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