commit | author | age
|
4d1219
|
1 |
layoutStrings = { |
B |
2 |
en: { |
|
3 |
}, |
|
4 |
zh: { |
|
5 |
title: "自定义表单设计引擎", |
|
6 |
saveButton: "保存", |
|
7 |
shareButton: "预览", |
|
8 |
} |
|
9 |
|
|
10 |
} |
|
11 |
var customBase = customBase || {}; |
|
12 |
customBase.uploaderTemp = 0; |
|
13 |
toastr.options = { |
|
14 |
closeButton: false, |
|
15 |
debug: false, |
|
16 |
progressBar: false, |
|
17 |
positionClass: "toast-top-center", |
|
18 |
onclick: null, |
|
19 |
showDuration: "300", |
|
20 |
hideDuration: "1000", |
|
21 |
timeOut: "2000", |
|
22 |
extendedTimeOut: "1000", |
|
23 |
showEasing: "swing", |
|
24 |
hideEasing: "linear", |
|
25 |
showMethod: "fadeIn", |
|
26 |
hideMethod: "fadeOut", |
|
27 |
} |
|
28 |
|
|
29 |
//customBase.query_set_value = function(itemId,type,value,num){ |
|
30 |
// |
|
31 |
// var itemvalue; |
|
32 |
// if(num != undefined){ |
|
33 |
// itemvalue = customBase.getItemValue(itemId,type)[num]; |
|
34 |
// }else{ |
|
35 |
// itemvalue = customBase.getItemValue(itemId,type); |
|
36 |
// } |
|
37 |
// if(value == 8888){ |
|
38 |
// ////console.log(itemvalue) |
|
39 |
// } |
|
40 |
// if(itemvalue == undefined || itemvalue == '' || itemvalue == 0){ |
|
41 |
// customBase.setItemValue(itemId,type,value,"","",num); |
|
42 |
// } |
|
43 |
//} |
|
44 |
|
|
45 |
//customBase.submitForm = function(){ |
|
46 |
// ////console.log(window.customBase); |
|
47 |
// ////console.log(window.customShow); |
|
48 |
// var submit_data = { |
|
49 |
// "formId":customShow.options.formid, |
|
50 |
// "dataRowNUm":customShow.options.dataRowNum |
|
51 |
// }; |
|
52 |
// |
|
53 |
// var submit_request = window.commonAjax("/datamanagement/getBudget",submit_data,"POST",true); |
|
54 |
// submit_request.done(function(res){ |
|
55 |
// |
|
56 |
// }) |
|
57 |
//} |
|
58 |
// 2017/10/17 李元杰 点击计算费用后 msgInfo渲染 |
|
59 |
|
|
60 |
customBase.groupInfo = function (_data) { |
|
61 |
var groupTitle, |
|
62 |
groupData |
|
63 |
var container = $('#itemId_12subform').append('<div class="container"></div>') |
|
64 |
var subform = $('#itemId_12subform .container'); |
|
65 |
// 点击后先清空在渲染页面数据 |
|
66 |
subform.empty(); |
|
67 |
for (var i = 0; i < _data.msgInfo.length; i++) { |
|
68 |
subform.append(`<li style="position: relative;float:left;"></li>`); |
|
69 |
groupTitle = `<span style="color:${_data.msgInfo[i].groupColor}">${_data.msgInfo[i].groupName}</span>` |
|
70 |
subform.find("li").eq(i).append(groupTitle); |
|
71 |
subform.find("li").eq(i).append("<div class='ulContent'></div>"); |
|
72 |
for (var j = 0; j < _data.msgInfo[i].groupData.length; j++) { |
|
73 |
subform.find("li").eq(i).find('.ulContent').append(`<div style="color:${_data.msgInfo[i].groupColor}" >${_data.msgInfo[i].groupData[j].data}</div>`) |
|
74 |
} |
|
75 |
} |
|
76 |
} |
|
77 |
//customBase.listen_check = function(res_data,classname){// 实时验证 |
|
78 |
// var customBase = window.customBase; |
|
79 |
// var customShow = window.customShow; |
|
80 |
// // 2017/10/17 李元杰 msgInfo渲染 |
|
81 |
// customBase.groupInfo(res_data) |
|
82 |
//// ////console.log(window.customBase); |
|
83 |
// _.each(res_data.data,function(redata){ |
|
84 |
// var cu_item = customBase.options.customItems[redata.fieldKey]; |
|
85 |
// ////console.log(cu_item) |
|
86 |
// if(cu_item != undefined && cu_item.type != "dropdownlist" && cu_item.type != "subform"){ |
|
87 |
// customBase.query_set_value(cu_item.id,cu_item.type,redata.value); |
|
88 |
// } |
|
89 |
// |
|
90 |
// var base_item = $("[fieldKey='" + redata.fieldKey + "']"); |
|
91 |
// if(base_item.length > 0){ |
|
92 |
// var base_item_id = base_item.attr('id'); |
|
93 |
// var base_item_type = base_item.attr('type'); |
|
94 |
// if(redata.type != "subform"){ |
|
95 |
// $("#"+base_item_id+"ActiveId").find("." + classname).remove(); |
|
96 |
// if(redata.msgInfo){ |
|
97 |
// var check_minfo = undefined; |
|
98 |
// _.each(redata.msgInfo.header,function(minfo){ |
|
99 |
// if(minfo.validate){ |
|
100 |
// //console.log(minfo) |
|
101 |
// $("#"+base_item_id+"ActiveId").find("h8[name='el_title']").append("<span class='" + classname + "'>" + minfo.name + ":" + minfo.value + "</span>"); |
|
102 |
// check_minfo = minfo; |
|
103 |
// }else{ |
|
104 |
// $("#"+base_item_id+"ActiveId").find("h8[name='el_title']").append("<span class='" + classname + "'>" + minfo.name + ":" + minfo.value + "</span>"); |
|
105 |
// } |
|
106 |
// }); |
|
107 |
// if(check_minfo != undefined){ |
|
108 |
// customBase.bind_check(base_item_id,base_item_type,check_minfo,classname); |
|
109 |
// $("#"+base_item_id).on('change', function(){ |
|
110 |
// customBase.bind_check(base_item_id,base_item_type,check_minfo,classname); |
|
111 |
// }); |
|
112 |
// } |
|
113 |
// } |
|
114 |
// }else{ |
|
115 |
// $("#"+base_item_id+"ActiveId").find("." + classname).remove(); |
|
116 |
// if(redata.msgInfo){ |
|
117 |
// _.each(redata.msgInfo.header,function(minfo){ |
|
118 |
// $("#"+base_item_id+"ActiveId").find("h8[name='el_title']").append("<span class='" + classname + "'>" + minfo.name + ":" + minfo.value + "</span>"); |
|
119 |
// }); |
|
120 |
// } |
|
121 |
// var sub_type = customShow.options.customItemShow.item[base_item_id].tag_Attribute.allcopy; |
|
122 |
//// ////console.log(sub_type); |
|
123 |
// _.each(redata.child,function(recd,i){ |
|
124 |
// _.each(recd.items,function(recd_item){ |
|
125 |
// ////console.log(recd_item); |
|
126 |
// ////console.log(customShow.options.customItemShow); |
|
127 |
// var cu_cd_item = customBase.options.customItems[recd_item.fieldKey]; |
|
128 |
// ////console.log(cu_cd_item); |
|
129 |
// if(cu_cd_item != undefined && cu_cd_item.type != "dropdownlist"){ |
|
130 |
// customBase.query_set_value(cu_cd_item.id,cu_cd_item.type,recd_item.value,i); |
|
131 |
// } |
|
132 |
// |
|
133 |
// var base_item_cd = $("[fieldKey='" + recd_item.fieldKey + "']:eq('" + i + "')"); |
|
134 |
// var base_item_id_cd = base_item_cd.attr('id'); |
|
135 |
// var base_item_type_cd = base_item_cd.attr('type'); |
|
136 |
//// ////console.log(base_item_cd); |
|
137 |
//// ////console.log(base_item_id_cd); |
|
138 |
//// ////console.log(base_item_type_cd); |
|
139 |
//// ////console.log(recd_item); |
|
140 |
// if(sub_type){ |
|
141 |
// $("[id='"+base_item_id_cd+"ActiveId']:eq('" + i + "')").find("." + classname).remove(); |
|
142 |
// }else{ |
|
143 |
// $("[id='"+base_item_id_cd+"']:eq('" + i + "')").closest("tr").find("p").remove(); |
|
144 |
// } |
|
145 |
// |
|
146 |
// if(recd_item.msgInfo){ |
|
147 |
// var check_minfo_cd = undefined; |
|
148 |
// _.each(recd_item.msgInfo.header,function(minfo_cd){ |
|
149 |
//// ////console.log($("#"+base_item_id_cd+"ActiveId")); |
|
150 |
//// ////console.log($("[id='"+base_item_id_cd+"ActiveId']:eq('" + i + "')")); |
|
151 |
// if(minfo_cd.validate){ |
|
152 |
// check_minfo_cd = minfo_cd; |
|
153 |
// if(sub_type){ |
|
154 |
// $("[id='"+base_item_id_cd+"ActiveId']:eq('" + i + "')").find("h8[name='el_title']").append("<span class='" + classname + "'>" + minfo_cd.name + ":" + minfo_cd.value + "</span>"); |
|
155 |
// }else{ |
|
156 |
// customBase.set_p($("[id='"+base_item_id_cd+"']:eq('" + i + "')")); |
|
157 |
// $("[id='"+base_item_id_cd+"']:eq('" + i + "')").prev("p").append("<span class='" + classname + "'>" + minfo_cd.name + ":" + minfo_cd.value + "</span>"); |
|
158 |
// } |
|
159 |
// }else{ |
|
160 |
// if(sub_type){ |
|
161 |
// $("[id='"+base_item_id_cd+"ActiveId']:eq('" + i + "')").find("h8[name='el_title']").append("<span class='" + classname + "'>" + minfo_cd.name + ":" + minfo_cd.value + "</span>"); |
|
162 |
// }else{ |
|
163 |
// customBase.set_p($("[id='"+base_item_id_cd+"']:eq('" + i + "')")); |
|
164 |
// $("[id='"+base_item_id_cd+"']:eq('" + i + "')").prev("p").append("<span class='" + classname + "'>" + minfo_cd.name + ":" + minfo_cd.value + "</span>"); |
|
165 |
// } |
|
166 |
// } |
|
167 |
// }); |
|
168 |
// if(check_minfo_cd != undefined){ |
|
169 |
// customBase.bind_check(base_item_id_cd,base_item_type_cd,check_minfo_cd,classname,sub_type,i); |
|
170 |
// $("[id='"+base_item_id_cd+"']:eq('" + i + "')").on('change', function(){ |
|
171 |
// customBase.bind_check(base_item_id_cd,base_item_type_cd,check_minfo_cd,classname,sub_type,i); |
|
172 |
// }); |
|
173 |
// } |
|
174 |
// } |
|
175 |
// }); |
|
176 |
// }); |
|
177 |
// } |
|
178 |
// } |
|
179 |
// |
|
180 |
// }); |
|
181 |
// |
|
182 |
// |
|
183 |
// |
|
184 |
// |
|
185 |
//// _.each(res_data,function(redata){ |
|
186 |
//// var base_item = $("[fieldKey='" + redata.fieldKey + "']"); |
|
187 |
//// if(base_item.length > 0){ |
|
188 |
//// var base_item_id = base_item.attr('id'); |
|
189 |
//// var base_item_type = base_item.attr('type'); |
|
190 |
//// ////console.log(base_item_id); |
|
191 |
//// ////console.log($("#"+base_item_id+"ActiveId").find(".listen_check")); |
|
192 |
//// if($("#"+base_item_id+"ActiveId").find(".listen_check").length == 0){ |
|
193 |
//// $("#"+base_item_id+"ActiveId").find("h8[name='el_title']").append("<span class='listen_check'>" + redata.amount + "</span>"); |
|
194 |
//// }else{ |
|
195 |
//// $("#"+base_item_id+"ActiveId").find(".listen_check").html(redata.amount); |
|
196 |
//// } |
|
197 |
//// var now_value_s = customBase.getItemValue(base_item_id,base_item_type); |
|
198 |
//// $("#"+base_item_id+"ActiveId").find(".listen_check").css("color","#333"); |
|
199 |
//// if(now_value_s != redata.amount){ |
|
200 |
//// $("#"+base_item_id+"ActiveId").find(".listen_check").css("color","red"); |
|
201 |
//// } |
|
202 |
//// $("#"+base_item_id).on('change', function(){ |
|
203 |
//// var now_value = customBase.getItemValue(base_item_id,base_item_type); |
|
204 |
//// $("#"+base_item_id+"ActiveId").find(".listen_check").css("color","#333"); |
|
205 |
//// if(now_value != redata.amount){ |
|
206 |
//// $("#"+base_item_id+"ActiveId").find(".listen_check").css("color","red"); |
|
207 |
//// } |
|
208 |
//// }); |
|
209 |
//// } |
|
210 |
//// }); |
|
211 |
//} |
|
212 |
|
|
213 |
//customBase.bind_check = function(base_item_id,base_item_type,minfo,classname,sub_type,i){//验证方法 |
|
214 |
// if( i != undefined){ |
|
215 |
// if(i == 0){ |
|
216 |
// var now_value = customBase.getItemValue(base_item_id, base_item_type); |
|
217 |
// }else{ |
|
218 |
// var now_value = customBase.getItemValue(base_item_id, base_item_type)[i]; |
|
219 |
// } |
|
220 |
// ////console.log(base_item_id); |
|
221 |
// ////console.log($("#" + base_item_id + "ActiveId")); |
|
222 |
// ////console.log($("[id='"+base_item_id+"ActiveId']:eq('" + i + "')")); |
|
223 |
// if(sub_type){ |
|
224 |
// $("[id='"+base_item_id+"ActiveId']:eq('" + i + "')").find("." + classname).css("color", "#333"); |
|
225 |
// if(now_value != minfo.value) { |
|
226 |
// $("[id='"+base_item_id+"ActiveId']:eq('" + i + "')").find("." + classname).css("color", "red"); |
|
227 |
// } |
|
228 |
// }else{ |
|
229 |
// $("[id='"+base_item_id+"']:eq('" + i + "')").prev("p").find("." + classname).css("color", "#333"); |
|
230 |
// if(now_value != minfo.value) { |
|
231 |
// $("[id='"+base_item_id+"']:eq('" + i + "')").prev("p").find("." + classname).css("color", "red"); |
|
232 |
// } |
|
233 |
// } |
|
234 |
// |
|
235 |
// }else{ |
|
236 |
// var now_value = customBase.getItemValue(base_item_id, base_item_type); |
|
237 |
// $("#" + base_item_id + "ActiveId").find("." + classname).css("color", "#333"); |
|
238 |
// if(now_value != minfo.value) { |
|
239 |
// $("#" + base_item_id + "ActiveId").find("." + classname).css("color", "red"); |
|
240 |
// } |
|
241 |
// } |
|
242 |
//} |
|
243 |
|
|
244 |
//customBase.set_p = function(item){ |
|
245 |
// var p_height = "19.2px"; |
|
246 |
// if(item.closest("tr").find("p").length == 0){ |
|
247 |
// var item_td = item.closest("tr").find("td"); |
|
248 |
// item_td.each(function(){ |
|
249 |
// $(this).prepend("<p style='height:" + p_height + "'></p>") |
|
250 |
// }); |
|
251 |
// } |
|
252 |
//} |
|
253 |
customBase.options = { |
|
254 |
customItems: {}, |
|
255 |
uploaderItem: {}, |
|
256 |
uploaderItemReady: {}, |
|
257 |
uploaderFile: {}, |
|
258 |
fileuuid: "", |
|
259 |
dropdownlistText: {}, |
|
260 |
uploaderFileName: {}, |
|
261 |
formbaseInfo: "", |
|
262 |
zTreeOnClickItems: {} |
|
263 |
} |
|
264 |
//项目编辑(设定及取得值) |
|
265 |
customBase.itemEdit = { |
|
266 |
//单行文本 |
|
267 |
text: { |
|
268 |
getItem: function (itemId) { |
|
269 |
itemReturn = []; |
|
270 |
var items = $(itemId); |
|
271 |
for (var i = 0; i < items.length; i++) { |
|
272 |
itemReturn[i] = items[i].value; |
|
273 |
}; |
|
274 |
if (itemReturn.length == 1) { |
|
275 |
return itemReturn[0]; |
|
276 |
} else { |
|
277 |
return itemReturn; |
|
278 |
} |
|
279 |
|
|
280 |
}, |
|
281 |
setItem: function (itemId, value, showClass) { |
|
282 |
if (showClass == undefined) { |
|
283 |
showClass = 'customViewUEditorCss'; |
|
284 |
} |
|
285 |
if (value == null) { |
|
286 |
value = ""; |
|
287 |
} |
|
288 |
var itemL = $("." + showClass + " " + itemId).length; |
|
289 |
if (itemL > value.length) { |
|
290 |
itemL = value.length; |
|
291 |
} |
|
292 |
if (itemL == 1) { |
|
293 |
if ('customShow' == showClass) { |
|
294 |
$("." + showClass).find(itemId)[0].setAttribute("readonly", "readonly"); |
|
295 |
} |
|
296 |
$("." + showClass).find(itemId)[0].value = value; |
|
297 |
} else if (itemL == 0) { |
|
298 |
for (var i = 0; i < $("." + showClass + " " + itemId).length; i++) { |
|
299 |
if ('customShow' == showClass) { |
|
300 |
$("." + showClass + " " + itemId)[i].setAttribute("readonly", "readonly"); |
|
301 |
} |
|
302 |
$("." + showClass + " " + itemId)[i].value = value; |
|
303 |
}; |
|
304 |
} else { |
|
305 |
for (var i = 0; i < itemL; i++) { |
|
306 |
if ('customShow' == showClass) { |
|
307 |
$("." + showClass + " " + itemId)[i].setAttribute("readonly", "readonly"); |
|
308 |
} |
|
309 |
$("." + showClass + " " + itemId)[i].value = value[i] |
|
310 |
}; |
|
311 |
} |
13ec33
|
312 |
|
4d1219
|
313 |
}, |
B |
314 |
}, |
|
315 |
//单选按钮组 |
|
316 |
checkboxRadio: { |
|
317 |
getItem: function (itemId, type) { |
|
318 |
var itemList = $("." + itemId + "value"); |
|
319 |
var itemListReturn = []; |
|
320 |
// 数组循环取得 |
|
321 |
for (var j = 0; j < itemList.length; j++) { |
|
322 |
|
|
323 |
if (type == "radio") { |
|
324 |
var items = $(itemList[j]).find(".custom-radio"); |
|
325 |
} else { |
|
326 |
var items = $(itemList[j]).find(".custom-check"); |
|
327 |
} |
|
328 |
var checkItem = []; |
|
329 |
var z = 0; |
|
330 |
for (var i = 0; i < items.length; i++) { |
|
331 |
if (items[i].className.indexOf("cur") > 0) { |
|
332 |
checkItem[z] = items[i].getAttribute("value"); |
|
333 |
z++; |
|
334 |
} else { |
|
335 |
} |
|
336 |
}; |
|
337 |
itemListReturn[j] = checkItem; |
|
338 |
z++; |
|
339 |
}; |
|
340 |
return itemListReturn; |
|
341 |
}, |
|
342 |
setItem: function (itemId, type, value, showClass) { |
|
343 |
//被选择项目设定 |
|
344 |
checkboxRadioItem = function (itemList, value) { |
|
345 |
console.log(itemList) |
|
346 |
if (typeof value == "string") { |
|
347 |
value = [value]; |
|
348 |
} |
|
349 |
for (var i = 0; i < itemList.length; i++) { |
|
350 |
for (var j = 0; j < value.length; j++) { |
|
351 |
if (value[j] == itemList[i].getAttribute("value")) { |
|
352 |
|
|
353 |
$(itemList[i]).addClass('cur'); |
|
354 |
} |
|
355 |
} |
|
356 |
} |
|
357 |
} |
|
358 |
var itemL = $("." + showClass + " ." + itemId + "value"); |
|
359 |
if (typeof value == "string") { |
|
360 |
value = [value]; |
|
361 |
} |
|
362 |
|
|
363 |
//数据赋值 |
|
364 |
for (var i = 0; i < itemL.length; i++) { |
|
365 |
var valueTemp = value[i]; |
|
366 |
if (type == "radio") { |
|
367 |
var items = $(itemL[i]).find(".custom-radio"); |
|
368 |
} else { |
|
369 |
var items = $(itemL[i]).find(".custom-check"); |
|
370 |
} |
|
371 |
items.removeClass('cur'); |
|
372 |
checkboxRadioItem(items, valueTemp) |
|
373 |
} |
|
374 |
}, |
|
375 |
}, |
|
376 |
//复选框组 |
|
377 |
checkbox: { |
|
378 |
getItem: function (itemId) { |
|
379 |
var checkItem = ""; |
|
380 |
if ($(itemId)[0] != undefined) { |
|
381 |
checkItem = $(itemId)[0].className.replace("custom-check", ""); |
|
382 |
} |
|
383 |
if (checkItem.indexOf("cur") > 0) { |
|
384 |
checkItem = true; |
|
385 |
} else { |
|
386 |
checkItem = false; |
|
387 |
} |
|
388 |
return checkItem; |
|
389 |
}, |
|
390 |
setItem: function (itemId, value) { |
|
391 |
if (value) { |
|
392 |
$(itemId).addClass('cur') |
|
393 |
} else { |
|
394 |
$(itemId).removeClass('cur'); |
|
395 |
} |
|
396 |
}, |
|
397 |
}, |
|
398 |
// HTML内容 |
|
399 |
htmlediter: { |
|
400 |
getItem: function (itemId) { |
|
401 |
itemId = itemId + "Item"; |
|
402 |
return UE.getEditor(itemId).getContent(); |
|
403 |
}, |
|
404 |
setItem: function (itemId, value, showClass) { |
449a85
|
405 |
itemId = itemId+"Item"; |
L |
406 |
console.log(value) |
|
407 |
var rValue = value.join(",");//html回显bug修改 李伟民 0201 |
|
408 |
if(showClass ==undefined){ |
|
409 |
showClass = 'customViewUEditorCss'; |
|
410 |
} |
|
411 |
UE.getEditor(itemId).ready(function(){ |
|
412 |
UE.getEditor(itemId).setContent(rValue); |
|
413 |
}); |
4d1219
|
414 |
|
B |
415 |
}, |
|
416 |
}, |
|
417 |
dropdownlistView: { |
|
418 |
getItem: function (itemId) { |
|
419 |
return $(itemId).select2("val"); |
|
420 |
}, |
|
421 |
setItem: function (itemId, value) { |
|
422 |
if (value) { |
|
423 |
$(itemId).select2("val", value); |
|
424 |
} else { |
|
425 |
$('.selectItme').attr('value', ""); |
|
426 |
$('.val-card').remove(); |
|
427 |
} |
|
428 |
}, |
|
429 |
}, |
|
430 |
dropdownlist: { |
|
431 |
getItem: function (itemId) { |
|
432 |
return $(itemId).select2("val"); |
|
433 |
}, |
|
434 |
setItem: function (itemId, value) { |
|
435 |
if (value) { |
|
436 |
$(itemId).select2("val", value); |
|
437 |
} else { |
|
438 |
$('.selectItme').attr('value', ""); |
|
439 |
$('.val-card').remove(); |
|
440 |
} |
|
441 |
}, |
|
442 |
}, |
|
443 |
// 下拉框(文本取得) |
|
444 |
dropdownlistText: { |
|
445 |
getItem: function (itemId) { |
|
446 |
var itemList = $(".customViewUEditorCss ." + itemId + "value"); |
|
447 |
var itemListReturn = []; |
|
448 |
var select2ItemList = customBase.options.dropdownlistText[itemId]; |
|
449 |
for (var i = 0; i < itemList.length; i++) { |
|
450 |
var select2Item = $(itemList[i]).select2("data"); |
|
451 |
var items = []; |
|
452 |
for (var j = 0; j < select2Item.length; j++) { |
|
453 |
for (var z = 0; z < select2ItemList.length; z++) { |
|
454 |
if (select2ItemList[z].text == select2Item[j].text) { |
|
455 |
items[j] = select2ItemList[z].value; |
|
456 |
} |
|
457 |
} |
|
458 |
// items[j] = select2Item[j].text; |
|
459 |
}; |
|
460 |
itemListReturn[i] = items; |
|
461 |
}; |
|
462 |
|
|
463 |
return itemListReturn; |
|
464 |
}, |
|
465 |
setItem: function (itemId, value, showClass, dropdowntype) { |
|
466 |
console.log(value) |
|
467 |
// var select2Item = customBase.options.dropdownlistText[itemId]; |
|
468 |
// //单多选框数据设定 |
|
469 |
// //2017/10/27 马习同修改 |
|
470 |
// var customItem = customBase.options.customItems; |
|
471 |
// var itemAttr = ""; |
|
472 |
// for(let key in customItem){ |
|
473 |
// if(customItem[key].id == itemId){ |
|
474 |
// itemAttr = customItem[key]; |
|
475 |
// } |
|
476 |
// } |
|
477 |
// console.log(_.cloneDeep(customItem)) |
|
478 |
// console.log(itemAttr); |
|
479 |
// //2017/10/27 马习同修改 |
|
480 |
// setelect2Item = function (itemId,value){ |
|
481 |
// if(typeof value == "string"){ |
|
482 |
// value = [value]; |
|
483 |
// } |
|
484 |
// var itemsTemp = []; |
|
485 |
// for (var i = 0; i < value.length; i++) { |
|
486 |
// for (var j = 0; j < select2Item.length; j++) { |
|
487 |
// if(select2Item[j].value == value[i]){ |
|
488 |
// var id = select2Item[j].id; |
|
489 |
// itemsTemp[i] = id; |
|
490 |
// } |
|
491 |
// }; |
|
492 |
// } |
|
493 |
// $(itemId).val(itemsTemp).trigger("change"); |
|
494 |
// } |
|
495 |
// //多个下拉菜单 马习同 |
|
496 |
// var itemList = $("."+showClass+" #itemId_"+itemAttr.parentsubFormNum+" ."+itemId+"value"); |
|
497 |
// var itemList1 = $("."+showClass+" ."+itemId+"value"); |
|
498 |
// console.log(itemList); |
|
499 |
// console.log(itemList1); |
|
500 |
// console.log(value) |
|
501 |
// if(itemList.length ==1){ |
|
502 |
// setelect2Item(itemList[0],value); |
|
503 |
// }else{ |
|
504 |
// for (var i = 0; i < itemList.length; i++) { |
|
505 |
// console.log(value) |
|
506 |
// console.log(itemList[i],value[i]) |
|
507 |
// setelect2Item(itemList1[i],value[i]); |
|
508 |
// } |
|
509 |
// } |
|
510 |
// |
|
511 |
//原代码 |
|
512 |
// var select2Item = customBase.options.dropdownlistText[itemId]; |
|
513 |
// //单多选框数据设定 |
|
514 |
// setelect2Item = function (itemId,value){ |
|
515 |
// if(typeof value == "string"){ |
|
516 |
// value = [value]; |
|
517 |
// } |
|
518 |
// var itemsTemp = []; |
|
519 |
// for (var i = 0; i < value.length; i++) { |
|
520 |
// for (var j = 0; j < select2Item.length; j++) { |
|
521 |
// if(select2Item[j].value == value[i]){ |
|
522 |
// var id = select2Item[j].id; |
|
523 |
// itemsTemp[i] = id; |
|
524 |
// } |
|
525 |
// }; |
|
526 |
// } |
|
527 |
// $(itemId).val(itemsTemp).trigger("change"); |
|
528 |
// } |
|
529 |
// //多个下拉菜单 |
|
530 |
// var itemList = $("."+showClass+" ."+itemId+"value"); |
|
531 |
// if(itemList.length ==1){ |
|
532 |
// setelect2Item(itemList[0],value); |
|
533 |
// }else{ |
|
534 |
// |
|
535 |
// for (var i = 0; i < itemList.length; i++) { |
|
536 |
// setelect2Item(itemList[i],value[i]); |
|
537 |
// } |
|
538 |
// } |
|
539 |
}, |
|
540 |
}, |
|
541 |
dropdownlistText2: { |
|
542 |
getItem: function (itemId) { |
|
543 |
// var itemList = $(".customViewUEditorCss ."+itemId+"value"); |
|
544 |
// var itemListReturn =[]; |
|
545 |
// var select2ItemList = customBase.options.dropdownlistText[itemId]; |
|
546 |
// for (var i = 0; i < itemList.length; i++) { |
|
547 |
// var select2Item = $(itemList[i]).select2("data"); |
|
548 |
// var items = []; |
|
549 |
// for (var j = 0; j < select2Item.length; j++) { |
|
550 |
// for(var z=0;z<select2ItemList.length;z++){ |
|
551 |
// if(select2ItemList[z].text == select2Item[j].text){ |
|
552 |
// items[j] = select2ItemList[z].value; |
|
553 |
// } |
|
554 |
// } |
|
555 |
// // items[j] = select2Item[j].text; |
|
556 |
// }; |
|
557 |
// itemListReturn[i] = items; |
|
558 |
// }; |
|
559 |
var itemListReturn = xhSelect.getValue(itemId); |
|
560 |
return itemListReturn; |
|
561 |
}, |
|
562 |
setItem: function (itemId, value, showClass, dropdowntype) { |
|
563 |
//2017/10/27 马习同修改 |
|
564 |
console.log(value); |
|
565 |
var customItem = customBase.options.customItems; |
|
566 |
var itemAttr = ""; |
|
567 |
for (let key in customItem) { |
|
568 |
if (customItem[key].id == itemId) { |
|
569 |
itemAttr = customItem[key]; |
|
570 |
} |
|
571 |
} |
|
572 |
//2017/10/27 马习同修改 |
|
573 |
|
|
574 |
var select2Item = customBase.options.dropdownlistText[itemId]; |
|
575 |
if (itemAttr.parentsubFormNum != 0) {//非子表单中 无需添加parentformnum 李伟民 11-14 |
|
576 |
var itemList = $("#itemId_" + itemAttr.parentsubFormNum + " #" + itemId); |
|
577 |
} else { |
|
578 |
var itemList = $("#" + itemId); |
|
579 |
} |
|
580 |
console.log(itemList); |
|
581 |
if (itemList.length == 1) { |
|
582 |
// setelect2Item(itemId,value,0); |
|
583 |
xhSelect.setValue(itemId, value, 0) |
|
584 |
} else { |
|
585 |
|
|
586 |
for (var i = 0; i < itemList.length; i++) { |
|
587 |
// setelect2Item(itemId,value[i],i); |
|
588 |
xhSelect.setValue(itemId, value[i], i) |
|
589 |
} |
|
590 |
} |
|
591 |
|
|
592 |
}, |
|
593 |
}, |
|
594 |
// 下拉框(值取得) |
|
595 |
dropdownlisVal: { |
|
596 |
getItem: function (itemId) { |
|
597 |
var itemList = $("." + itemId + "value"); |
|
598 |
var itemListReturn = []; |
|
599 |
for (var i = 0; i < itemList.length; i++) { |
|
600 |
var select2Item = $(itemList[i]).select2("val"); |
|
601 |
var items = []; |
|
602 |
for (var j = 0; j < select2Item.length; j++) { |
|
603 |
items[j] = select2Item[j].text; |
|
604 |
}; |
|
605 |
itemListReturn[i] = items; |
|
606 |
}; |
|
607 |
return itemListReturn; |
|
608 |
}, |
|
609 |
setItem: function (itemId, value) { |
|
610 |
$(itemId).select2("val", value); |
|
611 |
}, |
|
612 |
}, |
|
613 |
//文件上传 图片 |
|
614 |
fileupload: { //-------------todo------------------ |
|
615 |
getItem: function (itemId) { |
|
616 |
var fileReturn = {}; |
|
617 |
for (i in customBase.options.uploaderItem[itemId]) { |
|
618 |
if (customBase.options.uploaderItem[itemId].hasOwnProperty(i)) { |
|
619 |
var timestamp = new Date().getTime(); |
|
620 |
var idt = i.replace("WU", timestamp); |
|
621 |
fileReturn[idt] = customBase.options.uploaderItem[itemId][i]; |
|
622 |
// fileReturn.push(customBase.options.uploaderItemReady[itemId][i]); |
|
623 |
} |
|
624 |
}; |
|
625 |
//////console.log(fileReturn); |
|
626 |
return fileReturn; |
|
627 |
}, |
|
628 |
setItem: function (itemId, value) { |
|
629 |
//无此情况 |
|
630 |
}, |
|
631 |
}, |
|
632 |
tree: { //-------------todo------------------ |
|
633 |
getItem: function (itemId) { |
|
634 |
|
|
635 |
var returnItem = []; |
|
636 |
var treeItem = $('div#' + itemId); |
|
637 |
var dataItemJSson; |
|
638 |
for (var i = 0; i < treeItem.length; i++) { |
|
639 |
if (treeItem[i].getAttribute("value") == "") { |
|
640 |
var treeItem = {}; |
|
641 |
} else { |
|
642 |
////console.log(selectItme[i].getAttribute("value")); |
|
643 |
dataItemJSson = $.parseJSON(treeItem[i].getAttribute("value")); |
|
644 |
} |
|
645 |
|
|
646 |
var jn = 0; |
|
647 |
returnItem[i] = []; |
|
648 |
for (j in dataItemJSson) { |
|
649 |
returnItem[i][jn] = j; |
|
650 |
jn++; |
|
651 |
} |
|
652 |
} |
|
653 |
return returnItem; |
|
654 |
}, |
|
655 |
setItem: function (itemId, value) { |
|
656 |
var treeDiv = $('div#' + itemId); |
|
657 |
console.log(value) |
|
658 |
// 判断是否在子表单内 |
|
659 |
var isSubformTree = false; |
|
660 |
_.forIn(customShow.options.customItemShow.item, function (value, key) { |
|
661 |
if (value.tag_Id == itemId && value.parentsubFormNum != 0) { |
|
662 |
isSubformTree = true; |
|
663 |
} |
|
664 |
}); |
13ec33
|
665 |
|
4d1219
|
666 |
// 不在子表单内的树 |
B |
667 |
if (!isSubformTree) { |
|
668 |
var dataObj = {} |
|
669 |
var valueData = []; |
|
670 |
// 更新数据的时候需要在div上绑定一个存储数据的value |
|
671 |
// 单选 |
|
672 |
if(value) |
|
673 |
console.log(value); |
|
674 |
// if(value == ' '){ |
|
675 |
// if(value == ' '){ |
|
676 |
// value = window.localStorage.getItem('businessTypeAuto'); |
|
677 |
// } |
|
678 |
// }else{ |
|
679 |
if (typeof value == "string") { |
|
680 |
dataObj[value] = '1' |
|
681 |
} else { |
|
682 |
for (var j = 0; j < value.length; j++) { |
|
683 |
valueData[j] = value[j].split(',') |
|
684 |
dataObj[valueData[j]] = '1' |
|
685 |
} |
|
686 |
} |
|
687 |
$('#' + itemId).attr('value', JSON.stringify(dataObj)) |
|
688 |
console.log(value) |
|
689 |
console.log(itemId) |
|
690 |
var b = $('#'+itemId + "tree") |
|
691 |
console.log($('#'+itemId + "tree")) |
|
692 |
var treeObj = $.fn.zTree.getZTreeObj(itemId + "tree"); |
|
693 |
console.log(treeObj) |
|
694 |
if (treeObj == null) { |
|
695 |
return; |
|
696 |
} |
|
697 |
if (typeof value == "string") { |
|
698 |
value = [value]; |
|
699 |
} |
|
700 |
// 2017/11/6 回显的地方 |
|
701 |
for (var i = 0, l = value.length; i < l; i++) { |
|
702 |
if (treeObj.setting.check.chkStyle == "radio") { |
|
703 |
// 单选 |
|
704 |
console.log(value) |
|
705 |
var nodes = treeObj.getNodeByParam("id", value[i], null); |
|
706 |
console.log(nodes); |
|
707 |
if (_.isNull(nodes)) { |
|
708 |
// treeObj.checkAllNodes(false); |
|
709 |
// return false; |
|
710 |
} else { |
|
711 |
if (value == nodes.id) { |
|
712 |
value = nodes.name; |
|
713 |
} |
|
714 |
console.log(value) |
|
715 |
if (nodes != null) { |
|
716 |
// 2017 /11/6 选中 |
|
717 |
//选择节点设定 |
|
718 |
treeObj.checkNode(nodes, true, true); |
|
719 |
treeObj.expandAll(true); |
|
720 |
} |
|
721 |
} |
|
722 |
} else { |
|
723 |
// 多选 |
|
724 |
for (var j = 0; j < value[i].length; j++) { |
|
725 |
//取得设定节点 |
|
726 |
console.log(value[j]); |
|
727 |
var nodes = treeObj.getNodeByParam("id", value[j], null); |
|
728 |
console.log(nodes) |
|
729 |
if (_.isNull(nodes)) { |
|
730 |
// treeObj.checkAllNodes(false); |
|
731 |
// return false; |
|
732 |
} else { |
|
733 |
if (value[j] == nodes.id) { |
|
734 |
value[j] = nodes.name; |
|
735 |
} |
|
736 |
console.log(nodes) |
|
737 |
if (nodes != null) { |
|
738 |
// 2017 /11/6 选中 |
|
739 |
//选择节点设定 |
|
740 |
treeObj.checkNode(nodes, true, true); |
|
741 |
treeObj.expandAll(true); |
|
742 |
} |
|
743 |
} |
|
744 |
} |
|
745 |
} |
|
746 |
} |
|
747 |
// 详细页面的回显 |
96b1bc
|
748 |
// var showTreeDiv = ` <div style="word-break:break-all;border-width: 0px;border-style: solid;border-color: rgb(204, 204, 204);width:200px;" class="customShowItemClass edui-default customShowItemClassTemp"> |
L |
749 |
// ${value} |
|
750 |
// </div>` |
|
751 |
// $('#customShow').find(`#${itemId}ActiveId`).children(':nth-child(4)').remove(); |
|
752 |
$('#customShow').find(`[treeitemid=${itemId}]`).html(value);//普通模式树形回显 李伟民 0130 |
|
753 |
// $('#customShow').find(`#${itemId}ActiveId`).append(showTreeDiv); |
|
754 |
$('#' + itemId).parents('div[name="TreeWin"]').find('.citySel').val(value); |
4d1219
|
755 |
// } |
B |
756 |
} else { |
|
757 |
// 子表单里只有一颗树的时候 |
|
758 |
if (treeDiv.length == 1) { |
|
759 |
var dataObj = {} |
|
760 |
var valueData = []; |
|
761 |
// 更新数据的时候需要在div上绑定一个存储数据的value |
|
762 |
// 单选 |
|
763 |
console.log(value); |
|
764 |
// 不在子表单里的树更新时需要的数据 |
|
765 |
if(value){ |
|
766 |
if (typeof value[0] == "string" && value[0]!= '') { |
|
767 |
dataObj[value[0]] = '1' |
|
768 |
} else { |
|
769 |
for (var i = 0; i < value[0].length; i++) { |
|
770 |
valueData[i] = value[0][i].split(',') |
|
771 |
dataObj[valueData[i]] = '1' |
|
772 |
} |
|
773 |
} |
|
774 |
$('#' + itemId).attr('value', JSON.stringify(dataObj)) |
|
775 |
var treeObj = $.fn.zTree.getZTreeObj(itemId + "tree"); |
|
776 |
if (treeObj == null) { |
|
777 |
return; |
|
778 |
} |
|
779 |
if (typeof value == "string") { |
|
780 |
value = [value]; |
|
781 |
} |
|
782 |
// 2017/11/6 回显的地方 |
|
783 |
for (var i = 0, l = value.length; i < l; i++) { |
|
784 |
if (treeObj.setting.check.chkStyle == "radio") { |
|
785 |
// 12/6 因为会触发customShow.addtree()导致ul 的id 变更 |
|
786 |
var treeDiv = $('div#' + itemId); |
|
787 |
var ultreeId = $(treeDiv).find('ul').attr('id'); |
|
788 |
var treeObj = $.fn.zTree.getZTreeObj(ultreeId); |
|
789 |
// var treeObj = $.fn.zTree.getZTreeObj(itemId + "tree1"); |
|
790 |
// 单选 |
|
791 |
var nodes = treeObj.getNodeByParam("id", value[i], null); |
|
792 |
console.log(nodes) |
|
793 |
if (_.isNull(nodes)) { |
13ec33
|
794 |
|
4d1219
|
795 |
var tid = ''; |
B |
796 |
nodes = treeObj.getCheckedNodes(true); |
|
797 |
for (var i = 0; i < nodes.length; i++) { |
|
798 |
tid = nodes[i].tId |
|
799 |
} |
|
800 |
console.log(tid) |
|
801 |
// 强行制空 |
|
802 |
$('#'+tid+'_check').click() |
|
803 |
$('#' + tid + '_check').click() |
|
804 |
$(treeDiv).prev().find('.citySel').val('') |
|
805 |
} else { |
|
806 |
if (value[i] == nodes.id) { |
|
807 |
value[i] = nodes.name; |
|
808 |
} |
|
809 |
if (nodes != null) { |
|
810 |
// 2017 /11/6 选中 |
|
811 |
//选择节点设定 |
|
812 |
console.log(nodes) |
|
813 |
treeObj.checkNode(nodes, true, true); |
|
814 |
treeObj.expandAll(true); |
|
815 |
console.log(treeObj) |
|
816 |
var tid = ''; |
|
817 |
nodes11 = treeObj.getCheckedNodes(true); |
|
818 |
console.log(nodes11) |
|
819 |
for (var i = 0; i < nodes11.length; i++) { |
|
820 |
tid = nodes11[i].tId |
|
821 |
} |
|
822 |
console.log(tid); |
|
823 |
// console.log($('#'+tid+'_check')) |
|
824 |
// $('#'+tid+'_check').click() |
|
825 |
// $('#'+tid+'_check').click() |
13ec33
|
826 |
|
4d1219
|
827 |
} |
B |
828 |
} |
|
829 |
} else { |
|
830 |
// 多选 |
|
831 |
for (var j = 0; j < value[i].length; j++) { |
|
832 |
//取得设定节点 |
|
833 |
console.log(value[i][j]); |
|
834 |
var nodes = treeObj.getNodeByParam("id", value[i][j], null); |
|
835 |
console.log(nodes) |
|
836 |
if (_.isNull(nodes)) { |
|
837 |
// treeObj.checkAllNodes(false); |
|
838 |
// return false; |
|
839 |
} else { |
|
840 |
if (value[i][j] == nodes.id) { |
|
841 |
value[i][j] = nodes.name; |
|
842 |
} |
|
843 |
console.log(nodes) |
|
844 |
if (nodes != null) { |
|
845 |
// 2017 /11/6 选中 |
|
846 |
//选择节点设定 |
|
847 |
treeObj.checkNode(nodes, true, true); |
|
848 |
treeObj.expandAll(true); |
|
849 |
console.log(treeObj) |
13ec33
|
850 |
|
4d1219
|
851 |
} |
B |
852 |
} |
|
853 |
} |
|
854 |
} |
|
855 |
} |
|
856 |
// 回显到table表格里 |
|
857 |
var showIdTbale = $(`#${itemId}`).parents('.subformCss').attr('id'); |
|
858 |
$(`#${itemId}`).parent('div[name="TreeWin"]').find('.citySel').val(value); |
|
859 |
var deitSubFormsTree = $(`#${showIdTbale}`).find('tbody').find('tr:nth-child(2)').find('td'); |
|
860 |
for (var i = 1; i < deitSubFormsTree.length - 1; i++) { |
|
861 |
// 将编辑页面的树形ipnut 里面的值 放到展示页面里 |
|
862 |
var value = $(deitSubFormsTree[i]).find('.citySel').val(); |
|
863 |
$(`#customShow #${showIdTbale}ActiveId`).find(`#${showIdTbale}`).find('.trContentClass').find(`td:nth-child(${i + 1})`).find('.customShowItemClass').html(value) |
|
864 |
} |
13ec33
|
865 |
|
4d1219
|
866 |
} |
B |
867 |
|
|
868 |
} else { |
|
869 |
// 子表单内td里面的div更改 |
|
870 |
var oNode = '<div style="word-break:break-all;border-width: 0px;border-style: solid;border-color: rgb(204, 204, 204);width:200px;" class="customShowItemClassTemp customShowItemClass ' + id + '_showItem edui-default">'; |
|
871 |
oNode += "</div>"; |
|
872 |
var showItem = $($(".customShow").find("#" + itemId)); |
|
873 |
for (var i = 0; i < showItem.length; i++) { |
|
874 |
$($(showItem[i])[0]).after(oNode); |
|
875 |
$($(showItem[i])[0]).remove(); |
|
876 |
} |
|
877 |
var treeDiv = $('div#' + itemId); |
|
878 |
console.log(treeDiv) |
|
879 |
// 插入input里的value |
|
880 |
var iptValue = []; |
|
881 |
var iptValueObj = {}; |
|
882 |
// 更新的时候需要的数据 |
|
883 |
var dataObj = {} |
|
884 |
var valueData = []; |
|
885 |
for (var j = 0; j < treeDiv.length; j++) { |
|
886 |
var ultreeId = $(treeDiv[j]).find('ul').attr('id'); |
|
887 |
var treeObj = $.fn.zTree.getZTreeObj(ultreeId); |
|
888 |
if (treeObj == null) { |
|
889 |
return; |
|
890 |
} |
|
891 |
if (typeof value == "string") { |
|
892 |
value = [value]; |
|
893 |
} |
|
894 |
// 2017/11/6 回显的地方 |
|
895 |
// 单选 |
|
896 |
if (treeObj.setting.check.chkStyle == "radio") { |
|
897 |
console.log($(treeDiv[j])) |
|
898 |
console.log(value); |
|
899 |
for (var i = 0; i < value.length; i++) { |
|
900 |
if (value[i] == '') { |
|
901 |
console.log(1) |
|
902 |
// dataObj = {} |
|
903 |
} else { |
|
904 |
console.log(2) |
|
905 |
if (i == j) { |
|
906 |
dataObj[value[i]] = '1'; |
|
907 |
} |
|
908 |
} |
|
909 |
} |
|
910 |
$(treeDiv[j]).attr('value', JSON.stringify(dataObj)) |
|
911 |
dataObj = {} |
|
912 |
console.log(j) |
|
913 |
console.log(value[j]) |
|
914 |
var nodes = treeObj.getNodeByParam("id", value[j], null); |
|
915 |
console.log(nodes) |
|
916 |
console.log(treeObj) |
|
917 |
if (_.isNull(nodes)) { |
|
918 |
// treeObj.checkAllNodes(false); |
|
919 |
var tid = ''; |
|
920 |
nodes = treeObj.getCheckedNodes(true); |
|
921 |
for (var i = 0; i < nodes.length; i++) { |
|
922 |
tid = nodes[i].tId |
|
923 |
} |
|
924 |
console.log(tid) |
|
925 |
$('#' + tid + '_check').click() |
|
926 |
$(treeDiv[j]).prev().find('.citySel').val('') |
|
927 |
} else { |
|
928 |
if (value[j] == nodes.id) { |
|
929 |
iptValue.push(nodes.name); |
|
930 |
} |
|
931 |
if (nodes != null) { |
|
932 |
// 2017 /11/6 选中 |
|
933 |
//选择节点设定 |
|
934 |
console.log(treeObj); |
|
935 |
console.log(nodes) |
|
936 |
treeObj.checkNode(nodes, true, true); |
|
937 |
treeObj.expandAll(true); |
|
938 |
} |
|
939 |
for (var k = 0; k < iptValue.length; k++) { |
|
940 |
$(treeDiv[j]).prev().find('.citySel').val(iptValue[k]) |
|
941 |
} |
|
942 |
} |
|
943 |
|
|
944 |
} else { |
|
945 |
// 多选 |
|
946 |
|
|
947 |
console.log(value[j]) |
|
948 |
if (typeof value[j] == "string") { |
|
949 |
var strValue = value[j].split(','); |
|
950 |
// 导入excel时状态多选为字符串形式 |
|
951 |
if (strValue.length > 1) { |
|
952 |
console.log(strValue) |
|
953 |
for (var n = 0; n < strValue.length; n++) { |
|
954 |
var nodes = treeObj.getNodeByParam("id", strValue[n], null); |
|
955 |
console.log(nodes) |
|
956 |
if (strValue[n] == '') { |
|
957 |
|
|
958 |
} else { |
|
959 |
dataObj[strValue[n]] = '1'; |
|
960 |
} |
|
961 |
if (_.isNull(nodes)) { |
|
962 |
// treeObj.checkAllNodes(false); |
|
963 |
// return false; |
|
964 |
$(treeDiv[j]).prev().find('.citySel').val('') |
|
965 |
|
|
966 |
} else { |
|
967 |
if (strValue[n] == nodes.id) { |
|
968 |
iptValue.push(nodes.name); |
|
969 |
} |
|
970 |
if (nodes != null) { |
|
971 |
// 2017 /11/6 选中 |
|
972 |
//选择节点设定 |
|
973 |
treeObj.checkNode(nodes, true, true); |
|
974 |
treeObj.expandAll(true); |
|
975 |
} |
|
976 |
} |
|
977 |
$(treeDiv[j]).attr('value', JSON.stringify(dataObj)) |
|
978 |
|
|
979 |
} |
|
980 |
$(treeDiv[j]).prev().find('.citySel').val(iptValue.join(',')) |
|
981 |
iptValue = []; |
|
982 |
dataObj = {}; |
|
983 |
} else { |
|
984 |
var nodes = treeObj.getNodeByParam("id", value[j], null); |
|
985 |
for (var i = 0; i < value.length; i++) { |
|
986 |
if (value[i] == '') { |
|
987 |
|
|
988 |
} else { |
|
989 |
if (i == j) { |
|
990 |
dataObj[value[i]] = '1'; |
|
991 |
} |
|
992 |
} |
|
993 |
} |
|
994 |
$(treeDiv[j]).attr('value', JSON.stringify(dataObj)) |
|
995 |
dataObj = {} |
|
996 |
if (_.isNull(nodes)) { |
|
997 |
// treeObj.checkAllNodes(false); |
|
998 |
// return false; |
|
999 |
} else { |
|
1000 |
if (value[j] == nodes.id) { |
|
1001 |
iptValue.push(nodes.name); |
|
1002 |
} |
|
1003 |
if (nodes != null) { |
|
1004 |
// 2017 /11/6 选中 |
|
1005 |
//选择节点设定 |
|
1006 |
treeObj.checkNode(nodes, true, true); |
|
1007 |
treeObj.expandAll(true); |
|
1008 |
} |
|
1009 |
for (var k = 0; k < iptValue.length; k++) { |
|
1010 |
$(treeDiv[j]).prev().find('.citySel').val(iptValue[k]) |
|
1011 |
} |
|
1012 |
iptValue = []; |
|
1013 |
} |
|
1014 |
} |
|
1015 |
} else { |
|
1016 |
var dataObj = {} |
|
1017 |
var valueData = []; |
|
1018 |
for (var i = 0; i < value[j].length; i++) { |
|
1019 |
valueData[i] = value[j][i].split(',') |
|
1020 |
dataObj[valueData[i]] = '1' |
|
1021 |
} |
|
1022 |
$(treeDiv[j]).attr('value', JSON.stringify(dataObj)) |
|
1023 |
for (var k = 0; k < value[j].length; k++) { |
|
1024 |
// j是 有几个input框 |
|
1025 |
// k是 value 里面的数据还会有呈现数组的形式 |
|
1026 |
dataObj = {} |
|
1027 |
valueData = []; |
|
1028 |
var nodes = treeObj.getNodeByParam("id", value[j][k], null); |
|
1029 |
if (_.isNull(nodes)) { |
13ec33
|
1030 |
|
4d1219
|
1031 |
} else { |
B |
1032 |
if (value[j][k] == nodes.id) { |
|
1033 |
if (k <= value[j].length) { |
|
1034 |
iptValue.push(nodes.name); |
|
1035 |
} |
|
1036 |
} |
|
1037 |
iptValueObj[k] = iptValue; |
|
1038 |
// if (nodes != null) { |
|
1039 |
// 2017 /11/6 选中 |
|
1040 |
//选择节点设定 |
|
1041 |
treeObj.checkNode(nodes, true, true); |
|
1042 |
treeObj.expandAll(true); |
|
1043 |
// } |
|
1044 |
} |
|
1045 |
} |
|
1046 |
for (index in iptValueObj) { |
|
1047 |
$(treeDiv[j]).prev().find('.citySel').val(iptValueObj[index].join(',')) |
|
1048 |
} |
|
1049 |
iptValue = []; |
|
1050 |
iptValueObj = {}; |
|
1051 |
} |
|
1052 |
|
|
1053 |
} |
|
1054 |
// 获取父级ID |
|
1055 |
var showIdTable = $(`#${itemId}`).parents('.subformCss').attr('id'); |
|
1056 |
// 获取当前树形在整个td的下标 |
|
1057 |
var subformDataIndex = $(`#${itemId}`).parents('td').index(); |
|
1058 |
var subformTr = $('#customShow tr#' + showIdTable + "subformTr"); |
|
1059 |
var subformValue = $($('.tabBox' + ' #' + showIdTable + "subformTr")[j]).find('td').eq(subformDataIndex).find('.citySel').val() |
|
1060 |
$(subformTr[j]).children().eq(subformDataIndex).find('.customShowItemClassTemp').html(subformValue); |
|
1061 |
} |
|
1062 |
} |
|
1063 |
} |
13ec33
|
1064 |
|
4d1219
|
1065 |
}, |
B |
1066 |
}, |
|
1067 |
//选择表单控件 |
|
1068 |
mytext: { |
|
1069 |
getItem: function (itemId) { |
|
1070 |
// var newmytextObj = $('#'+itemId+' ul'); |
|
1071 |
// console.log(newmytextObj); |
|
1072 |
// var chooseFormData = {}; |
|
1073 |
// var str = []; |
|
1074 |
// _.each(newmytextObj,(opt,i)=>{ |
|
1075 |
// var $mytextObj = $('#'+opt.id+' [class="data1 DATAROWNUM"]'); |
|
1076 |
// var $mytextObj2 = $('#'+opt.id+' [class="data2 DATAROWNUM"]'); |
|
1077 |
//// console.log($mytextObj); |
|
1078 |
//// console.log($mytextObj2); |
|
1079 |
//// console.log($mytextObj.html()); |
|
1080 |
//// console.log($mytextObj2.html()); |
|
1081 |
//// for(let i = 0;i < $mytextObj.length ;i++){ |
|
1082 |
//// var $myText = $mytextObj.eq(i).html(); |
|
1083 |
//// console.log($myText) |
|
1084 |
//// console.log($mytextObj2.eq(i).html()) |
|
1085 |
//// chooseFormData[$myText] = $mytextObj2.eq(i).html(); |
|
1086 |
//// |
|
1087 |
//// } |
|
1088 |
//// dataArr1.push($mytextObj2.html()); |
|
1089 |
// console.log(i); |
|
1090 |
// console.log(newmytextObj.length); |
|
1091 |
// if(i<newmytextObj.length-1){ |
|
1092 |
// str += $mytextObj2.html()+","; |
|
1093 |
// }else{ |
|
1094 |
// str += $mytextObj2.html(); |
|
1095 |
// } |
|
1096 |
// }) |
|
1097 |
// console.log(str) |
|
1098 |
|
|
1099 |
var str = $('#' + itemId).attr("mxtVal");//关联数据 取值 11-07 李伟民 |
|
1100 |
return str; |
|
1101 |
|
|
1102 |
|
|
1103 |
}, |
|
1104 |
setItem: function (itemId, value) { |
|
1105 |
console.log(value); |
|
1106 |
if (!_.isString(value)) { |
|
1107 |
var new_value = []; |
|
1108 |
_.each(value.list, function (v) { |
|
1109 |
if (v.DATAROWNUM) { |
|
1110 |
new_value.push(v.DATAROWNUM); |
|
1111 |
} |
|
1112 |
}); |
|
1113 |
new_value = new_value.join(); |
|
1114 |
$('#' + itemId).attr("mxtVal", new_value);//关联数据 存值 11-07 李伟民 |
|
1115 |
} else { |
|
1116 |
$('#' + itemId).attr("mxtVal", value);//关联数据 存值 11-07 李伟民 |
|
1117 |
} |
|
1118 |
}, |
|
1119 |
}, |
|
1120 |
}; |
|
1121 |
|
|
1122 |
|
|
1123 |
//画面弹出信息 |
|
1124 |
customBase.alert = function (type, message) { |
|
1125 |
if (type == "E") { |
|
1126 |
toastr.error(message); |
|
1127 |
} else if (type == "I") { |
|
1128 |
toastr.info(message); |
|
1129 |
} else if (type == "W") { |
|
1130 |
toastr.warning(message); |
|
1131 |
} else if (type == "S") { |
|
1132 |
toastr.success(message); |
|
1133 |
} else { |
|
1134 |
toastr.error(message); |
|
1135 |
} |
|
1136 |
} |
|
1137 |
|
|
1138 |
//根据别名取得字段Id |
|
1139 |
customBase.getfieldKeyFoItemId = function (fieldKey) { |
|
1140 |
return customBase.options.customItems[fieldKey].id; |
|
1141 |
} |
|
1142 |
|
|
1143 |
//取得message信息 |
|
1144 |
customBase.getMessage = function (messageID) { |
|
1145 |
// 12/11 |
|
1146 |
var strMessage = ""; |
|
1147 |
switch (messageID) { |
|
1148 |
case "mesage_ID001": |
|
1149 |
strMessage = "子表单中无法追加此控件!"; |
|
1150 |
break; |
|
1151 |
case "mesage_ID002": |
|
1152 |
strMessage = "表单别名重复,请对别名进行修改!"; |
|
1153 |
break; |
|
1154 |
case "mesage_ID003": |
|
1155 |
strMessage = "表单保存成功!"; |
|
1156 |
break; |
|
1157 |
case "mesage_ID004": |
|
1158 |
strMessage = '项目必须输入!'; |
|
1159 |
break; |
|
1160 |
case "mesage_ID005": |
|
1161 |
strMessage = "上传成功!"; |
|
1162 |
break; |
|
1163 |
case "mesage_ID006": |
|
1164 |
strMessage = "操作过于频繁,请稍后再执行!"; |
|
1165 |
break; |
|
1166 |
case "mesage_ID007": |
|
1167 |
strMessage = "画面字段数据过多,保存失败!"; |
|
1168 |
break; |
|
1169 |
case "mesage_ID008": |
|
1170 |
strMessage = "单行文本的最大长度不能超过150!"; |
|
1171 |
break; |
|
1172 |
case "mesage_ID009": |
|
1173 |
strMessage = "'请输入有效的手机号码!"; |
|
1174 |
break; |
|
1175 |
case "mesage_ID010": |
|
1176 |
strMessage = "'请输入正确的网址!"; |
|
1177 |
break; |
|
1178 |
case "mesage_ID011": |
|
1179 |
strMessage = "'请输入有效的身份证号!"; |
|
1180 |
break; |
|
1181 |
case "mesage_ID012": |
|
1182 |
strMessage = "请输入有效的邮箱!"; |
|
1183 |
break; |
|
1184 |
case "mesage_ID013": |
|
1185 |
strMessage = "请输入表单名!"; |
|
1186 |
break; |
|
1187 |
case "mesage_ID014": |
|
1188 |
strMessage = "表单版本重复,请修改!"; |
|
1189 |
break; |
|
1190 |
case "mesage_ID015": |
|
1191 |
strMessage = "保存成功!"; |
|
1192 |
break; |
|
1193 |
case "mesage_ID016": |
|
1194 |
strMessage = "表单别名必须输入,请对别名进行修改!"; |
|
1195 |
break; |
|
1196 |
case "mesage_ID017": |
|
1197 |
strMessage = "表单的宽高必须输入!"; |
|
1198 |
break; |
|
1199 |
case "mesage_ID018": |
|
1200 |
strMessage = "请输入版本信息!"; |
|
1201 |
break; |
|
1202 |
case "mesage_ID019": |
|
1203 |
strMessage = "请输入整数!"; |
|
1204 |
break; |
|
1205 |
case "mesage_ID020": |
|
1206 |
strMessage = "整数长度超出设定范围!"; |
|
1207 |
break; |
|
1208 |
case "mesage_ID021": |
|
1209 |
strMessage = "小数长度超出设定范围!"; |
|
1210 |
break; |
|
1211 |
case "mesage_ID022": |
|
1212 |
strMessage = "条形码默认值不能为空!"; |
|
1213 |
break; |
|
1214 |
case "mesage_ID023": |
|
1215 |
strMessage = "长度超出设定范围!"; |
|
1216 |
break; |
|
1217 |
case "mesage_ID024": |
|
1218 |
strMessage = "请选择正确的部门"; |
|
1219 |
break; |
|
1220 |
case "mesage_ID025": |
|
1221 |
strMessage = "预算余额不足,不可退回"; |
|
1222 |
break; |
|
1223 |
case "mesage_ID026": |
|
1224 |
strMessage = "上级预算余额不足"; |
|
1225 |
break; |
|
1226 |
case "mesage_ID027": |
|
1227 |
strMessage = "操作成功"; |
|
1228 |
break; |
|
1229 |
case "mesage_ID028": |
|
1230 |
strMessage = "上级预算无此业务类型"; |
|
1231 |
break; |
|
1232 |
case "mesage_ID029": |
|
1233 |
strMessage = "还款成功"; |
|
1234 |
break; |
|
1235 |
case "mesage_ID030": |
|
1236 |
strMessage = "还款失败"; |
|
1237 |
break; |
|
1238 |
case "mesage_ID031": |
|
1239 |
strMessage = "创建流程实例成功"; |
|
1240 |
break; |
|
1241 |
case "mesage_ID032": |
|
1242 |
strMessage = "请创建流程定义"; |
|
1243 |
break; |
|
1244 |
case "mesage_ID033": |
|
1245 |
strMessage = "服务器返回错误有"; |
|
1246 |
break; |
|
1247 |
case "mesage_ID034": |
|
1248 |
strMessage = "本条数据已创建流程"; |
|
1249 |
break; |
|
1250 |
case "mesage_ID035": |
|
1251 |
strMessage = "请先选择流程定义"; |
|
1252 |
break; |
|
1253 |
default: |
|
1254 |
strMessage = "错误信息,请与管理员联系!"; |
|
1255 |
} |
|
1256 |
return strMessage; |
|
1257 |
} |
|
1258 |
|
|
1259 |
|
|
1260 |
//取得表单画面项目 |
|
1261 |
customBase.getItemValue = function (itemId, type) { |
|
1262 |
|
|
1263 |
var item = ""; |
|
1264 |
//单行文本 多行文本 数字 日历 customBase.itemEdit var prefix = JSON.parse(window.localStorage.getItem("customItem")); |
|
1265 |
if (type == 'text' || type == 'textarea' || type == 'number' || type == 'calendar' || type == "auto") { |
|
1266 |
item = customBase.itemEdit['text'].getItem("." + itemId + "value"); |
|
1267 |
} else if (type == 'radio' || type == 'checkbox') { |
|
1268 |
item = customBase.itemEdit['checkboxRadio'].getItem(itemId, type); |
|
1269 |
} else if (type == 'image' || type == 'fileupload') { |
|
1270 |
item = customBase.itemEdit['fileupload'].getItem(itemId); |
|
1271 |
} else if (type == 'amount') { |
|
1272 |
item = customBase.itemEdit['text'].getItem("#" + itemId + "amount"); |
|
1273 |
} else if (type == 'qrcode') { |
|
1274 |
item = customBase.itemEdit['text'].getItem("#" + itemId + "qrcode"); |
|
1275 |
} else if (type == 'barcode') { |
|
1276 |
item = customBase.itemEdit['text'].getItem("#" + itemId + "barcode"); |
|
1277 |
} else if (type == 'splitline' || type == 'button') { |
|
1278 |
|
|
1279 |
} else if (type == 'dropdownlistText') { |
|
1280 |
// customBase.itemEdit[type].setItem(itemId,value,showClass,dropdowntype); |
|
1281 |
// item = customBase.itemEdit["dropdownlistText"].getItem(itemId); |
|
1282 |
item = customBase.itemEdit["dropdownlistText2"].getItem(itemId); |
|
1283 |
} else if (type == "tree") { |
|
1284 |
item = customBase.itemEdit["tree"].getItem(itemId); |
|
1285 |
} else { |
|
1286 |
item = customBase.itemEdit[type].getItem(itemId); |
|
1287 |
} |
|
1288 |
return item; |
|
1289 |
} |
|
1290 |
//设定表单画面项目 12/7 |
|
1291 |
customBase.setItemValue = function (itemId, type, value, showClass, dropdowntype, num) { |
|
1292 |
console.log(type) |
|
1293 |
console.log(value) |
|
1294 |
console.log(itemId) |
|
1295 |
var item; |
|
1296 |
if (showClass == "") { |
|
1297 |
showClass = 'customViewUEditorCss'; |
|
1298 |
} |
|
1299 |
if (type == 'text' || type == 'textarea' || type == 'number' || type == 'calendar' || type == 'auto') { |
|
1300 |
if (num != undefined) { |
|
1301 |
customBase.itemEdit['text'].setItem("[id=" + itemId + "]:eq('" + num + "')", value, showClass); |
|
1302 |
} else { |
|
1303 |
customBase.itemEdit['text'].setItem("#" + itemId, value, showClass); |
|
1304 |
} |
|
1305 |
} else if (type == 'htmlediter') { |
|
1306 |
customBase.itemEdit['htmlediter'].setItem(itemId, value, showClass); |
|
1307 |
} else if (type == 'radio' || type == 'checkbox') { |
|
1308 |
customBase.itemEdit['checkboxRadio'].setItem(itemId, type, value, showClass); |
|
1309 |
} else if (type == 'tree') { |
|
1310 |
customBase.itemEdit['tree'].setItem(itemId, value); |
|
1311 |
} else if (type == 'dropdownlistText') { |
|
1312 |
//console.log(value); |
|
1313 |
customBase.itemEdit[type].setItem(itemId, value, showClass, dropdowntype); |
|
1314 |
//console.log(1); |
|
1315 |
customBase.itemEdit["dropdownlistText2"].setItem(itemId, value, showClass, dropdowntype); |
|
1316 |
} else if (type == 'splitline' || type == 'subform' || type == 'tag' || type == 'tab') { |
|
1317 |
} else if (type == 'image') { |
|
1318 |
// customBase.itemEdit[type].setItem(itemId,value,showClass); |
|
1319 |
} else if (type == 'qrcode') { |
|
1320 |
// customBase.itemEdit[type].setItem(itemId,value,showClass); |
|
1321 |
} else if (type == 'barcode') { |
|
1322 |
// customBase.itemEdit[type].setItem(itemId,value,showClass); |
|
1323 |
} else if (type == 'link') { |
|
1324 |
// customBase.itemEdit[type].setItem(itemId,value,showClass); |
|
1325 |
} else if (type == 'button') { |
|
1326 |
// customBase.itemEdit[type].setItem(itemId,value,showClass); |
|
1327 |
} else { |
|
1328 |
customBase.itemEdit[type].setItem(itemId, value, showClass); |
|
1329 |
} |
|
1330 |
|
|
1331 |
} |
|
1332 |
|
|
1333 |
|
|
1334 |
/** |
|
1335 |
* 获取项目根路径1 |
|
1336 |
* @return {RootPath} |
|
1337 |
*/ |
|
1338 |
customBase.getRootPath = function () { |
|
1339 |
var strFullPath = window.document.location.href; |
|
1340 |
var strPath = window.document.location.pathname; |
|
1341 |
var pos = strFullPath.indexOf(strPath); |
|
1342 |
var prePath = strFullPath.substring(0, pos); |
|
1343 |
var postPath = strPath.substring(0, strPath.substr(1).indexOf('/') + 1) + "/"; |
|
1344 |
return (prePath + postPath); |
|
1345 |
} |
|
1346 |
|
|
1347 |
|
|
1348 |
|
|
1349 |
//文件上传 |
|
1350 |
customBase.uploaderFileShow = function (potion) { |
|
1351 |
console.log(potion); |
|
1352 |
var itemId = potion.id; |
|
1353 |
|
|
1354 |
customBase.options.uploaderItem[itemId] = {}; |
|
1355 |
var arrItemReady = 0; |
|
1356 |
if (potion.ItemReady != undefined) { |
|
1357 |
arrItemReady = Object.keys(potion.ItemReady).length; |
|
1358 |
customBase.options.uploaderItem[itemId] = potion.ItemReady; |
|
1359 |
} |
|
1360 |
var $uploaderItem = $(".customViewUEditorCss #" + potion.id); |
|
1361 |
$uploaderItem.empty(); |
|
1362 |
var $uploadimg = $( |
|
1363 |
'<div id="' + potion.id + 'uploadimg">' + |
|
1364 |
'<div id="' + potion.id + 'fileList" class="uploader-list"></div>' + |
|
1365 |
'</div>' |
|
1366 |
); |
|
1367 |
var $list = $uploadimg.find("#" + potion.id + "fileList"); |
|
1368 |
var $addLi = $( |
|
1369 |
'<div id="' + potion.id + 'imgPicker" class="file-item ">' + |
|
1370 |
'<button type="button" class="btn btn-info designbtn right">点击选文件</button>' + |
|
1371 |
'</div>' |
|
1372 |
); |
|
1373 |
$list.after($addLi); |
|
1374 |
|
|
1375 |
//不可见辑情况下 附件追加按钮隐藏 李伟民 0123 |
|
1376 |
if (!potion.visible) { |
|
1377 |
$addLi.addClass("cfg_contentNone"); |
|
1378 |
} |
|
1379 |
if (!potion.editable) {//不可编辑 附件追加按钮样式修改 李伟民 0123 |
|
1380 |
$addLi.find('button').addClass("disabled"); |
|
1381 |
} |
|
1382 |
//默认图片追加 |
|
1383 |
if (potion.defaultvalueUrl != "") { |
|
1384 |
var tmp = potion.defaultvalueUrl.split("/");//按照"/"分割 |
|
1385 |
var pp = tmp[tmp.length - 1];//获取最后一部分,即文件名和参数 |
|
1386 |
var $li = $( |
|
1387 |
'<div class="thumbnail01">' + |
|
1388 |
'<div class="info"><a href="' + potion.defaultvalueUrl + '" >' + pp + '</a></div>' + |
|
1389 |
'</div>' |
|
1390 |
); |
|
1391 |
$list.prepend($li); |
|
1392 |
// //单一图片的情况下 图片追加隐藏 |
|
1393 |
// if(potion.imagetype == "single"){ |
|
1394 |
// $addLi.addClass("cfg_contentNone"); |
|
1395 |
// } |
|
1396 |
} |
|
1397 |
//数据编辑的情况下,数据表示 |
|
1398 |
if (arrItemReady > 0) { |
|
1399 |
for (fileid in potion.ItemReady) { |
|
1400 |
if (potion.ItemReady.hasOwnProperty(fileid)) { |
|
1401 |
var fileItem = potion.ItemReady[fileid]; |
|
1402 |
// var $list = $("#"+potion.id+"fileList"), |
|
1403 |
// var $list = $uploadimg, |
764ba6
|
1404 |
var fileDir = fileid.path; |
Z |
1405 |
var suffix = fileDir.substr(fileDir.lastIndexOf(".")+1); |
|
1406 |
console.log(fileItem.path) |
|
1407 |
if(suffix == "mp4"){ |
|
1408 |
$li = $( |
|
1409 |
'<div id="' + fileid + '" class="thumbnail01">' + |
|
1410 |
'<div class="frm_item_icons01">' + |
|
1411 |
'<div class="frm_item_icon remove" imgId="' + fileid + '">' + |
|
1412 |
'<img alt=" " style="width:14px;height:14px;" src="./../../css/img/icon/delete.png"></div>' + |
|
1413 |
'</div>' + |
|
1414 |
// '<img class = "fileQueuedAddItem" src = "'+fileItem.base64+'">' + |
|
1415 |
// '<div class="info"><a href="'+customBase.options.uploaderItem[itemId][file.id].path+'" >' + file.name + '</a></div>' + |
|
1416 |
'<div class="info"><a href="' + fileItem.path + '" " target="_blank">' + fileItem.oldName + '</a></div>' + |
|
1417 |
'</div>' |
|
1418 |
); |
|
1419 |
}else{ |
|
1420 |
$li = $( |
|
1421 |
'<div id="' + fileid + '" class="thumbnail01">' + |
|
1422 |
'<div class="frm_item_icons01">' + |
|
1423 |
'<div class="frm_item_icon remove" imgId="' + fileid + '">' + |
|
1424 |
'<img alt=" " style="width:14px;height:14px;" src="./../../css/img/icon/delete.png"></div>' + |
|
1425 |
'</div>' + |
|
1426 |
// '<img class = "fileQueuedAddItem" src = "'+fileItem.base64+'">' + |
|
1427 |
// '<div class="info"><a href="'+customBase.options.uploaderItem[itemId][file.id].path+'" >' + file.name + '</a></div>' + |
|
1428 |
'<div class="info"><a href="' + fileItem.path + '" >' + fileItem.oldName + '</a></div>' + |
|
1429 |
'</div>' |
|
1430 |
); |
|
1431 |
} |
4d1219
|
1432 |
// $img = $li.find('.fileQueuedAddItem'); |
B |
1433 |
|
|
1434 |
$li.find(".frm_item_icon").on('click', function (event) { |
|
1435 |
var imgId = this.getAttribute("imgId"); |
|
1436 |
$('#' + imgId).remove(); |
|
1437 |
if (imgId.indexOf("WU") > -1) { |
|
1438 |
uploader.removeFile(imgId, true); |
|
1439 |
} |
|
1440 |
delete customBase.options.uploaderItem[itemId][imgId]; |
|
1441 |
|
|
1442 |
event.stopPropagation(); |
|
1443 |
return false; |
|
1444 |
|
|
1445 |
}); |
|
1446 |
// $list为容器jQuery实例 |
|
1447 |
$list.prepend($li); |
|
1448 |
} |
|
1449 |
} |
|
1450 |
} |
|
1451 |
|
|
1452 |
$uploaderItem.append($uploadimg); |
|
1453 |
customBase.uploaderTemp += 500; |
|
1454 |
setTimeout(function () { |
|
1455 |
if (!potion.editable) {//不可编辑 点击无效果 李伟民 0123 |
|
1456 |
return false; |
|
1457 |
} |
|
1458 |
var uploader; |
|
1459 |
var webUploaderJson = { |
|
1460 |
// 选完文件后,是否自动上传。 |
|
1461 |
auto: true, |
|
1462 |
// pick: '#'+potion.id+"dndArea", |
|
1463 |
pick: '#' + potion.id + 'imgPicker', |
|
1464 |
paste: potion.id, |
|
1465 |
swf: '../../dist/Uploader.swf', |
|
1466 |
// fileExt: '*.zip,*.doc,*.xls,*.mp3,*.mp4', |
|
1467 |
// chunked:true, |
|
1468 |
// chunkSize :true, |
694e42
|
1469 |
fileSizeLimit: 20 * 1024 * 1024, // 200 M |
M |
1470 |
fileSingleSizeLimit: 20 * 1024 * 1024, // 50 M |
4d1219
|
1471 |
accept: {// 只允许选择图片文件格式 |
B |
1472 |
title: 'File', |
bb9424
|
1473 |
extensions: 'zip,rar,mp3,mp4,xls,xlsx,doc,docx,ppt,pptx,rtf', |
4d1219
|
1474 |
mimeTypes: '' |
B |
1475 |
}, |
|
1476 |
|
|
1477 |
} |
|
1478 |
var webUploaderJson = $.extend(webUploaderJson, window.commonWebUploaderJson(potion.formid)); |
|
1479 |
|
|
1480 |
|
|
1481 |
// 初始化Web Uploader |
|
1482 |
uploader = WebUploader.create(webUploaderJson); |
|
1483 |
|
|
1484 |
// uploader; |
|
1485 |
uploader.on('ready', function () { |
|
1486 |
debugger |
|
1487 |
window.uploader = uploader; |
|
1488 |
}); |
|
1489 |
uploader.on('error', function (type) { |
|
1490 |
if (type == "Q_TYPE_DENIED") { |
bb9424
|
1491 |
customBase.alert("myModal", "请上传zip,rar,mp3,mp4,xls,xlsx,doc,docx,ppt,pptx,rtf格式文件", ""); |
4d1219
|
1492 |
} |
B |
1493 |
}); |
|
1494 |
// 当有文件添加进来的时候 |
|
1495 |
uploader.on('fileQueued', function (file) { |
|
1496 |
// var $list = $("#"+potion.id+"fileList"), |
|
1497 |
var $list = $(".customViewUEditorCss #" + potion.id + "fileList"), |
|
1498 |
$li = $( |
|
1499 |
'<div id="' + file.id + '" class="thumbnail01">' + |
|
1500 |
'<div class="frm_item_icons01">' + |
|
1501 |
'<div class="frm_item_icon remove" imgId="' + file.id + '">' + |
764ba6
|
1502 |
'<img style="width:14px;height:14px;" src="./../../css/img/icon/delete.png"></div>' + |
4d1219
|
1503 |
'</div>' + |
B |
1504 |
// '<img class = "fileQueuedAddItem">' + |
764ba6
|
1505 |
'<div class="info"><a target="_blank" onclick=toastr.warning("加载中");>' + file.name + '</a>'+ |
Z |
1506 |
'<span style="color:red"> *加载中请勿保存</span></div>' + |
4d1219
|
1507 |
'</div>' |
764ba6
|
1508 |
); |
4d1219
|
1509 |
$img = $li.find('.fileQueuedAddItem'); |
B |
1510 |
|
|
1511 |
$li.find(".frm_item_icon").on('click', function () { |
|
1512 |
var imgId = this.getAttribute("imgId"); |
|
1513 |
$('#' + imgId).remove(); |
|
1514 |
if (imgId.indexOf("WU") > -1) { |
|
1515 |
uploader.removeFile(imgId, true); |
|
1516 |
} |
|
1517 |
delete customBase.options.uploaderItem[itemId][imgId]; |
|
1518 |
|
|
1519 |
event.stopPropagation(); |
|
1520 |
return false; |
|
1521 |
}); |
|
1522 |
// $list为容器jQuery实例 |
|
1523 |
$list.prepend($li); |
|
1524 |
}); |
|
1525 |
// 文件上传过程中创建进度条实时显示。 |
|
1526 |
uploader.on('uploadProgress', function (file, percentage) { |
|
1527 |
}); |
|
1528 |
|
|
1529 |
// 文件上传成功,给item添加成功class, 用样式标记上传成功。 |
|
1530 |
uploader.on('uploadSuccess', function (file, response) { |
|
1531 |
//////console.log(file); |
|
1532 |
//////console.log(response); |
|
1533 |
|
|
1534 |
$("#" + itemId + "mesageErrDiv").remove(); |
|
1535 |
$(".customViewUEditorCss #" + itemId).popover('hide') |
|
1536 |
|
|
1537 |
$('#' + file.id).addClass('upload-state-done'); |
|
1538 |
customBase.options.uploaderItem[itemId][file.id] = response.data; |
|
1539 |
$('#' + file.id).find("a")[0].setAttribute("href", response.data.path); |
764ba6
|
1540 |
$('#' + file.id).find("a")[0].onclick=null; |
Z |
1541 |
customBase.alert("S","上传成功"); |
|
1542 |
$('#' + file.id).find("span")[0].remove(); |
|
1543 |
// .attr("href",response.data.path); |
4d1219
|
1544 |
}); |
B |
1545 |
|
|
1546 |
// 文件上传失败,显示上传出错。 |
|
1547 |
uploader.on('uploadError', function (file) { |
|
1548 |
var $li = $('#' + file.id), |
|
1549 |
$error = $li.find('div.error'); |
|
1550 |
|
|
1551 |
// 避免重复创建 |
|
1552 |
if (!$error.length) { |
|
1553 |
$error = $('<div class="error"></div>').appendTo($li); |
|
1554 |
} |
764ba6
|
1555 |
$('#' + file.id).find("a")[0].onclick=null; |
Z |
1556 |
$('#' + file.id).find("span")[0].remove(); |
4d1219
|
1557 |
$error.text('上传失败'); |
B |
1558 |
}); |
|
1559 |
|
|
1560 |
// 完成上传完了,成功或者失败,先删除进度条。 |
|
1561 |
uploader.on('uploadComplete', function (file) { |
|
1562 |
$('#' + file.id).find('.progress').remove(); |
|
1563 |
}); |
|
1564 |
}, customBase.uploaderTemp); |
|
1565 |
} |
|
1566 |
//图片上传 |
|
1567 |
customBase.uploaderShow = function (potion) { |
|
1568 |
var customShowFlag = window.localStorage.getItem("customShowFlag") |
|
1569 |
console.log(customShowFlag); |
|
1570 |
console.log(customBase.options); |
|
1571 |
console.log(customShow.options.customItemShow.item); |
|
1572 |
var customItem = customShow.options.customItemShow.item; |
|
1573 |
//////console.log(potion); |
|
1574 |
var itemId = potion.id; |
|
1575 |
// var uploader; |
|
1576 |
customBase.options.uploaderItem[itemId] = {}; |
|
1577 |
var arrItemReady = 0; |
|
1578 |
if (potion.ItemReady != undefined) { |
|
1579 |
arrItemReady = Object.keys(potion.ItemReady).length; |
|
1580 |
customBase.options.uploaderItem[itemId] = potion.ItemReady; |
|
1581 |
} |
|
1582 |
var $uploaderItem = $(".customViewUEditorCss #" + potion.id); |
|
1583 |
$uploaderItem.empty(); |
|
1584 |
var $uploadimg = $( |
|
1585 |
'<div id="' + potion.id + 'uploadimg">' + |
|
1586 |
'<div id="' + potion.id + 'fileList" class="uploader-list"></div>' + |
|
1587 |
'</div>' |
|
1588 |
); |
|
1589 |
var $list = $uploadimg.find("#" + potion.id + "fileList"); |
|
1590 |
console.log($('#' + itemId)) |
|
1591 |
var $addLi = $( |
|
1592 |
'<div id="' + potion.id + 'imgPicker" class="file-item thumbnail">' + |
956db4
|
1593 |
'<div style="background:url(./../../formEngine/resources/css/image.png) no-repeat ;width: 100px;height: 100px;>" </div>' + |
4d1219
|
1594 |
'</div>' |
B |
1595 |
); |
|
1596 |
$list.prepend($addLi); |
|
1597 |
// //不可编辑情况下 图片追加隐藏 |
|
1598 |
// if (!potion.editable) { |
|
1599 |
// $addLi.addClass("cfg_contentNone"); |
|
1600 |
// } |
|
1601 |
//不可见辑情况下 图片追加按钮隐藏 李伟民 0123 |
|
1602 |
if (!potion.visible) { |
|
1603 |
$addLi.addClass("cfg_contentNone"); |
|
1604 |
} |
|
1605 |
if (!potion.editable) {//不可编辑 图片追加样式修改 李伟民 0123 |
|
1606 |
$addLi.css("cursor","not-allowed") |
|
1607 |
} |
|
1608 |
//默认图片追加 |
|
1609 |
if (potion.defaultvalueUrl != "") { |
|
1610 |
var $li = $( |
|
1611 |
'<div class="file-item thumbnail">' + |
|
1612 |
'<img src="' + potion.defaultvalueUrl + '"' + |
|
1613 |
'</div>' |
|
1614 |
// `<div class="file-item thumbnail"> |
|
1615 |
// <img src="${potion.defaultvalueUrl}" data-original="${otion.defaultvalueUrl}" |
|
1616 |
// </div>` |
|
1617 |
); |
|
1618 |
$list.prepend($li); |
|
1619 |
//单一图片的情况下 图片追加隐藏 |
|
1620 |
if (potion.imagetype == "single") { |
|
1621 |
$addLi.addClass("cfg_contentNone"); |
|
1622 |
} |
|
1623 |
} |
|
1624 |
//数据编辑的情况下,数据表示 |
|
1625 |
console.log(arrItemReady) |
|
1626 |
if (arrItemReady > 0) { |
|
1627 |
console.log(potion.ItemReady) |
|
1628 |
for (fileid in potion.ItemReady) { |
|
1629 |
if (potion.ItemReady.hasOwnProperty(fileid)) { |
|
1630 |
var fileItem = potion.ItemReady[fileid]; |
|
1631 |
// var $list = $("#"+potion.id+"fileList"), |
|
1632 |
// var $list = $uploadimg, |
|
1633 |
var $li = $( |
|
1634 |
'<div id="' + fileid + '" class="file-item thumbnail">' + |
e9bbff
|
1635 |
'<img alt=" " class = "fileQueuedAddItem" src = "' + fileItem.path + '" data-original ="' + fileItem.path + '" >' + |
4d1219
|
1636 |
'<div class="frm_item_icons">' + |
B |
1637 |
'<div class="frm_item_icon remove" imgId="' + fileid + '">' + |
|
1638 |
// '<img style="width:14px;height:14px;" src="./../../css/img/icon/delete.png"></div>' + |
1326a4
|
1639 |
'<div style="width:14px;height:14px;background:url(../../formEngine/resources/css/img/icon/delete.png);"> </div></div>' + |
4d1219
|
1640 |
|
B |
1641 |
'</div>' + |
|
1642 |
// '<div class="info">' + file.name + '</div>' + |
|
1643 |
'</div>' |
|
1644 |
); |
|
1645 |
|
|
1646 |
|
|
1647 |
$li.find(".frm_item_icon").on('click', function () { |
|
1648 |
var imgId = this.getAttribute("imgId"); |
|
1649 |
$('#' + imgId).remove(); |
|
1650 |
if (imgId.indexOf("WU") > -1) { |
|
1651 |
uploader.removeFile(imgId, true); |
|
1652 |
} |
|
1653 |
delete customBase.options.uploaderItem[itemId][imgId]; |
|
1654 |
//单一图片的情况下 图片追加隐藏 |
|
1655 |
if (potion.imagetype == "single") { |
|
1656 |
$addLi.removeClass("cfg_contentNone"); |
|
1657 |
} |
|
1658 |
console.log($(this)) |
|
1659 |
event.stopPropagation(); |
|
1660 |
}); |
|
1661 |
// $list为容器jQuery实例 |
|
1662 |
$list.prepend($li); |
|
1663 |
console.log($('#customShow').children()) |
|
1664 |
|
|
1665 |
} |
|
1666 |
} |
|
1667 |
} |
|
1668 |
//单一图片的情况下 图片追加隐藏 |
|
1669 |
if (arrItemReady > 0 && potion.imagetype == "single") { |
|
1670 |
setTimeout(function () { |
|
1671 |
$addLi.addClass("cfg_contentNone"); |
|
1672 |
}, 10); |
|
1673 |
console.log($('#customShow').children()) |
|
1674 |
|
|
1675 |
} |
|
1676 |
|
|
1677 |
$uploaderItem.append($uploadimg); |
|
1678 |
customBase.uploaderTemp += 500; |
|
1679 |
setTimeout(function () { |
|
1680 |
if (!potion.editable) {//不可编辑 取消点击事件 李伟民 0123 |
|
1681 |
return false; |
|
1682 |
} |
|
1683 |
var uploader; |
04dc45
|
1684 |
//发布页面 多选图片 曲辰明 3-27 |
Q |
1685 |
if (potion.imagetype == "single") { |
|
1686 |
var webUploaderJson = { |
|
1687 |
// 选完文件后,是否自动上传。 |
|
1688 |
auto: true, |
|
1689 |
// pick: '#'+potion.id+"dndArea", |
|
1690 |
pick: { |
|
1691 |
id: '#' + potion.id + 'imgPicker', |
|
1692 |
multiple: false//禁止多选 |
|
1693 |
}, |
|
1694 |
paste: potion.id, |
|
1695 |
swf: '../../dist/Uploader.swf', |
|
1696 |
} |
|
1697 |
}else{ |
|
1698 |
var webUploaderJson = { |
|
1699 |
// 选完文件后,是否自动上传。 |
|
1700 |
auto: true, |
|
1701 |
// pick: '#'+potion.id+"dndArea", |
|
1702 |
pick: { |
|
1703 |
id: '#' + potion.id + 'imgPicker', |
|
1704 |
multiple: true//多选 |
|
1705 |
}, |
|
1706 |
paste: potion.id, |
|
1707 |
swf: '../../dist/Uploader.swf', |
|
1708 |
} |
4d1219
|
1709 |
} |
B |
1710 |
var webUploaderJson = $.extend(webUploaderJson, window.commonWebUploaderJson(potion.formid)); |
|
1711 |
|
|
1712 |
|
|
1713 |
// 初始化Web Uploader |
|
1714 |
uploader = WebUploader.create(webUploaderJson); |
|
1715 |
|
|
1716 |
// uploader; |
|
1717 |
uploader.on('ready', function () { |
|
1718 |
window.uploader = uploader; |
|
1719 |
}); |
|
1720 |
// 当有文件添加进来的时候 |
|
1721 |
uploader.on('fileQueued', function (file) { |
|
1722 |
// var $list = $("#"+potion.id+"fileList"), |
|
1723 |
var $list = $(".customViewUEditorCss #" + potion.id + "fileList"), |
|
1724 |
$li = $( |
|
1725 |
'<div id="' + file.id + '" class="file-item thumbnail">' + |
|
1726 |
'<div class="frm_item_icons">' + |
|
1727 |
'<div class="frm_item_icon remove" imgId="' + file.id + '">' + |
3f9447
|
1728 |
'<div style="width:14px;height:14px;background:url(../../formEngine/resources/css/img/icon/delete.png)"></div></div>' + |
4d1219
|
1729 |
'</div>' + |
B |
1730 |
'<img class = "fileQueuedAddItem">' + |
|
1731 |
// '<div class="info">' + file.name + '</div>' + |
|
1732 |
'</div>' |
|
1733 |
), |
|
1734 |
$img = $li.find('.fileQueuedAddItem'); |
|
1735 |
|
|
1736 |
$li.find(".frm_item_icon").on('click', function () { |
|
1737 |
var imgId = this.getAttribute("imgId"); |
|
1738 |
$('#' + imgId).remove(); |
|
1739 |
if (imgId.indexOf("WU") > -1) { |
|
1740 |
uploader.removeFile(imgId, true); |
|
1741 |
} |
|
1742 |
delete customBase.options.uploaderItem[itemId][imgId]; |
|
1743 |
//单一图片的情况下 图片追加隐藏 |
|
1744 |
if (potion.imagetype == "single") { |
|
1745 |
$addLi.removeClass("cfg_contentNone"); |
|
1746 |
} |
|
1747 |
|
|
1748 |
event.stopPropagation(); |
|
1749 |
|
|
1750 |
}); |
|
1751 |
// $list为容器jQuery实例 |
|
1752 |
$list.prepend($li); |
|
1753 |
|
|
1754 |
//单一图片的情况下 图片追加隐藏 |
|
1755 |
if (potion.imagetype == "single") { |
|
1756 |
$addLi.addClass("cfg_contentNone"); |
|
1757 |
} |
|
1758 |
|
|
1759 |
// 创建缩略图 |
|
1760 |
// 如果为非图片文件,可以不用调用此方法。 |
|
1761 |
// thumbnailWidth x thumbnailHeight 为 100 x 100 |
|
1762 |
uploader.makeThumb(file, function (error, src) { |
|
1763 |
if (error) { |
|
1764 |
$img.replaceWith('<span>不能预览</span>'); |
|
1765 |
return; |
|
1766 |
} |
|
1767 |
// //////console.log(customBase.options.uploaderItem[itemId][file.id]); |
|
1768 |
// customBase.options.uploaderItem[itemId][file.id]["base64"] = src; |
|
1769 |
$img.attr('src', src); |
|
1770 |
// 12/21 |
|
1771 |
console.log($img) |
|
1772 |
$img.attr('data-original', src); |
04dc45
|
1773 |
// 发布页面查看大图 曲辰明 3-27 |
e2c25b
|
1774 |
if(localStorage.getItem("customShowFlag")!="3"){ |
Q |
1775 |
var viewer = new Viewer(document.getElementById(potion.id), { |
|
1776 |
show: function (){ |
|
1777 |
viewer.update(); |
|
1778 |
} |
|
1779 |
}); |
|
1780 |
} |
04dc45
|
1781 |
}, 400, 400); |
4d1219
|
1782 |
}); |
B |
1783 |
// 文件上传过程中创建进度条实时显示。 |
|
1784 |
uploader.on('uploadProgress', function (file, percentage) { |
|
1785 |
var $li = $('#' + file.id), |
|
1786 |
$percent = $li.find('.progress span'); |
|
1787 |
|
|
1788 |
// 避免重复创建 |
|
1789 |
if (!$percent.length) { |
|
1790 |
$percent = $('<p class="progress"><span></span></p>') |
|
1791 |
.appendTo($li) |
|
1792 |
.find('span'); |
|
1793 |
} |
|
1794 |
//////console.log(percentage); |
|
1795 |
$percent.css('width', percentage * 100 + '%'); |
|
1796 |
}); |
|
1797 |
|
|
1798 |
// 文件上传成功,给item添加成功class, 用样式标记上传成功。 |
|
1799 |
uploader.on('uploadSuccess', function (file, response) { |
|
1800 |
//////console.log(file); |
|
1801 |
//////console.log(response); |
|
1802 |
$('#' + file.id).addClass('upload-state-done'); |
|
1803 |
// customBase.options.uploaderFileName[file.id] = response.data; |
|
1804 |
customBase.options.uploaderItem[itemId][file.id] = response.data; |
|
1805 |
// //////console.log(customBase.options.uploaderItem[itemId][file.id]); |
|
1806 |
customBase.options.uploaderItem[itemId][file.id]["base64"] = $("#" + file.id + " .fileQueuedAddItem")[0].getAttribute("src"); |
|
1807 |
}); |
|
1808 |
|
|
1809 |
// 文件上传失败,显示上传出错。 |
|
1810 |
uploader.on('uploadError', function (file) { |
|
1811 |
var $li = $('#' + file.id), |
|
1812 |
$error = $li.find('div.error'); |
|
1813 |
|
|
1814 |
// 避免重复创建 |
|
1815 |
if (!$error.length) { |
|
1816 |
$error = $('<div class="error"></div>').appendTo($li); |
|
1817 |
} |
|
1818 |
|
|
1819 |
$error.text('上传失败'); |
|
1820 |
}); |
|
1821 |
|
|
1822 |
// 完成上传完了,成功或者失败,先删除进度条。 |
|
1823 |
uploader.on('uploadComplete', function (file) { |
|
1824 |
$('#' + file.id).find('.progress').remove(); |
|
1825 |
}); |
|
1826 |
}, customBase.uploaderTemp); |
|
1827 |
// 12/19 |
|
1828 |
console.log($uploadimg) |
|
1829 |
console.log($('#customViewUEditor').find('#itemId_1').children()) |
|
1830 |
|
|
1831 |
var $uploaderItems = $($("#customViewUEditor #" + potion.id)[0]); |
|
1832 |
var imgId = $uploaderItems.attr('id'); |
|
1833 |
var srcUrl = $uploaderItems.find('img').attr('src'); |
|
1834 |
// $uploaderItem.find('img').attr('data-original',srcUrl); |
|
1835 |
console.log($('#' + imgId).children().children()) |
|
1836 |
|
|
1837 |
console.log($('#' + imgId).find('#itemId_1fileList').find('label')) |
|
1838 |
$('#' + imgId).find('#itemId_1fileList').find('label').css({ |
|
1839 |
'height': '150px', |
|
1840 |
'width': '150px' |
|
1841 |
}) |
|
1842 |
var id = $('#' + imgId).children().children().attr('id') |
|
1843 |
//编辑 |
|
1844 |
var viewer = new Viewer(document.getElementById(id), { |
e2c25b
|
1845 |
show: function (){ |
Q |
1846 |
viewer.update(); |
|
1847 |
} |
4d1219
|
1848 |
}); |
B |
1849 |
console.log($('#customShow').children()) |
|
1850 |
console.log($("[style='opacity: 0; width: 100%; height: 100%; display: block; cursor: pointer; background: rgb(255, 255, 255)']")) |
|
1851 |
} |
|
1852 |
|
|
1853 |
|
|
1854 |
//图片上传 |
|
1855 |
customBase.uploaderShow_Temp = function (itemId, chunkSize, imgFlag, formID) { |
|
1856 |
if (chunkSize.width != 0) { |
|
1857 |
$(itemId + 'dndArea')[0].style.width = chunkSize.width + 'px'; |
|
1858 |
$(itemId + 'dndArea')[0].style.height = chunkSize.height + 'px'; |
|
1859 |
} |
|
1860 |
|
|
1861 |
var $wrap = $(itemId), |
|
1862 |
// 图片容器 |
|
1863 |
$queue = $('<ul class="filelist"></ul>').appendTo($wrap.find('.queueList')), |
|
1864 |
// 状态栏,包括进度和控制按钮 |
|
1865 |
$statusBar = $wrap.find('.statusBar'), |
|
1866 |
// 文件总体选择信息。 |
|
1867 |
$info = $statusBar.find('.info'), |
|
1868 |
// 上传按钮 |
|
1869 |
$upload = $wrap.find('.uploadBtn'), |
|
1870 |
// 没选择文件之前的内容。 |
|
1871 |
$placeHolder = $wrap.find('.placeholder'), |
|
1872 |
|
|
1873 |
$progress = $statusBar.find('.progress').hide(), |
|
1874 |
// 添加的文件数量 |
|
1875 |
fileCount = 0, |
|
1876 |
// 添加的文件总大小 |
|
1877 |
fileSize = 0, |
|
1878 |
// 优化retina, 在retina下这个值是2 |
|
1879 |
ratio = window.devicePixelRatio || 1, |
|
1880 |
// 缩略图大小 |
|
1881 |
thumbnailWidth = 110 * ratio, |
|
1882 |
thumbnailHeight = 110 * ratio, |
|
1883 |
// 可能有pedding, ready, uploading, confirm, done. |
|
1884 |
state = 'pedding', |
|
1885 |
// 所有文件的进度信息,key为file id |
|
1886 |
percentages = {}, |
|
1887 |
// 判断浏览器是否支持图片的base64 |
|
1888 |
isSupportBase64 = (function () { |
|
1889 |
var data = new Image(); |
|
1890 |
var support = true; |
|
1891 |
data.onload = data.onerror = function () { |
|
1892 |
if (this.width != 1 || this.height != 1) { |
|
1893 |
support = false; |
|
1894 |
} |
|
1895 |
} |
|
1896 |
data.src = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw=="; |
|
1897 |
return support; |
|
1898 |
})(), |
|
1899 |
// 检测是否已经安装flash,检测flash的版本 |
|
1900 |
flashVersion = (function () { |
|
1901 |
var version; |
|
1902 |
|
|
1903 |
try { |
|
1904 |
version = navigator.plugins['Shockwave Flash']; |
|
1905 |
version = version.description; |
|
1906 |
} catch (ex) { |
|
1907 |
try { |
|
1908 |
version = new ActiveXObject('ShockwaveFlash.ShockwaveFlash') |
|
1909 |
.GetVariable('$version'); |
|
1910 |
} catch (ex2) { |
|
1911 |
version = '0.0'; |
|
1912 |
} |
|
1913 |
} |
|
1914 |
version = version.match(/\d+/g); |
|
1915 |
return parseFloat(version[0] + '.' + version[1], 10); |
|
1916 |
})(), |
|
1917 |
|
|
1918 |
supportTransition = (function () { |
|
1919 |
var s = document.createElement('p').style, |
|
1920 |
r = 'transition' in s || |
|
1921 |
'WebkitTransition' in s || |
|
1922 |
'MozTransition' in s || |
|
1923 |
'msTransition' in s || |
|
1924 |
'OTransition' in s; |
|
1925 |
return r; |
|
1926 |
})(), |
|
1927 |
//创建 |
|
1928 |
uploader; |
|
1929 |
|
|
1930 |
if (!WebUploader.Uploader.support('flash') && WebUploader.browser.ie) { |
|
1931 |
// flash 安装了但是版本过低。 |
|
1932 |
if (flashVersion) { |
|
1933 |
(function (container) { |
|
1934 |
window['expressinstallcallback'] = function (state) { |
|
1935 |
switch (state) { |
|
1936 |
case 'Download.Cancelled': |
|
1937 |
customBase.alert("M", '您取消了更新!') |
|
1938 |
break; |
|
1939 |
|
|
1940 |
case 'Download.Failed': |
|
1941 |
customBase.alert("M", '安装失败') |
|
1942 |
break; |
|
1943 |
|
|
1944 |
default: |
|
1945 |
customBase.alert("M", '安装已成功,请刷新!'); |
|
1946 |
break; |
|
1947 |
} |
|
1948 |
delete window['expressinstallcallback']; |
|
1949 |
}; |
|
1950 |
|
|
1951 |
var swf = './expressInstall.swf'; |
|
1952 |
// insert flash object |
|
1953 |
var html = '<object type="application/' + |
|
1954 |
'x-shockwave-flash" data="' + swf + '" '; |
|
1955 |
|
|
1956 |
if (WebUploader.browser.ie) { |
|
1957 |
html += 'classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" '; |
|
1958 |
} |
|
1959 |
|
|
1960 |
html += 'width="100%" height="100%" style="outline:0">' + |
|
1961 |
'<param name="movie" value="' + swf + '" />' + |
|
1962 |
'<param name="wmode" value="transparent" />' + |
|
1963 |
'<param name="allowscriptaccess" value="always" />' + |
|
1964 |
'</object>'; |
|
1965 |
|
|
1966 |
container.html(html); |
|
1967 |
|
|
1968 |
})($wrap); |
|
1969 |
|
|
1970 |
// 压根就没有安转。 |
|
1971 |
} else { } |
|
1972 |
|
|
1973 |
return; |
|
1974 |
} else if (!WebUploader.Uploader.support()) { |
|
1975 |
customBase.alert("M", 'Web Uploader 不支持您的浏览器!'); |
|
1976 |
return; |
|
1977 |
} |
|
1978 |
if (imgFlag) { |
|
1979 |
labelTemp = '点击选择图片' |
|
1980 |
} else { |
|
1981 |
labelTemp = '点击选择文件' |
|
1982 |
} |
|
1983 |
|
|
1984 |
|
|
1985 |
|
|
1986 |
; |
|
1987 |
var webUploaderJson = { |
|
1988 |
pick: { |
|
1989 |
id: itemId + 'filePicker', |
|
1990 |
label: labelTemp |
|
1991 |
}, |
|
1992 |
dnd: itemId + 'dndArea', |
|
1993 |
paste: itemId, |
|
1994 |
swf: '../../dist/Uploader.swf', |
|
1995 |
chunked: false, |
|
1996 |
chunkSize: 512 * 1024, |
|
1997 |
// 禁掉全局的拖拽功能。这样不会出现图片拖进页面的时候,把图片打开。 |
|
1998 |
disableGlobalDnd: true, |
|
1999 |
fileNumLimit: 300, |
|
2000 |
fileSizeLimit: 200 * 1024 * 1024, // 200 M |
|
2001 |
fileSingleSizeLimit: 50 * 1024 * 1024 // 50 M |
|
2002 |
} |
|
2003 |
var webUploaderJson = $.extend(webUploaderJson, window.commonWebUploaderJson(formID)); |
|
2004 |
|
|
2005 |
// 实例化 |
|
2006 |
uploader = WebUploader.create(webUploaderJson); |
|
2007 |
|
|
2008 |
// 拖拽时不接受 js, txt 文件。 |
|
2009 |
uploader.on('dndAccept', function (items) { |
|
2010 |
var denied = false, |
|
2011 |
len = items.length, |
|
2012 |
i = 0, |
|
2013 |
// 修改js类型 |
|
2014 |
unAllowed = 'text/plain;application/javascript '; |
|
2015 |
|
|
2016 |
for (; i < len; i++) { |
|
2017 |
// 如果在列表里面 |
|
2018 |
if (~unAllowed.indexOf(items[i].type)) { |
|
2019 |
denied = true; |
|
2020 |
break; |
|
2021 |
} |
|
2022 |
} |
|
2023 |
|
|
2024 |
return !denied; |
|
2025 |
}); |
|
2026 |
|
|
2027 |
// 添加“添加文件”的按钮, |
|
2028 |
uploader.addButton({ |
|
2029 |
id: itemId + 'filePicker2', |
|
2030 |
label: '继续添加' |
|
2031 |
}); |
|
2032 |
//文件读取 |
|
2033 |
uploader.on('ready', function () { |
|
2034 |
window.uploader = uploader; |
|
2035 |
$queue.empty(); |
|
2036 |
var json = customBase.options.uploaderItemReady[itemId.replace("#", "")]; |
|
2037 |
if (json == undefined) { |
|
2038 |
json = []; |
|
2039 |
} |
|
2040 |
var jsonLen = json.length; |
|
2041 |
if (jsonLen != 0) { |
|
2042 |
fileCount = jsonLen; |
|
2043 |
$placeHolder.addClass('element-invisible'); |
|
2044 |
$statusBar.show(); |
|
2045 |
//显示在页面上 |
|
2046 |
$.each(json, function (i, n) { |
|
2047 |
fileSize += n.filelen; |
|
2048 |
var obj = {}, statusMap = {} |
|
2049 |
, file_id = 'WU_FILE_' + i; |
|
2050 |
obj.id = file_id; |
|
2051 |
obj.name = n.filebasename; |
|
2052 |
obj.filename = n.filename; |
|
2053 |
obj.getStatus = function () { |
|
2054 |
return ''; |
|
2055 |
}; |
|
2056 |
obj.statusText = ''; |
|
2057 |
obj.size = n.filelen; |
|
2058 |
obj.version = WebUploader.Base.version; |
|
2059 |
obj.type = n.mimeType; |
|
2060 |
obj.filetype = n.filetype; |
|
2061 |
obj.source = this; |
|
2062 |
obj.path = n.filePath.path; |
|
2063 |
obj.setStatus = function (status, text) { |
|
2064 |
|
|
2065 |
var prevStatus = statusMap[this.id]; |
|
2066 |
|
|
2067 |
typeof text !== 'undefined' && (this.statusText = text); |
|
2068 |
|
|
2069 |
if (status !== prevStatus) { |
|
2070 |
statusMap[this.id] = status; |
|
2071 |
/** |
|
2072 |
* 文件状态变化 |
|
2073 |
* @event statuschange |
|
2074 |
*/ |
|
2075 |
uploader.trigger('statuschange', status, prevStatus); |
|
2076 |
} |
|
2077 |
}; |
|
2078 |
editFile(obj); |
|
2079 |
$("#" + file_id).append(inputStr(i, n)); |
|
2080 |
}); |
|
2081 |
|
|
2082 |
WebUploader.Base.idSuffix = jsonLen; |
|
2083 |
|
|
2084 |
setState('ready'); |
|
2085 |
updateTotalProgress(); |
|
2086 |
} |
|
2087 |
// },'json'); |
|
2088 |
}); |
|
2089 |
|
|
2090 |
function inputStr(index, json) { |
|
2091 |
var inputStr = ''; |
|
2092 |
var pre = itemId; |
|
2093 |
//转化格式后的名称 |
|
2094 |
inputStr += '<input name="' + pre + 'list[' + index + '].filename" value="' + json.filename + '" style="display:none"/>'; |
|
2095 |
//保存路径 |
|
2096 |
inputStr += '<input name="' + pre + 'list[' + index + '].filepath" value="' + json.filepath + '" style="display:none"/>'; |
|
2097 |
//文件源名称 |
|
2098 |
inputStr += '<input name="' + pre + 'list[' + index + '].filebasename" value="' + json.filebasename + '" style="display:none"/>'; |
|
2099 |
|
|
2100 |
//文件类型 doc?xls? |
|
2101 |
inputStr += '<input name="' + pre + 'list[' + index + '].filetype" value="' + json.filetype + '" style="display:none"/>'; |
|
2102 |
//文件大小 |
|
2103 |
inputStr += '<input name="' + pre + 'list[' + index + '].filelen" value="' + json.filelen + '" style="display:none"/>'; |
|
2104 |
//doc转为html |
|
2105 |
inputStr += '<input name="' + pre + 'list[' + index + '].doc2htmlpath" value="' + json.doc2htmlpath + '" style="display:none"/>'; |
|
2106 |
//mimeType |
|
2107 |
inputStr += '<input name="' + pre + 'list[' + index + '].mimeType" value="' + json.mimeType + '" style="display:none"/>'; |
|
2108 |
return inputStr; |
|
2109 |
} |
|
2110 |
|
|
2111 |
function editFile(file) { |
|
2112 |
if (imgFlag) { |
|
2113 |
var $li = $('<li id="' + file.id + '" class="imgfileLiShow">' + |
|
2114 |
'<p class="title">' + file.name + '</p>' + |
|
2115 |
'<p class="imgWrap"></p>' + |
|
2116 |
'<p class="progress"><span></span></p>' + |
|
2117 |
'</li>'), |
|
2118 |
|
|
2119 |
$btns = $('<div class="file-panel">' + |
|
2120 |
'<span class="cancel">删除</span>' + |
|
2121 |
'<span class="rotateRight">向右旋转</span>' + |
|
2122 |
'<span class="rotateLeft">向左旋转</span></div>').appendTo($li), |
|
2123 |
|
|
2124 |
$wrap = $li.find('p.imgWrap') |
|
2125 |
|
|
2126 |
} else { |
|
2127 |
var $li = $('<li id="' + file.id + '">' + |
|
2128 |
'<div class="title" style="word-break:break-all;text-align:left;font-size:16px">' + file.filename + '</div>' + |
|
2129 |
|
|
2130 |
'</li>'), |
|
2131 |
$btns = $('<div class="file-panel">' + |
|
2132 |
'<span class="cancel">删除</span>' |
|
2133 |
|
|
2134 |
+ '</div>' |
|
2135 |
).appendTo($li), |
|
2136 |
|
|
2137 |
$wrap = $li.find('p.imgWrap') |
|
2138 |
} |
|
2139 |
|
|
2140 |
if (file.getStatus() === 'invalid') { |
|
2141 |
showError(file.statusText); |
|
2142 |
} else { |
|
2143 |
// @todo lazyload |
|
2144 |
$wrap.empty(); |
|
2145 |
$wrap.text('不能预览'); |
|
2146 |
|
|
2147 |
var img; |
|
2148 |
//判断是否是图片 |
|
2149 |
src = file.path; |
|
2150 |
img = $('<img src="' + src + '" style="height:100%;">'); |
|
2151 |
$wrap.empty().append(img); |
|
2152 |
|
|
2153 |
percentages[file.id] = [file.size, 0]; |
|
2154 |
file.rotation = 0; |
|
2155 |
} |
|
2156 |
|
|
2157 |
|
|
2158 |
|
|
2159 |
$li.append('<span class="success"></span>'); |
|
2160 |
|
|
2161 |
$li.on('mouseenter', function () { |
|
2162 |
$btns.stop().animate({ height: 30 }); |
|
2163 |
}); |
|
2164 |
|
|
2165 |
$li.on('mouseleave', function () { |
|
2166 |
$btns.stop().animate({ height: 0 }); |
|
2167 |
}); |
|
2168 |
|
|
2169 |
$btns.on('click', 'span', function () { |
|
2170 |
var index = $(this).index(), |
|
2171 |
deg; |
|
2172 |
|
|
2173 |
switch (index) { |
|
2174 |
case 0: |
|
2175 |
// uploader.removeFile( file ); |
|
2176 |
return; |
|
2177 |
|
|
2178 |
case 1: |
|
2179 |
file.rotation += 90; |
|
2180 |
break; |
|
2181 |
|
|
2182 |
case 2: |
|
2183 |
file.rotation -= 90; |
|
2184 |
break; |
|
2185 |
} |
|
2186 |
|
|
2187 |
if (supportTransition) { |
|
2188 |
deg = 'rotate(' + file.rotation + 'deg)'; |
|
2189 |
$wrap.css({ |
|
2190 |
'-webkit-transform': deg, |
|
2191 |
'-mos-transform': deg, |
|
2192 |
'-o-transform': deg, |
|
2193 |
'transform': deg |
|
2194 |
}); |
|
2195 |
} else { |
|
2196 |
$wrap.css('filter', 'progid:DXImageTransform.Microsoft.BasicImage(rotation=' + (~~((file.rotation / 90) % 4 + 4) % 4) + ')'); |
|
2197 |
} |
|
2198 |
|
|
2199 |
|
|
2200 |
}); |
|
2201 |
|
|
2202 |
$li.appendTo($queue); |
|
2203 |
} |
|
2204 |
|
|
2205 |
|
|
2206 |
// 当有文件添加进来时执行,负责view的创建 |
|
2207 |
if (imgFlag) { } |
|
2208 |
function addFile(file) { |
|
2209 |
if (imgFlag) { |
|
2210 |
var $li = $('<li id="' + file.id + '" class="imgfileLiShow">' + |
|
2211 |
'<p class="title">' + file.name + '</p>' + |
|
2212 |
'<p class="imgWrap"></p>' + |
|
2213 |
'<p class="progress"><span></span></p>' + |
|
2214 |
'</li>'), |
|
2215 |
|
|
2216 |
$btns = $('<div class="file-panel">' + |
|
2217 |
'<span class="cancel">删除</span>' + |
|
2218 |
'<span class="rotateRight">向右旋转</span>' + |
|
2219 |
'<span class="rotateLeft">向左旋转</span></div>').appendTo($li), |
|
2220 |
$prgress = $li.find('p.progress span'), |
|
2221 |
$wrap = $li.find('p.imgWrap'), |
|
2222 |
$info = $('<p class="error"></p>') |
|
2223 |
} else { |
|
2224 |
var $li = $('<li id="' + file.id + '">' + |
|
2225 |
'<div class="title" style="word-break:break-all;text-align:left;font-size:16px">' + file.name + '</div>' + |
|
2226 |
'</li>'), |
|
2227 |
|
|
2228 |
$btns = $('<div class="file-panel">' + |
|
2229 |
'<span class="cancel">删除</span>' + |
|
2230 |
'</div>' |
|
2231 |
).appendTo($li), |
|
2232 |
$prgress = $li.find('p.progress span'), |
|
2233 |
$wrap = $li.find('p.imgWrap'), |
|
2234 |
$info = $('<p class="error"></p>') |
|
2235 |
} |
|
2236 |
|
|
2237 |
|
|
2238 |
showError = function (code) { |
|
2239 |
switch (code) { |
|
2240 |
case 'exceed_size': |
|
2241 |
text = '文件大小超出'; |
|
2242 |
break; |
|
2243 |
|
|
2244 |
case 'interrupt': |
|
2245 |
text = '上传暂停'; |
|
2246 |
break; |
|
2247 |
|
|
2248 |
default: |
|
2249 |
text = '上传失败,请重试'; |
|
2250 |
break; |
|
2251 |
} |
|
2252 |
|
|
2253 |
$info.text(text).appendTo($li); |
|
2254 |
}; |
|
2255 |
|
|
2256 |
if (file.getStatus() === 'invalid') { |
|
2257 |
showError(file.statusText); |
|
2258 |
} else { |
|
2259 |
// @todo lazyload |
|
2260 |
$wrap.text('预览中'); |
|
2261 |
uploader.makeThumb(file, function (error, src) { |
|
2262 |
var img; |
|
2263 |
|
|
2264 |
if (error) { |
|
2265 |
$wrap.text('不能预览'); |
|
2266 |
return; |
|
2267 |
} |
|
2268 |
if (isSupportBase64) { |
|
2269 |
img = $('<img src="' + src + '">'); |
|
2270 |
$wrap.empty().append(img); |
|
2271 |
} else { |
|
2272 |
|
|
2273 |
} |
|
2274 |
}, thumbnailWidth, thumbnailHeight); |
|
2275 |
|
|
2276 |
percentages[file.id] = [file.size, 0]; |
|
2277 |
file.rotation = 0; |
|
2278 |
} |
|
2279 |
|
|
2280 |
file.on('statuschange', function (cur, prev) { |
|
2281 |
if (prev === 'progress') { |
|
2282 |
$prgress.hide().width(0); |
|
2283 |
} else if (prev === 'queued') { |
|
2284 |
$li.off('mouseenter mouseleave'); |
|
2285 |
$btns.remove(); |
|
2286 |
} |
|
2287 |
|
|
2288 |
// 成功 |
|
2289 |
if (cur === 'error' || cur === 'invalid') { |
|
2290 |
//////////console.log( file.statusText ); |
|
2291 |
showError(file.statusText); |
|
2292 |
percentages[file.id][1] = 1; |
|
2293 |
} else if (cur === 'interrupt') { |
|
2294 |
showError('interrupt'); |
|
2295 |
} else if (cur === 'queued') { |
|
2296 |
percentages[file.id][1] = 0; |
|
2297 |
} else if (cur === 'progress') { |
|
2298 |
$info.remove(); |
|
2299 |
$prgress.css('display', 'block'); |
|
2300 |
} else if (cur === 'complete') { |
|
2301 |
$li.append('<span class="success"></span>'); |
|
2302 |
} |
|
2303 |
|
|
2304 |
$li.removeClass('state-' + prev).addClass('state-' + cur); |
|
2305 |
}); |
|
2306 |
|
|
2307 |
$li.on('mouseenter', function () { |
|
2308 |
$btns.stop().animate({ height: 30 }); |
|
2309 |
}); |
|
2310 |
|
|
2311 |
$li.on('mouseleave', function () { |
|
2312 |
$btns.stop().animate({ height: 0 }); |
|
2313 |
}); |
|
2314 |
|
|
2315 |
$btns.on('click', 'span', function () { |
|
2316 |
var index = $(this).index(), |
|
2317 |
deg; |
|
2318 |
|
|
2319 |
switch (index) { |
|
2320 |
case 0: |
|
2321 |
uploader.removeFile(file); |
|
2322 |
return; |
|
2323 |
|
|
2324 |
case 1: |
|
2325 |
file.rotation += 90; |
|
2326 |
break; |
|
2327 |
|
|
2328 |
case 2: |
|
2329 |
file.rotation -= 90; |
|
2330 |
break; |
|
2331 |
} |
|
2332 |
|
|
2333 |
if (supportTransition) { |
|
2334 |
deg = 'rotate(' + file.rotation + 'deg)'; |
|
2335 |
$wrap.css({ |
|
2336 |
'-webkit-transform': deg, |
|
2337 |
'-mos-transform': deg, |
|
2338 |
'-o-transform': deg, |
|
2339 |
'transform': deg |
|
2340 |
}); |
|
2341 |
} else { |
|
2342 |
$wrap.css('filter', 'progid:DXImageTransform.Microsoft.BasicImage(rotation=' + (~~((file.rotation / 90) % 4 + 4) % 4) + ')'); |
|
2343 |
} |
|
2344 |
|
|
2345 |
|
|
2346 |
}); |
|
2347 |
|
|
2348 |
$li.appendTo($queue); |
|
2349 |
} |
|
2350 |
|
|
2351 |
// 负责view的销毁 |
|
2352 |
function removeFile(file) { |
|
2353 |
var $li = $('#' + file.id); |
|
2354 |
|
|
2355 |
delete percentages[file.id]; |
|
2356 |
updateTotalProgress(); |
|
2357 |
$li.off().find('.file-panel').off().end().remove(); |
|
2358 |
} |
|
2359 |
|
|
2360 |
function updateTotalProgress() { |
|
2361 |
var loaded = 0, |
|
2362 |
total = 0, |
|
2363 |
spans = $progress.children(), |
|
2364 |
percent; |
|
2365 |
|
|
2366 |
$.each(percentages, function (k, v) { |
|
2367 |
total += v[0]; |
|
2368 |
loaded += v[0] * v[1]; |
|
2369 |
}); |
|
2370 |
|
|
2371 |
percent = total ? loaded / total : 0; |
|
2372 |
|
|
2373 |
|
|
2374 |
spans.eq(0).text(Math.round(percent * 100) + '%'); |
|
2375 |
spans.eq(1).css('width', Math.round(percent * 100) + '%'); |
|
2376 |
updateStatus(); |
|
2377 |
} |
|
2378 |
|
|
2379 |
function updateStatus() { |
|
2380 |
var text = '', stats; |
|
2381 |
|
|
2382 |
if (state === 'ready') { |
|
2383 |
if (imgFlag) { |
|
2384 |
text = '选中' + fileCount + '张图片,共' + WebUploader.formatSize(fileSize) + '。'; |
|
2385 |
} else { |
|
2386 |
text = '选中' + fileCount + '个文件,共' + WebUploader.formatSize(fileSize) + '。'; |
|
2387 |
} |
|
2388 |
|
|
2389 |
} else if (state === 'confirm') { |
|
2390 |
stats = uploader.getStats(); |
|
2391 |
if (stats.uploadFailNum) { |
|
2392 |
if (imgFlag) { |
|
2393 |
text = '已成功上传' + stats.successNum + '张照片至XX相册,' + |
|
2394 |
stats.uploadFailNum + '张照片上传失败,<a class="retry" href="#">重新上传</a>失败图片或<a class="ignore" href="#">忽略</a>' |
|
2395 |
} else { |
|
2396 |
text = '已成功上传' + stats.successNum + '个文件至XX文件夹,' + |
|
2397 |
stats.uploadFailNum + '个文件上传失败,<a class="retry" href="#">重新上传</a>失败文件或<a class="ignore" href="#">忽略</a>' |
|
2398 |
} |
|
2399 |
} |
|
2400 |
|
|
2401 |
} else { |
|
2402 |
stats = uploader.getStats(); |
|
2403 |
if (imgFlag) { |
|
2404 |
text = '共' + fileCount + '张(' + |
|
2405 |
WebUploader.formatSize(fileSize) + |
|
2406 |
'),已上传' + stats.successNum + '张'; |
|
2407 |
|
|
2408 |
if (stats.uploadFailNum) { |
|
2409 |
text += ',失败' + stats.uploadFailNum + '张'; |
|
2410 |
} |
|
2411 |
} else { |
|
2412 |
text = '共' + fileCount + '个文件(' + |
|
2413 |
WebUploader.formatSize(fileSize) + |
|
2414 |
'),已上传' + stats.successNum + '个文件'; |
|
2415 |
|
|
2416 |
if (stats.uploadFailNum) { |
|
2417 |
text += ',失败' + stats.uploadFailNum + '个文件'; |
|
2418 |
} |
|
2419 |
} |
|
2420 |
|
|
2421 |
} |
|
2422 |
|
|
2423 |
$info.html(text); |
|
2424 |
} |
|
2425 |
|
|
2426 |
function setState(val) { |
|
2427 |
var file, stats; |
|
2428 |
|
|
2429 |
if (val === state) { |
|
2430 |
return; |
|
2431 |
} |
|
2432 |
|
|
2433 |
$upload.removeClass('state-' + state); |
|
2434 |
$upload.addClass('state-' + val); |
|
2435 |
state = val; |
|
2436 |
|
|
2437 |
switch (state) { |
|
2438 |
case 'pedding': |
|
2439 |
$placeHolder.removeClass('element-invisible'); |
|
2440 |
$queue.hide(); |
|
2441 |
$statusBar.addClass('element-invisible'); |
|
2442 |
uploader.refresh(); |
|
2443 |
break; |
|
2444 |
|
|
2445 |
case 'ready': |
|
2446 |
$placeHolder.addClass('element-invisible'); |
|
2447 |
$('#filePicker2').removeClass('element-invisible'); |
|
2448 |
$queue.show(); |
|
2449 |
$statusBar.removeClass('element-invisible'); |
|
2450 |
uploader.refresh(); |
|
2451 |
break; |
|
2452 |
|
|
2453 |
case 'uploading': |
|
2454 |
$('#filePicker2').addClass('element-invisible'); |
|
2455 |
$progress.show(); |
|
2456 |
$upload.text('暂停上传'); |
|
2457 |
break; |
|
2458 |
|
|
2459 |
case 'paused': |
|
2460 |
$progress.show(); |
|
2461 |
$upload.text('继续上传'); |
|
2462 |
break; |
|
2463 |
|
|
2464 |
case 'confirm': |
|
2465 |
$progress.hide(); |
|
2466 |
$('#filePicker2').removeClass('element-invisible'); |
|
2467 |
$upload.text('开始上传'); |
|
2468 |
|
|
2469 |
stats = uploader.getStats(); |
|
2470 |
if (stats.successNum && !stats.uploadFailNum) { |
|
2471 |
setState('finish'); |
|
2472 |
return; |
|
2473 |
} |
|
2474 |
break; |
|
2475 |
case 'finish': |
|
2476 |
stats = uploader.getStats(); |
|
2477 |
if (stats.successNum) { |
|
2478 |
var strMessage = customBase.getMessage("mesage_ID005"); |
|
2479 |
customBase.alert("S", strMessage); |
|
2480 |
// alert( '上传成功' ); |
|
2481 |
} else { |
|
2482 |
// 没有成功的图片,重设 |
|
2483 |
state = 'done'; |
|
2484 |
location.reload(); |
|
2485 |
} |
|
2486 |
break; |
|
2487 |
} |
|
2488 |
|
|
2489 |
updateStatus(); |
|
2490 |
} |
|
2491 |
|
|
2492 |
uploader.onUploadProgress = function (file, percentage) { |
|
2493 |
var $li = $('#' + file.id), |
|
2494 |
$percent = $li.find('.progress span'); |
|
2495 |
|
|
2496 |
$percent.css('width', percentage * 100 + '%'); |
|
2497 |
percentages[file.id][1] = percentage; |
|
2498 |
updateTotalProgress(); |
|
2499 |
customBase.options.uploaderItem[itemId] = uploader.getFiles(); |
|
2500 |
}; |
|
2501 |
|
|
2502 |
uploader.onFileQueued = function (file) { |
|
2503 |
fileCount++; |
|
2504 |
fileSize += file.size; |
|
2505 |
|
|
2506 |
if (fileCount === 1) { |
|
2507 |
$placeHolder.addClass('element-invisible'); |
|
2508 |
$statusBar.show(); |
|
2509 |
} |
|
2510 |
|
|
2511 |
addFile(file); |
|
2512 |
setState('ready'); |
|
2513 |
updateTotalProgress(); |
|
2514 |
}; |
|
2515 |
|
|
2516 |
uploader.onFileDequeued = function (file) { |
|
2517 |
fileCount--; |
|
2518 |
fileSize -= file.size; |
|
2519 |
|
|
2520 |
if (!fileCount) { |
|
2521 |
setState('pedding'); |
|
2522 |
} |
|
2523 |
|
|
2524 |
removeFile(file); |
|
2525 |
updateTotalProgress(); |
|
2526 |
|
|
2527 |
}; |
|
2528 |
|
|
2529 |
uploader.on('all', function (type) { |
|
2530 |
var stats; |
|
2531 |
switch (type) { |
|
2532 |
case 'uploadFinished': |
|
2533 |
setState('confirm'); |
|
2534 |
break; |
|
2535 |
|
|
2536 |
case 'startUpload': |
|
2537 |
setState('uploading'); |
|
2538 |
break; |
|
2539 |
|
|
2540 |
case 'stopUpload': |
|
2541 |
setState('paused'); |
|
2542 |
break; |
|
2543 |
|
|
2544 |
} |
|
2545 |
}); |
|
2546 |
|
|
2547 |
uploader.onError = function (code) { |
|
2548 |
customBase.alert("M", 'Eroor: ' + code); |
|
2549 |
}; |
|
2550 |
|
|
2551 |
$upload.on('click', function () { |
|
2552 |
if ($(this).hasClass('disabled')) { |
|
2553 |
return false; |
|
2554 |
} |
|
2555 |
if (state === 'ready') { |
|
2556 |
uploader.upload(); |
|
2557 |
uploader.on('uploadSuccess', function (file, response) { |
|
2558 |
customBase.options.uploaderFileName[response.data.oldName] = response.data; |
|
2559 |
}) |
|
2560 |
} else if (state === 'paused') { |
|
2561 |
uploader.upload(); |
|
2562 |
} else if (state === 'uploading') { |
|
2563 |
uploader.stop(); |
|
2564 |
} |
|
2565 |
}); |
|
2566 |
|
|
2567 |
$info.on('click', '.retry', function () { |
|
2568 |
uploader.retry(); |
|
2569 |
}); |
|
2570 |
|
|
2571 |
$info.on('click', '.ignore', function () { |
|
2572 |
customBase.alert("M", 'todo'); |
|
2573 |
}); |
|
2574 |
|
|
2575 |
$upload.addClass('state-' + state); |
|
2576 |
updateTotalProgress(); |
|
2577 |
} |
|
2578 |
|
|
2579 |
//得到金融控件的HTMLL |
|
2580 |
customBase.getAmountHtml = function (sizeWidthHeight, flag) { |
|
2581 |
var width = sizeWidthHeight.width; |
|
2582 |
var linewidth = (width - 10) / 11; |
|
2583 |
var item = sizeWidthHeight.defaultvalue; |
|
2584 |
var height = sizeWidthHeight.height; |
|
2585 |
var lineheight = parseInt(height) + 20; |
|
2586 |
var margin_top = '-20'; |
|
2587 |
var itemTemp = item.split(""); |
|
2588 |
var items = []; |
|
2589 |
var nbsp = ''; |
|
2590 |
|
|
2591 |
if (flag) { |
|
2592 |
nbsp = 'nbsp'; |
|
2593 |
} else { |
|
2594 |
nbsp = ' '; |
|
2595 |
margin_top = '10'; |
|
2596 |
} |
|
2597 |
for (var i = 0; i < 11; i++) { |
|
2598 |
items[i] = nbsp; |
|
2599 |
}; |
|
2600 |
for (var i = 0; i < itemTemp.length; i++) { |
|
2601 |
items[11 - i - 1] = itemTemp[itemTemp.length - i - 1]; |
|
2602 |
}; |
|
2603 |
|
|
2604 |
var oNode = '<div style="width:' + (width) + 'px;">'; |
|
2605 |
oNode += '<hr style="float:left;width: 1px;height:' + lineheight + 'px;margin-top:' + margin_top + 'px;border: #fff;"/>'; |
|
2606 |
if (items[0] == "nbsp") { |
|
2607 |
// items[0] = " "; |
|
2608 |
oNode += '<span style="width:' + (linewidth) + ';float:left;line-height:' + height + 'px;color:#fff;">' + ' ' + '</span>'; |
|
2609 |
} else { |
|
2610 |
oNode += '<span style="width:' + (linewidth) + ';float:left;line-height:' + height + 'px;">' + items[0] + '</span>'; |
|
2611 |
} |
|
2612 |
|
|
2613 |
var hrcolor = ""; |
|
2614 |
for (var i = 0; i < 10; i++) { |
|
2615 |
if (i == 2 || i == 5) { |
|
2616 |
hrcolor = '#31b0d5'; |
|
2617 |
} else if (i == 8) { |
|
2618 |
hrcolor = '#D53137'; |
|
2619 |
} else { |
|
2620 |
hrcolor = '#eee'; |
|
2621 |
} |
|
2622 |
oNode += '<hr style="border:0px;background-color:' + hrcolor + ';color:' + hrcolor + ';float: left;width: 1px;height:' + lineheight + 'px;margin-top:' + margin_top + 'px;"/>'; |
|
2623 |
// oNode += '<span style="width:'+linewidth+'px;float:left;line-height:'+height+'px;">'+items[i+1]+'</span>'; |
|
2624 |
////////////console.log(items[i+1]); |
|
2625 |
if (items[i + 1] == "nbsp") { |
|
2626 |
// items[0] = "0"; |
|
2627 |
oNode += '<span style="width:' + linewidth + 'px;float:left;line-height:' + height + 'px;color:#fff;">' + ' ' + '</span>'; |
|
2628 |
} else { |
|
2629 |
oNode += '<span style="width:' + linewidth + 'px;float:left;line-height:' + height + 'px;">' + items[i + 1] + '</span>'; |
|
2630 |
} |
|
2631 |
|
|
2632 |
}; |
|
2633 |
oNode += "</div>"; |
|
2634 |
return oNode; |
|
2635 |
} |
|
2636 |
|
|
2637 |
//条码设定 |
|
2638 |
customBase.createbarcode = function (val, text, callback) { |
|
2639 |
|
|
2640 |
var sizeWidthHeight = { width: 88, height: 40, styleclass: "" }; |
|
2641 |
var barWidth = 1; |
|
2642 |
var barHeight = 5; |
|
2643 |
val = parseInt(val); |
|
2644 |
val = val; |
|
2645 |
if (val == 1) { |
|
2646 |
barWidth = 1; |
|
2647 |
barHeight = 30; |
|
2648 |
sizeWidthHeight = { width: 88, height: 40, styleclass: "" }; |
|
2649 |
} else if (val == 2) { |
|
2650 |
barWidth = 2; |
|
2651 |
barHeight = 40; |
|
2652 |
sizeWidthHeight = { width: 176, height: 50, styleclass: "" }; |
|
2653 |
} else if (val == 3) { |
|
2654 |
barWidth = 3; |
|
2655 |
barHeight = 50; |
|
2656 |
sizeWidthHeight = { width: 264, height: 60, styleclass: "" }; |
|
2657 |
} else if (val == 4) { |
|
2658 |
barWidth = 4; |
|
2659 |
barHeight = 60; |
|
2660 |
sizeWidthHeight = { width: 352, height: 70, styleclass: "" }; |
|
2661 |
} else if (val == 5) { |
|
2662 |
barWidth = 5; |
|
2663 |
barHeight = 70; |
|
2664 |
sizeWidthHeight = { width: 440, height: 80, styleclass: "" }; |
|
2665 |
} else if (val == 6) { |
|
2666 |
barWidth = 6; |
|
2667 |
barHeight = 80; |
|
2668 |
sizeWidthHeight = { width: 528, height: 90, styleclass: "" }; |
|
2669 |
} |
|
2670 |
|
|
2671 |
//条形码数据回调 |
|
2672 |
callback(text, barWidth, barHeight, sizeWidthHeight); |
|
2673 |
} |
|
2674 |
customBase.zTreeOnClick = function (event, treeId, treeNode) { |
|
2675 |
console.log(this); |
|
2676 |
console.log(event); |
|
2677 |
console.log(treeId); |
|
2678 |
console.log(treeNode); |
|
2679 |
|
|
2680 |
if (treeNode.checked) { |
|
2681 |
// 单击事件 by kill |
|
2682 |
if ($('#span_' + treeNode.id).val() == undefined || $('#span_' + treeNode.id).val() == "") { |
|
2683 |
var i = $('#' + treeId).children(':first').children(':nth-child(2)').attr('class').indexOf('radio'); |
|
2684 |
if (i != -1) { |
|
2685 |
////console.log(i) |
|
2686 |
////console.log('span_'+treeId) |
|
2687 |
$('.span_' + treeId).remove(); |
|
2688 |
$('#' + treeId.replace("tree", "")) |
|
2689 |
.parent().parent().children(':first').children(':nth-child(4)').remove(); |
|
2690 |
} |
|
2691 |
//$('#'+treeId.replace("tree","")).parent().parent().children(':first') |
|
2692 |
// .append('<span id="span_'+treeNode.id+'">|'+treeNode.name+' </sapn>') |
|
2693 |
} |
|
2694 |
} else { |
|
2695 |
$('#span_' + treeNode.id).remove(); |
|
2696 |
} |
|
2697 |
var dofuncion = customBase.options.zTreeOnClickItems[treeId]; |
|
2698 |
if (dofuncion != undefined) { |
|
2699 |
eval(dofuncion); |
|
2700 |
} |
|
2701 |
}; |
|
2702 |
// 2017/11/2 李元杰 单选树选中事件 |
|
2703 |
customBase.zTreeOncheckRadio = function (e, treeId, treeNode) { |
|
2704 |
//console.log($('#citySel').parents('div[name=treeWinTitle]').next().attr('id')); |
|
2705 |
|
|
2706 |
var zTree = $.fn.zTree.getZTreeObj(treeId); |
|
2707 |
//console.log(zTree) |
|
2708 |
var nodes = zTree.getCheckedNodes(true); |
|
2709 |
var v = ""; |
|
2710 |
var dataObj = {} |
|
2711 |
for (var i = 0, l = nodes.length; i < l; i++) { |
|
2712 |
v += nodes[i].name + ","; |
|
2713 |
console.log(nodes) |
|
2714 |
dataObj[nodes[i].id] = '1' |
|
2715 |
} |
|
2716 |
if (v.length > 0) v = v.substring(0, v.length - 1) |
|
2717 |
// 2017/11/6 李元杰 单选树 |
|
2718 |
|
|
2719 |
// console.log($('#'+treeId).parents('div[name="TreeWin"]').find('.citySel')) |
|
2720 |
// console.log( ) |
|
2721 |
|
|
2722 |
$(e.currentTarget).parent().attr('value', JSON.stringify(dataObj)) |
|
2723 |
$(e.currentTarget).parents('div[name="TreeWin"]').find('.citySel').val(v); |
|
2724 |
// // cityObj.attr("value", v); |
|
2725 |
// console.log(e); |
|
2726 |
// console.log(treeId); |
|
2727 |
// console.log(treeNode); |
|
2728 |
// // $('#'+treeId).parents('div[type="tree"]').find('h8').children(':nth-child(4)').remove(); |
|
2729 |
// console.log( $('#'+treeId).parents('div[type="tree"]').find('h8')); |
|
2730 |
// console.log( $('#'+treeId).parents('div[type="tree"]').find('h8').children(':nth-child(3)')) |
|
2731 |
|
|
2732 |
// if(treeNode.checked){ |
|
2733 |
// // 单击事件 by kill |
|
2734 |
// if($('#span_'+treeNode.id).val()==undefined||$('#span_'+treeNode.id).val()==""){ |
|
2735 |
// //console.log($('#'+treeId)) |
|
2736 |
// var i=$('#'+treeId).children(':first').children(':nth-child(2)').attr('class').indexOf('radio'); |
|
2737 |
// if(i!=-1){ |
|
2738 |
// //console.log(i) |
|
2739 |
// //console.log('span_'+treeId) |
|
2740 |
// $('.span_'+treeId).remove(); |
|
2741 |
// $('#'+treeId.replace("tree","")) |
|
2742 |
// .parent().parent().children(':first').children(':nth-child(4)').remove(); |
|
2743 |
// } |
|
2744 |
// } |
|
2745 |
// }else{ |
|
2746 |
// $('#span_'+treeNode.id).remove(); |
|
2747 |
// } |
|
2748 |
var pitchon = ` |
|
2749 |
<span id="spanDiv'+${treeId}+'"> |
|
2750 |
<span>|${v}</span> |
|
2751 |
</span> |
|
2752 |
` |
|
2753 |
// $('#'+treeId).parents('div[type="tree"]').find('h8').children(':nth-child(4)').remove(); |
|
2754 |
// $('#'+treeId).parents('div[type="tree"]').find('h8').append(pitchon); |
|
2755 |
var dofuncion = customBase.options.zTreeOnClickItems[treeId]; |
|
2756 |
if (dofuncion != undefined) { |
|
2757 |
eval(dofuncion); |
|
2758 |
} |
|
2759 |
} |
|
2760 |
customBase.settingChkboxType = { |
|
2761 |
check: { |
|
2762 |
autoCheckTrigger: false, |
|
2763 |
chkboxType: { "Y": "", "N": "" }, |
|
2764 |
chkStyle: "checkbox", |
|
2765 |
enable: true, |
|
2766 |
nocheckInherit: false, |
|
2767 |
radioType: "level" |
|
2768 |
}, |
|
2769 |
view: { |
|
2770 |
showIcon: false, |
|
2771 |
showLine: false, |
|
2772 |
txtSelectedEnable: true, |
|
2773 |
}, |
|
2774 |
data: { |
|
2775 |
simpleData: { |
|
2776 |
enable: true, |
|
2777 |
idKey: "id", |
|
2778 |
pIdKey: "pId", |
|
2779 |
rootPId: 0 |
|
2780 |
} |
|
2781 |
}, |
|
2782 |
callback: { |
|
2783 |
onClick: customBase.zTreeOnClick, |
|
2784 |
onCheck: customBase.zTreeOncheckRadio, |
|
2785 |
} |
|
2786 |
} |
|
2787 |
|
|
2788 |
customBase.settingRadioType = { |
|
2789 |
check: { |
|
2790 |
enable: true, |
|
2791 |
chkStyle: "radio", |
|
2792 |
radioType: "all", |
|
2793 |
}, |
|
2794 |
view: { |
|
2795 |
showIcon: false, |
|
2796 |
showLine: false, |
|
2797 |
txtSelectedEnable: true, |
|
2798 |
}, |
|
2799 |
data: { |
|
2800 |
simpleData: { |
|
2801 |
enable: true, |
|
2802 |
idKey: "id", |
|
2803 |
pIdKey: "pId", |
|
2804 |
rootPId: 0 |
|
2805 |
} |
|
2806 |
}, |
|
2807 |
callback: { |
|
2808 |
onClick: customBase.zTreeOnClick, |
|
2809 |
onCheck: customBase.zTreeOncheckRadio, |
|
2810 |
} |
|
2811 |
} |
|
2812 |
|
|
2813 |
|
|
2814 |
|
|
2815 |
customBase.zNodes = [{ name: "树控件", isParent: true }]; |
|
2816 |
var customShow = customShow || {}; |
|
2817 |
|
|
2818 |
customShow.button = { |
|
2819 |
//基础字段 |
|
2820 |
printableBtn: { name: "打印", cssName: 'icon iconfont icon-dayin1 ', functionName: "customShow.onPrint" }, |
|
2821 |
exportBtn: { name: "导出", cssName: 'icon iconfont icon-kongjian_danhangwenben', functionName: "" }, |
|
2822 |
rejectBtn: { name: "驳回", cssName: 'icon iconfont icon-kongjian_danhangwenben', functionName: "customShow.rejectBtn" }, |
|
2823 |
submitBtn: { name: "提交", cssName: 'icon iconfont icon-kongjian_danhangwenben', functionName: "customShow.onclickSubmit" }, |
|
2824 |
auditableBtn: { name: "审批", cssName: 'icon iconfont icon-kongjian_danhangwenben', functionName: "customShow.auditableBtn" }, |
|
2825 |
queryBtn: { name: "查询", cssName: 'icon iconfont icon-kongjian_danhangwenben', functionName: "" }, |
|
2826 |
createBtn: { name: "新建", cssName: 'icon iconfont icon-kongjian_danhangwenben', functionName: "customShow.onclickSave1" }, |
|
2827 |
clearBtn: { name: "清空", cssName: 'icon iconfont icon-kongjian_danhangwenben', functionName: "customShow.onclickClear" }, |
|
2828 |
disposableBtn: { name: "取消", cssName: 'icon iconfont icon-kongjian_danhangwenben', functionName: 'customShow.onclickCancel' }, |
75eb92
|
2829 |
//fromSaveBtn: { name: "保存", cssName: 'icon iconfont icon-bianji ', functionName: "customShow.onclickSave2" }, |
4d1219
|
2830 |
editableBtn: { name: "编辑", cssName: 'icon iconfont icon-kongjian_danhangwenben', functionName: "customShow.onEditor" }, |
B |
2831 |
//添加权限按钮 马习同 2017-12-14 |
|
2832 |
billuploadingBtn: { name: "票据上传", cssName: 'icon iconfont icon-kongjian_danhangwenben', functionName: "customShow.billuploading" }, |
|
2833 |
reuploadBtn: { name: "重新上传票据", cssName: 'icon iconfont icon-kongjian_danhangwenben', functionName: "customShow.reupload" }, |
|
2834 |
checkbillBtn: { name: "查看票据", cssName: 'icon iconfont icon-kongjian_danhangwenben', functionName: "customShow.checkbill" }, |
|
2835 |
} |
|
2836 |
console.log(Flatpickr) |
|
2837 |
Flatpickr.localize(Flatpickr.l10ns.zh); // 设置为中文 |
|
2838 |
customShow.options = { |
|
2839 |
customItem: {}, |
|
2840 |
customViewDiv: "", |
|
2841 |
customInit: {}, |
|
2842 |
htmlediterShow: {}, |
|
2843 |
attributeList: {}, //属性一览 |
|
2844 |
// editorFlag:true, |
|
2845 |
formID: "", //表单ID |
|
2846 |
customShowFlag: "",//调用标识 |
|
2847 |
dataRowNum: "", //更新行番号 |
|
2848 |
breakFlag: false, //父画面刷新 |
|
2849 |
datasource: {}, |
|
2850 |
customItemShow: {}, |
|
2851 |
initTempDatas: {}, //临时初始化数据 |
|
2852 |
itemFormbase: "", |
|
2853 |
jsonLinkage: {}, //公式用 |
|
2854 |
btnFlag: { editable: "1", printable: "1", auditable: "0", disposable: "0" }, //按钮表示 |
|
2855 |
subformList: {}, //子表单List |
|
2856 |
subformDList: {}, |
|
2857 |
dropdownlist_I: 0, |
|
2858 |
subformDValue: {}, |
|
2859 |
formsetting: {}, |
|
2860 |
showErrId: {}, |
|
2861 |
// LinkageAnalysisSetValueFlag:false |
|
2862 |
} |
|
2863 |
|
|
2864 |
customShow.initEvent = { |
|
2865 |
//--------------------保存Button事件------------------------ |
|
2866 |
//画面check |
|
2867 |
fromCheck: function (items, callback) { |
|
2868 |
return customShow.onfromCheck(items); |
|
2869 |
////console.log(1) |
|
2870 |
}, |
|
2871 |
//03检证执行 |
|
2872 |
validationRuleCheck: function (items, callback) { return true }, |
|
2873 |
//检证接口函数(第三口) |
|
2874 |
validationRuleCheck3rd: function (items, callback) { return customShow.interfaceCheck(items) },//保存前计算费用 李伟民 10 - 31 |
|
2875 |
//发送数据到后台服务器,保存data |
|
2876 |
fromSave: function (items, callback) { |
|
2877 |
|
|
2878 |
}, |
|
2879 |
//发送数据到后台服务器,保存data |
|
2880 |
fromSave3rd: function (items, callback) { return true }, |
|
2881 |
fromSaveLinkage: function (items, callback) { return true }, |
|
2882 |
//--------------------保存Button事件------------------------ |
|
2883 |
//--------------------初期化事件---------------------------- |
|
2884 |
//01接口绑定:接口名 接口变量名 自定义函数 |
|
2885 |
interfaceBind: [], |
|
2886 |
//02事件绑定:字段别名 字段类型 事件名 自定义事件名 |
|
2887 |
// eventBind:[{fieldKey:"项目1",tag:"text",eventName:"click",functionName:"customShow.clickBindBase001"}], |
|
2888 |
eventBind: [], |
|
2889 |
//初期化接口 |
|
2890 |
interfaceInit: function (customShowFlag) { |
|
2891 |
//表示模式 |
|
2892 |
console.log(customShowFlag) |
|
2893 |
if (customShowFlag == 2) { |
|
2894 |
customShow.controlInit("customViewUEditorCss"); |
|
2895 |
//控件初始化 |
|
2896 |
customShow.controlInit("customShow"); |
|
2897 |
} else { |
|
2898 |
//控件初始化 |
|
2899 |
customShow.controlInit("customViewUEditorCss"); |
|
2900 |
} |
|
2901 |
//事件初始化 |
|
2902 |
customShow.clickBind(); |
|
2903 |
// 12/14 |
|
2904 |
if (customShowFlag == 1) { |
|
2905 |
// customShow.businessTypeAutoFun( 'businessTypeAuto','budget_itemCostType','cookie'); |
|
2906 |
SC.autoFieldKey(); |
|
2907 |
} |
|
2908 |
}, |
|
2909 |
interfaceInit3rd: function (customShowFlag) { return true }, |
|
2910 |
//验证初期公式 |
|
2911 |
interfaceInitLinkage: function (customShowFlag) { return true }, |
|
2912 |
//密码输入 |
|
2913 |
passwordInputFlag: function (items, callback) { }, |
|
2914 |
//--------------------初期化事件---------------------------- |
|
2915 |
//--------------------取消事件---------------------------- |
|
2916 |
//取消接口 |
|
2917 |
cancelEvent: function (items, callback) { }, |
|
2918 |
//取消接口(第三方提供) |
|
2919 |
cancelEvent3rd: function (items, callback) { return true }, |
|
2920 |
//取消接口 |
|
2921 |
cancelEventLinkage: function () { return true }, |
|
2922 |
//--------------------取消事件---------------------------- |
|
2923 |
//--------------------印刷事件---------------------------- |
|
2924 |
interfaceprint: function (items, callback) { }, |
|
2925 |
interfaceprint3rd: function (items, callback) { return true }, |
|
2926 |
//--------------------印刷事件---------------------------- |
|
2927 |
} |
|
2928 |
|
|
2929 |
function getProcessLog() {//获得流程信息 李雁鸣 12-25 |
|
2930 |
localStorage.setItem("processLog", null); |
|
2931 |
if (localStorage.getItem("customItem") != undefined && localStorage.getItem("customItem") != "undefined" && localStorage.getItem("customItem") != null && localStorage.getItem("customItem") != "" && localStorage.getItem("customItem") != null) { |
|
2932 |
var ss = { "formID": JSON.parse(localStorage.getItem("customForm")).newFormID, "dataRowNum": JSON.parse(localStorage.getItem("customItem")).DATAROWNUM }; |
|
2933 |
var requestSingleForm = window.commonAjax("/ubp-api-seache/process/inst/log", ss, "POST", true, false); |
|
2934 |
requestSingleForm.done(function (rs) { |
|
2935 |
console.log(rs.data); |
|
2936 |
console.log("新改的"); |
|
2937 |
if (rs.data != undefined) { |
|
2938 |
localStorage.setItem("processLog", JSON.stringify(rs.data.data)); |
|
2939 |
} else { |
|
2940 |
|
|
2941 |
} |
|
2942 |
}); |
|
2943 |
} |
|
2944 |
};//获得流程信息 李雁鸣 12-25 |
|
2945 |
|
|
2946 |
customShow.Init = function () { |
|
2947 |
getProcessLog() //获得流程信息 李雁鸣 12-25 |
|
2948 |
customShow.exCouldNumber = undefined;//初始化 云单编号 李伟民 12-22 |
|
2949 |
customShow.orderStatus = undefined;//初始化 表单状态 李伟民 12-26 |
|
2950 |
//数据源 |
|
2951 |
|
|
2952 |
//数据源信息取得 |
|
2953 |
var datasource = $.parseJSON(window.localStorage.getItem("datasource")); |
|
2954 |
customShow.options.datasource = {}; |
|
2955 |
if (datasource != null) { |
|
2956 |
|
|
2957 |
for (var i = 0; i < datasource.length; i++) { |
|
2958 |
customShow.options.datasource[datasource[i].dataSourceName] = datasource[i]; |
|
2959 |
}; |
|
2960 |
} |
|
2961 |
|
|
2962 |
// 0:预览 1:数据管理中新建 2:数据管理中展示(数据表示) 3:发布 4:模板中心 |
|
2963 |
var customShowFlag = window.localStorage.getItem("customShowFlag"); |
|
2964 |
customShow.options.customShowFlag = customShowFlag; |
|
2965 |
// 12/13 测试模拟用 |
|
2966 |
|
|
2967 |
if (customShowFlag == "0" || customShowFlag == "1") {// 新建 预览 隐藏 详情页 李伟民 11-17 |
|
2968 |
console.log(customShowFlag); |
|
2969 |
// 12/4 李元杰 日历当前时间 |
|
2970 |
// var dataObj = { |
|
2971 |
// "time":"yyyy-MM-dd HH:mm:ss" |
|
2972 |
// } |
|
2973 |
// var requestRight = window.commonAjax('/epc/getTime', dataObj, 'POST', true); |
|
2974 |
// requestRight.done(function (res) { |
|
2975 |
// // if (res.rspCode == "000000") { |
|
2976 |
// console.log(res) |
|
2977 |
// // } |
|
2978 |
// }) |
|
2979 |
var myDate = new Date(); |
|
2980 |
myDate.getFullYear(); //获取完整的年份(4位,1970-????) |
|
2981 |
myDate.getMonth(); //获取当前月份(0-11,0代表1月) |
|
2982 |
myDate.getDate(); |
|
2983 |
customShow.currentDate = myDate.getFullYear() + '-' + (myDate.getMonth() + 1) + '-' + myDate.getDate(); |
|
2984 |
console.log(new Date()) |
|
2985 |
console.log(customShow.currentDate) |
|
2986 |
$("#customShow").removeClass("fui-form"); |
|
2987 |
console.log(customBase.options.customItemShow) |
|
2988 |
// $(".preview-edit-pane").css("display", "none"); |
|
2989 |
// 12/23 |
|
2990 |
|
|
2991 |
|
|
2992 |
|
|
2993 |
|
|
2994 |
}// 新建 预览 隐藏 详情页 李伟民 11-17 |
|
2995 |
if (customShowFlag == "2") { |
|
2996 |
console.log(customShowFlag); |
|
2997 |
//12/23 |
|
2998 |
$(".preview-edit-pane").css("display", "block"); |
|
2999 |
// $("#editableBtn").on("click",() => { |
|
3000 |
// console.log($(".preview-edit-pane")); |
|
3001 |
|
|
3002 |
// }) |
|
3003 |
} |
|
3004 |
if(customShowFlag == '3'){ |
|
3005 |
$(".preview-edit-pane").css("display", "block"); |
|
3006 |
} |
|
3007 |
if (customShowFlag == "0") { |
|
3008 |
//表单ID |
|
3009 |
var customlocalStorage = window.localStorage.getItem("customForm"); |
|
3010 |
customlocalStorage = $.parseJSON(customlocalStorage); |
|
3011 |
customShow.options.formid = customlocalStorage.newFormID; |
|
3012 |
var customViewItem = window.localStorage.getItem("customViewItem"); |
|
3013 |
|
|
3014 |
customShow.InitShow({ |
|
3015 |
//绑定DIV |
|
3016 |
showDiv: "customViewUEditor", |
|
3017 |
//数据来源 |
|
3018 |
customShowFlag: customShowFlag, |
|
3019 |
//表示模式 |
|
3020 |
designMode: customlocalStorage.mode, |
|
3021 |
//画面表示基础数据 |
|
3022 |
customViewItem: $.parseJSON(customViewItem), |
|
3023 |
//画面表示数据 |
|
3024 |
formbase: "", |
|
3025 |
}); |
|
3026 |
$(".s_savebtn").hide(); |
|
3027 |
// $(".customShow .fa-calendar").addClass(); |
|
3028 |
} else { |
|
3029 |
customShow.options.formid = window.localStorage.getItem("newFormID"); |
|
3030 |
//初期数据取得 |
|
3031 |
customDataBound.getFormbase(customShow.options.formid, function (rs) { |
|
3032 |
if (rs.rspCode == "000000" && rs.data != null) { |
|
3033 |
//控件属性JSON对象 |
|
3034 |
var field = JSON.parse(rs.data.fieldset); |
|
3035 |
//转换成数组 |
|
3036 |
var fields = _.keysIn(field); |
|
3037 |
console.log(rs.data.fieldset) |
|
3038 |
|
|
3039 |
//循环读取tag_Type是否含有‘auto’ |
|
3040 |
for (var i = 0; i < fields.length; i++) { |
|
3041 |
var attrib = field[fields[i]]; |
|
3042 |
if (attrib.tag_Type != null && attrib.tag_Type == 'auto') { |
|
3043 |
//如果有那么就发送请求 |
|
3044 |
var dataObj = {}; |
|
3045 |
dataObj.prefix = attrib.tag_Attribute.prefixs["0"].itemtext_1 + '$in{' + attrib.tag_Attribute.prefixs["0"].itemtext_2 + '}'; |
|
3046 |
dataObj.FormID = formid; |
|
3047 |
var requestRight = window.commonAjax('/datamanagement/getGenerateRandomNumService', dataObj, 'POST', true); |
|
3048 |
requestRight.done(function (res) { |
|
3049 |
if (res.rspCode == "000000") { |
|
3050 |
var alisN = _.keysIn(customBase.options.customItems); |
|
3051 |
for (var i = 0; i < alisN.length; i++) { |
|
3052 |
var item = customBase.options.customItems[alisN[i]]; |
|
3053 |
if (item.type == "auto") { |
|
3054 |
var itemID = item.id; |
|
3055 |
customBase.setItemValue(itemID, 'text', res.data, '', ''); |
|
3056 |
} |
|
3057 |
} |
|
3058 |
} |
|
3059 |
}) |
|
3060 |
|
|
3061 |
} |
|
3062 |
} |
|
3063 |
|
|
3064 |
var formbase = window.localStorage.getItem("customItem"); |
|
3065 |
//console.log(formbase) |
|
3066 |
//////////////console.log(formbase); |
|
3067 |
// //console.log(formbase); |
|
3068 |
var customItem = { |
|
3069 |
formeditor: rs.data.resultForm, |
|
3070 |
item: $.parseJSON(rs.data.fieldset), |
|
3071 |
//表单宽度 |
|
3072 |
fromwidth: rs.data.formWidth, |
|
3073 |
//表单高度 |
|
3074 |
fromheigh: rs.data.formHeight, |
|
3075 |
//表单名 |
|
3076 |
formName: rs.data.formName, |
|
3077 |
customFlag: rs.data.designMode, |
|
3078 |
Linkage: rs.data.linkage |
|
3079 |
} |
|
3080 |
//console.log(customItem); |
|
3081 |
//console.log(formbase) |
|
3082 |
customShow.InitShow({ |
|
3083 |
//绑定DIV |
|
3084 |
showDiv: "customViewUEditor", |
|
3085 |
//数据来源 |
|
3086 |
customShowFlag: customShowFlag, |
|
3087 |
//表示模式 |
|
3088 |
designMode: rs.data.designMode, |
|
3089 |
//画面表示基础数据 |
|
3090 |
customViewItem: customItem, |
|
3091 |
//画面表示数据 |
|
3092 |
formbase: formbase, |
|
3093 |
}); |
|
3094 |
} else { |
|
3095 |
|
|
3096 |
} |
|
3097 |
}); |
|
3098 |
} |
7480eb
|
3099 |
//隐藏保存 |
M |
3100 |
if (publishShowflag==1){ |
|
3101 |
$(".preview-edit-pane").hide(); |
|
3102 |
} |
4d1219
|
3103 |
} |
B |
3104 |
// 12/4 李元杰 当前时间 |
|
3105 |
customShow.currentDate = ''; |
|
3106 |
function changeOrderStatus(orderStatus){//修改表单状态 李伟民 01-04 |
|
3107 |
if(orderStatus == undefined){ |
|
3108 |
return false; |
|
3109 |
} |
|
3110 |
switch(orderStatus){ |
|
3111 |
case '10': |
|
3112 |
$('#stateText').html('自动审单中'); |
|
3113 |
break |
|
3114 |
case '15': |
|
3115 |
$('#stateText').html('自动审单成功'); |
|
3116 |
break |
|
3117 |
case '19': |
|
3118 |
$('#stateText').html('自动审单失败'); |
|
3119 |
break |
|
3120 |
case '20': |
|
3121 |
$('#stateText').html('未上传单据'); |
|
3122 |
break |
|
3123 |
case '40': |
|
3124 |
$('#stateText').html('记账处理中'); |
|
3125 |
break |
|
3126 |
case '45': |
|
3127 |
$('#stateText').html('记账处理完成'); |
|
3128 |
break |
|
3129 |
case '49': |
|
3130 |
$('#stateText').html('记账处理失败'); |
|
3131 |
break |
|
3132 |
case undefined: |
|
3133 |
$('#stateText').html('test'); |
|
3134 |
break |
|
3135 |
|
|
3136 |
} |
|
3137 |
} |
|
3138 |
//画面初期化 |
|
3139 |
customShow.InitShow = function (customInit) { |
|
3140 |
customBase.customInit = customInit; |
|
3141 |
//画面初期迁移源属性取得 |
|
3142 |
// 0:预览 1:数据管理中新建 2:数据管理中展示 3:发布 4:模板中心 |
|
3143 |
//console.log(customInit) |
|
3144 |
if (customInit.customViewItem != null && customInit.customViewItem != undefined) { |
|
3145 |
customShow.costType = customInit.customViewItem.item; |
|
3146 |
} |
|
3147 |
var customShowFlag = customInit.customShowFlag; |
|
3148 |
var customViewDiv = "#" + customInit.showDiv; |
|
3149 |
customShow.options.customInit = customInit; |
|
3150 |
customShow.options.customViewDiv = customInit.showDiv; |
|
3151 |
//画面初期化(画面表示基础数据) |
|
3152 |
customShow.options.customItemShow = customInit.customViewItem; |
|
3153 |
customShow.options.jsonLinkage = customShow.options.customItemShow.Linkage; |
|
3154 |
var customItem = customShow.options.customItemShow; |
|
3155 |
setTimeout(function () { |
|
3156 |
if (customShowFlag == "4") { |
|
3157 |
$(".customViewUEditorCss").css("height", window.innerHeight); |
|
3158 |
$(".customShow").css("height", window.innerHeight - 200); |
|
3159 |
} else { |
|
3160 |
$(".customViewUEditorCss").css("height", window.innerHeight - 200); |
|
3161 |
$(".customShow").css("height", window.innerHeight - 200); |
|
3162 |
} |
|
3163 |
}, 10); |
|
3164 |
var btns = []; |
|
3165 |
//展示数据表示 |
|
3166 |
|
|
3167 |
if (customShowFlag == "0" || customShowFlag == "6") { |
|
3168 |
//2017-12-27 马习同 专家模式打印 |
|
3169 |
var print_btnFlag = window.localStorage.getItem("print_btnFlag"); |
|
3170 |
if (customShowFlag == "0" && print_btnFlag == "1"){ |
|
3171 |
var btns = [ |
|
3172 |
"printableBtn" |
|
3173 |
]; |
|
3174 |
customShow.setToolBtn(btns); |
|
3175 |
} |
|
3176 |
////console.log(window.customBase); |
|
3177 |
//标题头表示 |
|
3178 |
$('#childclick').css("display", "none"); |
|
3179 |
$(".header")[0].style.display = "block"; |
|
3180 |
//标题设定 |
|
3181 |
$(".modal-title")[0].innerHTML = customItem.formName; |
|
3182 |
|
|
3183 |
//画面内容的初始化设定 |
|
3184 |
customShow.setContentHtml(customItem, customViewDiv); |
|
3185 |
//编辑模式下表示 |
|
3186 |
$(customViewDiv)[0].style.display = "block"; |
|
3187 |
|
|
3188 |
//1:数据管理中新建 3:发布 4:模板中心 |
|
3189 |
} else if (customShowFlag == "1" || customShowFlag == "3") { |
|
3190 |
//标题头表示 |
|
3191 |
console.log("显示X"); |
|
3192 |
console.log($('#childclick')); |
|
3193 |
$('#childclick').css("display", "block"); |
|
3194 |
$('#childclick').click(() => { |
|
3195 |
customShow.onclickCancel(); |
|
3196 |
console.log("点击父元素关闭"); |
|
3197 |
}); |
|
3198 |
|
|
3199 |
$(".header")[0].style.display = "block"; |
8c6e10
|
3200 |
$("title")[0].innerHTML = customItem.formName; |
4d1219
|
3201 |
//标题设定 |
8c6e10
|
3202 |
$(".modal-title")[0].innerHTML = customItem.formName;$(".modal-title")[0].innerHTML = customItem.formName; |
4d1219
|
3203 |
//画面内容的初始化设定 |
B |
3204 |
customShow.setContentHtml(customItem, customViewDiv); |
|
3205 |
|
|
3206 |
// $(".footer")[0].style.display ="block"; |
|
3207 |
//编辑模式下表示 |
|
3208 |
$(customViewDiv)[0].style.display = "block"; |
|
3209 |
//2:数据管理中展示 |
|
3210 |
//第三方事件绑定 |
|
3211 |
// customShow.setEventBind(); |
|
3212 |
if (customShowFlag == "1") { |
|
3213 |
var btns = [ |
|
3214 |
'rejectBtn', |
|
3215 |
'submitBtn', |
|
3216 |
'auditableBtn', |
|
3217 |
'queryBtn', |
|
3218 |
'clearBtn', |
|
3219 |
// 'disposableBtn', |
|
3220 |
// 'fromSaveBtn', |
|
3221 |
]; |
|
3222 |
} else { |
|
3223 |
var btns = [ |
|
3224 |
'rejectBtn', |
|
3225 |
'submitBtn', |
|
3226 |
'auditableBtn', |
|
3227 |
'queryBtn', |
|
3228 |
'createBtn', |
|
3229 |
// 'clearBtn', |
|
3230 |
// 'disposableBtn', |
75eb92
|
3231 |
//'fromSaveBtn', |
4d1219
|
3232 |
]; |
B |
3233 |
} |
|
3234 |
} |
|
3235 |
else if (customShowFlag == "4") { |
|
3236 |
//标题头表示 |
|
3237 |
$(".header")[0].style.display = "none"; |
|
3238 |
//标题设定 |
|
3239 |
// $(".modal-title")[0].innerHTML=customItem.formName; |
|
3240 |
//画面内容的初始化设定 |
|
3241 |
customShow.setContentHtml(customItem, customViewDiv); |
|
3242 |
//编辑模式下表示 |
|
3243 |
$(customViewDiv)[0].style.display = "block"; |
|
3244 |
// $(".footer")[0].style.display ="none"; |
|
3245 |
//编辑模式下表示 |
|
3246 |
// $(customViewDiv)[0].style.display ="block"; |
|
3247 |
//第三方事件绑定 |
|
3248 |
// customShow.setEventBind(); |
|
3249 |
} else if (customShowFlag == "2") { |
|
3250 |
console.log("显示X"); |
|
3251 |
console.log($('#childclick')); |
|
3252 |
$('#childclick').css("display", "block"); |
|
3253 |
if (JSON.parse(window.localStorage.getItem('allow')) == true) { |
|
3254 |
$('#childclick').css("display", "none"); |
|
3255 |
} else { |
|
3256 |
$('#childclick').css("display", "block"); |
|
3257 |
} |
|
3258 |
$('#childclick').click(() => { |
|
3259 |
customShow.onclickCancel(); |
|
3260 |
console.log("点击父元素关闭"); |
|
3261 |
|
|
3262 |
}); |
|
3263 |
//按钮修改 马习同 2017-12-13 |
|
3264 |
// var btnshowFlag = { |
|
3265 |
// a = true, |
|
3266 |
// b = flase, |
|
3267 |
// }; |
|
3268 |
// if(btnshowFlag.a == true){ |
|
3269 |
// btns.push(); |
|
3270 |
// } |
|
3271 |
var btns = [ |
|
3272 |
// 'checkbillBtn',//查看票据 |
|
3273 |
'rejectBtn',//驳回 |
|
3274 |
'submitBtn',//提交 |
|
3275 |
'auditableBtn',//审批 |
|
3276 |
'editableBtn', |
|
3277 |
'printableBtn',//打印 |
|
3278 |
]; |
|
3279 |
//画面内容的初始化设定 |
|
3280 |
console.log(customItem); |
|
3281 |
console.log(customViewDiv); |
|
3282 |
customShow.setContentHtml(customItem, customViewDiv); |
|
3283 |
var items = {}; |
|
3284 |
//数据变换 |
|
3285 |
//console.log(customInit); |
|
3286 |
//console.log(customInit.formbase) |
|
3287 |
var formbase = $.parseJSON(customInit.formbase); |
|
3288 |
//console.log(formbase); |
|
3289 |
customShow.options.dataRowNum = formbase['DATAROWNUM']; |
|
3290 |
customShow.exCouldNumber = formbase['orderCode'];//获取云单编号 李伟民 12-26 |
|
3291 |
if(customShow.exCouldNumber){ |
|
3292 |
$('#exCloudNumberText').html('云单编号:' + customShow.exCouldNumber); |
|
3293 |
} |
|
3294 |
customShow.orderStatus = formbase['orderStatus'];// 获取表单状态 李伟民 12-26 |
|
3295 |
changeOrderStatus(customShow.orderStatus); |
|
3296 |
items = formbase; |
|
3297 |
customShow.options.itemFormbase = formbase; |
|
3298 |
console.log(_.cloneDeep(items)); |
|
3299 |
delete items['DATAROWNUM']; |
|
3300 |
console.log(_.cloneDeep(items)); |
|
3301 |
//初期化后,数据赋值(编辑模式) |
|
3302 |
console.log(_.cloneDeep(items)); |
|
3303 |
customShow.showCustom(items, customShow.options.customInit); |
|
3304 |
//初期化后,数据赋值(预览) |
|
3305 |
console.log(_.cloneDeep(items)); |
|
3306 |
customShow.setShowCustomItem(items); |
|
3307 |
//初期化后,票据信息追加 李伟民 12-26 |
|
3308 |
SC.billInfoInit(items); |
|
3309 |
|
|
3310 |
|
|
3311 |
//数据源再次追加 |
|
3312 |
// var customItems = customShow.options.customItemShow.item; |
|
3313 |
var customItems = customBase.options.customItems; |
|
3314 |
console.log(customItems); |
|
3315 |
for (item in customItems) { |
|
3316 |
if (customItems.hasOwnProperty(item)) { |
|
3317 |
if (customItems[item].type == 'dropdownlist' || customItems[item].type == 'radio' || |
|
3318 |
customItems[item].type == 'checkbox' || customItems[item].type == 'tree') { |
|
3319 |
var datasourcetype = customShow.options.customItemShow.item[customItems[item].id].tag_Attribute.datasourcetype; |
|
3320 |
console.log(datasourcetype); |
|
3321 |
if (datasourcetype == "custom") { |
|
3322 |
//数据源绑定(自定义数据) |
|
3323 |
customShow.setDatasourceData(customItems[item]); |
|
3324 |
} |
|
3325 |
} |
|
3326 |
} |
|
3327 |
} |
|
3328 |
//标题头表示 |
|
3329 |
$(".header")[0].style.display = "block"; |
|
3330 |
//标题设定 |
|
3331 |
$(".modal-title")[0].innerHTML = customItem.formName; |
|
3332 |
// 12/19 |
|
3333 |
$("#customViewUEditor")[0].style.display = "none"; |
|
3334 |
//2017/11/18 马习同修改 隐藏预览模式下 导入数据按钮 |
|
3335 |
$(".sonImportFile").addClass("cfg_contentNone"); |
|
3336 |
$(".s_savebtn").hide(); |
|
3337 |
$(".customShow .fa-calendar").addClass("cfg_contentNone"); |
|
3338 |
|
|
3339 |
console.log($(".customShow .tdContentClass")) |
|
3340 |
// _.each($(".customShow .tdContentClass"),opt=>{ |
|
3341 |
// // $(opt).attr("title", $(opt).children().children().html()); |
|
3342 |
// console.log($(opt).html()) |
|
3343 |
// if ($(opt).children().children().attr("type") == "text"){ |
|
3344 |
// $(opt).attr("title", $(opt).children().children().val()); |
|
3345 |
// }else{ |
|
3346 |
// console.log(_.cloneDeep($(opt).children().children())) |
|
3347 |
// console.log(opt.innerHTML) |
|
3348 |
// console.log($(opt).children().children()[0].innerHTML) |
|
3349 |
// $(opt).attr("title", $(opt).children().children()[0].innerHTML); |
|
3350 |
// } |
|
3351 |
// }) |
|
3352 |
|
|
3353 |
} |
|
3354 |
//第三方事件绑定 |
|
3355 |
var token = localStorage.getItem('token');//页面事件绑定 李伟民 12-22 |
|
3356 |
if (token != '' && token != undefined) { |
|
3357 |
token = JSON.parse(token); |
|
3358 |
} |
|
3359 |
var postdata = { 'formID': customShow.options.formid }; |
|
3360 |
_.extend(postdata, token); |
|
3361 |
var eventBindRquest = window.commonAjax('/formevent/getFormEventListService', postdata, 'GET', true, false); |
|
3362 |
eventBindRquest.done(function (res) { |
|
3363 |
if (res.data != undefined) { |
|
3364 |
// var eventBindData = []; |
|
3365 |
// _.each(res.data,function(data){ |
|
3366 |
// eventBindData.push({'fieldName':data.fieldName,'tag':data.fieldType,'eventName':data.event,'functionName':data.eventmethod}); |
|
3367 |
// }); |
|
3368 |
customShow.initEvent.eventBind = res.data; |
|
3369 |
} |
|
3370 |
customShow.setEventBind(); |
|
3371 |
});//页面事件绑定 李伟民 12-22 |
|
3372 |
|
|
3373 |
SC.showUser()//报销人根据当前登录人自动带出 李伟民 0108 |
|
3374 |
|
|
3375 |
customShow.setToolBtn(btns); |
|
3376 |
$(".select2-selection").remove(); |
|
3377 |
customShow.hidesubform(); |
|
3378 |
var unvisible = customBase.options.customItems; |
|
3379 |
for (item in unvisible) { |
|
3380 |
if (unvisible[item].type == "subform") { |
|
3381 |
var itemId = unvisible[item].id; |
|
3382 |
// var itemTwo = itemId; |
|
3383 |
// var itemSubform = $('.'+"customViewUEditorCss" +" #"+itemId+"ActiveId"); |
|
3384 |
////////////console.log(item); |
|
3385 |
//子表单删除第一条可添加 2017/10/26 马习同 |
|
3386 |
// var divIcon = $('<div id="'+itemId+'save" class="cfg_contentNone"></div>'); |
|
3387 |
var cloneE = $('#' + itemId + 'subformTr').clone(); |
|
3388 |
// divIcon.append(cloneE); |
|
3389 |
console.log(cloneE); |
|
3390 |
// itemSubform.append(divIcon); |
|
3391 |
customBase.options.customItems[item]['cloneDiv'] = cloneE; |
|
3392 |
} |
|
3393 |
} |
|
3394 |
//2017-12-12 马习同隐藏 |
|
3395 |
SC.Superior_hide(); |
|
3396 |
if (customShowFlag == "1" || customShowFlag == "0") { |
|
3397 |
// window.localStorage.setItem('businessTypeAuto','240'); |
|
3398 |
$(".preview-edit-pane").find('#disposableBtn').css('display', 'none'); |
|
3399 |
$(".preview-edit-pane").find('#clearBtn').css('display', 'none'); |
|
3400 |
$(".preview-edit-pane").find('#queryBtn').css('display', 'none'); |
|
3401 |
$(".preview-edit-pane").find('#auditableBtn').css('display', 'none'); |
|
3402 |
$(".preview-edit-pane").find('#submitBtn').css('display', 'none'); |
|
3403 |
$(".preview-edit-pane").find('#rejectBtn').css('display', 'none'); |
|
3404 |
} |
|
3405 |
} |
|
3406 |
// 2017/10/20 李元杰 抽出了 李伟民的计算费用的方法 最后将数据return出去了 |
|
3407 |
//计算费用 |
|
3408 |
//customShow.queryCostAllData = function(){ |
|
3409 |
// var post_data = []; |
|
3410 |
// var items = customShow.getItems(); |
|
3411 |
// var items_key = _.keysIn(items); |
|
3412 |
// var all_data = {}; |
|
3413 |
// //console.log(items); |
|
3414 |
// _.each(items_key,function(item){ |
|
3415 |
// var control = {}; |
|
3416 |
// var item_attr = customBase.options.customItems[item]; |
|
3417 |
// if(_.isArray(items[item]) && _.isObject(items[item][0])){//判断是否为子表单 |
|
3418 |
// _.extend(control,{'fieldKey':item,'mdCode':'','value':'','type':item_attr.type,'child':[]}); |
|
3419 |
// _.each(items[item],function(cd){ |
|
3420 |
// var cd_key = _.keysIn(cd); |
|
3421 |
// var item_cd = { |
|
3422 |
// "items":[], |
|
3423 |
// "cid":"" |
|
3424 |
// }; |
|
3425 |
// _.each(cd_key,function(cdk){ |
|
3426 |
// var control_cd = {}; |
|
3427 |
// var item_attr_cd = customBase.options.customItems[cdk]; |
|
3428 |
// _.extend(control_cd,{'fieldKey':cdk,'mdCode':customShow.getmasterdataById(item_attr_cd.id),'value':cd[cdk],'type':item_attr_cd.type}); |
|
3429 |
// item_cd.items.push(control_cd); |
|
3430 |
// if(cdk == "dataRowNum"){ |
|
3431 |
// item_cd.cid = cd[cdk]; |
|
3432 |
// } |
|
3433 |
// }); |
|
3434 |
// control.child.push(item_cd); |
|
3435 |
// }); |
|
3436 |
// //行程ID 预留 |
|
3437 |
// }else{ |
|
3438 |
// _.extend(control,{'fieldKey':item,'mdCode':customShow.getmasterdataById(item_attr.id),'value':items[item],'type':item_attr.type}); |
|
3439 |
// } |
|
3440 |
// post_data.push(control); |
|
3441 |
// }); |
|
3442 |
// var customShowFlag = window.localStorage.getItem("customShowFlag"); |
|
3443 |
// var customForm = window.localStorage.getItem("customForm"); |
|
3444 |
// if(customForm && customForm != ""){ |
|
3445 |
// customForm = JSON.parse(customForm); |
|
3446 |
// } |
|
3447 |
// if(customShowFlag == 2){//详情 |
|
3448 |
// var customItem = window.localStorage.getItem("customItem"); |
|
3449 |
// if(customItem && customItem != ""){ |
|
3450 |
// customItem = JSON.parse(customItem); |
|
3451 |
// //console.log(customItem); |
|
3452 |
// } |
|
3453 |
// _.extend(all_data,{"data":post_data,"formId":customForm.newFormID,"id":customItem.DATAROWNUM}); |
|
3454 |
// }else{//新建或预览 |
|
3455 |
// _.extend(all_data,{'data':post_data,"formId":customForm.newFormID,"id":""}); |
|
3456 |
// } |
|
3457 |
// _.extend(all_data,{'orderCode':""}); |
|
3458 |
// _.extend(all_data,{'ctId':"240"});// 费用类型 假 |
|
3459 |
// return all_data; |
|
3460 |
//} |
|
3461 |
//计算费用 |
|
3462 |
//customShow.queryCost = function(){ |
|
3463 |
// // 2017/10/20 李元杰 queryCostAllData 抽出来存这里了 |
|
3464 |
// // var post_data = []; |
|
3465 |
// // var items = customShow.getItems(); |
|
3466 |
// // var items_key = _.keysIn(items); |
|
3467 |
// // var all_data = {}; |
|
3468 |
// // //console.log(items); |
|
3469 |
// // //console.log(items_key) |
|
3470 |
// // _.each(items_key,function(item){ |
|
3471 |
// // var control = {}; |
|
3472 |
// // //console.log(item); |
|
3473 |
// // var item_attr = customBase.options.customItems[item]; |
|
3474 |
// // //console.log(item_attr) |
|
3475 |
// // if(_.isArray(items[item]) && _.isObject(items[item][0])){//判断是否为子表单 |
|
3476 |
// // _.extend(control,{'fieldKey':item,'mdCode':'','value':'','type':item_attr.type,'child':[]}); |
|
3477 |
// // _.each(items[item],function(cd){ |
|
3478 |
// // //console.log(cd) |
|
3479 |
// // var cd_key = _.keysIn(cd); |
|
3480 |
// // //console.log(cd_key) |
|
3481 |
// // var item_cd = { |
|
3482 |
// // "items":[], |
|
3483 |
// // "cid":"" |
|
3484 |
// // }; |
|
3485 |
// // _.each(cd_key,function(cdk){ |
|
3486 |
// // var control_cd = {}; |
|
3487 |
// // var item_attr_cd = customBase.options.customItems[cdk]; |
|
3488 |
// // //console.log(item_attr_cd); |
|
3489 |
// // _.extend(control_cd,{'fieldKey':cdk,'mdCode':customShow.getmasterdataById(item_attr_cd.id),'value':cd[cdk],'type':item_attr_cd.type}); |
|
3490 |
// // item_cd.items.push(control_cd); |
|
3491 |
// // if(cdk == "dataRowNum"){ |
|
3492 |
// // item_cd.cid = cd[cdk]; |
|
3493 |
// // } |
|
3494 |
// // }); |
|
3495 |
// // control.child.push(item_cd); |
|
3496 |
// // }); |
|
3497 |
// // //行程ID 预留 |
|
3498 |
// // }else{ |
|
3499 |
// // _.extend(control,{'fieldKey':item,'mdCode':customShow.getmasterdataById(item_attr.id),'value':items[item],'type':item_attr.type}); |
|
3500 |
// // } |
|
3501 |
// // post_data.push(control); |
|
3502 |
// // }); |
|
3503 |
// // var customShowFlag = window.localStorage.getItem("customShowFlag"); |
|
3504 |
// // var customForm = window.localStorage.getItem("customForm"); |
|
3505 |
// // if(customForm && customForm != ""){ |
|
3506 |
// // customForm = JSON.parse(customForm); |
|
3507 |
// // } |
|
3508 |
// // if(customShowFlag == 2){//详情 |
|
3509 |
// // var customItem = window.localStorage.getItem("customItem"); |
|
3510 |
// // if(customItem && customItem != ""){ |
|
3511 |
// // customItem = JSON.parse(customItem); |
|
3512 |
// // //console.log(customItem); |
|
3513 |
// // } |
|
3514 |
// // _.extend(all_data,{"data":post_data,"formId":customForm.newFormID,"id":customItem.DATAROWNUM}); |
|
3515 |
// // }else{//新建或预览 |
|
3516 |
// // _.extend(all_data,{'data':post_data,"formId":customForm.newFormID,"id":""}); |
|
3517 |
// // } |
|
3518 |
// // _.extend(all_data,{'orderCode':""}); |
|
3519 |
// // _.extend(all_data,{'ctId':"240"});// 费用类型 假 |
|
3520 |
// // //console.log(all_data); |
|
3521 |
// // //console.log(JSON.stringify(all_data)) |
|
3522 |
// var all_data = customShow.queryCostAllData(); |
|
3523 |
// // 2017/10/20 李元杰 queryCostAllData 抽出来存这里了 end |
|
3524 |
// var query_request = window.queryAjax("epc-count/countCost",all_data,"POST",true,false); |
|
3525 |
// ////console.log(query_request); |
|
3526 |
// query_request.done(function(res){ |
|
3527 |
// ////console.log("6531289"); |
|
3528 |
// customBase.listen_check(res.data,"query_check"); |
|
3529 |
// }) |
|
3530 |
// |
|
3531 |
// return all_data; |
|
3532 |
//} |
|
3533 |
// 12/12 模态框 |
|
3534 |
$('.closeBtn').on('click', () => { |
|
3535 |
$('.maskLayer').css('display', 'none'); |
|
3536 |
customShow.clean(); |
|
3537 |
}) |
|
3538 |
//扩展费用自定义方法,yuezhw 2017-11-13 |
|
3539 |
customShow.extended_budget = function (where) { |
|
3540 |
var obj = {}; |
|
3541 |
obj.formId = localStorage.getItem("newFormID"); |
|
3542 |
obj.dataId = JSON.parse(localStorage.getItem("customItem")).DATAROWNUM; |
|
3543 |
obj.tenantID = JSON.parse(localStorage.getItem("tenantID")).tenantID; |
|
3544 |
var query_request; |
|
3545 |
flatpickr("#budget_time", { |
|
3546 |
dateFormat: "Y-m-d" |
|
3547 |
}) |
|
3548 |
|
|
3549 |
var budgetNumber = $('#customShow').find('div[type="auto"]').find('input').val(); |
|
3550 |
var budgetDate = $($('#customShow').find('div[type="calendar"]')[1]).find('input').val(); |
|
3551 |
$('#budget_number').val(budgetNumber) |
|
3552 |
$('#budget_date').val(budgetDate) |
|
3553 |
$('#extended_someThing').css("display", "block"); |
|
3554 |
$('#budget_time').css("display", "block"); |
|
3555 |
$('.maskLayer').css('display', 'block'); |
|
3556 |
$('#budget_todo').on('click', () => { |
|
3557 |
obj.department = $('#budget_department').val(); |
|
3558 |
obj.info = $('#budget_time').val(); |
|
3559 |
var nowTime = new Date(Date.parse(obj.info)); |
|
3560 |
var endTime = new Date(Date.parse(JSON.parse(localStorage.getItem("customItem")).budgetEndDate)); |
|
3561 |
console.log(obj.info); |
|
3562 |
console.log(nowTime); |
|
3563 |
console.log(endTime); |
|
3564 |
if (obj.info.length < 1) { |
|
3565 |
alert("请输入增加时间"); |
|
3566 |
} else if (nowTime < endTime) { |
|
3567 |
alert("扩展时间不可小于当前结束时间!"); |
|
3568 |
} else { |
|
3569 |
var query_request = window.queryAjaxQQ("epc-form/extend/budget/time", obj, "POST", true, false); |
|
3570 |
query_request.done(function (res) { |
|
3571 |
console.log(typeof res.data) |
|
3572 |
console.log(res.data) |
|
3573 |
if (res.data === true) { |
|
3574 |
alert("扩展时间成功!"); |
|
3575 |
customShow.clean(); |
|
3576 |
$('.maskLayer').css('display', 'none'); |
|
3577 |
} else { |
|
3578 |
alert("服务器通信失败"); |
|
3579 |
} |
|
3580 |
}) |
|
3581 |
query_request.error(function (rs) { |
|
3582 |
// console.log(rs) |
|
3583 |
toastr.error(rs.responseJSON.rspDesc); |
|
3584 |
|
|
3585 |
}) |
|
3586 |
} |
|
3587 |
|
|
3588 |
}) |
|
3589 |
$('#budget_undo,.closeModal').on('click', () => { |
|
3590 |
customShow.clean(); |
|
3591 |
}) |
|
3592 |
} |
|
3593 |
//关闭页面 |
|
3594 |
customShow.clean = function () { |
|
3595 |
$('#extended_someThing').css("display", "none"); |
|
3596 |
$('#budget_whrere').val(''); |
|
3597 |
$('#budget_money').val(''); |
|
3598 |
$('#budget_time').val(''); |
|
3599 |
} |
|
3600 |
//根据别名获取主数据 |
|
3601 |
customShow.getmasterdataById = function (itemid) { |
|
3602 |
var mdata = undefined; |
|
3603 |
////console.log(itemid); |
|
3604 |
if (customShow.options.customItemShow.item[itemid] != undefined) { |
|
3605 |
if (customShow.options.customItemShow.item[itemid].tag_Attribute.masterData != undefined && customShow.options.customItemShow.item[itemid].tag_Attribute.masterData != '') { |
|
3606 |
mdata = JSON.parse(customShow.options.customItemShow.item[itemid].tag_Attribute.masterData); |
|
3607 |
} |
|
3608 |
} |
|
3609 |
if (mdata != undefined) { |
|
3610 |
return mdata.defindCode; |
|
3611 |
} else { |
|
3612 |
return ""; |
|
3613 |
} |
|
3614 |
} |
|
3615 |
|
|
3616 |
//数据赋值 ----编辑项目赋值 |
|
3617 |
customShow.setShowCustomItem = function (items) { |
|
3618 |
// 2017/10/19 李元杰 在费用明细里插入一些信息 |
|
3619 |
// 需要传给后端的对象 |
|
3620 |
//console.log(items); |
|
3621 |
// var objData = customShow.queryCostAllData(); |
|
3622 |
// 获取orderCode的值 |
|
3623 |
|
|
3624 |
// if(objData.orderCode){ |
|
3625 |
// var orderCode = customBase.getItemValue(customBase.options.customItems.orderCode.id,customBase.options.customItems.orderCode.type) |
|
3626 |
// objData.orderCode = orderCode[1]; |
|
3627 |
// var requestInsert = window.commonAjax("/datamanagement/getAssociatedFormDataService", objData, "POST", true); |
|
3628 |
// requestInsert.done(function (res) { |
|
3629 |
// for(var i = 0 ; i <res.data.data.length;i++){ |
|
3630 |
// if(res.data.data[i].child){ |
|
3631 |
// for(var j = 0;j<res.data.data[i].child.length;j++){ |
|
3632 |
// // 循环子表单里拥有dataRowNum的数量 |
|
3633 |
// $(`[id= ${customBase.options.customItems.dataRowNum.id}]`).each( (index,ipt)=>{ |
|
3634 |
// // 获取返回值里的value和子表单里的dataRowNum的值是否相同 |
|
3635 |
// if( res.data.data[i].child[j].msgInfo.header[0].value == $(ipt).val()){ |
|
3636 |
// // 寻找当前子表单的父节点里的H8标签插入数据 |
|
3637 |
// $($(`[id= ${customBase.options.customItems.dataRowNum.id}]`)[index].closest('[type=subform]')).children('h8').find('.text') |
|
3638 |
// .append(` <span>${res.data.data[i].child[j].msgInfo.header[0].name}</span>`) |
|
3639 |
// } |
|
3640 |
// }) |
|
3641 |
// } |
|
3642 |
// } |
|
3643 |
// } |
|
3644 |
// }); |
|
3645 |
// } |
|
3646 |
//delete items['DATAROWNUM']; // 子表单中 不删除datarownum 李伟民 11-16 |
|
3647 |
var items = _.cloneDeep(items); |
|
3648 |
var customItems = customBase.options.customItems; |
|
3649 |
//console.log(customItems); |
|
3650 |
//数据值变换 |
|
3651 |
for (item in items) { |
|
3652 |
if (items.hasOwnProperty(item)) { |
|
3653 |
if (customItems[item] == undefined) { |
|
3654 |
delete customItems[item]; |
|
3655 |
continue; |
|
3656 |
} |
|
3657 |
if (customItems[item].type == 'subform' || customItems[item].type == 'tag' || customItems[item].type == 'tab') { |
|
3658 |
var subformTemp = items[item]; |
|
3659 |
console.log(subformTemp) |
|
3660 |
if (subformTemp == undefined) { |
|
3661 |
subformTemp = [{}]; |
|
3662 |
} |
|
3663 |
for (subformItem in subformTemp[0]) { |
|
3664 |
if (subformTemp[0].hasOwnProperty(subformItem)) { |
|
3665 |
items[subformItem] = []; |
|
3666 |
} |
|
3667 |
} |
|
3668 |
console.log(subformTemp.length);//主数据丢失 |
|
3669 |
for (var i = 0; i < subformTemp.length; i++) { |
|
3670 |
if (i != 0) { |
|
3671 |
//子表单项目追加 |
|
3672 |
var subformAdd = $(".customViewUEditorCss #" + customItems[item].id + "ActiveId .subformAdd")[0]; |
|
3673 |
customShow.addsubformList(subformAdd, "customViewUEditorCss"); |
|
3674 |
} |
|
3675 |
for (subformItem in subformTemp[i]) { |
|
3676 |
if (subformTemp[i].hasOwnProperty(subformItem)) { |
|
3677 |
items[subformItem][i] = subformTemp[i][subformItem]; |
|
3678 |
} |
|
3679 |
} |
|
3680 |
}; |
|
3681 |
} |
|
3682 |
} |
|
3683 |
} |
|
3684 |
|
|
3685 |
//delete items['DATAROWNUM']; // 子表单中 不删除datarownum 李伟民 11-16 |
|
3686 |
console.log(_.cloneDeep(items)) |
|
3687 |
console.log(customItems); |
|
3688 |
//数据赋值 |
|
3689 |
for (item in items) { |
|
3690 |
console.log(item); |
|
3691 |
if (items.hasOwnProperty(item)) { |
|
3692 |
if (customItems[item] == undefined) { |
|
3693 |
delete customItems[item]; |
|
3694 |
continue; |
|
3695 |
} |
|
3696 |
var type = customItems[item].type; |
|
3697 |
var id = customItems[item].id; |
|
3698 |
console.log(id); |
|
3699 |
console.log(items[item]); |
|
3700 |
if ( |
|
3701 |
// type == 'radio' || type == 'checkbox' || |
|
3702 |
// type == 'dropdownlist'|| |
|
3703 |
// type == 'tree'|| |
|
3704 |
// type == 'amount'|| |
|
3705 |
// type == 'barcode'|| |
|
3706 |
// type == 'qrcode' || |
|
3707 |
// type == 'image'|| |
|
3708 |
type == 'button' |
|
3709 |
// || type == 'fileupload' |
|
3710 |
|| type == 'subform' || type == 'link' |
|
3711 |
|| type == 'splitline' || type == 'link' || type == 'tag' || type == 'tab' |
|
3712 |
) { |
|
3713 |
|
|
3714 |
} else if (customItems[item].type == "image" || customItems[item].type == "fileupload") { |
|
3715 |
var itemId = customItems[item].id; |
|
3716 |
if (items[item] != "") { |
|
3717 |
customBase.options.uploaderItemReady[itemId] = $.parseJSON(items[item]); |
|
3718 |
} else { |
|
3719 |
customBase.options.uploaderItemReady[itemId] = []; |
|
3720 |
} |
|
3721 |
} else if (type == 'amount') { |
|
3722 |
var id = id + "amount"; |
|
3723 |
customBase.setItemValue(id, 'text', items[item], 'customViewUEditorCss'); |
|
3724 |
$("#" + id).blur(); |
|
3725 |
} else if (type == 'qrcode') { |
|
3726 |
var id = id + "qrcode"; |
|
3727 |
customBase.setItemValue(id, 'text', items[item], 'customViewUEditorCss'); |
|
3728 |
$("#" + id).blur(); |
|
3729 |
} else if (type == 'barcode') { |
|
3730 |
var id = id + "barcode"; |
|
3731 |
customBase.setItemValue(id, 'text', items[item], 'customViewUEditorCss'); |
|
3732 |
$("#" + id).blur(); |
|
3733 |
} else if (type == 'dropdownlist' || type == 'radio' || type == 'checkbox' || type == 'tree') { |
|
3734 |
//异步加载时数据临时保存 |
|
3735 |
customShow.options.initTempDatas[id] = items[item]; |
|
3736 |
// var datasourcetype = $("#"+id)[0].getAttribute("datasourcetype"); |
|
3737 |
// //主数据源 |
|
3738 |
// if(datasourcetype == "masterdata"){ |
|
3739 |
// customBase.setItemValue(id,type,items[item],'customViewUEditorCss'); |
|
3740 |
// //数据源 |
|
3741 |
// }else if(datasourcetype == "datasource"){ |
|
3742 |
// customBase.setItemValue(id,type,items[item],'customViewUEditorCss'); |
|
3743 |
// //自定义 |
|
3744 |
// }else if(datasourcetype == "custom"){ |
|
3745 |
// customBase.setItemValue(id,'dropdownlistText',items[item],'customViewUEditorCss'); |
|
3746 |
// //API接口 |
|
3747 |
// }else if(datasourcetype == "api"){ |
|
3748 |
// customBase.setItemValue(id,type,items[item],'customViewUEditorCss'); |
|
3749 |
// } |
|
3750 |
|
|
3751 |
} else if (customItems[item].type == 'mytext') { |
|
3752 |
//选择表单预览回显 |
|
3753 |
var itemAttribute = customShow.options.customItemShow.item[customItems[item].id]; |
|
3754 |
var item_title = []; |
|
3755 |
var itemVal = []; |
|
3756 |
var $mytext = $("#customShow " + "#" + customItems[item].id + "ActiveId"); |
|
3757 |
if (itemAttribute.tag_Attribute.relevancesourcetype == "fundata") {// 关联数据回显渲染 李伟民 11-30 |
|
3758 |
var titleObj = { "key": JSON.parse(itemAttribute.tag_Attribute.fundata)["key"] }; |
|
3759 |
var dataObj = { |
|
3760 |
"formID": customShow.options.formid, |
|
3761 |
"tenantID": "001", |
|
3762 |
"search": [], |
|
3763 |
"pageSize": "1000", |
|
3764 |
"pageNum": "1", |
|
3765 |
"key": JSON.parse(itemAttribute.tag_Attribute.fundata)["key"], |
|
3766 |
"formData": {}, |
|
3767 |
"dataRowNum": items[item] |
|
3768 |
}; |
|
3769 |
var requesTitle = window.commonAjax("/datamanagement/getAssociateTitle", titleObj, "POST", true, false); |
|
3770 |
var requesData = window.commonAjax("/datamanagement/getAssociateData", dataObj, "POST", true, false); |
|
3771 |
requesTitle.done(function (res) { |
|
3772 |
console.log(res); |
|
3773 |
item_title = res.data; |
|
3774 |
}); |
|
3775 |
requesData.done(function (res) { |
|
3776 |
console.log(res); |
|
3777 |
if (!_.isNull(res.data) && res.data != undefined) { |
|
3778 |
itemVal = res.data; |
|
3779 |
} |
|
3780 |
}); |
|
3781 |
} else { |
|
3782 |
var myTitle = JSON.parse(window.localStorage.getItem("title")); |
|
3783 |
item_title = myTitle[item]; |
|
3784 |
itemVal = items[item]; |
|
3785 |
} |
|
3786 |
console.log(myTitle); |
|
3787 |
console.log(itemVal) |
|
3788 |
console.log(item_title); |
|
3789 |
console.log(itemVal.list); |
|
3790 |
var iconID = "customShow #" + customItems[item].id + "ActiveId";// 关联数据回显渲染 李伟民 11-30 |
|
3791 |
createMxtTable(iconID, item_title, itemVal.list);// 关联数据回显渲染 李伟民 11-30 |
|
3792 |
// var newData = []; |
|
3793 |
// _.each(itemVal.list,function(opt){ |
|
3794 |
// opt = _.mapKeys(opt,function(value,key){ |
|
3795 |
// _.each(item_title,function(item){ |
|
3796 |
// if(key == item.fieldKey){ |
|
3797 |
// key = item.title; |
|
3798 |
// } |
|
3799 |
// }) |
|
3800 |
// return key; |
|
3801 |
// }) |
|
3802 |
// console.log(_.cloneDeep(opt)) |
|
3803 |
// newData.push(opt); |
|
3804 |
// }) |
|
3805 |
// console.log(itemVal.list); |
|
3806 |
// console.log(newData); |
|
3807 |
//// var $value = newData; |
|
3808 |
// var show = ""; |
|
3809 |
// var divBox = $("<div></div>"); |
|
3810 |
// divBox.attr('id',customItems[item].id+'divBox'); |
|
3811 |
// //console.log($value) |
|
3812 |
// var sdata_head = ""; |
|
3813 |
// _.each($value,(opt,j)=>{ |
|
3814 |
// //console.log(opt); |
|
3815 |
// var ulBox = $("<ul></ul>"); |
|
3816 |
// for(let i in opt){ |
|
3817 |
// show = ""; |
|
3818 |
// sdata_head = '<td class="data1 '+i+'">'+i+'</td>'; |
|
3819 |
// show += '<li>'+'<span class="data1 '+i+'">'+i+'</span>'+'<span class="data2 '+i+'">'+opt[i]+'</span>'+'</li>'; |
|
3820 |
// ulBox.attr("class","addUl ulBox"+j); |
|
3821 |
// ulBox.attr("id","ulBox"+j); |
|
3822 |
// //console.log(show) |
|
3823 |
// ulBox.append(show); |
|
3824 |
// } |
|
3825 |
// console.log(sdata_head); |
|
3826 |
// divBox.append(ulBox); |
|
3827 |
// }); |
|
3828 |
// $mytext.append(divBox); |
|
3829 |
} else { |
|
3830 |
//值设定 |
|
3831 |
customBase.setItemValue(id, type, items[item], 'customViewUEditorCss'); |
|
3832 |
//异步加载时数据临时保存 |
|
3833 |
customShow.options.initTempDatas[id] = items[item]; |
|
3834 |
} |
|
3835 |
} |
|
3836 |
}; |
|
3837 |
//赋值后绑定票据信息 |
|
3838 |
} |
|
3839 |
// 定义云账房方法 10/17 |
|
3840 |
var orderid = ""; |
|
3841 |
function getepc() { |
|
3842 |
window.queryAjaxsd("epc/epc-form/getOrderCode", {}, "POST", true).done(function (res) { |
|
3843 |
//console.log("云账房id"); |
|
3844 |
//console.log(res); |
|
3845 |
if (res.data != undefined) { |
|
3846 |
orderid = res.data.orderCode; |
|
3847 |
setepc(orderid); |
|
3848 |
} |
|
3849 |
|
|
3850 |
}) |
|
3851 |
} |
|
3852 |
function setepc(orderid) { |
|
3853 |
//console.log(orderid); |
|
3854 |
//console.log(customBase); |
|
3855 |
//console.log(window.customShow); |
|
3856 |
if (customBase.options.customItems.orderCode != undefined) { |
|
3857 |
var id = customBase.options.customItems.orderCode.id; |
|
3858 |
var type = customBase.options.customItems.orderCode.type; |
|
3859 |
//console.log(id); |
|
3860 |
//console.log(type); |
|
3861 |
|
|
3862 |
customBase.setItemValue(id, type, orderid); |
|
3863 |
} |
|
3864 |
} |
|
3865 |
|
|
3866 |
function getCookie(name) { |
|
3867 |
var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)"); |
|
3868 |
if (arr = document.cookie.match(reg)) |
|
3869 |
return unescape(arr[2]); |
|
3870 |
else |
|
3871 |
return null; |
|
3872 |
} |
|
3873 |
|
|
3874 |
customShow.uploadBill = function () {//票据上传 |
|
3875 |
$('#upload_iframe').show(); |
|
3876 |
var token = localStorage.getItem(token); |
|
3877 |
if (token != '' && token != undefined) { |
|
3878 |
token = JSON.parse(token).accessToken; |
|
3879 |
} |
|
3880 |
var compid = getCookie('companyId'); |
|
3881 |
var tenantId = localStorage.getItem("tenantID"); |
|
3882 |
// var iframe_src = "http://csza.chfcloud.com/views/order_create_visit.html?token=" + token + "&compid=" + compid +"&tenantId=" + tenantId; |
|
3883 |
var iframe_src = "http://csza.chfcloud.com/views/order_create_visit.html?token=" + localStorage.getItem("testToken") + "&compid=" + localStorage.getItem("testCompanyId") +"&tenantId=" + localStorage.getItem("testTenantId"); |
|
3884 |
//var iframe_src = "http://csza.chfcloud.com/views/order_create_visit.html?token=a23efb1df2303a914b1139d4e1d1859f&compid=66&tenantId=13"; |
|
3885 |
$("#upload_iframe").append("<iframe id='uploadBill' style='width:100%;overflow: auto;'></iframe>"); |
|
3886 |
////console.log($("body")); |
|
3887 |
var thisHeight = $("body").height(); |
|
3888 |
////console.log(thisHeight); |
|
3889 |
$('#upload_iframe').height(thisHeight); |
|
3890 |
$('#uploadBill').height(thisHeight); |
|
3891 |
$('#uploadBill').attr("src", iframe_src); |
|
3892 |
window.addEventListener("message", customShow.getExCouldNumber); |
|
3893 |
$("#upload_iframe .right").on("click", function () { |
|
3894 |
customShow.uploadBillClose(); |
|
3895 |
}); |
|
3896 |
|
|
3897 |
} |
|
3898 |
|
|
3899 |
customShow.getExCouldNumber = function (event) { |
|
3900 |
if (event && event.data && event.data.indexOf('csc_OrderCode=') != -1) { |
|
3901 |
var exCouldNumber = event.data.split('=')[1]; |
|
3902 |
console.log(exCouldNumber); |
|
3903 |
customShow.exCouldNumber = exCouldNumber; |
|
3904 |
if(localStorage.getItem('customShowFlag') == 2){//详情页上传票据需将云单编号传给后台 李伟民 01-04 |
|
3905 |
var orderData = { |
|
3906 |
"formId":customShow.options.formid, |
|
3907 |
"formDataId":localStorage.getItem("datarowNum"), |
|
3908 |
"orderCode":exCouldNumber |
|
3909 |
} |
|
3910 |
var orderUpdate = window.cloudAjax("epc-form/formData/updataBillInfoAndForm",orderData,"POST",true); |
|
3911 |
orderUpdate.done(function(res){ |
|
3912 |
if(res.rspCode == '000000'){ |
|
3913 |
changeOrderStatus('10'); |
|
3914 |
customShow.uploadBillClose(); |
|
3915 |
} |
|
3916 |
}); |
|
3917 |
}else{ |
|
3918 |
customShow.uploadBillClose(); |
|
3919 |
} |
|
3920 |
} |
|
3921 |
} |
|
3922 |
|
|
3923 |
customShow.uploadBillClose = function () { |
|
3924 |
$('#uploadBill').remove(); |
|
3925 |
$('#upload_iframe').hide(); |
|
3926 |
window.removeEventListener("message", customShow.getExCouldNumber); |
|
3927 |
$('.bill_upload').hide(); |
|
3928 |
// getepc(); |
|
3929 |
}//画面初期编辑内容设定 |
|
3930 |
customShow.setContentHtml = function (customItem, customViewDiv) { |
|
3931 |
|
|
3932 |
//按钮状态编辑 btnFlag:{editable:"1",printable:"1",auditable:"1",disposable:"1"} //按钮表示 |
|
3933 |
var btnFlag = customShow.options.btnFlag; |
|
3934 |
if (btnFlag.editable != "0") { |
|
3935 |
$("#editableBtn").removeClass("cfg_contentNone"); |
|
3936 |
} |
|
3937 |
if (btnFlag.printable != "0") { |
|
3938 |
$("#printableBtn").removeClass("cfg_contentNone"); |
|
3939 |
} |
|
3940 |
if (btnFlag.auditable != "0") { |
|
3941 |
$("#auditableBtn").removeClass("cfg_contentNone"); |
|
3942 |
} |
|
3943 |
if (btnFlag.disposable != "0") { |
|
3944 |
$("#disposableBtn").removeClass("cfg_contentNone"); |
|
3945 |
} |
|
3946 |
|
|
3947 |
var div = document.createElement("div"); |
|
3948 |
div.innerHTML = customItem.formeditor; |
|
3949 |
if (customShow.options.customInit.designMode == "1") { |
04dc45
|
3950 |
//发布页面查看大图排版问题 曲辰明 3-27 |
Q |
3951 |
//div.setAttribute("class", "divshow divshowEditor"); |
4d1219
|
3952 |
|
B |
3953 |
if (customShow.options.customShowFlag != "4") { |
|
3954 |
$(div).css("height", customItem.fromheigh); |
13ec33
|
3955 |
$(div).css("width", "100%"); |
4d1219
|
3956 |
// $(customViewDiv).css("height",customItem.fromheigh); |
B |
3957 |
// $(customViewDiv).css("width",customItem.fromwidth); |
|
3958 |
console.log(1); |
|
3959 |
} |
|
3960 |
|
|
3961 |
} else { |
|
3962 |
div.setAttribute("class", "divshow divshowNoEditor"); |
|
3963 |
// $(div)[0].style.height = window.innerHeight-140 + "px"; |
|
3964 |
// if(customShow.options.customShowFlag =="0"){ |
|
3965 |
// $(div)[0].style.width ='98%'; |
|
3966 |
// }else{ |
|
3967 |
// $(div)[0].style.width ='100%'; |
|
3968 |
// } |
|
3969 |
|
|
3970 |
// $(div)[0].style.overflowY ='auto'; |
|
3971 |
$(div)[0].style.width = '100%'; |
|
3972 |
$(div)[0].style.height = '100%'; |
|
3973 |
|
|
3974 |
$(div).css("display", "flex"); |
|
3975 |
$(div).css("justify-content", "flex-start"); |
|
3976 |
$(div).css("flex-wrap", "wrap"); |
|
3977 |
} |
|
3978 |
$(customViewDiv).prepend(div); |
|
3979 |
|
|
3980 |
//基本信息List取得 |
|
3981 |
customBase.options.customItems = customShow.getItemsList(); |
|
3982 |
console.log(customShow.getItemsList()) |
|
3983 |
console.log(customShow.options.customItemShow.item) |
|
3984 |
|
|
3985 |
//接口绑定 |
|
3986 |
interfaceBind = customShow.initEvent.interfaceBind; |
|
3987 |
for (var i = 0; i < interfaceBind.length; i++) { |
746465
|
3988 |
if(window[interfaceBind[i].customInterfacemethod] != undefined){ |
L |
3989 |
customShow.initEvent[interfaceBind[i].interfacemethod] = eval(interfaceBind[i].customInterfacemethod); |
|
3990 |
} |
4d1219
|
3991 |
}; |
B |
3992 |
|
|
3993 |
// //事件绑定 |
|
3994 |
// eventBind = customShow.initEvent.eventBind; |
|
3995 |
// //02事件绑定:字段别名 字段类型 事件名 自定义事件名 |
|
3996 |
// for (var i = 0; i < eventBind.length; i++) { |
|
3997 |
// // 自定义事件名 |
|
3998 |
// var setfunction = eval(eventBind[i].eventmethod); |
|
3999 |
// // 事件名 |
|
4000 |
// var eventName = eventBind[i].event; |
|
4001 |
// // 字段类型 |
|
4002 |
// // var tag = eventBind.tag; //------------类型绑定------------- |
|
4003 |
// // 字段别名 |
|
4004 |
// var fieldKey = eventBind[i].fieldName; |
|
4005 |
// // 取得控件ID |
|
4006 |
// var itemId = customBase.getfieldKeyFoItemId(fieldKey); //--------------------------- |
|
4007 |
// //事件绑定 |
|
4008 |
// $("#"+itemId).on(eventName, setfunction); |
|
4009 |
// }; |
|
4010 |
// //-------------------------主数据取得------------------------------ |
|
4011 |
//-------------------------数据源取得------------------------------ |
|
4012 |
//-------------------------API取得data----------------------------- |
|
4013 |
|
|
4014 |
//画面初期化 |
|
4015 |
customShow.initEvent.interfaceInit(customShow.options.customShowFlag); |
|
4016 |
console.log(customShow.options.customItemShow.item); |
|
4017 |
//第三方初始化 |
|
4018 |
|
|
4019 |
customShow.initEvent.interfaceInit3rd(); |
|
4020 |
|
|
4021 |
//密码输入---------------- |
|
4022 |
customShow.initEvent.passwordInputFlag(); |
|
4023 |
//tree控件 by kill |
|
4024 |
// 2017/11/4 李元杰 在点击预览的时候树的按钮 |
|
4025 |
customShow.treeWinShow(); |
|
4026 |
|
|
4027 |
} |
|
4028 |
//2017/11/2 李元杰 单选树 树的显示 |
|
4029 |
|
b84eca
|
4030 |
$('.customViewUEditorCss').on('click', '.citySel,.menuBtn', function () { |
4d1219
|
4031 |
debugger |
B |
4032 |
// 树里存在数据时 |
|
4033 |
if ($(this).parents('div[name="TreeWin"]').find('.ztree').children('li').length > 0) { |
13ec33
|
4034 |
// 12/16 李元杰 |
4d1219
|
4035 |
$('div.drop_down_sel').remove(); |
B |
4036 |
var fieldKey = $(this).parents('div[name="TreeWin"]').find('.zTreeDemoBackground').attr('fieldkey'); |
|
4037 |
$('.zTreeDemoBackground').css("display", "none"); |
|
4038 |
$(".search_input").css("display", "none"); |
|
4039 |
if (customBase.options.customItems[fieldKey].editable) { |
|
4040 |
if (event.target.className == 'defaultHeight citySel' || event.target.className == 'defaultHeight citySel') { |
|
4041 |
var ztree = $(this).parents('div[name="TreeWin"]').find('.ztree') |
|
4042 |
for (var i = 0; i < ztree.length; i++) { |
|
4043 |
var treeObj = $.fn.zTree.getZTreeObj($(ztree[i]).attr('id')); |
|
4044 |
if (!_.isNull(treeObj)) { |
|
4045 |
treeObj.expandAll(true); |
|
4046 |
} |
|
4047 |
} |
|
4048 |
} |
|
4049 |
$(this).parents('div[name="TreeWin"]').find('div[name="treeWinTitle"]').find('.search_input').css("display", "block"); |
|
4050 |
$(this).parents('div[name="TreeWin"]').find('.zTreeDemoBackground').show(); |
|
4051 |
// 12/16 end |
|
4052 |
} |
70c562
|
4053 |
$('.customViewUEditorCss').off('click.tree').on('click.tree', function () { |
4d1219
|
4054 |
console.log(1); |
B |
4055 |
console.log($('div.drop_down_sel')) |
|
4056 |
$('div.drop_down_sel').remove(); |
|
4057 |
$('.zTreeDemoBackground').css("display", "none"); |
|
4058 |
$(".search_input").css("display", "none"); |
|
4059 |
|
|
4060 |
}); |
|
4061 |
|
|
4062 |
$('div.TreeWin').off('click.tree').on('click.tree', function (event) { |
|
4063 |
// 展开树 12/4 |
|
4064 |
console.log($(this)) |
|
4065 |
$('div.drop_down_sel').remove(); |
|
4066 |
var fieldKey = $(this).find('.zTreeDemoBackground').attr('fieldkey'); |
|
4067 |
$('.zTreeDemoBackground').css("display", "none"); |
|
4068 |
$(".search_input").css("display", "none"); |
|
4069 |
if (customBase.options.customItems[fieldKey].editable) { |
|
4070 |
if (event.target.className == 'defaultHeight citySel' || event.target.className == 'defaultHeight citySel') { |
|
4071 |
var ztree = $(this).find('.ztree') |
|
4072 |
for (var i = 0; i < ztree.length; i++) { |
|
4073 |
var treeObj = $.fn.zTree.getZTreeObj($(ztree[i]).attr('id')); |
|
4074 |
if (!_.isNull(treeObj)) { |
|
4075 |
treeObj.expandAll(true); |
|
4076 |
} |
|
4077 |
} |
|
4078 |
} |
|
4079 |
|
|
4080 |
$(this).find('div[name="treeWinTitle"]').find('.search_input').css("display", "block"); |
|
4081 |
$(this).find('.zTreeDemoBackground').show(); |
|
4082 |
} |
|
4083 |
event.stopPropagation(); |
|
4084 |
}); |
|
4085 |
|
|
4086 |
} |
|
4087 |
}) |
|
4088 |
//this function by kill |
|
4089 |
customShow.treeWinShow = function () { |
|
4090 |
// $('body').append('<div id="occlusion"></div>') |
|
4091 |
// occlusionCss={ |
|
4092 |
// background: 'white', |
|
4093 |
// filter: 'alpha(opacity=100)', |
|
4094 |
// opacity: '1', |
|
4095 |
// display: 'none', |
|
4096 |
// position: 'absolute', |
|
4097 |
// top: '0px', |
|
4098 |
// left: '0px', |
|
4099 |
// width: '100%', |
|
4100 |
// height: '100%', |
|
4101 |
// display:'none', |
|
4102 |
// "z-index":"99998", |
|
4103 |
// display:"none", |
|
4104 |
// height:'100%', |
|
4105 |
// width:'100%', |
|
4106 |
// }; |
|
4107 |
treeButtonDivCss = { |
|
4108 |
position: "absolute", |
|
4109 |
top: '85%', |
|
4110 |
left: '30%', |
|
4111 |
} |
|
4112 |
treeDutton2DivCss = { |
|
4113 |
position: "absolute", |
|
4114 |
top: '85%', |
|
4115 |
left: '60%', |
|
4116 |
} |
|
4117 |
winCss = { |
|
4118 |
position: 'relative', |
|
4119 |
"border-radius": "4px", |
|
4120 |
width: "100%", |
|
4121 |
'max-width':"190px", |
|
4122 |
height: "30px", |
|
4123 |
|
|
4124 |
} |
|
4125 |
treeWinTitleCss = { |
|
4126 |
"margint-top": "3%" |
|
4127 |
} |
|
4128 |
subFormTreeCss = { |
|
4129 |
position: "absolute", |
|
4130 |
|
|
4131 |
top: '56px', |
|
4132 |
left: '0px', |
|
4133 |
|
|
4134 |
'background-color': '#fff', |
|
4135 |
'z-index': '99999', |
|
4136 |
// top:"15%", |
|
4137 |
// "margin-left":"5%", |
|
4138 |
width: "165px", |
|
4139 |
border: "1px solid #CCC", |
|
4140 |
overflow: "hidden", |
|
4141 |
'overflow-y': "auto", |
|
4142 |
|
|
4143 |
} |
|
4144 |
wintreeCss = { |
|
4145 |
position: "absolute", |
|
4146 |
top: '56px', |
|
4147 |
'background-color': '#fff', |
|
4148 |
'z-index': '99999', |
|
4149 |
// top:"15%", |
|
4150 |
// "margin-left":"5%", |
|
4151 |
width: "165px", |
|
4152 |
border: "1px solid #CCC", |
|
4153 |
overflow: "hidden", |
|
4154 |
'overflow-y': "auto", |
|
4155 |
} |
8aa132
|
4156 |
if(customShow.options.customInit.designMode == 2){//快捷模式处理 李伟民 0123 |
4d1219
|
4157 |
$(".ztree").parent().parent().attr("name", "TreeWin"); |
B |
4158 |
$(".ztree").parent().parent().attr("class", "TreeWin"); |
|
4159 |
}else{ |
|
4160 |
$(".ztree").parent().wrapAll('<div name="TreeWin" class="TreeWin"></div>'); |
|
4161 |
} |
13ec33
|
4162 |
|
4d1219
|
4163 |
|
B |
4164 |
$('.ztree').parents('div[name="TreeWin"]').show(); |
|
4165 |
// 2017/11/4 点击预览的时候产生的树样式 李元杰 |
|
4166 |
$('div[type="Tree"]').append('<button class="btn btn-primary" name="treeButton1" style="display:none">选择</button>'); |
|
4167 |
//马习同 下拉树样式修改 11/13 |
|
4168 |
// $('div[name="TreeWin"]').prepend(` |
|
4169 |
// <div name="treeWinTitle"> |
|
4170 |
// <div class="content_wrap"> |
|
4171 |
// <div> |
|
4172 |
// <ul class="list ulContent"> |
|
4173 |
// <div class="input-group" > |
|
4174 |
// <input readonly unselectable="on" type="text" class="defaultHeight citySel" placeholder="" aria-describedby="basic-addon1"> |
|
4175 |
// <button id="" type="button" class="menuBtn btn btn-default"><i class="fa fa-search" aria-hidden="true"></i></button> |
|
4176 |
// </div> |
|
4177 |
|
|
4178 |
// </li> |
|
4179 |
// </ul> |
|
4180 |
// </div> |
|
4181 |
// </div> |
|
4182 |
// </div> |
|
4183 |
// `); |
8aa132
|
4184 |
if(customShow.options.customInit.designMode == 2){ |
4d1219
|
4185 |
$('div[name="TreeWin"]').prepend(` |
B |
4186 |
<div name="treeWinTitle"> |
|
4187 |
<input id="search_input" type="text" class="defaultHeight search_input" placeholder="" aria-describedby="basic-addon1"> |
|
4188 |
<div class="content_wrap"> |
|
4189 |
<div> |
|
4190 |
<ul class="list ulContent"> |
|
4191 |
<div class="input-group" > |
|
4192 |
<input readonly unselectable="on" type="text" class="defaultHeight citySel" placeholder="" aria-describedby="basic-addon1"> |
|
4193 |
<button id="" type="button" class="menuBtn btn btn-default"><i class="fa fa-search" aria-hidden="true"></i></button> |
|
4194 |
</div> |
|
4195 |
|
|
4196 |
</li> |
|
4197 |
</ul> |
|
4198 |
</div> |
|
4199 |
</div> |
|
4200 |
</div> |
|
4201 |
`); |
8aa132
|
4202 |
}else{ |
L |
4203 |
_.each($('.ztree'),function(tree){ |
|
4204 |
if($(tree).parent().attr('class').indexOf('cfg_contentNone') != -1){ |
|
4205 |
$(tree).closest('div[name="TreeWin"]').prepend(` |
|
4206 |
<div name="treeWinTitle" class="cfg_contentNone"> |
|
4207 |
<input id="search_input" type="text" class="defaultHeight search_input" placeholder="" aria-describedby="basic-addon1"> |
|
4208 |
<div class="content_wrap"> |
|
4209 |
<div> |
|
4210 |
<ul class="list ulContent"> |
|
4211 |
<div class="input-group" > |
|
4212 |
<input readonly unselectable="on" type="text" class="defaultHeight citySel" placeholder="" aria-describedby="basic-addon1"> |
|
4213 |
<button id="" type="button" class="menuBtn btn btn-default"><i class="fa fa-search" aria-hidden="true"></i></button> |
|
4214 |
</div> |
13ec33
|
4215 |
|
8aa132
|
4216 |
</li> |
L |
4217 |
</ul> |
|
4218 |
</div> |
|
4219 |
</div> |
|
4220 |
</div> |
|
4221 |
`); |
|
4222 |
}else{ |
|
4223 |
$(tree).closest('div[name="TreeWin"]').prepend(` |
|
4224 |
<div name="treeWinTitle"> |
|
4225 |
<input id="search_input" type="text" class="defaultHeight search_input" placeholder="" aria-describedby="basic-addon1"> |
|
4226 |
<div class="content_wrap"> |
|
4227 |
<div> |
|
4228 |
<ul class="list ulContent"> |
|
4229 |
<div class="input-group" > |
|
4230 |
<input readonly unselectable="on" type="text" class="defaultHeight citySel" placeholder="" aria-describedby="basic-addon1"> |
|
4231 |
<button id="" type="button" class="menuBtn btn btn-default"><i class="fa fa-search" aria-hidden="true"></i></button> |
|
4232 |
</div> |
13ec33
|
4233 |
|
8aa132
|
4234 |
</li> |
L |
4235 |
</ul> |
|
4236 |
</div> |
|
4237 |
</div> |
|
4238 |
</div> |
|
4239 |
`); |
|
4240 |
} |
|
4241 |
}) |
13ec33
|
4242 |
|
8aa132
|
4243 |
} |
13ec33
|
4244 |
|
4d1219
|
4245 |
// $('div[name="TreeWin"]').prepend('<div name="treeWinSearch"><input id="search_input" placeholder="Type to filter"><hr /></div>'); |
B |
4246 |
// $('div[name="TreeWin"]').append('<div name="treeButtonDiv"><button class="btn btn-primary" name="treeButton2">确定</button></div>'); |
|
4247 |
// $('div[name="TreeWin"]').append('<div name="treeButtonDiv2"><button class="btn btn-danger" name="treeButton3">取消</button></div>'); |
|
4248 |
// $(".ztree").parent().css(subFormTreeCss); |
|
4249 |
// $('.ztree').parents('.fieldOrderNum').attr('typpe'); |
|
4250 |
var ztreeParentCss = $(".ztree").parent(); |
|
4251 |
$(".ztree").parent().css(subFormTreeCss); |
|
4252 |
for (var i = 0; i < ztreeParentCss.length; i++) { |
|
4253 |
// 11/16 李元杰 子表单内树形搜索框定位 |
|
4254 |
console.log($(ztreeParentCss[i]).find('ul')) |
|
4255 |
console.log($(ztreeParentCss[i]).parents('.fieldOrderNum')) |
|
4256 |
var isAllCopyTreeIs = $(ztreeParentCss[i]).find('ul').attr('id').split('tree')[0]; |
|
4257 |
if (customShow.options.customItemShow.item[isAllCopyTreeIs].parentsubFormNum != 0) { |
|
4258 |
$(ztreeParentCss[i]).css(subFormTreeCss); |
|
4259 |
$(ztreeParentCss[i]).parent('div[name="TreeWin"]').find('.search_input').addClass('search_input_subform') |
|
4260 |
} else { |
|
4261 |
|
|
4262 |
$(ztreeParentCss[i]).css(wintreeCss); |
|
4263 |
} |
|
4264 |
// 树形是否有数据的判断 |
|
4265 |
if ($(ztreeParentCss[i]).children('ul').children('li').length > 0) { |
|
4266 |
|
|
4267 |
} else { |
|
4268 |
|
|
4269 |
$(ztreeParentCss[i]).hide(); |
|
4270 |
} |
|
4271 |
} |
|
4272 |
// $("#occlusion").css(occlusionCss); |
|
4273 |
$('div[name="TreeWin"]').css(winCss); |
8aa132
|
4274 |
if(customShow.options.customInit.designMode == 1){ |
4d1219
|
4275 |
$('div[name="TreeWin"]').css('width','unset'); |
B |
4276 |
} |
|
4277 |
$('div[name="treeWinTitle"]').css(treeWinTitleCss); |
|
4278 |
$('.ztree').css("top", "%20"); |
|
4279 |
// $(".ztree").parent().parent().hide(); |
|
4280 |
//这个换成点击新建 |
|
4281 |
// $('button[name="treeButton1"]').click(function(){ |
|
4282 |
// 表明只有树组件时才提示是否绑定数据 |
|
4283 |
if ($('button[name="treeButton1"]').length > 0) { |
|
4284 |
var treeId = $('button[name="treeButton1"]').prev().attr("id"); |
|
4285 |
var treeJson = $('button[name="treeButton1"]').prev().children(':nth-child(2)').attr("masterdata"); |
|
4286 |
//////console.log($(this).prev()[0]); |
|
4287 |
// console.log(treeJson); |
|
4288 |
//console.log(treeId); |
|
4289 |
if (typeof (treeJson) == "undefined" || treeJson == "") { |
|
4290 |
// alert("该控件没有进行数据绑定!") |
|
4291 |
} else { |
|
4292 |
// $("#occlusion").fadeTo(200); |
|
4293 |
console.log($('button[name="treeButton1"]')) |
|
4294 |
$('button[name="treeButton1"]').prev().show(); |
|
4295 |
console.log($('div[name="treeWinTitle"]')) |
|
4296 |
var treeWinTitle = $('div[name="treeWinTitle"]'); |
|
4297 |
console.log(treeWinTitle[0]) |
|
4298 |
for (var i = 0; i < treeWinTitle.length; i++) { |
|
4299 |
console.log($(treeWinTitle[i])); |
|
4300 |
$(treeWinTitle[i]).find('input[type="text"]').attr('id', `search_input${i}`) |
|
4301 |
} |
|
4302 |
} |
|
4303 |
} |
|
4304 |
// 12/7 李元杰 树禁止背景颜色 |
|
4305 |
var editableBgColor = $('.ztree'); |
|
4306 |
for (var i = 0; i < editableBgColor.length; i++) { |
|
4307 |
var editableFlag = $(editableBgColor[i]).parent().attr('editable') |
|
4308 |
if (editableFlag == 'true') { |
|
4309 |
var a = $(editableBgColor[i]).parents('div[name="TreeWin"]').find('.citySel') |
|
4310 |
$(editableBgColor[i]).parents('div[name="TreeWin"]').find('.citySel').removeClass('disableColor') |
|
4311 |
} else { |
|
4312 |
var a = $(editableBgColor[i]).parents('div[name="TreeWin"]').find('.citySel') |
|
4313 |
$(editableBgColor[i]).parents('div[name="TreeWin"]').find('.citySel').addClass('disableColor') |
|
4314 |
} |
|
4315 |
} |
|
4316 |
// 12/7 end |
|
4317 |
$('.ztree').addClass('search_list'); |
|
4318 |
// 搜索框获得焦点时 初始化 |
|
4319 |
console.log($('.tabBox')) |
|
4320 |
$('.tabBox').on('focus', '.search_input', function () { |
|
4321 |
console.log($(this)) |
|
4322 |
var searchListId = $(this).parents('div[name="TreeWin"]').find('.ztree').attr('id'); |
|
4323 |
console.log($(this).parents('div[name="TreeWin"]').find('.ztree')); |
|
4324 |
$(this).fastLiveFilter(`#${searchListId}`, {}); |
|
4325 |
}) |
|
4326 |
// $('button[name="treeButton2"]').click(function(){ |
|
4327 |
// //确定按钮 by kill |
|
4328 |
// var treeId=$(this).parent().parent().children(':nth-child(2)').attr("id") |
|
4329 |
// $('#spanDiv'+treeId).remove() |
|
4330 |
// $('#'+treeId+"ActiveId").children(':nth-child(1)').append('<span id="spanDiv'+treeId+'"></span>') |
|
4331 |
// $('#'+treeId+'tree').children('li').each(function(){ |
|
4332 |
// var state=$(this).children(':nth-child(2)').attr('class') |
|
4333 |
// if(state.indexOf('true')!=-1){ |
|
4334 |
// var text=$(this).children(':nth-child(3)').attr('title'); |
|
4335 |
// $('#'+treeId+"ActiveId").children(':nth-child(1)').children(':nth-child(4)').append('<span>|'+text+'</span>') |
|
4336 |
// } |
|
4337 |
// }) |
|
4338 |
// // $("#occlusion").fadeOut(200); |
|
4339 |
// // $(this).parent().parent().hide(); |
|
4340 |
// } |
|
4341 |
// ) |
|
4342 |
// $('button[name="treeButton3"]').click(function(){ |
|
4343 |
// //取消按钮 by kill |
|
4344 |
// var treeId=$(this).parent().parent().children(':nth-child(2)').attr("id") |
|
4345 |
// var a = []; |
|
4346 |
// var tite=$('#spanDiv'+treeId).children().text(); |
|
4347 |
// for(var i=0;i<tite.split("|").length;i++){ |
|
4348 |
// $('#'+treeId+'tree').children('li').each(function(){ |
|
4349 |
// if(tite.split("|")[i]==$(this).children(':nth-child(3)').attr('title')){ |
|
4350 |
// a.push($(this).children(':nth-child(2)').attr('id')) |
|
4351 |
// }else{ |
|
4352 |
// if($(this).children(':nth-child(2)').attr('class').indexOf('true')!=-1){ |
|
4353 |
// $(this).children(':nth-child(2)').click(); |
|
4354 |
// } |
|
4355 |
// } |
|
4356 |
// }) |
|
4357 |
// } |
|
4358 |
// for(var x=0;x<a.length;x++){ |
|
4359 |
// $('#'+a[x]).click(); |
|
4360 |
// ////console.log(a[x]) |
|
4361 |
// } |
|
4362 |
|
|
4363 |
// // $("#occlusion").fadeOut(200); |
|
4364 |
// // $(this).parent().parent().hide(); |
|
4365 |
// }) |
|
4366 |
// end by kill |
|
4367 |
|
|
4368 |
|
|
4369 |
} |
|
4370 |
|
|
4371 |
//事件绑定 接口绑定 |
|
4372 |
customShow.setEventBind = function () { |
|
4373 |
// //接口绑定 |
|
4374 |
// interfaceBind = customShow.initEvent.interfaceBind; |
|
4375 |
// for (var i = 0; i < interfaceBind.length; i++) { |
|
4376 |
// customShow.initEvent[interfaceBind[i].interfacemethod] = eval(interfaceBind[i].customInterfacemethod); |
|
4377 |
// }; |
|
4378 |
|
|
4379 |
//事件绑定 |
|
4380 |
eventBind = customShow.initEvent.eventBind; |
|
4381 |
//02事件绑定:字段别名 字段类型 事件名 自定义事件名 |
|
4382 |
console.log(eventBind); |
|
4383 |
for (var i = 0; i < eventBind.length; i++) { |
|
4384 |
// 自定义事件名 |
|
4385 |
var funstr = eventBind[i].eventmethod + "()";//页面事件绑定 李伟民 12-22 |
f7134f
|
4386 |
//页面事件绑定 李伟民 12-22 |
4d1219
|
4387 |
// 事件名 |
B |
4388 |
var eventName = eventBind[i].event; |
|
4389 |
// 字段类型 |
|
4390 |
// var tag = eventBind.tag; //------------类型绑定------------- |
|
4391 |
// 字段别名 |
|
4392 |
var fieldKey = eventBind[i].fieldName; |
|
4393 |
// 取得控件ID |
|
4394 |
var itemId = customBase.getfieldKeyFoItemId(fieldKey); //--------------------------- |
f7134f
|
4395 |
$("#" + itemId).attr('funstr',funstr) |
4d1219
|
4396 |
//事件绑定 |
f7134f
|
4397 |
$("#" + itemId).on(eventName, function () { |
449a85
|
4398 |
try {//页面事件 无资源文件 JS报错解决 李伟民 0131 |
L |
4399 |
eval($(this).attr('funstr')); |
|
4400 |
} catch (error) { |
|
4401 |
console.log('资源文件中无此方法') |
|
4402 |
} |
f7134f
|
4403 |
}); |
4d1219
|
4404 |
}; |
B |
4405 |
//-------------------------主数据取得------------------------------ |
|
4406 |
|
|
4407 |
//公式初期化 |
|
4408 |
setTimeout(function () { |
|
4409 |
customLinkageAnalysis.bindLinkage(); |
|
4410 |
}, 200); |
|
4411 |
//行程排序初期化 |
|
4412 |
setTimeout(function () { |
|
4413 |
customShow.journeySort(); |
|
4414 |
}, 200); |
|
4415 |
// customShow.options.LinkageAnalysisSetValueFlag = ture; |
|
4416 |
|
|
4417 |
setTimeout(function () { |
|
4418 |
//初期化公式接口 |
|
4419 |
customShow.initEvent.interfaceInitLinkage(); |
|
4420 |
}, 200); |
|
4421 |
//马习同 合计 2017-12-07 公式初期化后 |
|
4422 |
customShow.oneTotle(); |
|
4423 |
} |
|
4424 |
|
|
4425 |
customShow.setEventBindItem = function (eventItem) { |
|
4426 |
//事件绑定 |
|
4427 |
eventBind = eventItem; |
|
4428 |
//02事件绑定:字段别名 字段类型 事件名 自定义事件名 |
|
4429 |
for (var i = 0; i < eventBind.length; i++) { |
|
4430 |
// 自定义事件名 |
|
4431 |
var setfunction = eval(eventBind[i].eventmethod); |
|
4432 |
// 事件名 |
|
4433 |
var eventName = eventBind[i].event; |
|
4434 |
// 字段类型 |
|
4435 |
// var tag = eventBind.tag; //------------类型绑定------------- |
|
4436 |
// 字段别名 |
|
4437 |
var fieldKey = eventBind[i].fieldName; |
|
4438 |
// 取得控件ID |
|
4439 |
var itemId = customBase.getfieldKeyFoItemId(fieldKey); //--------------------------- |
|
4440 |
//事件绑定 |
|
4441 |
$("#" + itemId).on(eventName, setfunction); |
|
4442 |
}; |
|
4443 |
} |
|
4444 |
customShow.listData = {}; |
|
4445 |
// 11/21 全局 itemId |
|
4446 |
customShow.itemId = ""; |
|
4447 |
//数据设定值取得(主数据 API 数据源 自定义) |
|
4448 |
customShow.setDatasourceData = function (customItem) { |
|
4449 |
//马习同 获取 |
|
4450 |
customItems = customShow.options.customItemShow.item; |
|
4451 |
|
|
4452 |
var setDataItem = { |
|
4453 |
masterdata: function (item, callback) { |
|
4454 |
setMasterData(item, callback); |
|
4455 |
}, |
|
4456 |
datasource: function (item, callback) { |
|
4457 |
setDatasource(item, callback); |
|
4458 |
}, |
|
4459 |
custom: function (item, callback) { |
|
4460 |
setCustom(item, callback); |
|
4461 |
}, |
|
4462 |
api: function (item, callback) { |
|
4463 |
setApiDatasource(item, callback); |
|
4464 |
} |
|
4465 |
} |
|
4466 |
var setCallbackItem = function (itemId, listData) { |
|
4467 |
var type = customShow.options.customItemShow.item[itemId].tag_Type; |
|
4468 |
if (type == "dropdownlist") { |
|
4469 |
setDropdownlist(itemId, listData); |
|
4470 |
} else if (type == "radio" || type == "checkbox") { |
|
4471 |
setCustomradio(itemId, listData); |
|
4472 |
} else if (type == "tree") { |
|
4473 |
var dropdowntype = customShow.options.customItemShow.item[itemId].tag_Attribute.dropdowntype; |
|
4474 |
if (dropdowntype == "multiple") { |
|
4475 |
// 多选的树样式 |
|
4476 |
$('#' + itemId + "tree").parent().hide(); |
|
4477 |
setTree(itemId, customBase.settingChkboxType, listData); |
|
4478 |
|
|
4479 |
} else { |
|
4480 |
// 2017/11/1 李元杰 树更改成单选 |
|
4481 |
// 单选的树样式 |
|
4482 |
|
|
4483 |
$('#' + itemId + "tree").parent().hide(); |
|
4484 |
setTree(itemId, customBase.settingRadioType, listData); |
|
4485 |
} |
|
4486 |
var unvisible = customBase.options.customItems; |
|
4487 |
for (item in unvisible) { |
|
4488 |
if (unvisible[item].type == "subform") { |
|
4489 |
var itemId = unvisible[item].id; |
|
4490 |
// var itemTwo = itemId; |
|
4491 |
// var itemSubform = $('.'+"customViewUEditorCss" +" #"+itemId+"ActiveId"); |
|
4492 |
////////////console.log(item); |
|
4493 |
//子表单删除第一条可添加 2017/10/26 马习同 |
|
4494 |
// var divIcon = $('<div id="'+itemId+'save" class="cfg_contentNone"></div>'); |
|
4495 |
var cloneE = $('#' + itemId + 'subformTr').clone(); |
|
4496 |
// divIcon.append(cloneE); |
|
4497 |
console.log(cloneE); |
|
4498 |
// itemSubform.append(divIcon); |
|
4499 |
|
|
4500 |
|
|
4501 |
customBase.options.customItems[item]['cloneDiv'] = cloneE; |
|
4502 |
} |
|
4503 |
} |
|
4504 |
} |
|
4505 |
} |
|
4506 |
|
|
4507 |
//下拉菜单 |
|
4508 |
setDropdownlist = function (itemId, listData) { |
|
4509 |
|
|
4510 |
|
|
4511 |
var dropdownlistData; |
|
4512 |
|
|
4513 |
var item = $('.customViewUEditorCss #' + itemId); |
|
4514 |
// $($('.customViewUEditorCss #'+itemId)[0]).empty(); |
|
4515 |
// $($($('.customViewUEditorCss #'+itemId)[0]).parentNode).find(".select2").remove(); |
|
4516 |
var dropdowntype = customShow.options.customItemShow.item[itemId].tag_Attribute.dropdowntype; |
|
4517 |
var editable = customShow.options.customItemShow.item[itemId].tag_Attribute.editable; |
|
4518 |
// ////console.log(editable); |
|
4519 |
var readonly = "readonly"; |
|
4520 |
if (editable) { |
|
4521 |
readonly = ""; |
|
4522 |
} |
|
4523 |
var width = $(item[0])[0].style.width.replace("px", ""); |
|
4524 |
width = parseInt(width); |
|
4525 |
console.log(width) |
|
4526 |
customBase.options.dropdownlistText[itemId] = listData; |
|
4527 |
// $("#"+itemId).parent().empty(); |
|
4528 |
var itemIdClass = "selectClass js-example-basic-single defaultHeight customShowItemClass dropdowntypeCss " + itemId + "value " + readonly; |
|
4529 |
var DropdownlistItem = $("#" + itemId).parent(); |
|
4530 |
DropdownlistItem.empty(); |
|
4531 |
DropdownlistItem.append($('<div id="' + itemId + '" class="selectClass ' + itemIdClass + '"></div>')); |
|
4532 |
if (dropdowntype == "multiple") { |
|
4533 |
xhSelect.setXhSelect( |
|
4534 |
{ |
|
4535 |
selectId: itemId, |
|
4536 |
multiple: true, |
|
4537 |
width: width, |
|
4538 |
listData: listData |
|
4539 |
} |
|
4540 |
); |
|
4541 |
} else { |
|
4542 |
xhSelect.setXhSelect( |
|
4543 |
{ |
|
4544 |
selectId: itemId, |
|
4545 |
multiple: false, |
|
4546 |
width: width, |
|
4547 |
listData: listData |
|
4548 |
} |
|
4549 |
); |
|
4550 |
} |
|
4551 |
// item.find(); |
|
4552 |
// if(dropdowntype == "multiple"){ |
|
4553 |
// item.select2({theme: "classic", |
|
4554 |
// width: width, |
|
4555 |
// data: listData, |
|
4556 |
// multiple: true}); |
|
4557 |
// }else{ |
|
4558 |
// item.select2({theme: "classic", |
|
4559 |
// width: width, |
|
4560 |
// data: listData, |
|
4561 |
// }); |
|
4562 |
// } |
|
4563 |
customShow.clickBindSubform(); |
|
4564 |
|
|
4565 |
//数据加载 |
|
4566 |
var initTempData = customShow.options.initTempDatas[itemId]; |
|
4567 |
if (initTempData != undefined) { |
|
4568 |
var parentsubFormNum = customShow.options.customItemShow.item[itemId].parentsubFormNum; |
|
4569 |
initTempData = customShow.dbItemToShowItem(itemId, "dropdownlistText", initTempData, "customViewUEditorCss", dropdowntype, parentsubFormNum); |
|
4570 |
// customShow.options.initTempDatas[itemId] = initTempData; |
|
4571 |
customBase.setItemValue(itemId, "dropdownlistText", initTempData, "customViewUEditorCss", dropdowntype); |
|
4572 |
customShow.setShowItem(itemId, "dropdownlistText", initTempData); |
|
4573 |
} else { |
|
4574 |
if (customShow.options.customItemShow.item[itemId].tag_Attribute.datasourcetype == "custom") { |
|
4575 |
var customItemsTemp = customShow.options.customItemShow.item[itemId].tag_Attribute.custom; |
|
4576 |
////////console.log(customItemsTemp); |
|
4577 |
var initTempDataCustom = [] |
|
4578 |
var j = 0; |
|
4579 |
|
|
4580 |
for (var i = 0; i < customItemsTemp.length; i++) { |
|
4581 |
if (customItemsTemp[i].ischecked) { |
|
4582 |
initTempDataCustom[j] = customItemsTemp[i].itemtext; |
|
4583 |
j++; |
|
4584 |
// ////////console.log(customItems[i].itemtext); |
|
4585 |
// ////////console.log(customItems[i]); |
|
4586 |
} |
|
4587 |
} |
|
4588 |
////////console.log(initTempDataCustom); |
|
4589 |
if (customShow.options.customItemShow.item[itemId].tag_Attribute.dropdowntype == "single") { |
|
4590 |
customBase.setItemValue(itemId, "dropdownlistText", [initTempDataCustom[0]], "customViewUEditorCss", dropdowntype); |
|
4591 |
} else { |
|
4592 |
customBase.setItemValue(itemId, "dropdownlistText", initTempDataCustom, "customViewUEditorCss", dropdowntype); |
|
4593 |
} |
|
4594 |
} |
|
4595 |
} |
|
4596 |
} |
|
4597 |
setCustomradio = function (itemId, listData) { |
|
4598 |
var tag_Type = customItems[itemId].tag_Type; |
|
4599 |
customBase.options.dropdownlistText[itemId] = listData; |
|
4600 |
$('.customViewUEditorCss #' + itemId).removeClass('select2Maxheight').addClass('select2Maxheight'); |
|
4601 |
var item = $('.customViewUEditorCss #' + itemId + " .line"); |
|
4602 |
var oNodeclass = "custom-check"; |
|
4603 |
if (tag_Type == "radio") { |
|
4604 |
oNodeclass = "custom-radio"; |
|
4605 |
} else if (tag_Type == "checkbox") { |
|
4606 |
oNodeclass = "custom-check"; |
|
4607 |
} |
|
4608 |
var oNode = ""; |
|
4609 |
var customItemsData = customBase.options.customItems; |
|
4610 |
for (data in customItemsData) { |
|
4611 |
// console.log(customBase.options.customItems[data]); |
|
4612 |
// console.log(itemId); |
|
4613 |
for (var i = 0; i < listData.length; i++) { |
|
4614 |
if (customBase.options.customItems[data].id == itemId) { |
|
4615 |
// 11/9 李元杰 是否有选中 |
|
4616 |
console.log(customBase.options.customItems[data]) |
|
4617 |
var curFlag = ''; |
|
4618 |
if(listData[i].ischecked){ |
|
4619 |
curFlag = 'cur' |
|
4620 |
} |
|
4621 |
if (customBase.options.customItems[data].editable) { |
|
4622 |
oNode += '<li class="ui-state-default" style="height:28px"><span class="' + oNodeclass + ' ' + curFlag +' " value="' + listData[i].value + '" ><i class="label"></i>' + listData[i].text + '</span></li>'; |
|
4623 |
} else { |
|
4624 |
oNode += '<li class="ui-state-default" style="height:28px"><span class="' + oNodeclass + ' ' + curFlag +' readonly" value="' + listData[i].value + '" ><i class="label"></i>' + listData[i].text + '</span></li>'; |
|
4625 |
} |
|
4626 |
// }else{ |
|
4627 |
// oNode += '<li class="ui-state-default" style="height:28px"><span class="'+oNodeclass+'" value="'+listData[i].value+'" ><i class="label"></i>'+listData[i].text+'</span></li>'; |
|
4628 |
} |
|
4629 |
}; |
|
4630 |
// if(customBase.options.customItems[data].id == itemId ){ |
|
4631 |
// // console.log(listData); |
|
4632 |
|
|
4633 |
// } |
|
4634 |
} |
|
4635 |
for (var i = 0; i < $(item).length; i++) { |
|
4636 |
// item.empty(); |
|
4637 |
$($(item)[i]).empty(); |
|
4638 |
$(item)[i].innerHTML = oNode; |
|
4639 |
} |
|
4640 |
customShow.clickBindSubform(); |
|
4641 |
//数据加载 |
|
4642 |
var initTempData = customShow.options.initTempDatas[itemId]; |
|
4643 |
if (initTempData != undefined) { |
|
4644 |
var parentsubFormNum = customShow.options.customItemShow.item[itemId].parentsubFormNum; |
|
4645 |
initTempData = customShow.dbItemToShowItem(itemId, tag_Type, initTempData, "customViewUEditorCss", '', parentsubFormNum); |
|
4646 |
// customShow.options.initTempDatas[itemId] = initTempData; |
|
4647 |
customBase.setItemValue(itemId, tag_Type, initTempData, "customViewUEditorCss"); |
|
4648 |
customShow.setShowItem(itemId, tag_Type, initTempData); |
|
4649 |
} |
|
4650 |
console.log($(item)) |
|
4651 |
// 12/11 禁用背景 |
|
4652 |
var spanDiv = $(item).find('li').find('span'); |
|
4653 |
console.log($(item).parent().attr('editable')) |
|
4654 |
if (($(item).parent().attr('editable') == "true")) { |
|
4655 |
$(item).find('li').find('span').addClass("disableUrl"); |
|
4656 |
for (var i = 0; i < spanDiv.length; i++) { |
|
4657 |
console.log($(spanDiv[i])) |
|
4658 |
if (tag_Type == "radio") { |
|
4659 |
$(spanDiv[i]).removeClass("disableRadUrl"); |
|
4660 |
} else if (tag_Type == "checkbox") { |
|
4661 |
$(spanDiv[i]).removeClass("disableChkUrl"); |
|
4662 |
} |
|
4663 |
} |
|
4664 |
} else { |
|
4665 |
for (var i = 0; i < spanDiv.length; i++) { |
|
4666 |
console.log($(spanDiv[i])) |
|
4667 |
if (tag_Type == "radio") { |
|
4668 |
$(spanDiv[i]).addClass("disableRadUrl"); |
|
4669 |
} else if (tag_Type == "checkbox") { |
|
4670 |
$(spanDiv[i]).addClass("disableChkUrl"); |
|
4671 |
} |
|
4672 |
|
|
4673 |
} |
|
4674 |
} |
|
4675 |
} |
|
4676 |
setTree = function (itemId, setting, listData) { |
|
4677 |
$('.customViewUEditorCss #' + itemId + "tree").empty(); |
|
4678 |
// 在这里设置 树的id 和 listData |
|
4679 |
customShow.listData[itemId] = listData; |
|
4680 |
customShow.itemId = itemId |
|
4681 |
var treeDiv = $('div#' + itemId); |
|
4682 |
if (treeDiv.length != 1) { |
|
4683 |
for (var i = 0; i < treeDiv.length - 1; i++) { |
|
4684 |
var ultreeId = $(treeDiv[i]).find('ul').attr('id'); |
|
4685 |
ultreeId = ultreeId.split('tree')[0] + 'tree'; |
|
4686 |
$(treeDiv[i]).find('ul').attr('id', ultreeId + i); |
|
4687 |
$.fn.zTree.init($($('.customViewUEditorCss #' + itemId + "tree" + i)), setting, listData); |
|
4688 |
// $('#'+itemId).parents('div[name="TreeWin"]').find('.citySel').addClass('disableColor') |
|
4689 |
console.log('#' + itemId); |
|
4690 |
var treeObj = $.fn.zTree.getZTreeObj(itemId + "tree" + i); |
|
4691 |
// customShow.setTree.disableParentNode.set(treeObj); |
|
4692 |
if (treeObj) { |
|
4693 |
treeObj.expandAll(true); |
|
4694 |
} |
|
4695 |
} |
|
4696 |
} else { |
|
4697 |
$.fn.zTree.init($($('.customViewUEditorCss #' + itemId + "tree")), setting, listData); |
|
4698 |
var treeObj = $.fn.zTree.getZTreeObj(itemId + "tree"); |
|
4699 |
var treeDefaultSet; |
|
4700 |
if (treeObj) { |
|
4701 |
treeObj.expandAll(true); |
|
4702 |
} |
|
4703 |
var defaultValue = $('#' + itemId).attr('defaultvalue'); |
|
4704 |
var dataObj, defaultValue; |
|
4705 |
var treeDefaultSet = customShow.treeDefaultSet(treeObj, defaultValue) |
|
4706 |
defaultValue = treeDefaultSet[0] |
|
4707 |
dataObj = treeDefaultSet[1]; |
|
4708 |
$('#' + itemId).attr('value', JSON.stringify(dataObj)) |
|
4709 |
$('#' + itemId).prev().find('.citySel').val(defaultValue); |
|
4710 |
// 12/8 禁止选中 李元杰' |
|
4711 |
console.log(itemId) |
|
4712 |
var treeArray = _.filter(customShow.options.customItemShow.item, ['tag_Type', 'tree']) |
|
4713 |
for (var i = 0; i < treeArray.length; i++) { |
|
4714 |
if (treeArray[i].tag_Id == itemId) { |
|
4715 |
if (treeArray[i].tag_Attribute.disableParentNode) { |
|
4716 |
customShow.setTree.disableParentNode.set(treeObj) |
|
4717 |
} |
|
4718 |
} |
|
4719 |
} |
|
4720 |
} |
|
4721 |
var initTempData = customShow.options.initTempDatas[itemId]; |
|
4722 |
|
|
4723 |
var defaultValue = $('#' + itemId).attr('defaultvalue'); |
|
4724 |
if (initTempData == 'undefined' || initTempData == undefined) { |
|
4725 |
if (defaultValue != '' && defaultValue != 'undefined' && defaultValue != undefined) { |
|
4726 |
initTempData = defaultValue; |
|
4727 |
} else { |
|
4728 |
initTempData = ' ' |
|
4729 |
} |
|
4730 |
} |
|
4731 |
// 010110001000010000010000001 |
|
4732 |
if (initTempData != undefined) { |
|
4733 |
customBase.setItemValue(itemId, "tree", initTempData, "customViewUEditorCss"); |
|
4734 |
} |
|
4735 |
customShow.clickBindSubform(); |
|
4736 |
} |
|
4737 |
|
|
4738 |
|
|
4739 |
|
|
4740 |
|
|
4741 |
//API数据 |
|
4742 |
setApiDatasource = function (item, callback) { |
|
4743 |
console.log(item) |
|
4744 |
var apiUrl = item.tag_Attribute.apiUrl; |
|
4745 |
var callbackId = item.tag_Id; |
|
4746 |
callbackApiData = function (itemData, url) { |
|
4747 |
|
|
4748 |
console.log(url) |
|
4749 |
var ItemId = url.split("callbackId=")[1]; |
|
4750 |
console.log(url) |
|
4751 |
var item = customShow.options.customItemShow.item[ItemId]; |
|
4752 |
var apiIdKey = item.tag_Attribute.apiIdKey;// 表示项 |
|
4753 |
var apiPIdKey = item.tag_Attribute.apiPIdKey;// 表示值 |
|
4754 |
itemData = itemData.data; |
|
4755 |
|
|
4756 |
things = []; |
|
4757 |
console.log(itemData); |
|
4758 |
// var textcolumn = itemData[apiIdKey]; |
|
4759 |
|
|
4760 |
// var valuecolumn = itemData[apiPIdKey]; |
|
4761 |
// //取得数据长度不一致时数据不设定 |
|
4762 |
// if (textcolumn.length != valuecolumn.length) { |
|
4763 |
// return; |
|
4764 |
// } |
|
4765 |
if (item.tag_Type == 'radio' || item.tag_Type == 'checkbox') { |
|
4766 |
for (var i = 0; i < itemData.length; i++) { |
|
4767 |
if (i == 0 && item.tag_Type == 'radio') { |
|
4768 |
things[i] = { ischecked: true, value: itemData[i][apiPIdKey], text: itemData[i][apiIdKey] }; |
|
4769 |
} else { |
|
4770 |
things[i] = { ischecked: false, value: itemData[i][apiPIdKey], text: itemData[i][apiIdKey] }; |
|
4771 |
} |
|
4772 |
}; |
|
4773 |
} else if (item.tag_Type == 'tree') { |
|
4774 |
var apiName = item.tag_Attribute.apiName; |
|
4775 |
console.log(apiName) |
|
4776 |
// var namecolumn = itemData[apiName]; |
|
4777 |
// if (textcolumn.length != namecolumn.length) { |
|
4778 |
// return; |
|
4779 |
// } |
|
4780 |
for (var i = 0; i < itemData.length; i++) { |
|
4781 |
things[i] = { id: itemData[i][apiIdKey], pId: itemData[i][apiPIdKey], name: itemData[i][apiName] }; |
|
4782 |
}; |
|
4783 |
} else { |
|
4784 |
console.log(itemData) |
|
4785 |
|
|
4786 |
for (var i = 0; i < itemData.length; i++) { |
|
4787 |
console.log(itemData[i]) |
|
4788 |
console.log(apiPIdKey) |
|
4789 |
console.log(apiIdKey) |
|
4790 |
console.log(itemData[i][apiPIdKey]) |
|
4791 |
console.log(itemData[i][apiIdKey]) |
|
4792 |
things[i] = { id: i, value: itemData[i][apiPIdKey], text: itemData[i][apiIdKey] }; |
|
4793 |
|
|
4794 |
}; |
|
4795 |
} |
|
4796 |
console.log(things); |
|
4797 |
callback(ItemId, things); |
|
4798 |
} |
|
4799 |
|
|
4800 |
customDataBound.getApiDatasource(apiUrl, callbackId, callbackApiData); |
|
4801 |
} |
|
4802 |
//主数据 |
|
4803 |
setMasterData = function (item, callback) { |
|
4804 |
var callbackId = item.tag_Id; |
|
4805 |
var code = item.tag_Attribute.masterData; |
|
4806 |
console.log(code); |
|
4807 |
// 11/9 |
|
4808 |
|
|
4809 |
|
|
4810 |
|
|
4811 |
console.log(callbackId) |
|
4812 |
// if(code == ""){ |
|
4813 |
// return; |
|
4814 |
// } |
|
4815 |
callbackMasterData = function (itemid, itemData) { |
|
4816 |
things = []; |
|
4817 |
console.log('√') |
|
4818 |
console.log(itemData); |
|
4819 |
console.log(itemid); |
|
4820 |
var customItems = customBase.options.customItems; |
|
4821 |
for (item in customItems) { |
|
4822 |
if (customBase.options.customItems[item].id == callbackId) { |
|
4823 |
|
|
4824 |
} |
|
4825 |
} |
|
4826 |
item = customShow.options.customItemShow.item[itemid]; |
|
4827 |
if (item.tag_Type == 'radio' || item.tag_Type == 'checkbox') { |
|
4828 |
for (var i = 0; i < itemData.length; i++) { |
|
4829 |
if (i == 0 && item.tag_Type == 'radio') { |
|
4830 |
things[i] = { ischecked: true, value: itemData[i].code, text: itemData[i].value }; |
|
4831 |
} else { |
|
4832 |
things[i] = { ischecked: false, value: itemData[i].code, text: itemData[i].value }; |
|
4833 |
} |
|
4834 |
}; |
|
4835 |
} else if (item.tag_Type == 'tree') { |
|
4836 |
//------------------------- |
|
4837 |
console.log(itemData) |
|
4838 |
if (itemData != null) { |
|
4839 |
for (var i = 0; i < itemData.length; i++) { |
|
4840 |
things[i] = { |
|
4841 |
id: itemData[i].code, |
|
4842 |
pId: itemData[i].pid, |
|
4843 |
name: itemData[i].value |
|
4844 |
}; |
|
4845 |
}; |
|
4846 |
} |
13ec33
|
4847 |
|
4d1219
|
4848 |
} else if (item.tag_Type == 'dropdownlist') { |
B |
4849 |
if(itemData != undefined && !_.isNull(itemData)){ |
|
4850 |
for (var i = 0; i < itemData.length; i++) { |
|
4851 |
things[i] = { id: i, value: itemData[i].code, text: itemData[i].value }; |
|
4852 |
|
13ec33
|
4853 |
}; |
4d1219
|
4854 |
} |
B |
4855 |
} else { |
|
4856 |
//其他控件主数据-- |
|
4857 |
} |
|
4858 |
callback(itemid, things); |
|
4859 |
} |
|
4860 |
|
|
4861 |
//数据源数据取得 |
|
4862 |
customDataBound.getElement(code, callbackId, function (rs) { |
|
4863 |
// 修改下拉框样式统一 |
|
4864 |
if (rs.data == null) { |
|
4865 |
callbackMasterData(callbackId, []); |
|
4866 |
} |
|
4867 |
for (itemid in rs.data) { |
|
4868 |
if (rs.data.hasOwnProperty(itemid)) { |
|
4869 |
callbackMasterData(itemid, rs.data[itemid]); |
|
4870 |
} |
|
4871 |
} |
|
4872 |
|
|
4873 |
|
|
4874 |
}); |
|
4875 |
} |
|
4876 |
//数据源 |
|
4877 |
setDatasource = function (item, callback) { |
|
4878 |
var temp = {}; |
|
4879 |
datasourceName = item.tag_Attribute.datasource; |
|
4880 |
if (datasourceName == "") { |
|
4881 |
return; |
|
4882 |
} |
|
4883 |
if (customShow.options.datasource[datasourceName] == undefined) { |
|
4884 |
return; |
|
4885 |
} |
|
4886 |
temp.columnNames = item.tag_Attribute.textcolumn + "," + item.tag_Attribute.valuecolumn; |
|
4887 |
temp.datasource = customShow.options.datasource[datasourceName].datasource; |
|
4888 |
temp.databaseName = customShow.options.datasource[datasourceName].databaseName; |
|
4889 |
temp.callbackId = item.tag_Id; |
|
4890 |
if (item.tag_Type == 'tree') { |
|
4891 |
temp.columnNames += "," + item.tag_Attribute.namecolumn; |
|
4892 |
} |
|
4893 |
|
|
4894 |
callbackDatasource = function (rs) { |
|
4895 |
console.log(this); |
|
4896 |
console.log(this.url); |
|
4897 |
var ItemId = this.url.split("callbackId=")[1]; |
|
4898 |
|
|
4899 |
item = customShow.options.customItemShow.item[ItemId]; |
|
4900 |
|
|
4901 |
datasourceName = rs.data; |
|
4902 |
|
|
4903 |
things = []; |
|
4904 |
var textcolumn = datasourceName[item.tag_Attribute.textcolumn]; |
|
4905 |
var valuecolumn = datasourceName[item.tag_Attribute.valuecolumn]; |
|
4906 |
if (item.tag_Type == 'radio' || item.tag_Type == 'checkbox') { |
|
4907 |
for (var i = 0; i < textcolumn.length; i++) { |
|
4908 |
if (i == 0 && item.tag_Type == 'radio') { |
|
4909 |
things[i] = { ischecked: true, value: valuecolumn[i], text: textcolumn[i] }; |
|
4910 |
} else { |
|
4911 |
things[i] = { ischecked: false, value: valuecolumn[i], text: textcolumn[i] }; |
|
4912 |
} |
|
4913 |
}; |
|
4914 |
} else if (item.tag_Type == 'tree') { |
|
4915 |
var namecolumn = datasourceName[item.tag_Attribute.namecolumn]; |
|
4916 |
for (var i = 0; i < valuecolumn.length; i++) { |
|
4917 |
things[i] = { id: valuecolumn[i], pId: textcolumn[i], name: namecolumn[i] }; |
|
4918 |
}; |
|
4919 |
|
|
4920 |
} else { |
|
4921 |
for (var i = 0; i < valuecolumn.length; i++) { |
|
4922 |
things[i] = { id: i, value: valuecolumn[i], text: textcolumn[i] }; |
|
4923 |
|
|
4924 |
}; |
|
4925 |
} |
|
4926 |
|
|
4927 |
callback(ItemId, things); |
|
4928 |
} |
|
4929 |
|
|
4930 |
//数据源数据取得 |
|
4931 |
customDataBound.getFieldDatasource(temp, callbackDatasource); |
|
4932 |
} |
|
4933 |
//自定义数据 ------1001-------- |
|
4934 |
setCustom = function (item, callback) { |
|
4935 |
var custom = item.tag_Attribute.custom; |
|
4936 |
things = []; |
|
4937 |
if (item.tag_Type == 'radio' || item.tag_Type == 'checkbox') { |
|
4938 |
for (var i = 0; i < custom.length; i++) { |
|
4939 |
things[i] = { ischecked: custom[i].ischecked, value: custom[i].itemtext, text: custom[i].itemtext }; |
|
4940 |
}; |
|
4941 |
|
|
4942 |
} else { |
|
4943 |
for (var i = 0; i < custom.length; i++) { |
|
4944 |
things[i] = { id: i, value: custom[i].itemtext, text: custom[i].itemtext }; |
|
4945 |
}; |
|
4946 |
} |
|
4947 |
var ItemId = customItem.id; |
|
4948 |
callback(ItemId, things); |
|
4949 |
} |
|
4950 |
|
|
4951 |
//树 单选按钮 多选按钮 下拉菜单 |
|
4952 |
var type = customItems[customItem.id].tag_Type; |
|
4953 |
if (type == 'dropdownlist' || type == 'radio' || type == 'checkbox' || type == 'tree') { |
|
4954 |
//数据取得顺序 |
|
4955 |
//按照 选择的情况? 按照主数据?TODO |
|
4956 |
var item = customShow.options.customItemShow.item[customItem.id]; |
|
4957 |
|
|
4958 |
//数据清空 |
|
4959 |
if (type == 'dropdownlist') { |
|
4960 |
$($('.customViewUEditorCss #' + customItem.id)[0]).empty(); |
|
4961 |
$($($('.customViewUEditorCss #' + customItem.id)[0]).parentNode).find(".select2").remove(); |
|
4962 |
var visibleTemp = customShow.options.customItemShow.item[customItem.id].tag_Attribute.visible; |
|
4963 |
if (!visibleTemp) { |
|
4964 |
$($($('.customViewUEditorCss #' + customItem.id)[0]).parentNode).remove(); |
|
4965 |
return; |
|
4966 |
} else { |
|
4967 |
$('.customViewUEditorCss #' + customItem.id).select2({ theme: "classic", width: '240' }); |
|
4968 |
} |
|
4969 |
} else if (type == 'radio' || type == 'checkbox') { |
|
4970 |
// var item = $('.customViewUEditorCss #'+customItem.id +" .line"); |
|
4971 |
$($($('.customViewUEditorCss #' + customItem.id + " .line"))[0]).empty(); |
|
4972 |
} |
|
4973 |
|
|
4974 |
var datasourcetype = item.tag_Attribute.datasourcetype; |
|
4975 |
// ////console.log(datasourcetype); |
|
4976 |
console.log(item); |
|
4977 |
console.log(datasourcetype); |
|
4978 |
setDataItem[datasourcetype](item, setCallbackItem); |
|
4979 |
// _.each($(".customShow .tdContentClass"), opt => { |
|
4980 |
// // $(opt).attr("title", $(opt).children().children().html()); |
|
4981 |
// console.log($(opt).html()) |
|
4982 |
// if ($(opt).children().children().attr("type") == "text") { |
|
4983 |
// $(opt).attr("title", $(opt).children().children().val()); |
|
4984 |
// } else { |
|
4985 |
// console.log(_.cloneDeep($(opt).children().children())) |
|
4986 |
// console.log(opt.innerHTML) |
|
4987 |
// console.log($(opt).children().children()[0].innerHTML) |
|
4988 |
// $(opt).attr("title", $(opt).children().children()[0].innerHTML); |
|
4989 |
// } |
|
4990 |
// }) |
|
4991 |
} |
|
4992 |
// return itemData; |
|
4993 |
// _.each($(".customShow .tdContentClass"), opt => { |
|
4994 |
// // $(opt).attr("title", $(opt).children().children().html()); |
|
4995 |
// console.log($(opt).html()) |
|
4996 |
// if ($(opt).children().children().attr("type") == "text") { |
|
4997 |
// $(opt).attr("title", $(opt).children().children().val()); |
|
4998 |
// } else { |
|
4999 |
// console.log(_.cloneDeep($(opt).children().children())) |
|
5000 |
// console.log(opt.innerHTML) |
|
5001 |
// console.log($(opt).children().children()[0].innerHTML) |
|
5002 |
// $(opt).attr("title", $(opt).children().children()[0].innerHTML); |
|
5003 |
// } |
|
5004 |
// }) |
|
5005 |
} |
|
5006 |
// 12/7 设置默认值 |
|
5007 |
customShow.treeDefaultSet = function (treeObj, defaultValue) { |
|
5008 |
var objValue = {}; |
|
5009 |
var defaultValueArray = []; |
|
5010 |
var valueData; |
|
5011 |
var dataObj = {}; |
|
5012 |
var dataObjArray = [] |
13ec33
|
5013 |
// 12/7 树的默认值 |
4d1219
|
5014 |
// 判断单选多选 |
B |
5015 |
// if(defaultValue.indexOf(',') == -1){ |
13ec33
|
5016 |
if(defaultValue){ |
4d1219
|
5017 |
// 单选 |
13ec33
|
5018 |
if (defaultValue.indexOf(',') == -1) { |
4d1219
|
5019 |
var nodes = treeObj.getNodeByParam("id", defaultValue, null); |
B |
5020 |
if (!_.isNull(nodes)) { |
|
5021 |
// 2017 /11/6 选中 |
|
5022 |
//选择节点设定 |
|
5023 |
treeObj.checkNode(nodes, true, true); |
|
5024 |
treeObj.expandAll(true); |
|
5025 |
dataObj[defaultValue] = '1'; |
|
5026 |
if (defaultValue == nodes.id) { |
|
5027 |
defaultValue = nodes.name; |
|
5028 |
} |
|
5029 |
} |
|
5030 |
} else { //多选 |
|
5031 |
defaultValueArray = defaultValue.split(','); |
|
5032 |
for (var i = 0; i < defaultValueArray.length; i++) { |
|
5033 |
valueData = defaultValueArray[i] |
|
5034 |
dataObj[valueData] = '1' |
|
5035 |
} |
|
5036 |
for (var i = 0; i < defaultValueArray.length; i++) { |
|
5037 |
var nodes = treeObj.getNodeByParam("id", defaultValueArray[i], null); |
|
5038 |
if (!_.isNull(nodes)) { |
|
5039 |
// 2017 /11/6 选中 |
|
5040 |
//选择节点设定 |
|
5041 |
treeObj.checkNode(nodes, true, true); |
|
5042 |
treeObj.expandAll(true); |
|
5043 |
if (defaultValueArray[i] == nodes.id) { |
|
5044 |
defaultValueArray[i] = nodes.name; |
|
5045 |
} |
|
5046 |
} |
|
5047 |
} |
|
5048 |
defaultValue = defaultValueArray.join(',') |
|
5049 |
} |
|
5050 |
console.log(dataObj) |
|
5051 |
objValue[0] = defaultValue; |
|
5052 |
objValue[1] = dataObj; |
|
5053 |
} |
|
5054 |
return objValue; |
|
5055 |
// } |
|
5056 |
} |
|
5057 |
|
|
5058 |
//画面表示项目一览取得 |
|
5059 |
customShow.getItemsList = function () { |
|
5060 |
|
|
5061 |
var items = customShow.options.customItemShow.item; |
|
5062 |
var itemsList = {}; |
|
5063 |
|
|
5064 |
for (i in items) { |
|
5065 |
if (items.hasOwnProperty(i)) { |
|
5066 |
var item = items[i]; |
|
5067 |
itemsList[item.tag_Attribute.alias] = { |
|
5068 |
fieldKey: item.tag_Attribute.alias, |
|
5069 |
id: item.tag_Id, |
|
5070 |
type: item.tag_Type, |
|
5071 |
parentsubFormNum: item.parentsubFormNum, |
|
5072 |
visible: item.tag_Attribute.visible, //可见 |
|
5073 |
editable: item.tag_Attribute.editable, //可编辑 |
|
5074 |
mustcheck: item.tag_Attribute.mustcheck, //必填 |
|
5075 |
approvalmustenter: item.tag_Attribute.approvalmustenter,//审查必须 |
|
5076 |
defaultvalue: item.tag_Attribute.defaultvalue, |
|
5077 |
// field:"", |
|
5078 |
} |
|
5079 |
console.log(item.tag_Attribute.defaultvalue) |
|
5080 |
} |
|
5081 |
}; |
|
5082 |
return itemsList; |
|
5083 |
} |
|
5084 |
|
|
5085 |
// 子表单事件调用 |
|
5086 |
customShow.clickBindSubform = function () { |
|
5087 |
// 单选框 |
|
5088 |
$('.select .custom-radio').unbind(); |
|
5089 |
$('.select .custom-radio').on('click', function () { |
|
5090 |
// //////////console.log(this.className); |
|
5091 |
if (this.className.indexOf("readonly") > -1) { |
|
5092 |
return; |
|
5093 |
} |
|
5094 |
$($(this).parent().parent()).find(".cur").removeClass('cur'); |
|
5095 |
$(this).addClass('cur').siblings().removeClass('cur'); |
|
5096 |
}); |
|
5097 |
customLinkageAnalysis.bindLinkageSubform("radio"); |
|
5098 |
// 多选框 |
|
5099 |
$('.select .custom-check').unbind(); |
|
5100 |
$('.select .custom-check').on('click', function () { |
|
5101 |
if (this.className.indexOf("readonly") > -1) { |
|
5102 |
return; |
|
5103 |
} |
|
5104 |
$(this).toggleClass('cur'); |
|
5105 |
// $($(this).parent().parent().parent().parent()).find(".errorItemCss").removeClass('errorItemCss'); |
|
5106 |
// //////////console.log($($(this).parent().parent().parent())[0].id); |
|
5107 |
// var id = $($(this).parent().parent().parent())[0].id; |
|
5108 |
// $("#"+id+"mesageErrDiv").remove(); |
|
5109 |
// $(".customViewUEditorCss #"+id).popover('hide') |
|
5110 |
}); |
|
5111 |
customLinkageAnalysis.bindLinkageSubform("checkbox"); |
|
5112 |
//删除子表单项目 |
|
5113 |
$('.divshowEditor .iconfontcolorTH').unbind(); |
|
5114 |
$('.divshowEditor .iconfontcolorTH').on('click', function () { |
|
5115 |
////////////////console.log($(this).parent().parent().parent()); |
|
5116 |
$(this).parent().parent().parent().parent().parent().remove(); |
|
5117 |
}); |
|
5118 |
$('.iconfontcolor').unbind(); |
|
5119 |
$('.iconfontcolor').on('click', function () { |
|
5120 |
$(this).parent().parent().parent().remove(); |
|
5121 |
}); |
|
5122 |
|
|
5123 |
//-----------------日期类型------------------------ |
|
5124 |
// $('.dateFromyyyy').unbind(); |
|
5125 |
// $('.dateFromyyyymm').unbind(); |
|
5126 |
// $('.dateFromyyyymmdd').unbind(); |
|
5127 |
// $('.dateFromhhmiss').unbind(); |
|
5128 |
// Flatpickr.localize(Flatpickr.l10ns.zh); // 设置为中文 |
|
5129 |
flatpickr('.customViewUEditorCss .dateFromyyyy', { |
|
5130 |
dateFormat: "Y", |
|
5131 |
}); |
|
5132 |
flatpickr('.customViewUEditorCss .dateFromyyyymm', { |
|
5133 |
dateFormat: "Y-m", |
|
5134 |
}); |
|
5135 |
flatpickr('.customViewUEditorCss .dateFromyyyymmdd', { |
|
5136 |
dateFormat: "Y-m-d", |
|
5137 |
}); |
|
5138 |
flatpickr('.customViewUEditorCss .dateFromhhmiss', { |
|
5139 |
dateFormat: "Y-m-d H:i", |
|
5140 |
time_24hr: true, |
|
5141 |
enableTime: true |
|
5142 |
}); |
|
5143 |
// customLinkageAnalysis.bindLinkageSubform("calendar"); |
|
5144 |
} |
|
5145 |
|
|
5146 |
//各控件初期 |
|
5147 |
customShow.controlInit = function (showClass) { |
|
5148 |
|
|
5149 |
var customItems = customBase.options.customItems; |
|
5150 |
console.log(customItems) |
|
5151 |
if ('customShow' != showClass) { |
|
5152 |
//HTML内容控件初期化 |
|
5153 |
var htmlediterShow = $(".customViewUEditorCss .htmlediterShowClass"); |
|
5154 |
|
|
5155 |
for (var i = 0; i < htmlediterShow.length; i++) { |
|
5156 |
var itemId = htmlediterShow[i].id; |
|
5157 |
var htmlediterShowItemId = itemId.replace("Item", ""); |
|
5158 |
// var heightShow = htmlediterShow[i].getAttribute("heightShow"); |
|
5159 |
// var widthShow = htmlediterShow[i].getAttribute("widthShow"); |
|
5160 |
// ////////console.log(customShow.options.customItemShow.item[htmlediterShowItemId].tag_Attribute.alias); |
|
5161 |
var heightShow = customShow.options.customItemShow.item[htmlediterShowItemId].tag_Attribute.height; |
|
5162 |
var widthShow = customShow.options.customItemShow.item[htmlediterShowItemId].tag_Attribute.width; |
|
5163 |
// customShow.options.customItemShow.item[itemId].tag_Attribute.alias; |
|
5164 |
if (widthShow == undefined || heightShow == undefined) { |
|
5165 |
widthShow = 200; |
|
5166 |
heightShow = 200; |
|
5167 |
} |
|
5168 |
|
|
5169 |
customShow.options.htmlediterShow[itemId] = {}; |
|
5170 |
customShow.options.htmlediterShow[itemId].widthShow = widthShow; |
|
5171 |
customShow.options.htmlediterShow[itemId].heightShow = heightShow; |
|
5172 |
|
|
5173 |
|
|
5174 |
UE.getEditor(itemId, { |
|
5175 |
// serverUrl :url, |
|
5176 |
//allowDivTransToP: false,//阻止转换div 为p |
|
5177 |
toolleipi: true,//是否显示,设计器的 toolbars |
|
5178 |
textarea: 'design_content', |
|
5179 |
//这里可以选择自己需要的工具按钮名称,此处仅选择如下五个 |
|
5180 |
toolbars: [[ |
|
5181 |
'source', '|', 'bold', 'underline', 'strikethrough', 'forecolor', 'backcolor','removeformat']], |
|
5182 |
//关闭字数统计 |
|
5183 |
wordCount: false, |
|
5184 |
//关闭elementPath |
|
5185 |
elementPathEnabled: false, |
|
5186 |
//默认的编辑区域高度 |
|
5187 |
initialFrameHeight: heightShow, |
|
5188 |
scaleEnabled: true, |
|
5189 |
//高度 |
|
5190 |
// initialFrameHeight:heightShow, |
|
5191 |
// readonly:true, |
|
5192 |
//,iframeCssUrl:"css/bootstrap/css/bootstrap.css" //引入自身 css使编辑器兼容你网站css |
|
5193 |
//更多其他参数,请参考ueditor.config.js中的配置项 |
|
5194 |
}).ready(function () { |
|
5195 |
////////////console.log(customBase.options.customItems); |
|
5196 |
id = this.key; |
|
5197 |
for (i in customBase.options.customItems) { |
|
5198 |
if (customBase.options.customItems.hasOwnProperty(i)) { |
|
5199 |
var idItem = id.replace("Item", ""); |
|
5200 |
if (customBase.options.customItems[i].id == idItem) { |
|
5201 |
if (customShow.options.itemFormbase == "") { |
|
5202 |
UE.getEditor(id).setContent(customBase.options.customItems[i].defaultvalue); |
|
5203 |
} else { |
|
5204 |
var defaultvalue = customShow.options.itemFormbase[i]; |
|
5205 |
// ////////console.log(defaultvalue); |
|
5206 |
// defaultvalue=defaultvalue+" "; |
|
5207 |
UE.getEditor(id).setContent(defaultvalue); |
|
5208 |
// setTimeout(function() { |
|
5209 |
// // this.body.focus(); |
|
5210 |
// ////////console.log(UE.getEditor(id)); |
|
5211 |
// UE.getEditor(id).options.scaleEnabled =false; |
|
5212 |
// }, 1000); |
|
5213 |
} |
|
5214 |
} |
|
5215 |
//非表示 |
|
5216 |
// if(!customBase.options.customItems[i].visible){ |
|
5217 |
// $(".customViewUEditorCss #"+id).addClass("cfg_contentNone"); |
|
5218 |
// } |
|
5219 |
} |
|
5220 |
} |
|
5221 |
$(".edui-editor-bottomContainer").addClass("cfg_contentNone"); |
|
5222 |
this.body.onclick = function (event, ui) { |
|
5223 |
//////////console.log(this); |
|
5224 |
//////////console.log(this.getAttribute("id")); |
|
5225 |
// $(this).removeClass("errorItemCss"); |
|
5226 |
// $("#"+this.getAttribute("id")+"mesageErrDiv").remove(); |
|
5227 |
} |
|
5228 |
}) |
|
5229 |
}; |
|
5230 |
} |
|
5231 |
//-----------------日期类型------------------------ |
|
5232 |
|
|
5233 |
flatpickr('.customViewUEditorCss .dateFromyyyy', { |
|
5234 |
dateFormat: "Y", |
|
5235 |
}); |
|
5236 |
flatpickr('.customViewUEditorCss .dateFromyyyymm', { |
|
5237 |
dateFormat: "Y-m", |
|
5238 |
}); |
|
5239 |
flatpickr('.customViewUEditorCss .dateFromyyyymmdd', { |
|
5240 |
dateFormat: "Y-m-d", |
|
5241 |
}); |
|
5242 |
flatpickr('.customViewUEditorCss .dateFromhhmiss', { |
|
5243 |
dateFormat: "Y-m-d H:i", |
|
5244 |
time_24hr: true, |
|
5245 |
enableTime: true |
|
5246 |
}); |
|
5247 |
|
|
5248 |
if ('customShow' != showClass) { |
|
5249 |
//删除项目(select2项目删除) |
|
5250 |
$('.selection').remove(); |
|
5251 |
$(".ztree").empty(); |
|
5252 |
} |
|
5253 |
//下拉列表初期化 |
|
5254 |
|
|
5255 |
// $(".dropdowntypeCss").select2({theme: "classic",width: '240'}); |
|
5256 |
// //下拉列表不可用 |
|
5257 |
$('.' + showClass + " .editableDisabled").prop("disabled", true); |
|
5258 |
|
|
5259 |
// 金融控件 |
|
5260 |
for (item in customItems) { |
|
5261 |
if (customItems.hasOwnProperty(item)) { |
|
5262 |
//金融控件 |
|
5263 |
if (customItems[item].type == "amount") { |
|
5264 |
if ("customViewUEditorCss" == showClass) { |
|
5265 |
var itemId = customItems[item].id; |
|
5266 |
// var itemValue = $('.'+showClass +" #"+itemId)[0].getAttribute("defaultvalue"); |
|
5267 |
var showCustomItem = customShow.options.customItemShow.item[itemId]; |
|
5268 |
// var itemValue = $('.'+showClass +" #"+itemId)[0].getAttribute("qrcodeurl"); |
|
5269 |
// var widthQrcode = $("#"+customItems[item].id)[0].width; |
|
5270 |
var itemValue = showCustomItem.tag_Attribute.defaultvalue; |
|
5271 |
var widthQrcode = showCustomItem.tag_Attribute.width; |
|
5272 |
if (widthQrcode == 0 || widthQrcode == undefined) { |
|
5273 |
widthQrcode = 60; |
|
5274 |
} |
|
5275 |
var divIcons = document.createElement("input"); |
|
5276 |
divIcons.setAttribute("type", "text"); |
|
5277 |
divIcons.setAttribute("id", customItems[item].id + "amount"); |
|
5278 |
divIcons.setAttribute("style", "width: " + widthQrcode + "px; height:33px"); |
|
5279 |
divIcons.setAttribute("class", "amountShowTextClass cfg_contentNone"); |
|
5280 |
divIcons.setAttribute("value", itemValue); |
|
5281 |
$('.' + showClass + " #" + itemId)[0].after(divIcons); |
|
5282 |
$('.' + showClass + " #" + itemId).addClass("amountShowClass"); |
|
5283 |
} |
|
5284 |
//申请单 |
|
5285 |
} |
|
5286 |
else if (customItems[item].type == "mytext") { |
|
5287 |
if ("customViewUEditorCss" == showClass) { |
|
5288 |
var itemId = customItems[item].id; |
|
5289 |
////console.log(itemId); |
|
5290 |
var showCustomItem = customShow.options.customItemShow.item[itemId]; |
|
5291 |
// var itemValue = $('.'+showClass +" #"+itemId)[0].getAttribute("qrcodeurl"); |
|
5292 |
// var widthQrcode = $("#"+customItems[item].id)[0].width; |
|
5293 |
var itemValue = showCustomItem.tag_Attribute.qrcodeurl; |
|
5294 |
var widthQrcode = showCustomItem.tag_Attribute.width; |
|
5295 |
if (widthQrcode == 0 || widthQrcode == undefined) { |
|
5296 |
widthQrcode = 60; |
|
5297 |
} |
|
5298 |
var divIcons = document.createElement("div"); |
|
5299 |
var div = document.createElement("div"); |
|
5300 |
divIcons.setAttribute("id", customItems[item].id + "qrcode"); |
|
5301 |
divIcons.setAttribute("class", "boxBtn"); |
|
5302 |
divIcons.setAttribute("myAttr", itemId); |
|
5303 |
divIcons.innerHTML = '选择数据'; |
|
5304 |
divIcons.setAttribute("maxlength", 200); |
|
5305 |
$('.' + showClass + " #" + itemId).eq(0).after(divIcons); |
|
5306 |
// $(" #"+itemId+"divid")[0].after(divIcons); |
|
5307 |
} |
|
5308 |
//二维码 |
|
5309 |
} else if (customItems[item].type == "qrcode") { |
|
5310 |
if ("customViewUEditorCss" == showClass) { |
|
5311 |
var itemId = customItems[item].id; |
|
5312 |
var showCustomItem = customShow.options.customItemShow.item[itemId]; |
|
5313 |
// var itemValue = $('.'+showClass +" #"+itemId)[0].getAttribute("qrcodeurl"); |
|
5314 |
// var widthQrcode = $("#"+customItems[item].id)[0].width; |
|
5315 |
var itemValue = showCustomItem.tag_Attribute.qrcodeurl; |
|
5316 |
var widthQrcode = showCustomItem.tag_Attribute.width; |
9ba3c7
|
5317 |
var heightqrcode = showCustomItem.tag_Attribute.height; |
Z |
5318 |
if (heightqrcode == 0 || heightqrcode == undefined) { |
|
5319 |
heightqrcode = 165; |
|
5320 |
} |
4d1219
|
5321 |
if (widthQrcode == 0 || widthQrcode == undefined) { |
B |
5322 |
widthQrcode = 165; |
|
5323 |
} |
9ba3c7
|
5324 |
|
4d1219
|
5325 |
var divIcons = document.createElement("input"); |
B |
5326 |
divIcons.setAttribute("type", "text"); |
|
5327 |
divIcons.setAttribute("id", customItems[item].id + "qrcode"); |
|
5328 |
divIcons.setAttribute("style", "width: " + widthQrcode + "px;height:33px"); |
|
5329 |
divIcons.setAttribute("class", "qrcodeShowTextClass cfg_contentNone"); |
|
5330 |
divIcons.setAttribute("value", itemValue); |
|
5331 |
divIcons.setAttribute("maxlength", 200); |
|
5332 |
$('.' + showClass + " #" + itemId)[0].after(divIcons); |
9ba3c7
|
5333 |
$('.' + showClass + " #" + itemId)[0].setAttribute("style", "width: " + widthQrcode + "px;height:" + heightqrcode + "px"); |
4d1219
|
5334 |
$('.' + showClass + " #" + itemId).addClass("qrcodeShowClass"); |
B |
5335 |
} |
|
5336 |
//条形码 |
|
5337 |
} else if (customItems[item].type == "barcode") { |
|
5338 |
if ("customViewUEditorCss" == showClass) { |
|
5339 |
var itemId = customItems[item].id; |
|
5340 |
// var itemValue = $('.'+showClass +" #"+itemId)[0].getAttribute("text"); |
|
5341 |
// var widthBarcode = $("#"+customItems[item].id)[0].width; |
|
5342 |
var showCustomItem = customShow.options.customItemShow.item[itemId]; |
|
5343 |
// var itemValue = $('.'+showClass +" #"+itemId)[0].getAttribute("qrcodeurl"); |
|
5344 |
// var widthQrcode = $("#"+customItems[item].id)[0].width; |
|
5345 |
var itemValue = showCustomItem.tag_Attribute.text; |
|
5346 |
var widthBarcode = 165; |
|
5347 |
// if(widthBarcode == 0){ |
|
5348 |
// widthBarcode = 100; |
|
5349 |
// } |
|
5350 |
var divIcons = document.createElement("input"); |
|
5351 |
divIcons.setAttribute("type", "text"); |
|
5352 |
divIcons.setAttribute("id", customItems[item].id + "barcode"); |
|
5353 |
divIcons.setAttribute("style", "width: " + widthBarcode + "px;height:33px"); |
|
5354 |
divIcons.setAttribute("class", "barcodeShowTextClass cfg_contentNone"); |
|
5355 |
divIcons.setAttribute("value", itemValue); |
|
5356 |
divIcons.setAttribute("maxlength", 200); |
|
5357 |
$('.' + showClass + " #" + itemId)[0].after(divIcons); |
|
5358 |
$('.' + showClass + " #" + itemId).addClass("barcodeShowClass"); |
|
5359 |
} |
|
5360 |
//子表单设定 |
|
5361 |
} else if (customItems[item].type == "subform") { |
|
5362 |
var itemId = customItems[item].id; |
|
5363 |
var itemTwo = itemId; |
|
5364 |
var itemSubform = $('.' + showClass + " #" + itemId + "ActiveId"); |
|
5365 |
//lym |
|
5366 |
//位总div添加id |
|
5367 |
$("#" + itemId + "ActiveId").find(".usfile").attr("id", itemTwo + "uld"); |
|
5368 |
//为a标签添加id |
|
5369 |
$("#" + itemId + "ActiveId").find(".usfile a").attr("id", itemTwo + "uis"); |
|
5370 |
$("#" + itemId + "ActiveId").find(".usfile a").attr("itemId", itemTwo); |
|
5371 |
//为inputFile添加id |
|
5372 |
$("#" + itemId + "ActiveId").find("#" + itemTwo + "uld form input").attr("itemId", itemTwo); |
|
5373 |
$("#" + itemId + "ActiveId").find("#" + itemTwo + "uld form input").attr("id", itemTwo + "btn"); |
|
5374 |
$("#" + itemId + "ActiveId").find("#" + itemTwo + "uld form").attr("itemId", itemTwo); |
|
5375 |
|
|
5376 |
//////////////console.log(item); |
|
5377 |
var ulIcon = document.createElement("ul"); |
|
5378 |
var liIcon = ""; |
|
5379 |
var m_customItems = customShow.options.customItemShow.item; |
|
5380 |
console.log(customBase.options) |
|
5381 |
var subItems = []; |
|
5382 |
var parentNum = itemId.replace("itemId_", ""); |
|
5383 |
_.each(m_customItems, opt => { |
|
5384 |
if (opt.parentsubFormNum == parentNum) { |
|
5385 |
subItems.push(opt); |
|
5386 |
} |
|
5387 |
}) |
|
5388 |
console.log(subItems) |
|
5389 |
_.remove(subItems, n => { |
|
5390 |
return n.tag_Attribute.alias == "DATAROWNUM" || n.tag_Attribute.visible == false; |
|
5391 |
}); |
|
5392 |
//_.sortBy(orderArr, ['fieldOrderNum']); |
|
5393 |
subItems = _.sortBy(subItems, ['fieldOrderNum']); |
|
5394 |
_.each(subItems, opt => { |
|
5395 |
console.log(opt) |
|
5396 |
if (opt.tag_Type == "number") { |
|
5397 |
liIcon += "<li class='n_totle'><input class='" + opt.tag_Id + "totle textCssDiv defaultHeight' type='text' readonly></li>" |
|
5398 |
console.log(1) |
|
5399 |
} else { |
|
5400 |
liIcon += "<li class='p_totle'></li>" |
|
5401 |
console.log(2) |
|
5402 |
} |
|
5403 |
}); |
|
5404 |
$(ulIcon).append(liIcon); |
|
5405 |
$("#" + itemId + "ActiveId").find(".h_totle").append(ulIcon); |
|
5406 |
console.log($("#" + itemId + "ActiveId").find(".h_totle")) |
|
5407 |
console.log(ulIcon) |
13ec33
|
5408 |
// 单行文本 多行文本 数字 日历 |
4d1219
|
5409 |
} else if (customItems[item].type == "text" || customItems[item].type == "textarea" || customItems[item].type == "number" || customItems[item].type == "calendar") { |
B |
5410 |
var itemId = customItems[item].id; |
|
5411 |
var defaultvalue = $("#" + itemId).attr("defaultvalue"); |
|
5412 |
// 12/4 判断是否存在当前时间 |
|
5413 |
var calendar = _.filter(customShow.options.customItemShow.item, ['tag_Type', 'calendar']) |
|
5414 |
for (var i = 0; i < calendar.length; i++) { |
|
5415 |
if (calendar[i].tag_Attribute.currentDate) { |
|
5416 |
if (itemId == calendar[i].tag_Id) { |
|
5417 |
defaultvalue = customShow.currentDate |
|
5418 |
} |
|
5419 |
} |
|
5420 |
} |
|
5421 |
console.log(defaultvalue) |
|
5422 |
// 之前表单日历默认值不存在时 12/4 |
|
5423 |
if (defaultvalue == undefined || defaultvalue == 'undefined') { |
|
5424 |
defaultvalue = '' |
|
5425 |
} |
|
5426 |
customBase.setItemValue(itemId, "text", defaultvalue); |
|
5427 |
//数字验证事件追加 |
|
5428 |
if (customItems[item].type == "number") { |
|
5429 |
//数值型控件验证 |
|
5430 |
$("#" + itemId).unbind('blur'); |
|
5431 |
$("#" + itemId).on('blur', function (e) { |
|
5432 |
var numbertype = $(this)[0].getAttribute("numbertype"); |
|
5433 |
if (numbertype == "decimal") { |
|
5434 |
var decimalplace = $(this)[0].getAttribute("decimalplace"); |
|
5435 |
decimalplace = parseInt(decimalplace); |
|
5436 |
if ($(this)[0].value != "") { |
|
5437 |
$(this)[0].value = Number($(this)[0].value).toFixed(decimalplace); |
|
5438 |
} |
|
5439 |
|
|
5440 |
} |
|
5441 |
}); |
|
5442 |
} |
|
5443 |
} else if (customItems[item].type == 'dropdownlist' || customItems[item].type == 'radio' || |
|
5444 |
customItems[item].type == 'checkbox' || customItems[item].type == 'tree') { |
|
5445 |
if ('customShow' != showClass) { |
|
5446 |
//数据源绑定 |
|
5447 |
customShow.setDatasourceData(customItems[item]); |
|
5448 |
} |
|
5449 |
} else if (customItems[item].type == 'splitline') { |
|
5450 |
//分割线 |
|
5451 |
var itemId = customItems[item].id; |
|
5452 |
$('.' + showClass + " #" + itemId + "ActiveId").addClass("layoutsetting8"); |
|
5453 |
} else if (customItems[item].type == 'tree') { |
|
5454 |
var itemId = customItems[item].id; |
|
5455 |
var defaultvalue = $("#" + itemId)[0].getAttribute("defaultvalue"); |
|
5456 |
|
|
5457 |
// 之前表单树形默认值不存在时 12/7 |
|
5458 |
if (defaultvalue == undefined || defaultvalue == 'undefined') { |
|
5459 |
defaultvalue = '' |
|
5460 |
} |
|
5461 |
customBase.setItemValue(itemId, "text", defaultvalue); |
|
5462 |
} |
|
5463 |
//初始属性设定 |
|
5464 |
if (customItems[item].type == 'dropdownlist' || customItems[item].type == 'radio' || |
|
5465 |
customItems[item].type == 'checkbox' || customItems[item].type == 'tree' || |
|
5466 |
customItems[item].type == "text" || customItems[item].type == "textarea" || customItems[item].type == "number" |
|
5467 |
|| customItems[item].type == "calendar" || customItems[item].type == "fileupload" |
|
5468 |
|| customItems[item].type == "qrcode" || customItems[item].type == "barcode" |
|
5469 |
|| customItems[item].type == "htmlediter" || customItems[item].type == "link" |
|
5470 |
|| customItems[item].type == "subform" |
|
5471 |
) { |
|
5472 |
console.log(customBase.options.customItems[item]) |
|
5473 |
customShow.setShowAttribute(customBase.options.customItems[item]); |
|
5474 |
} |
|
5475 |
// 12/15 |
|
5476 |
if (customItems[item].type == "link") { |
|
5477 |
var linkurl = customShow.costType[customItems[item].id].tag_Attribute.linkurl; |
|
5478 |
if(linkurl == ''){ |
|
5479 |
linkurl = 'javascript:void(0)'; |
|
5480 |
} |
|
5481 |
if(customShow.costType[customItems[item].id].tag_Attribute.editable){//不可编辑控制 李伟民 0124 |
|
5482 |
$('#'+customItems[item].id).attr('href',linkurl) |
|
5483 |
} |
|
5484 |
} |
|
5485 |
} |
|
5486 |
}; |
|
5487 |
//事件追加 |
|
5488 |
customShow.clickBindSubform(); |
|
5489 |
|
|
5490 |
} |
|
5491 |
|
|
5492 |
//固定事件的绑定 |
|
5493 |
var index_i = 0; |
|
5494 |
customShow.clickBind = function () { |
|
5495 |
|
|
5496 |
//子表单事件追加 |
|
5497 |
customShow.clickBindSubform(); |
|
5498 |
|
|
5499 |
// //保存按钮按下 |
|
5500 |
// $(".fromSaveCss").on('click', function() { |
|
5501 |
// customShow.onclickSave(); |
|
5502 |
// }); |
|
5503 |
|
|
5504 |
// //取消按钮按下 |
|
5505 |
// $(".cancelCss").on('click', function() { |
|
5506 |
// customShow.onclickCancel(); |
|
5507 |
// }); |
|
5508 |
|
|
5509 |
|
|
5510 |
// 子表单添加记录事件 |
|
5511 |
|
|
5512 |
$('.subformAdd').unbind(); |
|
5513 |
function addSubFunc() { |
|
5514 |
//子表单项目追加 |
|
5515 |
//console.log($(this)[0]); |
|
5516 |
customShow.addsubformList($(this)[0], "customViewUEditorCss"); |
|
5517 |
// customShow.setXhSelectListAdd(); |
|
5518 |
//子表单事件追加 |
|
5519 |
customShow.clickBindSubform(); |
|
5520 |
//公式初期化 |
|
5521 |
customLinkageAnalysis.bindLinkage(); |
|
5522 |
customShow.oneTotle(); |
|
5523 |
//console.log($('.subformAdd')); |
|
5524 |
$('.subformAdd').unbind('click', addSubFunc); |
|
5525 |
$('.subformAdd').on('click', addSubFunc); |
|
5526 |
//行程排序初期化 |
|
5527 |
customShow.journeySort(); |
|
5528 |
SC.noBillCheckInit()//无票据行程验证 |
|
5529 |
|
|
5530 |
} |
|
5531 |
$('.subformAdd').on('click', addSubFunc); |
|
5532 |
|
|
5533 |
//主数据丢失 |
|
5534 |
// $('.subformAdd').unbind(); |
|
5535 |
// $('.subformAdd').on('click', function(){ |
|
5536 |
// console.log(1) |
|
5537 |
// //子表单项目追加 |
|
5538 |
// customShow.addsubformList($(this)[0],"customViewUEditorCss"); |
|
5539 |
// //子表单事件追加 |
|
5540 |
// customShow.clickBindSubform(); |
|
5541 |
// //公式初期化 |
|
5542 |
// customLinkageAnalysis.bindLinkage(); |
|
5543 |
// //行程排序初期化 |
|
5544 |
// customShow.journeySort(); |
|
5545 |
// }); |
|
5546 |
|
|
5547 |
//图片文件上传 |
|
5548 |
var uploaderImage = $(".customViewUEditorCss .uploaderImage"); |
|
5549 |
for (var i = 0; i < uploaderImage.length; i++) { |
|
5550 |
|
|
5551 |
var imageItem = customShow.options.customItemShow.item[uploaderImage[i].id]; |
|
5552 |
var itemList = customBase.options.uploaderItemReady[uploaderImage[i].id]; |
|
5553 |
// 参数设定 |
|
5554 |
var potion = { |
|
5555 |
id: uploaderImage[i].id, |
|
5556 |
width: imageItem.tag_Attribute.width, |
|
5557 |
height: imageItem.tag_Attribute.height, |
|
5558 |
formid: customShow.options.formid, |
|
5559 |
imagetype: imageItem.tag_Attribute.dropdowntype, //图片类型 |
|
5560 |
editable: imageItem.tag_Attribute.editable, //是否可编辑 |
|
5561 |
defaultvalueUrl: imageItem.tag_Attribute.defaultvalue, //默认的Url |
|
5562 |
ItemReady: itemList, |
|
5563 |
visible:imageItem.tag_Attribute.visible |
|
5564 |
} |
|
5565 |
customBase.uploaderShow(potion); |
|
5566 |
// customBase.uploaderShow("#"+uploaderImage[i].id,{width:0,height:200},true,customShow.options.formid); |
|
5567 |
|
|
5568 |
}; |
|
5569 |
|
|
5570 |
//lym子表单上传 |
|
5571 |
$('.sonImportFile').unbind(); |
|
5572 |
$(".sonImportFile").click(function () { |
|
5573 |
console.log("进入点击事件"); |
|
5574 |
//var checkedObj = $("#tbody input[type=checkbox]:checked"); |
|
5575 |
console.log("fdsffddffd"); |
|
5576 |
// //创建文件上传对象 |
|
5577 |
var a = $(this).attr("itemId") |
|
5578 |
console.log(a) |
|
5579 |
$("#" + a + "btn").click( |
|
5580 |
|
|
5581 |
); |
|
5582 |
$("#" + a + "btn").change(function () { |
|
5583 |
console.log("uqwhdoqwhdo"); |
|
5584 |
//var objFile = $("#"+itemTwo+"btn"); |
|
5585 |
//改变 |
|
5586 |
|
|
5587 |
let mthis = this; |
|
5588 |
var tenantId = localStorage.getItem("tenantID"); |
|
5589 |
var formID = localStorage.getItem("newFormID"); |
|
5590 |
var tenant = JSON.parse(tenantId); |
|
5591 |
var user = localStorage.getItem("userName"); |
|
5592 |
var userName = JSON.parse(user); |
|
5593 |
var aba = a; |
|
5594 |
console.log(aba); |
13ec33
|
5595 |
//结束 |
4d1219
|
5596 |
console.log(tenantId); |
B |
5597 |
console.log(formID); |
|
5598 |
var objFile = $(this); |
|
5599 |
if (objFile.value == "") { |
|
5600 |
return; |
|
5601 |
} else { |
|
5602 |
var f_content = this.value; |
|
5603 |
var fileext = f_content.substring(f_content.lastIndexOf("."), f_content.length); |
|
5604 |
fileext = fileext.toLowerCase() |
|
5605 |
if (fileext != '.xls') { |
|
5606 |
} else { |
|
5607 |
//改变 |
|
5608 |
var dataObj = { "formID": formID, "tenantID": tenant.tenantID, "userName": userName.userName, "rowNum": aba } |
|
5609 |
//结束 |
|
5610 |
|
|
5611 |
var options = { |
13ec33
|
5612 |
url: url, //上传文件的路径 |
4d1219
|
5613 |
type: 'post', |
B |
5614 |
dataObj: dataObj, |
|
5615 |
async: false, |
|
5616 |
success: function (data) {//异步上传成功之后的操作 |
|
5617 |
if (data != undefined && data != null) { |
|
5618 |
console.log("返回参数"); |
|
5619 |
} |
|
5620 |
|
|
5621 |
} |
|
5622 |
}; |
|
5623 |
|
|
5624 |
var requestData = window.SonfiledUpload(dataObj, options, "/excel/impSonExcel", $(this).attr("itemId"), fileext); |
|
5625 |
var excels = JSON.parse(requestData); |
|
5626 |
console.log(requestData); |
|
5627 |
// console.log("最后"); |
13ec33
|
5628 |
// |
4d1219
|
5629 |
// console.log($(this).attr("itemId")) |
B |
5630 |
//改变 |
|
5631 |
$(mthis).val(""); |
|
5632 |
if (excels.data != undefined) { |
|
5633 |
customShow.addRow($(this).attr("itemId"), excels.data); |
|
5634 |
toastr.info("导入成功"); |
|
5635 |
|
|
5636 |
} else { |
|
5637 |
toastr.error("表格数据格式有误!"); |
|
5638 |
} |
|
5639 |
//结束 |
|
5640 |
//清除后台返回结果 |
|
5641 |
window.localStorage.removeItem("seccData"); |
|
5642 |
|
|
5643 |
} |
|
5644 |
} |
|
5645 |
}) |
|
5646 |
}); |
|
5647 |
//文本文件上传 |
|
5648 |
var uploaderFile = $(".customViewUEditorCss .uploaderFile"); |
|
5649 |
console.log(uploaderFile) |
|
5650 |
for (var i = 0; i < uploaderFile.length; i++) { |
|
5651 |
|
|
5652 |
var imageItem = customShow.options.customItemShow.item[uploaderFile[i].id]; |
|
5653 |
debugger |
|
5654 |
var itemList = customBase.options.uploaderItemReady[uploaderFile[i].id]; |
|
5655 |
// 参数设定 |
|
5656 |
var potion = { |
|
5657 |
id: uploaderFile[i].id, |
|
5658 |
width: imageItem.tag_Attribute.width, |
|
5659 |
height: imageItem.tag_Attribute.height, |
|
5660 |
formid: customShow.options.formid, |
|
5661 |
imagetype: imageItem.tag_Attribute.dropdowntype, //图片类型 |
|
5662 |
editable: imageItem.tag_Attribute.editable, //是否可编辑 |
|
5663 |
defaultvalueUrl: imageItem.tag_Attribute.defaultvalue, //默认的Url |
|
5664 |
ItemReady: itemList, |
|
5665 |
visible:imageItem.tag_Attribute.visible |
|
5666 |
} |
|
5667 |
customBase.uploaderFileShow(potion); |
|
5668 |
// customBase.uploaderShow_Temp("#"+uploaderFile[i].id,{width:0,height:200},false,customShow.options.formid); |
|
5669 |
|
|
5670 |
}; |
|
5671 |
|
|
5672 |
//必须入力验证 |
|
5673 |
// var mustcheckCss = $(".mustcheckCss");//-----------todo |
|
5674 |
// for (var i = 0; i < mustcheckCss.length; i++) { |
|
5675 |
// ////////////////console.log('#'+$(mustcheckCss)[i].id); |
|
5676 |
// }; |
|
5677 |
|
|
5678 |
//子表单默认删除项目去掉 |
|
5679 |
//子表单第一行可删除 |
|
5680 |
// $(".iconfontcolor").addClass("cfg_contentNone"); |
|
5681 |
// $(".iconfontcolorTH").addClass("cfg_contentNone"); |
|
5682 |
|
|
5683 |
//金融控件点击事件 |
|
5684 |
$('.amountShowClass').unbind(); |
|
5685 |
$('.amountShowClass').on('click', function () { |
|
5686 |
var editable = $(this)[0].getAttribute("editable"); |
|
5687 |
//编辑设定 |
|
5688 |
if (editable == "false") { |
|
5689 |
return; |
|
5690 |
} |
|
5691 |
|
|
5692 |
|
|
5693 |
$(this).addClass("cfg_contentNone"); |
|
5694 |
$("#" + $(this)[0].id + "amount").removeClass("cfg_contentNone"); |
|
5695 |
$("#" + $(this)[0].id + "amount").focus(); |
|
5696 |
}); |
|
5697 |
|
|
5698 |
//金融控件点击事件 |
|
5699 |
$('.amountShowTextClass').unbind(); |
|
5700 |
$('.amountShowTextClass').on('blur', function () { |
|
5701 |
var id = $(this)[0].id; |
|
5702 |
//表示的控件ID取得 |
|
5703 |
var idTemp = id.replace("amount", ""); |
|
5704 |
|
|
5705 |
var showCustomItem = customShow.options.customItemShow.item[idTemp]; |
|
5706 |
// var widthqrcode = $("#"+idTemp)[0].width; |
|
5707 |
// var heightqrcode = $("#"+idTemp)[0].height; |
|
5708 |
var widthqrcode = showCustomItem.tag_Attribute.width; |
|
5709 |
var heightqrcode = showCustomItem.tag_Attribute.height; |
|
5710 |
if (heightqrcode == 0 || heightqrcode == undefined) { |
|
5711 |
heightqrcode = 24; |
|
5712 |
} |
|
5713 |
if (widthqrcode == 0 || widthqrcode == undefined) { |
|
5714 |
widthqrcode = 200; |
|
5715 |
} |
|
5716 |
|
|
5717 |
//金额组件 |
|
5718 |
//默认数值 |
|
5719 |
var defaultSize = { |
|
5720 |
width: widthqrcode, |
|
5721 |
height: heightqrcode, |
|
5722 |
defaultvalue: "", |
|
5723 |
styleclass: "" |
|
5724 |
}; |
|
5725 |
|
|
5726 |
var decimalplace = $(this)[0].getAttribute("decimalplace"); |
|
5727 |
decimalplace = parseInt(decimalplace); |
|
5728 |
if ($(this)[0].value != "") { |
|
5729 |
$(this)[0].value = Number($(this)[0].value).toFixed(decimalplace); |
|
5730 |
} |
|
5731 |
|
|
5732 |
|
|
5733 |
defaultSize.defaultvalue = $(this)[0].value.replace(".", ""); |
|
5734 |
|
|
5735 |
var showItem = customBase.getAmountHtml(defaultSize, true); |
|
5736 |
customBase.amount2Image(showItem, "amount", defaultSize, function (amountHtml) { |
|
5737 |
// ////////////////console.log(idTemp); |
|
5738 |
$("#" + idTemp + "amount").addClass("cfg_contentNone"); |
|
5739 |
for (var i = 0; i < $("." + idTemp + "value").length; i++) { |
|
5740 |
$("." + idTemp + "value")[i].setAttribute("src", amountHtml); |
|
5741 |
}; |
|
5742 |
$("#" + idTemp).removeClass("cfg_contentNone"); |
|
5743 |
}) |
|
5744 |
}); |
|
5745 |
var addVal = []; |
|
5746 |
|
|
5747 |
//申请单控件点击事件 |
|
5748 |
$('.chooseMenu').unbind(); |
|
5749 |
$(".mytext_icon").on("click", function () { |
|
5750 |
$(this).closest("[type='mytext']").find('.boxBtn').click(); |
|
5751 |
console.log(customShow.options); |
|
5752 |
console.log(customBase.options); |
|
5753 |
}) |
|
5754 |
$('.boxBtn').on('click', (obj) => { |
|
5755 |
console.log(customBase.options) |
|
5756 |
addVal = []; |
|
5757 |
//取得父页面变量 |
|
5758 |
var outWindowObj = window.parent; |
|
5759 |
var $iconId = $(obj)[0].target.getAttribute("myAttr"); |
|
5760 |
var iconAttr = customShow.options.customItemShow.item[$iconId]; |
|
5761 |
console.log(iconAttr); |
|
5762 |
if ($("#" + $iconId).attr("formhuixian") != undefined) { |
|
5763 |
var formhuixian = JSON.parse($("#" + $iconId).attr("formhuixian")); |
|
5764 |
} |
|
5765 |
//console.log(formhuixian); |
|
5766 |
let head = ""; |
|
5767 |
if ($(obj)[0].target.previousSibling.getAttribute("chooseForm") != "" || iconAttr.tag_Attribute.relevancesourcetype == "fundata") { |
|
5768 |
console.log(attrData); |
|
5769 |
if (iconAttr.tag_Attribute.relevancesourcetype == "fundata") {//函数分支修改 李伟民 12-05 |
|
5770 |
var titleObj = { "key": JSON.parse(iconAttr.tag_Attribute.fundata)['key'] }; |
|
5771 |
var requestTitle = window.commonAjax("/datamanagement/getAssociateTitle", titleObj, "POST", true, false); |
|
5772 |
requestTitle.done(function (res) { |
|
5773 |
var formtitle = []; |
|
5774 |
_.each(res.data, function (tdata) { |
|
5775 |
formtitle.push({ "fieldKey": tdata.fieldKey, "title": tdata.title }); |
|
5776 |
}); |
|
5777 |
head = formtitle; |
|
5778 |
}); |
|
5779 |
var attrData = undefined; |
|
5780 |
} else { |
|
5781 |
var attrData = JSON.parse($(obj)[0].target.previousSibling.getAttribute("chooseForm")); |
|
5782 |
head = attrData.huixianObj.chooseData; |
|
5783 |
}//函数分支修改 李伟民 12-05 |
|
5784 |
// window.localStorage.setItem("bussiness", attrData.formID.bussinessSystem) //不用了? |
|
5785 |
//获取id值 |
|
5786 |
//用于验证是否已经存在div |
|
5787 |
var $divsLength = $('#' + $iconId + 'divIcons').length; |
|
5788 |
//接收table头请求 |
|
5789 |
var formId = ""; |
|
5790 |
if (attrData && attrData.ScreenCondition != undefined) { |
|
5791 |
//下拉框取值 |
|
5792 |
let getVal = attrData.ScreenCondition.child; |
|
5793 |
console.log(getVal); |
|
5794 |
_.each(getVal, opts => { |
|
5795 |
_.each(customBase.options.customItems, opt => { |
|
5796 |
if (opt.fieldKey == opts.fieldKey && opts.side == "thi") { |
|
5797 |
opts.value = ""; |
|
5798 |
if (opt.type == "dropdownlist") { |
|
5799 |
var getVals = customBase.getItemValue(opt.id, "dropdownlistText"); |
|
5800 |
console.log(getVals); |
|
5801 |
if (getVals[0][0] != undefined) { |
|
5802 |
opts.value = getVals[0]; |
|
5803 |
} else { |
|
5804 |
opts.value = ""; |
|
5805 |
} |
|
5806 |
} else if (opt.type == "tree") {//树控件 处理 李伟民 12-5 |
|
5807 |
var getVals = customBase.getItemValue(opt.id, opt.type); |
|
5808 |
console.log(getVals); |
|
5809 |
if (getVals[0][0] != undefined) { |
|
5810 |
opts.value = getVals[0]; |
|
5811 |
} else { |
|
5812 |
opts.value = ""; |
|
5813 |
} |
|
5814 |
} else {//树控件 处理 李伟民 12-5 |
|
5815 |
var getVals = customBase.getItemValue(opt.id, opt.type); |
|
5816 |
console.log(getVals); |
|
5817 |
if (getVals != undefined) { |
|
5818 |
opts.value = getVals; |
|
5819 |
} else { |
|
5820 |
opts.value = ""; |
|
5821 |
} |
|
5822 |
} |
|
5823 |
} |
|
5824 |
}) |
|
5825 |
}); |
|
5826 |
var sCondition = {}; |
|
5827 |
//请求数据 筛选条件参数 |
|
5828 |
let getValue = {}; |
|
5829 |
getValue.child = getVal; |
|
5830 |
getValue.count = attrData.ScreenCondition.count; |
|
5831 |
sCondition = getValue; |
|
5832 |
let shaixuanData = attrData.ScreenCondition.child; |
|
5833 |
} |
|
5834 |
if ((attrData && attrData.huixianObj != undefined) || iconAttr.tag_Attribute.relevancesourcetype == "fundata") { |
|
5835 |
if (iconAttr.tag_Attribute.relevancesourcetype == "fundata") { |
|
5836 |
formId = undefined; |
|
5837 |
} else { |
|
5838 |
formId = attrData.formID; |
|
5839 |
} |
|
5840 |
if ($divsLength == 0) { |
|
5841 |
//外层蒙版 |
|
5842 |
console.log(customShow.options.customItemShow.item) |
|
5843 |
console.log($iconId) |
|
5844 |
var my_text_title = customShow.options.customItemShow.item[$iconId].tag_Attribute.title; |
|
5845 |
|
|
5846 |
var menuContent = document.createElement('div'); |
|
5847 |
//数据渲染div |
|
5848 |
var divIcons = document.createElement('div'); |
|
5849 |
var pageBox = document.createElement('div'); |
|
5850 |
var buttonDiv = document.createElement("div"); |
|
5851 |
var closeBtn = document.createElement("span"); |
|
5852 |
var requersTable = document.createElement("table"); |
|
5853 |
var page = document.createElement("div"); |
|
5854 |
var bigmodule = document.createElement("div"); |
|
5855 |
var mymodule = document.createElement("div"); |
|
5856 |
var mymodule2 = document.createElement("div"); |
|
5857 |
var modal_content = document.createElement("div"); |
|
5858 |
var mymodulebody = document.createElement("div"); |
|
5859 |
var mymoduleheader = document.createElement("div"); |
|
5860 |
var mymodulefooter = document.createElement("div"); |
|
5861 |
var myinput = document.createElement("input"); |
|
5862 |
var mybtn = document.createElement("button"); |
|
5863 |
mybtn.innerHTML = "<i class='fa fa-search'></i>"; |
|
5864 |
mybtn.setAttribute('class', 'btn btn-default'); |
|
5865 |
mybtn.setAttribute('onClick', 'showbtn()'); |
|
5866 |
mybtn.setAttribute('id', 'showserch'); |
|
5867 |
// 添加搜索 |
|
5868 |
var serchbox = document.createElement('div'); |
|
5869 |
var serchpage = document.createElement('div'); |
|
5870 |
var sersrc = document.createElement('script'); |
|
5871 |
serchpage.setAttribute('class', 'pagination'); |
|
5872 |
serchpage.setAttribute('style', 'display:none'); |
956db4
|
5873 |
sersrc.setAttribute('src', './../../formEngine/resources/js/dataManagement/findmany.js'); |
4d1219
|
5874 |
var header = '<div _ngcontent-c12="" aria-label="Close" class="close"><span _ngcontent-c12="" class="closeBtn" aria-hidden="true">×</span></div><h4 class="modal-title modal-title_box" id="myModalLabel">' + my_text_title + '</h4>'; |
B |
5875 |
var footer = '<div _ngcontent-c12="" class="btn btn-primary btn-info btn-action closeBtn">确定</div>'; |
|
5876 |
serchbox.setAttribute('class', 'fui-form hides'); |
|
5877 |
serchbox.setAttribute('id', 'findserch'); |
|
5878 |
serchbox.setAttribute('style', 'display:none !important;'); |
|
5879 |
serchbox.innerHTML = '<div class="search_item">' + |
|
5880 |
'<div class="search_column ng-scope" id="copyTemp" style="display: none;">' + |
|
5881 |
'<div class="ng-binding" style="font-size:10px;font-weight:700;"></div>' + |
|
5882 |
'<span style="display: flex;width: 100%;"></span></div>' + |
|
5883 |
|
|
5884 |
'<div class="search_column findbox ng-scope" id="copyTempNumber" style="display: none;">' + |
|
5885 |
'<div class="ng-binding" style="font-size:10px;font-weight:700;">预算截止时间</div>' + |
|
5886 |
'<span style="display: flex;position:relative;width:45%;"><input id = "numberFrom" class="" type="number"/></span>' + |
|
5887 |
'<span> ~ </span>' + |
|
5888 |
'<span style="display: flex;position:relative; width:45%;"><input id = "numberTo" class="" type="number"/></span></div>' + |
|
5889 |
'<div class="search_column ng-scope" id="copyTempTime" style="display: none;">' + |
|
5890 |
'<div class="ng-binding" style="font-size:10px;font-weight:700;"> 预算截止时间</div>' + |
|
5891 |
'<span style="display: flex; position: relative;width:45%;">' + |
|
5892 |
'<input id = "dateFrom" class="" type="text"/><i name = "clearFlatPickr" style="position:absolute;padding-left:3px;font-size:16px;top:6px;right:5px;" class="fa fa-calendar" aria-hidden="true"></i>' + |
|
5893 |
'</span><span> ~ </span><span style="display: flex;position:relative;width:45%;">' + |
|
5894 |
'<input id = "dateTo" class="" type="text"/><i name = "clearFlatPickr" style="position:absolute;padding-left:3px;font-size:16px;top:6px;right:5px;" class="fa fa-calendar" aria-hidden="true"></i>' + |
|
5895 |
'</span></div><div class="search_column_button search_column_button_box">' + |
|
5896 |
'<span><button class="btn btn-info btn-action" id="search_condition"><i class="fa fa-search" aria-hidden="true"></i> 查询</button></span>' + |
|
5897 |
'</div></div>' + |
|
5898 |
'<div class="condition_search_footer" style="display:none">' + |
|
5899 |
'<label class="first">' + |
|
5900 |
'<span><select class="ng-pristine ng-untouched ng-valid ng-not-empty" id="pageSelect">' + |
|
5901 |
'<option value="20" selected="selected">20条/页</option>' |
|
5902 |
'<option value="50"> 50条/页</option><option value="100">100条/页</option>' + |
|
5903 |
'</select></span><span class="ng-binding">共<span id = "showTotalPageLeft"></span>页</span></label>' + |
|
5904 |
'<label class="second"> <div class="pagination">' + |
|
5905 |
'<span class="skip first">首页</span><span class="skip pre">上一页</span>' + |
|
5906 |
'<div class="nums"></div><span class="skip next">下一页</span>' + |
|
5907 |
'<span class="skip last">尾页</span></div></label></div>'; |
|
5908 |
mymoduleheader.innerHTML = header; |
|
5909 |
mymodulefooter.innerHTML = footer; |
|
5910 |
mymodule.setAttribute('style', 'width:750px;height: 448px;margin:0 auto;'); |
|
5911 |
menuContent.setAttribute('id', $iconId + 'menuContent'); |
|
5912 |
menuContent.setAttribute('class', 'menuContent'); |
|
5913 |
bigmodule.setAttribute('class', 'bigmodule'); |
|
5914 |
mymodule.setAttribute('class', 'mymodule'); |
|
5915 |
mymodule2.setAttribute('class', 'mymodule2 mymodule2_box'); |
|
5916 |
modal_content.setAttribute('class', 'modal-content modal_content_box'); |
|
5917 |
mymodulebody.setAttribute('class', 'mymodulebody'); |
|
5918 |
$(mymodulebody).css({ "height": "485px", "overflow-y": "auto" }); |
|
5919 |
mymoduleheader.setAttribute('class', 'mymoduleheader'); |
|
5920 |
mymodulefooter.setAttribute('class', 'mymodulefooter'); |
|
5921 |
myinput.setAttribute('class', 'myipt'); |
|
5922 |
divIcons.setAttribute('class', 'mytext'); |
|
5923 |
divIcons.setAttribute('id', $iconId + 'divIcons'); |
|
5924 |
page.setAttribute('id', $iconId + 'pageF'); |
|
5925 |
page.setAttribute('class', 'pageF'); |
|
5926 |
pageBox.setAttribute('id', $iconId + 'pageBox'); |
|
5927 |
pageBox.setAttribute('class', 'pageBox'); |
|
5928 |
buttonDiv.setAttribute("class", "buttonDiv"); |
|
5929 |
requersTable.setAttribute("class", "requestMenu"); |
|
5930 |
$('#' + $iconId + 'ActiveId').append(menuContent); |
|
5931 |
$('#' + $iconId + 'menuContent').append(bigmodule); |
|
5932 |
bigmodule.appendChild(mymodule); |
|
5933 |
mymodule.appendChild(mymodule2); |
|
5934 |
mymodule2.appendChild(modal_content); |
|
5935 |
modal_content.appendChild(mymodulebody); |
|
5936 |
mymodulebody.appendChild(mymoduleheader); |
|
5937 |
mymodulebody.appendChild(serchpage); |
|
5938 |
mymodulebody.appendChild(mybtn); |
|
5939 |
mymodulebody.appendChild(serchbox); |
|
5940 |
mymodulebody.appendChild(divIcons); |
|
5941 |
mymodulebody.appendChild(mymodulefooter); |
|
5942 |
mymodulebody.appendChild(myinput); |
|
5943 |
pageBox.appendChild(page); |
|
5944 |
// $('.mytext').append(sersrc); |
|
5945 |
// $('.mytext').append(buttonDiv); |
|
5946 |
$('#' + $iconId + 'divIcons').append(requersTable); |
|
5947 |
$('#' + $iconId + 'divIcons').append(pageBox); |
|
5948 |
var lastPage = ""; |
|
5949 |
customBase.findmay = { |
|
5950 |
"formId": formId, |
|
5951 |
"sCondition": sCondition, |
|
5952 |
"formhuixian": formhuixian, |
|
5953 |
"head": head, |
|
5954 |
"iconId": $iconId, |
|
5955 |
"addVal": addVal |
|
5956 |
} |
|
5957 |
var count = fenye("5", "1", formId, sCondition, formhuixian, head, $iconId, addVal, []); |
|
5958 |
|
|
5959 |
lastPage = Math.ceil(count / 5); |
|
5960 |
//console.log($(".pageF")) |
|
5961 |
$(".pageF").paging({ |
|
5962 |
pageNo: 1, |
|
5963 |
totalPage: lastPage, |
|
5964 |
totalSize: count, |
|
5965 |
callback: function (num) { |
|
5966 |
console.log(num); |
|
5967 |
fenye("5", num, formId, sCondition, formhuixian, head, $iconId, addVal, []); |
|
5968 |
} |
|
5969 |
}); |
|
5970 |
} |
|
5971 |
//如果存在就移除 |
|
5972 |
} else { |
|
5973 |
$('#' + $iconId + 'menuContent').remove(); |
|
5974 |
} |
|
5975 |
} else { |
|
5976 |
alert('未选择表单') |
|
5977 |
} |
|
5978 |
// 调用查询方法10/18 |
|
5979 |
findserch(); |
|
5980 |
}); |
|
5981 |
//条形码点击事件 |
|
5982 |
$('.barcodeShowClass').unbind(); |
|
5983 |
$('.barcodeShowClass').on('click', function () { |
|
5984 |
var editable = $(this)[0].getAttribute("editable"); |
|
5985 |
//编辑设定 |
|
5986 |
if (editable == "false") { |
|
5987 |
return; |
|
5988 |
} |
|
5989 |
|
|
5990 |
$(this).addClass("cfg_contentNone"); |
|
5991 |
$("#" + $(this)[0].id + "barcode").removeClass("cfg_contentNone"); |
|
5992 |
$("#" + $(this)[0].id + "barcode").focus(); |
|
5993 |
}); |
|
5994 |
//条形码焦点离开事件 |
|
5995 |
$('.barcodeShowTextClass').unbind(); |
|
5996 |
$('.barcodeShowTextClass').on('blur', function () { |
|
5997 |
var id = $(this)[0].id; |
|
5998 |
//表示的控件ID取得 |
|
5999 |
var idTemp = id.replace("barcode", ""); |
|
6000 |
// //默认数值 |
|
6001 |
// var defaultSize = { |
|
6002 |
// width:$("#"+idTemp)[0].width, |
|
6003 |
// height:$("#"+idTemp)[0].height, |
|
6004 |
// defaultvalue:"", |
|
6005 |
// styleclass:"" |
|
6006 |
// }; |
|
6007 |
// var size = $("#"+idTemp)[0].getAttribute("size"); |
|
6008 |
var showCustomItem = customShow.options.customItemShow.item[idTemp]; |
|
6009 |
// var size = $("#"+idTemp)[0].getAttribute("size"); |
|
6010 |
var size = showCustomItem.tag_Attribute.size; |
|
6011 |
// defaultSize.defaultvalue = $(this)[0].value; |
|
6012 |
customBase.createbarcode(size, $(this)[0].value, function (text, barWidth, barHeight, sizeWidthHeight) { |
|
6013 |
$("#canvasbarcode").remove(); |
|
6014 |
$(document.body).append('<div id="canvasbarcode" style="display: none;"></div>'); |
|
6015 |
// //设值 距离左侧距离 margin-left: -2px; |
|
6016 |
// if(barWidth == 1){ |
|
6017 |
// $("."+idTemp+"value").addClass("barcodeMarginleft1"); |
|
6018 |
// }else if(barWidth == 2){ |
|
6019 |
|
|
6020 |
// }else if(barWidth == 3){ |
|
6021 |
|
|
6022 |
// }else if(barWidth == 4){ |
|
6023 |
|
|
6024 |
// }else if(barWidth == 5){ |
|
6025 |
|
|
6026 |
// }else if(barWidth == 6){ |
|
6027 |
|
|
6028 |
// } |
|
6029 |
// $("."+idTemp+"value").addClass("barcodeMarginleft"+barWidth); |
|
6030 |
|
|
6031 |
jQuery('#canvasbarcode').barcode(text, "code128", { barWidth: barWidth, barHeight: barHeight, showHRI: true }); |
|
6032 |
var canvasbarcode = $("#canvasbarcode")[0].innerHTML; |
|
6033 |
sizeWidthHeight.width = $("#canvasbarcode")[0].style.width; |
|
6034 |
|
|
6035 |
customBase.amount2Image(canvasbarcode, "barcode", sizeWidthHeight, function (amountHtml) { |
|
6036 |
$("#" + idTemp + "barcode").addClass("cfg_contentNone"); |
|
6037 |
for (var i = 0; i < $("." + idTemp + "value").length; i++) { |
|
6038 |
$("." + idTemp + "value")[i].setAttribute("src", amountHtml); |
|
6039 |
}; |
|
6040 |
$("#" + idTemp).removeClass("cfg_contentNone"); |
|
6041 |
}); |
|
6042 |
}); |
|
6043 |
}); |
|
6044 |
//二维码点击事件 |
|
6045 |
$('.qrcodeShowClass').unbind(); |
|
6046 |
$('.qrcodeShowClass').on('click', function () { |
|
6047 |
var editable = $(this)[0].getAttribute("editable"); |
|
6048 |
//编辑设定 |
|
6049 |
if (editable == "false") { |
|
6050 |
return; |
|
6051 |
} |
|
6052 |
|
|
6053 |
$(this).addClass("cfg_contentNone"); |
|
6054 |
$("#" + $(this)[0].id + "qrcode").removeClass("cfg_contentNone"); |
|
6055 |
$("#" + $(this)[0].id + "qrcode").focus(); |
|
6056 |
}); |
|
6057 |
|
|
6058 |
//二维码焦点离开事件 |
|
6059 |
$('.qrcodeShowTextClass').unbind(); |
|
6060 |
$('.qrcodeShowTextClass').on('blur', function () { |
|
6061 |
var id = $(this)[0].id; |
|
6062 |
//表示的控件ID取得 |
|
6063 |
var idTemp = id.replace("qrcode", ""); |
|
6064 |
var showCustomItem = customShow.options.customItemShow.item[idTemp]; |
|
6065 |
// var widthqrcode = $("#"+idTemp)[0].width; |
|
6066 |
// var heightqrcode = $("#"+idTemp)[0].height; |
|
6067 |
var widthqrcode = showCustomItem.tag_Attribute.width; |
|
6068 |
var heightqrcode = showCustomItem.tag_Attribute.height; |
|
6069 |
if (heightqrcode == 0 || heightqrcode == undefined) { |
|
6070 |
heightqrcode = 60; |
|
6071 |
} |
|
6072 |
if (widthqrcode == 0 || widthqrcode == undefined) { |
|
6073 |
widthqrcode = 60; |
|
6074 |
} |
|
6075 |
//默认数值 |
|
6076 |
var defaultSize = { |
|
6077 |
width: widthqrcode, |
|
6078 |
height: heightqrcode, |
|
6079 |
defaultvalue: "", |
|
6080 |
styleclass: "" |
|
6081 |
}; |
|
6082 |
// var size = $("#"+idTemp)[0].getAttribute("size"); |
|
6083 |
|
|
6084 |
defaultSize.defaultvalue = $(this)[0].value; |
|
6085 |
$("#canvasqrcode").remove(); |
|
6086 |
$(document.body).append('<div id="canvasqrcode" style="display: none;"></div>'); |
|
6087 |
jQuery('#canvasqrcode').qrcode({ width: defaultSize.width, height: defaultSize.height, text: $(this)[0].value }); |
|
6088 |
var mycanvas = $("#canvasqrcode").find("canvas")[0]; |
|
6089 |
var image = mycanvas.toDataURL("image/png"); |
|
6090 |
$("#" + idTemp + "qrcode").addClass("cfg_contentNone"); |
|
6091 |
for (var i = 0; i < $("." + idTemp + "value").length; i++) { |
|
6092 |
$("." + idTemp + "value")[i].setAttribute("src", image); |
|
6093 |
}; |
|
6094 |
|
|
6095 |
$("#" + idTemp).removeClass("cfg_contentNone"); |
|
6096 |
}); |
|
6097 |
} |
|
6098 |
// 禁用树的父节点 12/9 |
|
6099 |
customShow.setTree = { |
|
6100 |
disableParentNode: { |
|
6101 |
set: function (treeObj) { |
|
6102 |
if (treeObj) { |
|
6103 |
var nodes = treeObj.getNodes(); |
|
6104 |
var level = 0; |
|
6105 |
// 获取最底层的层数 |
|
6106 |
treeObj.getNodesByFilter(function (node) { |
|
6107 |
if (level < node.level) { |
|
6108 |
level = node.level; |
|
6109 |
} |
|
6110 |
}); // 查找不是最底层的节点集合 |
|
6111 |
var nodesFilter = treeObj.getNodesByFilter(function (node) { |
|
6112 |
return (node.level != level) |
|
6113 |
}); |
|
6114 |
//父节点禁止勾选 |
|
6115 |
for (var i = 0; i < nodesFilter.length; i++) { |
|
6116 |
treeObj.setChkDisabled(nodesFilter[i], true); |
|
6117 |
} |
|
6118 |
} |
|
6119 |
} |
|
6120 |
} |
|
6121 |
} |
|
6122 |
|
|
6123 |
customShow.addtree = function (itemId, item) { |
|
6124 |
console.log(customBase.settingRadioType) |
|
6125 |
//修改克隆树的实例化 马习同2017-11-21 |
|
6126 |
console.log(customShow.options.customItemShow.item) |
|
6127 |
var customItem = customShow.options.customItemShow.item; |
|
6128 |
var ztree = {}; |
|
6129 |
for (let key in customItem) { |
|
6130 |
if (customItem[key].tag_Type == "tree") { |
|
6131 |
ztree[key] = customItem[key]; |
|
6132 |
} |
|
6133 |
} |
|
6134 |
$('.zTreeDemoBackground').css("display", "none"); |
|
6135 |
$(".search_input").css("display", "none"); |
|
6136 |
var index = 0; |
|
6137 |
var treeObj; |
|
6138 |
// var disableparentnode = false; |
|
6139 |
for (let key in ztree) { |
|
6140 |
if ($(item).find("#" + key).find('.ztree').parent().attr('disableparentnode') == "true") { |
|
6141 |
$(item).find("#" + key).find('.ztree').attr("id", key + "tree" + index_i);//修改克隆树的id 马习同2017-11-21 |
|
6142 |
if (ztree[key].tag_Attribute.dropdowntype == "single") { |
|
6143 |
$.fn.zTree.init($($(".customViewUEditorCss #" + key + "tree" + index_i)), customBase.settingRadioType, customShow.listData[key]); |
|
6144 |
// 12/2 树展开 |
|
6145 |
treeObj = $.fn.zTree.getZTreeObj(key + "tree" + index_i); |
|
6146 |
customShow.setTree.disableParentNode.set(treeObj) |
|
6147 |
if (treeObj) { |
|
6148 |
treeObj.expandAll(true); |
|
6149 |
} |
|
6150 |
} else if (ztree[key].tag_Attribute.dropdowntype == "multiple") { |
|
6151 |
$.fn.zTree.init($($(".customViewUEditorCss #" + key + "tree" + index_i)), customBase.settingChkboxType, customShow.listData[key]); |
|
6152 |
treeObj = $.fn.zTree.getZTreeObj(key + "tree" + index_i); |
|
6153 |
customShow.setTree.disableParentNode.set(treeObj) |
|
6154 |
if (treeObj) { |
|
6155 |
treeObj.expandAll(true); |
|
6156 |
} |
|
6157 |
} |
|
6158 |
} else { |
|
6159 |
$(item).find("#" + key).find('.ztree').attr("id", key + "tree" + index_i);//修改克隆树的id 马习同2017-11-21 |
|
6160 |
if (ztree[key].tag_Attribute.dropdowntype == "single") { |
|
6161 |
$.fn.zTree.init($($(".customViewUEditorCss #" + key + "tree" + index_i)), customBase.settingRadioType, customShow.listData[key]); |
|
6162 |
// 12/2 树展开 |
|
6163 |
treeObj = $.fn.zTree.getZTreeObj(key + "tree" + index_i); |
|
6164 |
console.log(treeObj) |
|
6165 |
if (treeObj) { |
|
6166 |
treeObj.expandAll(true); |
|
6167 |
} |
|
6168 |
} else if (ztree[key].tag_Attribute.dropdowntype == "multiple") { |
|
6169 |
$.fn.zTree.init($($(".customViewUEditorCss #" + key + "tree" + index_i)), customBase.settingChkboxType, customShow.listData[key]); |
|
6170 |
treeObj = $.fn.zTree.getZTreeObj(key + "tree" + index_i); |
|
6171 |
console.log(treeObj) |
|
6172 |
if (treeObj) { |
|
6173 |
treeObj.expandAll(true); |
|
6174 |
} |
|
6175 |
} |
|
6176 |
} |
|
6177 |
// 克隆后选中节点 12/7 李元杰 |
|
6178 |
if (!_.isNull(treeObj)) { |
|
6179 |
var treeId = treeObj['setting'].treeId; |
|
6180 |
var defaultValue = $('#' + treeId).parent().attr('defaultvalue'); |
|
6181 |
// // 12/7 默认值 |
|
6182 |
if (defaultValue != '') { |
|
6183 |
console.log(treeObj) |
|
6184 |
customShow.treeDefaultSet(treeObj, defaultValue); |
|
6185 |
} |
|
6186 |
} |
|
6187 |
|
|
6188 |
} |
|
6189 |
console.log(treeObj) |
|
6190 |
console.log($(item)) |
|
6191 |
//修改克隆树的实例化End 马习同2017-11-21 |
|
6192 |
index_i++; |
|
6193 |
|
|
6194 |
} |
|
6195 |
|
|
6196 |
//子表单项目追加 |
|
6197 |
customShow.addsubformList = function (subformAdd, showClass) { |
|
6198 |
console.log(i) |
|
6199 |
var allcopy = subformAdd.getAttribute('allcopy'); |
|
6200 |
var itemId = subformAdd.getAttribute('itemId'); |
|
6201 |
//单行记录更新 |
|
6202 |
if (allcopy == "false") { |
|
6203 |
console.log(customBase.options.customItems); |
|
6204 |
console.log(customBase.options.customItems[customShow.options.customItemShow.item[itemId].tag_Attribute.alias].cloneDiv); |
|
6205 |
var item = customBase.options.customItems[customShow.options.customItemShow.item[itemId].tag_Attribute.alias].cloneDiv; |
|
6206 |
// 子表单隐藏 马习同 11-13 |
|
6207 |
// var item =$("."+showClass+" #"+itemId+"save").children()[0]; |
|
6208 |
//子表单情况为U情况 |
|
6209 |
if (item == undefined) {// 子表单回显 修改 李伟民 11-10 |
|
6210 |
var tbody = $("." + showClass + " #" + itemId + "ActiveId").find("tbody"); |
|
6211 |
tbody = tbody[0].cloneNode(true); |
|
6212 |
console.log(tbody) |
|
6213 |
// 清空input 12/7 |
|
6214 |
console.log($(item)) |
|
6215 |
if ($(item).find('.zTreeDemoBackground').attr('defaultvalue') == '') { |
|
6216 |
$(item).find(".citySel").val(''); |
|
6217 |
} |
|
6218 |
$(tbody).find(".select2").remove(); |
|
6219 |
console.log($(tbody).html()); |
|
6220 |
$(tbody).find(".tdTitleClass").closest("tr").addClass("table_title"); |
|
6221 |
$(tbody).find(".dropdowntypeCss").select2({ theme: "classic" }); |
|
6222 |
// $(tbody).find(".zTreeDemoBackground").select2({theme: "classic"}); |
|
6223 |
if ($(tbody).find(".table_title").length > 0) { |
|
6224 |
//删除头行 |
|
6225 |
$(tbody).find(".table_title").remove(); |
|
6226 |
} |
|
6227 |
if ($(tbody).find(".trContentClass").length > 1) {// 去除重复的tr 李伟民 11-14 |
|
6228 |
$($(tbody).find(".trContentClass")[0]).siblings().remove(); |
|
6229 |
}// 去除重复的tr 李伟民 11-14 |
|
6230 |
// $(tbody).find(".cfg_contentNone").removeClass("cfg_contentNone"); |
|
6231 |
tbody = customShow.addsubformListInit(itemId, $(tbody).find("tr")); |
|
6232 |
console.log(tbody); |
|
6233 |
console.log(itemId); |
|
6234 |
console.log($(tbody).find("#" + itemId).attr("class")); |
|
6235 |
$(tbody).find("input").attr("funarr", "");//公式绑定 清空 李伟民 12-11 |
|
6236 |
$(tbody).find("input").attr("checkfunarr", ""); |
|
6237 |
$(tbody).find(".select_get").attr("funarr", ""); |
|
6238 |
$(tbody).find(".select_get").attr("checkfunarr", "");//公式绑定 清空 李伟民 12-11 |
|
6239 |
$($("." + showClass + " #" + itemId + "ActiveId").find("table")[0]).append(tbody);// 子表单回显 修改 李伟民 11-10 |
|
6240 |
customShow.hidesubform(); |
|
6241 |
customShow.setXhSelectList(false);//添加记录 重复问题 李伟民11-14 |
|
6242 |
} else { |
|
6243 |
item = item[0].cloneNode(true); |
|
6244 |
// 12/7 清空input |
|
6245 |
var defaultvalue = $(item).find('.zTreeDemoBackground').attr('defaultvalue'); |
|
6246 |
var itemIdTree = $(item).find('.ztree').attr('id'); |
|
6247 |
var treeObj = $.fn.zTree.getZTreeObj(itemIdTree); |
|
6248 |
console.log(treeObj) |
|
6249 |
// 12/7 默认值 |
|
6250 |
if ($(item).find('.zTreeDemoBackground').attr('defaultvalue') == '') { |
|
6251 |
$(item).find(".citySel").val(''); |
|
6252 |
} |
|
6253 |
$(item).find(".select2").remove(); |
|
6254 |
$(item).find(".dropdowntypeCss").select2({ theme: "classic" }); |
|
6255 |
$(item).find(".subformAddiconShow .cfg_contentNone").removeClass("cfg_contentNone"); |
|
6256 |
item = customShow.addsubformListInit(itemId, item); |
|
6257 |
$(item).find("input").attr("funarr", "");//公式绑定 清空 李伟民 12-11 |
|
6258 |
$(item).find("input").attr("checkfunarr", ""); |
|
6259 |
$(item).find(".select_get").attr("funarr", ""); |
|
6260 |
$(item).find(".select_get").attr("checkfunarr", "");//公式绑定 清空 李伟民 12-11 |
|
6261 |
$($("." + showClass + " #" + itemId + "ActiveId").find("table")[0]).append(item); |
|
6262 |
customShow.setXhSelectList(true);//添加记录 重复问题 李伟民11-14 |
|
6263 |
} |
|
6264 |
|
|
6265 |
customShow.addtree(itemId, item); |
|
6266 |
//子表单事件追加 |
|
6267 |
} else { |
|
6268 |
//全子表单复制 |
|
6269 |
// //console.log(1); |
|
6270 |
|
|
6271 |
var item = $("." + showClass + " #" + itemId + "ActiveId")[0]; |
|
6272 |
// //console.log(item); |
|
6273 |
item = item.cloneNode(true); |
|
6274 |
//console.log(item); |
|
6275 |
var divIcons = document.createElement("div"); |
|
6276 |
divIcons.setAttribute("class", "frm_item_icons allCopyCss"); |
|
6277 |
var divIcon = document.createElement("div"); |
|
6278 |
divIcon.setAttribute("class", "frm_item_icon remove"); |
|
6279 |
var divIconImg = document.createElement("i"); |
|
6280 |
divIconImg.setAttribute("class", "icon iconfont icon-iconfontcolor93 iconfontcolor"); |
|
6281 |
divIconImg.setAttribute("style", "text-align: left;font-size: 18px;color: red;"); |
|
6282 |
// var divIconImg = document.createElement("img"); |
|
6283 |
// divIconImg.setAttribute("src", "./../../css/img/icon/delete.png"); |
|
6284 |
divIcon.appendChild(divIconImg); |
|
6285 |
divIcons.appendChild(divIcon); |
|
6286 |
// $(item).find(".icon-jiahao").parent().addClass("cfg_contentNone"); |
|
6287 |
$(item).append(divIcons); |
|
6288 |
// 清空 树的input |
|
6289 |
console.log($(item)) |
|
6290 |
if ($(item).find('.zTreeDemoBackground').attr('defaultvalue') != '') { |
|
6291 |
|
|
6292 |
} else { |
|
6293 |
$(item).find(".citySel").val(''); |
|
6294 |
} |
|
6295 |
$(item).find(".select2").remove(); |
|
6296 |
$(item).find(".dropdowntypeCss").select2({ theme: "classic" }); |
|
6297 |
//console.log(item); |
|
6298 |
item = customShow.addsubformListInit(itemId, item); |
|
6299 |
// 10/23添加子表单记录 |
|
6300 |
var beforeitem = $("." + showClass + " #" + itemId + "ActiveId"); |
|
6301 |
//console.log(beforeitem); |
|
6302 |
$(item).find("input").attr("funarr", "");//公式绑定 清空 李伟民 12-11 |
|
6303 |
$(item).find("input").attr("checkfunarr", ""); |
|
6304 |
$(item).find(".select_get").attr("funarr", ""); |
|
6305 |
$(item).find(".select_get").attr("checkfunarr", "");//公式绑定 清空 李伟民 12-11 |
|
6306 |
$("." + showClass + " #" + itemId + "ActiveId").eq(0).after(item); |
|
6307 |
// _.each(beforeitem,function(bitem){ |
|
6308 |
if (beforeitem.length > 1) { |
|
6309 |
for (var i = 0; i < beforeitem.length - 1; i++) { |
|
6310 |
$(beforeitem[i]).find(".icon-jiahao").parent().addClass("cfg_contentNone"); |
|
6311 |
} |
|
6312 |
} else { |
|
6313 |
$(beforeitem[0]).find(".icon-jiahao").parent().addClass("cfg_contentNone"); |
|
6314 |
} |
|
6315 |
customShow.setXhSelectList();//添加记录 重复问题 李伟民11-14 |
|
6316 |
// }); |
|
6317 |
customShow.addtree(itemId, item); |
|
6318 |
} |
|
6319 |
} |
|
6320 |
//马习同修改 子表单隐藏 11/13 |
|
6321 |
customShow.hidesubform = function () { |
|
6322 |
// console.log($("[tag_type='subform']")) |
|
6323 |
_.each($("[tag_type='subform']"), opt => { |
|
6324 |
console.log(opt) |
|
6325 |
$($(opt).find(".tdTitleClass")[0]).addClass("cfg_contentNone"); |
|
6326 |
$($(opt).find(".tdContentClass")[0]).addClass("cfg_contentNone"); |
|
6327 |
}) |
|
6328 |
var unvisible = customBase.options.customItems; |
|
6329 |
var unvisibleArr = []; |
|
6330 |
_.each(unvisible, opt => { |
|
6331 |
if (opt.visible == false && opt.parentsubFormNum != 0) { |
|
6332 |
unvisibleArr.push(opt) |
|
6333 |
} |
|
6334 |
}) |
|
6335 |
// _.remove(unvisibleArr,n => { |
|
6336 |
// return n.fieldKey == "DATAROWNUM"; |
|
6337 |
// }) |
|
6338 |
// console.log(unvisibleArr) |
|
6339 |
_.each(unvisibleArr, opt => { |
|
6340 |
$("[id='" + opt.id + "']").parent().parent().addClass("cfg_contentNone"); |
|
6341 |
$($(".customShow #itemId_" + opt.parentsubFormNum + " .tdTitleClass")[$("[id='" + opt.id + "']").parent().parent().index()]).addClass("cfg_contentNone"); |
|
6342 |
$($(".customViewUEditorCss #itemId_" + opt.parentsubFormNum + " .tdTitleClass")[$("[id='" + opt.id + "']").parent().parent().index()]).addClass("cfg_contentNone"); |
|
6343 |
}) |
|
6344 |
} |
|
6345 |
//子表单内数据初始化 |
|
6346 |
customShow.addsubformListInit = function (itemId, tbodys) { |
|
6347 |
//console.log(tbodys); |
|
6348 |
var itemList = customShow.options.customItemShow.item; |
|
6349 |
var item = itemList[itemId]; |
|
6350 |
var parentsubFormNum = item.columnOrderNum + ""; |
|
6351 |
|
|
6352 |
for (itemListId in itemList) { |
|
6353 |
if (itemList.hasOwnProperty(itemListId)) { |
|
6354 |
if (itemList[itemListId].parentsubFormNum == parentsubFormNum) { |
|
6355 |
//子表单内控件确认 |
|
6356 |
var type = itemList[itemListId].tag_Type; |
|
6357 |
if (type == "text" || type == "textarea" || type == "number") { |
|
6358 |
$(tbodys).find("#" + itemListId)[0].value = itemList[itemListId].tag_Attribute.defaultvalue; |
|
6359 |
} else if (type == "calendar") { |
|
6360 |
$(tbodys).find("#" + itemListId)[0].value = ""; |
|
6361 |
} else if (type == "radio") { |
|
6362 |
|
|
6363 |
} else if (type == "checkbox") { |
|
6364 |
|
|
6365 |
} else if (type == "dropdownlist") { |
|
6366 |
var itemListIdTemp = itemListId + "_" + customShow.options.dropdownlist_I; |
|
6367 |
var item = $(tbodys).find("#" + itemListId); |
|
6368 |
////////console.log($(tbodys)); |
|
6369 |
// var dropdowntype = $(item.find('select'))[0].getAttribute("dropdowntype"); |
|
6370 |
var dropdowntype = customShow.options.customItemShow.item[itemListId].tag_Attribute.dropdowntype; |
|
6371 |
if ($("#" + itemListId + " .select3-element")[0] == undefined) { |
|
6372 |
var width = $(tbodys).find("#" + itemListId)[0].style.width.replace("px", ""); |
|
6373 |
} else { |
|
6374 |
var width = $("#" + itemListId + " .select3-element")[0].style.width.replace("px", ""); |
|
6375 |
} |
|
6376 |
|
|
6377 |
width = parseInt(width); |
|
6378 |
var listData = customBase.options.dropdownlistText[itemListId]; |
|
6379 |
////////console.log(customBase.options.dropdownlistText); |
|
6380 |
// $("#"+itemId).parent().empty(); |
|
6381 |
var itemIdClass = "selectClass js-example-basic-single defaultHeight customShowItemClass dropdowntypeCss " + itemListId + "value " + itemListIdTemp; |
|
6382 |
var DropdownlistItem = item.parent(); |
|
6383 |
// DropdownlistItem.css("background-color","red"); |
|
6384 |
// var setDiv = $('<div id="'+itemListId+'" class="selectClass '+itemIdClass+'"></div>'); |
|
6385 |
var setDiv = $('<div id="' + itemListId + '" class="selectClass lwm' + itemIdClass + '"></div>'); |
|
6386 |
console.log("11122211") |
|
6387 |
DropdownlistItem.empty(); |
|
6388 |
setDiv.empty(); |
|
6389 |
console.log(itemListId); |
|
6390 |
DropdownlistItem.append(setDiv); |
|
6391 |
console.log($(DropdownlistItem).html()); |
|
6392 |
//////console.log(dropdowntype); |
|
6393 |
|
|
6394 |
if (dropdowntype == "multiple") { |
|
6395 |
customShow.options.subformDList[itemListIdTemp] = { |
|
6396 |
selectId: itemListId, |
|
6397 |
multiple: true, |
|
6398 |
width: width, |
|
6399 |
// listData:listData, |
|
6400 |
} |
|
6401 |
} else { |
|
6402 |
customShow.options.subformDList[itemListIdTemp] = { |
|
6403 |
selectId: itemListId, |
|
6404 |
multiple: false, |
|
6405 |
width: width, |
|
6406 |
// listData:listData, |
|
6407 |
} |
|
6408 |
} |
|
6409 |
// if(dropdowntype == "multiple"){ |
|
6410 |
// xhSelect.setXhSelect( |
|
6411 |
// { |
|
6412 |
// selectId:itemListId, |
|
6413 |
// multiple:true, |
|
6414 |
// width: width, |
|
6415 |
// listData:listData, |
|
6416 |
// setDiv:setDiv |
|
6417 |
// // setDiv:itemListIdTemp |
|
6418 |
// } |
|
6419 |
// ); |
|
6420 |
// }else{ |
|
6421 |
// xhSelect.setXhSelect( |
|
6422 |
// { |
|
6423 |
// selectId:itemListId, |
|
6424 |
// multiple:false, |
|
6425 |
// width: width, |
|
6426 |
// listData:listData, |
|
6427 |
// setDiv:setDiv |
|
6428 |
// // setDiv:itemListIdTemp |
|
6429 |
// } |
|
6430 |
// ); |
|
6431 |
// } |
|
6432 |
|
|
6433 |
} |
|
6434 |
} |
|
6435 |
customShow.options.dropdownlist_I++; |
|
6436 |
} |
|
6437 |
|
|
6438 |
} |
|
6439 |
//console.log(customShow); |
|
6440 |
//console.log(customBase); |
|
6441 |
|
|
6442 |
////////console.log(customShow.options.customItemShow.item); |
|
6443 |
////////console.log(itemId); |
|
6444 |
////////console.log(item); |
|
6445 |
////////console.log(parentsubFormNum); |
|
6446 |
// customShow.setXhSelectList(); |
|
6447 |
return tbodys; |
|
6448 |
} |
|
6449 |
//驳回 |
|
6450 |
customShow.rejectBtn = function () { |
|
6451 |
var flag = true;//true驳回 false不驳回 |
|
6452 |
over(flag) |
|
6453 |
} |
|
6454 |
//提交 |
|
6455 |
customShow.onclickSubmit = function () { |
|
6456 |
get(); |
|
6457 |
} |
|
6458 |
//查看票据 |
|
6459 |
customShow.checkbill = function () { |
|
6460 |
window.open("./../bill_img/bill.html") |
|
6461 |
} |
|
6462 |
//审批 |
|
6463 |
customShow.auditableBtn = function () { |
|
6464 |
auditableBtn(); |
|
6465 |
} |
|
6466 |
function auditableBtn() { |
|
6467 |
var processLog = JSON.parse(localStorage.getItem("processLog")); |
|
6468 |
if (processLog != null && processLog != undefined) { |
|
6469 |
} else { |
|
6470 |
alert("请先创建一个流程"); |
|
6471 |
return null; |
|
6472 |
} |
|
6473 |
if (processLog[0].processState == 60) { |
|
6474 |
alert("流程已结束"); |
|
6475 |
return null; |
|
6476 |
} |
|
6477 |
var inputs = "<h3 class='sp_title'>请输入审批语</h3><br/>" + "<textarea maxlength='200' onKeyUp='listenword()' class='stexta' type='test' id='datas'></textarea><span class='wordwrap'><var class='word'>0</var>/200</span><br/>" |
|
6478 |
+ "<div class='footerbtn' style='display:flex;justify-content:space-around;'><input class='btn btn-default choosebtn' type='button' value='取消' onclick='zhixing(false)'/><input class='btn btn-default choosebtn2' type='button' value='确定' onclick='zhixing(true)'/></div>"; |
|
6479 |
$("#liucheng").html(inputs); |
|
6480 |
$("#auditableBtn")[0].setAttribute('data-toggle', "modal"); |
|
6481 |
$("#auditableBtn")[0].setAttribute('data-target', ".bs-example-modal-sm"); |
|
6482 |
} |
|
6483 |
customShow.onclickSave1 = function () { |
|
6484 |
// SC.sendanydata(function(flag){ |
|
6485 |
// console.log(flag); |
|
6486 |
// if(!flag){ |
|
6487 |
// console("if") |
|
6488 |
// customShow.onclickSave(1); |
|
6489 |
// }else{ |
|
6490 |
|
|
6491 |
// alert("错误"); |
|
6492 |
// } |
|
6493 |
// }); |
|
6494 |
SC.sendanydata(customShow.onclickSave, 1) |
|
6495 |
|
|
6496 |
|
|
6497 |
} |
|
6498 |
customShow.onclickSave2 = function () { |
|
6499 |
SC.sendanydata(customShow.onclickSave, 2) |
|
6500 |
} |
|
6501 |
|
|
6502 |
//清空按钮按下是 |
|
6503 |
customShow.onclickClear = function () { |
|
6504 |
console.log(customBase); |
|
6505 |
console.log(customShow); |
|
6506 |
var itemKey = _.keys(customShow.options.customItemShow.item); |
|
6507 |
var item = customShow.options.customItemShow.item; |
|
6508 |
console.log(itemKey); |
|
6509 |
_.each(itemKey, function (itemId) { |
|
6510 |
console.log(itemId); |
|
6511 |
console.log(item[itemId].tag_Type); |
|
6512 |
customBase.setItemValue(itemId, item[itemId].tag_Type, "", ""); |
|
6513 |
}); |
|
6514 |
} |
|
6515 |
//保存按钮按下时 |
|
6516 |
customShow.onclickSave = function (clickFlag) { |
|
6517 |
console.log(clickFlag); |
|
6518 |
var saveReturn = customShow.initEvent.fromSaveLinkage(); |
|
6519 |
|
|
6520 |
//画面项目取得 --------------------------画面项目取得------ |
|
6521 |
var items = customShow.getItems(true); |
|
6522 |
console.log(items) |
|
6523 |
// customShow.queryCost(); |
|
6524 |
try { |
|
6525 |
if (typeof (eval(eachitem)) == "function") { |
|
6526 |
eachitem(items); |
|
6527 |
} |
|
6528 |
} catch (e) { |
|
6529 |
console.log("不存在的函数"); |
|
6530 |
} |
|
6531 |
|
|
6532 |
console.log("遍历数组") |
|
6533 |
console.log(items); |
|
6534 |
// 画面check |
|
6535 |
var returnfromCheck = customShow.initEvent.fromCheck(items); //-------------------- |
|
6536 |
if (returnfromCheck) { |
|
6537 |
return; |
|
6538 |
} |
|
6539 |
// 03检证执行 |
|
6540 |
var check = customShow.initEvent.validationRuleCheck(items); //-------------------- |
|
6541 |
if (!check) { |
|
6542 |
return; |
|
6543 |
} |
|
6544 |
// 检证接口函数 |
|
6545 |
var check = customShow.initEvent.validationRuleCheck3rd(items); //-----------需要对验证进行解析--------- |
|
6546 |
if (!check) { |
|
6547 |
return; |
|
6548 |
} |
|
6549 |
// 提取数据 生成数据json 同customShow.getItems() |
|
6550 |
//公式保存接口 |
|
6551 |
// var saveReturn = customShow.initEvent.fromSaveLinkage(items); |
|
6552 |
// if(!saveReturn){ |
|
6553 |
// return; |
|
6554 |
// } |
|
6555 |
// 发送数据到后台服务器,保存data |
|
6556 |
var saveReturn = customShow.initEvent.fromSave3rd(items);//-------------------- |
|
6557 |
console.log(customShow.options.customShowFlag) |
|
6558 |
if (saveReturn) { |
|
6559 |
console.log(1) |
|
6560 |
if (customShow.options.customShowFlag == "1") { |
|
6561 |
//保存 |
|
6562 |
customDataBound.fromSave(customShow.options.formid, items, function (rs) { |
|
6563 |
if (rs.rspCode == "000000") { |
|
6564 |
var strMessage = customBase.getMessage("mesage_ID015"); |
|
6565 |
customBase.alert("S", strMessage); |
|
6566 |
// return; |
|
6567 |
} |
|
6568 |
if (rs.rspCode == "100004") { |
|
6569 |
var strMessage = customBase.getMessage("mesage_ID007"); |
|
6570 |
customBase.alert("E", strMessage); |
|
6571 |
return; |
|
6572 |
} |
|
6573 |
if (customShow.options.customShowFlag == "1") { |
|
6574 |
window.parent.$('#myModal').modal('hide'); |
|
6575 |
window.parent.addFormData(rs); |
|
6576 |
$(window.parent.document.body).css({ "overflow-x": "auto", "overflow-y": "auto" }); |
|
6577 |
} |
|
6578 |
// //////console.log(rs); |
|
6579 |
}); |
|
6580 |
} else if (customShow.options.customShowFlag == "2") { |
|
6581 |
console.log(2) |
|
6582 |
//保存 |
|
6583 |
customDataBound.fromEdit(customShow.options.formid, items, customShow.options.dataRowNum, function (rs) { |
|
6584 |
if (rs.rspCode == "100004") { |
|
6585 |
var strMessage = customBase.getMessage("mesage_ID007"); |
|
6586 |
customBase.alert("E", strMessage); |
|
6587 |
return; |
|
6588 |
} |
|
6589 |
customShow.options.breakFlag = true; |
|
6590 |
//预览模式表示 |
|
6591 |
$("#customViewUEditor")[0].style.display = "none"; |
|
6592 |
//马习同 2018-1-2 布局修改 |
|
6593 |
$("#customShow")[0].style.display = "flex"; |
|
6594 |
// $(".footer")[0].style.display ="none"; |
|
6595 |
|
|
6596 |
var btns = [ |
|
6597 |
'printableBtn', |
|
6598 |
// 'exportBtn', |
|
6599 |
// 'rejectBtn', |
|
6600 |
// 'submitBtn', |
|
6601 |
// 'auditableBtn', |
|
6602 |
// 'queryBtn', |
|
6603 |
// 'createBtn', |
|
6604 |
// 'clearBtn', |
|
6605 |
// 'disposableBtn', |
|
6606 |
// 'fromSaveBtn', |
|
6607 |
'editableBtn' |
|
6608 |
]; |
|
6609 |
customShow.showCustom(items, customShow.options.customInit); |
|
6610 |
customShow.setToolBtn(btns); |
|
6611 |
console.log("关闭") |
|
6612 |
customShow.onclickCancel(); |
|
6613 |
|
|
6614 |
}); |
|
6615 |
// customShow.onclickCancel(); |
|
6616 |
} |
|
6617 |
else if (customShow.options.customShowFlag == "3") { |
|
6618 |
// 保存 |
|
6619 |
console.log(3) |
|
6620 |
if (clickFlag == 2 && customShow.options.dataRowNum != "") { |
|
6621 |
//保存 |
|
6622 |
customDataBound.fromEdit(customShow.options.formid, items, customShow.options.dataRowNum, function (rs) { |
|
6623 |
////console.log(rs); |
|
6624 |
if (rs.rspCode == "000000") { |
|
6625 |
var strMessage = customBase.getMessage("mesage_ID015"); |
|
6626 |
customBase.alert("S", strMessage); |
|
6627 |
// return; |
|
6628 |
} |
|
6629 |
if (rs.rspCode == "100004") { |
|
6630 |
var strMessage = customBase.getMessage("mesage_ID007"); |
|
6631 |
customBase.alert("E", strMessage); |
|
6632 |
return; |
|
6633 |
} |
|
6634 |
// customShow.options.breakFlag = true; |
|
6635 |
// //预览模式表示 |
|
6636 |
// $("#customViewUEditor")[0].style.display ="none"; |
|
6637 |
// $("#customShow")[0].style.display ="block"; |
|
6638 |
// // $(".footer")[0].style.display ="none"; |
|
6639 |
// customShow.showCustom(items,customShow.options.customInit); |
|
6640 |
}); |
|
6641 |
//新建 |
|
6642 |
} else { |
|
6643 |
customDataBound.fromSave(customShow.options.formid, items, function (rs) { |
|
6644 |
if (rs.rspCode == "000000") { |
|
6645 |
var strMessage = customBase.getMessage("mesage_ID015"); |
|
6646 |
customBase.alert("S", strMessage); |
|
6647 |
// return; |
|
6648 |
} |
|
6649 |
if (rs.rspCode == "100004") { |
|
6650 |
var strMessage = customBase.getMessage("mesage_ID007"); |
|
6651 |
customBase.alert("E", strMessage); |
|
6652 |
return; |
|
6653 |
} |
|
6654 |
// if(customShow.options.customShowFlag == "1" ){ |
|
6655 |
// window.parent.$('#myModal').modal('hide'); |
|
6656 |
// window.parent.addFormData(rs); |
|
6657 |
// $(window.parent.document.body).css({"overflow-x": "auto","overflow-y": "auto"}); |
|
6658 |
// } |
|
6659 |
if(customShow.options.customShowFlag != "3" ){//发布差异修改 李伟民 0120 |
|
6660 |
customShow.options.dataRowNum = rs.data.dataRowNum; |
|
6661 |
} |
|
6662 |
//////console.log(rs); |
|
6663 |
}); |
|
6664 |
} |
|
6665 |
} |
|
6666 |
} |
|
6667 |
// customShow.onclickCancel(); |
|
6668 |
// window.parent.$('#myModal').modal('hide'); |
|
6669 |
// console.log($('.boxOne')) |
|
6670 |
// $('.boxOne').css("display","none"); |
|
6671 |
} |
|
6672 |
|
|
6673 |
//保存按钮按下时(项目预览表示) |
|
6674 |
customShow.showCustom = function (items, customInit) { |
|
6675 |
console.log(items); |
|
6676 |
console.log(customInit); |
|
6677 |
customShow.options.customItemShow = customInit.customViewItem; |
|
6678 |
var customItem = customShow.options.customItemShow; |
|
6679 |
// $(".preview-edit-pane").css("display","block"); |
|
6680 |
// $(".footer")[0].style.display ="block"; |
|
6681 |
// $(".footer .fromSaveCss")[0].style.display ="none"; |
|
6682 |
|
|
6683 |
var divHtml = customItem.formeditor; |
|
6684 |
|
|
6685 |
$("#customShow").empty(); |
|
6686 |
$("#customShow")[0].innerHTML = divHtml; |
|
6687 |
var height = customShow.options.customItemShow.height; |
|
6688 |
// height = parseInt(height)-50; |
|
6689 |
//////////console.log(height); |
|
6690 |
$("#customShow")[0].style.height = height + "px"; |
|
6691 |
$("#customShow")[0].style.width = customShow.options.customItemShow.width; |
|
6692 |
$("#customShow")[0].style.display = "flex"; |
|
6693 |
var customItems = customBase.options.customItems; |
|
6694 |
|
|
6695 |
//数据值变换 |
|
6696 |
for (item in customItems) { |
|
6697 |
if (customItems.hasOwnProperty(item)) { |
|
6698 |
if (customItems[item] == undefined) { |
|
6699 |
delete customItems[item]; |
|
6700 |
continue; |
|
6701 |
} |
|
6702 |
if (customItems[item].type == 'subform') { |
|
6703 |
var subformTemp = items[item]; |
|
6704 |
//////console.log(items); |
|
6705 |
////console.log(item); |
|
6706 |
console.log(subformTemp); |
|
6707 |
// console.log(customItems); |
|
6708 |
if (subformTemp == undefined) { |
|
6709 |
subformTemp = [{}]; |
|
6710 |
} |
|
6711 |
for (subformItem in subformTemp[0]) { |
|
6712 |
if (subformTemp[0].hasOwnProperty(subformItem)) { |
|
6713 |
items[subformItem] = []; |
|
6714 |
} |
|
6715 |
} |
|
6716 |
for (var i = 0; i < subformTemp.length; i++) { |
|
6717 |
if (i != 0) { |
|
6718 |
//子表单项目追加 |
|
6719 |
var subformAdd = $(".customShow #" + customItems[item].id + "ActiveId .subformAdd")[0]; |
|
6720 |
customShow.addsubformList(subformAdd, "customShow"); |
|
6721 |
} |
|
6722 |
for (subformItem in subformTemp[i]) { |
|
6723 |
if (subformTemp[i].hasOwnProperty(subformItem)) { |
|
6724 |
items[subformItem][i] = subformTemp[i][subformItem]; |
|
6725 |
} |
|
6726 |
} |
|
6727 |
}; |
|
6728 |
} |
|
6729 |
//选项卡回显 |
|
6730 |
if (customItems[item].type == 'tag') { |
|
6731 |
var subformTemp = items[item]; |
|
6732 |
////console.log(items); |
|
6733 |
////console.log(item); |
|
6734 |
////console.log(subformTemp); |
|
6735 |
////console.log(customItems); |
|
6736 |
if (subformTemp == undefined) { |
|
6737 |
subformTemp = [{}]; |
|
6738 |
} |
|
6739 |
for (subformItem in subformTemp[0]) { |
|
6740 |
if (subformTemp[0].hasOwnProperty(subformItem)) { |
|
6741 |
items[subformItem] = []; |
|
6742 |
} |
|
6743 |
} |
|
6744 |
for (var i = 0; i < subformTemp.length; i++) { |
|
6745 |
if (i != 0) { |
|
6746 |
//子表单项目追加 |
|
6747 |
var subformAdd = $(".customShow #" + customItems[item].id + "ActiveId .subformAdd")[0]; |
|
6748 |
customShow.addsubformList(subformAdd, "customShow"); |
|
6749 |
} |
|
6750 |
for (subformItem in subformTemp[i]) { |
|
6751 |
if (subformTemp[i].hasOwnProperty(subformItem)) { |
|
6752 |
items[subformItem][i] = subformTemp[i][subformItem]; |
|
6753 |
} |
|
6754 |
} |
|
6755 |
}; |
|
6756 |
} |
|
6757 |
} |
|
6758 |
} |
|
6759 |
|
|
6760 |
customShow.options.subformDValue = items; |
|
6761 |
//表示项目进行变换 |
|
6762 |
|
|
6763 |
//画面项目初期化 |
|
6764 |
customShow.controlInit("customShow"); |
|
6765 |
|
|
6766 |
//删除项目(select2项目删除) |
|
6767 |
$('.customShow .selection').remove(); |
|
6768 |
//console.log(customItems); |
|
6769 |
//数据设定 |
|
6770 |
for (item in customItems) { |
|
6771 |
console.log(items) |
|
6772 |
if (customItems.hasOwnProperty(item)) { |
|
6773 |
if (customItems[item] == undefined) { |
|
6774 |
delete customItems[item]; |
|
6775 |
continue; |
|
6776 |
} |
|
6777 |
|
|
6778 |
var type = customItems[item].type; |
|
6779 |
var id = customItems[item].id; |
|
6780 |
var value = items[item]; |
|
6781 |
// value = [{"tId":"itemId_1tree_2"},{"name":"F066008"},{"tId":"itemId_1tree_3"},{"name":"F066003"}]; |
|
6782 |
// value = [{"name":"F066008"},{"name":"F066003"}]; |
|
6783 |
// value = [{"name":"F066008"},{"name":"F066003"}]; |
|
6784 |
|
|
6785 |
if (customItems[item].type == 'subform') { |
|
6786 |
$(".customShow").find("#" + id + "subform").find("td").addClass(""); |
|
6787 |
} else if (customItems[item].type == 'htmlediter') { |
|
6788 |
// var htmlediterShow = $(".customShow").find("#"+id)[0]; |
|
6789 |
var htmlediterShow = $(".customShow #" + id + "Item")[0]; |
|
6790 |
// var heightShow = $(htmlediterShow)[0].getAttribute("heightShow"); |
|
6791 |
// var widthShow = $(htmlediterShow)[0].getAttribute("widthShow"); |
|
6792 |
var heightShow = customShow.options.customItemShow.item[id].tag_Attribute.height; |
|
6793 |
var widthShow = customShow.options.customItemShow.item[id].tag_Attribute.width; |
|
6794 |
if (widthShow == undefined || heightShow == undefined) { |
|
6795 |
widthShow = 200; |
|
6796 |
heightShow = 200; |
|
6797 |
} |
|
6798 |
var oNode = '<div style="word-break:break-all;width:' + widthShow + 'px;height:' + |
|
6799 |
heightShow + 'px;" class="customShowItemClass edui-default customShowItemClassTemp">'; |
|
6800 |
// var oNode ='<div style="word-break:break-all;border-width: 1px;border-style: solid;border-color: rgb(204, 204, 204);class="customShowItemClass edui-default">'; |
|
6801 |
oNode += value; |
|
6802 |
oNode += "</div>"; |
|
6803 |
$($(".customShow #" + id + "Item")[0]).after(oNode); |
|
6804 |
$($(".customShow #" + id + "Item")[0]).remove(); |
|
6805 |
//标签数据设定 |
|
6806 |
} else if (customItems[item].type == 'textarea') { |
|
6807 |
var htmlediterShow = $(".customShow #" + id)[0]; |
|
6808 |
var heightShow = customShow.options.customItemShow.item[id].tag_Attribute.height; |
|
6809 |
var widthShow = customShow.options.customItemShow.item[id].tag_Attribute.width; |
|
6810 |
if (widthShow == undefined || heightShow == undefined) { |
|
6811 |
widthShow = 300; |
|
6812 |
heightShow = 80; |
|
6813 |
} |
|
6814 |
var oNode = '<div style="word-break:break-all;border-width: 0px;border-style: solid;border-color: rgb(204, 204, 204);width:' + widthShow + 'px;height:' + |
|
6815 |
heightShow + 'px;" class="customShowItemClass edui-default customShowItemClassTemp">'; |
|
6816 |
// var oNode ='<div style="word-break:break-all;border-width: 1px;border-style: solid;border-color: rgb(204, 204, 204);class="customShowItemClass edui-default">'; |
|
6817 |
oNode += value; |
|
6818 |
oNode += "</div>"; |
|
6819 |
$($(".customShow #" + id)[0]).after(oNode); |
|
6820 |
$($(".customShow #" + id)[0]).remove(); |
|
6821 |
//标签数据设定 |
|
6822 |
} else if (customItems[item].type == 'number') { |
|
6823 |
var numberShowItems = $(".customShow #" + id); |
|
6824 |
for (var i = 0; i < numberShowItems.length; i++) { |
|
6825 |
numberShowItems[i].setAttribute("type", "text"); |
|
6826 |
} |
|
6827 |
|
|
6828 |
//标签数据设定 |
|
6829 |
} else if (customItems[item].type == 'link') { |
|
6830 |
var htmlediterShow = $(".customShow").find("#" + id)[0]; |
|
6831 |
// console.log($(htmlediterShow)) |
|
6832 |
// $(htmlediterShow)[0].setAttribute("href","javascript:;"); |
|
6833 |
$(htmlediterShow).css("font-size", "16px;"); |
|
6834 |
//单选 多选按钮 |
|
6835 |
} else if (type == 'radio' || type == 'checkbox' || type == 'dropdownlist') { |
|
6836 |
|
|
6837 |
var oNode = '<div style="word-break:break-all;border-width: 0px;border-style: solid;border-color: rgb(204, 204, 204);width:200px;" class="customShowItemClassTemp customShowItemClass ' + id + '_showItem edui-default">'; |
|
6838 |
oNode += "</div>"; |
|
6839 |
// $($(".customShow").find("#"+id)[0]).after(oNode); |
|
6840 |
// $($(".customShow").find("#"+id)[0]).remove(); |
|
6841 |
var showItem = $($(".customShow").find("#" + id)); |
|
6842 |
console.log(showItem) |
|
6843 |
for (var i = 0; i < showItem.length; i++) { |
|
6844 |
$($(showItem[i])[0]).after(oNode); |
|
6845 |
$($(showItem[i])[0]).remove(); |
|
6846 |
} |
|
6847 |
console.log(value) |
|
6848 |
//单选复选回显问题 |
|
6849 |
customShow.setShowItem(id, type, value, true); |
|
6850 |
} |
|
6851 |
else if (customItems[item].type == 'tree') { |
96b1bc
|
6852 |
//普通模式树形回显 李伟民 0130 |
L |
6853 |
var oNode = '<div treeitemid=' + id + ' style="word-break:break-all;border-width: 0px;border-style: solid;border-color: rgb(204, 204, 204);width:200px;" class="customShowItemClass edui-default customShowItemClassTemp">'; |
4d1219
|
6854 |
// 2017 /11/7 李元杰 树的回显 |
B |
6855 |
// var treeShow = $('#customShow').find('div[type=tree]'); |
|
6856 |
|
|
6857 |
// if(value !=undefined && value !=""){ |
|
6858 |
// console.log(1); |
|
6859 |
// if(typeof value == "string"){ |
|
6860 |
// // value = $.parseJSON(value); |
|
6861 |
// console.log(2); |
|
6862 |
// value =[value]; |
|
6863 |
// } |
|
6864 |
// // 2017/11/7 李元杰回显 |
|
6865 |
// if(value.length>0){ |
|
6866 |
// console.log(value); |
|
6867 |
// for(var i =0;i<value.length;i++){ |
|
6868 |
// value[i] |
|
6869 |
// } |
|
6870 |
|
|
6871 |
|
|
6872 |
// console.log(value) |
|
6873 |
|
|
6874 |
// if(typeof value[0] == "string"){ |
|
6875 |
// //console.log(value[0]); |
|
6876 |
// // value[0] = $.parseJSON(value[0]); |
|
6877 |
// } |
|
6878 |
|
|
6879 |
// oNode +=value[0]; |
|
6880 |
// } |
|
6881 |
// for (var i = 1; i < value.length; i++) { |
|
6882 |
// console.log(4); |
|
6883 |
// if(typeof value[i] == "string"){ |
|
6884 |
// console.log(5); |
|
6885 |
// // value[i] = $.parseJSON(value[i]); |
|
6886 |
// } |
|
6887 |
// console.log(value) |
|
6888 |
// oNode +=" , "+value[i]; |
|
6889 |
// console.log(oNode) |
|
6890 |
// }; |
|
6891 |
// } |
|
6892 |
// console.log(oNode) |
|
6893 |
|
|
6894 |
// oNode +="</div>"; |
|
6895 |
"</div>"; |
|
6896 |
$($(".customShow").find("#" + id)[0]).after(oNode); |
|
6897 |
$($(".customShow").find("#" + id)[0]).remove(); |
|
6898 |
// customShow.setShowItem(id, type, value, true); |
|
6899 |
console.log($($(".customShow").find("#" + id)[0])) |
|
6900 |
} |
|
6901 |
else if (customItems[item].type == 'amount') { |
|
6902 |
var id = id + "amount"; |
|
6903 |
customBase.setItemValue(id, 'text', items[item], 'customShow'); |
|
6904 |
$("#" + id).blur(); |
|
6905 |
|
|
6906 |
} else if (customItems[item].type == 'qrcode') { |
|
6907 |
var id = id + "qrcode"; |
|
6908 |
customBase.setItemValue(id, 'text', items[item], 'customShow'); |
|
6909 |
$("#" + id).blur(); |
|
6910 |
} else if (customItems[item].type == 'barcode') { |
|
6911 |
var id = id + "barcode"; |
|
6912 |
customBase.setItemValue(id, 'text', items[item], 'customShow'); |
|
6913 |
$("#" + id).blur() |
|
6914 |
} else if (customItems[item].type == 'fileupload') { |
|
6915 |
// var $wrap = $(".customShow #" + customItems[item].id); |
|
6916 |
var $uploaderItem = $($(".customShow #" + customItems[item].id)[0]); |
|
6917 |
$uploaderItem.empty(); |
|
6918 |
var $uploadimg = $( |
|
6919 |
'<div >' + |
|
6920 |
'<div id="fileList" class="uploader-list"></div>' + |
|
6921 |
'</div>' |
|
6922 |
); |
|
6923 |
var $list = $uploadimg.find("#fileList"); |
|
6924 |
if (typeof value != "string") { |
|
6925 |
if (_.isArray(value)) { |
|
6926 |
// airport = JSON.parse(airport) |
|
6927 |
value = value.join(",") |
|
6928 |
var value = JSON.parse(value); |
|
6929 |
|
|
6930 |
} |
|
6931 |
for (i in value) { |
bb9424
|
6932 |
var fileDir = value[i].path; |
Z |
6933 |
var suffix = fileDir.substr(fileDir.lastIndexOf(".")+1); |
|
6934 |
if(suffix == "mp4"){ |
|
6935 |
var $li = $( |
|
6936 |
'<div class="">' + |
|
6937 |
'<div><a href="' + value[i].path + '" target="_blank">' + value[i].oldName + ' </a></div>' + |
|
6938 |
'</div>' |
|
6939 |
); |
|
6940 |
}else{ |
|
6941 |
var $li = $( |
|
6942 |
'<div class="">' + |
|
6943 |
// '<div class="info"><a href="' + value[i].path + '" >' + value[i].oldName + '</a></div>' + |
|
6944 |
// '<div class="info info-box"><div class="info_box">' + value[i].oldName + |
|
6945 |
// '<span class="x_box" style="display:none;">×</span>' + |
|
6946 |
// '<img class="img_box" style="display:none;" src="' + value[i].path + '">' + |
|
6947 |
|
|
6948 |
'<div><a href="' + value[i].path + '" >' + value[i].oldName + '</a></div>' + |
|
6949 |
'</div>' |
|
6950 |
); |
|
6951 |
} |
4d1219
|
6952 |
$li.appendTo($list); |
B |
6953 |
}; |
|
6954 |
} |
|
6955 |
$uploadimg.appendTo($uploaderItem); |
|
6956 |
//2017-12-17 马习同修改 图片 |
|
6957 |
// $(".info_box").on("click", function () { |
|
6958 |
// $(".x_box").show(); |
|
6959 |
// $(".img_box").show(); |
|
6960 |
// $(".x_box").unbind(); |
|
6961 |
// $(".x_box").on("click", function () { |
|
6962 |
// console.log(1); |
|
6963 |
// $(".x_box").hide(); |
|
6964 |
// $(".img_box").hide(); |
|
6965 |
// }) |
|
6966 |
// }) |
|
6967 |
} else if (customItems[item].type == 'image') { |
|
6968 |
// var $wrap = $(".customShow #" + customItems[item].id); |
|
6969 |
var $uploaderItem = $($(".customShow #" + customItems[item].id)[0]); |
|
6970 |
console.log($('#' + customItems[item].id)); |
|
6971 |
console.log($uploaderItem) |
|
6972 |
$uploaderItem.empty(); |
|
6973 |
|
|
6974 |
var $uploadimg = $( |
|
6975 |
'<div >' + |
|
6976 |
'<div id ="fileList" class="uploader-list"></div>' + |
|
6977 |
'</div>' |
|
6978 |
); |
|
6979 |
// var $list = $uploadimg.find("#"+potion.id+"fileList"); |
|
6980 |
console.log(value) |
449a85
|
6981 |
if(customItems[item].defaultvalue != undefined){//详细显示默认值 李伟民 0131 |
L |
6982 |
var $list = $uploadimg.find("#fileList"); |
|
6983 |
var $addLi = $( |
|
6984 |
'<div class="file-item thumbnail">' + |
|
6985 |
'<img src="' + customItems[item].defaultvalue + '">' + |
|
6986 |
'</div>' |
|
6987 |
); |
|
6988 |
|
|
6989 |
$list.prepend($addLi); |
|
6990 |
} |
4d1219
|
6991 |
if (_.isArray(value)) { |
B |
6992 |
// airport = JSON.parse(airport) |
|
6993 |
value = value.join(",") |
|
6994 |
var value = JSON.parse(value); |
13ec33
|
6995 |
|
4d1219
|
6996 |
} |
B |
6997 |
console.log(value) |
|
6998 |
if (typeof value != "string") { |
|
6999 |
if (typeof value == "string") { |
|
7000 |
// value = $.parseJSON(value); |
|
7001 |
} |
|
7002 |
for (i in value) { |
|
7003 |
var $list = $uploadimg.find("#fileList"); |
|
7004 |
var $addLi = $( |
|
7005 |
'<div class="file-item thumbnail">' + |
bd8eb1
|
7006 |
'<img style="width:100px,height:100px" src="' + value[i].path + '">' + |
4d1219
|
7007 |
'</div>' |
B |
7008 |
); |
|
7009 |
|
|
7010 |
$list.prepend($addLi); |
|
7011 |
} |
|
7012 |
} |
|
7013 |
// 12/18 放大图片 |
|
7014 |
|
|
7015 |
$uploaderItem.append($uploadimg); |
|
7016 |
var particularId = $uploaderItem.attr('id') + '_1' |
|
7017 |
$uploaderItem.children().attr('id', particularId); |
|
7018 |
// var particularId = $uploaderItem.find('#uploaderItem').attr('id') |
|
7019 |
// 详情页 |
|
7020 |
var viewer = new Viewer(document.getElementById(particularId), { |
|
7021 |
url: 'data-original', |
13ec33
|
7022 |
|
4d1219
|
7023 |
}); |
B |
7024 |
var imgId = $uploaderItem.attr('id'); |
|
7025 |
var srcUrl = $uploaderItem.find('img').attr('src'); |
|
7026 |
$uploaderItem.find('img').attr('alt', ' '); |
|
7027 |
// itemId_32uploadimg |
|
7028 |
|
|
7029 |
// 编辑页 |
|
7030 |
// console.log($('#customViewUEditor').find('#'+imgId).children()) |
|
7031 |
// console.log($('#'+imgId)) |
|
7032 |
// console.log($uploaderItem) |
|
7033 |
// var viewer = new Viewer(document.getElementById(imgId), { |
|
7034 |
// url: 'data-original', |
|
7035 |
// show:function(){ |
|
7036 |
// console.log('显示') |
|
7037 |
// } |
|
7038 |
// }); |
|
7039 |
// 12/18 |
|
7040 |
|
|
7041 |
|
|
7042 |
} else if (customItems[item].type == 'mytext') { |
|
7043 |
//选择表单编辑回显 |
|
7044 |
console.log(customItems); |
|
7045 |
console.log(customShow); |
|
7046 |
var itemAttribute = customShow.options.customItemShow.item[customItems[item].id]; |
|
7047 |
var $mytext = $("#" + customItems[item].id); |
|
7048 |
var item_title = []; |
|
7049 |
var itemVal = []; |
|
7050 |
if (itemAttribute.tag_Attribute.relevancesourcetype == "fundata") {// 关联数据回显渲染 李伟民 11-30 |
|
7051 |
var titleObj = { "key": JSON.parse(itemAttribute.tag_Attribute.fundata)["key"] }; |
|
7052 |
var dataObj = { |
|
7053 |
"formID": customShow.options.formid, |
|
7054 |
"tenantID": "001", |
|
7055 |
"search": [], |
|
7056 |
"pageSize": "1000", |
|
7057 |
"pageNum": "1", |
|
7058 |
"key": JSON.parse(itemAttribute.tag_Attribute.fundata)["key"], |
|
7059 |
"formData": {}, |
|
7060 |
"dataRowNum": items[item] |
|
7061 |
}; |
|
7062 |
var requesTitle = window.commonAjax("/datamanagement/getAssociateTitle", titleObj, "POST", true, false); |
|
7063 |
var requesData = window.commonAjax("/datamanagement/getAssociateData", dataObj, "POST", true, false); |
|
7064 |
requesTitle.done(function (res) { |
|
7065 |
console.log(res); |
|
7066 |
item_title = res.data; |
|
7067 |
}); |
|
7068 |
requesData.done(function (res) { |
|
7069 |
console.log(res); |
|
7070 |
if (!_.isNull(res.data) && res.data != undefined) { |
|
7071 |
itemVal = res.data; |
|
7072 |
} |
|
7073 |
}); |
|
7074 |
} else { |
|
7075 |
var myTitle = JSON.parse(window.localStorage.getItem("title")); |
|
7076 |
item_title = myTitle[item]; |
|
7077 |
itemVal = items[item]; |
|
7078 |
} |
|
7079 |
console.log(itemVal) |
|
7080 |
console.log(item_title); |
|
7081 |
console.log(itemVal.list); |
|
7082 |
createMxtTable(customItems[item].id, item_title, itemVal.list);// 关联数据回显渲染 李伟民 11-30 |
|
7083 |
// var newData = []; |
|
7084 |
// _.each(itemVal.list,function(opt){ |
|
7085 |
// opt = _.mapKeys(opt,function(value,key){ |
|
7086 |
// _.each(item_title,function(item){ |
|
7087 |
// if(key == item.fieldKey){ |
|
7088 |
// key = item.title; |
|
7089 |
// } |
|
7090 |
// }) |
|
7091 |
// return key; |
|
7092 |
// }) |
|
7093 |
// console.log(_.cloneDeep(opt)) |
|
7094 |
// newData.push(opt); |
|
7095 |
// }) |
|
7096 |
// console.log(itemVal.list); |
|
7097 |
// console.log(newData); |
|
7098 |
var formhuixian = itemVal.list; |
|
7099 |
|
|
7100 |
//console.log(formhuixian); |
|
7101 |
var huixianStr = ""; |
|
7102 |
for (let i in formhuixian) { |
|
7103 |
//console.log($mytext.attr("fieldkey")); |
|
7104 |
//console.log(i); |
|
7105 |
//console.log(formhuixian[i]); |
|
7106 |
if (i = $mytext.attr("fieldkey")) { |
|
7107 |
huixianStr = formhuixian[i]; |
|
7108 |
} |
|
7109 |
} |
|
7110 |
//console.log(huixianStr); |
|
7111 |
$mytext.attr("formhuixian", JSON.stringify(itemVal.list)); |
|
7112 |
// if(newData){ |
|
7113 |
// var $value = newData; |
|
7114 |
// console.log($value) |
|
7115 |
// |
|
7116 |
// var show = ""; |
|
7117 |
// var divBox = $("<div></div>"); |
|
7118 |
// divBox.attr('id',customItems[item].id+'divBox'); |
|
7119 |
// var sdata_head = ""; |
|
7120 |
// _.each($value,(opt,j)=>{ |
|
7121 |
// var ulBox = $("<ul></ul>"); |
|
7122 |
// for(let i in opt){ |
|
7123 |
// show = ""; |
|
7124 |
// sdata_head = '<td class="data1 '+i+'">'+i+'</td>'; |
|
7125 |
// show += '<li>'+'<span class="data1 '+i+'">'+i+'</span>'+'<span class="data2 '+i+'">'+opt[i]+'</span>'+'</li>'; |
|
7126 |
// ulBox.attr("class","addUl ulBox"+j); |
|
7127 |
// ulBox.attr("id","ulBox"+j); |
|
7128 |
// //console.log(show) |
|
7129 |
// ulBox.append(show); |
|
7130 |
// } |
|
7131 |
// divBox.append(ulBox); |
|
7132 |
// }); |
|
7133 |
// console.log(sdata_head); |
|
7134 |
// $mytext.append(divBox); |
|
7135 |
// } |
|
7136 |
} |
|
7137 |
if (type == 'radio' || type == 'checkbox' || type == 'dropdownlist' || type == 'tree' || |
|
7138 |
type == 'amount' || type == 'barcode' || type == 'qrcode' || type == 'image' || |
|
7139 |
type == 'button' || type == 'fileupload' |
|
7140 |
|| type == 'subform' || type == 'link' |
|
7141 |
|| type == 'splitline' || type == 'link' |
|
7142 |
|| type == 'textarea' |
|
7143 |
) { |
|
7144 |
|
|
7145 |
} else { |
|
7146 |
//值设定 |
|
7147 |
customBase.setItemValue(id, type, value, 'customShow'); |
|
7148 |
} |
|
7149 |
|
|
7150 |
} |
|
7151 |
}; |
|
7152 |
} |
|
7153 |
|
|
7154 |
//画面表示项目取得 ----------------- |
|
7155 |
customShow.getItems = function (saveflag) { |
|
7156 |
var items = customBase.options.customItems; |
|
7157 |
console.log(items); |
|
7158 |
var itemTempS = {}; |
|
7159 |
for (item in items) { |
|
7160 |
if (items.hasOwnProperty(item)) { |
|
7161 |
console.log(item); |
|
7162 |
console.log(items[item].type); |
|
7163 |
if (items[item].type == "button" || items[item].type == "link") { |
|
7164 |
} else if (items[item].type == "dropdownlist") { |
|
7165 |
// var datasourcetype = $("#"+items[item].id)[0].getAttribute("datasourcetype"); |
|
7166 |
// //主数据源 |
|
7167 |
// if(datasourcetype == "masterdata"){ |
|
7168 |
// itemTempS[item] = customBase.getItemValue(items[item].id,"dropdownlistText"); |
|
7169 |
// //数据源 |
|
7170 |
// }else if(datasourcetype == "datasource"){ |
|
7171 |
// itemTempS[item] = customBase.getItemValue(items[item].id,"dropdownlistText"); |
|
7172 |
// //自定义 |
|
7173 |
// }else if(datasourcetype == "custom"){ |
|
7174 |
// itemTempS[item] = customBase.getItemValue(items[item].id,"dropdownlistText"); |
|
7175 |
// //API接口 |
|
7176 |
// }else if(datasourcetype == "api"){ |
|
7177 |
// itemTempS[item] = customBase.getItemValue(items[item].id,"dropdownlistText"); |
|
7178 |
// } |
|
7179 |
itemTempS[item] = customBase.getItemValue(items[item].id, "dropdownlistText"); |
|
7180 |
console.log(itemTempS[item]) |
|
7181 |
if (saveflag) {//下拉框 传值 修改 李伟民 11-09 |
|
7182 |
console.log(itemTempS[item]); |
|
7183 |
_.each(itemTempS[item], function (sval, i) { |
|
7184 |
if (_.isArray(sval)) { |
|
7185 |
itemTempS[item][i] = sval.join(); |
|
7186 |
} |
|
7187 |
}) |
|
7188 |
// if(_.isArray(itemTempS[item][0])){ |
|
7189 |
// itemTempS[item][0] = itemTempS[item][0].join(",") |
|
7190 |
// } |
|
7191 |
console.log(itemTempS[item]); |
|
7192 |
}//下拉框 传值 修改 李伟民 11-09 |
|
7193 |
} else if (items[item].type == "tree") { |
|
7194 |
itemTempS[item] = customBase.getItemValue(items[item].id, "tree"); |
|
7195 |
console.log(itemTempS[item]) |
|
7196 |
if (saveflag) {//树形传值 修改 李元杰 11-21 |
|
7197 |
console.log(itemTempS[item]); |
|
7198 |
_.each(itemTempS[item], function (sval, i) { |
|
7199 |
if (_.isArray(sval)) { |
|
7200 |
itemTempS[item][i] = sval.join(); |
|
7201 |
} |
|
7202 |
}) |
|
7203 |
// if(_.isArray(itemTempS[item][0])){ |
|
7204 |
// itemTempS[item][0] = itemTempS[item][0].join(",") |
|
7205 |
// } |
|
7206 |
}//树形 传值 修改 李元杰 11-21 |
|
7207 |
} else if (items[item].type == "checkbox") { |
|
7208 |
itemTempS[item] = customBase.getItemValue(items[item].id, "checkbox"); |
|
7209 |
console.log(itemTempS[item]) |
|
7210 |
console.log(saveflag) |
|
7211 |
if (saveflag) {//复选框传值 修改 马习同 12-6 |
|
7212 |
console.log(itemTempS[item]); |
|
7213 |
_.each(itemTempS[item], function (sval, i) { |
|
7214 |
if (_.isArray(sval)) { |
|
7215 |
itemTempS[item][i] = sval.join(); |
|
7216 |
} |
|
7217 |
}) |
|
7218 |
// if(_.isArray(itemTempS[item][0])){ |
|
7219 |
// itemTempS[item][0] = itemTempS[item][0].join(",") |
|
7220 |
// } |
|
7221 |
}////复选框传值 修改 马习同 12-6 |
|
7222 |
} else if (items[item].type == "radio") { |
|
7223 |
itemTempS[item] = customBase.getItemValue(items[item].id, "radio"); |
|
7224 |
console.log(itemTempS[item]) |
|
7225 |
console.log(saveflag) |
|
7226 |
if (saveflag) {//复选框传值 修改 马习同 12-6 |
|
7227 |
console.log(itemTempS[item]); |
|
7228 |
_.each(itemTempS[item], function (sval, i) { |
|
7229 |
if (_.isArray(sval)) { |
|
7230 |
itemTempS[item][i] = sval.join(); |
|
7231 |
} |
|
7232 |
}) |
|
7233 |
// if(_.isArray(itemTempS[item][0])){ |
|
7234 |
// itemTempS[item][0] = itemTempS[item][0].join(",") |
|
7235 |
// } |
|
7236 |
}////复选框传值 修改 马习同 12-6 |
|
7237 |
} else if (items[item].type == "subform" || items[item].type == "tag" || items[item].type == "tab") { |
|
7238 |
|
|
7239 |
} else if (items[item].type == "auto") { |
|
7240 |
var str = window.localStorage.getItem("customItem"); |
|
7241 |
var prefix = (str != undefined && str != "undefined") ? JSON.parse(str) : null; |
|
7242 |
if (prefix != null && (prefix[item] != null || prefix[item] != undefined)) { |
|
7243 |
itemTempS[item] = prefix[item]; |
|
7244 |
} else { |
|
7245 |
itemTempS[item] = customBase.getItemValue(items[item].id, items[item].type); |
|
7246 |
} |
|
7247 |
} else { |
|
7248 |
itemTempS[item] = customBase.getItemValue(items[item].id, items[item].type); |
|
7249 |
console.log(itemTempS[item]); |
|
7250 |
} |
|
7251 |
} |
|
7252 |
}; |
|
7253 |
var itemRetuen = {}; |
|
7254 |
|
|
7255 |
//子表单数据变换 |
|
7256 |
for (item in customBase.options.customItems) { |
|
7257 |
if (customBase.options.customItems.hasOwnProperty(item)) { |
|
7258 |
if (customBase.options.customItems[item].type == "subform" || customBase.options.customItems[item].type == "tag" || customBase.options.customItems[item].type == "tab") { |
|
7259 |
var id = customBase.options.customItems[item].id.replace("itemId_", ""); |
|
7260 |
itemRetuen[id] = {}; |
|
7261 |
} |
|
7262 |
} |
|
7263 |
} |
|
7264 |
console.log(_.cloneDeep(itemRetuen)); |
|
7265 |
console.log(_.cloneDeep(itemTempS)); |
|
7266 |
//子表单内数据保存 |
|
7267 |
for (item in itemTempS) { |
|
7268 |
////console.log(items); |
|
7269 |
////console.log(itemTempS); |
|
7270 |
////console.log(item); |
|
7271 |
if (itemTempS.hasOwnProperty(item)) { |
|
7272 |
var parentsubFormNum = customBase.options.customItems[item].parentsubFormNum; |
|
7273 |
////console.log(customBase.options) |
|
7274 |
////console.log(customBase.options.customItems[item]); |
|
7275 |
////console.log(parentsubFormNum); |
|
7276 |
if (parentsubFormNum == "0") { |
|
7277 |
if (customBase.options.customItems[item].type == "radio" || |
|
7278 |
customBase.options.customItems[item].type == "checkbox" || |
|
7279 |
customBase.options.customItems[item].type == "dropdownlist" || |
|
7280 |
customBase.options.customItems[item].type == "tree" |
|
7281 |
) { |
|
7282 |
itemRetuen[item] = itemTempS[item][0]; |
|
7283 |
} else { |
|
7284 |
itemRetuen[item] = itemTempS[item]; |
|
7285 |
} |
|
7286 |
} else { |
|
7287 |
////console.log(item); |
|
7288 |
////console.log(items); |
|
7289 |
////console.log(itemRetuen[parentsubFormNum]); |
|
7290 |
////console.log(itemTempS[item]); |
|
7291 |
////console.log(itemRetuen); |
|
7292 |
////console.log(parentsubFormNum); |
|
7293 |
itemRetuen[parentsubFormNum][item] = itemTempS[item]; |
|
7294 |
} |
|
7295 |
} |
|
7296 |
} |
|
7297 |
//子表单内最终数据变换 |
|
7298 |
console.log(_.cloneDeep(itemRetuen)); |
|
7299 |
console.log(customBase.options.customItems); |
|
7300 |
for (item in customBase.options.customItems) { |
|
7301 |
if (customBase.options.customItems.hasOwnProperty(item)) { |
|
7302 |
if (customBase.options.customItems[item].type == "subform" || customBase.options.customItems[item].type == "tag" || customBase.options.customItems[item].type == "tab") { |
|
7303 |
var id = customBase.options.customItems[item].id.replace("itemId_", ""); |
|
7304 |
var tepItem = itemRetuen[id]; |
|
7305 |
var subformIten = []; |
|
7306 |
var i = 0; |
|
7307 |
console.log(tepItem); |
|
7308 |
for (tem in tepItem) { |
|
7309 |
if (tepItem.hasOwnProperty(tem)) { |
|
7310 |
if (typeof tepItem[tem] == "string") { |
|
7311 |
if (subformIten[0] == undefined) { |
|
7312 |
subformIten[0] = {}; |
|
7313 |
} |
|
7314 |
subformIten[0][tem] = tepItem[tem]; |
|
7315 |
} else { |
|
7316 |
console.log(tepItem[tem]); |
|
7317 |
for (var i = 0; i < tepItem[tem].length; i++) { |
|
7318 |
if (subformIten[i] == undefined) { |
|
7319 |
subformIten[i] = {}; |
|
7320 |
} |
|
7321 |
subformIten[i][tem] = tepItem[tem][i]; |
|
7322 |
} |
|
7323 |
} |
|
7324 |
} |
|
7325 |
} |
|
7326 |
delete itemRetuen[id]; |
|
7327 |
console.log(_.cloneDeep(subformIten)); |
|
7328 |
itemRetuen[customBase.options.customItems[item].fieldKey] = subformIten; |
|
7329 |
} |
|
7330 |
} |
|
7331 |
} |
|
7332 |
console.log(_.cloneDeep(itemRetuen)); |
|
7333 |
return itemRetuen; |
|
7334 |
} |
|
7335 |
|
|
7336 |
//取消事件 |
|
7337 |
customShow.onclickCancel = function () { |
|
7338 |
// var items = customShow.getItems(); |
|
7339 |
//检证执行 |
|
7340 |
var saveReturn = customShow.initEvent.cancelEventLinkage(); |
|
7341 |
if (!saveReturn) { |
|
7342 |
return; |
|
7343 |
} |
|
7344 |
|
|
7345 |
//取消接口(第三方提供) |
|
7346 |
var saveReturn = customShow.initEvent.cancelEvent3rd();//-------------------- |
|
7347 |
if (saveReturn) { |
|
7348 |
// 取消接口 |
|
7349 |
customShow.initEvent.cancelEvent();//-------------------- |
|
7350 |
} |
|
7351 |
if (customShow.options.customShowFlag == "3") { |
|
7352 |
// window.close(); |
|
7353 |
window.location.href = "about:blank"; |
|
7354 |
window.close(); |
|
7355 |
} else if (customShow.options.customShowFlag == "0" || customShow.options.customShowFlag == "1" || customShow.options.customShowFlag == "2") { |
|
7356 |
window.parent.$('#myModal').modal('hide'); |
|
7357 |
if (customShow.options.breakFlag) { |
|
7358 |
window.parent.addFormData(); |
|
7359 |
} |
|
7360 |
if (customShow.options.customShowFlag == "1" || customShow.options.customShowFlag == "2") { |
|
7361 |
$(window.parent.document.body).css({ "overflow-x": "auto", "overflow-y": "auto" }); |
|
7362 |
} |
|
7363 |
window.parent.$("#myFormDesign").css("display", ""); |
|
7364 |
window.parent.$(".htmlediterClass").css("display", ""); |
|
7365 |
} |
|
7366 |
} |
|
7367 |
|
|
7368 |
//印刷事件 打印 |
|
7369 |
customShow.onPrint = function () { |
|
7370 |
var items = customShow.getItems(); |
|
7371 |
var interfacep = customShow.initEvent.interfaceprint3rd(items); |
|
7372 |
if (!interfacep) { |
|
7373 |
return; |
|
7374 |
} |
|
7375 |
var removePrintArea = function (id) { |
|
7376 |
$("iframe#" + id).remove(); |
|
7377 |
}; |
|
7378 |
var customShowFlag = window.localStorage.getItem("customShowFlag"); |
|
7379 |
if (customShowFlag == "0") { |
|
7380 |
var itemOnPrint = $("#customViewUEditor")[0].cloneNode(true); |
|
7381 |
$(itemOnPrint).css("overflow", 'visible'); |
|
7382 |
$(itemOnPrint).printArea(); |
|
7383 |
}else{ |
|
7384 |
var itemOnPrint = $("#customShow")[0].cloneNode(true); |
|
7385 |
$(itemOnPrint).css("overflow", 'visible'); |
|
7386 |
$(itemOnPrint).printArea(); |
|
7387 |
} |
|
7388 |
} |
|
7389 |
|
|
7390 |
//编辑按钮按下时 |
|
7391 |
customShow.onEditor = function () { |
|
7392 |
// $(".preview-edit-pane").css("display", "none"); |
|
7393 |
window.localStorage.setItem("customShowFlag", 3); |
|
7394 |
var formIDs = customlocalStorage.newFormID; |
|
7395 |
|
|
7396 |
customDataBound.formsetting(formIDs, function () { }); |
|
7397 |
//console.log("编辑存值"); |
|
7398 |
$("#customShow").empty(); |
|
7399 |
if (customShow.options.customShowFlag != "3") { |
|
7400 |
//图片文件上传 |
|
7401 |
var uploaderImage = $(".customViewUEditorCss .uploaderImage"); |
|
7402 |
for (var i = 0; i < uploaderImage.length; i++) { |
|
7403 |
$("#" + uploaderImage[i].id).find('.imgfileLiShow').remove(); |
|
7404 |
var imageItem = customShow.options.customItemShow.item[uploaderImage[i].id]; |
|
7405 |
var itemList = customBase.options.uploaderItemReady[uploaderImage[i].id]; |
|
7406 |
if (customShow.options.customShowFlag == "3") { |
|
7407 |
|
|
7408 |
} |
|
7409 |
// 参数设定 |
|
7410 |
var potion = { |
|
7411 |
id: uploaderImage[i].id, |
|
7412 |
width: imageItem.tag_Attribute.width, |
|
7413 |
height: imageItem.tag_Attribute.height, |
|
7414 |
formid: customShow.options.formid, |
|
7415 |
imagetype: imageItem.tag_Attribute.dropdowntype, //图片类型 |
|
7416 |
editable: imageItem.tag_Attribute.editable, //是否可编辑 |
|
7417 |
defaultvalueUrl: imageItem.tag_Attribute.defaultvalue, //默认的Url |
|
7418 |
ItemReady: itemList, |
|
7419 |
visible:imageItem.tag_Attribute.visible |
|
7420 |
} |
|
7421 |
// 12/18 |
|
7422 |
customBase.uploaderShow(potion); |
|
7423 |
|
|
7424 |
// customBase.uploaderShow("#"+uploaderImage[i].id,{width:0,height:200},true,customShow.options.formid); |
|
7425 |
|
|
7426 |
}; |
|
7427 |
|
|
7428 |
//文本文件上传 |
|
7429 |
var uploaderFile = $(".customViewUEditorCss .uploaderFile"); |
|
7430 |
|
|
7431 |
for (var i = 0; i < uploaderFile.length; i++) { |
|
7432 |
$("#" + uploaderFile[i].id + " .filelist").empty(); |
|
7433 |
|
|
7434 |
var imageItem = customShow.options.customItemShow.item[uploaderFile[i].id]; |
|
7435 |
debugger |
|
7436 |
var itemList = customBase.options.uploaderItemReady[uploaderFile[i].id]; |
|
7437 |
// 参数设定 |
|
7438 |
var potion = { |
|
7439 |
id: uploaderFile[i].id, |
|
7440 |
width: imageItem.tag_Attribute.width, |
|
7441 |
height: imageItem.tag_Attribute.height, |
|
7442 |
formid: customShow.options.formid, |
|
7443 |
imagetype: imageItem.tag_Attribute.dropdowntype, //图片类型 |
|
7444 |
editable: imageItem.tag_Attribute.editable, //是否可编辑 |
|
7445 |
defaultvalueUrl: imageItem.tag_Attribute.defaultvalue, //默认的Url |
|
7446 |
ItemReady: itemList, |
|
7447 |
visible:imageItem.tag_Attribute.visible |
|
7448 |
} |
|
7449 |
customBase.uploaderFileShow(potion); |
|
7450 |
// customBase.uploaderShow_Temp("#"+uploaderFile[i].id,{width:0,height:200},false,customShow.options.formid); |
|
7451 |
}; |
|
7452 |
} |
|
7453 |
$("#customViewUEditor")[0].style.display = "block"; |
|
7454 |
$("#customShow")[0].style.display = "none"; |
|
7455 |
$("#customShow").css("display", "none"); |
|
7456 |
$("#customShow").removeClass("fui-form"); |
|
7457 |
// $(".footer")[0].style.display ="block"; |
|
7458 |
// $(".preview-edit-pane")[0].style.display ="none"; |
|
7459 |
// $(".footer .fromSaveCss")[0].style.display ="block"; |
|
7460 |
|
|
7461 |
var btns = [ |
|
7462 |
// 'printableBtn', |
|
7463 |
//12/23'exportBtn', |
|
7464 |
//12/23 'rejectBtn', |
|
7465 |
// 12/23 'submitBtn', |
|
7466 |
//12 /23 'auditableBtn', |
|
7467 |
// 12/23 'queryBtn', |
|
7468 |
// 'createBtn', |
|
7469 |
// 'clearBtn', |
|
7470 |
// 12/23 'disposableBtn', |
|
7471 |
// 'fromSaveBtn', |
|
7472 |
// 'editableBtn' |
|
7473 |
]; |
|
7474 |
customShow.setToolBtn(btns); |
|
7475 |
|
|
7476 |
customShow.setXhSelectList(); |
|
7477 |
//子表单事件调用 |
|
7478 |
customShow.clickBindSubform(); |
|
7479 |
//2017/11/18 马习同修改 隐藏预览模式下 导入数据按钮 |
|
7480 |
$(".sonImportFile").removeClass("cfg_contentNone"); |
|
7481 |
//s_savebtn |
|
7482 |
$(".s_savebtn").show(); |
|
7483 |
// $(".preview-edit-pane").css("display", "none"); |
|
7484 |
//12/23 |
|
7485 |
// $('#disposableBtn').css('display','none'); |
|
7486 |
// $('#clearBtn').css('display','none'); |
|
7487 |
// $('#queryBtn').css('display','none'); |
|
7488 |
// $('#auditableBtn').css('display','none'); |
|
7489 |
// $('#submitBtn').css('display','none'); |
|
7490 |
// $('#rejectBtn').css('display','none'); |
|
7491 |
|
|
7492 |
} |
|
7493 |
|
|
7494 |
//画面验证 |
|
7495 |
customShow.onfromCheck = function (items) { |
|
7496 |
if ($(".errorCheckCss").length > 0) { |
|
7497 |
return true; |
|
7498 |
} |
|
7499 |
if($(".checkErr") > 0){ |
|
7500 |
return true; |
|
7501 |
} |
|
7502 |
$(".errorItemCss").removeClass("errorItemCss"); |
|
7503 |
$(".mesageErrDiv").remove(); |
|
7504 |
for (var id in customShow.options.showErrId) { |
|
7505 |
$($(".customViewUEditorCss #" + id)[customShow.options.showErrId[id]]).popover('hide'); |
|
7506 |
} |
|
7507 |
|
|
7508 |
//必须入力验证 |
|
7509 |
mustcheckExe = function (tag_Type, value, ItemId, N) { |
|
7510 |
if (tag_Type == "text" || tag_Type == "textarea" || |
|
7511 |
tag_Type == "number" || tag_Type == "htmlediter" || tag_Type == "fileupload" || |
|
7512 |
tag_Type == "calendar") { |
|
7513 |
if (tag_Type == "fileupload") { |
|
7514 |
var count = 0; |
|
7515 |
for (var key in value) { |
|
7516 |
count++; |
|
7517 |
} |
|
7518 |
if (count == 0) { |
|
7519 |
value = ""; |
|
7520 |
} |
|
7521 |
|
|
7522 |
} |
|
7523 |
if (value == "") { |
|
7524 |
customShow.showErrorItem(tag_Type, ItemId, N); |
|
7525 |
var message = customBase.getMessage("mesage_ID004"); |
|
7526 |
customShow.setShowMesageErr(ItemId, message, N); |
|
7527 |
mustcheck = true; |
|
7528 |
} |
|
7529 |
} else if (tag_Type == "checkbox" || tag_Type == "dropdownlist") { |
|
7530 |
// //////////console.log(value); |
|
7531 |
if (value.length == 0) { |
|
7532 |
customShow.showErrorItem(tag_Type, ItemId, N); |
|
7533 |
var message = customBase.getMessage("mesage_ID004"); |
|
7534 |
customShow.setShowMesageErr(ItemId, message, N); |
|
7535 |
mustcheck = true; |
|
7536 |
} |
|
7537 |
} |
|
7538 |
} |
|
7539 |
|
|
7540 |
//数值型验证 |
|
7541 |
numberFormatCheck = function (numbertype, value, ItemId, N) { |
|
7542 |
if (numbertype == "integer") { |
|
7543 |
if (value.indexOf(".") > -1) { |
|
7544 |
var message = customBase.getMessage("mesage_ID019"); |
|
7545 |
customShow.showErrorItem("number", ItemId, N); |
|
7546 |
customShow.setShowMesageErr(ItemId, message, N); |
|
7547 |
mustcheck = true; |
|
7548 |
} else { |
|
7549 |
var numberMaxlength = customShow.options.customItemShow.item[ItemId].tag_Attribute.maxlength; |
|
7550 |
numberMaxlength = parseInt(numberMaxlength); |
|
7551 |
if (value.length > numberMaxlength && numberMaxlength != 0) { |
|
7552 |
customShow.showErrorItem("number", ItemId, N); |
|
7553 |
var message = customBase.getMessage("mesage_ID020"); |
|
7554 |
customShow.setShowMesageErr(ItemId, message, N); |
|
7555 |
mustcheck = true; |
|
7556 |
} |
|
7557 |
} |
|
7558 |
} else { |
|
7559 |
var integerItem; |
|
7560 |
integerItem = value.split("."); |
|
7561 |
//整数长度 |
|
7562 |
// var aa = customShow.options.customItemShow.item[subformItemId].tag_Attribute.alias; |
|
7563 |
var numberMaxlength = customShow.options.customItemShow.item[ItemId].tag_Attribute.maxlength; |
|
7564 |
numberMaxlength = parseInt(numberMaxlength); |
|
7565 |
var numberdecimalplace = customShow.options.customItemShow.item[ItemId].tag_Attribute.decimalplace; |
|
7566 |
numberdecimalplace = parseInt(numberdecimalplace); |
|
7567 |
if (integerItem[0].length > numberMaxlength && numberMaxlength != 0) { |
|
7568 |
customShow.showErrorItem("number", ItemId, N); |
|
7569 |
var message = customBase.getMessage("mesage_ID020"); |
|
7570 |
customShow.setShowMesageErr(ItemId, message, N); |
|
7571 |
mustcheck = true; |
|
7572 |
} |
|
7573 |
if (integerItem[2] != undefined && integerItem[1].length > numberdecimalplace) { |
|
7574 |
customShow.showErrorItem("number", ItemId, N); |
|
7575 |
var message = customBase.getMessage("mesage_ID021"); |
|
7576 |
customShow.setShowMesageErr(ItemId, message, N); |
|
7577 |
mustcheck = true; |
|
7578 |
} |
|
7579 |
////////console.log(customShow.options.customItemShow.item[ItemId].tag_Attribute); |
|
7580 |
} |
|
7581 |
} |
|
7582 |
|
|
7583 |
//文本格式验证 |
|
7584 |
maxlengthCheck = function (maxlength, value, ItemId, N) { |
|
7585 |
if (value.length > maxlength && maxlength != 0) { |
|
7586 |
customShow.showErrorItem("htmlediter", ItemId, N); |
|
7587 |
var message = customBase.getMessage("mesage_ID023"); |
|
7588 |
customShow.setShowMesageErr(ItemId, message, N); |
|
7589 |
mustcheck = true; |
|
7590 |
} |
|
7591 |
} |
|
7592 |
//文本格式验证 |
|
7593 |
textFormatCheck = function (format, value, ItemId, N) { |
|
7594 |
if (value == "") { |
|
7595 |
return; |
|
7596 |
} else if (format == "phone") { |
|
7597 |
//手机号 |
|
7598 |
var p1 = /^1[3|4|5|7|8][0-9]{9}$/; |
|
7599 |
var me = false; |
|
7600 |
if (!p1.test(value)) { |
|
7601 |
customShow.showErrorItem("text", ItemId, N); |
|
7602 |
var message = customBase.getMessage("mesage_ID009"); |
|
7603 |
customShow.setShowMesageErr(ItemId, message, N); |
|
7604 |
mustcheck = true; |
|
7605 |
} |
|
7606 |
} else if (format == "url") { |
b81a80
|
7607 |
//网址 张吉男修改网址验证 |
Z |
7608 |
// var strRegex = "^((https|http|ftp|rtsp|mms)?://)" |
|
7609 |
// + "?(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?" //ftp的user@ |
|
7610 |
// + "(([0-9]{1,3}\.){3}[0-9]{1,3}" // IP形式的URL- 199.194.52.184 |
|
7611 |
// + "|" // 允许IP和DOMAIN(域名) |
|
7612 |
// + "([0-9a-z_!~*'()-]+\.)*" // 域名- www. |
|
7613 |
// + "([0-9a-z][0-9a-z-]{0,61})?[0-9a-z]\." // 二级域名 |
|
7614 |
// + "[a-z]{2,6})" // first level domain- .com or .museum |
|
7615 |
// + "(:[0-9]{1,4})?" // 端口- :80 |
|
7616 |
// + "((/?)|" // a slash isn't required if there is no file name |
|
7617 |
// + "(/[0-9a-z_!~*'().;?:@&=+$,%#-]+)+/?)$"; |
|
7618 |
var strRegex="[a-zA-z]+://[^\s]*"; |
4d1219
|
7619 |
var re = new RegExp(strRegex); |
B |
7620 |
if (!re.test(value)) { |
|
7621 |
customShow.showErrorItem("text", ItemId, N); |
|
7622 |
var message = customBase.getMessage("mesage_ID010"); |
|
7623 |
customShow.setShowMesageErr(ItemId, message, N); |
|
7624 |
mustcheck = true; |
|
7625 |
} |
|
7626 |
} else if (format == "cardno") { |
|
7627 |
//身份证 |
|
7628 |
// 2018.1.25 张吉男修改 身份证验证错误 |
|
7629 |
// var p1 = /^\d{6}(18|19|20)?\d{2}(0[1-9]|1[12])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i; |
|
7630 |
var p1=/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/; |
|
7631 |
// alert(1111); |
|
7632 |
if (!p1.test(value)) { |
|
7633 |
customShow.showErrorItem("text", ItemId, N); |
|
7634 |
var message = customBase.getMessage("mesage_ID011"); |
|
7635 |
customShow.setShowMesageErr(ItemId, message, N); |
|
7636 |
mustcheck = true; |
|
7637 |
} |
|
7638 |
} else if (format == "email") { |
|
7639 |
//邮箱 |
|
7640 |
var myreg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/; |
|
7641 |
if (!myreg.test(value)) { |
|
7642 |
customShow.showErrorItem("text", ItemId, N); |
|
7643 |
var message = customBase.getMessage("mesage_ID012"); |
|
7644 |
customShow.setShowMesageErr(ItemId, message, N); |
|
7645 |
mustcheck = true; |
|
7646 |
} |
|
7647 |
} |
|
7648 |
} |
|
7649 |
var customItems = customBase.options.customItems; |
|
7650 |
//必须入力验证 |
|
7651 |
var mustcheck = false; |
|
7652 |
for (fieldKey in customItems) { |
|
7653 |
|
|
7654 |
if (customItems.hasOwnProperty(fieldKey)) { |
|
7655 |
////console.log(customItems); |
|
7656 |
var tag_Type = customItems[fieldKey].type; |
|
7657 |
var ItemId = customItems[fieldKey].id; |
|
7658 |
if (customItems[fieldKey].visible) { |
|
7659 |
if (customItems[fieldKey].mustcheck) { |
|
7660 |
var value = items[fieldKey]; |
|
7661 |
//子表单的情况 |
|
7662 |
if (value == undefined) { |
|
7663 |
|
|
7664 |
//取得对应子表单ID |
|
7665 |
var subformItemId = "itemId_" + customItems[fieldKey].parentsubFormNum; |
|
7666 |
if (customShow.options.customItemShow.item[subformItemId] != undefined) { |
|
7667 |
var subformItemAlias = customShow.options.customItemShow.item[subformItemId].tag_Attribute.alias; |
|
7668 |
var subformItem = items[subformItemAlias]; |
|
7669 |
for (var i = 0; i < subformItem.length; i++) { |
|
7670 |
mustcheckExe(tag_Type, subformItem[i][fieldKey], ItemId, i); |
|
7671 |
} |
|
7672 |
} |
|
7673 |
} else { |
|
7674 |
mustcheckExe(tag_Type, value, ItemId, 0); |
|
7675 |
} |
|
7676 |
} |
|
7677 |
//文本格式验证 |
|
7678 |
if (customItems[fieldKey].type == "text") { |
|
7679 |
var value = items[fieldKey]; |
|
7680 |
////console.log(fieldKey); |
|
7681 |
////console.log(customItems); |
|
7682 |
////console.log(value); |
|
7683 |
var format = customShow.options.customItemShow.item[ItemId].tag_Attribute.format; |
|
7684 |
//子表单的情况 |
|
7685 |
if (value == undefined) { |
|
7686 |
//取得对应子表单ID |
|
7687 |
var subformItemId = "itemId_" + customItems[fieldKey].parentsubFormNum; |
|
7688 |
var subformItemAlias = customShow.options.customItemShow.item[subformItemId].tag_Attribute.alias; |
|
7689 |
var subformItem = items[subformItemAlias]; |
|
7690 |
////console.log(items); |
|
7691 |
////console.log(subformItemAlias); |
|
7692 |
////console.log(subformItem); |
|
7693 |
for (var i = 0; i < subformItem.length; i++) { |
|
7694 |
textFormatCheck(format, subformItem[i][fieldKey], ItemId, i); |
|
7695 |
} |
|
7696 |
} else { |
|
7697 |
textFormatCheck(format, value, ItemId, 0); |
|
7698 |
} |
|
7699 |
|
|
7700 |
} |
|
7701 |
//数值整数验证 |
|
7702 |
if (customItems[fieldKey].type == "number") { |
|
7703 |
var value = items[fieldKey]; |
|
7704 |
//数值格式 |
|
7705 |
var numbertype = customShow.options.customItemShow.item[ItemId].tag_Attribute.numbertype; |
|
7706 |
//子表单的情况 |
|
7707 |
if (value == undefined) { |
|
7708 |
//取得对应子表单ID |
|
7709 |
var subformItemId = "itemId_" + customItems[fieldKey].parentsubFormNum; |
|
7710 |
var subformItemAlias = customShow.options.customItemShow.item[subformItemId].tag_Attribute.alias; |
|
7711 |
var subformItem = items[subformItemAlias]; |
|
7712 |
for (var i = 0; i < subformItem.length; i++) { |
|
7713 |
numberFormatCheck(numbertype, subformItem[i][fieldKey], ItemId, i); |
|
7714 |
} |
|
7715 |
} else { |
|
7716 |
numberFormatCheck(numbertype, value, ItemId, 0); |
|
7717 |
} |
|
7718 |
|
|
7719 |
} |
|
7720 |
|
|
7721 |
//默认长度检证 |
|
7722 |
if (customItems[fieldKey].type == "htmlediter") { |
|
7723 |
var value = items[fieldKey]; |
|
7724 |
//数值格式 |
|
7725 |
var maxlength = customShow.options.customItemShow.item[ItemId].tag_Attribute.maxlength; |
|
7726 |
// //子表单的情况 |
|
7727 |
// if(value ==undefined){ |
|
7728 |
// //取得对应子表单ID |
|
7729 |
// var subformItemId = "itemId_"+customItems[fieldKey].parentsubFormNum; |
|
7730 |
// var subformItemAlias = customShow.options.customItemShow.item[subformItemId].tag_Attribute.alias; |
|
7731 |
// var subformItem = items[subformItemAlias]; |
|
7732 |
// for(var i=0;i<subformItem.length;i++){ |
|
7733 |
// numberFormatCheck(numbertype,subformItem[i][fieldKey],ItemId,i); |
|
7734 |
// } |
|
7735 |
// }else{ |
|
7736 |
maxlengthCheck(maxlength, value, ItemId, 0); |
|
7737 |
// } |
|
7738 |
|
|
7739 |
} |
|
7740 |
} |
|
7741 |
} |
|
7742 |
} |
|
7743 |
//焦点事件 |
|
7744 |
// $(".errorItemCss").unbind('focus'); |
|
7745 |
// $(".errorItemCss").on('focus', function() { |
|
7746 |
// $(this).removeClass("errorItemCss"); |
|
7747 |
// ////////////console.log($(this)[0].id); |
|
7748 |
// $("#"+$(this)[0].id+"mesageErrDiv").remove(); |
|
7749 |
// $(".customViewUEditorCss #"+$(this)[0].id).popover('hide') |
|
7750 |
// }); |
|
7751 |
// //下拉列表点击事件 |
|
7752 |
// $(".select2-search__field").unbind("focus"); |
|
7753 |
// $(".select2-search__field").bind("focus",function(){ |
|
7754 |
// var id = this.getAttribute("errorItemId"); |
|
7755 |
// var N = this.getAttribute("N"); |
|
7756 |
// $($('.customViewUEditorCss #'+id)[N].parentNode).find(".select2").removeClass("errorItemCss"); |
|
7757 |
// $("#"+id+"mesageErrDiv").remove(); |
|
7758 |
// $($(".customViewUEditorCss #"+id)[N]).popover('hide') |
|
7759 |
// }); |
|
7760 |
|
|
7761 |
if (mustcheck) { return true; } |
|
7762 |
|
|
7763 |
//单选按钮长度验证 |
|
7764 |
|
|
7765 |
//焦点事件 |
|
7766 |
// $(".errorItemCss").unbind(); |
|
7767 |
// $(".errorItemCss").on('focus', function() { |
|
7768 |
// $(this).removeClass("errorItemCss"); |
|
7769 |
// }); |
|
7770 |
return false; |
|
7771 |
} |
|
7772 |
|
|
7773 |
//检证验证 |
|
7774 |
customShow.interfaceCheck = function (items) {//保存前计算费用 李伟民 10 - 31 |
|
7775 |
var flag = true; |
|
7776 |
_.each(customBase.interfaceData, function (intdata) { |
|
7777 |
var func = intdata.customInterfacemethod + "()"; |
5a4f8f
|
7778 |
if(intdata.interfacemethod == 'fromSave3rd'){//只执行保存接口事件 |
L |
7779 |
try {//解决不上传资源文件JS报错 导致无法保存 李伟民 0129 |
|
7780 |
var thisChheck = eval(func); |
|
7781 |
console.log(thisChheck); |
|
7782 |
if (thisChheck == false) { |
|
7783 |
flag = false; |
|
7784 |
} |
|
7785 |
} catch (error) { |
13ec33
|
7786 |
|
5a4f8f
|
7787 |
} |
4d1219
|
7788 |
} |
B |
7789 |
}); |
|
7790 |
return flag; |
|
7791 |
}//保存前计算费用 李伟民 10 - 31 |
|
7792 |
|
|
7793 |
//错误信息 |
|
7794 |
customShow.showErrorItem = function (errorClass, tag_Type, id, N) { |
|
7795 |
if (tag_Type == "text" || tag_Type == "textarea" || tag_Type == "number" || tag_Type == "calendar" |
|
7796 |
|| tag_Type == "checkbox") { |
|
7797 |
$($(".customViewUEditorCss #" + id)[N]).addClass(errorClass); |
|
7798 |
} else if (tag_Type == "htmlediter") { |
|
7799 |
// $(".customViewUEditorCss #"+id+"Item").addClass(errorClass); |
|
7800 |
UE.getEditor(id + "Item").body.setAttribute("class", errorClass); |
|
7801 |
if (UE.getEditor(id + "Item").body.getAttribute("heightFlag") == "height") { |
|
7802 |
} else { |
|
7803 |
var height = UE.getEditor(id + "Item").body.style.height.replace("px", ""); |
|
7804 |
height = parseInt(height) - 12; |
|
7805 |
UE.getEditor(id + "Item").body.style.height = height + "px"; |
|
7806 |
UE.getEditor(id + "Item").body.setAttribute("id", id); |
|
7807 |
} |
|
7808 |
UE.getEditor(id + "Item").body.setAttribute("heightFlag", height); |
|
7809 |
|
|
7810 |
// //////////console.log(UE.getEditor(id+"Item").body.style.height = ); |
|
7811 |
} else if (tag_Type == "dropdownlist") { |
|
7812 |
// $(".customViewUEditorCss #"+id).p + ".selection").addClass(errorClass); |
|
7813 |
// //////////console.log($('.customViewUEditorCss #'+id)[0].parentNode); |
|
7814 |
$($('.customViewUEditorCss #' + id)[N].parentNode).find(".select2").addClass(errorClass); |
|
7815 |
// $(".customViewUEditorCss #"+id+" .select2-search__field") |
|
7816 |
if ($($('.customViewUEditorCss #' + id)[N].parentNode).find(".select2-search__field").length > 0) { |
|
7817 |
$($('.customViewUEditorCss #' + id)[N].parentNode).find(".select2-search__field")[0].setAttribute("errorItemId", id); |
|
7818 |
$($('.customViewUEditorCss #' + id)[N].parentNode).find(".select2-search__field")[0].setAttribute("N", N); |
|
7819 |
} |
|
7820 |
} |
|
7821 |
} |
|
7822 |
|
|
7823 |
//画面属性设定(初始值 表示/非表示 只读 必须 审查必须) |
|
7824 |
customShow.setShowAttribute = function (aliasItem) { |
|
7825 |
console.log(aliasItem) |
|
7826 |
// 12/7 不可编辑 可以编辑 |
|
7827 |
id = aliasItem.id; |
|
7828 |
//表示非表示 |
|
7829 |
if (aliasItem.visible) { |
|
7830 |
$(".customViewUEditorCss #" + id).removeClass("cfg_contentNone"); |
|
7831 |
$(".customViewUEditorCss #" + id + "ActiveId").removeClass("cfg_contentNone"); |
|
7832 |
$(".customViewUEditorCss ." + id + "IconShow").removeClass("cfg_contentNone"); |
|
7833 |
$(".customViewUEditorCss #" + id + "Item").removeClass("cfg_contentNone"); |
|
7834 |
if (customShow.options.customItemShow.customFlag == "1" && aliasItem.type == "dropdownlist") { |
|
7835 |
$($(".customViewUEditorCss #" + id)[0].parentNode).removeClass("cfg_contentNone"); |
|
7836 |
} |
|
7837 |
} else if (!aliasItem.visible) { |
|
7838 |
$(".customViewUEditorCss #" + id).addClass("cfg_contentNone"); |
|
7839 |
$(".customViewUEditorCss #" + id + "ActiveId").addClass("cfg_contentNone"); |
|
7840 |
$(".customViewUEditorCss ." + id + "IconShow").addClass("cfg_contentNone"); |
|
7841 |
$(".customViewUEditorCss #" + id + "Item").addClass("cfg_contentNone"); |
|
7842 |
if (customShow.options.customItemShow.customFlag == "1" && aliasItem.type == "dropdownlist") { |
|
7843 |
$($(".customViewUEditorCss #" + id)[0].parentNode).addClass("cfg_contentNone"); |
|
7844 |
} |
|
7845 |
} |
|
7846 |
//必须 |
|
7847 |
if (aliasItem.mustcheck) { |
|
7848 |
$(".customViewUEditorCss ." + id + "IconShow .iconMustcheck").removeClass("cfg_contentNone"); |
|
7849 |
} else if (!aliasItem.mustcheck) { |
|
7850 |
$(".customViewUEditorCss ." + id + "IconShow .iconMustcheck").addClass("cfg_contentNone"); |
|
7851 |
} |
|
7852 |
//审查必须 |
|
7853 |
if (aliasItem.approvalmustenter) { |
|
7854 |
$(".customViewUEditorCss ." + id + "IconShow .iconApprovalmustenter").removeClass("cfg_contentNone"); |
|
7855 |
} else if (!aliasItem.approvalmustenter) { |
|
7856 |
$(".customViewUEditorCss ." + id + "IconShow .iconApprovalmustenter").addClass("cfg_contentNone"); |
|
7857 |
} |
|
7858 |
|
|
7859 |
//编辑-非编辑 |
|
7860 |
var itemTemp = $($(".customViewUEditorCss #" + id)[0]); |
|
7861 |
var tag_Type = aliasItem.type; |
|
7862 |
if (aliasItem.editable) { |
|
7863 |
if (tag_Type == "text" || tag_Type == "textarea" || tag_Type == "number" || tag_Type == "calendar") {//--OK |
|
7864 |
itemTemp.removeAttr('readonly'); |
|
7865 |
// 非编辑情况移除背景颜色 12/7 李元杰 |
|
7866 |
for (var i = 0; i < itemTemp.length; i++) { |
|
7867 |
console.log(itemTemp[i]); |
|
7868 |
$(itemTemp[i]).removeClass('disableColor') |
|
7869 |
} |
|
7870 |
if (tag_Type == "calendar") { |
|
7871 |
var calendarItem = customShow.options.customItemShow.item[id]; |
|
7872 |
// var editable = tag_Attribute['editable']; |
|
7873 |
var textformat = calendarItem.tag_Attribute.datatype; |
|
7874 |
if (textformat == 'Y') { |
|
7875 |
$(itemTemp).addClass('dateFromyyyy'); |
|
7876 |
} else if (textformat == 'Y-m') { |
|
7877 |
$(itemTemp).addClass('dateFromyyyymm'); |
|
7878 |
} else if (textformat == 'Y-m-d') { |
|
7879 |
$(itemTemp).addClass('dateFromyyyymmdd'); |
|
7880 |
} else if (textformat == 'Y-m-d H:i') { |
|
7881 |
$(itemTemp).addClass('dateFromhhmiss'); |
|
7882 |
} |
|
7883 |
customShow.clickBindSubform(); |
|
7884 |
|
|
7885 |
} |
|
7886 |
} else if (tag_Type == "radio") {//---------------------------------------------------------- |
|
7887 |
itemTemp.find('.custom-radio').removeAttr("readonly"); |
|
7888 |
} else if (tag_Type == "radio") {//---------------------------------------------------------- |
|
7889 |
itemTemp.find('.custom-radio').removeAttr("readonly"); |
|
7890 |
} else if (tag_Type == "checkbox") {//------------------------------------------------------- |
|
7891 |
itemTemp.find('.custom-check').removeAttr("readonly"); |
|
7892 |
} else if (tag_Type == "dropdownlist") {//---------------------------------------------------OK |
|
7893 |
// $(itemTemp).removeClass('editableDisabled'); |
|
7894 |
// $(itemTemp).prop("disabled", false); //设置下拉框不可用 |
|
7895 |
// $(itemTemp).find(".select-container").removeAttr("readonly"); |
|
7896 |
$(itemTemp).removeClass("disableColor"); |
|
7897 |
|
|
7898 |
$(itemTemp).removeClass("readonly"); |
|
7899 |
// ////console.log($(itemTemp).find(".select-container")); |
|
7900 |
} else if (tag_Type == "button") {//---------------------------------------------------------OK |
|
7901 |
$(itemTemp).removeClass('disabled'); |
|
7902 |
} else if (tag_Type == "link") {//-----------------------------------------------------------OK |
|
7903 |
itemTemp.href = "javascript:void(0);"; |
|
7904 |
itemTemp.removeAttr('disabled', 'disabled'); |
|
7905 |
} else if (tag_Type == "fileupload") {//----------------------------------------------------todo |
|
7906 |
} else if (tag_Type == "tree") {//----------------------------------------------------------todo |
|
7907 |
$(itemTemp).parent().find('.citySel').removeClass('disableColor') |
|
7908 |
|
|
7909 |
// var itemTemp = $("#customResultFormDiv").find("#"+tag_Id)[0]; |
|
7910 |
itemTemp[0].setAttribute('editable', aliasItem.editable); |
|
7911 |
} |
|
7912 |
// else if (tag_Type == "tree" || tag_Type == "tree" || tag_Type == "tree") { |
|
7913 |
// // var itemTemp = $("#customResultFormDiv").find("#"+tag_Id)[0]; |
|
7914 |
// itemTemp.setAttribute('editable', aliasItem.editable); |
|
7915 |
// } |
|
7916 |
|
|
7917 |
} else if (!aliasItem.editable) { |
|
7918 |
if (tag_Type == "text" || tag_Type == "textarea" || tag_Type == "number" || tag_Type == "calendar") {//--OK |
|
7919 |
for (var i = 0; i < itemTemp.length; i++) { |
|
7920 |
// 12/7 李元杰 添加背景颜色 |
|
7921 |
console.log(itemTemp[i]); |
|
7922 |
itemTemp[i].setAttribute('readonly', ''); |
|
7923 |
$(itemTemp[i]).addClass('disableColor') |
|
7924 |
} |
|
7925 |
if (tag_Type == "calendar") { |
|
7926 |
// $('.dateFromyyyy').unbind(); |
|
7927 |
// $('.dateFromyyyymm').unbind(); |
|
7928 |
// $('.dateFromyyyymmdd').unbind(); |
|
7929 |
// $('.dateFromhhmiss').unbind(); |
|
7930 |
itemTemp.removeClass('dateFromyyyy'); |
|
7931 |
itemTemp.removeClass('dateFromyyyymm'); |
|
7932 |
itemTemp.removeClass('dateFromyyyymmdd'); |
|
7933 |
itemTemp.removeClass('dateFromhhmiss'); |
|
7934 |
////////console.log(itemTemp); |
|
7935 |
var itemDateFromTemp = itemTemp[0].cloneNode(true); |
|
7936 |
var $DateFromTemp = "<div id='itemDateFromTemp'></div>" |
|
7937 |
itemTemp.after($DateFromTemp); |
|
7938 |
itemTemp.remove(); |
|
7939 |
var DateFromTemp = $("#itemDateFromTemp")[0]; |
|
7940 |
DateFromTemp.after(itemDateFromTemp); |
|
7941 |
DateFromTemp.remove(); |
|
7942 |
customShow.clickBindSubform(); |
|
7943 |
} |
|
7944 |
} else if (tag_Type == "radio") {//----------------------------------------------------------todo |
|
7945 |
|
|
7946 |
// setTimeout(function(){ |
|
7947 |
itemTemp.find('.custom-radio').addClass("readonly"); |
|
7948 |
// },0) |
|
7949 |
} else if (tag_Type == "checkbox") {//-------------------------------------------------------todo |
|
7950 |
itemTemp.find('.custom-check').addClass("readonly"); |
|
7951 |
} else if (tag_Type == "dropdownlist") {//---------------------------------------------------OK |
|
7952 |
// $(itemTemp).addClass('editableDisabled'); |
|
7953 |
// $(itemTemp).prop("disabled", true); //设置下拉框不可用 |
|
7954 |
// ////console.log($(itemTemp).find(".select-container")); |
|
7955 |
// itemTemp = $(itemTemp).find(".select-container"); |
|
7956 |
// for(var i = 0 ;i<itemTemp.length;i++){ |
|
7957 |
// itemTemp[i].setAttribute('readonly',''); |
|
7958 |
// } |
|
7959 |
console.log($(itemTemp)) |
|
7960 |
$(itemTemp).find('.select-container_box').addClass('disableColor') |
|
7961 |
$(itemTemp).addClass("readonly"); |
|
7962 |
////console.log( $(itemTemp)); |
|
7963 |
} else if (tag_Type == "button") {//---------------------------------------------------------OK |
|
7964 |
$(itemTemp).addClass('disabled'); |
|
7965 |
} else if (tag_Type == "link") {//-----------------------------------------------------------OK |
|
7966 |
itemTemp.href = "javascript:void(0);"; |
|
7967 |
debugger |
|
7968 |
for (var i; i < itemTemp.length; i++) { |
|
7969 |
itemTemp[i].setAttribute('disabled', 'disabled'); |
|
7970 |
} |
|
7971 |
} else if (tag_Type == "fileupload") {//----------------------------------------------------todo |
|
7972 |
console.log($(itemTemp)); |
|
7973 |
debugger |
|
7974 |
} else if (tag_Type == "tree") {//----------------------------------------------------------todo |
|
7975 |
// 禁用背景颜色 |
|
7976 |
console.log($(itemTemp).parents('div[name="TreeWin"]')) |
|
7977 |
console.log($(itemTemp)) |
|
7978 |
|
|
7979 |
itemTemp[0].setAttribute('editable', aliasItem.editable); |
|
7980 |
} |
|
7981 |
// else if (tag_Type == "tree" || tag_Type == "tree" || tag_Type == "tree") { |
|
7982 |
// // var itemTemp = $("#customResultFormDiv").find("#"+tag_Id)[0]; |
|
7983 |
// console.log($(itemTemp)) |
|
7984 |
// itemTemp.setAttribute('editable', aliasItem.editable); |
|
7985 |
// } |
|
7986 |
} |
|
7987 |
} |
|
7988 |
//错误信息显示 |
|
7989 |
customShow.setShowMesageErr = function (id, message, N, type) { |
|
7990 |
console.log("setShowMesageErr"); |
|
7991 |
console.log(message); |
|
7992 |
////console.log(id); |
5a4f8f
|
7993 |
var mesageHtml = '<div class="' + id + 'Popover"></div>'; |
4d1219
|
7994 |
if (customShow.options.customInit.designMode == "1") { |
B |
7995 |
////console.log(id); |
|
7996 |
////console.log(message); |
|
7997 |
////console.log(N); |
|
7998 |
////console.log($($(".customViewUEditorCss #"+id)[N])); |
|
7999 |
// $($(".customViewUEditorCss #"+id)[N]).popover('hide'); |
a36c19
|
8000 |
// if($($(".customViewUEditorCss #" + id)[N]).attr('popoverFalg') != undefined){ |
L |
8001 |
// $('.' + id + 'Popover').html(message); |
|
8002 |
// } |
4d1219
|
8003 |
$($(".customViewUEditorCss #" + id)[N]).attr('popoverFalg','true'); |
B |
8004 |
$($(".customViewUEditorCss #" + id)[N]).popover({ |
|
8005 |
// title:"错误信息", |
|
8006 |
html: true, |
a36c19
|
8007 |
content: mesageHtml, |
4d1219
|
8008 |
trigger: 'manual' |
B |
8009 |
}); |
|
8010 |
$($(".customViewUEditorCss #" + id)[N]).hover(function(){// 普通模式 错误提示修改 李伟民 0125 |
|
8011 |
if($($(".customViewUEditorCss #" + id)[N]).attr('popoverFalg') != 'false'){ |
|
8012 |
$($(".customViewUEditorCss #" + id)[N]).popover('show'); |
a36c19
|
8013 |
$('.' + id + 'Popover').html(message); |
4d1219
|
8014 |
} |
B |
8015 |
},function(){ |
|
8016 |
$($(".customViewUEditorCss #" + id)[N]).popover('hide'); |
|
8017 |
}) |
|
8018 |
$($(".customViewUEditorCss #" + id)[N]).on('focus',function(){ |
|
8019 |
$($(".customViewUEditorCss #" + id)[N]).attr('popoverFalg','false'); |
|
8020 |
$($(".customViewUEditorCss #" + id)[N]).popover('hide'); |
|
8021 |
}) |
|
8022 |
$($(".customViewUEditorCss #" + id)[N]).popover('show'); |
a36c19
|
8023 |
$('.' + id + 'Popover').html(message); |
4d1219
|
8024 |
setTimeout(function(){ |
B |
8025 |
$($(".customViewUEditorCss #" + id)[N]).popover('hide'); |
|
8026 |
},2000) |
|
8027 |
customShow.options.showErrId[id] = N; |
|
8028 |
//////console.log($($(".customViewUEditorCss #"+id+"Item")[N]).length); |
13ec33
|
8029 |
|
4d1219
|
8030 |
if ($($(".customViewUEditorCss #" + id + "Item")[N]).length == 1) { |
B |
8031 |
$($(".customViewUEditorCss #" + id + "Item")[N]).attr('popoverFalg','true'); |
|
8032 |
$($(".customViewUEditorCss #" + id + "Item")[N]).popover({ |
|
8033 |
// title:"错误信息", |
|
8034 |
html: true, |
a36c19
|
8035 |
content: mesageHtml, |
4d1219
|
8036 |
trigger: 'manual' |
B |
8037 |
}); |
|
8038 |
$($(".customViewUEditorCss #" + id + "Item")[N]).popover('show'); |
a36c19
|
8039 |
$('.' + id + 'Popover').html(message); |
4d1219
|
8040 |
setTimeout(function(){ |
B |
8041 |
$($(".customViewUEditorCss #" + id + "Item")[N]).popover('hide'); |
|
8042 |
},2000) |
|
8043 |
customShow.options.showErrId[id + "Item"] = N; |
|
8044 |
$($(".customViewUEditorCss #" + id + "Item")[N]).hover(function(){ |
|
8045 |
if($($(".customViewUEditorCss #" + id + "Item")[N]).attr('popoverFalg') != 'false'){ |
|
8046 |
$($(".customViewUEditorCss #" + id + "Item")[N]).popover('show'); |
a36c19
|
8047 |
$('.' + id + 'Popover').html(message); |
4d1219
|
8048 |
} |
B |
8049 |
},function(){ |
|
8050 |
$($(".customViewUEditorCss #" + id + "Item")[N]).popover('hide'); |
|
8051 |
}) |
|
8052 |
$($(".customViewUEditorCss #" + id + "Item")[N]).on('focus',function(){ |
|
8053 |
$($(".customViewUEditorCss #" + id + "Item")[N]).attr('popoverFalg','false'); |
|
8054 |
$($(".customViewUEditorCss #" + id + "Item")[N]).popover('hide'); |
|
8055 |
})// 普通模式 错误提示修改 李伟民 0125 |
|
8056 |
} |
13ec33
|
8057 |
|
4d1219
|
8058 |
} else { |
B |
8059 |
var mesageErrDiv = document.createElement("div"); |
|
8060 |
mesageErrDiv.setAttribute("class", "mesageErrDiv"); |
|
8061 |
mesageErrDiv.setAttribute("id", id + "mesageErrDiv"); |
|
8062 |
if(type){//验证消息 修改 李伟民 |
|
8063 |
$(mesageErrDiv).addClass("checkErr"); |
|
8064 |
}//验证消息 修改 李伟民 |
|
8065 |
$(mesageErrDiv).append(message); |
|
8066 |
var tempActiveId = $($(".customViewUEditorCss #" + id + "ActiveId")[N]).find("#" + id + "mesageErrDiv"); |
|
8067 |
$($(".customViewUEditorCss #" + id + "ActiveId")[N]).find("#" + id + "mesageErrDiv").remove(); |
|
8068 |
// if(tempActiveId.length == 0){ |
|
8069 |
// if($($(".customViewUEditorCss #"+id+"ActiveId")[N]).length !=0){ |
|
8070 |
//2017/10/23 李元杰 必选的提示信息修改 |
|
8071 |
var requiredHint = $($($(".customViewUEditorCss #" + id + "ActiveId")[N])[0]); |
|
8072 |
if (requiredHint.find('input').val() === '') { |
|
8073 |
if ($(".customViewUEditorCss #" + id + "ActiveId").length == 0) { |
|
8074 |
console.log($(".customViewUEditorCss [id='" + id + "']:eq(" + N + ")").closest("td")); |
|
8075 |
$(".customViewUEditorCss [id='" + id + "']:eq(" + N + ")").closest("td").append(mesageErrDiv); |
|
8076 |
} else { |
|
8077 |
$($($(".customViewUEditorCss #" + id + "ActiveId")[N])[0]).append(mesageErrDiv); |
|
8078 |
} |
|
8079 |
$(mesageErrDiv).html(requiredHint.children('h8').children('span').html() + "必须输入") |
|
8080 |
} else { |
|
8081 |
if ($(".customViewUEditorCss #" + id + "ActiveId").length == 0) { |
|
8082 |
console.log($(".customViewUEditorCss [id='" + id + "']:eq(" + N + ")").closest("td")); |
|
8083 |
if ($(".customViewUEditorCss [id='" + id + "']:eq(" + N + ")").closest("td").find(".mesageErrDiv").length == 0) { |
|
8084 |
$(".customViewUEditorCss [id='" + id + "']:eq(" + N + ")").closest("td").append(mesageErrDiv); |
|
8085 |
} |
|
8086 |
} else { |
|
8087 |
if ($($($(".customViewUEditorCss #" + id + "ActiveId")[N])[0]).find(".mesageErrDiv").length == 0) { |
|
8088 |
$($($(".customViewUEditorCss #" + id + "ActiveId")[N])[0]).append(mesageErrDiv); |
|
8089 |
} |
|
8090 |
} |
|
8091 |
} |
|
8092 |
// $(mesageErrDiv).html(requiredHint.children('h8').children('span').html() + "必须输入") |
|
8093 |
// } |
|
8094 |
// } |
|
8095 |
|
|
8096 |
|
|
8097 |
} |
|
8098 |
|
|
8099 |
} |
|
8100 |
|
|
8101 |
//DB数据to画面表示数据转化 |
|
8102 |
customShow.dbItemToShowItem = function (itemId, type, value, showClass, dropdowntype, parentsubFormNum) { |
|
8103 |
if (type == "radio" || type == "checkbox") { |
|
8104 |
var itemL = $("." + showClass + " ." + itemId + "value"); |
|
8105 |
//数值变换 |
|
8106 |
//单选按钮,仅仅有一项情况(无子表单时) |
|
8107 |
if (type == "radio" && itemL.length == 1) { |
|
8108 |
if (parentsubFormNum != 0) { |
|
8109 |
value = value[0]; |
|
8110 |
} |
|
8111 |
value = [[value]]; |
|
8112 |
} else if (type == "checkbox" && itemL.length == 1) { |
|
8113 |
//复选框时,仅仅有一项情况(无子表单时) |
|
8114 |
//只选择一项 |
|
8115 |
if (parentsubFormNum != 0) { |
|
8116 |
value = value[0]; |
|
8117 |
} |
|
8118 |
if (typeof value == "string") { |
|
8119 |
value = [[value]]; |
|
8120 |
} else { |
|
8121 |
//复数项选择 |
|
8122 |
value = [value]; |
|
8123 |
} |
|
8124 |
} else if (type == "radio" && itemL.length > 1) { |
|
8125 |
// |
|
8126 |
var valueTempRadio = []; |
|
8127 |
for (var i = 0; i < value.length; i++) { |
|
8128 |
valueTempRadio[i] = [value[i]]; |
|
8129 |
} |
|
8130 |
value = valueTempRadio; |
|
8131 |
} else if (type == "checkbox" && itemL.length > 1) { |
|
8132 |
var valueTempRadio = []; |
|
8133 |
for (var i = 0; i < value.length; i++) { |
|
8134 |
if (typeof value[i] == "string") { |
|
8135 |
valueTempRadio[i] = [value[i]]; |
|
8136 |
} else { |
|
8137 |
valueTempRadio[i] = value[i]; |
|
8138 |
} |
|
8139 |
} |
|
8140 |
value = valueTempRadio; |
|
8141 |
} |
|
8142 |
} else if (type == "dropdownlistText") { |
|
8143 |
|
|
8144 |
//多个下拉菜单 |
|
8145 |
var itemList = $("." + showClass + " ." + itemId + "value"); |
|
8146 |
if (itemList.length == 1) { |
|
8147 |
if (parentsubFormNum != 0) { |
|
8148 |
value = value[0]; |
|
8149 |
} |
|
8150 |
if (typeof value == "string" && dropdowntype == "single") { |
|
8151 |
value = [value]; |
|
8152 |
} |
|
8153 |
//子表单中,复选情况 |
|
8154 |
if (dropdowntype == "multiple") { |
|
8155 |
if (typeof value == "string") { |
|
8156 |
value = [value]; |
|
8157 |
} else { |
|
8158 |
// value = value[0]; |
|
8159 |
} |
|
8160 |
} |
|
8161 |
// setelect2Item(itemList[0],value); |
|
8162 |
} else { |
|
8163 |
for (var i = 0; i < itemList.length; i++) { |
|
8164 |
// var valueTemp; |
|
8165 |
//单选时,多文件 |
|
8166 |
if (dropdowntype == "single") { |
|
8167 |
value[i] = [value[i]]; |
|
8168 |
} else { |
|
8169 |
// for (var i = 0; i < value[i].length; i++) { |
|
8170 |
if (typeof value[i] == "string") { |
|
8171 |
value[i] = [value[i]]; |
|
8172 |
} else { |
|
8173 |
value[i] = value[i]; |
|
8174 |
} |
|
8175 |
// } |
|
8176 |
} |
|
8177 |
// setelect2Item(itemList[i],valueTemp); |
|
8178 |
} |
|
8179 |
} |
|
8180 |
} |
|
8181 |
return value; |
|
8182 |
} |
|
8183 |
|
|
8184 |
//表示模式下,数据设定(单选 复选 下拉菜单) |
|
8185 |
customShow.setShowItem = function (itemId, type, value, flag) { |
|
8186 |
//被选择项目设定 |
|
8187 |
console.log(1) |
|
8188 |
// console.log(_.cloneDeep(itemId)) |
|
8189 |
// console.log(_.cloneDeep(type)) |
|
8190 |
console.log(_.cloneDeep(value)) |
|
8191 |
// console.log(_.cloneDeep(flag)) |
|
8192 |
checkboxRadioShow = function (showItem, value) { |
|
8193 |
console.log($(showItem), value) |
|
8194 |
var listData = customBase.options.dropdownlistText[itemId]; |
|
8195 |
if (listData == undefined) { |
|
8196 |
return; |
|
8197 |
} |
|
8198 |
if (typeof value == "string") { |
|
8199 |
value = [value]; |
|
8200 |
// value = JSON.parse(value) |
|
8201 |
} |
|
8202 |
var temp = []; |
|
8203 |
var tempStr = ""; |
|
8204 |
console.log(listData); |
|
8205 |
console.log(value) |
|
8206 |
for (var i = 0; i < listData.length; i++) { |
|
8207 |
for (var j = 0; j < value.length; j++) { |
|
8208 |
if (value[j] == listData[i].value) { |
|
8209 |
console.log(1) |
|
8210 |
temp[j] = listData[i].text; |
|
8211 |
} |
|
8212 |
} |
|
8213 |
} |
|
8214 |
console.log(temp) |
|
8215 |
for (var i = 0; i < temp.length; i++) { |
|
8216 |
if (i == 0) { |
|
8217 |
tempStr = temp[i]; |
|
8218 |
} else { |
|
8219 |
tempStr += "," + temp[i]; |
|
8220 |
} |
|
8221 |
} |
|
8222 |
console.log(tempStr) |
|
8223 |
$(showItem).empty(); |
|
8224 |
//console.log(tempStr); |
|
8225 |
$(showItem).append(tempStr); |
|
8226 |
|
|
8227 |
} |
|
8228 |
var showItem = $("." + itemId + "_showItem"); |
|
8229 |
console.log(showItem) |
|
8230 |
//页面返回 |
|
8231 |
if (flag) { |
|
8232 |
if (type == "checkbox" || type == "radio") { |
|
8233 |
if (showItem.length == 1) { |
|
8234 |
checkboxRadioShow(showItem[0], value); |
|
8235 |
} else { |
|
8236 |
for (var i = 0; i < showItem.length; i++) { |
|
8237 |
checkboxRadioShow(showItem[i], value[i]); |
|
8238 |
} |
|
8239 |
} |
|
8240 |
} else { |
|
8241 |
if (showItem.length == 1) { |
|
8242 |
checkboxRadioShow(showItem[0], value); |
|
8243 |
} else { |
|
8244 |
for (var i = 0; i < showItem.length; i++) { |
|
8245 |
checkboxRadioShow(showItem[i], value[i]); |
|
8246 |
} |
|
8247 |
} |
|
8248 |
} |
|
8249 |
} else { |
|
8250 |
if (type == "checkbox" || type == "radio") { |
|
8251 |
for (var i = 0; i < showItem.length; i++) { |
|
8252 |
var valueTemp = value[i]; |
|
8253 |
checkboxRadioShow(showItem[i], valueTemp); |
|
8254 |
} |
|
8255 |
} else { |
|
8256 |
if (showItem.length == 1) { |
|
8257 |
checkboxRadioShow(showItem[0], value); |
|
8258 |
} else { |
|
8259 |
for (var i = 0; i < showItem.length; i++) { |
|
8260 |
checkboxRadioShow(showItem[i], value[i]); |
|
8261 |
} |
|
8262 |
} |
|
8263 |
} |
|
8264 |
} |
|
8265 |
} |
|
8266 |
|
|
8267 |
//工具栏设定button |
|
8268 |
customShow.setToolBtn = function (btns) { |
|
8269 |
console.log(btns) |
|
8270 |
$(".edit-pane").empty(); |
|
8271 |
var $editPaneBtn = $($(".edit-pane")[0]); |
|
8272 |
|
|
8273 |
console.log($editPaneBtn) |
|
8274 |
// //////console.log(btns); |
|
8275 |
for (var i = 0; i < btns.length; i++) { |
|
8276 |
if (customShow.button[btns[i]].functionName == "") { |
|
8277 |
$a = '<a id="' + btns[i] + '" href="javascript:void(0);">' + |
|
8278 |
'<i class="icon-flow-edit"></i><span style="color:#ff0000"><i class="' + customShow.button[btns[i]].cssName + '" style="text-align: left;color:#ff0000"></i>' + customShow.button[btns[i]].name + '</span></a>'; |
|
8279 |
} else { |
|
8280 |
$a = '<a id="' + btns[i] + '" href="javascript:void(0);" onclick="' + customShow.button[btns[i]].functionName + '()">' + |
|
8281 |
'<i class="icon-flow-edit"></i><span><i class="' + customShow.button[btns[i]].cssName + '" style="text-align: left;"></i>' + customShow.button[btns[i]].name + '</span></a>'; |
|
8282 |
} |
|
8283 |
if (customShow.getFormSetting(btns[i]) != 0) { |
|
8284 |
$editPaneBtn.prepend($a); |
|
8285 |
} |
|
8286 |
|
|
8287 |
} |
|
8288 |
if (btns.length > 0) { |
|
8289 |
// $(".preview-edit-pane").css("display", "block"); |
|
8290 |
} |
|
8291 |
} |
|
8292 |
|
|
8293 |
customShow.setTextBtn = function () { |
|
8294 |
var item = customShow.options.customItemShow.item["itemId_1"]; |
|
8295 |
var code = item.tag_Attribute.masterData; |
|
8296 |
var masterData = $.parseJSON(code); |
|
8297 |
var defindCode = masterData.defindCode; |
|
8298 |
var eleCode = masterData.eleCode; |
|
8299 |
customLinkageAnalysis.getElement("itemId_1", eleCode, function (re) { |
|
8300 |
////////console.log(re); |
|
8301 |
}) |
|
8302 |
} |
|
8303 |
|
|
8304 |
//主数据重复 |
|
8305 |
customShow.setXhSelectList = function (addflag) { |
|
8306 |
// console.log(1) |
|
8307 |
var subformDList = customShow.options.subformDList; |
|
8308 |
//console.log(subformDList); |
|
8309 |
//console.log(85244445) |
|
8310 |
//console.log(addflag) |
|
8311 |
var setValueItem = {}; |
|
8312 |
// |
|
8313 |
//var subArr = []; |
|
8314 |
//_.each(subformDList,opt=>{ |
|
8315 |
// subArr.push(opt); |
|
8316 |
//}) |
|
8317 |
//var subObj = {}; |
|
8318 |
//for(var key in subformDList){ |
|
8319 |
// if(subformDList[key] == _.last(subArr)){ |
|
8320 |
// subObj[key] = subformDList[key]; |
|
8321 |
// } |
|
8322 |
//} |
|
8323 |
//console.log(_.cloneDeep(subObj)); |
|
8324 |
for (var id in subformDList) { |
|
8325 |
console.log(id); |
|
8326 |
if ($(".customViewUEditorCss ." + id).length == 1) { |
|
8327 |
var xhSelectTemp = { |
|
8328 |
selectId: customShow.options.subformDList[id].selectId, |
|
8329 |
multiple: customShow.options.subformDList[id].multiple, |
|
8330 |
width: customShow.options.subformDList[id].width, |
|
8331 |
listData: customBase.options.dropdownlistText[customShow.options.subformDList[id].selectId], |
|
8332 |
setDiv: id |
|
8333 |
}; |
|
8334 |
console.log(xhSelectTemp); |
|
8335 |
console.log(1) |
|
8336 |
xhSelect.setXhSelect(xhSelectTemp); |
|
8337 |
var item = customShow.options.customItemShow.item[customShow.options.subformDList[id].selectId]; |
|
8338 |
setValueItem[item.tag_Attribute.alias] = customShow.options.subformDList[id].selectId; |
|
8339 |
} |
|
8340 |
} |
|
8341 |
console.log(setValueItem); |
|
8342 |
console.log(customShow.options); |
|
8343 |
if (!addflag) { |
|
8344 |
for (var valueItem in setValueItem) { |
|
8345 |
var setList = customShow.options.subformDValue[valueItem]; |
|
8346 |
console.log(setList); |
|
8347 |
if (setList != undefined) { |
|
8348 |
for (var i = 0; i < setList.length; i++) { |
|
8349 |
xhSelect.setValue(setValueItem[valueItem], setList[i], i); |
|
8350 |
} |
|
8351 |
} |
|
8352 |
} |
|
8353 |
|
|
8354 |
} |
|
8355 |
} |
|
8356 |
//子表单添加记录 复制下拉框方法 2017/10/06 |
|
8357 |
customShow.setXhSelectListAdd = function () { |
|
8358 |
// //////console.log(table); |
|
8359 |
var subformDList = customShow.options.subformDList; |
|
8360 |
var setValueItem = {}; |
|
8361 |
//10/2/27 马习同修改 下拉框复制重复 |
|
8362 |
var xhSelectTemp = {}; |
|
8363 |
for (var id in subformDList) { |
|
8364 |
if ($(".customViewUEditorCss ." + id).length == 1) { |
|
8365 |
var xhSelectTemp = { |
|
8366 |
selectId: customShow.options.subformDList[id].selectId, |
|
8367 |
multiple: customShow.options.subformDList[id].multiple, |
|
8368 |
width: customShow.options.subformDList[id].width, |
|
8369 |
listData: customBase.options.dropdownlistText[customShow.options.subformDList[id].selectId], |
|
8370 |
setDiv: id |
|
8371 |
}; |
|
8372 |
// //////console.log($(".customViewUEditorCss ."+id).find('select > option')); |
|
8373 |
if ($(".customViewUEditorCss ." + id).find('select > option').length == 0) { |
|
8374 |
// //////console.log("----------------------------------------------"); |
|
8375 |
console.log(1) |
|
8376 |
xhSelect.setXhSelect(xhSelectTemp); |
|
8377 |
} |
|
8378 |
} |
|
8379 |
} |
|
8380 |
xhSelect.setXhSelect(xhSelectTemp); |
|
8381 |
//10/2/27 马习同修改 下拉框复制重复 |
|
8382 |
} |
|
8383 |
|
|
8384 |
|
|
8385 |
customShow.getFormSetting = function (btnFlag) { |
|
8386 |
var ren = 1; |
|
8387 |
if (btnFlag == 'printableBtn') { |
|
8388 |
ren = customShow.options.formsetting['printable']; |
|
8389 |
} else if (btnFlag == 'exportBtn') { |
|
8390 |
ren = customShow.options.formsetting['exportable']; |
|
8391 |
} else if (btnFlag == 'rejectBtn') { |
|
8392 |
ren = customShow.options.formsetting['rejectable']; |
|
8393 |
} else if (btnFlag == 'submitBtn') { |
|
8394 |
ren = customShow.options.formsetting['submitable']; |
|
8395 |
} else if (btnFlag == 'auditableBtn') { |
|
8396 |
ren = customShow.options.formsetting['auditable']; |
|
8397 |
} else if (btnFlag == 'queryBtn') { |
|
8398 |
ren = customShow.options.formsetting['queryable']; |
|
8399 |
} else if (btnFlag == 'createBtn') { |
|
8400 |
ren = customShow.options.formsetting['createable']; |
|
8401 |
} else if (btnFlag == 'clearBtn') { |
|
8402 |
// ren = customShow.options.formsetting['clearable']; |
|
8403 |
ren = 1; |
|
8404 |
} else if (btnFlag == 'disposableBtn') { |
|
8405 |
// ren = customShow.options.formsetting['disposable']; |
|
8406 |
ren = 1; |
0da79f
|
8407 |
//} else if (btnFlag == 'fromSaveBtn') { |
75eb92
|
8408 |
// if(customShow.options.customShowFlag != '3'){//发布修改 李伟民 0120 |
Z |
8409 |
// ren = customShow.options.formsetting['saveable']; |
|
8410 |
// console.log(ren) |
|
8411 |
// }else{ |
|
8412 |
// ren = 1; |
|
8413 |
// } |
4d1219
|
8414 |
// ren = 1; |
B |
8415 |
} else if (btnFlag == 'editableBtn') { |
66b6b8
|
8416 |
ren = customShow.options.formsetting['editableBtn'];//编辑按钮受权限控制 李伟民 0204 |
L |
8417 |
// ren = 1; |
4d1219
|
8418 |
} |
B |
8419 |
return ren; |
|
8420 |
|
|
8421 |
} |
|
8422 |
var customLinkageAnalysis = customLinkageAnalysis || {}; |
|
8423 |
//-----------------------------------------------------仲追加内容---------------------------------------------------------- |
|
8424 |
customLinkageAnalysis.options = {}; |
|
8425 |
//取得表单值 |
|
8426 |
/** |
|
8427 |
* 参数:ItemId 字段ID |
|
8428 |
* 返回值:值 |
|
8429 |
*/ |
|
8430 |
customLinkageAnalysis.getValue = function (itemId) { |
|
8431 |
var item = customShow.options.customItemShow.item[itemId]; |
|
8432 |
var alias = item.tag_Attribute.alias; |
|
8433 |
var items = customShow.getItems(); |
|
8434 |
var result = items[alias]; |
|
8435 |
|
|
8436 |
if (item.parentsubFormNum != 0) { |
|
8437 |
for (var ItemId in customShow.options.customItemShow.item) { |
|
8438 |
if (customShow.options.customItemShow.item[ItemId].columnOrderNum == item.parentsubFormNum) { |
|
8439 |
result = items[customShow.options.customItemShow.item[ItemId].tag_Attribute.alias]; |
|
8440 |
} |
|
8441 |
} |
|
8442 |
////console.log(result); |
|
8443 |
var resultTemp = ""; |
|
8444 |
|
|
8445 |
for (var i = 0; i < result.length; i++) { |
|
8446 |
if (i > 0) { |
|
8447 |
resultTemp += ","; |
|
8448 |
} |
|
8449 |
if (typeof result[i][alias] != "string") { |
|
8450 |
resultTemp += result[i][alias].join(','); |
|
8451 |
} else { |
|
8452 |
resultTemp += result[i][alias]; |
|
8453 |
} |
|
8454 |
|
|
8455 |
} |
|
8456 |
////console.log(resultTemp); |
|
8457 |
return resultTemp; |
|
8458 |
} else if (typeof result != "string") { |
|
8459 |
result = result.join(','); |
|
8460 |
} |
|
8461 |
////console.log(customShow); |
|
8462 |
////console.log(customLinkageAnalysis); |
|
8463 |
console.log(result); |
|
8464 |
return result; |
|
8465 |
} |
|
8466 |
|
|
8467 |
//设定表单值-------------------- |
|
8468 |
/** |
|
8469 |
* 参数:ItemId 字段ID |
|
8470 |
* value:设定值 |
|
8471 |
*/ |
|
8472 |
customLinkageAnalysis.setValue = function (itemId, value, num) { |
|
8473 |
console.log(itemId); |
|
8474 |
console.log(value); |
|
8475 |
var item = customShow.options.customItemShow.item[itemId]; |
|
8476 |
//数据类型 |
|
8477 |
var type = item.tag_Type; |
|
8478 |
if (type == "text" || type == "textarea" || |
|
8479 |
type == "number" || type == "calendar") { |
|
8480 |
customBase.setItemValue(itemId, "text", value, "", "", num); |
|
8481 |
} else if (type == "radio" || type == "checkbox") { |
|
8482 |
if (value.indexOf(",") != -1) { |
|
8483 |
value = value.split(","); |
|
8484 |
value = [value]; |
|
8485 |
} |
|
8486 |
customBase.setItemValue(itemId, type, value, "customViewUEditorCss"); |
|
8487 |
} else if (type == "dropdownlist") { |
|
8488 |
var dropdowntype = item.tag_Attribute.dropdowntype; |
|
8489 |
customBase.setItemValue(itemId, "dropdownlistText", value, "customViewUEditorCss", dropdowntype); |
|
8490 |
} else if (type == "htmlediter") { |
|
8491 |
var id = itemId + "Item"; |
|
8492 |
UE.getEditor(id).setContent(value); |
|
8493 |
} else if (type == "qrcode") { |
|
8494 |
var id = itemId + "qrcode"; |
|
8495 |
customBase.setItemValue(id, 'text', value, 'customViewUEditorCss'); |
|
8496 |
$("#" + id).blur(); |
|
8497 |
} else if (type == "barcode") { |
|
8498 |
var id = itemId + "barcode"; |
|
8499 |
customBase.setItemValue(id, 'text', value, 'customViewUEditorCss'); |
|
8500 |
$("#" + id).blur(); |
|
8501 |
} else if (type == "tree") { |
|
8502 |
|
|
8503 |
} else if (type == "amount") { |
|
8504 |
var id = itemId + "amount"; |
|
8505 |
customBase.setItemValue(id, 'text', value, 'customViewUEditorCss'); |
|
8506 |
$("#" + id).blur(); |
|
8507 |
} |
|
8508 |
|
|
8509 |
} |
|
8510 |
|
|
8511 |
//取得属性 |
|
8512 |
/** |
|
8513 |
* 参数:ItemId 字段ID |
|
8514 |
* attributeName:属性名 |
|
8515 |
* visible //可见 true:可见 false:不可见 |
|
8516 |
editable //可编辑 true:可编辑 false:不可编辑 |
|
8517 |
*/ |
|
8518 |
customLinkageAnalysis.getAttribut = function (itemId, attributeName) { |
|
8519 |
console.log(itemId); |
|
8520 |
console.log(attributeName) |
|
8521 |
var item = customShow.options.customItemShow.item[itemId]; |
|
8522 |
// return customLinkageAnalysis.validationEx(item.tag_Attribute.alias); |
|
8523 |
var alias = item.tag_Attribute.alias; |
|
8524 |
var ttn = customBase.options.customItems[alias][attributeName]; |
|
8525 |
////console.log(ttn) |
|
8526 |
return ttn; |
|
8527 |
} |
|
8528 |
|
|
8529 |
//设定属性---------------需要测试----- |
|
8530 |
/** |
|
8531 |
* 参数:ItemId 字段ID |
|
8532 |
* attributeName:属性名 |
|
8533 |
* visible //可见 true:可见 false:不可见 |
|
8534 |
editable //可编辑 true:可编辑 false:不可编辑 |
|
8535 |
*/ |
|
8536 |
customLinkageAnalysis.setAttribut = function (itemId, attributeName, attributeValue) { |
|
8537 |
var item = customShow.options.customItemShow.item[itemId]; |
|
8538 |
// return customLinkageAnalysis.validationEx(item.tag_Attribute.alias); |
|
8539 |
var alias = item.tag_Attribute.alias; |
|
8540 |
console.log(alias) |
|
8541 |
attributeValue = attributeValue + ""; |
|
8542 |
attributeValue = attributeValue.toLowerCase(); |
|
8543 |
if (attributeValue == "true") { |
|
8544 |
attributeValue = true; |
|
8545 |
} else if (attributeValue == "false") { |
|
8546 |
attributeValue = false; |
|
8547 |
} else { |
|
8548 |
//默认值 |
|
8549 |
attributeValue = true; |
|
8550 |
} |
|
8551 |
customBase.options.customItems[alias][attributeName] = attributeValue; |
|
8552 |
customShow.setShowAttribute(customBase.options.customItems[alias]); |
|
8553 |
} |
|
8554 |
|
|
8555 |
//设定错误信息 |
|
8556 |
/** |
|
8557 |
* 参数:ItemId 字段ID |
|
8558 |
* message:信息 |
|
8559 |
*/ |
|
8560 |
customLinkageAnalysis.setMessage = function (mode, ItemId, message, num) { |
|
8561 |
var item = customShow.options.customItemShow.item[ItemId]; |
|
8562 |
var type = item.tag_Type; |
|
8563 |
if (num == undefined) { |
|
8564 |
num = 0; |
|
8565 |
} |
|
8566 |
var errorClass; |
|
8567 |
if (mode == "0") {//验证消息 修改 李伟民 |
|
8568 |
errorClass = "errorCheckCss" |
|
8569 |
} else { |
|
8570 |
errorClass = "errorItemCss"; |
|
8571 |
}//验证消息 修改 李伟民 |
|
8572 |
customShow.showErrorItem(errorClass, type, ItemId, num); |
|
8573 |
//焦点事件 |
|
8574 |
// $("." + errorClass).unbind('focus'); |
|
8575 |
$("[id='" + ItemId + "']:eq(" + num + ")").unbind("focus"); |
|
8576 |
$("[id='" + ItemId + "']:eq(" + num + ")").on('focus', function () { |
|
8577 |
console.log("focus"); |
|
8578 |
$(this).removeClass(errorClass); |
|
8579 |
////////console.log($(this)[0].id); |
|
8580 |
$(this).closest("#" + $(this)[0].id + "ActiveId").find("[id='" + $(this)[0].id + "mesageErrDiv']").remove();//修改错误信息删除 李伟民 2017-10-18 14:15 |
|
8581 |
$(this).closest(".tdContentClass").find("[id='" + $(this)[0].id + "mesageErrDiv']").remove();//列表模式 |
|
8582 |
// $("#"+$(this)[0].id+"mesageErrDiv").remove(); |
|
8583 |
$(".customViewUEditorCss #" + $(this)[0].id).popover('hide') |
|
8584 |
}); |
|
8585 |
//下拉列表点击事件 |
|
8586 |
$(".select2-search__field").unbind("focus"); |
|
8587 |
$(".select2-search__field").bind("focus", function () { |
|
8588 |
var id = this.getAttribute("errorItemId"); |
|
8589 |
var N = this.getAttribute("N"); |
|
8590 |
$($('.customViewUEditorCss #' + id)[N].parentNode).find(".select2").removeClass(errorClass); |
|
8591 |
$("#" + id + "mesageErrDiv").remove(); |
|
8592 |
$($(".customViewUEditorCss #" + id)[N]).popover('hide') |
|
8593 |
}); |
|
8594 |
if (mode == "0") {//验证消息 修改 李伟民 |
|
8595 |
customShow.setShowMesageErr(ItemId, message, num, true); |
|
8596 |
} else { |
|
8597 |
customShow.setShowMesageErr(ItemId, message, num); |
|
8598 |
}//验证消息 修改 李伟民 |
13ec33
|
8599 |
|
4d1219
|
8600 |
} |
B |
8601 |
|
|
8602 |
//设定alert信息 |
|
8603 |
//参数:type类型 |
|
8604 |
// E:错误信息 |
|
8605 |
// I:信息 |
|
8606 |
// W:警告 |
|
8607 |
// S:成功 |
|
8608 |
// message:信息 |
|
8609 |
customLinkageAnalysis.alert = function (type, message) { |
|
8610 |
customBase.alert(type, message); |
|
8611 |
} |
|
8612 |
|
|
8613 |
|
|
8614 |
|
|
8615 |
// 初期调用 |
|
8616 |
customLinkageAnalysis.bindLinkage = function () { |
|
8617 |
// ////console.log(window.customBase); |
|
8618 |
//取得公式的JSON数据 |
|
8619 |
// ////console.log(customShow); |
|
8620 |
// ////console.log(customLinkageAnalysis); |
|
8621 |
var rules = customShow.options.jsonLinkage; |
|
8622 |
if (typeof rules == 'string') { |
|
8623 |
rules = eval(rules); |
|
8624 |
} |
|
8625 |
if (rules == null || rules.length == 0) { |
|
8626 |
return; |
|
8627 |
} |
|
8628 |
//初期接口 (false:不继续执行 true:继续执行) |
|
8629 |
// customShow.initEvent.interfaceInitLinkage; |
|
8630 |
|
|
8631 |
//取消接口 (false:不继续执行 true:继续执行) |
|
8632 |
// customShow.initEvent.cancelEventLinkage; |
|
8633 |
|
|
8634 |
//保存接口 (false:不继续执行 true:继续执行) |
|
8635 |
// customShow.initEvent.fromSaveLinkage; |
|
8636 |
for (var i = 0; i < rules.length; i++) { |
|
8637 |
//console.log(rules[i]); |
|
8638 |
var dofunction = {}; |
|
8639 |
try { |
|
8640 |
dofunction = customLinkageAnalysis.makeLinkage(rules[i]); |
|
8641 |
} catch (e) { |
|
8642 |
////console.log(e.message); |
|
8643 |
continue; |
|
8644 |
} |
|
8645 |
var allFunction = customLinkageAnalysis.changeDoFunction(dofunction); |
|
8646 |
var fieldId = rules[i].event.eventFieldId; |
|
8647 |
if (fieldId == "_body" && rules[i].event.doEvent == "loading") { |
|
8648 |
customShow.initEvent.interfaceInitLinkage = customLinkageAnalysis.bindFunctionEvent(allFunction.strFunction); |
|
8649 |
} else if (fieldId == "_body" && rules[i].event.doEvent == "commit") { |
|
8650 |
customShow.initEvent.fromSaveLinkage = customLinkageAnalysis.bindFunctionEvent(allFunction.strFunction); |
|
8651 |
} |
|
8652 |
var item = customShow.options.customItemShow.item[fieldId]; |
|
8653 |
if (item != undefined) { |
|
8654 |
var doEvent = rules[i].event.doEvent; |
|
8655 |
doEvent = doEvent.replace("selectedChange", "change"); |
|
8656 |
if (item.tag_Type == "radio" || item.tag_Type == "checkbox") { |
|
8657 |
doEvent = doEvent.replace("change", "click"); |
|
8658 |
} |
|
8659 |
if (item.tag_Type == "amount" || item.tag_Type == "qrcode" || item.tag_Type == "barcode") { |
|
8660 |
fieldId = fieldId + item.tag_Type; |
|
8661 |
} |
|
8662 |
if (item.tag_Type == "htmlediter") { |
|
8663 |
UE.getEditor(fieldId + "Item").onclick = function (event, ui) { |
|
8664 |
// eval(strFunction); |
|
8665 |
// ////console.log(UE.getEditor(fieldId+"Item").getContent()); |
|
8666 |
customLinkageAnalysis.options[fieldId + "Item"] = UE.getEditor(fieldId + "Item").getContent(); |
|
8667 |
} |
|
8668 |
UE.getEditor(fieldId + "Item").onblur = function (event, ui) { |
|
8669 |
//////console.log(UE.getEditor(fieldId+"Item").getContent()); |
|
8670 |
var fieldIdItem = UE.getEditor(fieldId + "Item").getContent(); |
|
8671 |
if (fieldIdItem != customLinkageAnalysis.options[fieldId + "Item"]) { |
|
8672 |
eval(allFunction.strFunction); |
|
8673 |
} |
|
8674 |
|
|
8675 |
} |
|
8676 |
////console.log(UE.getEditor(fieldId+"Item")); |
|
8677 |
} else if (item.tag_Type == "tree") { |
|
8678 |
customBase.options.zTreeOnClickItems[fieldId + "tree"] = allFunction.strFunction; |
|
8679 |
} else if (item.tag_Type == "radio" || item.tag_Type == "checkbox") { |
|
8680 |
|
|
8681 |
} else { |
|
8682 |
customLinkageAnalysis.bindEvent(fieldId, doEvent, allFunction); |
|
8683 |
} |
|
8684 |
|
|
8685 |
} |
|
8686 |
_.each(rules[i].results, function (ru) {// 自定义验证 为弹出消息控件绑定验证方法 李伟民 2017-10-18 15:09 |
|
8687 |
if ((ru.mode == "2" || ru.mode == "0") && rules[i].event.eventFieldId != ru.eventFieldId) {//判断是否为验证公式 判断触发控件与弹出消息控件是否为同一控件 |
|
8688 |
//console.log(ru); |
|
8689 |
customLinkageAnalysis.bindEvent(ru.eventFieldId, "blur", allFunction); |
|
8690 |
} |
|
8691 |
});// 自定义验证 为弹出消息控件绑定验证方法 李伟民 2017-10-18 15:09 end |
|
8692 |
} |
|
8693 |
} |
|
8694 |
|
|
8695 |
|
|
8696 |
// 子控件事件调用时 |
|
8697 |
customLinkageAnalysis.bindLinkageSubform = function (inType) { |
|
8698 |
//取得公式的JSON数据 |
|
8699 |
var rules = customShow.options.jsonLinkage; |
|
8700 |
if (typeof rules == 'string') { |
|
8701 |
rules = eval(rules); |
|
8702 |
} |
|
8703 |
if (rules == null || rules.length == 0) { |
|
8704 |
return; |
|
8705 |
} |
|
8706 |
// if("calendar" == inType){ |
|
8707 |
// $("#"+fieldId).unbind(); |
|
8708 |
// } |
|
8709 |
for (var i = 0; i < rules.length; i++) { |
|
8710 |
var dofuncion = ""; |
|
8711 |
try { |
|
8712 |
dofuncion = customLinkageAnalysis.makeLinkage(rules[i]); |
|
8713 |
} catch (e) { |
|
8714 |
////console.log(e.message); |
|
8715 |
continue; |
|
8716 |
} |
|
8717 |
var fieldId = rules[i].event.eventFieldId; |
|
8718 |
var item = customShow.options.customItemShow.item[fieldId]; |
|
8719 |
var strFunction = customLinkageAnalysis.changeDoFunction(dofuncion); |
|
8720 |
if (item != undefined) { |
|
8721 |
var doEvent = rules[i].event.doEvent; |
|
8722 |
doEvent = doEvent.replace("selectedChange", "change"); |
|
8723 |
// if (item.tag_Type == "radio" || item.tag_Type == "checkbox") { |
|
8724 |
// // doEvent = doEvent.replace("change", "click"); |
|
8725 |
// } |
|
8726 |
if (inType == item.tag_Type) { |
|
8727 |
if (item.tag_Type == "radio") { |
|
8728 |
$("#" + fieldId + ' .custom-radio').on('click', function () { |
|
8729 |
// //////console.log(this.className); |
|
8730 |
if (this.className.indexOf("readonly") > -1) { |
|
8731 |
return; |
|
8732 |
} |
|
8733 |
eval(strFunction); |
|
8734 |
}); |
|
8735 |
} else if (item.tag_Type == "checkbox") { |
|
8736 |
$("#" + fieldId + ' .custom-check').on('click', function () { |
|
8737 |
// //////console.log(this.className); |
|
8738 |
if (this.className.indexOf("readonly") > -1) { |
|
8739 |
return; |
|
8740 |
} |
|
8741 |
eval(strFunction); |
|
8742 |
}); |
|
8743 |
} else { |
|
8744 |
customLinkageAnalysis.bindEvent(fieldId, doEvent, strFunction); |
|
8745 |
} |
|
8746 |
|
|
8747 |
} |
|
8748 |
} |
|
8749 |
} |
|
8750 |
} |
|
8751 |
|
|
8752 |
customLinkageAnalysis.bindFunctionEvent = function (strFunction) { |
|
8753 |
//console.log(strFunction); |
|
8754 |
return function () { |
|
8755 |
try { |
|
8756 |
eval(strFunction); |
|
8757 |
} catch (e) { |
|
8758 |
////console.log(e.message); |
|
8759 |
} |
|
8760 |
} |
|
8761 |
} |
|
8762 |
|
|
8763 |
customLinkageAnalysis.changeDoFunction = function (doFunction) { |
|
8764 |
var conditionCode = doFunction.conditionCode; |
|
8765 |
//console.log(doFunction); |
|
8766 |
var code = ""; |
|
8767 |
var strFunction = ""; |
|
8768 |
var checkFunction = "";// 单独检查校验规则代码 李伟民 2017-10-19 14:33 |
|
8769 |
if (conditionCode != null) { |
|
8770 |
code = conditionCode.code |
|
8771 |
var conditionListCode = conditionCode.listCode; |
|
8772 |
|
|
8773 |
for (var i = 0; i < conditionListCode.length; i++) { |
|
8774 |
strFunction += "var code" + i + " = " + conditionListCode[i] + ";\r\n"; |
|
8775 |
checkFunction += "var code" + i + " = " + conditionListCode[i] + ";\r\n";// 单独检查校验规则代码 李伟民 2017-10-19 14:33 |
|
8776 |
var reg = new RegExp('\\{' + i + '\\}', "g"); |
|
8777 |
code = code.replace(reg, "\"+customLinkageAnalysis.changeEvalType(eval('code" + i + "'))+\""); |
|
8778 |
} |
|
8779 |
for (var i = 0; i < conditionListCode.length; i++) { |
|
8780 |
var reg = new RegExp('\\{' + i + '\\}', "g"); |
|
8781 |
strFunction = strFunction.replace(reg, "code" + i); |
|
8782 |
checkFunction = strFunction.replace(reg, "code" + i);// 单独检查校验规则代码 李伟民 2017-10-19 14:33 |
|
8783 |
} |
|
8784 |
if (conditionCode.clearCode != undefined) {//添加清空错误信息 李伟民 2017-10-18 17:45 |
|
8785 |
_.each(conditionCode.clearCode, function (_clearCode) { |
|
8786 |
strFunction += _clearCode; |
|
8787 |
checkFunction += _clearCode;// 单独检查校验规则代码 李伟民 2017-10-19 14:33 |
|
8788 |
}) |
|
8789 |
}//添加清空错误信息 李伟民 2017-10-18 17:45 end |
|
8790 |
if (code != null && code != "") { |
|
8791 |
if (code.indexOf('Math.floor') != -1) { |
|
8792 |
code = eval(code); |
|
8793 |
////console.log(code); |
|
8794 |
} |
|
8795 |
code = "customLinkageAnalysis.expeval(\"=" + code + "\")"; |
|
8796 |
strFunction += "if (" + code + " == 'true') { \r\n"; |
|
8797 |
checkFunction += "if (" + code + " == 'true') { \r\n";// 单独检查校验规则代码 李伟民 2017-10-19 14:33 |
|
8798 |
} |
|
8799 |
} |
|
8800 |
var results = doFunction.results; |
|
8801 |
for (var i = 0; i < results.length; i++) { |
|
8802 |
var resultValue = results[i].resultValue; |
|
8803 |
var resultJsText = results[i].resultJsText; |
|
8804 |
if (resultValue != null) { |
|
8805 |
var listCode = resultValue.listCode; |
|
8806 |
var resultCode = resultValue.code; |
|
8807 |
for (var j = 0; j < listCode.length; j++) { |
|
8808 |
strFunction += "var resultCode" + j + " = " + listCode[j] + ";\r\n"; |
|
8809 |
var reg = new RegExp('\\{' + j + '\\}', "g"); |
|
8810 |
////console.log(resultCode); |
|
8811 |
resultCode = resultCode.replace(reg, "\"+customLinkageAnalysis.changeEvalType(eval('resultCode" + j + "'))+\""); |
|
8812 |
} |
|
8813 |
for (var j = 0; j < listCode.length; j++) { |
|
8814 |
var reg = new RegExp('\\{' + j + '\\}', "g"); |
|
8815 |
strFunction = strFunction.replace(reg, "resultCode" + j); |
|
8816 |
} |
|
8817 |
// if(resultCode.indexOf('Math.floor') != -1){ |
|
8818 |
////console.log(resultCode); |
|
8819 |
// resultCode = eval(resultCode); |
|
8820 |
// } |
|
8821 |
//console.log(resultCode); |
|
8822 |
resultCode = "customLinkageAnalysis.expeval(\"=" + resultCode + "\")"; |
|
8823 |
strFunction += resultJsText.replace(/\{0\}/g, resultCode); |
|
8824 |
} else if (results[i].resultJsText.indexOf("setMessage")) {// 判断是否为 规则校验公式 |
|
8825 |
strFunction += resultJsText + "; \r\n"; |
|
8826 |
checkFunction += resultJsText + "; \r\n";// 单独检查校验规则代码 李伟民 2017-10-19 14:33 |
|
8827 |
} else { |
|
8828 |
strFunction += resultJsText + "; \r\n"; |
|
8829 |
} |
|
8830 |
//公式联动追加 |
|
8831 |
if (results[i].doEvent != undefined && results[i].resultJsText.indexOf("setValue") != -1) { |
|
8832 |
strFunction += '$("#' + results[i].targetid + '").trigger("' + results[i].doEvent + '.value");'; |
|
8833 |
} |
|
8834 |
|
|
8835 |
//公式联动追加结束 |
|
8836 |
|
|
8837 |
} |
|
8838 |
|
|
8839 |
if (code != null && code != "") { |
|
8840 |
strFunction += "}"; |
|
8841 |
checkFunction += "}";// 单独检查校验规则代码 李伟民 2017-10-19 14:33 |
|
8842 |
} |
|
8843 |
////console.log(strFunction); |
|
8844 |
var allFunction = { "strFunction": strFunction, "checkFunction": checkFunction }; |
|
8845 |
return allFunction; |
|
8846 |
} |
|
8847 |
|
|
8848 |
function funCheck(optarr, allFunction) {//判断是否重复绑定方法 |
|
8849 |
var flag = true; |
|
8850 |
if (optarr != undefined && optarr != '') { |
|
8851 |
optarr = JSON.parse(optarr); |
|
8852 |
console.log(optarr); |
|
8853 |
console.log(allFunction); |
|
8854 |
_.each(optarr, function (fn) { |
|
8855 |
if (fn.strFunction == allFunction.strFunction && fn.checkFunction == allFunction.checkFunction) { |
|
8856 |
console.log("falg false"); |
|
8857 |
flag = false; |
|
8858 |
} |
|
8859 |
}) |
|
8860 |
} |
|
8861 |
return flag; |
|
8862 |
} |
|
8863 |
|
|
8864 |
customLinkageAnalysis.bindEvent = function (fieldId, doEvent, allFunction) {//aaaaaa |
|
8865 |
console.log(allFunction); |
|
8866 |
var evalstr = ""; |
|
8867 |
var evalchekstr = ""; |
|
8868 |
////console.log(customShow.options.customItemShow.item[fieldId].tag_Type); |
|
8869 |
if (customShow.options.customItemShow.item[fieldId].tag_Type == "dropdownlist") { |
|
8870 |
////console.log($("[id='" + fieldId+"']")); |
|
8871 |
////console.log($("[id='" + fieldId+"']").find(".select_get")); |
|
8872 |
////console.log($(".select_get")); |
|
8873 |
////console.log(strFunction); |
|
8874 |
_.each($("[id='" + fieldId + "']").find(".select_get"),function(opt){ |
|
8875 |
var optarr = $(opt).attr("funarr"); |
|
8876 |
if(funCheck(optarr,allFunction)){ |
|
8877 |
$(opt).on(doEvent + ".value", function () { |
|
8878 |
if (customShow.options.customItemShow.item[fieldId].parentsubFormNum != 0) { |
|
8879 |
// _.each($("[id='" + fieldId + "']").find(".select_get"), (item, i) => { |
|
8880 |
if (allFunction.strFunction.indexOf("var i=") == -1) { |
|
8881 |
////console.log(i); |
|
8882 |
evalstr = "var i=" + $("[id='" + fieldId + "']").find(".select_get").index(this) + ";" + allFunction.strFunction; |
|
8883 |
} |
|
8884 |
// }) |
|
8885 |
}else{ |
|
8886 |
evalstr = allFunction.strFunction; |
|
8887 |
} |
|
8888 |
try { |
|
8889 |
console.log(evalstr); |
|
8890 |
eval(evalstr); |
|
8891 |
} catch (e) { |
|
8892 |
////console.log(e.message); |
|
8893 |
} |
|
8894 |
}); |
|
8895 |
var funarr; |
|
8896 |
if($(opt).attr("funarr") == undefined || $(opt).attr("funarr") == ""){ |
|
8897 |
funarr = [allFunction]; |
|
8898 |
}else{ |
|
8899 |
funarr = JSON.parse($(opt).attr("funarr")); |
|
8900 |
funarr.push(allFunction); |
|
8901 |
} |
|
8902 |
$(opt).attr("funarr",JSON.stringify(funarr)); |
|
8903 |
} |
|
8904 |
var checkarr = $(opt).attr("checkfunarr"); |
|
8905 |
if(funCheck(checkarr,allFunction)){ |
|
8906 |
$(opt).on(doEvent + ".check", function () {//单独检验校验规则绑定 李伟民 2017-10-19 15:18 |
|
8907 |
if (customShow.options.customItemShow.item[fieldId].parentsubFormNum != 0) { |
|
8908 |
// _.each($("[id='" + fieldId + "']").find(".select_get"), (item, i) => { |
|
8909 |
if (allFunction.checkFunction.indexOf("var i=") == -1) { |
|
8910 |
evalchekstr = "var i=" + $("[id='" + fieldId + "']").find(".select_get").index(this) + ";" + allFunction.checkFunction; |
|
8911 |
} |
|
8912 |
// }) |
|
8913 |
}else{ |
|
8914 |
evalchekstr = allFunction.checkFunction; |
|
8915 |
} |
|
8916 |
try { |
|
8917 |
eval(evalchekstr); |
|
8918 |
} catch (e) { |
|
8919 |
//console.log(e.message); |
|
8920 |
} |
|
8921 |
});//单独检验校验规则绑定 李伟民 2017-10-19 15:18 end |
|
8922 |
var checkfunarr; |
|
8923 |
if($(opt).attr("checkfunarr") == undefined || $(opt).attr("checkfunarr") == ""){ |
|
8924 |
checkfunarr = [allFunction]; |
|
8925 |
}else{ |
|
8926 |
checkfunarr = JSON.parse($(opt).attr("checkfunarr")); |
|
8927 |
checkfunarr.push(allFunction); |
|
8928 |
} |
|
8929 |
$(opt).attr("checkfunarr",JSON.stringify(checkfunarr)); |
|
8930 |
} |
13ec33
|
8931 |
|
4d1219
|
8932 |
}); |
B |
8933 |
// $("[id='" + fieldId + "']").find(".select_get").on(doEvent + ".value", function () { |
|
8934 |
// if (customShow.options.customItemShow.item[fieldId].parentsubFormNum != 0) { |
|
8935 |
// // _.each($("[id='" + fieldId + "']").find(".select_get"), (item, i) => { |
|
8936 |
// if (allFunction.strFunction.indexOf("var i=") == -1) { |
|
8937 |
// ////console.log(i); |
|
8938 |
// evalstr = "var i=" + $("[id='" + fieldId + "']").find(".select_get").index(this) + ";" + allFunction.strFunction; |
|
8939 |
// } |
|
8940 |
// // }) |
|
8941 |
// }else{ |
|
8942 |
// evalstr = allFunction.strFunction; |
|
8943 |
// } |
|
8944 |
// try { |
|
8945 |
// console.log(evalstr); |
|
8946 |
// eval(evalstr); |
|
8947 |
// } catch (e) { |
|
8948 |
// ////console.log(e.message); |
|
8949 |
// } |
|
8950 |
// }); |
|
8951 |
// $("[id='" + fieldId + "']").find(".select_get").unbind(doEvent + ".check"); |
|
8952 |
// $("[id='" + fieldId + "']").find(".select_get").on(doEvent + ".check", function () {//单独检验校验规则绑定 李伟民 2017-10-19 15:18 |
|
8953 |
// if (customShow.options.customItemShow.item[fieldId].parentsubFormNum != 0) { |
|
8954 |
// // _.each($("[id='" + fieldId + "']").find(".select_get"), (item, i) => { |
|
8955 |
// if (allFunction.checkFunction.indexOf("var i=") == -1) { |
|
8956 |
// evalchekstr = "var i=" + $("[id='" + fieldId + "']").find(".select_get").index(this) + ";" + allFunction.checkFunction; |
|
8957 |
// } |
|
8958 |
// // }) |
|
8959 |
// }else{ |
|
8960 |
// evalchekstr = allFunction.checkFunction; |
|
8961 |
// } |
|
8962 |
// try { |
|
8963 |
// eval(evalchekstr); |
|
8964 |
// } catch (e) { |
|
8965 |
// //console.log(e.message); |
|
8966 |
// } |
|
8967 |
// });//单独检验校验规则绑定 李伟民 2017-10-19 15:18 end |
|
8968 |
} else { |
|
8969 |
// $("[id='" + fieldId + "']").unbind(doEvent + ".value"); |
|
8970 |
_.each($("[id='" + fieldId + "']"),function(opt){ |
|
8971 |
var optarr = $(opt).attr("funarr"); |
|
8972 |
if(funCheck(optarr,allFunction)){ |
|
8973 |
$(opt).on(doEvent + ".value", function () { |
|
8974 |
if (customShow.options.customItemShow.item[fieldId].parentsubFormNum != 0 && allFunction.strFunction.indexOf("getSum") == -1) { |
|
8975 |
console.log($("[id='" + fieldId + "']")); |
|
8976 |
console.log($(this)); |
|
8977 |
console.log($("[id='" + fieldId + "']").index(this)); |
|
8978 |
// _.each($("[id='" + fieldId + "']"), (item, i) => { |
|
8979 |
// console.log($(item)); |
|
8980 |
if (allFunction.strFunction.indexOf("var i=") == -1) { |
|
8981 |
////console.log(i); |
|
8982 |
evalstr = "var i=" + $("[id='" + fieldId + "']").index(this) + ";" + allFunction.strFunction; |
|
8983 |
} |
|
8984 |
// }) |
|
8985 |
}else if(allFunction.strFunction.indexOf("getSum") > 0){ |
|
8986 |
console.log(allFunction.strFunction); |
|
8987 |
console.log("replace"); |
|
8988 |
evalstr = allFunction.strFunction; |
|
8989 |
// allFunction.strFunction = allFunction.strFunction.replace(new RegExp(".split(',')[i]") ,""); |
|
8990 |
while(evalstr.indexOf(".split(',')[i]") != -1){ |
|
8991 |
evalstr = evalstr.replace(".split(',')[i]",""); |
|
8992 |
} |
|
8993 |
}else{ |
|
8994 |
evalstr = allFunction.strFunction; |
|
8995 |
} |
|
8996 |
// try { |
|
8997 |
console.log(evalstr); |
|
8998 |
eval(evalstr); |
|
8999 |
// } catch (e) { |
|
9000 |
// ////console.log(e.message); |
|
9001 |
// } |
|
9002 |
}); |
|
9003 |
var funarr; |
|
9004 |
if($(opt).attr("funarr") == undefined || $(opt).attr("funarr") == ""){ |
|
9005 |
funarr = [allFunction]; |
|
9006 |
}else{ |
|
9007 |
funarr = JSON.parse($(opt).attr("funarr")); |
|
9008 |
funarr.push(allFunction); |
|
9009 |
} |
|
9010 |
$(opt).attr("funarr",JSON.stringify(funarr)); |
13ec33
|
9011 |
|
4d1219
|
9012 |
}; |
B |
9013 |
var checkarr = $(opt).attr("checkfunarr"); |
|
9014 |
if(funCheck(checkarr,allFunction)){ |
|
9015 |
$(opt).on("blur.check", function () {//单独检验校验规则绑定 李伟民 2017-10-19 15:18 |
|
9016 |
if (customShow.options.customItemShow.item[fieldId].parentsubFormNum != 0) { |
|
9017 |
console.log("change.check"); |
|
9018 |
_.each($("[id='" + fieldId + "']"), (item, i) => { |
|
9019 |
if (allFunction.checkFunction.indexOf("var i=") == -1) { |
|
9020 |
////console.log(i); |
|
9021 |
evalchekstr = "var i=" + $("[id='" + fieldId + "']").index(this) + ";" + allFunction.checkFunction; |
|
9022 |
} |
|
9023 |
}) |
|
9024 |
}else{ |
|
9025 |
evalchekstr = allFunction.checkFunction; |
|
9026 |
} |
|
9027 |
try { |
|
9028 |
if(evalchekstr.indexOf('alert') == -1){ |
|
9029 |
eval(evalchekstr); |
|
9030 |
} |
|
9031 |
} catch (e) { |
|
9032 |
////console.log(e.message); |
|
9033 |
} |
|
9034 |
});//单独检验校验规则绑定 李伟民 2017-10-19 15:18 end |
|
9035 |
var checkfunarr; |
|
9036 |
if($(opt).attr("checkfunarr") == undefined || $(opt).attr("checkfunarr") == ""){ |
|
9037 |
checkfunarr = [allFunction]; |
|
9038 |
}else{ |
|
9039 |
checkfunarr = JSON.parse($(opt).attr("checkfunarr")); |
|
9040 |
checkfunarr.push(allFunction); |
|
9041 |
} |
|
9042 |
$(opt).attr("checkfunarr",JSON.stringify(checkfunarr)); |
|
9043 |
} |
13ec33
|
9044 |
|
4d1219
|
9045 |
}); |
B |
9046 |
// $("[id='" + fieldId + "']").unbind(doEvent + ".check"); |
|
9047 |
// $("[id='" + fieldId + "']").on(doEvent + ".check", function () {//单独检验校验规则绑定 李伟民 2017-10-19 15:18 |
|
9048 |
// if (customShow.options.customItemShow.item[fieldId].parentsubFormNum != 0) { |
|
9049 |
// console.log("change.check"); |
|
9050 |
// _.each($("[id='" + fieldId + "']"), (item, i) => { |
|
9051 |
// if (allFunction.checkFunction.indexOf("var i=") == -1) { |
|
9052 |
// ////console.log(i); |
|
9053 |
// evalchekstr = "var i=" + $("[id='" + fieldId + "']").index(this) + ";" + allFunction.checkFunction; |
|
9054 |
// } |
|
9055 |
// }) |
|
9056 |
// }else{ |
|
9057 |
// evalchekstr = allFunction.checkFunction; |
|
9058 |
// } |
|
9059 |
// try { |
|
9060 |
// eval(evalchekstr); |
|
9061 |
// } catch (e) { |
|
9062 |
// ////console.log(e.message); |
|
9063 |
// } |
|
9064 |
// });//单独检验校验规则绑定 李伟民 2017-10-19 15:18 end |
|
9065 |
} |
|
9066 |
} |
|
9067 |
|
|
9068 |
customLinkageAnalysis.changeEvalType = function (str) { |
|
9069 |
console.log(str); |
624ff8
|
9070 |
if (isNaN(Number(str)) && (str.substring(0, 1) != "\"" || str.substring(str.length - 1, 1) != "\"") && (str.indexOf('||') != -1) && (str.indexOf('&&') != -1)) {//|| && 修改 李伟民 公式不稳定修改 0202 |
4d1219
|
9071 |
return "'" + str + "'"; |
B |
9072 |
} else { |
|
9073 |
////console.log(str); |
|
9074 |
return str; |
|
9075 |
} |
|
9076 |
} |
|
9077 |
|
|
9078 |
//事件绑定调用 |
|
9079 |
//事件绑定:字段ID:ItemId 事件名 自定义事件名 |
|
9080 |
//参数 |
|
9081 |
// eventItem=[{ |
|
9082 |
// ItemId:"Item_1", 控件id |
|
9083 |
// event:"click", 事件 |
|
9084 |
// eventmethod:"XXXXXXXXXXXXXXXXXXXX" 自定义事件名 |
|
9085 |
// }] |
|
9086 |
customLinkageAnalysis.setEventBind = function (eventItem) { |
|
9087 |
customShow.setEventBindItem(eventItem); |
|
9088 |
} |
|
9089 |
//03检证执行(接口) |
|
9090 |
customLinkageAnalysis.validationEx = { |
|
9091 |
get: function (alias) { |
|
9092 |
var itemTempS; |
|
9093 |
var item = customBase.options.customItems[alias]; |
|
9094 |
if (item.type == "button" || item.type == "link") { |
|
9095 |
} else if (item.type == "dropdownlist") { |
|
9096 |
var datasourcetype = $("#" + item.id)[0].getAttribute("datasourcetype"); |
|
9097 |
//////////console.log(datasourcetype); |
|
9098 |
//主数据源 |
|
9099 |
if (datasourcetype == "masterdata") { |
|
9100 |
itemTempS = customBase.getItemValue(item.id, item.type); |
|
9101 |
//数据源 |
|
9102 |
} else if (datasourcetype == "datasource") { |
|
9103 |
itemTempS = customBase.getItemValue(item.id, "dropdownlistText"); |
|
9104 |
//自定义 |
|
9105 |
} else if (datasourcetype == "custom") { |
|
9106 |
itemTempS = customBase.getItemValue(item.id, "dropdownlistText"); |
|
9107 |
//API接口 |
|
9108 |
} else if (datasourcetype == "api") { |
|
9109 |
itemTempS = customBase.getItemValue(item.id, item.type); |
|
9110 |
} |
|
9111 |
} else if (item.type == "subform") { |
|
9112 |
|
|
9113 |
} else { |
|
9114 |
itemTempS = customBase.getItemValue(item.id, item.type); |
|
9115 |
} |
|
9116 |
item.value = itemTempS; |
|
9117 |
////////console.log(item); |
|
9118 |
return item; |
|
9119 |
} |
|
9120 |
} |
|
9121 |
//取得主数据 |
|
9122 |
/* |
|
9123 |
itemId:项目ID |
|
9124 |
masterCode:执行CODE |
|
9125 |
返回值:元素的值 |
|
9126 |
*/ |
|
9127 |
customLinkageAnalysis.getElement = function (itemId, masterCode, num) { |
|
9128 |
var item = customShow.options.customItemShow.item[itemId]; |
|
9129 |
var code = item.tag_Attribute.masterData; |
|
9130 |
var masterData = $.parseJSON(code); |
|
9131 |
var defindCode = masterData.defindCode; |
|
9132 |
var eleCode = masterData.eleCode; |
|
9133 |
var eleValue = customLinkageAnalysis.getValue(itemId); |
|
9134 |
if(num != undefined && eleValue != undefined && eleValue.indexOf(',') != -1){//子表单中控件处理 李伟民 0106 |
|
9135 |
eleValue = eleValue.split(',')[num]; |
|
9136 |
} |
|
9137 |
var opt = { |
|
9138 |
eleCode: eleCode, |
|
9139 |
defindCode: defindCode, |
|
9140 |
eleValue: eleValue, |
|
9141 |
masterCode: masterCode, |
|
9142 |
itemId: itemId |
|
9143 |
} |
|
9144 |
//主数据取得 |
|
9145 |
var result = customDataBound.getElement1(opt); |
|
9146 |
console.log(result); |
|
9147 |
console.log(itemId) |
|
9148 |
if (result.rspCode == "000000") { |
|
9149 |
if (result.data[itemId].length > 0) { |
|
9150 |
console.log(result.data[itemId][0].value) |
|
9151 |
return result.data[itemId][0].value; |
|
9152 |
} else { |
|
9153 |
return ""; |
|
9154 |
} |
|
9155 |
} else { |
|
9156 |
return ""; |
|
9157 |
} |
|
9158 |
} |
|
9159 |
|
|
9160 |
customLinkageAnalysis.clearMessage = function (itemId, num) {//清空错误信息方法 李伟民 2017-10-18 16:36 |
|
9161 |
if (num == undefined) { |
|
9162 |
num = 0; |
|
9163 |
} |
|
9164 |
//console.log($("[id='"+itemId+"']:eq("+num+")")); |
|
9165 |
//console.log($("[id='"+itemId+"ActiveId']:eq("+num+")")); |
|
9166 |
$("[id='" + itemId + "']:eq(" + num + ")").removeClass("errorItemCss"); |
|
9167 |
$("[id='" + itemId + "']:eq(" + num + ")").removeClass("errorCheckCss"); |
|
9168 |
$("[id='" + itemId + "ActiveId']:eq(" + num + ")").find("#" + itemId + "mesageErrDiv").remove(); |
|
9169 |
}//清空错误信息方法 李伟民 2017-10-18 16:36 end |
|
9170 |
|
|
9171 |
customLinkageAnalysis.makeLinkage = function (rule) { |
|
9172 |
////console.log(rule); |
|
9173 |
var result = {}; |
|
9174 |
var conditionCode = {}; |
|
9175 |
conditionCode = customLinkageAnalysis.changeCodeMirror(rule.conditionCode, rule.conditionHistory._history); |
|
9176 |
|
|
9177 |
if (rule.conditionCode != "" && !_.isNull(rule.conditionCode)) {//清空错误信息 李伟民 2017-10-18 16:36 |
|
9178 |
var clearCode = []; |
|
9179 |
_.each(rule.results, function (ru) { |
|
9180 |
if (ru.mode == "2") { |
|
9181 |
var ruItem = customShow.options.customItemShow.item[ru.eventFieldId]; |
|
9182 |
if (ruItem.parentsubFormNum != 0) { |
|
9183 |
clearCode.push("customLinkageAnalysis.clearMessage('" + ru.eventFieldId + "',i);"); |
|
9184 |
} else { |
|
9185 |
clearCode.push("customLinkageAnalysis.clearMessage('" + ru.eventFieldId + "');"); |
|
9186 |
} |
|
9187 |
} |
|
9188 |
}); |
|
9189 |
conditionCode["clearCode"] = clearCode; |
|
9190 |
}//清空错误信息 李伟民 2017-10-18 16:36 end |
|
9191 |
|
|
9192 |
var results = new Array(); |
|
9193 |
for (var i = 0; i < rule.results.length; i++) { |
|
9194 |
var resultJs = {}; |
|
9195 |
var textType = rule.results[i].attribute; |
|
9196 |
var resultJsText = ""; |
|
9197 |
var resultTargrtItem = customShow.options.customItemShow.item[rule.results[i].eventFieldId]; if ("1" == rule.results[i].mode) { |
|
9198 |
var resultValue = customLinkageAnalysis.changeCodeMirror(rule.results[i].code, rule.results[i].eventHistory._history); |
|
9199 |
resultJs.resultValue = resultValue; |
|
9200 |
if (textType == 'value') { |
|
9201 |
if (resultTargrtItem.parentsubFormNum != 0) { |
|
9202 |
resultJsText += "customLinkageAnalysis.setValue('" + rule.results[i].eventFieldId + "', {0}, i);"; |
|
9203 |
} else { |
|
9204 |
resultJsText += "customLinkageAnalysis.setValue('" + rule.results[i].eventFieldId + "', {0});"; |
|
9205 |
} |
|
9206 |
} else if (textType == 'visible' || textType == 'editable') { |
|
9207 |
resultJsText += "customLinkageAnalysis.setAttribut('" + rule.results[i].eventFieldId + "','" + textType + "', {0});"; |
|
9208 |
} else { |
|
9209 |
// todo |
|
9210 |
} |
|
9211 |
} else if ("2" == rule.results[i].mode || "0" == rule.results[i].mode) { |
|
9212 |
if (resultTargrtItem.parentsubFormNum != 0) {//自定义校验支持子表单中控件 李伟民 2017-10-18 14:34 |
|
9213 |
// resultJsText += "customLinkageAnalysis.clearMessage('" + rule.results[i].eventFieldId + "',i);"; |
|
9214 |
resultJsText += "customLinkageAnalysis.setMessage('" + rule.results[i].mode + "','" + rule.results[i].eventFieldId + "','" + rule.results[i].message + "',i);"; |
|
9215 |
} else { |
|
9216 |
// resultJsText += "customLinkageAnalysis.clearMessage('" + rule.results[i].eventFieldId + "');"; |
|
9217 |
resultJsText += "customLinkageAnalysis.setMessage('" + rule.results[i].mode + "','" + rule.results[i].eventFieldId + "','" + rule.results[i].message + "');"; |
|
9218 |
}//自定义校验支持子表单中控件 李伟民 2017-10-18 14:34 end |
|
9219 |
|
|
9220 |
} else if ("3" == rule.results[i].mode) { |
|
9221 |
resultJsText += "customLinkageAnalysis.alert('" + rule.results[i].messageType + "','" + rule.results[i].message + "');"; |
|
9222 |
} else { |
|
9223 |
; |
|
9224 |
} |
|
9225 |
resultJs.resultJsText = resultJsText; |
|
9226 |
resultJs.targetid = rule.results[i].eventFieldId;// 公式联动追加 目标控件 |
|
9227 |
var targetDoEvent = ''; |
|
9228 |
// ////console.log(customShow.options.jsonLinkage); |
|
9229 |
var jsonLinkage_add = customShow.options.jsonLinkage;//预览公式联动修改 李伟民 0117 |
|
9230 |
if (_.isString(jsonLinkage_add)) { |
|
9231 |
jsonLinkage_add = JSON.parse(jsonLinkage_add); |
|
9232 |
} |
|
9233 |
_.each(jsonLinkage_add, function (allrule) {// 公式联动追加 目标控件事件 |
|
9234 |
if (allrule.event.eventFieldId == resultJs.targetid) { |
|
9235 |
resultJs.doEvent = allrule.event.doEvent; |
|
9236 |
} |
|
9237 |
}); |
|
9238 |
results.push(resultJs); |
|
9239 |
} |
|
9240 |
result.conditionCode = conditionCode; |
|
9241 |
result.results = results; |
|
9242 |
////console.log(result); |
|
9243 |
return result; |
|
9244 |
} |
|
9245 |
|
|
9246 |
customLinkageAnalysis.reachLeftSpace = function (str, length) { |
|
9247 |
var result = str; |
|
9248 |
if (str.length < length) { |
|
9249 |
var spaceLen = length - str.length; |
|
9250 |
for (var i = 0; i < spaceLen; i++) { |
|
9251 |
result = " " + result; |
|
9252 |
} |
|
9253 |
} |
|
9254 |
return result; |
|
9255 |
} |
|
9256 |
|
|
9257 |
customLinkageAnalysis.replace = function (str, stringObj, replaceText, from, to) { |
|
9258 |
var resultBefore = str.substring(0, from); |
|
9259 |
var text = str.substring(from, to); |
|
9260 |
var resultAfter = str.substring(to); |
|
9261 |
text = text.replace(stringObj, customLinkageAnalysis.reachLeftSpace(replaceText, stringObj.length)); |
|
9262 |
return resultBefore + text + resultAfter; |
|
9263 |
} |
|
9264 |
|
|
9265 |
customLinkageAnalysis.changeCodeMirror = function (code, history) { |
|
9266 |
if (code.trim() == "") { |
|
9267 |
return null; |
|
9268 |
} |
|
9269 |
//console.log(code); |
|
9270 |
//console.log(history); |
|
9271 |
var result = {}; |
|
9272 |
var conditionCode = ""; |
|
9273 |
var listCode = new Array(); |
|
9274 |
var arrConditionCode = code.split('\r\n'); |
|
9275 |
////console.log(arrConditionCode); |
|
9276 |
var resultIndex = 0; |
|
9277 |
|
|
9278 |
if (history != null && history.length > 0) { |
|
9279 |
for (var i = 0; i < history.length; i++) { |
|
9280 |
var line = history[i].from.line; |
|
9281 |
var fromCh = history[i].from.ch; |
|
9282 |
var toCh = history[i].to.ch; |
|
9283 |
var text = history[i].text; |
|
9284 |
arrConditionCode[line] = customLinkageAnalysis.replace(arrConditionCode[line], text, '{' + resultIndex + '}', fromCh, toCh); |
|
9285 |
var idText = history[i].idText; |
|
9286 |
var arrInputText = idText.split('.'); |
|
9287 |
var replaceText = ""; |
|
9288 |
var id = arrInputText[0]; |
|
9289 |
var textType = arrInputText[1]; |
|
9290 |
var idItem = customShow.options.customItemShow.item[id]; if (textType == 'value') { |
|
9291 |
if (idItem.parentsubFormNum != 0) { |
|
9292 |
replaceText = "customLinkageAnalysis.getValue('" + id + "').split(',')[i]"; |
|
9293 |
} else { |
|
9294 |
replaceText = "customLinkageAnalysis.getValue('" + id + "')"; |
|
9295 |
} // ////console.log(replaceText); |
|
9296 |
} else if (textType == 'visible' || textType == 'editable') { |
|
9297 |
replaceText = "customLinkageAnalysis.getAttribut('" + id + "','" + textType + "')"; |
|
9298 |
} else { |
|
9299 |
if (idItem.parentsubFormNum != 0) {//主数据关联也需区分子表单中控件 李伟民 0106 |
|
9300 |
replaceText = "customLinkageAnalysis.getElement('" + id + "','" + textType + "',i)"; |
|
9301 |
} else { |
|
9302 |
replaceText = "customLinkageAnalysis.getElement('" + id + "','" + textType + "')"; |
|
9303 |
} |
|
9304 |
// replaceText = "customLinkageAnalysis.getElement('" + id + "','" + textType + "')"; |
|
9305 |
} |
|
9306 |
listCode.push(replaceText); |
|
9307 |
resultIndex++; |
|
9308 |
} |
|
9309 |
} |
|
9310 |
conditionCode = arrConditionCode.join('\r\n').replace(/\(/g, "###(###"); |
|
9311 |
conditionCode = conditionCode.replace(/\)/g, "###)###"); |
|
9312 |
arrConditionCode = conditionCode.split('\r\n'); |
|
9313 |
conditionCode = arrConditionCode.join('\r\n'); |
|
9314 |
conditionCode = conditionCode.replace(/AND/g, '&&'); |
|
9315 |
conditionCode = conditionCode.replace(/OR/g, '||'); |
|
9316 |
while (conditionCode.indexOf(' ') >= 0) { |
|
9317 |
conditionCode = conditionCode.replace(/ /g, ' '); |
|
9318 |
} |
|
9319 |
var conditionCodeResult = customLinkageAnalysis.changeSign(conditionCode, listCode, resultIndex); |
|
9320 |
conditionCode = conditionCodeResult.conditionCode; |
|
9321 |
resultIndex = conditionCodeResult.resultIndex; |
|
9322 |
conditionCode = conditionCode.replace(/###\(###/g, "("); |
|
9323 |
conditionCode = conditionCode.replace(/###\)###/g, ")"); |
|
9324 |
result.code = conditionCode; |
|
9325 |
result.listCode = listCode; |
|
9326 |
//console.log(result); |
|
9327 |
return result; |
|
9328 |
} |
|
9329 |
|
|
9330 |
customLinkageAnalysis.changeCodeSign = function (sign, inner) { |
|
9331 |
var exp = igame.Expression; |
|
9332 |
if (sign.indexOf('MAX') >= 0) { |
|
9333 |
sign = "Max"; |
|
9334 |
} else if (sign.indexOf('MIN') >= 0) { |
|
9335 |
sign = "Min"; |
|
9336 |
} else if (sign.indexOf('AVG') >= 0) { |
|
9337 |
sign = "Average"; |
|
9338 |
} else if (sign.indexOf('SUM') >= 0) { |
|
9339 |
sign = "Sum"; |
|
9340 |
} else if (sign.indexOf('COUNT') >= 0) { |
|
9341 |
sign = "Count"; |
624ff8
|
9342 |
} else if (sign.indexOf('||') >= 0) {//|| &&修改 李伟民 0202 公式不稳定修改 |
L |
9343 |
return sign + eval("[" + inner + "]").toString(); |
4d1219
|
9344 |
} else { |
B |
9345 |
return ""; |
|
9346 |
} |
|
9347 |
|
|
9348 |
var arlInner = eval("[" + inner + "]"); |
|
9349 |
return new exp.Formula(sign + "(" + arlInner.join(',') + ")").evaluate().toString(); |
|
9350 |
} |
|
9351 |
|
|
9352 |
customLinkageAnalysis.expeval = function (str) { |
|
9353 |
// console.log(str); |
|
9354 |
if (str.trim().replace(/=/, "") == "") { |
|
9355 |
console.log("str err"); |
|
9356 |
return " "; |
|
9357 |
} |
|
9358 |
console.log("str scc"); |
|
9359 |
var exp = igame.Expression; |
|
9360 |
// console.log(exp); |
|
9361 |
// console.log(str); |
|
9362 |
// console.log(new exp.Formula(str)); |
|
9363 |
// console.log(new exp.Formula(str).evaluate()); |
|
9364 |
// console.log(new exp.Formula(str).evaluate().toString()); |
|
9365 |
return new exp.Formula(str).evaluate().toString(); |
|
9366 |
} |
|
9367 |
|
|
9368 |
customLinkageAnalysis.changeSign = function (conditionCode, listCode, resultIndex) { |
|
9369 |
////console.log(conditionCode); |
|
9370 |
var index = 0; |
|
9371 |
var indexOf = -1; |
|
9372 |
var result = {}; |
|
9373 |
while ((indexOf = conditionCode.substring(index).indexOf('MAX')) >= 0 |
|
9374 |
|| (indexOf = conditionCode.substring(index).indexOf('MIN')) >= 0 |
|
9375 |
|| (indexOf = conditionCode.substring(index).indexOf('AVG')) >= 0 |
|
9376 |
|| (indexOf = conditionCode.substring(index).indexOf('SUM')) >= 0 |
|
9377 |
|| (indexOf = conditionCode.substring(index).indexOf('COUNT')) >= 0 |
|
9378 |
|| (indexOf = conditionCode.substring(index).indexOf('parseInt')) >= 0 |
|
9379 |
|| (indexOf = conditionCode.substring(index).indexOf('addtest')) >= 0 |
|
9380 |
|| (indexOf = conditionCode.substring(index).indexOf('getDay')) >= 0 |
|
9381 |
|| (indexOf = conditionCode.substring(index).indexOf('getSum')) >= 0) {//时间函数 李伟民 2017-10-17 21:49 修改公式 |
|
9382 |
var before = conditionCode.substring(0, indexOf); |
|
9383 |
var beforeInner = 0; |
|
9384 |
var afterIndexOf = 0; |
|
9385 |
var sign; |
|
9386 |
var after; |
|
9387 |
if (history != null && history.length > 0) { |
|
9388 |
beforeInner = conditionCode.substring(indexOf).indexOf('###(###') + 7 |
|
9389 |
// afterIndexOf = conditionCode.substring(indexOf).lastIndexOf('###)###'); |
|
9390 |
afterIndexOf = customLinkageAnalysis.getBackBracketIndex(conditionCode.substring(indexOf), '###(###', '###)###'); |
|
9391 |
sign = conditionCode.substring(indexOf).substring(0, beforeInner - 7); |
|
9392 |
after = conditionCode.substring(indexOf).substring(afterIndexOf + 7); |
|
9393 |
} else { |
|
9394 |
beforeInner = conditionCode.substring(indexOf).indexOf('(') + 1 |
|
9395 |
// afterIndexOf = conditionCode.substring(indexOf).lastIndexOf(')'); |
|
9396 |
afterIndexOf = customLinkageAnalysis.getBackBracketIndex(conditionCode.substring(indexOf), '(', ')'); |
|
9397 |
sign = conditionCode.substring(indexOf).substring(0, beforeInner - 1); |
|
9398 |
after = conditionCode.substring(indexOf).substring(afterIndexOf + 1); |
|
9399 |
} |
|
9400 |
var inner = conditionCode.substring(indexOf).substring(beforeInner, afterIndexOf); |
|
9401 |
var innerResult = customLinkageAnalysis.changeSign(inner, listCode, resultIndex); |
|
9402 |
inner = innerResult.conditionCode; |
|
9403 |
resultIndex = innerResult.resultIndex; |
|
9404 |
inner = inner.replace(/###\(###/g, "("); |
|
9405 |
inner = inner.replace(/###\)###/g, ")"); |
|
9406 |
if ((indexOf = conditionCode.substring(index).indexOf('parseInt')) >= 0 |
|
9407 |
|| (indexOf = conditionCode.substring(index).indexOf('addtest')) >= 0 |
|
9408 |
|| (indexOf = conditionCode.substring(index).indexOf('getDay')) >= 0 |
|
9409 |
|| (indexOf = conditionCode.substring(index).indexOf('getSum')) >= 0) {//时间函数 李伟民 2017-10-17 21:49 修改公式 |
|
9410 |
listCode.push(sign + "(" + inner + ")"); |
|
9411 |
} else { |
|
9412 |
listCode.push("customLinkageAnalysis.changeCodeSign('" + sign + "',\[" + inner + "\])"); |
|
9413 |
} |
|
9414 |
|
|
9415 |
conditionCode = before + "{" + resultIndex + "}"; |
|
9416 |
resultIndex++; |
|
9417 |
index = conditionCode.length - 1; |
|
9418 |
conditionCode += after; |
|
9419 |
} |
|
9420 |
result.conditionCode = conditionCode; |
|
9421 |
result.resultIndex = resultIndex; |
|
9422 |
////console.log(result); |
|
9423 |
return result; |
|
9424 |
} |
|
9425 |
addtest = function (arg1, arg2) { |
|
9426 |
return arg1 + arg2; |
|
9427 |
} |
|
9428 |
|
|
9429 |
getDay = function (arg1, arg2) {//时间函数 李伟民 2017-10-17 21:49 |
|
9430 |
var date1 = new Date(arg1) |
|
9431 |
var date2 = new Date(arg2) |
|
9432 |
var s1 = date1.getTime(), s2 = date2.getTime(); |
|
9433 |
var total = (s1 - s2) / 1000; |
|
9434 |
var day = parseInt(total / (24 * 60 * 60));//计算整数天数 |
|
9435 |
//console.log(day); |
|
9436 |
return day; |
|
9437 |
}//时间函数 李伟民 2017-10-17 21:49 end |
|
9438 |
|
|
9439 |
getSum = function () { |
|
9440 |
console.log(arguments); |
|
9441 |
var allItem = []; |
|
9442 |
_.each(arguments, function (arg) { |
|
9443 |
allItem.push(arg.split(",")); |
|
9444 |
}); |
|
9445 |
console.log(allItem); |
|
9446 |
var sum = 0; |
|
9447 |
_.each(allItem, function (item) { |
|
9448 |
_.each(item, function (cd) { |
|
9449 |
sum += Number(cd); |
|
9450 |
}) |
|
9451 |
}) |
|
9452 |
return sum; |
|
9453 |
} |
|
9454 |
|
|
9455 |
customLinkageAnalysis.getBackBracketIndex = function (str, strBracket, strBackBracket) { |
|
9456 |
var beforeIndex = str.indexOf(strBracket); |
|
9457 |
var backIndex = str.indexOf(strBackBracket); |
|
9458 |
var layers = 0; |
|
9459 |
while (beforeIndex < backIndex && beforeIndex >= 0) { |
|
9460 |
layers++; |
|
9461 |
beforeIndex = str.indexOf(strBracket, beforeIndex + strBracket.length) |
|
9462 |
} |
|
9463 |
while (layers > 1 && backIndex >= 0) { |
|
9464 |
layers--; |
|
9465 |
backIndex = str.indexOf(strBackBracket, backIndex + strBackBracket.length); |
|
9466 |
} |
|
9467 |
if (backIndex < 0) { |
|
9468 |
throw Error("括号未闭合"); |
|
9469 |
} |
|
9470 |
return backIndex; |
|
9471 |
} |
|
9472 |
var customDataBound = customDataBound || {}; |
|
9473 |
|
|
9474 |
//根据表单ID取得表单基本信息 |
|
9475 |
customDataBound.getFormbase = function (formid, callback) { |
|
9476 |
// if(customBase.options.formbaseInfo == ""){ |
|
9477 |
var dataObj = {}; |
|
9478 |
dataObj.formID = formid; |
|
9479 |
var requestRight = window.commonAjax("/formbase/getFormInfoService", dataObj, "GET", true); |
|
9480 |
requestRight.done(function (rs) { |
|
9481 |
callback(rs); |
|
9482 |
}) |
|
9483 |
|
|
9484 |
|
|
9485 |
// }else{ |
|
9486 |
// callback(customBase.options.formbaseInfo); |
|
9487 |
// } |
|
9488 |
} |
|
9489 |
|
|
9490 |
//表单保存 |
|
9491 |
customDataBound.savaFormbase = function (formbase, callback) { |
|
9492 |
////////////console.log(formbase); |
|
9493 |
var dataObj = {}; |
|
9494 |
dataObj = formbase; |
|
9495 |
console.log(formbase); |
|
9496 |
var requestRight = window.commonAjax("/formbase/saveformService", dataObj, "POST", true); |
|
9497 |
requestRight.done(function (rs) { |
|
9498 |
|
|
9499 |
callback(rs); |
|
9500 |
}); |
|
9501 |
} |
|
9502 |
|
|
9503 |
//表单数据保存 |
|
9504 |
customDataBound.fromSave = function (formid, formbase, callback) { |
|
9505 |
// if(window.localStorage.getItem("bussinessSystem")){ |
|
9506 |
// var flag = window.localStorage.getItem("bussinessSystem"); |
|
9507 |
// } |
|
9508 |
var dataObj = {}; |
|
9509 |
dataObj.formID = formid; |
|
9510 |
dataObj.data = formbase; |
|
9511 |
// dataObj.tenantID = "001"; |
|
9512 |
// dataObj.flag = flag; |
|
9513 |
//dataObj.flag = "cloud" |
|
9514 |
//console.log(dataObj); |
|
9515 |
if (customShow.exCouldNumber != undefined && customShow.exCouldNumber != '') {//保存时 传云单标号 李伟民 12-22 |
|
9516 |
_.extend(dataObj, { 'orderCode': customShow.exCouldNumber }); |
|
9517 |
}//保存时 传云单标号 李伟民 12-22 |
|
9518 |
//_.extend(dataObj,{'orderCode': '1012000170900005'});//临时修改 |
|
9519 |
var requestRight = window.commonAjax("/datamanagement/addFormDataService", dataObj, "POST", true); |
|
9520 |
requestRight.done(function (rs) { |
|
9521 |
callback(rs); |
|
9522 |
}); |
|
9523 |
} |
|
9524 |
|
|
9525 |
//表单数据编辑 |
|
9526 |
customDataBound.fromEdit = function (formid, formbase, dataRowNum, callback) { |
|
9527 |
var dataObj = {}; |
|
9528 |
// if(window.localStorage.getItem("bussinessSystem")){ |
|
9529 |
// var flag = window.localStorage.getItem("bussinessSystem"); |
|
9530 |
// } |
|
9531 |
// dataObj.flag = flag; |
|
9532 |
dataObj.formID = formid; |
|
9533 |
dataObj.dataRowNum = dataRowNum; |
|
9534 |
dataObj.data = formbase; |
|
9535 |
if (customShow.exCouldNumber != undefined && customShow.exCouldNumber != '') {//保存时 传云单标号 李伟民 12-22 |
|
9536 |
_.extend(dataObj, { 'orderCode': customShow.exCouldNumber }); |
|
9537 |
}//保存时 传云单标号 李伟民 12-22 |
|
9538 |
//_.extend(dataObj,{'orderCode': '1012000170900005'});//临时修改 |
|
9539 |
var requestRight = window.commonAjax("/datamanagement/updateFormDataService", dataObj, "POST", true); |
|
9540 |
requestRight.done(function (rs) { |
|
9541 |
|
|
9542 |
callback(rs); |
|
9543 |
}); |
|
9544 |
} |
|
9545 |
|
|
9546 |
// 获取表单设定数据源信息 |
|
9547 |
|
|
9548 |
// JSON:{"rspCode":"000000","rspDesc":"请求成功","data":[{"测试连接":["actor_id","first_name","last_name","last_update"]}]} |
|
9549 |
customDataBound.getDatasource = function (formID, callback) { |
|
9550 |
var dataObj = {}; |
|
9551 |
dataObj.formID = formID; |
|
9552 |
// dataObj.formID = '8888'; |
|
9553 |
// dataObj.tenantID = "001"; |
|
9554 |
var requestRight = window.commonAjax("/datasource/getDatasourceColumnsNameService", dataObj, "GET", true); |
|
9555 |
|
|
9556 |
requestRight.done(function (rs) { |
|
9557 |
if (rs.rspCode == "000000") { |
|
9558 |
callback(rs.data); |
|
9559 |
} else { |
|
9560 |
callback(rs.data); |
|
9561 |
} |
|
9562 |
}); |
|
9563 |
} |
|
9564 |
|
|
9565 |
// 获取当前表单设置字段的数据源信息 数据绑定 |
|
9566 |
// 参数: formID,tenantID |
|
9567 |
// JSON: {"rspCode":"000000","rspDesc":"请求成功","data":[{"单选按钮组测试":{"datasource":"","textcolumn":"","valuecolumn":""}}]} |
|
9568 |
customDataBound.getFieldDatasource = function (Datasource, callback) { |
|
9569 |
url = "/datasource/getDatasourceColumnsValueService?tenantID={tenantID}&databaseName={databaseName}&datasource={datasource}&columnNames={columnNames}&callbackId={callbackId}"; |
|
9570 |
url = url.replace("{databaseName}", Datasource.databaseName); |
|
9571 |
url = url.replace("{columnNames}", Datasource.columnNames); |
|
9572 |
url = url.replace("{datasource}", Datasource.datasource); |
|
9573 |
url = url.replace("{callbackId}", Datasource.callbackId); |
|
9574 |
|
|
9575 |
window.commonGetJson(url, callback); |
|
9576 |
|
|
9577 |
} |
|
9578 |
|
|
9579 |
// 获得主数据 |
|
9580 |
customDataBound.getElement = function (code, callbackId, callback) { |
|
9581 |
if (code != "") { |
|
9582 |
var dataObj = {}; |
|
9583 |
dataObj.tenantIDForMaster = 1; |
7b0ed4
|
9584 |
if(_.isString(code)){ |
Z |
9585 |
dataObj.code = code; |
|
9586 |
}else{ |
|
9587 |
dataObj.code = JSON.stringify(code); |
|
9588 |
} |
4d1219
|
9589 |
dataObj.callbackId = callbackId; |
B |
9590 |
//console.log(dataObj); |
|
9591 |
let customlocalStorage = window.localStorage.getItem("bussinessSystem"); |
|
9592 |
var reg = new RegExp('"', "g"); // service 修改 李元杰 11-16 |
|
9593 |
customlocalStorage = customlocalStorage.replace(reg, ""); // service 修改 李元杰 11-16 |
|
9594 |
console.log(customlocalStorage); |
|
9595 |
dataObj.flag = customlocalStorage; |
9022c2
|
9596 |
var requestRight = window.commonAjax("/te-csc-api/search/base/elementprivate", dataObj, "POST", true); |
4d1219
|
9597 |
|
B |
9598 |
requestRight.done(function (rs) { |
|
9599 |
console.log(rs) |
|
9600 |
if (rs.rspCode == "000000") { |
|
9601 |
console.log(rs) |
|
9602 |
callback(rs); |
|
9603 |
customShow.addTitle(); |
|
9604 |
SC.money_cur(); |
|
9605 |
// 12/13 |
|
9606 |
|
|
9607 |
console.log(window.localStorage.getItem('customShowFlag')) |
|
9608 |
if (window.localStorage.getItem('customShowFlag') == 1) { |
|
9609 |
// customShow.businessTypeAutoFun( 'businessTypeAuto','budget_itemCostType'); |
|
9610 |
SC.autoFieldKey(); |
|
9611 |
} |
|
9612 |
} else { |
|
9613 |
callback(rs); |
|
9614 |
console.log(rs) |
|
9615 |
toastr.error(rs.rspDesc.responseJSON); |
|
9616 |
} |
|
9617 |
}); |
|
9618 |
requestRight.error(function (rs) { |
|
9619 |
// console.log(rs) |
|
9620 |
// toastr.error(rs.responseJSON.rspDesc); |
|
9621 |
|
|
9622 |
}) |
|
9623 |
} else { |
|
9624 |
callback([]); |
|
9625 |
} |
|
9626 |
|
|
9627 |
} |
|
9628 |
|
|
9629 |
// 获得主数据 |
|
9630 |
customDataBound.getElement1 = function (opt) { |
|
9631 |
var dataObj = {}; |
|
9632 |
// dataObj.tenantIDForMaster = 1; |
|
9633 |
// dataObj.code =opt; |
|
9634 |
// dataObj.callbackId = callbackId; |
|
9635 |
var result; |
9022c2
|
9636 |
var requestRight = window.commonAjax("/te-csc-api/search/base/elementprivate1", opt, "POST", true, false); |
4d1219
|
9637 |
requestRight.done(function (rs) { |
B |
9638 |
if (rs.rspCode == "000000") { |
|
9639 |
result = rs; |
|
9640 |
} else { |
|
9641 |
result = rs; |
|
9642 |
} |
|
9643 |
}); |
|
9644 |
return result; |
|
9645 |
} |
|
9646 |
|
|
9647 |
// 获取当前表单设置字段的数据源信息 API数据取得 |
|
9648 |
// 参数: formID,tenantID |
|
9649 |
// JSON: {"rspCode":"000000","rspDesc":"请求成功","data":[{"单选按钮组测试":{"datasource":"","textcolumn":"","valuecolumn":""}}]} |
|
9650 |
customDataBound.getApiDatasource = function (url, callbackId, callback) { |
|
9651 |
// console.log(1); |
|
9652 |
var urls = url; |
|
9653 |
var url = url + "&callbackId={callbackId}"; |
|
9654 |
|
|
9655 |
url = url.replace("{callbackId}", callbackId); |
|
9656 |
// var xhr = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP'); |
|
9657 |
// xhr.open("GET", urls, true); |
|
9658 |
// debugger |
|
9659 |
// xhr.onreadystatechange = function () { |
|
9660 |
// var res = JSON.parse(xhr.responseText); |
|
9661 |
// console.log(res); |
|
9662 |
// } |
|
9663 |
$.ajax({ |
|
9664 |
type: "get", |
|
9665 |
url: urls, |
|
9666 |
async: true, |
|
9667 |
success: function (rs) { |
|
9668 |
console.log(url); |
|
9669 |
console.log(rs); |
|
9670 |
callback(rs, url); |
|
9671 |
} |
|
9672 |
}); |
|
9673 |
// // var url = url + "&callbackId={callbackId}"; |
|
9674 |
// // url = url.replace("{callbackId}", callbackId); |
|
9675 |
// // //////////console.log(url); |
|
9676 |
// // window.commonGetApiJson(url, callback); |
|
9677 |
// //////////console.log(url); |
|
9678 |
// //window.commonGetApiJson(url,callback); |
|
9679 |
} |
|
9680 |
|
|
9681 |
customDataBound.bindInterface = function (formid) {//绑定接口注册方法//保存前计算费用 李伟民 10 - 31 |
|
9682 |
var dataObj = {}; |
|
9683 |
dataObj.formID = formid; |
|
9684 |
var accessToken = JSON.parse(localStorage.getItem("token")).accessToken; |
|
9685 |
dataObj.access_token = accessToken; |
|
9686 |
var requestRight = window.commonAjax("/forminterface/getFormInterfaceListService", dataObj, "GET", true, false); |
|
9687 |
requestRight.done(function (rs) { |
|
9688 |
//console.log(rs); |
|
9689 |
customBase.interfaceData = rs.data; |
|
9690 |
|
|
9691 |
}) |
|
9692 |
}//保存前计算费用 李伟民 10 - 31 |
|
9693 |
|
|
9694 |
customDataBound.formsetting = function (formid, callback) { |
|
9695 |
// 工具栏自定义10/18 |
|
9696 |
$('.edit_form').html(""); |
|
9697 |
var type = ""; |
|
9698 |
var flag = window.localStorage.getItem("customShowFlag"); |
|
9699 |
switch (flag) { |
|
9700 |
case "1": type = "TJ"; break; |
|
9701 |
case "3": type = "XG"; break; |
|
9702 |
case "2": type = "XX"; break; |
|
9703 |
case "4": type = "LB"; break; |
|
9704 |
} |
|
9705 |
|
|
9706 |
//console.log(type); |
|
9707 |
var dataObj = {}; |
|
9708 |
dataObj.formID = formid; |
|
9709 |
dataObj.type = type; |
|
9710 |
console.log(dataObj) |
|
9711 |
var dataObjFlag = _.cloneDeep(dataObj); |
|
9712 |
delete dataObjFlag.type |
|
9713 |
var request = window.commonAjax("/formbase/getFormInfoService", dataObjFlag, "GET", true); |
|
9714 |
request.done(function (rs) { |
|
9715 |
if (rs.data != null) { |
|
9716 |
window.localStorage.setItem('bussinessSystem', rs.data.bussinesssystem) |
|
9717 |
} |
|
9718 |
}) |
|
9719 |
|
|
9720 |
|
|
9721 |
|
|
9722 |
var requestRight = window.commonAjax("/formsetting/getFormsettingInfoService", dataObj, "POST", true); |
|
9723 |
requestRight.done(function (rs) { |
|
9724 |
customDataBound.bindInterface(formid); |
|
9725 |
// ////console.log(rs); |
|
9726 |
//console.log(type); |
|
9727 |
if (rs.data.saveable == "0") { |
|
9728 |
$(".sure_box").hide(); |
|
9729 |
} |
|
9730 |
if (!rs.data.subCustomButton) { |
|
9731 |
$("#doself").remove(); |
|
9732 |
|
|
9733 |
} |
|
9734 |
if (rs.data.subCustomButton) { |
|
9735 |
// var dd=document.createElement('span'); |
|
9736 |
var formdata = []; |
|
9737 |
//console.log("查询类型"); |
|
9738 |
//console.log(type); |
|
9739 |
switch (type) { |
|
9740 |
case "TJ": formdata = rs.data.subCustomButton.addCustomButton; break; |
|
9741 |
case "XG": formdata = rs.data.subCustomButton.updateCustomButton; break; |
|
9742 |
case "XX": formdata = rs.data.subCustomButton.detailedCustomButton; break; |
|
9743 |
case "LB": formdata = rs.data.subCustomButton.listCustomButton; break; |
|
9744 |
} |
|
9745 |
//console.log("渲染结果"); |
|
9746 |
var srcd = document.createElement('script'); |
|
9747 |
// var tabledata=rs.data.customButtons; |
|
9748 |
srcd.type = "text/javascript"; |
|
9749 |
_.each(formdata, function (obt, i) { |
|
9750 |
var dd = document.createElement('span'); |
|
9751 |
dd.id = obt.buttonName + i; |
|
9752 |
//btn btn-default |
|
9753 |
dd.setAttribute("class", "btn_myself"); |
|
9754 |
dd.setAttribute("buttonId", obt.buttonId); |
|
9755 |
dd.innerHTML = "<i class='icon iconfont icon-kongjian_danhangwenben' style='text-align: left;'></i>" + obt.buttonName; |
|
9756 |
|
|
9757 |
$(".edit_form").append(dd); |
|
9758 |
|
|
9759 |
//console.log(obt.buttonName); |
|
9760 |
if (obt.buttonName == "驳回") { |
|
9761 |
//console.log("等于撤回"); |
|
9762 |
// 定义审批流程定义的方法 |
|
9763 |
// 撤销流程实例 |
|
9764 |
|
|
9765 |
$("#" + dd.id).click(function () { |
|
9766 |
var process = localStorage.getItem("processid"); |
|
9767 |
|
|
9768 |
//console.log(process); |
|
9769 |
var dd = JSON.parse(process); |
|
9770 |
var tent = JSON.parse(localStorage.getItem("tenantID")).tenantID; |
|
9771 |
|
|
9772 |
//console.log(dd.data); |
|
9773 |
window.queryAjaxs("ubp-api-seache/process/inst/log", { "processInstId": dd.data.processInstId }, "POST", true).done(function (res) { |
|
9774 |
//console.log("打印回执"); |
|
9775 |
//console.log(res); |
|
9776 |
if (res != undefined) { |
|
9777 |
//console.log("发送请求"); |
|
9778 |
window.queryAjaxs("ubp-api-control/process/inst/drawBack", { "processInstId": res.data[0].processInstId, "activityInstId": res.data[0].activityInstId }, "POST", true).done(function (res) { |
|
9779 |
//console.log("打印回执"); |
|
9780 |
//console.log(res); |
|
9781 |
if (res.data == 1) { |
|
9782 |
//console.log("撤销成功"); |
|
9783 |
customBase.alert('S',"撤销成功"); |
|
9784 |
// localStorage.removeItem('userinfo') |
|
9785 |
} |
|
9786 |
}) |
|
9787 |
} |
|
9788 |
|
|
9789 |
}) |
|
9790 |
|
|
9791 |
}); |
|
9792 |
|
|
9793 |
// 结束流程实例 |
|
9794 |
} else if (obt.buttonName == "结束") { |
|
9795 |
$("#" + dd.id)[0].setAttribute('data-toggle', "modal"); |
|
9796 |
$("#" + dd.id)[0].setAttribute('data-target', ".bs-example-modal-sm"); |
|
9797 |
$("#" + dd.id).click(function () { |
|
9798 |
var processLog = JSON.parse(localStorage.getItem("processLog")); |
|
9799 |
if (processLog != null && processLog != undefined) { |
|
9800 |
} else { |
|
9801 |
$("#liucheng").html("<h3 class='sp_title'>请先创建一个流程<h3>"); |
|
9802 |
return null; |
|
9803 |
} |
|
9804 |
if (processLog[0].processState == 60) { |
|
9805 |
$("#liucheng").html("<h3 class='sp_title'>流程已结束<h3>"); |
|
9806 |
return null; |
|
9807 |
} else { |
|
9808 |
var inputs = "<h3 class='sp_title'>是否确认结束?<h3><br/>" |
|
9809 |
+ "<div class='footerbtn' style='display:flex;justify-content:space-around;'><input class='btn btn-default choosebtn2' type='button' value='确定' onclick='over(true)'/> <input type='button' class='btn btn-default choosebtn' value='取消' onclick='over(false)'/></div>"; |
|
9810 |
$("#liucheng").html(inputs); |
|
9811 |
$("#sssd").click(); |
|
9812 |
|
|
9813 |
} |
|
9814 |
}); |
|
9815 |
|
|
9816 |
} else if (obt.buttonName == "退回") { |
|
9817 |
$("#" + dd.id)[0].setAttribute('data-toggle', "modal"); |
|
9818 |
$("#" + dd.id)[0].setAttribute('data-target', ".bs-example-modal-sm"); |
|
9819 |
$("#" + dd.id).click(function () { |
|
9820 |
var processLog = JSON.parse(localStorage.getItem("processLog")); |
|
9821 |
if (processLog[0].processState == 60) { |
|
9822 |
customBase.alert('E',"流程已结束"); |
|
9823 |
return null; |
|
9824 |
} else { |
|
9825 |
if (processLog != "null" && processLog != undefined) { |
|
9826 |
console.log(processLog.length); |
|
9827 |
if (processLog.length == 1) { |
|
9828 |
customBase.alert('W',"无可退回活动"); |
|
9829 |
return null; |
|
9830 |
} |
|
9831 |
} else { |
|
9832 |
customBase.alert('W',"请先创建一个流程"); |
|
9833 |
return; |
|
9834 |
} |
|
9835 |
//请求可退回活动项 |
|
9836 |
var isshow = false; |
|
9837 |
var ss = { |
|
9838 |
"processInstId": processLog[0].processInstId |
|
9839 |
} |
|
9840 |
var requestSingleForm = window.commonAjax("/ubp-api-seache/process/get/back", ss, "POST", true); |
|
9841 |
requestSingleForm.done(function (rs) { |
|
9842 |
console.log(rs); |
|
9843 |
var res = rs.data; |
|
9844 |
if (res != undefined & res != null) { |
|
9845 |
|
|
9846 |
if (res.length > 0) { |
|
9847 |
|
|
9848 |
var inputs = "<h3 class='sp_title'>请选择要退回的活动</h3><br/>"; |
|
9849 |
for (var i = 0; i < res.length; i++) { |
|
9850 |
if (i == 0) { |
|
9851 |
inputs += "<input style='margin-left:-9px !important;' type='radio' onClick='choosebox(" + i + ")' class='act acts' value=" + res[i].activityDefId + " name='task' />" + res[i].activityDefName + "</br>"; |
|
9852 |
} else { |
|
9853 |
inputs += "<input type='radio' onClick='choosebox(" + i + ")' class='act acts' value=" + res[i].activityDefId + " name='task' />" + res[i].activityDefName + "</br>"; |
|
9854 |
} |
|
9855 |
} |
|
9856 |
inputs += "<div class='footerbtn' style='display:flex;justify-content:space-around;'><input class='btn btn-default choosebtn' type='button' value='取消' onclick='tui(false)'/><input type='button' class='btn btn-default choosebtn2' value='确定' onclick='tui(true," + activeitem + ")'/>"; |
|
9857 |
inputs += "</div>"; |
|
9858 |
console.log(inputs); |
|
9859 |
$("#liucheng").html(inputs); |
|
9860 |
|
|
9861 |
|
13ec33
|
9862 |
// callback(); |
4d1219
|
9863 |
} |
B |
9864 |
} else { |
|
9865 |
$("#liucheng").html("<h3 class='sp_title'>无可退回项<h3>"); |
|
9866 |
|
|
9867 |
return null; |
|
9868 |
} |
|
9869 |
}); |
|
9870 |
|
|
9871 |
} |
|
9872 |
}); |
|
9873 |
} else if (obt.buttonName == "审批") { |
|
9874 |
$("#" + dd.id).click(function () { |
|
9875 |
|
|
9876 |
var processLog = JSON.parse(localStorage.getItem("processLog")); |
|
9877 |
if (processLog != null && processLog != undefined) { |
|
9878 |
} else { |
|
9879 |
customBase.alert('W',"请先创建一个流程"); |
|
9880 |
return null; |
|
9881 |
} |
|
9882 |
if (processLog[0].processState == 60) { |
|
9883 |
customBase.alert('E',"流程已结束"); |
|
9884 |
return null; |
|
9885 |
} |
|
9886 |
var inputs = "<h3 class='sp_title'>请输入审批语</h3><br/>" + "<textarea maxlength='200' onKeyUp='listenword()' class='stexta' type='test' id='datas'></textarea><span class='wordwrap'><var class='word'>0</var>/200</span><br/>" |
|
9887 |
+ "<div class='footerbtn' style='display:flex;justify-content:space-around;'><input class='btn btn-default choosebtn' type='button' value='取消' onclick='zhixing(false)'/><input class='btn btn-default choosebtn2' type='button' value='确定' onclick='zhixing(true)'/></div>"; |
|
9888 |
$("#liucheng").html(inputs); |
|
9889 |
$("#" + dd.id)[0].setAttribute('data-toggle', "modal"); |
|
9890 |
$("#" + dd.id)[0].setAttribute('data-target', ".bs-example-modal-sm"); |
|
9891 |
}); |
|
9892 |
|
|
9893 |
} else { |
|
9894 |
$("#" + dd.id).click(function () { |
|
9895 |
|
|
9896 |
var fuc = obt.methodName + "()"; |
|
9897 |
eval(fuc); |
|
9898 |
//console.log(fuc); |
|
9899 |
//调用自定义js中的方法 |
|
9900 |
//console.log("调用自定义方法"); |
|
9901 |
fuc; |
|
9902 |
|
|
9903 |
}); |
|
9904 |
} |
|
9905 |
}); |
|
9906 |
|
|
9907 |
srcd.src = rs.data.resourceFilePath; |
|
9908 |
|
|
9909 |
// $("#customShow").append(srcd); |
|
9910 |
if(rs.data.resourceFilePath != undefined && flag != 3 && rs.data.resourceFilePath != ''){//自定义JS加载修改 李伟民 0109 |
|
9911 |
document.getElementsByTagName("head")[0].appendChild(srcd); // 接口注册 初期化事件 李伟民 12-18 |
|
9912 |
srcd.onload = function () { |
|
9913 |
_.each(customBase.interfaceData, function (data) { |
|
9914 |
if (data.interfacemethod == "interfaceInit3rd") { |
|
9915 |
if (data.customInterfacemethod != undefined && data.customInterfacemethod != '') { |
|
9916 |
var funstr = data.customInterfacemethod + "()"; |
|
9917 |
eval(funstr); |
|
9918 |
} |
|
9919 |
} |
|
9920 |
}); |
|
9921 |
callback(rs);//自定义JS加载修改 李伟民 0109 |
|
9922 |
} |
|
9923 |
}else{ |
|
9924 |
callback(rs);//自定义JS加载修改 李伟民 0109 |
|
9925 |
} |
13ec33
|
9926 |
|
4d1219
|
9927 |
// $(".preview-edit-pane").append(dd); |
B |
9928 |
// $("#"+dd.id).click(function(){ |
|
9929 |
|
|
9930 |
// var fuc=arr[1]+"()"; |
|
9931 |
// eval(fuc); |
|
9932 |
// ////console.log(fuc); |
|
9933 |
|
|
9934 |
// ////console.log("调用自定义方法"); |
|
9935 |
// fuc; |
|
9936 |
|
|
9937 |
// }); |
|
9938 |
}else{ |
|
9939 |
callback(rs);//自定义JS加载修改 李伟民 0109 |
|
9940 |
} |
|
9941 |
}); |
|
9942 |
var dataObjDo = {}; |
|
9943 |
dataObjDo = dataObj; |
|
9944 |
delete dataObjDo.type |
|
9945 |
console.log(dataObj) |
|
9946 |
var requestRight = window.commonAjax("/tabConfiguration/queryTabConfiguration", dataObjDo, "POST", true); |
|
9947 |
requestRight.done(function (rs) { |
13ec33
|
9948 |
//2017/10/31 李元杰 附件 流程先洗 选项卡添加 |
4d1219
|
9949 |
console.log(rs) |
B |
9950 |
$('.boxTwo').hide(); |
|
9951 |
$('.sTab').find('ul li').eq(1).hide(); |
|
9952 |
$('.boxThr').hide(); |
|
9953 |
$('.sTab').find('ul li').eq(2).hide(); |
|
9954 |
if (rs.data != '') { |
|
9955 |
if (rs.data[0].appendix == "do") { |
|
9956 |
console.log($('.sTab').find('ul li')) |
|
9957 |
$('.sTab').find('ul li').eq(1).show(); |
|
9958 |
} else { |
|
9959 |
$('.boxTwo').hide(); |
|
9960 |
$('.sTab').find('ul li').eq(1).hide(); |
|
9961 |
} |
|
9962 |
if (rs.data[0].processInfo == "do") { |
|
9963 |
$('.sTab').find('ul li').eq(2).show(); |
|
9964 |
} else { |
|
9965 |
$('.boxThr').hide(); |
|
9966 |
$('.sTab').find('ul li').eq(2).hide(); |
|
9967 |
} |
|
9968 |
} |
|
9969 |
}); |
|
9970 |
} |
|
9971 |
|
|
9972 |
|
|
9973 |
var xhSelect = xhSelect || {}; |
|
9974 |
xhSelect.scope = { |
|
9975 |
sel_val_lst: { |
|
9976 |
// 'F073001':"常规出差" |
|
9977 |
}, |
|
9978 |
rm_optionFlag: false |
|
9979 |
}; |
|
9980 |
|
|
9981 |
xhSelect.options = { |
|
9982 |
selectId: "", |
|
9983 |
multiple: false, |
|
9984 |
listData: [], |
|
9985 |
width: 200, |
|
9986 |
setDiv: "" |
|
9987 |
} |
|
9988 |
xhSelect.setValue = function (itemId, listData) { |
|
9989 |
xhSelect.setValue(itemId, listData, 0); |
|
9990 |
} |
|
9991 |
xhSelect.setValue = function (itemId, listData, N) { |
|
9992 |
var selectItme = $("#" + itemId + " .selectItme"); |
|
9993 |
var listDataJson = {}; |
|
9994 |
if (_.isString(listData)) {// 下拉款填值 修改 李伟民 11-14 |
|
9995 |
listData = listData.split(",") |
|
9996 |
}// 下拉款填值 修改 李伟民 11-14 |
|
9997 |
console.log(listData); |
|
9998 |
for (var i = 0; i < listData.length; i++) { |
|
9999 |
listDataJson[listData[i]] = "1"; |
|
10000 |
} |
|
10001 |
|
|
10002 |
var $options = $($("#" + itemId)[0]).find('select > option'); |
|
10003 |
var vals_selected = []; |
|
10004 |
var j = 0; |
|
10005 |
$options.each(function () { |
|
10006 |
for (var jsonstr in listDataJson) { |
|
10007 |
if ($(this).val() == jsonstr) { |
|
10008 |
vals_selected[j] = {}; |
|
10009 |
vals_selected[j].value = $(this).val(); |
|
10010 |
vals_selected[j].label = $(this).text(); |
|
10011 |
j++; |
|
10012 |
} |
|
10013 |
} |
|
10014 |
}); |
|
10015 |
var $el = $($("." + itemId + "value")[N]); |
|
10016 |
var set_valueleft = function (vals_selected) { |
|
10017 |
var $divContainer = ""; |
|
10018 |
var selectedItem = {}; |
|
10019 |
for (var i = 0; i < vals_selected.length; i++) { |
6f4af7
|
10020 |
//张吉男修改 下拉框发布 |
4d1219
|
10021 |
$divContainer += '<div class="val-card ng-binding ng-scope ' + vals_selected[i].value + |
B |
10022 |
'Class" ng-repeat="sel_val in sel_val_lst track by $index" ng-show="true" multiple="" load-data="" style="height:40px;line-height:25px;">' + |
6f4af7
|
10023 |
vals_selected[i].label + '<a onclick="xhSelect.rm_option(this,\'' + vals_selected[i].value + |
Z |
10024 |
'\')" ng-href="javascript:void(0);" href="javascript:void(0);">' + ' <i class="icon iconfont icon-guanbijiantou" val="' + |
4d1219
|
10025 |
vals_selected[i].value + '" style="color:#20b4aa;"></i></li>' + ' </a>' + ' </div>'; |
B |
10026 |
|
|
10027 |
selectedItem[vals_selected[i].value] = "1"; |
|
10028 |
} |
|
10029 |
$divContainer += '<div class="suffix">' + '<i class="fa fa-angle-down" aria-hidden="true"></i>' + '</div>'; |
|
10030 |
$el.find(".select-container").empty(); |
|
10031 |
$el.find(".select-container").append($divContainer); |
|
10032 |
var selectedItemJson = JSON.stringify(selectedItem); |
|
10033 |
if ($el.find(".selectItme").length != 0) { |
|
10034 |
$el.find(".selectItme")[0].setAttribute("value", selectedItemJson); |
|
10035 |
} |
|
10036 |
|
|
10037 |
}; |
|
10038 |
set_valueleft(vals_selected); |
|
10039 |
} |
|
10040 |
xhSelect.getValue = function (itemId) { |
|
10041 |
var returnItem = []; |
|
10042 |
var selectItme = $("#" + itemId + " .selectItme"); |
|
10043 |
console.log(selectItme) |
|
10044 |
for (var i = 0; i < selectItme.length; i++) { |
|
10045 |
if (selectItme[i].getAttribute("value") == "") { |
|
10046 |
var selectItmeJson = {}; |
|
10047 |
} else { |
|
10048 |
////console.log(selectItme[i].getAttribute("value")); |
|
10049 |
var selectItmeJson = $.parseJSON(selectItme[i].getAttribute("value")); |
|
10050 |
} |
|
10051 |
|
|
10052 |
var jn = 0; |
|
10053 |
returnItem[i] = []; |
|
10054 |
for (j in selectItmeJson) { |
|
10055 |
returnItem[i][jn] = j; |
|
10056 |
jn++; |
|
10057 |
} |
|
10058 |
} |
|
10059 |
return returnItem; |
|
10060 |
} |
|
10061 |
// 下拉框主数据渲染 |
|
10062 |
xhSelect.setXhSelect = function (options) { |
|
10063 |
////console.log(options); |
|
10064 |
////console.log(_.cloneDeep(xhSelect.options)); |
|
10065 |
//解决主数据重复 |
|
10066 |
var options_xh = _.cloneDeep(xhSelect.options); |
|
10067 |
options_xh.listData = []; |
|
10068 |
//解决主数据重复END |
|
10069 |
options = $.extend(true, options_xh, options); |
|
10070 |
var optionArr = ""; |
|
10071 |
console.log(options.selectId); |
|
10072 |
////console.log(options.listData); |
|
10073 |
// ////console.log(options.listData.length); |
|
10074 |
for (var i = 0; i < options.listData.length; i++) { |
|
10075 |
optionArr += '<option value="' + options.listData[i].value + '">' + options.listData[i].text + '</option>'; |
|
10076 |
} |
|
10077 |
console.log(optionArr); |
|
10078 |
var multiple = ""; |
|
10079 |
if (options.multiple) { |
|
10080 |
multiple = 'multiple'; |
|
10081 |
} |
|
10082 |
|
|
10083 |
var $xhSelectDiv = '' + |
|
10084 |
'<div class="selectClass">' + |
|
10085 |
'<div ng-transclude="" style="display:none;">' + |
|
10086 |
'<select class="select_get ng-scope" load-data="" ' + multiple + ' >' + |
|
10087 |
optionArr + |
|
10088 |
'</select>' + |
|
10089 |
'</div>' + |
|
10090 |
'<div class="selectItme" style="display:none;" value=""></div>' + |
|
10091 |
'<div class="select3-element" style="width:100%;max-width: ' + options.width + 'px">' + |
|
10092 |
' <div class="select-container select-container_box" gccolname="ex_c11"> ' + |
|
10093 |
' <div class="suffix">' + |
|
10094 |
' <i class="fa fa-angle-down" aria-hidden="true"></i>' + |
|
10095 |
' </div>' + |
|
10096 |
' </div>' + |
|
10097 |
' </div> ' + |
|
10098 |
'</div>'; |
|
10099 |
console.log(options); |
|
10100 |
if (options.setDiv == '') { |
|
10101 |
var $el = $("#" + options.selectId); |
|
10102 |
} else { |
|
10103 |
var $el = $("." + options.setDiv); |
|
10104 |
} |
|
10105 |
console.log(optionArr) |
|
10106 |
console.log($xhSelectDiv) |
|
10107 |
_.each($el, function (sel) {//添加记录 重复问题 李伟民11-14 主数据丢失 11-29 再次修改 |
|
10108 |
if ($(sel).find(".selectClass").length == 0) { |
|
10109 |
$(sel).append($xhSelectDiv) |
|
10110 |
} else { |
|
10111 |
$(sel).find(".selectClass").find(".select_get").html(optionArr); |
|
10112 |
} |
|
10113 |
})//添加记录 重复问题 李伟民11-14 主数据丢失 11-29 再次修改 |
|
10114 |
|
|
10115 |
|
|
10116 |
//添加记录 重复问题 李伟民11-14 |
|
10117 |
// $("#"+options.selectId).find() |
|
10118 |
|
|
10119 |
xhSelect.selectContainer(options); |
|
10120 |
customLinkageAnalysis.bindLinkage(); |
|
10121 |
//行程排序初期化 |
|
10122 |
customShow.journeySort(); |
|
10123 |
} |
|
10124 |
xhSelect.rm_option = function (val, vals_selected) { |
|
10125 |
xhSelect.scope.rm_optionFlag = true; |
|
10126 |
console.log(val); |
|
10127 |
console.log(vals_selected) |
|
10128 |
$('div.drop_down_sel').remove(); |
|
10129 |
var selectItmeJson = $($(val).parent().parent().parent().parent()).find(".selectItme")[0].getAttribute("value"); |
|
10130 |
|
|
10131 |
var selectItme = $.parseJSON(selectItmeJson); |
|
10132 |
delete selectItme[vals_selected]; |
|
10133 |
selectItmeJson = JSON.stringify(selectItme); |
|
10134 |
$($(val).parent().parent().parent().parent()).find(".selectItme")[0].setAttribute('value', selectItmeJson); |
6f4af7
|
10135 |
|
Z |
10136 |
//张吉男修改 下拉框默认值不可以清空 |
|
10137 |
var cla=new RegExp("disableColor"); |
|
10138 |
//console.log(cla.test($(val).parent().parent().attr("class"))); |
|
10139 |
//判断下拉框是否是可编辑 |
|
10140 |
if(!(cla.test($(val).parent().parent().attr("class")))){ |
|
10141 |
$(val).parent().remove(); |
|
10142 |
} |
4d1219
|
10143 |
setTimeout(function () { |
B |
10144 |
xhSelect.scope.rm_optionFlag = false; |
|
10145 |
}, 500); |
|
10146 |
} |
|
10147 |
xhSelect.selectContainer = function (options) { |
|
10148 |
var itemId = options.selectId; |
|
10149 |
if (options.setDiv == '') { |
|
10150 |
var $el = $("#" + itemId); |
|
10151 |
} else { |
|
10152 |
var $el = $("." + options.setDiv); |
|
10153 |
} |
|
10154 |
$el.find('div.select-container').on('click', function (event) { |
|
10155 |
var selectedItem = $el.find(".selectItme")[0].getAttribute("value"); |
|
10156 |
// 12/4 李元杰 |
|
10157 |
$('.zTreeDemoBackground').css("display", "none"); |
|
10158 |
$(".search_input").css("display", "none"); |
|
10159 |
console.log(selectedItem); |
|
10160 |
console.log(event); |
|
10161 |
console.log($(this)) |
|
10162 |
////console.log("-------------------this-----------------------------------"); |
|
10163 |
if ($el[0].className.indexOf("readonly") > -1) { |
|
10164 |
return; |
|
10165 |
} |
|
10166 |
if (selectedItem != "") { |
|
10167 |
selectedItem = $.parseJSON(selectedItem); |
|
10168 |
} |
|
10169 |
|
|
10170 |
if (xhSelect.scope.rm_optionFlag) { |
|
10171 |
return; |
|
10172 |
} |
|
10173 |
console.log(2) |
|
10174 |
$('div.drop_down_sel').remove(); |
|
10175 |
var $select = $el.find('select'); |
|
10176 |
var isMultiple = $select.attr('multiple'); |
|
10177 |
var $options = $el.find('select > option'); |
|
10178 |
////console.log($el); |
|
10179 |
////console.log($options); |
|
10180 |
var $options_str = '<ul>' + '<li class="sel_query">' + '<input type="text" name="query" >' + '</li>' + '</ul>'; |
|
10181 |
|
|
10182 |
$options_str += '<div class="select "><ul class="line">'; |
|
10183 |
|
|
10184 |
if ($select.attr('multiple')) { |
|
10185 |
$options_str += '<li class="ui-state-default" style="height:28px"><span class="custom-check "' + |
|
10186 |
' value="All" label="全选" ><i class="label"></i>全选</span></li>'; |
|
10187 |
} |
|
10188 |
$options.each(function () { |
|
10189 |
var checked = ''; |
|
10190 |
if (selectedItem[$(this).val()] != undefined) { |
|
10191 |
checked = 'cur'; |
|
10192 |
} |
|
10193 |
$options_str += '<li class="ui-state-default" style="height:28px"><span class="custom-check ' + checked + |
|
10194 |
'" value="' + $(this).val() + '" label="' + $(this).text() + '' + '" title="' + $(this).text() + '"><i class="label"></i>' + $(this).text() + '</span></li>' |
|
10195 |
}); |
|
10196 |
|
|
10197 |
$options_str += '</ul></div>'; |
|
10198 |
console.log($options_str) |
|
10199 |
console.log(3) |
|
10200 |
$("div.drop_down_sel").remove(); |
|
10201 |
var $select_obj = $('<div drop-down-selector="" filterlist="searchlist" class="drop_down_sel" style="position: absolute;">' + $options_str + '</div>'); |
|
10202 |
$el.find('div.select3-element').append($select_obj); |
|
10203 |
$('body').off('click.sel').on('click.sel', function () { |
|
10204 |
console.log(5); |
|
10205 |
$('div.drop_down_sel').remove(); |
|
10206 |
$('.zTreeDemoBackground').css("display", "none"); |
|
10207 |
$(".search_input").css("display", "none"); |
|
10208 |
}); |
|
10209 |
$('div.drop_down_sel').off('click.sel').on('click.sel', function (event) { |
|
10210 |
|
|
10211 |
event.stopPropagation(); |
|
10212 |
}); |
|
10213 |
console.log(6) |
|
10214 |
$select_obj.find('input[name="query"]').on('keyup', |
|
10215 |
function () { |
|
10216 |
var $el = $(this); |
|
10217 |
var inputs = $select_obj.find('.custom-check'); |
|
10218 |
inputs.each(function () { |
|
10219 |
var val = $(this).attr('label'); |
|
10220 |
var input_val = $el.val(); |
|
10221 |
if (val.indexOf(input_val) > -1) { |
|
10222 |
$(this).closest('li').show(); |
|
10223 |
} else { |
|
10224 |
$(this).closest('li').hide(); |
|
10225 |
} |
|
10226 |
}); |
|
10227 |
}); |
|
10228 |
|
|
10229 |
$select_obj.find('.custom-check').on('click', function () { |
|
10230 |
if (this.className.indexOf("readonly") > -1) { |
|
10231 |
return; |
|
10232 |
} |
|
10233 |
$(this).toggleClass('cur'); |
|
10234 |
if ($(this)[0].getAttribute("value") == "All") { |
|
10235 |
if (this.className.indexOf("cur") > -1) { |
|
10236 |
$($(this).parent().parent()).find(".custom-check").addClass("cur"); |
|
10237 |
} else { |
|
10238 |
$($(this).parent().parent()).find(".cur").removeClass('cur'); |
|
10239 |
} |
|
10240 |
} |
|
10241 |
|
|
10242 |
var set_valueleft = function (vals_selected) { |
|
10243 |
var $divContainer = ""; |
|
10244 |
var selectedItem = {}; |
|
10245 |
for (var i = 0; i < vals_selected.length; i++) { |
|
10246 |
$divContainer += '<div class="val-card ng-binding ng-scope ' + vals_selected[i].value + |
|
10247 |
'Class" ng-repeat="sel_val in sel_val_lst track by $index" ng-show="true" multiple="" load-data="" style="height:40px;line-height:25px;">' + |
|
10248 |
vals_selected[i].label + '<a onclick="xhSelect.rm_option(this,\'' + vals_selected[i].value + |
|
10249 |
'\')" ng-href="javascript:void(0);" href="javascript:void(0);">' + ' <i class="icon iconfont icon-guanbijiantou" val="' + |
|
10250 |
vals_selected[i].value + '" style="color:#20b4aa;"></i>' + ' </a>' + ' </div>'; |
|
10251 |
selectedItem[vals_selected[i].value] = "1"; |
|
10252 |
} |
|
10253 |
$divContainer += '<div class="suffix">' + '<i class="fa fa-angle-down" aria-hidden="true"></i>' + '</div>'; |
|
10254 |
$el.find(".select-container").empty(); |
|
10255 |
$el.find(".select-container").append($divContainer); |
|
10256 |
var selectedItemJson = JSON.stringify(selectedItem); |
|
10257 |
$el.find(".selectItme")[0].setAttribute("value", selectedItemJson); |
|
10258 |
$el.find(".select_get").trigger("change.value");//下拉框 公式 |
|
10259 |
}; |
|
10260 |
var vals_selected = []; |
|
10261 |
var vals_selected_item = []; |
|
10262 |
var checkboxChecked = false; |
|
10263 |
var checkboxValue = $(this)[0].getAttribute("value"); |
|
10264 |
var checkboxLabel = $(this)[0].getAttribute("label"); |
|
10265 |
if ($(this)[0].className.indexOf('cur') > -1) { |
|
10266 |
checkboxChecked = true; |
|
10267 |
} |
|
10268 |
if (!isMultiple) { |
|
10269 |
vals_selected = [{ |
|
10270 |
'value': checkboxValue, |
|
10271 |
'label': checkboxLabel |
|
10272 |
}]; |
|
10273 |
set_valueleft(vals_selected); |
|
10274 |
console.log(7) |
|
10275 |
$('div.drop_down_sel').remove(); |
|
10276 |
} else { |
|
10277 |
var vls = []; |
|
10278 |
var values = $($(this).parent().parent()).find('.cur'); |
|
10279 |
var j = 0; |
|
10280 |
for (var i = 0; i < values.length; i++) { |
|
10281 |
if (values[i].getAttribute("value") != "All") { |
|
10282 |
vals_selected[j] = {}; |
|
10283 |
vals_selected[j].value = values[i].getAttribute("value"); |
|
10284 |
vals_selected[j].label = values[i].getAttribute("label"); |
|
10285 |
j++; |
|
10286 |
} |
|
10287 |
} |
|
10288 |
set_valueleft(vals_selected); |
|
10289 |
} |
|
10290 |
}); |
|
10291 |
event.stopPropagation(); |
|
10292 |
}); |
|
10293 |
} |
|
10294 |
|
|
10295 |
//customBase.reCharge = function(){//重新记账 李伟民 2017-10-18 21:30 |
|
10296 |
// //console.log(customBase); |
|
10297 |
// //console.log(customShow); |
|
10298 |
// var rePostData = {}; |
|
10299 |
// rePostData['formID'] = customShow.options.formid; |
|
10300 |
// rePostData['dataRowNum'] = customShow.options.dataRowNum; |
|
10301 |
// var reCharge_request = window.cloudAjax("epc-tenant/accounting/record",rePostData,"POST",true); |
|
10302 |
// reCharge_request.done(function(res){ |
|
10303 |
// //console.log(res); |
|
10304 |
// }) |
|
10305 |
//}//重新记账 李伟民 2017-10-18 21:30 end |
|
10306 |
|
|
10307 |
//customBase.checkItem = function(){//提交验证 李伟民2017-10-19 15:52 |
|
10308 |
// //console.log(customBase); |
|
10309 |
// //console.log(customShow); |
|
10310 |
// //画面项目取得 --------------------------画面项目取得------ |
|
10311 |
// var items = customShow.getItems(); |
|
10312 |
// ////console.log(items) |
|
10313 |
// // 画面check |
|
10314 |
// var returnfromCheck = customShow.initEvent.fromCheck(items); //-------------------- |
|
10315 |
// if(returnfromCheck){ |
|
10316 |
//// return; |
|
10317 |
// } |
|
10318 |
// |
|
10319 |
// |
|
10320 |
// var rules = customShow.options.jsonLinkage; |
|
10321 |
// if(!_.isNull(rules) && rules != undefined){ |
|
10322 |
// rules = JSON.parse(rules); |
|
10323 |
// //console.log(rules); |
|
10324 |
// var checkId = []; |
|
10325 |
// _.each(rules,function(ru){ |
|
10326 |
// _.each(ru.results,function(res){ |
|
10327 |
// if(res.mode == "2" || res.mode == "0"){ |
|
10328 |
// checkId.push(ru.event.eventFieldId); |
|
10329 |
// return false; |
|
10330 |
// } |
|
10331 |
// }) |
|
10332 |
// }); |
|
10333 |
// checkId = _.uniq(checkId); |
|
10334 |
// //console.log(checkId); |
|
10335 |
// _.each(checkId,function(cid){ |
|
10336 |
// $("[id='" + cid + "']").trigger("change.check"); |
|
10337 |
// }); |
|
10338 |
// } |
|
10339 |
//}//提交验证 李伟民2017-10-19 15:52 end |
|
10340 |
|
|
10341 |
// function checkSameDay(day1, day2) {//判断是否为同一天 李伟民 2017-10-20 17:00 |
|
10342 |
// var seconds; |
|
10343 |
// seconds = day1 - day2; |
|
10344 |
// //console.log(seconds); |
|
10345 |
// if (seconds < 24 * 60 * 60 * 1000 && seconds >= 0) { |
|
10346 |
// return true; |
|
10347 |
// } else { |
|
10348 |
// return false; |
|
10349 |
// } |
|
10350 |
// }//判断是否为同一天 李伟民 2017-10-20 17:00 end |
|
10351 |
|
|
10352 |
// customBase.checkTimeCross = function () {//跨行程验证时间 李伟民 2017-10-20 11:35 |
|
10353 |
// //console.log(customBase); |
|
10354 |
// //console.log(customShow); |
|
10355 |
// var items = customShow.getItems(); |
|
10356 |
// //console.log(items); |
|
10357 |
// var itemKey = _.keys(customBase.options.customItems); |
|
10358 |
// var subItem = []; |
|
10359 |
// _.each(itemKey, function (keys) { |
|
10360 |
// if (customBase.options.customItems[keys].type == "subform") { |
|
10361 |
// subItem.push(customBase.options.customItems[keys].fieldKey); |
|
10362 |
// } |
|
10363 |
// }); |
|
10364 |
// var FromDateArr = []; |
|
10365 |
// var LeaveDateArr = []; |
|
10366 |
// //console.log(subItem); |
|
10367 |
// _.each(subItem, function (sub) { |
|
10368 |
// if (items[sub] != undefined) { |
|
10369 |
// _.each(items[sub], function (isub, i) { |
|
10370 |
// if (isub.FromDate != undefined) { |
|
10371 |
// FromDateArr.push({ "value": new Date(isub.FromDate), "num": i, "property": customBase.options.customItems['FromDate'] }); |
|
10372 |
// } |
|
10373 |
// if (isub.LeaveDate != undefined) { |
|
10374 |
// LeaveDateArr.push({ "value": new Date(isub.LeaveDate), "num": i, "property": customBase.options.customItems['LeaveDate'] }); |
|
10375 |
// } |
|
10376 |
// }); |
|
10377 |
// } |
|
10378 |
// }); |
|
10379 |
// //console.log(FromDateArr); |
|
10380 |
// //console.log(LeaveDateArr); |
|
10381 |
// if (FromDateArr.length > 1 && LeaveDateArr.length > 1 && FromDateArr.length == LeaveDateArr.length) { |
|
10382 |
// _.each(FromDateArr, function (fdate, k) { |
|
10383 |
// if (k > 0) { |
|
10384 |
// //console.log(checkSameDay(fdate.value,LeaveDateArr[k-1].value)); |
|
10385 |
// if (checkSameDay(fdate.value, LeaveDateArr[k - 1].value) == false) { |
|
10386 |
// var message = customShow.options.customItemShow.item[fdate.property.id].tag_Attribute.title + "与上一行程不连续"; |
|
10387 |
// customLinkageAnalysis.setMessage(fdate.property.id, message, k); |
|
10388 |
// } |
|
10389 |
// } |
|
10390 |
// }); |
|
10391 |
// } |
|
10392 |
// }//跨行程验证时间 李伟民 2017-10-20 11:35 end |
|
10393 |
// customBase.checkLandCross = function () {//跨行程验地点 李伟民 2017-10-20 11:35 |
|
10394 |
// var items = customShow.getItems(); |
|
10395 |
// //console.log(items); |
|
10396 |
// var itemKey = _.keys(customBase.options.customItems); |
|
10397 |
// var subItem = []; |
|
10398 |
// _.each(itemKey, function (keys) { |
|
10399 |
// if (customBase.options.customItems[keys].type == "subform") { |
|
10400 |
// subItem.push(customBase.options.customItems[keys].fieldKey); |
|
10401 |
// } |
|
10402 |
// }); |
|
10403 |
// var FromLandeArr = []; |
|
10404 |
// var ToLandArr = []; |
|
10405 |
// _.each(subItem, function (sub) { |
|
10406 |
// if (items[sub] != undefined) { |
|
10407 |
// _.each(items[sub], function (isub, i) { |
|
10408 |
// if (isub.From_site != undefined) { |
|
10409 |
// FromLandeArr.push({ "value": isub.From_site[0], "num": i, "property": customBase.options.customItems['From_site'] }); |
|
10410 |
// } |
|
10411 |
// if (isub.To_site != undefined) { |
|
10412 |
// ToLandArr.push({ "value": isub.To_site[0], "num": i, "property": customBase.options.customItems['To_site'] }); |
|
10413 |
// } |
|
10414 |
// }); |
|
10415 |
// } |
|
10416 |
// }); |
|
10417 |
// if (FromLandeArr.length > 1 && ToLandArr.length > 1 && FromLandeArr.length == ToLandArr.length) { |
|
10418 |
// _.each(FromLandeArr, function (fland, k) { |
|
10419 |
// if (k > 0) { |
|
10420 |
// customLinkageAnalysis.clearMessage(fland.property.id, k); |
|
10421 |
// //console.log(fland.value != ToLandArr[k-1].value); |
|
10422 |
// if (fland.value != ToLandArr[k - 1].value) { |
|
10423 |
// var message = customShow.options.customItemShow.item[fland.property.id].tag_Attribute.title + "与上一行程不连续"; |
|
10424 |
// customLinkageAnalysis.setMessage(fland.property.id, message, k); |
|
10425 |
// } |
|
10426 |
// } |
|
10427 |
// }); |
|
10428 |
// } |
|
10429 |
// }//跨行程验地点 李伟民 2017-10-20 11:35 end |
|
10430 |
//自定义表单扩展函数 增加行 删除行 |
|
10431 |
customShow.addRow = function (subId, data) { |
|
10432 |
console.log(data); |
|
10433 |
console.log(subId); |
|
10434 |
console.log($("#" + subId)); |
|
10435 |
console.log($("#" + subId).find(".trContentClass")); |
|
10436 |
$("#" + subId).find(".trContentClass").remove(); |
|
10437 |
// console.log(data[0].length - 1); |
|
10438 |
for (var i = 0; i < data[0].length; i++) { |
|
10439 |
var itemId = subId; |
|
10440 |
var showClass = "customViewUEditorCss"; |
|
10441 |
var item = customBase.options.customItems[customShow.options.customItemShow.item[itemId].tag_Attribute.alias].cloneDiv; |
|
10442 |
//console.log(customShow.options) |
|
10443 |
console.log(itemId, item) |
|
10444 |
console.log(itemId, customBase.options.customItems) |
|
10445 |
//子表单情况为U情况 |
|
10446 |
if (item == undefined) {// 子表单回显 修改 李伟民 11-10 |
|
10447 |
var tbody = $("." + showClass + " #" + itemId + "ActiveId").find("tbody"); |
|
10448 |
tbody = tbody[0].cloneNode(true); |
|
10449 |
$(tbody).find(".select2").remove(); |
|
10450 |
console.log($(tbody).html()); |
|
10451 |
$(tbody).find(".tdTitleClass").closest("tr").addClass("table_title"); |
|
10452 |
$(tbody).find(".dropdowntypeCss").select2({ theme: "classic" }); |
|
10453 |
// $(tbody).find(".zTreeDemoBackground").select2({theme: "classic"}); |
|
10454 |
if ($(tbody).find(".table_title").length > 0) { |
|
10455 |
//删除头行 |
|
10456 |
$(tbody).find(".table_title").remove(); |
|
10457 |
} |
|
10458 |
if ($(tbody).find(".trContentClass").length > 1) {// 去除重复的tr 李伟民 11-14 |
|
10459 |
$($(tbody).find(".trContentClass")[0]).siblings().remove(); |
|
10460 |
}// 去除重复的tr 李伟民 11-14 |
|
10461 |
// $(tbody).find(".cfg_contentNone").removeClass("cfg_contentNone"); |
|
10462 |
tbody = customShow.addsubformListInit(itemId, $(tbody).find("tr")); |
|
10463 |
console.log(tbody); |
|
10464 |
console.log(itemId); |
|
10465 |
console.log($(tbody).find("#" + itemId).attr("class")); |
|
10466 |
$($("." + showClass + " #" + itemId + "ActiveId").find("table")[0]).append(tbody);// 子表单回显 修改 李伟民 11-10 |
|
10467 |
customShow.hidesubform(); |
|
10468 |
customShow.setXhSelectList(false);//添加记录 重复问题 李伟民11-14 |
|
10469 |
} else { |
|
10470 |
console.log(item); |
|
10471 |
item = item[0].cloneNode(true); |
|
10472 |
console.log(item); |
|
10473 |
$(item).find(".select2").remove(); |
|
10474 |
$(item).find(".dropdowntypeCss").select2({ theme: "classic" }); |
|
10475 |
|
|
10476 |
$(item).find(".subformAddiconShow .cfg_contentNone").removeClass("cfg_contentNone"); |
|
10477 |
item = customShow.addsubformListInit(itemId, item); |
|
10478 |
$($("." + showClass + " #" + itemId + "ActiveId").find("table")[0]).append(item); |
|
10479 |
|
|
10480 |
} |
|
10481 |
customShow.setXhSelectList(true);//添加记录 重复问题 李伟民11-14 |
|
10482 |
customShow.addtree(itemId, item); |
|
10483 |
//子表单事件追加 |
|
10484 |
customShow.clickBindSubform(); |
|
10485 |
//公式初期化 |
|
10486 |
customLinkageAnalysis.bindLinkage(); |
|
10487 |
customShow.oneTotle(); |
|
10488 |
$('.iconfontcolor').on('click', function () { |
|
10489 |
$(this).parent().parent().parent().remove(); |
|
10490 |
}); |
|
10491 |
console.log($(item)) |
|
10492 |
customShow.addtree(itemId, item); |
|
10493 |
} |
|
10494 |
var customItems = customBase.options.customItems; |
|
10495 |
console.log(customItems) |
|
10496 |
var order = $($("#" + subId + "ActiveId .trContentClass")[0]).find(".tdContentClass"); |
|
10497 |
var orderid = []; |
|
10498 |
var orderObj = {}; |
|
10499 |
_.each(order, opt => { |
|
10500 |
if ($(opt).find("div").children().eq(0).attr("id")) { |
|
10501 |
orderid.push($(opt).find("div").children().eq(0).attr("id")); |
|
10502 |
} else { |
|
10503 |
orderid.push($(opt).find("div").children().eq(1).attr("id")); |
|
10504 |
} |
|
10505 |
}); |
|
10506 |
console.log(orderid); |
|
10507 |
orderid.splice(0, 1); |
|
10508 |
console.log(orderid); |
|
10509 |
var subArr = []; |
|
10510 |
console.log(subId) |
|
10511 |
_.each(customItems, opt => { |
|
10512 |
if (opt.parentsubFormNum == subId.replace("itemId_", "")) { |
|
10513 |
subArr.push(opt); |
|
10514 |
} |
|
10515 |
}); |
|
10516 |
_.remove(subArr, n => { |
|
10517 |
return n.fieldKey == "DATAROWNUM"; |
|
10518 |
}) |
|
10519 |
console.log(subArr); |
|
10520 |
var endArr = []; |
|
10521 |
_.each(orderid, opt => { |
|
10522 |
var a = {}; |
|
10523 |
_.each(subArr, o => { |
|
10524 |
if (opt == o.id) { |
|
10525 |
a = o; |
|
10526 |
} |
|
10527 |
}); |
|
10528 |
endArr.push(a); |
|
10529 |
}) |
|
10530 |
console.log(endArr); |
|
10531 |
console.log(data); |
|
10532 |
_.each(endArr, (opts, i) => { |
|
10533 |
console.log(opts.id, opts.type, data[i]); |
|
10534 |
if (opts.type == "dropdownlist") {// 不可修改 控件type 李伟民 11-17 |
|
10535 |
customBase.setItemValue(opts.id, "dropdownlistText", data[i], "", ""); |
|
10536 |
} else { |
|
10537 |
customBase.setItemValue(opts.id, opts.type, data[i], "", ""); |
|
10538 |
} |
|
10539 |
}); |
|
10540 |
console.log(subId) |
|
10541 |
customShow.subTotle(subId) |
|
10542 |
}; |
|
10543 |
//关联表单控件 列表渲染 |
|
10544 |
createTable = function (rs, formId, formhuixian, head, $iconId, addVal) { |
|
10545 |
var showVal = []; |
|
10546 |
var iconAttr = customShow.options.customItemShow.item[$iconId];//关联数据 函数 数据源 李伟民 11-07 |
|
10547 |
//接收table内容请求 |
|
10548 |
var content = ""; |
|
10549 |
var counts = ""; |
|
10550 |
$(".requestMenu").empty(); |
|
10551 |
//渲染table头部变量; |
|
10552 |
let headtr = ""; |
|
10553 |
//渲染table内容变量 |
|
10554 |
let contentdata = ""; |
|
10555 |
//表头渲染数据 |
|
10556 |
//console.log(head); |
|
10557 |
_.remove(head, n => { |
|
10558 |
return n.fieldKey == "DATAROWNUM"; |
|
10559 |
}); |
|
10560 |
_.each(head, opt => { |
|
10561 |
headtr += '<td>' + opt.title + '</td>'; |
|
10562 |
}); |
|
10563 |
let head_tr = $("<tr class='headtr'></tr>"); |
|
10564 |
head_tr.append('<td class="td1">选择</td>' + headtr); |
|
10565 |
$(".requestMenu").append(head_tr); |
|
10566 |
|
|
10567 |
//console.log(rs) |
|
10568 |
if (rs.data != undefined && !_.isNull(rs.data) && rs.data.count != undefined) { |
|
10569 |
counts = rs.data.count; |
|
10570 |
} |
|
10571 |
if (rs.data != undefined && !_.isNull(rs.data)) { |
|
10572 |
content = rs.data.list; |
|
10573 |
} else { |
|
10574 |
content = []; |
|
10575 |
} |
|
10576 |
// if(iconAttr.tag_Attribute.relevancesourcetype == "fundata"){ |
|
10577 |
// codeContent = rs.data.list; |
|
10578 |
// }else{ |
|
10579 |
// codeContent = rs.data.code; |
|
10580 |
// } |
|
10581 |
console.log(content); |
|
10582 |
if (content.length == 0) { |
|
10583 |
var div_empty = $("<div><i style='width:20px;height:20px;' class='fa fa-envelope-o' aria-hidden='true'></i><p>您还没有数据显示</p></div>"); |
|
10584 |
$(".requestMenu").append(div_empty); |
|
10585 |
} else { |
|
10586 |
_.each(content, (opt) => { |
|
10587 |
_.each(formhuixian, n => { |
|
10588 |
if (opt.DATAROWNUM == n.DATAROWNUM) { |
|
10589 |
opt.show = "cur"; |
|
10590 |
} |
|
10591 |
}); |
|
10592 |
var contentdata = ""; |
|
10593 |
_.each(head, opts => { |
|
10594 |
contentdata += '<td>' + opt[opts.fieldKey] + '</td>'; |
|
10595 |
}); |
|
10596 |
var tr = $("<tr class='bodytr'></tr>"); |
|
10597 |
tr.append('<td class="td1"><li class="checkLine"><span class="custom-check ' + opt.show + '"></span><i class="label"></i></li></td>' + contentdata); |
|
10598 |
console.log(tr); |
|
10599 |
$(".requestMenu").append(tr); |
|
10600 |
}); |
|
10601 |
} |
|
10602 |
//console.log(formhuixian); |
|
10603 |
|
|
10604 |
|
|
10605 |
if (formhuixian != undefined) { |
|
10606 |
addVal = formhuixian; |
|
10607 |
} |
|
10608 |
let show = ""; |
|
10609 |
var showObj = {}; |
|
10610 |
//选择方法 |
|
10611 |
head.push({ fieldKey: "DATAROWNUM", title: "DATAROWNUM" }); |
|
10612 |
//判断单选多选 |
|
10613 |
var selItem = customShow.options.customItemShow.item; |
|
10614 |
console.log(selItem); |
|
10615 |
var sel = ""; |
|
10616 |
var datarow = ""; |
|
10617 |
var tag_Id = ""; |
|
10618 |
console.log(selItem); |
|
10619 |
for (let key in selItem) { |
|
10620 |
if (key == $iconId) { |
|
10621 |
sel = selItem[key].tag_Attribute.mytextSel; |
|
10622 |
console.log(selItem[key].tag_Attribute.singleSetValue); |
|
10623 |
if (selItem[key].tag_Attribute.singleSetValue != "itemId") { |
|
10624 |
datarow = JSON.parse(selItem[key].tag_Attribute.singleSetValue).columnOrderNum; |
|
10625 |
tag_Id = JSON.parse(selItem[key].tag_Attribute.singleSetValue).tag_Id; |
|
10626 |
} |
|
10627 |
} |
|
10628 |
} |
|
10629 |
console.log(sel) |
|
10630 |
if (sel == "single") { |
|
10631 |
$(".custom-check").on("click", function () { |
|
10632 |
var addVals = []; |
|
10633 |
var showVals = []; |
|
10634 |
$(this).parent().parent().parent().siblings().find(".custom-check").removeClass('cur'); |
|
10635 |
$(this).toggleClass('cur'); |
|
10636 |
console.log($(this)); |
|
10637 |
console.log($(this).siblings()); |
|
10638 |
// var showObj = {}; |
|
10639 |
let $index = $(this).parent().parent().parent().index() - 1; |
|
10640 |
var check = $(".custom-check"); |
|
10641 |
console.log(check); |
|
10642 |
_.each(check, opt => { |
|
10643 |
console.log(opt) |
|
10644 |
if ($(opt).hasClass('cur')) { |
|
10645 |
addVals.push(content[$(opt).parent().parent().parent().index() - 1]); |
|
10646 |
// showVals.push(content[$(opt).parent().parent().parent().index() - 1]); |
|
10647 |
// addVals.push(codeContent[$(opt).parent().parent().parent().index() - 1]);//填值时使用code 李伟民 12-05 |
|
10648 |
// console.log(codeContent[$(opt).parent().parent().parent().index() - 1]) |
|
10649 |
} else { |
|
10650 |
_.remove(addVals, n => { |
|
10651 |
return n.DATAROWNUM == content[$(opt).parent().parent().parent().index() - 1].DATAROWNUM; |
|
10652 |
// return n.DATAROWNUM == codeContent[$(opt).parent().parent().parent().index() - 1].DATAROWNUM;//填值时使用code 李伟民 12-05 |
|
10653 |
}); |
|
10654 |
// _.remove(showVals, n => { |
|
10655 |
// return n.DATAROWNUM == content[$(opt).parent().parent().parent().index() - 1].DATAROWNUM; |
|
10656 |
// }); |
|
10657 |
} |
|
10658 |
}); |
|
10659 |
addVal = addVals; |
|
10660 |
// showVal = showVals; |
|
10661 |
console.log(addVal); |
|
10662 |
console.log(datarow); |
|
10663 |
customShow.sureonclick(addVal, $iconId, head, sel, iconAttr, datarow, formId); |
|
10664 |
}); |
|
10665 |
console.log(addVal); |
|
10666 |
|
|
10667 |
} else if (sel == "multiple") { |
|
10668 |
$(".custom-check").on("click", function () { |
|
10669 |
$(this).toggleClass('cur'); |
|
10670 |
// var showObj = {}; |
|
10671 |
let $index = $(this).parent().parent().parent().index() - 1; |
|
10672 |
if ($(this).hasClass('cur')) { |
|
10673 |
addVal.push(content[$index]); |
|
10674 |
// showVal.push(content[$index]); |
|
10675 |
// addVal.push(codeContent[$index]);//填值时使用code 李伟民 12-05 |
|
10676 |
//console.log(content[$index]) |
|
10677 |
} else { |
|
10678 |
_.remove(addVal, n => { |
|
10679 |
return n.DATAROWNUM == content[$index].DATAROWNUM; |
|
10680 |
// return n.DATAROWNUM == codeContent[$index].DATAROWNUM;//填值时使用code 李伟民 12-05 |
|
10681 |
}); |
|
10682 |
// _.remove(showVal, n => { |
|
10683 |
// return n.DATAROWNUM == content[$index].DATAROWNUM; |
|
10684 |
// }); |
|
10685 |
} |
|
10686 |
customShow.sureonclick(addVal, $iconId, head, sel, iconAttr, datarow, formId); |
|
10687 |
}); |
|
10688 |
} |
|
10689 |
console.log(addVal); |
|
10690 |
//选择方法END |
|
10691 |
return counts; |
|
10692 |
} |
|
10693 |
|
|
10694 |
function createMxtTable($iconId, head, addVal) {// 关联数据渲染修改 李伟民 11-30 |
|
10695 |
console.log(head); |
|
10696 |
console.log(addVal); |
|
10697 |
if (head == "" || addVal == "" || head == undefined || addVal == undefined) { |
|
10698 |
return false; |
|
10699 |
} |
|
10700 |
var tableBox = $("<table class='mxtdatatable table'></table>"); |
|
10701 |
var tableTitle = $("<tr></tr>"); |
|
10702 |
var tableBody = $("<tbody></tbody>"); |
|
10703 |
var tableHead = $("<thead></thead>"); |
|
10704 |
_.each(addVal, function (atd) { |
|
10705 |
var tableContent = $("<tr></tr>"); |
|
10706 |
_.each(head, function (htd) { |
|
10707 |
var td = '<td class="mxtdatatabletd">' + (atd[htd.fieldKey] ? atd[htd.fieldKey] : "") + '</td>'; |
|
10708 |
tableContent.append(td); |
|
10709 |
var th = '<th>' + htd.title + '</th>'; |
|
10710 |
tableTitle.append(th); |
|
10711 |
}); |
|
10712 |
tableBody.append(tableContent); |
|
10713 |
}); |
|
10714 |
tableHead.append(tableTitle); |
|
10715 |
tableBox.append(tableHead); |
|
10716 |
tableBox.append(tableBody); |
|
10717 |
$('#' + $iconId).append(tableBox); |
|
10718 |
}// 关联数据渲染修改 李伟民 11-30 |
|
10719 |
|
|
10720 |
function setValByAnother(iconAttr, addVal, formId, head, typeflag) {//遍历对比别名相同填值 typefalg为true代表关联的是函数 |
|
10721 |
var datarowNum = addVal[0].DATAROWNUM; |
|
10722 |
var postdata = {}; |
|
10723 |
var getCodeUrl = ""; |
|
10724 |
var ajaxtype = ""; |
|
10725 |
if (typeflag) { |
|
10726 |
getCodeUrl = "/datamanagement/getAssociateData"; |
|
10727 |
postdata = { "formID": customShow.options.formid, "search": [], "pageSize": "1000", "pageNum": "1", "key": JSON.parse(iconAttr.tag_Attribute.fundata)['key'], "dataRowNum": datarowNum, "type": "code" }; |
|
10728 |
ajaxtype = "POST"; |
|
10729 |
} else { |
|
10730 |
postdata = { |
|
10731 |
"datarowNum": datarowNum, |
|
10732 |
"formID": formId.formID |
|
10733 |
}; |
|
10734 |
getCodeUrl = "/datamanagement/getSingleFormDataService"; |
|
10735 |
ajaxtype = "GET"; |
|
10736 |
} |
|
10737 |
|
|
10738 |
console.log(postdata); |
|
10739 |
var rquest = window.commonAjax(getCodeUrl, postdata, ajaxtype, true); |
|
10740 |
rquest.done(function (res) { |
|
10741 |
console.log(res); |
|
10742 |
var rsdata = ""; |
|
10743 |
if (res.data && res.data.main != undefined) { |
|
10744 |
if (typeflag) { |
|
10745 |
rsdata = res.data.list[0]; |
|
10746 |
} else { |
|
10747 |
rsdata = res.data.main; |
|
10748 |
} |
|
10749 |
console.log(iconAttr); |
|
10750 |
console.log(rsdata); |
|
10751 |
if (rsdata == undefined) { |
|
10752 |
return false; |
|
10753 |
} |
|
10754 |
_.each(customBase.options.customItems, opt => { |
|
10755 |
_.each(head, opts => { |
|
10756 |
if (opts.fieldKey == opt.fieldKey) { |
|
10757 |
if (opt.type == "dropdownlist") { |
|
10758 |
// if(customBase.getItemValue(opt.id,"dropdownlistText")[0].length == 0){ |
|
10759 |
var item = customShow.options.customItemShow.item[opt.id]; |
|
10760 |
var dropdowntype = item.tag_Attribute.dropdowntype; |
|
10761 |
customBase.setItemValue(opt.id, "dropdownlistText", res.data.main[opt.fieldKey], "", ""); |
|
10762 |
// } |
|
10763 |
} else { |
|
10764 |
// if(!customBase.getItemValue(opt.id,opt.type)){ |
|
10765 |
customBase.setItemValue(opt.id, opt.type, res.data.main[opt.fieldKey], "", ""); |
|
10766 |
// } |
|
10767 |
} |
|
10768 |
}; |
|
10769 |
}) |
|
10770 |
}); |
|
10771 |
} |
|
10772 |
|
|
10773 |
}); |
|
10774 |
|
|
10775 |
} |
|
10776 |
|
|
10777 |
customShow.sureonclick = function (addVal, $iconId, head, sel, iconAttr, datarow, formId) { |
|
10778 |
console.log(datarow) |
|
10779 |
$(".btn-primary").on("click", function () { |
|
10780 |
var showObj = {}; |
|
10781 |
console.log(addVal); |
|
10782 |
$('#' + $iconId).empty(); |
|
10783 |
//回显属性 |
|
10784 |
$("#" + $iconId).attr("formhuixian", JSON.stringify(addVal)); |
|
10785 |
var saveval = '';//关联数据空间 存值 李伟民 11-07 |
|
10786 |
var saveArr = []; |
|
10787 |
_.each(addVal, function (v) { |
|
10788 |
if (v.DATAROWNUM != undefined) { |
|
10789 |
saveArr.push(v.DATAROWNUM); |
|
10790 |
} |
|
10791 |
}); |
|
10792 |
saveval = saveArr.join(); |
|
10793 |
customBase.setItemValue($iconId, customShow.options.customItemShow.item[$iconId].tag_Type, saveval);//关联数据空间 存值 李伟民 11-07 end |
|
10794 |
if (addVal != "" && addVal != undefined) { |
|
10795 |
$("#" + iconAttr.tag_Id).attr("checkVal", JSON.stringify(addVal));//将选中值存储起来 用于验证 |
|
10796 |
$("#" + iconAttr.tag_Id).attr("checkHead", JSON.stringify(head)); |
|
10797 |
} |
|
10798 |
var data2 = customShow.columnToRow(head, addVal); |
|
10799 |
//子表单自动增加行 |
|
10800 |
var subId = $('#' + $iconId + "ActiveId").attr("choosesubform"); |
|
10801 |
console.log(subId); |
|
10802 |
if (subId == "itemId") { |
|
10803 |
createMxtTable($iconId, head, addVal); |
|
10804 |
console.log(addVal); |
|
10805 |
console.log(head); |
|
10806 |
setValByAnother(iconAttr, addVal, formId, head); |
|
10807 |
//遍历对比别名相同填值 |
|
10808 |
// _.each(customBase.options.customItems, opt => { |
|
10809 |
// _.each(head, opts => { |
|
10810 |
// if (opts.fieldKey == opt.fieldKey) { |
|
10811 |
// if (opt.type == "dropdownlist") { |
|
10812 |
// // if(customBase.getItemValue(opt.id,"dropdownlistText")[0].length == 0){ |
|
10813 |
// var item = customShow.options.customItemShow.item[opt.id]; |
|
10814 |
// var dropdowntype = item.tag_Attribute.dropdowntype; |
|
10815 |
// customBase.setItemValue(opt.id, "dropdownlistText", addVal[0][opt.fieldKey], "", ""); |
|
10816 |
// // } |
|
10817 |
// } else { |
|
10818 |
// // if(!customBase.getItemValue(opt.id,opt.type)){ |
|
10819 |
// customBase.setItemValue(opt.id, opt.type, addVal[0][opt.fieldKey], "", ""); |
|
10820 |
// // } |
|
10821 |
// } |
|
10822 |
// }; |
|
10823 |
// }) |
|
10824 |
// }); |
|
10825 |
} else { |
|
10826 |
console.log(addVal) |
|
10827 |
if (sel == "single" && iconAttr.tag_Attribute.relevancesourcetype != "fundata") { |
|
10828 |
setValByAnother(iconAttr, addVal, formId, head) |
|
10829 |
// _.each(addVal,(opt,j)=>{ |
|
10830 |
//// var ulBox = $("<ul></ul>"); |
|
10831 |
// var ulBox = $("<table></table>"); |
|
10832 |
// var sdata_head = ""; |
|
10833 |
// var sdata_boby = ""; |
|
10834 |
// for(var i = 0;i<head.length;i++){ |
|
10835 |
// show = ""; |
|
10836 |
// sdata_head += '<td class="data1 '+head[i].fieldKey+'">'+head[i].title+'</td>'; |
|
10837 |
// sdata_boby += '<td class="data2 '+head[i].fieldKey+'">'+opt[head[i].fieldKey]+'</td>'; |
|
10838 |
// show += '<li>'+'<span class="data1 '+head[i].fieldKey+'">'+head[i].title+'</span>'+'<span class="data2 '+head[i].fieldKey+'">'+opt[head[i].fieldKey]+'</span>'+'</li>'; |
|
10839 |
// |
|
10840 |
// showObj[head[i].fieldKey] = opt[head[i].fieldKey]; |
|
10841 |
// |
|
10842 |
// ulBox.attr("class","addUl ulBox"+j); |
|
10843 |
// ulBox.attr("id","ulBox"+j); |
|
10844 |
//// ulBox.append(show); |
|
10845 |
// } |
|
10846 |
// ulBox.append("<tr>"+sdata_head+"</tr><tr>"+sdata_boby+"</tr>"); |
|
10847 |
// console.log(sdata_head); |
|
10848 |
// $('#'+$iconId).append(ulBox); |
|
10849 |
// }); |
|
10850 |
createMxtTable($iconId, head, addVal); |
|
10851 |
var subdata = {}; |
|
10852 |
console.log(datarow) |
|
10853 |
subdata.formdataNum = datarow; |
|
10854 |
subdata.datarowNum = addVal[0].DATAROWNUM; |
|
10855 |
subdata.formID = formId.formID; |
|
10856 |
var subformData = window.commonAjax("/datamanagement/getSubFormDataListService", subdata, "GET", true, false); |
|
10857 |
subformData.done(function (rs) { |
|
10858 |
console.log(rs.data); |
|
10859 |
var c_data = SC.cur_zero(rs.data); |
|
10860 |
console.log(c_data) |
|
10861 |
var rsArr = []; |
|
10862 |
_.each(c_data, opt => { |
|
10863 |
var opts = _.omit(opt, ['DATAROWNUM']); |
|
10864 |
rsArr.push(opts) |
|
10865 |
}); |
|
10866 |
var rslength = _.keys(rsArr[0]).length; |
|
10867 |
console.log(rsArr); |
|
10868 |
var subId = $('#' + $iconId + "ActiveId").attr("choosesubform"); |
|
10869 |
console.log($(".myipt")) |
|
10870 |
var formObj = window.localStorage.getItem("netformid"); |
|
10871 |
var globalFormID = formObj; |
|
10872 |
var dataObj = {}; |
|
10873 |
dataObj.formID = globalFormID; |
|
10874 |
var order_id = []; |
|
10875 |
// 11/25 李元杰 存flag |
|
10876 |
console.log(dataObj) |
|
10877 |
var requestRight = window.commonAjax("/datamanagement/getFormFieldListService", dataObj, "GET", true, false); |
|
10878 |
requestRight.done(function (rs) { |
|
10879 |
console.log(rs) |
|
10880 |
order_id = rs.data; |
|
10881 |
}) |
|
10882 |
|
13ec33
|
10883 |
// var tenantID =JSON.parse(window.localStorage.getItem('tenantID')) |
4d1219
|
10884 |
// dataObj.tenantID= tenantID.tenantID; |
B |
10885 |
|
|
10886 |
// var order_ids = JSON.parse($(".myipt").val()); |
|
10887 |
console.log(order_id); |
|
10888 |
// console.log(order_ids) |
|
10889 |
|
|
10890 |
|
|
10891 |
if (customShow.options.customItemShow.item[$iconId].tag_Attribute.singleSetValue) { |
|
10892 |
var message = JSON.parse(customShow.options.customItemShow.item[$iconId].tag_Attribute.singleSetValue); |
|
10893 |
} |
|
10894 |
console.log(message.columnOrderNum) |
|
10895 |
|
|
10896 |
console.log(subId); |
|
10897 |
var subIds = subId.replace("itemId_", "") |
|
10898 |
console.log(subIds); |
|
10899 |
var orderArr = []; //存储关联表单内子表单的数组 |
|
10900 |
_.each(order_id, opt => { |
|
10901 |
console.log(opt) |
|
10902 |
if (opt.parentsubFormNum == message.columnOrderNum) { |
|
10903 |
orderArr.push(opt); |
|
10904 |
} |
|
10905 |
}); |
|
10906 |
_.remove(orderArr, n => { |
|
10907 |
return n.fieldKey == "DATAROWNUM"; |
|
10908 |
}) |
|
10909 |
console.log(orderArr); |
|
10910 |
orderArr = _.sortBy(orderArr, ['fieldOrderNum']); |
|
10911 |
var resArr = []; |
|
10912 |
for (i = 0; i < rslength; i++) { |
|
10913 |
resArr.push([]) |
|
10914 |
} |
|
10915 |
console.log(rsArr); |
|
10916 |
console.log(orderArr) |
|
10917 |
_.each(rsArr, (opt, i) => { |
|
10918 |
var j = 0 |
|
10919 |
_.each(orderArr, n => { |
|
10920 |
resArr[j][i] = opt[n.fieldKey] |
|
10921 |
j++; |
|
10922 |
}) |
|
10923 |
}); |
|
10924 |
console.log(resArr); |
|
10925 |
if (resArr.length == 0){ |
|
10926 |
alert("上级预算为0"); |
|
10927 |
} else { |
|
10928 |
customShow.addRow(subId, resArr); |
|
10929 |
} |
|
10930 |
$(".subformAdd").hide(); |
|
10931 |
$(".subformAddiconShow").hide(); |
|
10932 |
|
|
10933 |
}); |
|
10934 |
} else if (sel == "multiple" || iconAttr.tag_Attribute.relevancesourcetype == "fundata") { |
|
10935 |
console.log("fundata"); |
|
10936 |
if (iconAttr.tag_Attribute.relevancesourcetype == "fundata") {//关联函数时 别名相同填值 |
|
10937 |
setValByAnother(iconAttr, addVal, "", head, true); |
|
10938 |
} |
|
10939 |
createMxtTable($iconId, head, addVal); |
|
10940 |
$("#" + subId + "subformTr").nextAll().remove(); |
|
10941 |
customShow.addRow(subId, data2); |
|
10942 |
$(".subformAdd").hide(); |
|
10943 |
$(".subformAddiconShow").hide(); |
|
10944 |
} |
|
10945 |
} |
|
10946 |
console.log(customShow.customJs(subId)) |
|
10947 |
SC.setSubForm(customShow.customJs(subId), subId); |
|
10948 |
if (addVal.length != 0) { |
|
10949 |
SC.Superior_show() |
|
10950 |
} |
|
10951 |
}); |
|
10952 |
} |
|
10953 |
|
|
10954 |
customShow.customJs = function (subId) { |
|
10955 |
var subArr = []; |
|
10956 |
console.log(subId) |
|
10957 |
var customItems = customBase.options.customItems; |
|
10958 |
console.log(customItems) |
|
10959 |
_.each(customItems, opt => { |
|
10960 |
if (opt.parentsubFormNum == subId.replace("itemId_", "")) { |
|
10961 |
subArr.push(opt); |
|
10962 |
} |
|
10963 |
}); |
|
10964 |
_.remove(subArr, n => { |
|
10965 |
return n.fieldKey == "DATAROWNUM"; |
|
10966 |
}) |
|
10967 |
console.log(subArr); |
|
10968 |
var aliasArr = []; |
|
10969 |
_.each(subArr, opt => { |
|
10970 |
aliasArr.push(opt.fieldKey) |
|
10971 |
}) |
|
10972 |
console.log(aliasArr); |
|
10973 |
return aliasArr; |
|
10974 |
} |
|
10975 |
|
|
10976 |
//表单引用 扩展 回显子表单功能 |
|
10977 |
fenye = function (pageSize, pageNum, formId, sCondition, formhuixian, head, $iconId, addVal, anydata) { |
|
10978 |
console.log($iconId); |
|
10979 |
console.log("findmany"); |
|
10980 |
console.log(anydata); |
|
10981 |
console.log(head); |
|
10982 |
var iconAttr = customShow.options.customItemShow.item[$iconId];//关联数据 函数 数据源 李伟民 11-07 |
|
10983 |
console.log(iconAttr); |
|
10984 |
var dataUrl = ""; |
|
10985 |
var dataObj; |
|
10986 |
if (anydata) { |
|
10987 |
// alert('if'); |
|
10988 |
} else { |
|
10989 |
// alert("else"); |
|
10990 |
} |
|
10991 |
if (iconAttr.tag_Attribute.relevancesourcetype && iconAttr.tag_Attribute.relevancesourcetype == "fundata") { |
|
10992 |
dataUrl = "/datamanagement/getAssociateData"; |
|
10993 |
dataObj = { "formID": customShow.options.formid, "tenantID": "001", "search": [], "pageSize": pageSize, "pageNum": pageNum, "key": JSON.parse(iconAttr.tag_Attribute.fundata)['key'] }; |
|
10994 |
_.extend(dataObj, { "formData": customShow.getItems() }); |
|
10995 |
} else { |
|
10996 |
dataUrl = "/datamanagement/getAssociatedFormDataService"; |
|
10997 |
dataObj = { "formID": formId.formID, "tenantID": "001", "screenCondition": sCondition, "pageSize": pageSize, "pageNum": pageNum, "search": anydata }; |
|
10998 |
window.localStorage.setItem("netformid", dataObj.formID); |
|
10999 |
} |
|
11000 |
//关联数据 函数 数据源 李伟民 11-07 |
|
11001 |
// var dataObj = {"formID":formId.formID,"tenantID":"001","screenCondition":sCondition,"pageSize":pageSize,"pageNum":pageNum}; |
|
11002 |
//window.localStorage.setItem("netformid",dataObj.formID); |
|
11003 |
var requestRight = window.commonAjax(dataUrl, dataObj, "POST", true, false); |
|
11004 |
var counts = ""; |
|
11005 |
requestRight.done(function (rs) { |
|
11006 |
if (iconAttr.tag_Attribute.relevancesourcetype && iconAttr.tag_Attribute.relevancesourcetype == "fundata") { |
|
11007 |
// var titleObj = { "key": JSON.parse(iconAttr.tag_Attribute.fundata)['key'] }; |
|
11008 |
// var requestTitle = window.commonAjax("/datamanagement/getAssociateTitle", titleObj, "POST", true, false); |
|
11009 |
// requestTitle.done(function (res) { |
|
11010 |
// var formtitle = []; |
|
11011 |
// _.each(res.data, function (tdata) { |
|
11012 |
// formtitle.push({ "fieldKey": tdata.fieldKey, "title": tdata.title }); |
|
11013 |
// }); |
|
11014 |
counts = createTable(rs, formId, formhuixian, head, $iconId, addVal); |
|
11015 |
// }); |
|
11016 |
|
|
11017 |
} else { |
|
11018 |
counts = createTable(rs, formId, formhuixian, head, $iconId, addVal);//关联表单 列表回显 |
|
11019 |
} |
|
11020 |
|
|
11021 |
}); |
|
11022 |
$('.closeBtn').on('click', () => { |
|
11023 |
$('#' + $iconId + 'menuContent').remove(); |
|
11024 |
console.log($('.maskLayer')) |
|
11025 |
$('.maskLayer').css('display', 'none'); |
|
11026 |
}) |
|
11027 |
return counts; |
|
11028 |
} |
|
11029 |
customShow.journeySort = function () {//行程排序 初始化 李伟民 2017-10-23 15:56 |
|
11030 |
//console.log(customShow); |
|
11031 |
var itemKey = _.keys(customShow.options.customItemShow.item); |
|
11032 |
_.each(itemKey, function (keys) { |
|
11033 |
if (customShow.options.customItemShow.item[keys].tag_Type == "subform" && customShow.options.customItemShow.item[keys].tag_Attribute.sorttype != undefined && customShow.options.customItemShow.item[keys].tag_Attribute.sorttype != "") { |
|
11034 |
customShow.bindSort(customShow.options.customItemShow.item[keys].tag_Attribute.sorttype, keys); |
|
11035 |
} |
|
11036 |
}); |
|
11037 |
// customShow.bindSort("itemId_6","itemId_3"); |
|
11038 |
}//行程排序 初始化 李伟民 2017-10-23 15:56 end |
|
11039 |
|
|
11040 |
customShow.bindSort = function (sorttype, sub) {//排序事件绑定 |
|
11041 |
if (customShow.options.customItemShow.item[sorttype] == undefined) { |
|
11042 |
return false; |
|
11043 |
} |
|
11044 |
var tagType = customShow.options.customItemShow.item[sorttype].tag_Type; |
|
11045 |
if (tagType == "text" || tagType == "number" || tagType == "calendar") { //单行文本 数字 时间 |
|
11046 |
$("[id=" + sorttype + "]").unbind("change.sort", customShow.sortEvent); |
|
11047 |
$("[id=" + sorttype + "]").on("change.sort", { msg: { "sorttype": sorttype, "type": tagType, "sub": sub } }, customShow.sortEvent); |
|
11048 |
} else if (tagType == "dropdownlist") { // 下拉框 |
|
11049 |
|
|
11050 |
} |
|
11051 |
|
|
11052 |
} |
|
11053 |
|
|
11054 |
customShow.sortEvent = function (event) {// |
|
11055 |
var sorttype = event.data.msg.sorttype; |
|
11056 |
var type = event.data.msg.type; |
|
11057 |
var sub = event.data.msg.sub; |
7e9bb9
|
11058 |
var subType = customShow.options.customItemShow.item[sub].tag_Attribute.allcopy; |
L |
11059 |
console.log(event); |
4d1219
|
11060 |
var allValue; |
B |
11061 |
var allItem = []; |
|
11062 |
allValue = customBase.getItemValue(sorttype, type); |
|
11063 |
if(_.isString(allValue)){ |
|
11064 |
allValue = [allValue]; |
|
11065 |
} |
|
11066 |
//console.log(allValue); |
|
11067 |
_.each(allValue, function (v, i) { |
7e9bb9
|
11068 |
var optValue; |
L |
11069 |
if(type == "calendar"){ |
|
11070 |
optValue = new Date(v); |
|
11071 |
}else if(type == "number"){ |
|
11072 |
optValue = Number(v) |
|
11073 |
}else{ |
|
11074 |
optValue = v; |
4d1219
|
11075 |
} |
7e9bb9
|
11076 |
if(subType){ |
L |
11077 |
allItem.push({ "value": optValue, "index": i, "temp": $("[id='" + sub + "ActiveId']:eq(" + i + ")").clone(true) }); |
|
11078 |
}else{ |
|
11079 |
allItem.push({ "value": optValue, "index": i, "temp": $("[id='" + sub + "subformTr']:eq(" + i + ")").clone(true) }); |
|
11080 |
} |
13ec33
|
11081 |
|
4d1219
|
11082 |
}); |
B |
11083 |
//console.log(allItem); |
|
11084 |
var sortValue = _.sortBy(allItem, function (o) { |
|
11085 |
return o.value; |
|
11086 |
}); |
|
11087 |
console.log(sortValue); |
7e9bb9
|
11088 |
if(subType){ |
L |
11089 |
_.each($("[id='" + sub + "ActiveId']"), function (subform, k) { |
|
11090 |
$(subform).replaceWith(sortValue[k].temp); |
|
11091 |
}) |
|
11092 |
}else{ |
|
11093 |
_.each($("[id='" + sub + "subformTr']"), function (subform, k) { |
|
11094 |
$(subform).replaceWith(sortValue[k].temp); |
|
11095 |
}) |
|
11096 |
} |
13ec33
|
11097 |
|
4d1219
|
11098 |
// customShow.controlInit("customShow"); |
B |
11099 |
customLinkageAnalysis.bindLinkage(); |
|
11100 |
customShow.journeySort(); |
|
11101 |
} |
|
11102 |
//马习同 2017/10/25 |
|
11103 |
$(".sTab ul li").on('click', function () { |
|
11104 |
$(this).css('border-bottom', '2px solid #23b7e5'); |
|
11105 |
$(this).css('box-sizing', 'border-box'); |
|
11106 |
$(this).siblings().css('border', 'none'); |
|
11107 |
//console.log($($(".tabBox>div")[$(this).index()])); |
449a85
|
11108 |
$($(".tabBox>div")[$(this).index()]).show(); |
4d1219
|
11109 |
$($(".tabBox>div")[$(this).index()]).siblings().hide(); |
449a85
|
11110 |
if($(this).index() == 0){//切换选项卡导致 保存按钮消失修改 李伟民 0201 |
L |
11111 |
$(".tabBox .sure_box").show(); |
|
11112 |
} |
4d1219
|
11113 |
}); |
B |
11114 |
$(".tag_two").on("click", function () { |
|
11115 |
// $(".boxTwo iframe").attr("src","http://122.114.176.216:8087/#/IframeExample?token=C3CDE94FE9CBDDDD37312D3331AC091EC737F5555007677E45A390EFEC7147996A49AA4E117EDC02F0D15984E725CA3B5B93DDAF0C989C35642B58B29360D998DDDAC06EB509BE1C22B19D555A1BB75A07A36FD6C4A7E87C9C9EA0070A213BFB44FF8D3B2AD5A33086EAF1F22E978B24951EA806054F94042533CA73EA7901C5E8B13D4DB7DC87308266E769258DEDFF&openId=3dc22baf5d484170&tenantId=13&companyId=17& appId=1&processInstId=1483") |
|
11116 |
}) |
|
11117 |
//马习同 11/7 行转化列 |
|
11118 |
customShow.columnToRow = function (head, addVal) { |
|
11119 |
var data = [] |
|
11120 |
_.remove(head, n => { |
|
11121 |
return n.fieldKey == "DATAROWNUM"; |
|
11122 |
}) |
|
11123 |
_.each(head, opt => { |
|
11124 |
let data1 = []; |
|
11125 |
_.each(addVal, opts => { |
|
11126 |
data1.push(opts[opt.fieldKey]); |
|
11127 |
}); |
|
11128 |
console.log(data1) |
|
11129 |
data.push(data1) |
|
11130 |
}); |
|
11131 |
return data; |
|
11132 |
} |
|
11133 |
|
|
11134 |
function submitErrShow(item,num){//审查必须错误提示 李伟民 0119 |
|
11135 |
console.log(item,num); |
|
11136 |
var itemId = item.tag_Id; |
|
11137 |
if(num == undefined){ |
|
11138 |
num = 0; |
|
11139 |
} |
|
11140 |
var mesageErrDiv = document.createElement("div"); |
|
11141 |
mesageErrDiv.setAttribute("class", "mesageErrDiv"); |
|
11142 |
$(mesageErrDiv).addClass('submitrErr'); |
8aa132
|
11143 |
var mesageErrStr = item.tag_Attribute.title + '不能为空(审查必须)'; |
4d1219
|
11144 |
mesageErrDiv.setAttribute("id", id + "mesageErrDiv"); |
8aa132
|
11145 |
$(mesageErrDiv).append(mesageErrStr); |
L |
11146 |
if(customShow.options.customInit.designMode != 1){//快捷模式 李伟民 0126 |
4d1219
|
11147 |
if ($(".customShow #" + itemId + "ActiveId").length == 0) { |
B |
11148 |
console.log($(".customViewUEditorCss [id='" + itemId + "']:eq(" + num + ")").closest("td")); |
|
11149 |
$(".customShow [id='" + itemId + "']:eq(" + num + ")").closest("td").append(mesageErrDiv); |
|
11150 |
$(".customShow ." + itemId + "_showItem:eq(" + num + ")").append(mesageErrDiv); |
|
11151 |
} else { |
|
11152 |
$($($(".customShow #" + itemId + "ActiveId")[num])[0]).append(mesageErrDiv); |
|
11153 |
} |
8aa132
|
11154 |
}else{//普通模式 李伟民 0126 |
L |
11155 |
if ($(".customShow #" + itemId).length == 0) { |
|
11156 |
$($(".customShow ." + itemId + "_showItem")[num]).css({ |
|
11157 |
'height':"20px", |
|
11158 |
'display':'inline-block' |
|
11159 |
}) |
|
11160 |
$($(".customShow ." + itemId + "_showItem")[num]).popover({ |
|
11161 |
// title:"错误信息", |
|
11162 |
html: true, |
|
11163 |
content: mesageErrStr, |
|
11164 |
trigger: 'hover' |
|
11165 |
}); |
|
11166 |
$($(".customShow ." + itemId + "_showItem")[num]).popover('show'); |
|
11167 |
} else { |
|
11168 |
$($(".customShow #" + itemId)[num]).popover({ |
|
11169 |
// title:"错误信息", |
|
11170 |
html: true, |
|
11171 |
content: mesageErrStr, |
|
11172 |
trigger: 'hover' |
|
11173 |
}); |
|
11174 |
$($(".customShow #" + itemId)[num]).popover('show'); |
|
11175 |
} |
|
11176 |
} |
4d1219
|
11177 |
} |
B |
11178 |
|
|
11179 |
function submitCheck(){//提交前验证审查必须 李伟民 0119 |
|
11180 |
$('.submitrErr').remove(); |
|
11181 |
var checkFlag = true; |
|
11182 |
var item = localStorage.getItem('customItem'); |
|
11183 |
if(item != undefined && item != ''){ |
|
11184 |
item = JSON.parse(item); |
|
11185 |
} |
|
11186 |
console.log(customBase); |
13ec33
|
11187 |
console.log(customShow); |
4d1219
|
11188 |
console.log(item); |
B |
11189 |
var allItemKey = _.keys(customBase.options.customItems); |
|
11190 |
var allItemId = _.keys(customShow.options.customItemShow.item); |
|
11191 |
var allItem = _.cloneDeep(customShow.options.customItemShow.item); |
|
11192 |
var allItemValue = []; |
|
11193 |
var childItem = []; |
|
11194 |
var parentNums = []; |
|
11195 |
var parentItem = {}; |
|
11196 |
_.each(allItemId,function(id){ |
|
11197 |
if(allItem[id].parentsubFormNum == 0){ |
|
11198 |
allItemValue.push(allItem[id]); |
|
11199 |
}else{ |
|
11200 |
childItem.push(allItem[id]); |
|
11201 |
parentNums.push(allItem[id].parentsubFormNum); |
|
11202 |
} |
|
11203 |
}); |
|
11204 |
_.each(parentNums,function(num){ |
|
11205 |
_.each(allItemId,function(id){ |
|
11206 |
if(num == allItem[id].columnOrderNum){ |
|
11207 |
parentItem[num] = allItem[id]; |
|
11208 |
} |
|
11209 |
}); |
|
11210 |
}); |
|
11211 |
_.each(childItem,function(cd){ |
|
11212 |
_.extend(cd,{'parentId':parentItem[cd.parentsubFormNum].tag_Attribute.alias}); |
|
11213 |
}); |
|
11214 |
allItemValue = _.concat(allItemValue,childItem); |
|
11215 |
console.log(allItemValue); |
|
11216 |
console.log(item); |
|
11217 |
_.each(allItemValue,function(item_value){ |
|
11218 |
if(item_value.parentsubFormNum == 0){ |
|
11219 |
var value = item[item_value.tag_Attribute.alias] |
|
11220 |
// _.extend(item_value,{'value':item[item_value.tag_Attribute.alias]}); |
|
11221 |
if(item_value.tag_Attribute.approvalmustenter){//审查必须属性 |
|
11222 |
if(_.isArray(value)){ |
|
11223 |
if(value.length == 0){ |
|
11224 |
submitErrShow(item_value); |
|
11225 |
checkFlag = false; |
|
11226 |
} |
|
11227 |
}else if(value == '' || value == undefined){ |
|
11228 |
submitErrShow(item_value); |
|
11229 |
checkFlag = false; |
|
11230 |
} |
|
11231 |
} |
|
11232 |
}else{ |
|
11233 |
var cd_value = []; |
|
11234 |
_.each(item[item_value.parentId],function(sub){ |
|
11235 |
cd_value.push(sub[item_value.tag_Attribute.alias]); |
|
11236 |
}); |
|
11237 |
// _.extend(item_value,{'value':cd_value}); |
|
11238 |
_.each(cd_value,function(cval,k){ |
|
11239 |
if(_.isArray(cval)){ |
|
11240 |
if(cval.length == 0){ |
|
11241 |
submitErrShow(item_value,k); |
|
11242 |
checkFlag = false; |
|
11243 |
} |
|
11244 |
}else if(cval == '' || cval == undefined){ |
|
11245 |
submitErrShow(item_value,k); |
|
11246 |
checkFlag = false; |
|
11247 |
} |
|
11248 |
}) |
|
11249 |
} |
|
11250 |
}); |
|
11251 |
return checkFlag; |
|
11252 |
} |
|
11253 |
|
|
11254 |
//lym |
|
11255 |
function get() { |
|
11256 |
var checkFlag = submitCheck(); |
|
11257 |
if(checkFlag != true){ |
|
11258 |
return false; |
|
11259 |
} |
|
11260 |
console.log(localStorage.getItem("organizationId")); |
|
11261 |
console.log(localStorage.getItem("datarowNum")); |
|
11262 |
//从local取出log |
|
11263 |
var processLog = localStorage.getItem("processLog"); |
|
11264 |
var tenant = JSON.parse(localStorage.getItem("tenantID")); |
|
11265 |
var cust = JSON.parse(localStorage.getItem("customItem")); |
|
11266 |
//暂时修改流程lym |
|
11267 |
// var org = cust.expend_department.trim(); |
|
11268 |
//暂时修改流程lym |
|
11269 |
console.log(processLog); |
|
11270 |
console.log(processLog !== null); |
|
11271 |
//12/11 |
|
11272 |
if (processLog != "null") { |
|
11273 |
var strMessage = customBase.getMessage("mesage_ID034"); |
|
11274 |
customBase.alert("E", strMessage); |
|
11275 |
//return null; |
|
11276 |
} else { |
|
11277 |
//暂时修改流程lym |
|
11278 |
// if (org == "" || org == undefined || org == null) { |
|
11279 |
// //var strMessage = customBase.getMessage("mesage_ID035"); |
|
11280 |
// customBase.alert("E", "请选择部门"); |
|
11281 |
// return null; |
|
11282 |
// } |
|
11283 |
//暂时修改流程lym |
|
11284 |
// 画面check 提交前验证 李伟民 12-26 |
|
11285 |
// var returnfromCheck = customShow.initEvent.fromCheck(items); //-------------------- |
|
11286 |
// if (returnfromCheck) { |
|
11287 |
// return; |
|
11288 |
// } |
|
11289 |
var ss = { |
|
11290 |
"tenantID": tenant.tenantID, |
|
11291 |
//"organizationId": org, |
|
11292 |
"formID": localStorage.getItem("newFormID"), |
|
11293 |
"dataRowNum": localStorage.getItem("datarowNum") |
|
11294 |
} |
|
11295 |
var requestSingleForm = window.commonAjax("/ubp-api-control/process/inst/create", ss, "POST", true); |
|
11296 |
requestSingleForm.done(function (rs) { |
|
11297 |
console.log(rs); |
|
11298 |
if (rs.resCode == 00000) { |
13ec33
|
11299 |
|
4d1219
|
11300 |
customBase.alert('S', "提交成功"); |
B |
11301 |
$("#sssd").click(); |
13ec33
|
11302 |
|
4d1219
|
11303 |
} else { |
B |
11304 |
if (rs.data == '3') { |
|
11305 |
customBase.alert('E', "请先配置流程定义"); |
|
11306 |
$("#sssd").click(); |
|
11307 |
}else if(rs.data == '2'){ |
|
11308 |
customBase.alert('E', "请不要重复提交"); |
|
11309 |
$("#sssd").click(); |
|
11310 |
} else { |
|
11311 |
customBase.alert('E', "提交失败"); |
|
11312 |
$("#sssd").click(); |
|
11313 |
} |
|
11314 |
} |
|
11315 |
}); |
|
11316 |
} |
13ec33
|
11317 |
|
4d1219
|
11318 |
} |
B |
11319 |
//lym结束后操作 |
|
11320 |
function over(data) { |
|
11321 |
if (data == true) { |
|
11322 |
//确定提交后操作 |
|
11323 |
var processLog = JSON.parse(localStorage.getItem("processLog")); |
|
11324 |
console.log(processLog); |
|
11325 |
var ss = { |
|
11326 |
"processInstId": processLog[0].processInstId |
|
11327 |
} |
|
11328 |
console.log(ss); |
|
11329 |
var requestSingleForm = window.commonAjax("/ubp-api-control/process/inst/over", ss, "POST", true); |
|
11330 |
requestSingleForm.done(function (rs) { |
|
11331 |
console.log(rs); |
|
11332 |
if (rs.data == 1) { |
449a85
|
11333 |
customBase.alert('S',"结束成功"); |
4d1219
|
11334 |
$("#sssd").click(); |
B |
11335 |
} else { |
449a85
|
11336 |
customBase.alert("E","结束失败"); |
4d1219
|
11337 |
} |
B |
11338 |
}); |
|
11339 |
|
|
11340 |
|
|
11341 |
|
|
11342 |
} else { |
|
11343 |
$("#sssd").click(); |
|
11344 |
} |
|
11345 |
} |
|
11346 |
|
|
11347 |
//lym退回确定后操作 |
|
11348 |
function tui(data, item) { |
|
11349 |
|
|
11350 |
if (data == true) { |
|
11351 |
console.log($('.actcur').val()); |
|
11352 |
if ($('.actcur').val() == undefined) { |
449a85
|
11353 |
customBase.alert("W","请选择退回的活动"); |
4d1219
|
11354 |
return null; |
B |
11355 |
} |
|
11356 |
var processLog = JSON.parse(localStorage.getItem("processLog")); |
|
11357 |
var ss = { |
|
11358 |
"activityInstId": processLog[0].activityInstId, |
|
11359 |
"activityDefId": $('.actcur').val(), |
|
11360 |
"processInstId": processLog[0].processInstId, |
|
11361 |
"formID": localStorage.getItem("newFormID"), |
|
11362 |
"dataRowNum": localStorage.getItem("datarowNum") |
|
11363 |
} |
|
11364 |
var requestSingleForm = window.commonAjax("/ubp-api-control/process/inst/bac", ss, "POST", true); |
|
11365 |
requestSingleForm.done(function (rs) { |
|
11366 |
console.log(rs); |
|
11367 |
|
|
11368 |
if (rs.data == 1) { |
449a85
|
11369 |
customBase.alert("S","退回成功"); |
4d1219
|
11370 |
$("#sssd").click(); |
B |
11371 |
} else { |
449a85
|
11372 |
customBase.alert("E","退回失败"); |
4d1219
|
11373 |
} |
B |
11374 |
}); |
|
11375 |
|
|
11376 |
|
|
11377 |
} else { |
|
11378 |
$("#sssd").click(); |
|
11379 |
} |
|
11380 |
} |
|
11381 |
//lym 审批确定后方法 |
|
11382 |
function zhixing(data) { |
|
11383 |
console.log(data); |
|
11384 |
console.log($("#datas").val()); |
|
11385 |
if (data == false) { |
|
11386 |
$("#sssd").click(); |
|
11387 |
} else { |
|
11388 |
|
|
11389 |
var processLog = JSON.parse(localStorage.getItem("processLog")); |
|
11390 |
console.log(processLog[0].processInstId); |
|
11391 |
var ss = { |
|
11392 |
"processInstId": processLog[0].processInstId, |
|
11393 |
"activityInstId": processLog[0].activityInstId, |
|
11394 |
"data": $("#datas").val(), |
|
11395 |
"formID": localStorage.getItem("newFormID"), |
|
11396 |
"dataRowNum": localStorage.getItem("datarowNum"), |
13ec33
|
11397 |
"token": localStorage.getItem("testToken"),//差旅token 特殊处理 |
4d1219
|
11398 |
"tenantId": localStorage.getItem("testTenantId"), |
B |
11399 |
"companyId": localStorage.getItem("testCompanyId"), |
13ec33
|
11400 |
|
4d1219
|
11401 |
} |
B |
11402 |
console.log("标记token"); |
|
11403 |
var requestSingleForm = window.commonAjax("/ubp-api-control/process/inst/finish", ss, "POST", true); |
|
11404 |
requestSingleForm.done(function (rs) { |
|
11405 |
console.log(rs); |
|
11406 |
if (rs.resCode == "00000") { |
|
11407 |
customBase.alert('S',"审批成功"); |
5a4f8f
|
11408 |
$('#editableBtn').remove();//审批成功后不能编辑 李伟民 0129 |
4d1219
|
11409 |
$("#sssd").click(); |
B |
11410 |
} else { |
|
11411 |
customBase.alert('W',"审批失败"); |
|
11412 |
} |
|
11413 |
}); |
|
11414 |
} |
|
11415 |
} |
|
11416 |
//2017.11.24 qld 追加预算 |
|
11417 |
customBase.budgetAddmoney = function () { |
|
11418 |
var id = JSON.parse(localStorage.getItem("tenantID")) |
|
11419 |
console.log(id.tenantID); |
|
11420 |
var sub = JSON.parse(localStorage.getItem("customItem")); |
|
11421 |
var submit_data = { |
|
11422 |
"formId": localStorage.getItem("newFormID"), |
|
11423 |
"netformid": localStorage.getItem("netformid"), |
|
11424 |
"parentDataRowNum": localStorage.getItem("datarowNum"), |
|
11425 |
"dataRowNum": localStorage.getItem("datarowNum"), |
|
11426 |
"tenantID": id.tenantID, |
|
11427 |
"formType": "ZJ" |
|
11428 |
}; |
|
11429 |
|
|
11430 |
var submit_request = window.commonAjax1("epc-form/extend/budget/money", submit_data, "POST", true); |
|
11431 |
submit_request.done(function (res) { |
|
11432 |
if (res.resCode == 'C0000') { |
|
11433 |
if (res.data == '1') { |
|
11434 |
var strMessage = customBase.getMessage("mesage_ID024"); |
|
11435 |
customBase.alert("E", strMessage); |
|
11436 |
} else if (res.data == '2') { |
|
11437 |
var strMessage = customBase.getMessage("mesage_ID025"); |
|
11438 |
customBase.alert("E", strMessage); |
|
11439 |
} else if (res.data == '3') { |
|
11440 |
var strMessage = customBase.getMessage("mesage_ID026"); |
|
11441 |
customBase.alert("E", strMessage); |
|
11442 |
} else if (res.data == '9') { |
|
11443 |
var strMessage = customBase.getMessage("mesage_ID027"); |
|
11444 |
customBase.alert("S", strMessage); |
|
11445 |
} else if (res.data == '7') { |
|
11446 |
var strMessage = customBase.getMessage("mesage_ID028"); |
|
11447 |
customBase.alert("E", strMessage); |
|
11448 |
} |
|
11449 |
|
|
11450 |
} |
|
11451 |
|
|
11452 |
}) |
|
11453 |
|
|
11454 |
} |
|
11455 |
|
|
11456 |
customBase.budgetBackmoney = function () { |
|
11457 |
var id = JSON.parse(localStorage.getItem("tenantID")) |
|
11458 |
console.log(id.tenantID); |
|
11459 |
var sub = JSON.parse(localStorage.getItem("customItem")); |
|
11460 |
var submit_data = { |
|
11461 |
"formId": localStorage.getItem("newFormID"), |
|
11462 |
"netformid": localStorage.getItem("netformid"), |
|
11463 |
"parentDataRowNum": localStorage.getItem("datarowNum"), |
|
11464 |
"dataRowNum": localStorage.getItem("datarowNum"), |
|
11465 |
"formType": "TH", |
|
11466 |
"tenantID": id.tenantID |
|
11467 |
}; |
|
11468 |
|
|
11469 |
var submit_request = window.commonAjax1("epc-form/extend/budget/money", submit_data, "POST", true); |
|
11470 |
submit_request.done(function (res) { |
|
11471 |
if (res.resCode == 'C0000') { |
|
11472 |
if (res.data == '1') { |
|
11473 |
var strMessage = customBase.getMessage("mesage_ID024"); |
|
11474 |
customBase.alert("E", strMessage); |
|
11475 |
} else if (res.data == '2') { |
|
11476 |
var strMessage = customBase.getMessage("mesage_ID025"); |
|
11477 |
customBase.alert("E", strMessage); |
|
11478 |
} else if (res.data == '3') { |
|
11479 |
var strMessage = customBase.getMessage("mesage_ID026"); |
|
11480 |
customBase.alert("E", strMessage); |
|
11481 |
} else if (res.data == '9') { |
|
11482 |
var strMessage = customBase.getMessage("mesage_ID027"); |
|
11483 |
customBase.alert("S", strMessage); |
|
11484 |
} else if (res.data == '7') { |
|
11485 |
var strMessage = customBase.getMessage("mesage_ID028"); |
|
11486 |
customBase.alert("E", strMessage); |
|
11487 |
} |
|
11488 |
} |
|
11489 |
|
|
11490 |
}) |
|
11491 |
|
|
11492 |
} |
|
11493 |
function repayment() { |
|
11494 |
var customBase = window.customBase; |
|
11495 |
customBase.repayment(); |
|
11496 |
return true; |
|
11497 |
} |
|
11498 |
customBase.repayment = function () { |
|
11499 |
var id = JSON.parse(localStorage.getItem("tenantID")) |
|
11500 |
console.log(id.tenantID); |
|
11501 |
var sub = JSON.parse(localStorage.getItem("customItem")); |
|
11502 |
console.log(sub); |
|
11503 |
var subForm = sub.DATAROWNUM; |
|
11504 |
console.log("我是" + subForm) |
|
11505 |
var submit_data = { |
|
11506 |
"formId": localStorage.getItem("newFormID"), |
|
11507 |
"netformid": localStorage.getItem("netformid"), |
|
11508 |
"parentDataRowNum": localStorage.getItem("datarowNum"), |
|
11509 |
"datarowNum": localStorage.getItem("datarowNum"), |
|
11510 |
"tenantId": id.tenantID |
|
11511 |
}; |
|
11512 |
|
|
11513 |
var submit_request = window.commonAjax1("epc-form/repayment/money", submit_data, "POST", true); |
|
11514 |
submit_request.done(function (res) { |
|
11515 |
if (res.data == true) { |
|
11516 |
// 12/7 qld |
|
11517 |
var strMessage = customBase.getMessage("mesage_ID029"); |
|
11518 |
customBase.alert("S", strMessage); |
|
11519 |
} else { |
|
11520 |
var strMessage = customBase.getMessage("mesage_ID030"); |
|
11521 |
customBase.alert("E", strMessage); |
|
11522 |
} |
|
11523 |
|
|
11524 |
}) |
|
11525 |
|
|
11526 |
} |
|
11527 |
//子表单合计方法 马习同 2017-12-06 |
|
11528 |
customShow.subTotle = function (subId) { |
|
11529 |
var customItems = customBase.options.customItems; |
|
11530 |
var numArr = []; |
|
11531 |
var subArr = []; |
|
11532 |
var numObj = {}; |
|
11533 |
_.each(customItems, opt => { |
|
11534 |
if (opt.parentsubFormNum == subId.replace("itemId_", "")) { |
|
11535 |
subArr.push(opt); |
|
11536 |
} |
|
11537 |
}); |
|
11538 |
_.remove(subArr, n => { |
|
11539 |
return n.fieldKey == "DATAROWNUM"; |
|
11540 |
}); |
|
11541 |
_.each(subArr, opt => { |
|
11542 |
if (opt.type == "number") { |
|
11543 |
console.log(opt.id); |
|
11544 |
numObj[opt.id] = customBase.getItemValue(opt.id, opt.type); |
|
11545 |
numArr.push(Number(customBase.getItemValue(opt.id, opt.type))); |
|
11546 |
} |
|
11547 |
}) |
|
11548 |
console.log(numObj); |
|
11549 |
for (let key in numObj) { |
|
11550 |
var opts = []; |
|
11551 |
if (_.isArray(numObj[key])) { |
|
11552 |
_.each(numObj[key], n => { |
|
11553 |
n = Number(n); |
|
11554 |
console.log(n); |
|
11555 |
opts.push(n); |
|
11556 |
}) |
|
11557 |
numObj[key] = opts; |
|
11558 |
} |
|
11559 |
console.log(numObj[key]); |
|
11560 |
} |
|
11561 |
console.log(numObj); |
|
11562 |
//_.sum 求和 |
|
11563 |
for (let key in numObj) { |
|
11564 |
$("." + key + "totle").val(_.sum(numObj[key])); |
|
11565 |
} |
|
11566 |
|
|
11567 |
} |
|
11568 |
//子表单合计方法 马习同 2017-12-07 |
|
11569 |
customShow.oneTotle = function () { |
|
11570 |
var customItems = customShow.options.customItemShow.item; |
|
11571 |
var totleArr = []; |
|
11572 |
var numObj = {}; |
|
11573 |
var numArr = []; |
|
11574 |
_.each(customItems, opt => { |
|
11575 |
console.log(opt.tag_Attribute.total) |
|
11576 |
if (opt.tag_Attribute.total == true) { |
|
11577 |
totleArr.push(opt.tag_Id); |
|
11578 |
console.log(opt.tag_Id) |
|
11579 |
} |
|
11580 |
}) |
|
11581 |
console.log(totleArr); |
|
11582 |
_.each(totleArr, opt => { |
|
11583 |
$("#" + opt + " [type='number']").unbind("change.totle"); |
|
11584 |
$("#" + opt + " [type='number']").on("change.totle", function () { |
|
11585 |
console.log($(this).attr("id")); |
|
11586 |
numObj[$(this).attr("id")] = customBase.getItemValue($(this).attr("id"), $(this).attr("type")); |
|
11587 |
console.log(_.cloneDeep(numObj)); |
|
11588 |
console.log(numObj[key]) |
|
11589 |
|
|
11590 |
for (let key in numObj) { |
|
11591 |
var opts = []; |
|
11592 |
if (_.isArray(numObj[key])) { |
|
11593 |
_.each(numObj[key], n => { |
|
11594 |
n = Number(n); |
|
11595 |
console.log(n); |
|
11596 |
opts.push(n); |
|
11597 |
}) |
|
11598 |
numObj[key] = opts; |
|
11599 |
} |
|
11600 |
console.log(numObj[key]); |
|
11601 |
} |
|
11602 |
|
|
11603 |
console.log(numObj); |
|
11604 |
//_.sum 求和 |
|
11605 |
for (let key in numObj) { |
|
11606 |
$("." + key + "totle").val(_.sum(numObj[key])); |
|
11607 |
} |
|
11608 |
}) |
|
11609 |
}) |
|
11610 |
} |
|
11611 |
//子表单内的控件内容超出部分显示title |
|
11612 |
customShow.addTitle = function () { |
|
11613 |
_.each($(".customShow .tdContentClass"), opt => { |
|
11614 |
// $(opt).attr("title", $(opt).children().children().html()); |
|
11615 |
console.log($(opt).html()) |
|
11616 |
if ($(opt).children().children().attr("type") == "text") { |
|
11617 |
$(opt).attr("title", $(opt).children().children().val()); |
|
11618 |
} else { |
|
11619 |
console.log(_.cloneDeep($(opt).children().children())) |
|
11620 |
console.log(opt.innerHTML) |
|
11621 |
console.log($(opt).children().children()[0].innerHTML) |
|
11622 |
$(opt).attr("title", $(opt).children().children()[0].innerHTML); |
|
11623 |
} |
|
11624 |
}) |
|
11625 |
} |
|
11626 |
// customShow.businessTypeAutoFun = function(key,fieldKey,cookieOrlocal){ |
|
11627 |
// if(cookieOrlocal == 'cookie'){ |
|
11628 |
// if(customBase.options.customItems[fieldKey].parentsubFormNum == '0'){ |
|
11629 |
// var businessTypeAuto = getCookie(key); |
|
11630 |
// customBase.setItemValue(customBase.options.customItems[fieldKey].id, customBase.options.customItems[fieldKey].type, businessTypeAuto, '', ''); |
|
11631 |
// } |
|
11632 |
// }else{ |
|
11633 |
// if(customBase.options.customItems[fieldKey].parentsubFormNum == '0'){ |
|
11634 |
// var businessTypeAuto = window.localStorage.getItem(key); |
|
11635 |
// customBase.setItemValue(customBase.options.customItems[fieldKey].id, customBase.options.customItems[fieldKey].type, businessTypeAuto, '', ''); |
|
11636 |
// } |
|
11637 |
// } |
|
11638 |
// } |
|
11639 |
// SC.billInfoInit = function(items){//票据信息初始化 李伟民 12-26 |
|
11640 |
// var itemKey = _.keys(items); |
|
11641 |
// var customItems = customBase.options.customItems; |
|
11642 |
// customShow.allbillInfo = []; |
|
11643 |
// _.each(itemKey,function(key){ |
|
11644 |
// console.log(key); |
|
11645 |
// if(customItems[key] != undefined && customItems[key] != '' && customItems[key].type == "subform"){ |
|
11646 |
// var billInfos = []; |
|
11647 |
// _.each(items[key], function(journey, i){ |
|
11648 |
// if(journey.billData != undefined){ |
|
11649 |
// billInfos.push(JSON.parse(journey.billData)); |
|
11650 |
// $("#" + key + "ActiveId").attr('noBillCheck',JSON.parse(journey.billData)); |
|
11651 |
// }else{ |
|
11652 |
// billInfos.push({}); |
|
11653 |
// } |
|
11654 |
// }); |
|
11655 |
// customShow.allbillInfo.push({ |
|
11656 |
// 'subFormId':customItems[key].id, |
|
11657 |
// 'subFormKey':key, |
|
11658 |
// 'billInfos':billInfos |
|
11659 |
// }) |
|
11660 |
// } |
|
11661 |
// }); |
|
11662 |
// billInfobind(customShow.allbillInfo); |
|
11663 |
// SC.noBillCheckInit(); |
|
11664 |
// } |
b84eca
|
11665 |
// SC.noBillCheckInit = function(){ |
L |
11666 |
// noBillCheck('journey','reimburseMan'); |
|
11667 |
// } |
|
11668 |
// function noBillCheck(subFieldKey,reimburseManKey){//无票据行程及票据人员与报销人验证 |
|
11669 |
// if(customBase.options.customItems[subFieldKey] == undefined){ |
|
11670 |
// return false; |
|
11671 |
// } |
|
11672 |
// var subId = customBase.options.customItems[subFieldKey].id; |
|
11673 |
// var manId = customBase.options.customItems[reimburseManKey].id; |
|
11674 |
// var manType = customBase.options.customItems[reimburseManKey].type; |
|
11675 |
// var manTitle = customBase.options.customItems[reimburseManKey].title; |
|
11676 |
// var journeySub = $("#" + subId + "ActiveId"); |
|
11677 |
// _.each(journeySub,function(jour){ |
|
11678 |
// var checkData = $(jour).attr('noBillCheck'); |
|
11679 |
// if(checkData != undefined && checkData != ''){ |
|
11680 |
// checkData = JSON.parse(checkData); |
|
11681 |
// var manVal = customBase.getItemValue(manId,manType); |
|
11682 |
// if(manVal != undefined && manVal != checkData.PersonalVal){ |
|
11683 |
// $(jour).children('h8').append("<span class='billCheck'>" + "票据‘" + checkData.PersonalName + "’与" + manTitle + "不同</span>"); |
|
11684 |
// } |
|
11685 |
// }else{ |
|
11686 |
// $(jour).children('h8').append("<span class='billCheck'>无票据行程</span>"); |
|
11687 |
// } |
|
11688 |
// }); |
|
11689 |
// } |
|
11690 |
// function billInfobind(allbillInfo){//票据信息显示 及 实时验证 李伟民 12-26 |
|
11691 |
// _.each(allbillInfo,function(info,k){ |
|
11692 |
// var sub_type = customShow.options.customItemShow.item[info.subFormId].tag_Attribute.allcopy; |
13ec33
|
11693 |
|
b84eca
|
11694 |
// _.each(info.billInfos,function(binfo, i){ |
L |
11695 |
// if(binfo.billCode != undefined){ |
|
11696 |
// var itemKey = _.keys(binfo.billHeadMeaningMvCodeMap); |
|
11697 |
// _.each(itemKey,function(key){ |
|
11698 |
// if(binfo.billHeadMap[key] != undefined && binfo.billHeadMap[key] != ''){ |
|
11699 |
// var bhName = binfo.billHeadMap[key].val; |
|
11700 |
// var bhVal = binfo.billHeadMap[key].code; |
|
11701 |
// billShow(sub_type,itemKey,bhName,bhVal,i); |
|
11702 |
// if(sub_type && key == 'PersonalName'){//储存票据人员信息 |
|
11703 |
// var noBillCheckData = { |
|
11704 |
// "PersonalName":bhName, |
|
11705 |
// "PersonalVal":bhVal |
|
11706 |
// }; |
|
11707 |
// $("#" + info.subFormId + "ActiveId:ep(" + k + ")").attr("noBillCheck",JSON.stringify(noBillCheckData)); |
|
11708 |
// } |
|
11709 |
// } |
|
11710 |
// }); |
13ec33
|
11711 |
// } |
b84eca
|
11712 |
// }); |
L |
11713 |
// }) |
|
11714 |
// } |
|
11715 |
// function billShow(sub_type,itemKey,bhName,bhVal,num){//票据信息验证绑定 李伟民 12-26 |
|
11716 |
// var itemId = customBase.options.customItems[itemKey].id; |
|
11717 |
// var type = customBase.options.customItems[itemKey].type; |
|
11718 |
// if(sub_type){ |
|
11719 |
// $("[id='"+itemId+"ActiveId']:eq('" + num + "')").find("h8[name='el_title']").append("<span class='billCheck'>" + bhName + "</span>"); |
|
11720 |
// }else{ |
|
11721 |
// customBase.set_p($("[id='"+itemId+"']:eq('" + num + "')")); |
|
11722 |
// if(type == 'dropdownlist'){ |
|
11723 |
// $("[id='"+itemId+"']:eq('" + num + "')").closet("p").append("<span class='billCheck'>" + bhName + "</span>"); |
|
11724 |
// }else{ |
|
11725 |
// $("[id='"+itemId+"']:eq('" + num + "')").prev("p").append("<span class='billCheck'>" + bhName + "</span>"); |
|
11726 |
// } |
13ec33
|
11727 |
|
b84eca
|
11728 |
// } |
L |
11729 |
// if(type == 'dropdownlist'){ |
|
11730 |
// $("[id='"+itemId+"']:eq('" + num + "')").find(".select_get").on('change.billcheck',function(){ |
|
11731 |
// if(sub_type){ |
|
11732 |
// $("[id='"+itemId+"ActiveId']:eq('" + i + "')").find(".billCheck").css("color", "#333"); |
|
11733 |
// if($(this).val() != bhVal) { |
|
11734 |
// $("[id='"+base_item_id+"ActiveId']:eq('" + i + "')").find(".billCheck").css("color", "red"); |
|
11735 |
// } |
|
11736 |
// }else{ |
|
11737 |
// $("[id='"+itemId+"']:eq('" + i + "')").closet("p").find(".billCheck").css("color", "#333"); |
|
11738 |
// if($(this).val() != bhVal) { |
|
11739 |
// $("[id='"+itemId+"']:eq('" + i + "')").closet("p").find(".billCheck").css("color", "red"); |
|
11740 |
// } |
|
11741 |
// } |
|
11742 |
// }); |
|
11743 |
// }else{ |
|
11744 |
// $("[id='"+itemId+"']:eq('" + num + "')").on('change.billcheck',function(){ |
|
11745 |
// if(sub_type){ |
|
11746 |
// $("[id='"+itemId+"ActiveId']:eq('" + i + "')").find(".billCheck").css("color", "#333"); |
|
11747 |
// if($(this).val() != bhVal) { |
|
11748 |
// $("[id='"+itemId+"ActiveId']:eq('" + i + "')").find(".billCheck").css("color", "red"); |
|
11749 |
// } |
|
11750 |
// }else{ |
|
11751 |
// $("[id='"+itemId+"']:eq('" + i + "')").prev("p").find(".billCheck").css("color", "#333"); |
|
11752 |
// if($(this).val() != bhVal) { |
|
11753 |
// $("[id='"+itemId+"']:eq('" + i + "')").prev("p").find(".billCheck").css("color", "red"); |
|
11754 |
// } |
|
11755 |
// } |
|
11756 |
// }) |
|
11757 |
// } |
624ff8
|
11758 |
// } |