fs-danaus
2022-12-15 867622ec9d4e9fc94c223baed6233ba113bcb6a2
提交 | 用户 | age
a6a76f 1 document.onkeydown = hotkey;
F 2 var benzi = "";
3 var popdivId = "";//隐藏42层用到
4 var popdiv = null;
5 var systemUuid = {};
6 systemUuid.uuid = null;
7
8 function generateUUID_hotkey() {
9     var d = new Date().getTime();
10     if (window.performance && typeof window.performance.now === "function") {
11         d += performance.now(); //use high-precision timer if available
12     }
13     var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
14         var r = (d + Math.random() * 16) % 16 | 0;
15         d = Math.floor(d / 16);
16         return (c == 'x' ? r : (r & 0x3 | 0x8)).toString(16);
17     });
18     return uuid;
19 }
20
21 (function () {
22     if (typeof (generateUUID_hotkey) != "undefined") {
23         systemUuid.uuid = generateUUID_hotkey();
24         //console.info("........generateUUID:"+systemUuid.uuid);
25     } else {
26         systemUuid.uuid = generateUUID();
27     }
28     try {
29         $(window).scroll(function () {
30             if ($(document).scrollTop() > 0) {
31                 parent.subPageScrollHeight = $(document).scrollTop();
32             }
33         });
34     } catch (e) {
35     }
36 })();
37 window.onload = function () {
38     gridHeight();//格线高度设置
39 }
40 window.onresize = function () {
41     gridHeight();//格线高度设置
42 }
43
44 function hotkey(event) {
45     var e = window.event || event;
46     var eCode = e.keyCode;
47     if (eCode == 27) {
48         e.returnValue = false;
49     }
50     if (((parent && parent.userType === "1")) && (eCode == 65) && (e.ctrlKey) && (e.shiftKey)) {
51         open2_9802('');
52     } else if ((eCode == 83) && (e.ctrlKey) && (e.shiftKey)) {//ctrl+shift+S    //(parent&&parent.userType==="1")&&
53         open2_9802('s');
54     } else if ((eCode == 82) && (e.altKey)) {        //alt+r 刷新
55         refresh();
56     }
57     panelGrid(e);
58 }
59
60 function panelGrid(event) {
61     //ctrl+shift+1,打开F11
62     if (event.keyCode == 49 && event.ctrlKey && event.shiftKey && formType == "1") {
63         var mainDis = document.getElementById('tplt-grid').style.display;
64         if (mainDis == "block" || mainDis == "") {
65             gridToPanel = false;
66             var va_ = mygrid.getCurRecord();
67             if (va_ != null) {
68                 panMain[panIndex].panInfoSet(panMain[panIndex].html_Col, va_, false);
69             }
70             gridToPanel = true;
71         }
72         document.getElementById('tplt-grid').style.display = (mainDis == "none") ? "block" : "none";
73         document.getElementById('tplt-panel').style.display = (mainDis == "none") ? "none" : "block";
74     }
75 }
76
77 function panelHid(op) {
78     if (op == "0") {
79         document.getElementById('tplt-panel').style.display = "none";
80     } else {
81         document.getElementById('tplt-grid').style.display = "none";
82     }
83     gridHeight();
84 }
85
86 function open2_9802(o) {
87     var url = "";
88     var fid = "";
89     var paUs = document.URL.split("/");
90     url = paUs[0] + "/" + paUs[1] + "/" + paUs[2];
91     fid = this.formId != null ? this.formId : paUs[7];
92     if (parent.addTab) {
93         if (o == 's_all') {
94             parent.addTab("生成所有页面", "", "", "", url + "/buildv2.do?m=a");
95         } else if (o == '') {
96             parent.addTab("", 9802, 10, "wherePan=formid=" + fid);
97         } else {
98             parent.addTab(fid + "生成页面", "", "", "", url + "/buildv2.do?formID=" + fid);
99         }
100     } else {
101         if (o != 's') {
102             window.open(url + "/app/0/" + parent.dbid + "9802/10/index.jsp?wherePan=formid=" + fid, "", 'left=0,top=0,width=' + (screen.availWidth - 10) + ',height=' + (screen.availHeight - 50) + ',toolbar=no,menubar=no,scrollbars=no,location=no');
103         } else {
104             window.open(url + "/buildv2.do?formID=" + fid, "", 'left=200,top=200,width=300,height=30,toolbar=no,menubar=no,scrollbars=no,location=no');
105         }
106     }
107 }
108
109 function toJson(str) {
110     var s = str.split("\?");
111     var temp = s[1].split("&");
112     var json = {};
113     for (var i = 0; i < temp.length; i++) {
114         var ts;
115         if (temp[i].indexOf && temp[i].indexOf("==") > 0) {
116             ts = temp[i].split(/\b=\b/);
117         } else {
118             ts = temp[i].split(/=/);
119         }
120         //存在多个=的情况,by danaus 2020/2/24 20:28
121         var strs = "";
122         for (var j = 1; j < ts.length; j++) {
123             if (j == 1)
124                 strs += ts[j];
125             else
126                 strs += "=" + ts[j];
127         }
128         json[ts[0]] = strs;
129     }
130     return json;
131 }
132
133 function exportExcel() {//导出excel
134     var excelurl;
135     var excelTitle;
136     var TGData = "";
137     showLoading();
138     try {
139         if (top.myFresh.formType == 3 && !top.myFresh.clickNode) {
140             alert("请先选择左边分类再执行导出");
11e5da 141             closeLoading();
a6a76f 142             return;
F 143         }
144     } catch (e) {
145     }
146     if (typeof (mygrid) != "undefined") {
147         if (typeof (panMain) != "undefined" && typeof (panMain[panIndex]) != "undefined")
867622 148             mygrid.excelTitle = new Base64().encode((panMain[panIndex].panelTitle == undefined ? "" : panMain[panIndex].panelTitle) + "~" + mygrid.gridTitlefun());// 面板+格线的动态标题
a6a76f 149         else
867622 150             mygrid.excelTitle = new Base64().encode("~" + mygrid.gridTitlefun());// a面板+格线的动态标题
a6a76f 151         var str = mygrid.exportExcl();
F 152         excelurl = str.split("&p&")[0];
153         if (excelurl.indexOf("flag=") < 0) {
154             excelurl += "flag=-1";
155         }
156         TGData = str.split("&p&")[1].replace("TGData=", "");
157     } else {
158         if (typeof (panMain) != "undefined")
159             excelTitle = new Base64().encode((panMain[panIndex].panelTitle == undefined ? "" : panMain[panIndex].panelTitle) + "~" + "");// 面板+格线的动态标题
160         TGData = '{"Cfg":{"Sort":"","SortCols":"","SortTypes":"0","Group":"","GroupCols":"","SearchAction":"","TimeZone":"-480","ScrollLeft":"0","LeftScrollLeft":"0","ScrollTop":"0"},"CutFilter":{"Filter":""},"rowspan":"","Filters":[],"IO":{},"Fields":{"FieldsName":"" },"CutFilter":{"Filter":"" },"Exprs":{"expr":"" },"Cps":{"cp":"" },"rowspan":"","excelTitle":"fg==","Body":[{"Pos":"0"}]}';
5733ae 161         if (panMain[panIndex].panelTitle == null || panMain[panIndex].panelTitle == "") {
X 162             var doccode = $("#doccode").val();
163             if (doccode != null && doccode != "") {
164                 panMain[panIndex].panelTitle = "doccode='" + doccode + "'";
165             }
166         }
a6a76f 167         excelurl = "/gtGrid.do?m=load&where=" + (panMain[panIndex].panelTitle == undefined ? "" : panMain[panIndex].panelTitle) + "&formID=" + formId + "&winType=" + (formType == 16 ? 17 : formType) + "|0&flag=-1&autopaging=3&cp=0&formdatafilters=&pageSize=100&picFild=";
F 168     }
169     var obj = toJson(excelurl);
170
171     var form = $("<form>");
172     form.attr('style', 'display:none');
173     form.attr('target', '');
174     form.attr('method', 'post');
175     form.attr('action', "/gtGrid.do?m=" + obj.m);
176     var input1 = $('<input>');
177     input1.attr('type', 'hidden');
178     input1.attr('name', 'autopaging');
179     input1.attr('value', obj.autopaging);
180     form.append(input1);
181     var input2 = $('<input>');
182     input2.attr('type', 'hidden');
183     input2.attr('name', 'cp');
184     input2.attr('value', obj.cp);
185     form.append(input2);
186     var input3 = $('<input>');
187     input3.attr('type', 'hidden');
188     input3.attr('name', 'flag');
189     input3.attr('value', obj.flag);
190     form.append(input3);
191     var input4 = $('<input>');
192     input4.attr('type', 'hidden');
193     input4.attr('name', 'formID');
194     input4.attr('value', obj.formID);
195     form.append(input4);
196     var input5 = $('<input>');
197     input5.attr('type', 'hidden');
198     input5.attr('name', 'formdatafilters');
199     input5.attr('value', obj.formdatafilters);
200     form.append(input5);
201     var input6 = $('<input>');
202     input6.attr('type', 'hidden');
203     input6.attr('name', 'pageSize');
204     input6.attr('value', obj.pageSize);
205     form.append(input6);
206     var input7 = $('<input>');
207     input7.attr('type', 'hidden');
208     input7.attr('name', 'picFild');
209     input7.attr('value', obj.picFild);
210     form.append(input7);
211     var input8 = $('<input>');
212     input8.attr('type', 'hidden');
213     input8.attr('name', 'where');
214     input8.attr('value', obj.where);
215     form.append(input8);
216     var input9 = $('<input>');
217     input9.attr('type', 'hidden');
218     input9.attr('name', 'winType');
219     input9.attr('value', obj.winType);
220     form.append(input9);
05dbc2 221     var input10 = $('<input>');
F 222     input10.attr('type', 'hidden');
223     input10.attr('name', 'isExportExcel');
224     input10.attr('value', obj.isExportExcel);
225     form.append(input10);
a6a76f 226     var input11 = $('<input>');
F 227     input11.attr('type', 'hidden');
228     input11.attr('name', 'TGData');
229     input11.attr('value', TGData);
230     form.append(input11);
d89677 231     var input12 = $('<input>');
F 232     input12.attr('type', 'hidden');
233     input12.attr('name', 'tbCols');
234     input12.attr('value', obj.tbCols);
235     form.append(input12);
a6a76f 236     $('body').append(form);
F 237     form.submit();
238     form.remove();
239     if (typeof (mygrid) != "undefined") mygrid.ReloadBody();
240     top.myFresh.clickNode = false;
241     closeLoading();
242 }
243
244 function refalshGridOfColse() {
245
246     var p_frame = parent.frames[inChangFrame];
247     if (p_frame) {
248         if (C_Grid != "") {
249             var gr = eval('(' + C_Grid + ')');//弹出的父页面传过来的信息
250             var pa = p_frame.Grids[gr.gridID];//得到grid
251             if (pa.clickDb) {
252                 pa.clickDb = false;
253                 return;
254             }
255             if (pa && gr.clickGrid) {
256                 if (gr.toP == undefined || gr.toP == null || gr.toP == "null" || gr.toP == "") return;//没有需要返回字段,不作处理
257                 //增加如果当前页面是31类型弹出作选择用则需要判断是否已保存了数据才给返回
258                 if (gr.is31 && (this.getInsertedRecords().length > 0 || this.getUpdatedRecords().length > 0 || this.getDeletedRecords().length > 0)) {
259                     alert(this.GetText("isSave"));
260                     return;
261                 }
262                 var ower = gr.toP.split(";");//自表
263                 var temp = [];
264                 var row = pa.Rows[gr.rowIDp];//三点弹出的所在行
265                 for (var i = 0; i < ower.length; i++) {
266                     temp[i] = row[ower[i]];
267                 }
268                 pa.threePop(temp, ower, row, null, -1);
269                 pa.EndEdit(0);
270             }
271         }
272     }
273 }
274
275 function postCheck(y, grid) {//由直接按确认后才调用
276     //location.href=document.URL+"?"+y.split(",")[3];
277     var doc = y.split(",")[4];
278     //$("#doccode").attr("value",doc);
279     isNew = 0;//更新
280     check = 3;//执行数据范围的确认前检查
281     ischeck = true;//表示需要在commitIs里面执行确定执行
282     trandoc = y.split(",")[0];
283     var pm = panMain[panIndex];
284
285     plane = pm.getPanMap();
286     var datas = grid.postData(plane, check);
287     var url = '/check.do';
288     if (btnId != null) {
289         url = url + '?btnid=' + btnId;
290     }
291     $.ajax({
292         type: "POST",
293         async: false,  // 设置同步方式
294         cache: false,
295         url: url,
296         data: {"_gt_json": datas, "point": 3, "formid": formId, "hasGrid": "1"},
297         dataType: 'text',
298         success: function (data) {
299             tranOk = true;
300             parent.errShow.frame = parent.frames[inThisFrame];
301             parent.errShow.show_divErro(data, true);
302
303             btnId = null;
304             OA = "";
305         }
306     });
307 }
308
309 var g = null;//格线对象
310 var wpanl = "";//面板
311 function setValue(str) {
312     if (g != null) {//处理格线
313         Grids[g.id].SetValue(g.r, g.c, str, 0);
314         Grids[g.id].RefreshCell(g.r, g.c);
315         g = null;
316     } else if (wpanl != null) {//处理面板
317         if (str.indexOf('|') != -1) {//9类型上传附件,处理图片返回的uuid
318             var ls = str.split('|')[1];
319             str = ls;
320         }
321         var uuid = str.replaceAll(".*uuid=", "");//获取uuid值
322         //     var sturl=str.substring(0,str.indexOf('uuid=')+5);//截取图片显示调用函数
323         if (wpanl.pid != undefined) {//9类型附件上传控件赋值
324             if (uuid.indexOf('&') != -1) {
325                 uuid = uuid.substring(0, uuid.indexOf('&'));
326             }
327             setDoc(wpanl.pid, ".value='" + uuid + "'");// 赋字段值
328             setDoc(wpanl.th, ".src='/getImage.do?type=1&uuid=" + uuid + "'");//id+_UpImage图片的赋值
329         } else {//19类型附件上传赋值
330             uuid = uuid.substring(0, uuid.indexOf(';'));
331             setDoc(wpanl, ".value='" + uuid + "'");// 赋字段值
332         }
333         wpanl = null;
334     }
335 };
336
337 function showWindow_Grid(url, obj, callBack, arguments, tid, pid) {
338     if (obj == undefined || obj == null || obj == '') {
339         obj = {};
340         obj.isDialog = 1;
341     }
342     g = tid;
343     wpanl = pid;
344     // url=encodeURL(url);
345     var param = {
346         "url": url,
347         vArguments: obj,
348         dialogWidth: 420,//(screen.availWidth - 60),
349         dialogHeight: 380,//(screen.availHeight - 110),
350         callBack: callBack
351     };
352     param = $.extend(param, arguments || {});
353     var openPage = new myapp(param);// new 一个打开对象 **改变了窗体不是默认大小
354     openPage.openNewWin();
355 };
356
357 var myapp = function (o) {
358     this.options = {
359         url: "",// 你要打开的页面url
360         vArguments: "window",// 你要向打开的页面传递的数据
361         dialogWidth: 300,// 打开窗口的宽度
362         dialogHeight: 300,// 你打开窗口的高度
363         center: "yes",// center: {yes | no | 1 | 0 }:窗口是否居中,默认yes,但仍可以指定高度和宽度。
364         help: "no",// {yes | no | 1 | 0 }:是否显示帮助按钮,默认yes
365         resizable: "yes",// {yes | no | 1 | 0 } [IE5+]:是否可被改变大小。默认no
366         status: "yes",// {yes | no | 1 | 0 } [IE5+]:是否显示状态栏。默认为yes[
367         // Modeless]或no[Modal]。
368         scroll: "yes",// { yes | no | 1 | 0 | on | off }:指明对话框是否显示滚动条。默认为yes。
369         callBack: false
370     };
371     Object.extend(this.options, o || {});
372 };
373 myapp.prototype = {
374     openNewWin: function (url) {
375         var options = this.options;
376         var l = (screen.availWidth - options["dialogWidth"]) / 2;
377         var h = (screen.availHeight - options["dialogHeight"]) / 2;
378         var sp = "dialogTop:" + h + "px;dialogLeft:" + l + "px;dialogWidth:"
379             + options["dialogWidth"] + "px;dialogHeight:"
380             + options["dialogHeight"] + "px;center:" + options["center"]
381             + ";help:" + options["help"] + ";resizable:"
382             + options["resizable"] + ";status:" + options["status"]
383             + ";scroll:" + options["scroll"];
384         if (typeof options["fieldid"] != 'undefined') {
385             wpanl = options["fieldid"];
386         }
387         var newWin = null;
388         if (window.showModalDialog != undefined) {
389             newWin = window.showModalDialog(options["url"], options["vArguments"], sp);
390             var call = options["callBack"];
391             if (typeof call == "function") {// 调用 数据处理函数
392                 call(newWin);
393             }
394         } else {
395             var sp1 = "top=" + h + ",left=" + l + ",width="
396                 + options["dialogWidth"] + ",height="
397                 + options["dialogHeight"];
398             if (options["url"].indexOf('.do?') != -1) {//判断是否访问的是方法 2014-11-25
399                 $.ajax({
400                     type: "POST",
401                     async: false,  // 设置同步方式
402                     cache: false,
403                     url: options["url"],
404                     dataType: 'text',
405                     success: function (data) {
406                         if (data == '删除成功') {
407                             setDoc(wpanl.pid, ".value=''");//清空
408                             setDoc(wpanl.th, ".src=''");//id+_UpImage图片的清空
409                             document.getElementById(wpanl.pid + 'Update').style.display = "none";//隐藏更新
410                             document.getElementById(wpanl.pid + 'Upload').style.display = "block";//显示上传
411                             document.getElementById(wpanl.pid + 'Upload').value = "上传";//显示上传
412                         }
413                         alert(data);
414                     }
415                 });
416             } else {
417                 window.open(options["url"], "newdiag", sp1);
418             }
419         }
420
421     },
422     setOptions: function () {
423     }
424 };
425
426
427 /**
428  *
429  *  Base64 encode / decode
430  *
431  *  @author haitao.tu
432  *  @date   2010-04-26
433  *  @email  tuhaitao@foxmail.com
434  *
435  */
436
437 function Base64() {
438
439     // private property  
440     _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
441
442     // public method for encoding  
443     this.encode = function (input) {
444         var output = "";
445         var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
446         var i = 0;
447         input = _utf8_encode(input);
448         while (i < input.length) {
449             chr1 = input.charCodeAt(i++);
450             chr2 = input.charCodeAt(i++);
451             chr3 = input.charCodeAt(i++);
452             enc1 = chr1 >> 2;
453             enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
454             enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
455             enc4 = chr3 & 63;
456             if (isNaN(chr2)) {
457                 enc3 = enc4 = 64;
458             } else if (isNaN(chr3)) {
459                 enc4 = 64;
460             }
461             output = output +
462                 _keyStr.charAt(enc1) + _keyStr.charAt(enc2) +
463                 _keyStr.charAt(enc3) + _keyStr.charAt(enc4);
464         }
465         return output;
466     }
467
468     // public method for decoding  
469     this.decode = function (input) {
470         var output = "";
471         var chr1, chr2, chr3;
472         var enc1, enc2, enc3, enc4;
473         var i = 0;
474         input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
475         while (i < input.length) {
476             enc1 = _keyStr.indexOf(input.charAt(i++));
477             enc2 = _keyStr.indexOf(input.charAt(i++));
478             enc3 = _keyStr.indexOf(input.charAt(i++));
479             enc4 = _keyStr.indexOf(input.charAt(i++));
480             chr1 = (enc1 << 2) | (enc2 >> 4);
481             chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
482             chr3 = ((enc3 & 3) << 6) | enc4;
483             output = output + String.fromCharCode(chr1);
484             if (enc3 != 64) {
485                 output = output + String.fromCharCode(chr2);
486             }
487             if (enc4 != 64) {
488                 output = output + String.fromCharCode(chr3);
489             }
490         }
491         output = _utf8_decode(output);
492         return output;
493     }
494
495     // private method for UTF-8 encoding  
496     _utf8_encode = function (string) {
497         string = string.replace(/\r\n/g, "\n");
498         var utftext = "";
499         for (var n = 0; n < string.length; n++) {
500             var c = string.charCodeAt(n);
501             if (c < 128) {
502                 utftext += String.fromCharCode(c);
503             } else if ((c > 127) && (c < 2048)) {
504                 utftext += String.fromCharCode((c >> 6) | 192);
505                 utftext += String.fromCharCode((c & 63) | 128);
506             } else {
507                 utftext += String.fromCharCode((c >> 12) | 224);
508                 utftext += String.fromCharCode(((c >> 6) & 63) | 128);
509                 utftext += String.fromCharCode((c & 63) | 128);
510             }
511
512         }
513         return utftext;
514     }
515
516     // private method for UTF-8 decoding  
517     _utf8_decode = function (utftext) {
518         var string = "";
519         var i = 0;
520         var c = c1 = c2 = 0;
521         while (i < utftext.length) {
522             c = utftext.charCodeAt(i);
523             if (c < 128) {
524                 string += String.fromCharCode(c);
525                 i++;
526             } else if ((c > 191) && (c < 224)) {
527                 c2 = utftext.charCodeAt(i + 1);
528                 string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
529                 i += 2;
530             } else {
531                 c2 = utftext.charCodeAt(i + 1);
532                 c3 = utftext.charCodeAt(i + 2);
533                 string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
534                 i += 3;
535             }
536         }
537         return string;
538     }
0279b8 539     return this;
a6a76f 540 }
F 541
542 function closeOther() {
543     if (popdiv) {//面板引用的id
544         popdiv.colseAll();
545     }
546     if (mygrid.popdiv) {
547         mygrid.popdiv.colseAll();
548     }
549 }
550
551 var getDiv42 = {
552     pop: createPopDiv(),
553     ShowDivForPanel: function (e, id, formid, rod, index) {
554         this.pop.ShowDivForPanel(e, id, formid, rod, index);
555         try {
556             // 单击触发事件
557             $(document).bind('click', function (e) {
558                 if (getDiv42.pop != null && e.target.offsetParent != null) {
559                     // 单击事件触发42类型控件层隐藏
560                     // 处理42类型控件层的隐藏 2015-4-20 13:51:25
561                     getDiv42.pop.popdivIdDisplay(e.target.offsetParent.id);
562                 }
563             });
564         } catch (e) {
565         }
566         try {
567             // tab触发事件
568             $(document).bind('keyup', function (e) {
569                 if (e.keyCode == 9 && getDiv42.pop != null && e.target.offsetParent != null) {
570                     // tab键触发42类型控件层隐藏
571                     // 处理42类型控件层的隐藏 2015-4-20 13:51:25
572                     getDiv42.pop.popdivIdDisplay(e.target.offsetParent.id);
573                 }
574             });
575         } catch (e) {
576         }
577     },
578     closediv: function (thisd, div) {
579         this.pop.closediv(thisd, div);
580     }
581 }
582
583 function createPopDiv() {
584     var popdiv1 = {// 42类型控件弹出列表
585         Tgrid: null,// 格线
586         Trow: null,
587         inputValue: "",// 保存之前的值
588         timer: null,// 定时器,选择返回记得清除计时器
589         Tformid: null,// 弹出列表的功能号
590         lf: null,// 左边位置
591         tp: null,// 上边位置
592         positionss: 'absolute',
593         Trand: 0,// 生成div id的随机数,以区别相同功能号的情况
594         isclose: true,
595         rowcount: 0,// 记录行数
596         Tfield: null,// 保存当前的字段,以便格线计算公式用
597         ShowDivForPanel: function (e, id, formid, rod, index) {// 面板 elem表示当前触发的文本框对象
598             var div = this;
599             clearTimeout(div.timer);
600             if (e.offsetParent == null) return;
601             this.Tformid = formid
602             this.Trand = rod
603             //获取scroll的top位置,弹出层需要减去这个高度,避免位置出现偏差 by danaus 2020/11/7 17:23
604             var scrollTop = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop;
605             tp = e.offsetParent.offsetParent.offsetTop + e.offsetParent.offsetTop + 28 - scrollTop;// 42控件div的top控制
606             lf = e.offsetParent.offsetParent.offsetLeft + e.offsetParent.offsetLeft + 118;// 42类型div的left控制
607             popdivId = document.getElementById('T_' + this.Tformid + '_' + this.Trand + 'div');// 获取隐藏层属性
608             if (isTopFixed()) {
609                 //这里是针对单单只有面板并且没滚动条的情况 xin 2020-11-11 09:46:54
610                 if ($("#tplt-grid").length > 0) {
611                     tp = e.offsetParent.offsetParent.offsetTop + e.offsetParent.offsetTop + 28;
612                 } else {
613                     tp = tp + 70;
614                     this.positionss = "fixed";
615                 }
616             }
617             // 调用ajax从后台取数据,例子对应ShowDivForGrid方法
618             // 写的方法
619             var panInfo = panMain[index].panInfo;
620             var pi = id.split("#");
621             var col = e.id;
622             var biao = pi[0];
623             var waiziduan = pi[1];
624             benzi = pi[2].toLowerCase();
625             var SuggestFileds = pi[3];
626             var guangl = pi[4];
627             if (getDoc(col, '.readOnly')) {
628                 return;
629             }
630             if (SuggestFileds == "") {
631                 SuggestFileds = waiziduan;
632             }
633 // for(var p in panMain ){
634             var efilter = "";
635             for (var ef in panMain) {
636                 if (typeof (panMain[ef].panInfo[col]) != "undefined") {
637                     if (panMain[ef].panInfo[col].efilter != "") {
638                         efilter += panMain[ef].panInfo[col].efilter;
639                     }
640                 }
641             }
642             var tiaojian = this.getOutWhere(benzi, waiziduan, '', ' and ', col, true, guangl, efilter);// efilter获取自定义信息
643             var url = "/invAlldiv.do?id=" + biao + "&where="
644                 + encodeURI(replacePageValue(tiaojian)) + "&sugg=" + SuggestFileds;
645             //url = encodeURI(encodeURI(url));// 必须两次
646             var userAgents = navigator.userAgent; // 取得浏览器的userAgent字符串
647             var bols = ((userAgents.indexOf("Firefox") > -1 && event.keyCode == 8) ? true : event.keyCode == 8);
648             div.timer = setTimeout(function () {
649                 var D = e.value// 当前值
650                 if (bols && D == "") {// backespace建 删除关联字段信息(清空关联)
651                     var emptyref = panInfo[e.id].emptyrefdata.toLowerCase().split(";");
652                     if (emptyref.length > 0) {
653                         for (var del in emptyref)
654                             setDoc(emptyref[del], ".value=''");// 赋字段值
655                     }
656                     div.colseAll();
657                     return;
658                 }
659                 if (D == "" || div.inputValue == D) {
660                     return;
661                 }
662                 div.inputValue = D;
663                 $.ajax({
664                     type: "POST",
665                     async: false,  // 设置同步方式
666                     cache: false,
667                     url: url,
668                     // data:{"_gt_json":datas,"point":3,"formid":formId,"hasGrid":"1"},
669                     dataType: 'text',
670                     success: function (date) {
671                         var cdiv = document.getElementById('T_' + div.Tformid + "_" + div.Trand + 'CDiv');// 内容Div
672                         div.removeRows(cdiv);
673                         div.popDiv(date, cdiv);
674                     },
675                     error: function (data) {
676                         alert(data);
677                     }
678                 });
679             }, 2000);
680         },
681         getOutWhere: function (ben, wai, zi, addFuHao, id, qianzhi, guangl, efilter) {// 条件(本身,外表,自定义,连接符,是否强制录入)
682             openTree = true;
683             var bens = ben.split(";");
684             var wais = wai.split(";");
685             var glian = guangl.split(";");
686             var where = "";
687             var col = "";
688             var value = "";
689             var colDan = "";
690             var gl = "";
691             for (i = 0; i < bens.length; i++) {
692                 col = bens[i].toLowerCase();
693                 if (col.Trim() != "") {
694                     value = getDoc(col, ".value");
695                     // 针对 300029 资金帐户
696                     if (value == null) {
697                         value = "";
698                     }
699                     //
700                     if (qianzhi) { // 强制判断
701                         if (value != "") {
702                             if (value.indexOf("'") != -1) {
703                                 value = value.replace(new RegExp("'", "g"), "''");
704                             }
705                             where += wais[i] + " like '" + "@~" + value + "@~'"
706                                 + addFuHao;// and
707                         }
708                     }
709                 }
710             }
711             if (guangl != "") {
712                 value = getDoc(id, ".value");
713                 if (value.indexOf("'") != -1) {
714                     value = value.replace(new RegExp("'", "g"), "''");
715                 }
716                 for (var g = 0; g < glian.length; g++) {
717                     col = glian[g].toLowerCase();
718                     if (col.Trim() != "") {
719                         gl += col + " like '" + "@~" + value + "@~'" + " or ";
720                     }
721                 }
722                 gl = gl.substring(0, gl.length - 3);
723                 gl = " or (" + gl + ")";
724             }
725             if (zi.Trim() != "") {
726                 where += zi + addFuHao;// 追加自定义条件
727             }
728             where = where.substring(0, where.length - addFuHao.length);
729
730             //where为空值的情况,让他在()里面成立。解决查询sql报错问题
731             where = (efilter == "" ? "" : "(") + "(" + (where == "" ? "1=1" : where) + ")" + gl + (efilter == "" ? "" : ") and (" + efilter + ")");
732             return where;
733         },
734         close: function (div) {
5f1f90 735             //新方法里面调用隐藏(格线用) xin 2021-3-24 10:57:20
ac2ece 736             var that=this;
5f1f90 737             control42DivData.divClose(div, function (bol) {
X 738                 if (!bol) {
ac2ece 739                     that.inputValue = "";
5f1f90 740                     div.parentElement.style.display = "none";
ac2ece 741                     clearInterval(that.timer);
X 742                     that.timer = null;
743                     that.isclose = true;
5f1f90 744                     closeOther();
X 745                 }
746             })
a6a76f 747         },
F 748         colseAll: function () {
749             var cdiv = document.getElementById('T_' + this.Tformid + '_' + this.Trand + 'CDiv');// 内容Div
750
751             cdiv.inputValue = "";
752             cdiv.parentElement.style.display = "none";
753             clearInterval(cdiv.timer);
754             cdiv.timer = null;
755             cdiv.isclose = true;
756         },
757         closediv: function (thisd, div) {
758             this.inputValue = "";
759             popdivId = thisd;
760             document.getElementById(div).style.display = "none";
761             closeOther();
762         },
763         //隐藏42控件的div层
764         popdivIdDisplay: function (panelId) {
765             clearInterval(this.timer);
766             this.timer = null;
767             if (popdivId != "" && popdivId != null) {
768                 var div42 = popdivId.firstChild.id;
769                 panelId == null ? "" : panelId;
770                 if (panelId != div42) {
771                     if (document.getElementById(popdivId.id).style.display != "") {
772                         document.getElementById(popdivId.id).style.display = "none";
773                     }
774                 }
775             }
776         },
777         // 格线
778         ShowDivForGrid: function (tg, elem, col) {
ac2ece 779             var that=this;
5f1f90 780             control42DivData.ShowDivForGrid(tg, elem, col, function (bol) {
X 781                 if (!bol) {//没发现是新的界面时候才执行下面的旧方法(兼容) xin 2021-3-25 10:06:37
ac2ece 782                     that.Tgrid = tg;
X 783                     if (that.Tgrid == null) return;
5f1f90 784                     Trow = GT.rowIDp;
ac2ece 785                     that.Tformid = col.formid;
X 786                     that.Trand = col.rand;
5f1f90 787                     if (elem.offsetParent == null) return;
ac2ece 788                     var gheight = that.Tgrid.MainTag.clientHeight;
5f1f90 789                     //获取scroll的top位置,弹出层需要减去这个高度,避免位置出现偏差 by danaus 2020/11/7 17:23
X 790                     var scrollTop = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop;
791                     tp = elem.offsetParent.offsetTop + elem.offsetParent.offsetHeight - scrollTop;
792                     lf = elem.offsetParent.offsetLeft;
a6a76f 793
5f1f90 794                     // 取数据
X 795                     Tfield = col.Name;
796                     var A = col;
797                     if (A == undefined || A.toParm == null) {
798                         return
a6a76f 799                     }
ac2ece 800                     D = that.Tgrid.Edit.Tag.value + "";
X 801                     if (D == "" || that.inputValue == D) {
5f1f90 802                         return;
X 803                     }
ac2ece 804                     that.inputValue = D;
5f1f90 805                     F = "";
X 806                     I = A.toParm.split(";");
807                     P = A.formParm.split(";");
808                     M = A.sField.split(";");
809                     N = A.dField.split(";");
810                     O = A.eFilter;
811                     D = D.replace(/'/g, "''");
ac2ece 812                     F = GT.threePop.setupParms(I, M, N, O, A.id, D + '', A.formParm, Trow, " like", false, true, true, true, that.Tgrid.Data.seInfo, null, null, A.refield, true);
5f1f90 813                     E = {};
X 814                     E.Url = "/gtGrid.do?m=suggest";
815                     E.Format = "JSON";
816                     E.Data = "_pop_json";
817                     E.isGt = 1;
818                     E.Method = "post";
819                     D = D == "" ? "''" : D;
ac2ece 820                     var tab = document.getElementById('T_' + that.Tformid + "_" + that.Trand + 'CDiv');
5f1f90 821                     var str = eval('(' + $(tab).attr("data") + ')');// json对象
X 822
ac2ece 823                     G = that;
5f1f90 824                     C = "{";
X 825                     C += "'formID':\"" + A.formid;
826                     C += "\",'where':\"" + F;
827                     C += "\",'parm':\"" + A.suggest;
ac2ece 828                     C += "\",'exp':\"" + that.prossParmer(str.exp.replace(/#/g, "'"), Trow);
5f1f90 829                     C += "\",'type':\"" + A.wtype;
X 830                     C += "\",'value':\"" + A.Name + ";" + D.replace("%", "@~").replace("%", "@~") + "\"}";
ac2ece 831                     that.Tgrid.AjaxCall(E, C, function (Q, R) {
5f1f90 832                         var S;
X 833                         var cdiv = document.getElementById('T_' + G.Tformid + "_" + G.Trand + 'CDiv');// 内容Div
ac2ece 834                         if (that.timer) clearInterval(that.timer);
5f1f90 835                         G.Tgrid.curTab = cdiv;
X 836                         G.removeRows(cdiv);
837                         if (R != "") {
838                             if (R.indexOf("error;") > -1) {
839                                 alert(R.split(";")[1]);
840                                 G.Tgrid.threePop(S, I, Trow, null, -1)
841                             } else {
842                                 // 设置格线需要的属性
843                                 cdiv.setAttribute("grid", "{index:" + G.Tgrid.Index + ",rowid:\"" + Trow.id + "\"}");
844                                 if (isTopFixed()) {
845                                     tp = elem.offsetParent.offsetTop + elem.offsetParent.offsetHeight;
846                                 }
847                                 G.popDiv(R, cdiv);
848                             }
849                         }
850                         G.isclose = false;
851                     });
a6a76f 852                 }
F 853             });
854         },
855         prossParmer: function (filter, row) {
856
857             var flg = false;
858             if (filter instanceof Array) {
859                 flg = true;
860                 filter = filter.join(";");
861             }// 因为有存在是数组的情况,转为字符串
862             if (filter != "" && filter.match(/&.*?&/)) {// 存在&...&的字段才需要查找
863                 var temp = filter.match(/&.*?&/g);
864                 for (var t = 0; t < temp.length; t++) {// 可能存在多个需要替换的字段
865                     var va = temp[t];
866                     var vas = va.toLowerCase().replace("&", "").replace("&", "");
867                     var flgs = false;
868
869                     var vt = document.getElementById(vas);
870                     if (vt) {// 只要存在有,则取里面的值,不然才需要找格线里面的值 by 2014-725
871                         // &&vt.value&&vt.value!=''&&vt.value!=='0'
872                         filter = filter.replace(new RegExp(va, "gm"), vt.value);
873                         flgs = true;
874                     }
875
876
877                     if (!flgs) {
878                         filter = filter.replace(va, row[vas]);
879                     }
880                 }
881             }
882             return filter;
883         },
884         getRowsHeight: function (rows) {
885             var height = 0;
886             for (var r = 0; r < rows.length; r++) {
887                 height += rows[r].offsetHeight;
888             }
889             return height;
890         },
891         popDiv: function (R, cdiv) {// 处理弹出列表,需要组装的代码,R为从后台读取返回的json数据
892             this.rowcount = 0;
893             var obj = eval('(' + R + ')');
894             if (obj.error != undefined) {
895                 alert(obj.error);
896                 return;
897             }
898             var str = "";
6c2b58 899             var datas=(obj.data!=null?obj.data:obj);//新版本的返回格式 xin 2021-4-24 14:22:47
X 900             if (datas.length > 0) {
964514 901                 for (var o = 0; o < datas.length; o++) {
X 902                     var ob = datas[o];
a6a76f 903                     if (ob["hasNexPage"] != undefined)
F 904                         this.addRow_withInsert2(cdiv);
905                     else
906                         this.addRow_withInsert(cdiv, ob);
907
908                 }
909             }
910             var pd = document.getElementById('T_' + this.Tformid + '_' + this.Trand + 'div');
911             // var myscroll=new
912             // IScroll('#T_'+Tformid+'div',{click:true,scrollbars:true});
913             if (this.Tgrid != null && this.Tgrid != undefined) {
914                 var gheight = this.Tgrid.MainTag.clientHeight + 40;
915                 // pd.style.height="300px";
916                 pd.style.overflow = "auto";
917                 if (cdiv.rows.length > 0) {// 有内容的情况
918                     if (tp + 280 > gheight && (gheight - tp < 280) && cdiv.rows.length > 0) {
919
920                         if (cdiv.rows.length * 30 < 300) {
921                             pd.style.overflow = "hidden";
922                             var h = this.getRowsHeight(cdiv.rows);
923                             pd.style.height = (h == 0 ? 500 : h) + "px";
924                         } else {
925
926                             var temp = tp;
927                             tp = tp - 280 - 20 - 20;
928                             if (tp < 0) tp = temp;
929                             pd.style.height = "300px";
930                         }
931                     }
932                 } else {// 没内容
933
934                     // pd.style.height="30px";
935                     pd.style.overflow = "hidden";
936                 }
937             }
938
939             pd.style.display = "block";
940             pd.style.left = lf + 'px';
941             pd.style.top = tp + 'px';
942             pd.style.position = this.positionss;
943             // pd.style.top=(isTopFixed()?(tp+70):tp)+'px';
944             // pd.style.position='fixed';
945 //                        pd.style.top=(tp+80)+'px';//+80是固定了头部,面板top属性+80,所以这里也要加 xin 2020-10-16 10:18:45
946             //  pd.style.background="#99BBE8";
947         },
948         removeRows: function (table) {
949             var rowCount = table.rows.length;
950             if (rowCount > 1) {
951
952                 for (var i = 1; i < rowCount; i++) {
953
954                     table.deleteRow(i);
955                     rowCount = rowCount - 1;
956                     i = i - 1;
957                 }
958
959             }
960         },
961         addRow_withInsert2: function (table) {
962             var row = table.insertRow(table.rows.length);
963             var cell = row.insertCell(0);
964             cell.innerHTML = "由于篇幅限制,部分搜索结果未予显示";
965             cell.colSpan = 50;
966             cell.align = "center";
967         },
968         addRow_withInsert: function (table, ob) {
969             var row = table.insertRow(table.rows.length);
970             row.onmouseover = (function () {
971                 return function () {
972                     this.style.backgroundColor = '#ffff66';
973                 }
974             })(row);
975
976
977             row.onmouseout = (function () {
978                 return function () {
979                     this.style.backgroundColor = '#d4e3e5';
980                 }
981             })(row);
982
983             var rowCount = table.rows.length;
984             var countCell = table.rows.item(0).cells.length;
985             var i = 0;
986             var str = eval('(' + $(table).attr("data").toLowerCase() + ')');// json对象
987             for (var item in ob) {
988                 if (item.indexOf("_expr") > 0) continue;
989                 var cell = row.insertCell(i);
990                 var vlu = ob[item] == 'null' ? "" : ob[item];
991                 if (ob[item + "_expr"] == 0) {
992                     vlu = "***";
993                     cell.hd = ob[item];
994                 }
995                 cell.innerHTML = vlu;
996                 cell.id = "_" + item;// 增加id前加_是为了区别参数替换时和其他重名而取错数
997                 if (str.data.indexOf(";" + item.toLowerCase() + ";") >= 0) {
998                     cell.style.display = "none";
999
1000                 }
1001                 cell.onclick = (function () {
1002                         return function () {
1003                             if (navigator.userAgent.match(/iPad|iPhone|Android/i)) {
1004                                 // 返回值给格线,暂时只支持返回一行
1005                                 var row = cell.parentElement;
1006                                 var js = eval('(' + $(table).attr("data").toLowerCase() + ')');
1007
1008                                 var fileds = js.form.split(";");
1009
1010                                 var ft = [];
1011                                 // 按需要返回的字段来生成对应的值,不然顺序乱就不对了
1012
1013                                 for (var r = 0; r < fileds.length; r++) {
1014                                     var flg = false;
1015                                     for (var v = 0; v < row.cells.length; v++) {
1016                                         var id = $(row.cells[v]).attr("id").toLowerCase();
1017                                         if ("_" + fileds[r] == id) {// 符合条件,取出来
1018                                             var txt = row.cells[v].innerText;
1019                                             if (typeof (row.cells[v].hd) != "undefined" && txt == "***") txt = row.cells[v].hd;
1020                                             ft.push(txt);
1021                                             flg = true;
1022                                             break;
1023                                         }
1024                                     }
1025                                     if (!flg) ft.push("");
1026                                 }
1027                                 if ($(table).attr("grid") != undefined) {// 格线
1028                                     var grid = eval('(' + $(table).attr("grid").toLowerCase() + ')');
1029                                     var gd = Grids[grid.index];
1030                                     // var row=gd.Rows[grid.rowid];//三点弹出的所在行
1031                                     // st,to,row,index,fl,c,flag,orgCol
1032                                     gd.threePop(ft, js.to.split(";"), Trow, null, -1, null, null, Tfield);
1033                                     gd.EndEdit(0);
1034                                     this.inputValue = "";
1035                                 } else {// 面板
1036                                     // TODO,这里增加面板的处理代码
1037                                     openValue42(ft, benzi.split(";"), true);
1038                                 }
1039                                 table.parentElement.style.display = "none";
1040                             }
1041                         }
1042                     }
1043                 )(cell);
1044                 cell.ondblclick = (function () {
1045                         return function () {
1046                             // 返回值给格线,暂时只支持返回一行
1047                             var row = cell.parentElement;
1048                             var js = eval('(' + $(table).attr("data").toLowerCase() + ')');
1049
1050                             var fileds = js.form.split(";");
1051
1052                             var ft = [];
1053                             // 按需要返回的字段来生成对应的值,不然顺序乱就不对了
1054
1055                             for (var r = 0; r < fileds.length; r++) {
1056                                 var flg = false;
1057                                 for (var v = 0; v < row.cells.length; v++) {
1058                                     var id = $(row.cells[v]).attr("id").toLowerCase();
b9e8fc 1059                                     if ("_" + fileds[r].trim() == id) {// 符合条件,取出来
a6a76f 1060                                         var txt = row.cells[v].innerHTML;// by danaus innerText会把值里中间的空格去掉一些;
F 1061                                         if (typeof (row.cells[v].hd) != "undefined" && txt == "***") txt = row.cells[v].hd;
1062                                         ft.push(txt);
1063                                         flg = true;
1064                                         break;
1065                                     }
1066                                 }
1067                                 if (!flg) ft.push("");
1068                             }
1069                             if ($(table).attr("grid") != undefined) {// 格线
1070                                 var grid = eval('(' + $(table).attr("grid").toLowerCase() + ')');
1071                                 var gd = Grids[grid.index];
1072                                 // var row=gd.Rows[grid.rowid];//三点弹出的所在行
1073                                 gd.threePop(ft, js.to.split(";"), Trow, null, -1, null, null, Tfield);
1074                                 gd.EndEdit(0);
1075                                 this.inputValue = "";
1076                             } else {// 面板
1077                                 // TODO,这里增加面板的处理代码
1078                                 openValue42(ft, benzi.split(";"), true);
1079                             }
1080                             table.parentElement.style.display = "none";
1081                         }
1082                     }
1083                 )(cell);
1084                 i++;
1085
1086             }
1087             this.rowcount++;
1088
1089         }
1090
1091     };
1092     return popdiv1;
1093 }
1094 function openValue42(st, get, boo) {
1095     if (st != undefined && st != null) {
1096         for (var n = 0; n < st.length; n++) {
1097             if (getDoc(get[n], "") == null) {
1098                 if (!navigator.userAgent.match(/iPad|iPhone|Android/i)) {
1099                     alert("返回字段设置" + get[n] + "在页面上没有!");
1100                 } else {
1101                     var getvalue = get[n];
1102                     $(document.getElementById(getvalue)).attr("value", st[n]);
1103                 }
1104             } else {
1105                 setDoc(get[n], ".value ='" + (st[n] == "undefined" ? "" : st[n]) + "'");
1106                 var panInfo = panMain[panIndex].panInfo;
1107                 if (panInfo != null && panInfo[get[n]] != undefined) {//特殊控件需要重新渲染 xin 2020-8-18 15:08:27
1108                     switch (panInfo[get[n]].controltype) {
1109                         case "43":
1110                             $("#" + get[n]).val(st[n]).trigger('change');
1111                             break;
1112                     }
1113                 }
1114                 if (st[n] != '') {//针对31级联
1115                     getSelect31(get[n]);
1116                 }
1117             }
1118         }
1119     }
1120
1121 }
1122
1123 var LayerObj = null;
1124
1125 //格线弹出上传附件页面
1126 function showLayerGrid_pic(url, obj) {
1127     LayerObj = createLayer_pic();//hotkey.js
1128     LayerObj.showLayer(url, obj);
1129 };
1130
1131 function createLayer_pic() {
1132     var lay = {
1133         layIndex: null,//弹出层引用ID
1134         _flg_: null,
1135
1136 //弹出层
1137         showLayer: function (str, flg) {
1138             this._flg_ = flg;
1139             this.layIndex = layer.open({
1140                 type: 2,
1141                 title: false,
1142                 maxmin: false,
1143                 _flg_: flg,
1144                 shift: 1,
1145                 shadeClose: true, //点击遮罩关闭层
1146                 area: ['800px', '460px'],
631e91 1147                 success:function(){
X 1148                     $('.layui-layer-iframe').find('iframe').contents().find('#scroller').css('overflow-x','hidden');
1149                 },
a6a76f 1150                 content: str       //'/app/67/0/cnzh/110502/1/index.jsp'
F 1151             });
1152         },
1153         close: function () {
1154             layer.close(this.layIndex);
1155
1156             if (this._flg_ == 2)
1157                 mygrid.ReloadBody();
1158             else
1159                 location.reload();
1160
1161         }
1162     };
1163     return lay;
1164 }
1165
1166 function showLayerGrid(url, ref, width, height) {
1167     LayerObj = createLayer();//hotkey.js
1168     LayerObj.showLayer(url, ref, width, height);
1169 };
1170
1171 function createLayer() {
1172     var lay = {
1173         layIndex: null,//弹出层引用ID
1174         _flg_: null,
1175 //弹出层
1176         showLayer: function (str, flg, width, height) {
1177             this._flg_ = flg;
c6add6 1178             if(flg==-1 && str.indexOf("warehousing")!=-1){//是序列号扫码界面 xin 2021-8-3 10:17:22
X 1179                 openNewLayui.openWin(str);
1180                 return;
1181             }
a6a76f 1182             this.layIndex = layer.open({
F 1183                 type: 2,
1184                 title: false,
1185                 maxmin: false,
1186                 _flg_: flg,
1187                 shift: 1,
1188                 shadeClose: true, //点击遮罩关闭层
1189                 area: [width || '800px', height || '460px'],
1190                 content: str,      //'/app/67/0/cnzh/110502/1/index.jsp'
1191                 end: function () {
1192                     closeLoading();
631e91 1193                 },
X 1194                 success:function(){
1195                     $('.layui-layer-iframe').find('iframe').contents().find('#scroller').css('overflow-x','hidden');
a6a76f 1196                 }
F 1197             });
1198         },
1199         close: function () {
1200             layer.close(this.layIndex);
aa6c24 1201                 //by danaus 2021/4/8 14:45
e39212 1202                 if(this._flg_ == 2) {
F 1203                     if (mygrid)
1204                         mygrid.ReloadBody();
d9fba9 1205                 }else if(this._flg_ == -1){
F 1206                     //表示是序列号扫码入库调用,不需要刷新页面
e39212 1207                 }else {
F 1208                     if (location)
1209                         location.reload();
1210                 }
f2bd64 1211
a6a76f 1212
F 1213         }
1214     };
1215     return lay;
1216 }
1217
92b189 1218 function codeScanning(state,formid,formtype,type){
0279b8 1219     var url = "/general/SerialNumber/" + (type == "out" ? "deliveryPage.jsp?" : "warehousing.jsp?");
1ed342 1220     var parm = "formid=" + formid + "&formtype=" + formtype + "&doccode=" + getDoc("doccode", ".value");
c6add6 1221     var isEdit = false;
X 1222     if (state != null) {
0279b8 1223         var docstatePan = getDoc("docstatus", ".value");
c6add6 1224         if (state.indexOf(";") != -1) {
X 1225             isEdit = ($.inArray(docstatePan, state.split(";")) != -1 ? true : isEdit);
1226         }
0279b8 1227         if (state == "" || docstatePan == state) {
c6add6 1228             isEdit = true;
X 1229         }
0279b8 1230         if (docstatePan == '100') {//确定单不可编辑
X 1231             isEdit = false;
1232         }
c6add6 1233     }
0279b8 1234     url += encodeText(parm + "&isEdit=" + isEdit);
X 1235     openNewLayui.openWin(url);
c6add6 1236 }
X 1237 var openNewLayui={
92b189 1238     layer: (typeof (layui) != 'undefined' ? layui.layer : null),
0279b8 1239     openWin: function (url) {
62e7e7 1240         var that=this;
c6add6 1241         this.layer.open({
X 1242             type: 2,
92b189 1243             area: ['800px', '550px'],
c6add6 1244             title: false,
X 1245             content: url,
62e7e7 1246             cancel: function (index,layero) {
X 1247                 var envt = $(layero).find("iframe")[0].contentWindow;
1248                 if (envt != null) {
1249                     if(envt.isChang){
1250                         if(confirm("界面有修改,是否执行扫完了再关闭?")){
98b20c 1251                             that.setGrid(envt.vm.okSubmit(),true);
62e7e7 1252                         }else{
X 1253                             layer.close(index);
c6add6 1254                         }
62e7e7 1255                     }else{
X 1256                         layer.close(index);
c6add6 1257                     }
X 1258                 }
1259             }
1260         });
62e7e7 1261     },
98b20c 1262     setGrid:function(value,isSave){
62e7e7 1263         // var envt = $(layero).find("iframe")[0].contentWindow;
X 1264         if (value != null) {
1265             // var value = envt.vm.okSubmit();
1266             if (Grids != null && value != null) {
1267                 var gr = Grids[value.T_id];
1268                 gr.EndEdit(true);
1269                 var rowids = value.rowids;
1270                 for (var r in rowids) {
1271                     gr.setSerialNumber("serialnumbers", (rowids[r] != "" ? rowids[r].join(";") : ""), r);
1272                 }
98b20c 1273                 if(isSave){//有改动过是需要保存
X 1274                     //处理保存自动执行事件
1275                     $("#tpSave").trigger("click");
1276                     // save(2);//执行保存
1277                 }
62e7e7 1278             }
X 1279         }
1280         layer.closeAll();
c6add6 1281     }
X 1282 }
a6a76f 1283 //38类型用到的弹出窗体
F 1284 var LayerObjs = null;
1285
1286 function showLayerGrids(url, ref) {
1287     LayerObjs = createLayers();//hotkey.js
1288     LayerObjs.showLayer(url, ref);
1289 };
1290
1291 function createLayers() {
1292     var lay = {
1293         layIndex: null,//弹出层引用ID
1294         _flg_: null,
1295 //弹出层
1296         showLayer: function (str, flg) {
1297             this._flg_ = flg;
1298             this.layIndex = layer.open({
1299                 type: 2,
1300                 title: false,
1301                 maxmin: false,
1302                 _flg_: flg,
1303                 shift: 1,
1304                 shadeClose: true, //点击遮罩关闭层
1305                 area: ['540px', '425px'],
631e91 1306                 success:function(){
X 1307                     $('.layui-layer-iframe').find('iframe').contents().find('#scroller').css('overflow-x','hidden');
1308                 },
a6a76f 1309                 content: str       //'/app/67/0/cnzh/110502/1/index.jsp'
F 1310             });
1311         },
1312         close: function () {
1313             layer.close(this.layIndex);
1314             if (this._flg_ == 2)
f2bd64 1315                 mygrid.ReloadBody();//刷新表休
a6a76f 1316             else
f2bd64 1317                 location.reload();//刷新整个页面
a6a76f 1318
F 1319         }
1320     };
1321     return lay;
1322 }
1323
1324 //38类型的小弹窗
1325 var LayerObjsi = null;
1326
1327 function showLayerGridsi(url, ref) {
1328     LayerObjsi = createLayersi();//hotkey.js
1329     LayerObjsi.showLayer(url, ref);
1330 };
1331
1332 function createLayersi() {
1333     var lay = {
1334         layIndex: null,//弹出层引用ID
1335         _flg_: null,
1336 //弹出层
1337         showLayer: function (str, flg) {
1338             this._flg_ = flg;
1339             this.layIndex = layer.open({
1340                 type: 2,
1341                 title: false,
1342                 maxmin: false,
1343                 _flg_: flg,
1344                 shift: 1,
1345                 shadeClose: true, //点击遮罩关闭层
1346                 area: ['300px', '150px'],
631e91 1347                 success:function(){
X 1348                     $('.layui-layer-iframe').find('iframe').contents().find('#scroller').css('overflow-x','hidden');
1349                 },
a6a76f 1350                 content: str       //'/app/67/0/cnzh/110502/1/index.jsp'
F 1351             });
1352         },
1353         close: function () {
1354             layer.close(this.layIndex);
1355             if (this._flg_ == 2)
1356                 mygrid.ReloadBody();
1357             else
1358                 location.reload();
1359
1360         }
1361     };
1362     return lay;
1363 }
987e16 1364 function delemptyrefdata() {
X 1365    return;
1366 }
a6a76f 1367 //解决格线高度问题
F 1368 function gridHeight() {
1369     try {
1370         var panelHeight = (top.panelHeight == 0 ? document.documentElement.clientHeight : top.panelHeight);// 获取页面的总高度
1371         var panelType = top.myFresh.panel[top.tabindex];// 获取面板的类型
1372         if (';2;3;4;20;30;301;302;303;304;'.indexOf(';' + panelType + ';') != -1) {// 有树形的特殊窗体处理
1373             if (gridId.length == 0) return;
1374             var panelWidth = document.documentElement.clientWidth;
1375             var treeWidth = $('#wrappers').outerWidth(true);// 树形的宽度
1376             var treeHeight = $('#tplt-panels').outerHeight(true);// 树形的高度
c2dc59 1377             $('#' + gridId[0]).css('height', (treeHeight - 30 - 20) + 'px');// 减去30是因为margin和padding的值
a6a76f 1378             $('#' + gridId[0]).css('width', (panelWidth - treeWidth - 30) + 'px');
F 1379             return;
1380         }
1381         if (';1;9;10;15;17;18;497;499;'.indexOf(';' + panelType + ';') != -1 && typeof (formId) != 'undefined') {// 清单列表页面
1382             var topPanelHeight = $('#top_table').outerHeight(true);
1383             if (topPanelHeight == null) {// 没有标题的高度
d6f308 1384                 topPanelHeight = $('#tplt-top').outerHeight(true)+10;
a6a76f 1385             }
c2dc59 1386             panelHeight = panelHeight - 20;//文字颜色说明占了20高
a6a76f 1387             if (panelType == 1) {
F 1388                 $('#' + gridId[0]).css('height', (panelHeight - topPanelHeight - 50) + 'px');// 减去50是因为margin和padding的值
1389                 return;
1390             }
1391             if (panelType == 10 || panelType == 18) {
f0690b 1392                 panelHeight = panelHeight - 8;//文字颜色说明占了8高
a6a76f 1393                 var panelTable0Height = $('#panelTable0').outerHeight(true);
ac6f6a 1394                 $('#' + gridId[0]).css('margin-bottom','0').css('margin-top','0');
X 1395                 $('#' + gridId[0]).css('height', (panelHeight - topPanelHeight - panelTable0Height) + 5 + 'px');// 减去25是因为margin和padding的值
a6a76f 1396                 return;
F 1397             }
1398             var panelFormIdHeight = $('#panel_' + formId).outerHeight(true);
d2ec46 1399             if(panelFormIdHeight==null){
X 1400                 panelFormIdHeight = $('.main_talbe').outerHeight(true);
1401             }
ac6f6a 1402             $('#' + gridId[0]).css('height', (panelHeight - topPanelHeight - panelFormIdHeight - 10) + 'px');// 减去50是因为margin和padding的值
a6a76f 1403             return;
F 1404         }
1405         return;
1406     } catch (e) {
1407         //$.messager.alert("操作提示","获取格线高度出现了错误!"+e,"warning");
1408     }
1409 }
1410
1411 function isTopFixed() {
1412     var bol = false;
0279b8 1413     if (top.myFresh!=null && ";5;8;16;496;".indexOf(";" + top.myFresh.panel[top.tabindex] + ";") != -1) {
a6a76f 1414         bol = true;
F 1415     }
1416     return bol;
1417 }
5f1f90 1418 //处理42控件显示层的数据加载 xin 2021-3-23 11:11:03
X 1419 var control42DivData = {
1420     table42: null
1421     , Env42table: {}
1422     , Collection: {}//属性
1423     , timer: null//时间
379d49 1424     ,inputValue:null
5f1f90 1425     , ShowDivForPanel: function (elem, Info, rod) {//面板数据加载
64c018 1426         var Cid = 'panel_table_' + rod;
5f1f90 1427         if (this.Collection[Cid] == null) {//第一次时进入
X 1428             this.getPanelParam(elem, Info, rod, Cid);//获取通用属性
1429         }
fc3567 1430         // var scrollTop = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop;
X 1431         this.Collection[Cid].top = elem.offsetTop + 26;//elem.offsetParent.offsetParent.offsetTop + elem.offsetParent.offsetTop + 28 - scrollTop;// 42控件div的top控制
1432         this.Collection[Cid].left = elem.offsetLeft;//elem.offsetParent.offsetParent.offsetLeft + elem.offsetParent.offsetLeft + 118;// 42类型div的left控制
5f1f90 1433         //组装条件
X 1434         this.getPanelWhere(Info.seekgroupid.toLowerCase(), Info.fk.toLowerCase(), '', ' and ', elem.id, true, this.Collection[Cid]);
1435         //执行渲染
1436         this.render(this.Collection[Cid]);
1437     }
1438     , ShowDivForGrid: function (tg, elem, col,callback) {//格线数据加载
64c018 1439         var Cid = 'grid_table_' + col.rand;
900851 1440         var value="";
F 1441         try {
1442              value = tg.Edit.Tag.value + "";
1443             if (value == '' || this.inputValue == value) {
1444                 return;
1445             }
1446         }catch (e){}
379d49 1447         this.inputValue=value;
X 1448         value = value.replace(/'/g, "''");
1449         value = value == "" ? "''" : value;
5f1f90 1450         if (this.Collection[Cid] == null) {//第一次时进入
X 1451             this.getGrideParam(tg, elem, col, Cid,callback);//获取通用属性
1452         }
1517e0 1453         if (this.Collection[Cid].isOld){
53a8b1 1454             this.Collection[Cid]=null;
1517e0 1455             return;
X 1456         }
5f1f90 1457         //获取scroll的top位置,弹出层需要减去这个高度,避免位置出现偏差 by danaus 2020/11/7 17:23
X 1458         var scrollTop = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop;
1459         this.Collection[Cid].top = elem.offsetParent.offsetTop + elem.offsetParent.offsetHeight - scrollTop;
1460         this.Collection[Cid].left = elem.offsetParent.offsetLeft;
1461         if (this.isTopFixed()) {
1462             this.Collection[Cid].top = elem.offsetParent.offsetTop + elem.offsetParent.offsetHeight;
1463         }
1464         this.Collection[Cid]._pop_json.value = col.Name + ";" + value.replace("%", "@~").replace("%", "@~");
1465         I = col.toParm.split(";");
1466         P = col.formParm.split(";");
1467         M = col.sField.split(";");
1468         N = col.dField.split(";");
1469         O = col.eFilter;
1470         this.Collection[Cid]._pop_json.where = GT.threePop.setupParms(I, M, N, O, col.id, value + '',
1471             col.formParm, GT.rowIDp, " like", false, true, true, true, tg.Data.seInfo, null, null, col.refield, true);
1472         this.Collection[Cid].wheres._pop_json = JSON.stringify(this.Collection[Cid]._pop_json);
1473         this.Collection[Cid].gridIndex = tg.Index;
1474         this.Collection[Cid].rowid = GT.rowIDp.id;
1475         this.render(this.Collection[Cid]);//执行渲染
1476     }
1477     , getPanelParam: function (elem, Info, rod, Cid) {//面板需要到的属性
1478         var list = {};
1479         list.type = 0;
1480         list.fieldid = elem.id;
1481         this.getDefault(list, Info.ft, rod);
1482         list.url = '/panelControlData42.do';
1483         list.relation = $(elem).data('relation').toLowerCase();//查询条件的字段
1484         //条件
1485         list.wheres = {};
1486         list.wheres.sugg = $(elem).data('sugges').toLowerCase();//后台查询需要到的字段名
1487         if (list.wheres.sugg == '') {
1488             list.wheres.sugg = Info.fk;
1489         }
76a592 1490         list.fk=Info.fk.toLowerCase().split(';');
X 1491         list.seekgroupid=Info.seekgroupid.toLowerCase().split(';');
5f1f90 1492         list._pop_json={};
X 1493         list.parm=list.wheres.sugg.split(';');
1494         list.wheres.ft = Info.ft;
1495         this.Collection[Cid] = list;
1496     }
1497     , getGrideParam: function (tg, elem, col, Cid,callback) {//格线需要到的属性
1498         var list = {};
1499         list.type = 1;
1517e0 1500         list.isOld=false;
5f1f90 1501         this.getDefault(list, col.formid, col.rand,callback);
1517e0 1502         if (list.isOld){
X 1503             this.Collection[Cid] = list;
1504             return;
1505         }
5f1f90 1506         tg.curTab=list.div42;//关联到关闭层(在旧方法引用)
X 1507         list.url = '/gtGrid.do?m=suggest';
1508         list.Tfield = col.Name;
1509         //条件
1510         list.wheres = {};
1511         list._pop_json = {};
1512         list._pop_json.formID = col.formid;
1513         list._pop_json.parm = col.suggest;
1514         list._pop_json.type = col.wtype;
1515         var str = eval('(' + $('#' + list.id).data("datas") + ')');// json对象
1516         list._pop_json.exp = this.prossParmer(str.exp.replace(/#/g, "'"), GT.rowIDp);
1517         list.formfileds = str.form.split(';');
1518         list.to=str.to.split(';');
1519         list.data=str.data.split(';');
1520         list.parm = col.suggest.split(';');
1521         this.Collection[Cid] = list;
1522     }
1523     , getDefault: function (list, F, R,callback) {//通用默认属性
1524         list.id = 'T_' + F + '_' + R + 'CDiv';
1525         list.div42 = $('#T_' + F + '_' + R + 'div');
1526         list.width = 820;//默认
1527         list.array = [];
1528         var array = $('#' + list.id).data('title');//显示的字段名
1529         if (typeof  array == 'undefined'){//不是最新生成的界面
1517e0 1530              list.isOld=true;
X 1531              callback(false);
1532         }else{
4e6234 1533             if (array != null && array.length>0) {
1517e0 1534                 array = eval('(' + array + ')');
X 1535                 list.array=array;
1536             } else {
dc47b2 1537                 $.messager.alert("提示", "获取不到显示标题列!请检查有没有设置了表号或有没有设置了显示字段名", "warning");
1517e0 1538                 return;
X 1539             }
5f1f90 1540         }
X 1541     }
1542     , prossParmer: function (filter, row) {
1543         var flg = false;
1544         if (filter instanceof Array) {
1545             flg = true;
1546             filter = filter.join(";");
1547         }// 因为有存在是数组的情况,转为字符串
1548         if (filter != "" && filter.match(/&.*?&/)) {// 存在&...&的字段才需要查找
1549             var temp = filter.match(/&.*?&/g);
1550             for (var t = 0; t < temp.length; t++) {// 可能存在多个需要替换的字段
1551                 var va = temp[t];
1552                 var vas = va.toLowerCase().replace("&", "").replace("&", "");
1553                 var flgs = false;
1554                 var vt = document.getElementById(vas);
1555                 if (vt) {// 只要存在有,则取里面的值,不然才需要找格线里面的值 by 2014-725
1556                     // &&vt.value&&vt.value!=''&&vt.value!=='0'
1557                     filter = filter.replace(new RegExp(va, "gm"), vt.value);
1558                     flgs = true;
1559                 }
1560                 if (!flgs) {
1561                     filter = filter.replace(va, row[vas]);
1562                 }
1563             }
1564         }
1565         return filter;
1566     }
1567     , getPanelWhere: function (ben, wai, zi, addFuHao, id, qianzhi, CEnvt) {
1568         // openTree = true;
1569         var bens = ben.split(";");
1570         var wais = wai.split(";");
1571         var glian = CEnvt.relation.split(";");
1572         var where = "";
1573         var col = "";
1574         var value = "";
1575         var gl = "";
1576         var efilter = '';
1577         for (var ef in panMain) {
1578             if (typeof (panMain[ef].panInfo[id]) != "undefined") {
1579                 if (panMain[ef].panInfo[id].efilter != "") {
1580                     efilter += panMain[ef].panInfo[id].efilter;
1581                 }
1582             }
1583         }
1584         for (i = 0; i < bens.length; i++) {
1585             col = bens[i].toLowerCase();
1586             if (col.Trim() != "") {
1587                 value = getDoc(col, ".value");
1588                 // 针对 300029 资金帐户
1589                 if (value == null) {
1590                     value = "";
1591                 }
1592                 if (qianzhi) { // 强制判断
1593                     if (value != "") {
1594                         if (value.indexOf("'") != -1) {
1595                             value = value.replace(new RegExp("'", "g"), "''");
1596                         }
1597                         where += wais[i] + " like '" + "@~" + value + "@~'"
1598                             + addFuHao;// and
1599                     }
1600                 }
1601             }
1602         }
1603         if (CEnvt.relation != "") {
1604             value = getDoc(id, ".value");
1605             if (value.indexOf("'") != -1) {
1606                 value = value.replace(new RegExp("'", "g"), "''");
1607             }
1608             for (var g = 0; g < glian.length; g++) {
1609                 col = glian[g].toLowerCase();
1610                 if (col.Trim() != "") {
1611                     gl += col + " like '" + "@~" + value + "@~'" + " or ";
1612                 }
1613             }
1614             gl = gl.substring(0, gl.length - 3);
1615             gl = " or (" + gl + ")";
1616         }
1617         if (zi.Trim() != "") {
1618             where += zi + addFuHao;// 追加自定义条件
1619         }
1620         where = where.substring(0, where.length - addFuHao.length);
1621         //where为空值的情况,让他在()里面成立。解决查询sql报错问题
1622         where = (efilter == "" ? "" : "(") + "(" + (where == "" ? "1=1" : where) + ")" + gl + (efilter == "" ? "" : ") and (" + efilter + ")");
1623         CEnvt.wheres.where = encodeURI(replacePageValue(where));
1624     }
1625     , render: function (list) {//渲染数据
1626         var that=this;
53a8b1 1627         var cols=this.handle(list.array,list.parm);//这里处理权限和隐藏特殊设置的每一列字段值信息
5f1f90 1628         if (this.Env42table[list.id] == null) {
X 1629             this.Env42table[list.id] = this.table42.render({//渲染
1630                 elem: '#' + list.id //层id名
1631                 , url: list.url //请求路径
1632                 , where: list.wheres //条件
1633                 , title: '数据信息'
1634                 , height: 320 //高度
aacaa1 1635                 , width: (cols.length>5?900:((160*(cols.length))<590?590:(160*(cols.length)))) //列数超过7列时给一个固定值。
dc47b2 1636                 , cellMinWidth:150 //全局定义所有常规单元格的最小宽度(默认:60),一般用于列宽自动分配的情况。其优先级低于表头参数中的 minWidth
5f1f90 1637                 , size: 'sm'
X 1638                 , cols: [cols]//标题数组
1639                 , page: true
1640                 , limit: 20 //默认每页显示20条数据
1641                 , page: {
1642                     groups: 5 //连续出现的页码个数
1643                 }
1644                 , parseData: function (res) { //res 即为原始返回的数据
1645                     if (res == null || res.msg != null) {
1646                         console.log("获取数据失败!" + (res.msg != null ? res.msg : ''));
92cfac 1647                         layer.msg(res.msg);
5f1f90 1648                         return {
X 1649                             "code": 0,//res.status, //解析接口状态
1650                             "msg": '',//res.message, //解析提示文本
1651                             "count": 0,//res.total, //解析数据长度
1652                             "data": '',//.data.item //解析数据列表
1653                         };
1654                     }
1655                     if (res instanceof Array) {
1656                         return {
1657                             "code": 0,//res.status, //解析接口状态
1658                             "msg": '',//res.message, //解析提示文本
1659                             "count": res.length,//res.total, //解析数据长度
1660                             "data": res,//.data.item //解析数据列表
1661                         };
1662                     }
1663                     return {
1664                         "code": 0,//res.status, //解析接口状态
1665                         "msg": '',//res.message, //解析提示文本
1666                         "count": res.count,//res.total, //解析数据长度
1667                         "data": res.data,//.data.item //解析数据列表
1668                     };
1669                 }
1670                 , done: function (res, curr, count) {//数据渲染完的回调
1671                     list.div42.css('top', list.top);
1672                     list.div42.css('left', list.left);
1673                     list.div42.css('background', 'white');
1674                     $('.layui-table-view').css('marginTop', 0);
1675                     $('.layui-table-view').css('marginBottom', 0);
8bda92 1676                     that.div42Height(list);
5f1f90 1677                     list.div42.show();
X 1678                     //手机或平板模式下触发
1679                     if (navigator.userAgent.match(/iPad|iPhone|Android/i)) {
1680                         list.div42.find('.layui-table-body').find("table").find("tbody").children("tr").on('dblclick', function () {
1681                             var id = JSON.stringify(list.div42.find('.layui-table-body').find("table").find("tbody").find(".layui-table-hover").data('index'));
1682                             var obj = res.data[id];
1683                             that.SetValueData(list, obj);
1684                         })
1685                     }
92cfac 1686                 },error:function (r) {
X 1687                     console.log(r);
1688                     // layer.msg(r);
5f1f90 1689                 }
X 1690             });
1691             this.table42.on('rowDouble(' + list.id + ')', function (obj) {//行双击事件。(手机或平板模式下失效)
1692                 that.SetValueData(list,obj.data);
1693             });
1694             $('input').click(function () {
1695                 if (!list.div42.is(":hidden") && list.fieldid != this.id){
1696                     list.div42.hide();
1697                 }
1698             })
1699         } else {
1700             //执行重载
1701             this.Env42table[list.id].reload({
53a8b1 1702                  cols: [cols]//标题数组
X 1703                 ,page: {
5f1f90 1704                     curr: 1 //重新从第 1 页开始
X 1705                 }
1706                 , where: list.wheres //条件
1707             }, 'data');
1708         }
1709     }
8bda92 1710     ,div42Height:function(list){//出现面板高度太低的情况,强行把面板高度提高
15af7d 1711         if ($("#tplt-grid").height() == null && list.type==0 && $(".istabs").height()==null) {//是面板上的控件执行才进入
8bda92 1712             var panelControlH = $('.panelControlDiv')[0];
X 1713             if (panelControlH != null && $(panelControlH).height() < 400) {
1714                 $(panelControlH).height(list.div42.height() + list.top);
1715             }
1716         }
1717     }
5f1f90 1718     ,handle:function (array,parm) {//处理
X 1719         var i=0;
1720         var index=-1;
1721         for (var p in array){//遍历标题列,添加多一个templet属性,当加载数据回来填充时回调这个属性执行下面的方法并返回一个参数值d
1722             array[p].templet=function (d) {//d返回的是每一行的数据信息.
1723                 if (index!=d.LAY_TABLE_INDEX){//LAY_TABLE_INDEX属性值为执行到的行数,
1724                     index=d.LAY_TABLE_INDEX;
1725                     i=0;
1726                 }
1727                 var id=parm[i];
1728                 i++;
1729                 if (d[id + '_expr'] == 0) {//权限控制隐藏
1730                     return "***";
1731                 }
1732                 return d[id]!=null?d[id]:'';
1733             };
1734         }
1735         return array;
1736     }
1737     ,SetValueData: function (list, data) {//赋值
1738         if (list.type == 0) {//面板
76a592 1739             var fk = list.fk;
6c911f 1740             var p=panMain[panIndex];
76a592 1741             for (var i = 0; i < fk.length; i++) {//赋值给页面
X 1742                 if (typeof data[fk[i]] != 'undefined') {
6c911f 1743                     var v = (data[fk[i]] == null ? "" : data[fk[i]]);
X 1744                     setDoc(list.seekgroupid[i], ".value='" + v + "'");
1745                     if (p.select[list.seekgroupid[i]] != null) {//有级联到31控件的字段需要加载 xin 2021-5-10 14:55:33
688a84 1746                         getSelect31(list.seekgroupid[i]);
6c911f 1747                     }
X 1748                     if (p.panInfo[list.seekgroupid[i]] != null && p.panInfo[list.seekgroupid[i]].controltype == 43) {//是43控件
1749                         $("#" + list.seekgroupid[i]).val(v).trigger('change');
688a84 1750                     }
76a592 1751                 }
5f1f90 1752             }
X 1753         } else if (list.type == 1) {//格线
76a592 1754             var fileds = list.formfileds;
X 1755             var V = [];
5f1f90 1756             for (var r = 0; r < fileds.length; r++) {
76a592 1757                 if (typeof data[fileds[r]] != 'undefined') {
X 1758                     V.push((data[fileds[r]] != null ? data[fileds[r]] : ''));
1759                 } else {
1760                     V.push('');
1761                 }
5f1f90 1762             }
X 1763             if (list.gridIndex != null) {
1764                 var gd = Grids[list.gridIndex];
1765                 // var row=gd.Rows[list.rowid];//三点弹出的所在行
1766                 gd.threePop(V, list.to, GT.rowIDp, null, -1, null, null, list.Tfield);//赋值给页面
1767                 gd.EndEdit(0);
987e16 1768                 this.inputValue = "";
5f1f90 1769             }
X 1770         }
1771         list.div42.hide();//隐藏
1772     }
1773     , isTopFixed: function () {
1774         var bol = false;
1775         if (";5;8;16;496;".indexOf(";" + top.myFresh.panel[top.tabindex] + ";") != -1) {
1776             bol = true;
1777         }
1778         return bol;
1779     }
1780     ,divClose:function (Envt,callback) {//关闭
1517e0 1781         if (Envt[0]==null || Envt[0].id.indexOf('CDiv')>0){//旧版本调用的属性id
5f1f90 1782             return callback(false);
1517e0 1783         }else{
X 1784             this.inputValue="";
1785             $(Envt).hide();
5f1f90 1786         }
X 1787     }
1788     , loading: function () {//加载42控件
1789         if (typeof layui != 'undefined') {
1790             this.table42 = layui.table;
1791             this.isControl42();
1792         } else {
631e91 1793             var that=this;
5f1f90 1794             $("<link>").attr({
X 1795                 rel: "stylesheet",
1796                 type: "text/css",
1797                 href: "/layui/css/layui.css"
1798             }).appendTo("head");
1799             $.getScript('/layui/layui.all.js', function () {
631e91 1800                 if (typeof layui == 'undefined') {
5f1f90 1801                     console.log('获取42控件插件层失败!');
X 1802                     return null;
1803                 }
631e91 1804                 that.table42 = layui.table;
X 1805                 that.isControl42();
5f1f90 1806             })
X 1807         }
1808     }
1809     , isControl42: function () {
1810         var get = this;
1811         //页面42控件的keyup事件(面板调用)
1812         $('.isControl42').on('keyup', function () {
83611a 1813             if (this.readOnly || this.disabled){//只读
X 1814                 return;
1815             }
5f1f90 1816             clearTimeout(get.timer);
X 1817             var elem = this;
1818             var rod = $(elem).data('rod');
1819             var index = $(elem).data('index');
1820             var panInfo = panMain[index].panInfo;
1821             if (panInfo == null) {
1822                 console.log("获取不到面板panInfo属性信息");
1823                 return;
1824             }
1825             if (elem.value == '') {//空值情况
1826                 var empty = panInfo[elem.id].emptyrefdata.toLowerCase();//清空关联字段
1827                 empty = empty.split(';');
1828                 for (var e = 0; e < empty.length; e++) {
0ff2cb 1829                     if (panInfo[empty[e]]!=null && panInfo[empty[e]].controltype == 43) {//43控件清空
6c911f 1830                         $("#" + empty[e]).val('').trigger('change');
X 1831                         continue;
1832                     }
5f1f90 1833                     setDoc(empty[e], ".value=''");//清空
X 1834                 }
1835                 $('#T_' + panInfo[elem.id].ft + '_' +rod + 'div').hide();//隐藏
1836                 return;
1837             }
1838             get.timer = setTimeout(function () {
1839                 get.ShowDivForPanel(elem, panInfo[elem.id], rod);
31cb41 1840             }, 1000);
5f1f90 1841         });
X 1842     }
1843 };
0279b8 1844 //执行收款显示二维码或退款
366271 1845 function OpenPayAndRefund(doccode,type,formid){
0279b8 1846         if(type=="pay"){//显示二维码
e72c74 1847             let doc=doccode;
X 1848             var url = "/general/onlinePayment/payment.jsp?orderNo=" + doc+"&formId="+formid;
0279b8 1849             layui.layer.open({
X 1850                 type: 2,
1851                 area: ['700px', '500px'],
1852                 title: false,
1853                 content: url,
1854                 cancel: function (index, layero) {
1855                     var envt = $(layero).find("iframe")[0].contentWindow;
1856                     if (envt != null) {
1857                         if (!envt.isChang) {
1858                             if (!confirm("还没有支付,确定关闭吗?")) {
1859                                 return false;
c356d4 1860                             }
c6abc2 1861                         }
0279b8 1862                         if (envt.ws != null) {
X 1863                             envt.ws.close();
1864                         }
c6abc2 1865                     }
0279b8 1866                     layer.closeAll();
e72c74 1867                     getReductionURL(doc);
0279b8 1868                 }
X 1869             });
366271 1870         }else{//确定
F 1871             $.ajax({
1872                 url: "/gtGrid.do?m=newTran&formid="+formid+"&docCode="+doccode,
1873                 type: "get",
1874                 async: false,
1875                 success: function (res) {
1876                     if(res.state==-1) {
6aa76e 1877                         layer.alert(res.msg,function (){location.reload();});
d75ad0 1878                     }else{
F 1879                         location.reload();
0279b8 1880                     }
366271 1881                 }, error: function (e, h, a) {
6aa76e 1882                     layer.alert(e.responseText,function (){location.reload();} );
0279b8 1883                 }
366271 1884             });
c6abc2 1885     }
X 1886 }
0279b8 1887 //针对收款二维码界面关闭的处理 xin 2021-9-8 10:09:33
e72c74 1888 function getReductionURL(doc){
X 1889     var url = location.search;
1890     var parm = Base64().decode(url.substring(1, url.length));
1891     if (parm.indexOf("&onlinePay=1") != -1) {
1892         parm = parm.replace("&onlinePay=1", "");
1893         parm = "?" + encodeText(parm);
1894         location.replace(location.href.split("?")[0] + parm);
1895     } else {
1896         if (doc != null) {
1897             let docUrl = '?' + encodeText('doccode=' + doc);
1898             location.replace(location.href.split("?")[0]  + docUrl);
1899         } else {
1900             location.reload();
1901         }
0279b8 1902     }
X 1903     layer.closeAll();
1904 }
07beec 1905 //批量上传物料主数据主图片 xin 2021-9-17 09:51:37
X 1906 function Batchupload(){
1907     var url="/general/batchUpload/uploadIndex.jsp";
1908     layui.layer.open({
1909         type: 2,
1910         area: ['850px', '500px'],
1911         title: false,
1912         content: url,
1913         cancel: function (index, layero) {
1914             layer.closeAll();
1915         }
1916     });
1917 }
e72c74 1918
5b18c2 1919 function progressBar(e,value){
X 1920     top.$(e).jQMeter({
1921         goal: '100',
1922         raised: value+'',
1923         height: '24px',
1924         barColor:'#6699cc',
1925         bgColor: '#CCC'
1926     });
1927 }
a6a76f 1928 $(function () {
F 1929     //单据窗体头部固定 xin 2020-10-26 17:23:58
1930     if (isTopFixed()) {
1931         $("#top_table").addClass("topTable");
5f1f90 1932         if ($("#tool").height() > 40) {//头部按钮过多导致tool高度变高的时候。
a6a76f 1933             $("#scroller").addClass("tpltPanelsss");
F 1934             $("body").addClass("bodyScrollss");//设置滚动条样式
5f1f90 1935         } else {
a6a76f 1936             $("#scroller").addClass("tpltPanels");
F 1937             $("body").addClass("bodyScroll");//设置滚动条样式
1938         }
1939     }
5f1f90 1940     //------下面的是关于42控件的处理------
X 1941     control42DivData.loading();
1942     //---end---关于42控件的处理结束------
5b18c2 1943
X 1944     //---------47控件类型加载---------- xin 2022-4-27 10:58:12
1945     $(".progressBar47").each(function () {
1946         let id = $(this).data("id");
1947         let value = $("#" + id).val();//获取控件Id的value值
1948         value = value != null ? value : 0;
1949         if (isNaN(value) || value == "") {//不全是数字
1950             value = 0;
1951         }
1952         if (value >= 1) {
1953             value = 100;
1954         }
1955         if (value > 0 && value < 1) {//这种情况是1表示100%的值,那么0.1*100=10
1956             value = value * 100;
1957         }
1958         progressBar(this, value);
1959     })
e72c74 1960
a6a76f 1961 })