HuXiYu
authored
about a year ago
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
let action = null ;
layui . config ({
base : "/js/" ,
version : 1
}). use ([ 'system' ], function () {
var form = layui . form ,
$ = layui . jquery ,
element = layui . element ,
table = layui . table ,
system = layui . system ,
sysU = new system . u (),
sendDataWhere = null ,
sendDataDescWhere = null ,
areaName = "configure" ,
controllerName = "BaseClientInfo" ,
app = null ;
action = {
addOptions : function () {
var options = {
fromId : "#modifyForm form" ,
url : ` / $ { areaName } /${controllerName}/ Ins ` ,
//sendDataWhere: null,
//isAddWhereExtend: "arbitrarily",
//mainTable: app.data.tableIns,
唐召明
authored
about a year ago
26
title : "<span style='color:red;'>(自动创建用户账号,保存后无法修改,请仔细核实【用户账号】信息)</span>" ,
HuXiYu
authored
about a year ago
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
submit : "submit(fromAdd)"
}
return options ;
},
editOptions : function () {
var options = {
fromId : "#modifyForm form" ,
url : ` / $ { areaName } /${controllerName}/ Upd ` ,
submit : "submit(fromUpdate)"
}
return options ;
},
deleteOptions : function () {
var options = {
url : ` / $ { areaName } /${controllerName}/ DelByIds ` ,
HuXiYu
authored
about a year ago
44
keyId : "keys"
HuXiYu
authored
about a year ago
45
46
47
48
49
50
51
52
53
}
return options ;
},
exportOptions : function () {
var options = {
fromId : "listForm" ,
url : ` / $ { areaName } /${controllerName}/ Export ` ,
isDefault : false ,
唐召明
authored
about a year ago
54
sendDataWhere : {},
HuXiYu
authored
about a year ago
55
56
57
58
59
60
61
62
63
64
65
66
67
68
excelCols : {
head : app . data . cols ,
body : app . data . colsDesc
}
}
return options ;
},
queryOptions : function () {
var options = {
resetFrom : "form[lay-filter=listForm]" ,
fromId : "listForm" ,
urlExport : ` / $ { areaName } /${controllerName}/ Export ` ,
urlQuery : ` / $ { areaName } /${controllerName}/ Load ` ,
唐召明
authored
about a year ago
69
sendDataWhere : {},
HuXiYu
authored
about a year ago
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
mainTable : app . data . tableIns
}
return options ;
},
/*rowClickOptions: function () {
var options = {
/ / 是否主子表
isDefault : true ,
targetTableId : app . data . tableElem ,
tabfilter : "tableTabBody" ,
tabId : 2 ,
customFn : app . methods . initTableDesc
}
return options ;
}, * /
uploadOptions: function () {
var options = {
url: `/ $ { areaName } /${controllerName}/ Import ` ,
fromFile : "#excelfile" ,
content : $ ( "#ImportData" )
}
return options ;
},
唐召明
authored
about a year ago
94
HuXiYu
authored
about a year ago
95
addBefore : function ( callBack ) {
唐召明
authored
about a year ago
96
let userAccountObj = document . getElementById ( 'userAccount' );
唐召明
authored
about a year ago
97
let defaultConfig = document . getElementById ( 'defaultConfig' );
赖素文
authored
about a year ago
98
let temp1 = 'form-readonly-color' ;
唐召明
authored
about a year ago
99
100
let temp2 = 'layui-hide' ;
唐召明
authored
about a year ago
101
userAccountObj . readOnly = false ;
唐召明
authored
about a year ago
102
103
104
105
106
107
108
if ( userAccountObj . classList . contains ( temp1 )) {
userAccountObj . classList . remove ( temp1 );
}
if ( defaultConfig . classList . contains ( temp2 )) {
defaultConfig . classList . remove ( temp2 );
}
HuXiYu
authored
about a year ago
109
110
111
112
113
114
115
116
//callBack是回调函数,如果editBefore有ajax 放在成功之后
if ( callBack != null ) callBack ();
},
addSaveBefore : function ( data , callBack ) {
if ( callBack != null ) callBack ();
},
editBefore : function ( data , callBack ) {
HuXiYu
authored
about a year ago
117
//data.enable = data.enable.toString();
唐召明
authored
about a year ago
118
let userAccountObj = document . getElementById ( 'userAccount' );
唐召明
authored
about a year ago
119
let defaultConfig = document . getElementById ( 'defaultConfig' );
赖素文
authored
about a year ago
120
let temp1 = 'form-readonly-color' ;
唐召明
authored
about a year ago
121
122
let temp2 = 'layui-hide' ;
唐召明
authored
about a year ago
123
userAccountObj . readOnly = true ;
唐召明
authored
about a year ago
124
125
126
127
128
129
130
if ( ! userAccountObj . classList . contains ( temp1 )) {
userAccountObj . classList . add ( temp1 );
}
if ( ! defaultConfig . classList . contains ( temp2 )) {
defaultConfig . classList . add ( temp2 );
}
HuXiYu
authored
about a year ago
131
132
133
134
135
136
137
138
form . val ( "modifyForm" , data );
if ( callBack != null ) callBack ();
},
editSaveBefore : function ( data , callBack ) {
if ( callBack != null ) callBack ();
},
checkboxMethod : function ( obj ) {
HuXiYu
authored
about a year ago
139
140
var page = "" . GetUrlParam ( "page" ),
userAccount = "" . GetUrlParam ( "userAccount" );
HuXiYu
authored
about a year ago
141
if ( page == "sysuser" ) {
HuXiYu
authored
about a year ago
142
var sendData = {
HuXiYu
authored
about a year ago
143
144
145
userAccount : userAccount ,
checkeds : obj . checked ,
clientKeys : obj . data . keys ,
HuXiYu
authored
about a year ago
146
147
148
};
var ajaxConfig = {
data : sendData ,
唐颖
authored
about a year ago
149
url : "/base/SysUser/BindUserClient" ,
HuXiYu
authored
about a year ago
150
151
152
success : function ( result ) {
if ( sysU . successBefore ( result )) return false ;
layer . msg ( result . Message );
HuXiYu
authored
about a year ago
153
sysU . refreshTable ( app , sysU , null , "main" );
HuXiYu
authored
about a year ago
154
155
156
157
158
}
};
sysU . ajax ( ajaxConfig );
}
},
HuXiYu
authored
about a year ago
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
BindClientProjects : function () {
var checkStatus = table . checkStatus ( 'mainList' ),
data = checkStatus . data ;
var edit = false ;
if ( data . length != 1 ) {
layer . msg ( "请选择客户管理的项目!" );
return ;
}
var url = ` / configure / BaseProject / Index ? menuFlag =- 2 & selectColKeyCustom = keys & page = BaseClientInfo & clientKeys = $ { data [ 0 ]. keys } ` ; //menuFlag=-2 菜单隐藏
var index = layer . open ({
title : "客户管理项目<span style='color:red'>请逐一勾选,禁止全选</span>" ,
area : [ "1000px" , "600px" ],
type : 2 ,
content : url ,
});
},
HuXiYu
authored
about a year ago
179
180
//所有动作成功之后
actionSuccess : ( flag ) => {
HuXiYu
authored
about a year ago
181
sysU . refreshTable ( app , sysU , null , flag );
HuXiYu
authored
about a year ago
182
183
184
185
186
187
188
189
190
191
192
193
},
closeAfter : function ( callBack ) {
if ( callBack != null ) callBack ();
}
}
app = {
data : {
cols : [[
{ checkbox : true , fixed : true },
{ field : "id" , width : 80 , hide : true , title : "Id" },
{ field : "keys" , width : 80 , hide : true , title : "Keys" },
赖素文
authored
about a year ago
194
{ field : "clientName" , width : 300 , title : "客户名称" },
赖素文
authored
about a year ago
195
{ field : "legalRepresentative" , width : 180 , title : "联系人" },
赖素文
authored
about a year ago
196
197
198
{ field : "projectUsers" , width : 200 , title : "关联的用户账号" },
{ field : "projectNames" , width : 200 , title : "关联的项目" },
HuXiYu
authored
about a year ago
199
200
{ field : "unifiedSocialCreditCode" , width : 150 , title : "统一社会信用代码" },
{ field : "businessRegistrationCode" , width : 150 , title : "工商注册号" },
赖素文
authored
about a year ago
201
HuXiYu
authored
about a year ago
202
203
204
{ field : "telephone" , width : 150 , title : "电话" },
{ field : "email" , width : 150 , title : "邮箱" },
{ field : "registeredAddress" , width : 150 , title : "注册地址" },
赖素文
authored
about a year ago
205
{ field : "setupDate" , width : 150 , title : "成立日期" , hide : true },
HuXiYu
authored
about a year ago
206
{ field : "remark" , width : 150 , title : "备注" },
唐召明
authored
about a year ago
207
208
{ field : "createBy" , width : 150 , title : "创建人" },
{ field : "createTime" , width : 150 , title : "创建时间" },
HuXiYu
authored
about a year ago
209
]],
唐召明
authored
about a year ago
210
colsDesc : null ,
HuXiYu
authored
about a year ago
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
tableIns : null ,
tableElem : "mainList" ,
tableInsDesc : null ,
tableElemDesc : "mainListDesc" ,
//下拉框配置
selectOption : {
//station: {
// SelType: "FromUrl",
// SelFrom: `/${areaName}/${controllerName}/StationLineSelect`,
// SelLabel: "workStationName",
// SelValue: "workStationCode",
// OptGroup: true,
// Dom: [$("[name='stationCode']")]
//},
//返回的数据 用于后续操作
selectData : {
}
}
},
methods : {
initTable : function ( opt ) {
var config = {};
if ( opt != undefined ) $ . extend ( config , opt );
let options = {
elem : "#" + app . data . tableElem ,
url : ` / $ { areaName } /${controllerName}/ Load ` ,
cols : sysU . columnRecord ( app . data . tableElem , app . data . cols ),
toolbar : '#toolbarTable' ,
唐召明
authored
about a year ago
241
where : config ,
HuXiYu
authored
about a year ago
242
243
//height: "full-56",//如果是主明细页签,列表主体高度要设置,否则分页导航不直观展示
doneExtend : function ( res , obj ) {
HuXiYu
authored
about a year ago
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
var pageFlag = "" . GetUrlParam ( "page" ),
userAccount = "" . GetUrlParam ( "userAccount" );
//加载用户绑定的客户
if ( pageFlag == "sysuser" ) {
let ajaxConfig = {
data : { userAccount : userAccount },
url : ` / base / SysUser / GetUserBindClient ` ,
success : function ( result ) {
if ( sysU . successBefore ( result )) return false ;
var targetArrValue = result . Result . map ( function ( e ) { return e . clientKeys ; });
var selectColKey = "" . GetUrlParam ( "selectColKeyCustom" );
sysU . SetTableCheck ( targetArrValue , res , selectColKey , app . data . tableElem );
}
};
sysU . ajax ( ajaxConfig );
}
HuXiYu
authored
about a year ago
260
261
262
263
264
265
}
}
app . data . tableIns = sysU . initTable ( options );
},
initSelectTable : function () {
唐召明
authored
about a year ago
266
var opt1 = {
HuXiYu
authored
about a year ago
267
268
269
270
271
272
273
274
275
elem : ".productCode" ,
checkedKey : "productCode" ,
doneKey : {
key : "productCode" ,
lableValue : "productName"
},
searchKey : "productCode" ,
searchName : "产品编码"
};
唐召明
authored
about a year ago
276
sysU . initSelectProduct ( opt1 );
HuXiYu
authored
about a year ago
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
},
initFrom () {
sysU . initSelect ( app . data . selectOption );
}
},
registerEvent : function () {
},
init : function () {
//var sendDataWhere = form.val("listForm")
app . methods . initTable ();
app . methods . initFrom ();
app . registerEvent ();
}
};
app . init ();
});