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