admin.js
9.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
var initApp=function(){
"use strict";
var ref = [
"xn.common",
"xn.service.interceptor",
"xn.directive.top",
"xn.admin.filter",
"xn.admin.service",
"xn.directive.loading",
"xn.directive.attachment",
"xn.directive.imgDisk",
"xn.page",
"xn.directive.calendar",
"xn.directive.location",
"xn.directive.card",
"xn.directive.select",
"xn.directive.approval",
"xn.directive.disk",
"ui.bootstrap",
"xn.directive.form"
];
var app =angular.module("xn", ref);
app.config(["$httpProvider", function ($httpProvider) {
$httpProvider.interceptors.push("httpInterceptor");
}]);
app.value("xnConfig", xnConfig);
app.config(["xnValidatorProvider", function (xnValidatorProvider) {
xnValidatorProvider.setRules({
/*角色创建和编辑的验证*/
roleName: {
required: "角色名称不能为空!"
},
/*设置默认密码的验证*/
passworddefault: {
required: "默认密码不能为空!",
maxlength: "密码长度不能大于14个字符!",
pattern: "密码强度不足,必须包含数字、字母或特殊符号中的两种,长度6-14位"
},
/*创建用户的验证*/
username: {
required: "用户姓名不能为空!"
},
useremail: {
required: "邮箱不能为空!",
pattern: "邮箱格式不正确!"
},
useraccount:{
required: "账号不能为空!"
},
usermobilePhone: {
pattern: "手机号码格式不正确,需要为11位,且应该以13,15,17,18开头!"
},
/*企业编辑的验证*/
tenantname:{
required: "公司名称不能为空!"
},
tenantfax: {
pattern: "传真格式不正确!"
},
tenantmobilePhone: {
pattern: "电话号码格式不正确"
},
tenantemailSuffix: {
maxlength: "邮箱后缀的长度过长,最多50",
pattern:"邮箱后缀格式不正确"
},
postCode : {
pattern: "邮编应为6位数字"
},
batchName : {
required: "推送备注不能为空!"
},
messageTitle:{
required: "消息标题不能为空!"
},
messageContent : {
required: "消息内容不能为空!"
},
mailTitle : {
required: "邮件标题不能为空!"
},
mailContent : {
required: "邮件内容不能为空!"
},
groupName : {
required: "群组名称不能为空!"
},
groupCode : {
required: "群组代码不能为空!"
},
accountName : {
required: "账号名称不能为空!"
},
wechatNumber : {
required: "微信号不能为空!"
},
accountType : {
required: "账号类型不能为空!"
},
appId : {
required: "应用ID不能为空!"
},
appKey : {
required: "帐号Key不能为空!"
},
appSecret : {
required: "应用密钥不能为空!"
},
voucherCode: {
required: "兑换码不能为空!"
},
processName :{
required: "流程名称不能为空!"
},
processCode :{
required: "流程代码不能为空!"
},
categoryName :{
required: "类别名称不能为空!"
},
attributeCode :{
pattern : "字段代码中只能包含英文字母!"
}
});
}]);
/**
*消息明细
*/
var messageDetailController =["$scope","$modalInstance","FoundationService", function ($scope,$modalInstance,FoundationService) {
var id = {id: $scope.messageDetailId};
//页面加载消息详细信息
$scope.getMessageDetail = function () {
FoundationService.getMessageDetail(id).success(function (data) {
$scope.messageDetail = data.message;
});
};
$scope.getMessageDetail();
$scope.doRead = function () {
$scope.messageReadIds = [];
$scope.messageReadIds.push($scope.messageDetailId);
console.log($scope.messageReadIds);
FoundationService.doRead($scope.messageReadIds).success(function () {
});
};
$scope.doRead();
$scope.cancel = function () {
$scope.getMessageList();
$modalInstance.dismiss("cancel");
};
}];
// 全局配置 form提交验证
app.config(["xnValidatorProvider", function (xnValidatorProvider) {
// 全局配置
xnValidatorProvider.config({
blurTrig : false,
showError : false,
removeError: false
});
}]);
app.controller("BodyController",["$scope", "$location","dialogService", "toolsService", function($scope, $location,dialogService, toolsService) {
$scope.global={loadingInit:false};
$scope.maxPageSize=5;
/*导航效果处理(一二级导航)*/
var navShow=''; /*临时存储*/
var subNavShow='';
$scope.$on("navShow",function(event ,show){
$scope.navShow=show;
navShow=show;
console.log(navShow)
});
/*二级导航*/
$scope.$on("subNavShow",function(event ,show){
$scope.subNavShow=show;
subNavShow=show;
});
$scope.navMouseenter=function (number) {
$scope.navShow=number;
$scope.subNavShow=null;
};
/*移出导航*/
$scope.cancelNav=function () {
$scope.navShow=navShow;
$scope.subNavShow=subNavShow;
};
$scope.cancelSubNav=function () {
$scope.subNavShow=null;
};
$scope.upFileClick=function(){
var upImportFileId=document.getElementById("upImportFileId");
upImportFileId.onchange=function(){
var upImportFile;
var upImportFileList =upImportFileId.files;
var upImportFilename;
if(upImportFileList){
upImportFile = upImportFileList[0];
upImportFilename=upImportFile.name;
}else{
upImportFilename =upImportFileId.value;
}
var str =upImportFilename.substr(upImportFilename.indexOf(".")+1);
if(str != "xls" && str != "xlsx"){
$("#upImportFile").val("");
dialogService.tip([{"message":"请上传Excel文件!" }]);
}else{
$("#upImportFile").val(upImportFilename);
}
};
};
//日期转换函数
Date.prototype.format = function(format){
var o = {
"M+" : this.getMonth()+1, //month
"d+" : this.getDate(), //day
"h+" : this.getHours(), //hour
"m+" : this.getMinutes(), //minute
"s+" : this.getSeconds(), //second
"q+" : Math.floor((this.getMonth()+3)/3), //quarter
"S" : this.getMilliseconds() //millisecond
};
if(/(y+)/.test(format)) format=format.replace(RegExp.$1,
(this.getFullYear()+"").substr(4 - RegExp.$1.length));
for(var k in o)if(new RegExp("("+ k +")").test(format))
format = format.replace(RegExp.$1,
RegExp.$1.length==1 ? o[k] :
("00"+ o[k]).substr((""+ o[k]).length));
return format;
};
//关闭错误
$scope.closeAlert = function (index,form) {
form.splice(index,1);
};
//常用数据
$scope.hours=[
{key:0,value:"00"},
{key:1,value:"01"},
{key:2,value:"02"},
{key:3,value:"03"},
{key:4,value:"04"},
{key:5,value:"05"},
{key:6,value:"06"},
{key:7,value:"07"},
{key:8,value:"08"},
{key:9,value:"09"},
{key:10,value:"10"},
{key:11,value:"11"},
{key:12,value:"12"},
{key:13,value:"13"},
{key:14,value:"14"},
{key:15,value:"15"},
{key:16,value:"16"},
{key:17,value:"17"},
{key:18,value:"18"},
{key:19,value:"19"},
{key:20,value:"20"},
{key:21,value:"21"},
{key:22,value:"22"},
{key:23,value:"23"}
];
}]);
};