xinyb
2024-09-19 18ffbca9acaccd5099a7a63652f52210f59a7e40
WebRoot/js/index/funcLink.js
@@ -1,17 +1,28 @@
var version = 0;// 版本号
var pwdCallBack = null;// 密码输入点击确定后回调函数
var obj22 = null;// 22类型传值对象
var shx=false;
var leftWidth="0";
var gridId=[];
var shx = false;
var leftWidth = "0";
var gridId = [];
//var uploadObj = null;
//var edit='';
var pic={};// 格线附件上传参数属性
var rsakey={
    pubkey:"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAkRupiYcKVGGUtDBDoR1t/1zm3ZtZgnte39iTJW6hlqjdY0UagKjpNiIv7J6XjtgfX7SgsR4AWnivqQHAICIvdPKfGZZzIs62OQ19MqrDTMoB/LvK5teNWhClv23WMUfRbP+EHgprT6hTw8U5apw1IB6i/y57NkLav792wiYBYRU4X45NoTaT+aiTSLFEflbfm94EXnhSS3vFkBmrZGy5BRNI8gmzafroslGx2Hk90CqlNdeKYxgZQ6xtvj+u33yrszWvPT6F9fsJT8aMjtvH050iYKRVct+x6Q7VRJgCI4MgvAexnTKdxW54YzvXCuO5bDiy5la7CgerWkTAq9dzXwIDAQAB"
var pic = {};// 格线附件上传参数属性
var rsakey = {
    pubkey: "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAkRupiYcKVGGUtDBDoR1t/1zm3ZtZgnte39iTJW6hlqjdY0UagKjpNiIv7J6XjtgfX7SgsR4AWnivqQHAICIvdPKfGZZzIs62OQ19MqrDTMoB/LvK5teNWhClv23WMUfRbP+EHgprT6hTw8U5apw1IB6i/y57NkLav792wiYBYRU4X45NoTaT+aiTSLFEflbfm94EXnhSS3vFkBmrZGy5BRNI8gmzafroslGx2Hk90CqlNdeKYxgZQ6xtvj+u33yrszWvPT6F9fsJT8aMjtvH050iYKRVct+x6Q7VRJgCI4MgvAexnTKdxW54YzvXCuO5bDiy5la7CgerWkTAq9dzXwIDAQAB"
};
let arrayFileType_Panel = {};//保存上传返回的附件uuid;seq及文件类型
let arrayFileSeq_Panel = {};//保存上传返回的附件uuid;seq及文件名称,用于删除时根据文件名称匹配到seq
let fileUploadCount_Panel = 0;//保存附件总数
let formid_Panel;
let paramExprs = [];//保存功能链接参数值是密文的参数名称
function encryptFun(value) {
    var encrypt = new JSEncrypt();
    encrypt.setPublicKey(rsakey.pubkey);
    return encrypt.encrypt(value);
}
//拼接附件url
function getAttachmentUrl(staticUrl,formid,unid,domain,dbid,isShowOrgPic,width,height,fileExt,isDownLoad){
function getAttachmentUrl(staticUrl, formid, unid, domain, dbid, isShowOrgPic, width, height, fileExt, isDownLoad) {
    // if (staticUrl != null && staticUrl != "") {
    //     if (isDownLoad) {
    //         return unid + "_" + dbid + "_" + formid + "_" + fileExt;
@@ -87,7 +98,9 @@
      onfileiput(formId, colname, panMain[0].panInfo[colname].controltype,
             "", "", nodejs.usercode, value);
      picevent(colname);   // 事件
      $doc(colname).val(value);
        if (panMain[0].panInfo[colname].controltype != "9") {//9类型是单附件不需要再赋值
            $doc(colname).val(value);
        }
   }
}
@@ -108,12 +121,13 @@
            uploadAsync: false,   // bool是否多文件批量上传将并行异步/。默认为true
            showCaption: false,//是否显示被选文件的简介
            showBrowse: false,//是否显示文件浏览按钮
            showBatchDownload:true,//显示批量下载按钮
            showBatchDownload: true,//显示批量下载按钮
            showUpload: false,//是否显示上传按钮
            showCancel: false,//是否显示取消按钮
            showRemove: false,//是否显示移除按钮
            showDrag:false,//是否显示拖动按钮
            showDrag: false,//是否显示拖动按钮
            showClose: false,//是否显示关闭按钮
            multiple: id.type == 9 ? false : true,//by danaus 2024-02-19 17:39
            dropZoneEnabled: true,   //是否显示拖拽区域
            browseOnZoneClick: false,   //布尔值,是否在点击预览区域时触发文件浏览/选择。默认为false
            showUploadedThumbs: true,   // 是否在预览窗口中持续显示已经上传的文件缩略图(用于ajax上传),直到按下删除/清除按钮
@@ -122,8 +136,8 @@
            isNine: false,   // 19类型就为false,9类型就为true,下面有判断
            validateInitialCount: false,   // 是否包括初始预览文件数(服务器上传文件)验证minfilecount和maxfilecount。默认为false.
            overwriteInitial: true,   // 是否要覆盖初始预览内容和标题设置
            initialPreviewAsData:true,
            allowedFileExtensions:null,//允许上传的文件扩展名列表。默认情况下设置为 null
            initialPreviewAsData: true,
            allowedFileExtensions: null,//允许上传的文件扩展名列表。默认情况下设置为 null
            dropZoneTitle:'点击或拖拽文件',
            dropZoneClickTitle:'',
            layoutTemplates : {
@@ -174,7 +188,9 @@
                'htm': '<i class="bi bi-filetype-html" style="color:#369584"></i>',
                'txt': '<i class="bi bi-filetype-txt" style="color: #5d5a5a"></i>',
                'mov': '<i class="bi bi-film"></i>',
                'mp3': '<i class="bi bi-filetype-mp3"></i>'
                'mp3': '<i class="bi bi-filetype-mp3"></i>',
                'jpg':'<i class="bi bi-file-image" style="color: #45b8ab"></i>',
                'key':'<i class="bi bi-filetype-key" style="color: #3fa2e3"></i>'
            },
            previewFileExtSettings: {
                'doc': function(ext) {
@@ -200,6 +216,9 @@
                },
                'mp3': function(ext) {
                    return ext.match(/(mp3|wav)$/i);
                },
                'jpg':function (ext) {
                    return ext.match(/(jpg|png|jpeg|gif|ico|pic|bmp|tif)$/i);
                }
            },
            isNodragging:false,//自定义属性,在只读状态是否可以执行拖拽
@@ -233,16 +252,19 @@
                fileInputId.fileinput('upload');
            }).on('filebatchuploadsuccess', function(event, data) {
                // 此事件仅在ajax上传且文件批量上传成功之后触发
                let tmp={};
                let oldKey=id.val();// 旧的值
                let newKey=data.response.uuid?data.response.uuid+";":"";   // 新的值
                if(oldKey!=""){
                    var keys=oldKey.split(";");
                    for(var i=1;i<keys.length;i++){
                        newKey=newKey.replace(";"+keys[i]+";",";");
                fileUploadCount_Panel += data.files.length;
                arrayFileSeq_Panel = JSON.parse(data.response.seqMap);
                arrayFileType_Panel = JSON.parse(data.response.fileExtMap);
                let tmp = {};
                let oldKey = id.val();// 旧的值
                let newKey = data.response.uuid ? data.response.uuid + ";" : "";   // 新的值
                if (oldKey != "") {
                    var keys = oldKey.split(";");
                    for (var i = 1; i < keys.length; i++) {
                        newKey = newKey.replace(";" + keys[i] + ";", ";");
                    }
                }
                tmp.key=newKey;
                tmp.key = newKey;
                tmp.type=data.response.type;
                tmp.filedId=name;
                tmp.oldKey=oldKey;
@@ -252,10 +274,10 @@
                    data.thumbs.attr("data-key",JSON.stringify(tmp));
                }
                // 格线调用
                if(g){
                    let grid=g.id;
                    let obj=unid+";"+data.response.fileType;// by by danaus 2020/4/30 11:32
                    grid.SetValue(g.row, g.col,obj,0);
                if(g) {
                    let grid = g.id;
                    let obj = unid + ";" + data.response.fileType;// by danaus 2020/4/30 11:32
                    grid.SetValue(g.row, g.col, obj, 0);
                    grid.RefreshCell(g.row, g.col);
                }
            }).on('filebeforedelete', function(event, params) {
@@ -265,6 +287,8 @@
            }).on('filedeleted', function(event, key) {
                // 在删除initialPreview内容集中的每个缩略图文件之后触发此事件
                // 格线调用
                debugger;
                fileUploadCount_Panel--;
                if (isGrid != null && isGrid == 'grid') {
                    if (g) {
                        let grid = g.id;
@@ -275,6 +299,7 @@
                } else {   // 面板
                    let va = id.val();
                    key = key.split(";")[1];
                    delete arrayFileType_Panel[key];
                    va = va.replace(";" + key, "");
                    if (va.indexOf(";") < 0) {
                        va = "";
@@ -284,20 +309,21 @@
                }
            }).on('filesuccessremove', function(event, val) {
                // 使用缩略图删除按钮删除成功上传的缩略图后,会触发此事件
                if(val!=null && val.key!=null){
                    let vals = val.key.split(";");
                    let uuid;
                    let seq = 0;
                    if (vals.length > 1) {
                        uuid = val.key.split(";")[0];
                        seq = val.key.split(";")[1];
                    }
                debugger;
                if(val!=null && val.key!=null) {
                    let title = val.title;//文件名称,用于查找对应的seq
                    let delSeq = arrayFileSeq_Panel[title];//对应删除的seq
                    let uuid = val.key.split(";")[0];
                    $.ajax({
                        type: "POST",
                        dataType: 'json',
                        url: '/attachment/deleteOwnerAttachment.do?type=' + val.type + '&unid=' + uuid + '&seq=' + seq,   // 删除路径
                        url: '/attachment/deleteOwnerAttachment.do?formid=' + formid_Panel + '&fieldid=' + val.filedId + '&ishd=1&type=' + val.type + '&unid=' + uuid + '&seq=' + delSeq,   // 删除路径
                        success: function (data) {
                            let newUid = val.oldKey == "" ? "" : val.oldKey.replace(";" + seq, "");
                            fileUploadCount_Panel--;
                            delete arrayFileSeq_Panel[title];
                            delete arrayFileType_Panel[uuid + ";" + delSeq];
                            // let newUid = val.oldKey == "" ? "" : val.oldKey.replace(";" + delSeq, "");
                            let newUid = val.key == "" ? "" : val.key.replace(";" + delSeq, "");//by danaus 2024-02-21 16:56
                            id.val(newUid);
                        }
                    });
@@ -378,6 +404,29 @@
    }
    return o;
}
//附件权限控制设置
// function readApproved(editstatus,docstatus,id,userCode,index){
//     let isReadOnly = true;//默认只读
//     //取SQL条件表达式结果
//     let expr = getDoc(id + "_expr", ".value");
//     let isEditUpload = ((expr != null && expr == 2) || expr == null) ? true : false;
//     let readonly = panMain[index] != null ? panMain[index].panInfo[id].ReadOnly : 0;//是否只读
//     if (readonly != 1 && (isNew == 1 || (predocstatus == docstatus && isEditUpload))) {
//         //可编辑附件
//         isReadOnly = false;
//     }
//     let editstatusArra = (editstatus != null && editstatus != "") ? editstatus.join(";") : [];
//     let isEditstatus = $.inArray(docstatus, editstatusArra);//是否可以编辑
//     let curChecker = getDoc("curchecker", ".value");//当前审核人
//     let ApprovedUserCodes = getDoc("approvedusercodes", ".value");//用于记录已审核人列表
//     if (readonly != 1 && (predocstatus != docstatus && isEditUpload && isEditstatus) &&
//         ((curChecker != "" && curChecker.indexOf(userCode) != 1) ||
//             (curChecker == "" && ApprovedUserCodes.indexOf(userCode) != 1))) {
//         //可编辑附件
//         isReadOnly = false;
//     }
//     return isReadOnly;
// }
/**
 *-----end-----上面的方法是针对9/19附件控件类型 xin 2021-5-13 09:59:58
 */
@@ -391,6 +440,7 @@
 * @param usercode 账号
 * @param uuid uuId
 * @param maxFileSize 上传附件大小限制值
 * @param index 面板元素(多个面板时候就是0,1,2)
 */
function onfileiput(formid,id,controlType,docstatus,rowid,usercode,uuid,maxFileSize){
    //获取到插件基本属性
@@ -398,6 +448,7 @@
    var isReadOnly = false;
    try {
        // 上传附件需要的参数
        formid_Panel = formid;
        var param = {};
        var panelautoSave = "";//标记是否为单据
        var readerUserCodes = $('#readerusercodes').val();
@@ -414,13 +465,13 @@
        try {
            param.doccode = $('#doccode').val();
            if (param.doccode == undefined) {
                param.doccode = panMain[panIndex].panelAuditValue.doccode;
                param.doccode = panMain[panIndex].panelAuditValue.doccode;//panMain[panIndex].panelAuditValue.doccode;
            }
            if (param.doccode && readerUserCodes != undefined && readerUserCodes != '') {
                param.readerusercodes = readerUserCodes;
            }
        } catch (e) {
            param.doccode = panMain[panIndex].panelAuditValue.doccode;
            param.doccode = panMain[panIndex].panelAuditValue.doccode;//panMain[panIndex].panelAuditValue.doccode;
        }
        if (formType && (formType == 5 || formType == 9
            || formType == 15 || formType == 8
@@ -432,11 +483,13 @@
                    var ed = panMain[i].picState[id].split(";pb#");
                    param.headflag = ed[0];
                    param.editstatus = (ed.length > 1 && ed[1] != null ? ed[1] : ed[0]);
                    // isReadOnly=readApproved(param.editstatus,docstatus,id,usercode,index);
                    if (param.editstatus != "") {
                        if ((";" + param.editstatus + ";").indexOf(";" + docstatus + ";") > -1) {
                            isReadOnly = false;
                        } else {
                            isReadOnly = true;
                            //ApprovedUserCodes //用于记录已审核人列表
                        }
                    }
                }
@@ -455,7 +508,7 @@
                    fileInput.option.otherActionButtons = '';//隐藏权限
                    fileInput.option.isNodragging=true;//禁止拖拽(自定义)
                }
                fileInput.option.browseOnZoneClick = !isReadOnly;//是只读状态就禁用点击区域上传附件功能
                fileInput.option.browseOnZoneClick = !isReadOnly;//是只读状态就禁用点击区域上传附件功能(false表示禁用)
                fileInput.option.maxFileSize = maxFileSize;//上传大小(kb)
                var encrypt = new JSEncrypt();
                encrypt.setPublicKey(rsakey.pubkey);
@@ -466,6 +519,8 @@
                        param.dbid = jsons[0].dbid;
                        param.usercode = jsons[0].userCode;
                        param.username = jsons[0].userName;
                        //是新单那就表示是没有附件的,要清空单据里面字段的值
                        $doc(id).val('');//清空
                        break;
                    }
                    // 图片属性
@@ -522,9 +577,7 @@
                    // if (jsons[i].fileType.toLowerCase() == 'pdf') {//pdf格式调用插件
                    //     fileURL = jsons[i].domain + '/general/pdf/web/viewer.jsp?file=' + fileURL;
                    // }
                    if (jsons[i].orgFileType == 'doc' || jsons[i].orgFileType == 'docx' || jsons[i].orgFileType == 'xls'
                        || jsons[i].orgFileType == 'xlsx' || jsons[i].orgFileType == 'ppt' || jsons[i].orgFileType == 'pptx') {
                        jsons[i].fileType = 'office';
                    if (jsons[i].fileType == 'office') {//office类型需要
                        fileURL = encodeURIComponent(fileURL);
                    }
                    fileInput.option.initialPreview.push(fileURL);
@@ -533,7 +586,7 @@
                        'time': jsons[i].uploadTimeStr,  //上传开始时间
                        'name': jsons[i].authorName,  //作者名称
                        'size': jsons[i].fileSizeStr,   // 上传的图片大小
                        'type': jsons[i].fileType,   // 上传的图片类型
                        'type': jsons[i].allowView?jsons[i].fileType:'lock',   // 上传的图片类型
                        'filename': jsons[i].originalFileName,//jsons[i].physicalFile,   //物理文件
                        'filetype': jsons[i].fileType + '/' + jsons[i].orgFileType,
                        'title': title,//title
@@ -615,7 +668,7 @@
    })
}
/******图片在图片框内按宽高比例自动缩放!!!***/
// 图片在图片框内按宽高比例自动缩放!!!
// Img:要放图片的img元素,onload时传参可用this
// maxHeight  :img元素的高度,像素(图片框 最大高度)
@@ -1310,7 +1363,8 @@
// f:功能号    t:功能类型   sf:自身字段   lf:外表字段   lk:为1时执行存储过程,0显示界面,3弹出层
// sd:自表字段 ld:外表字段    isp:       ef:where条件语句   mes:提示信息
// clo:1表示关闭
function funcLink(f, t, sf, lf, lk, sd, ld, isp, ef, mes, ref, clo, autoSave,sortid,messageTip) {
//rowid,表格当前行id
function funcLink(f, t, sf, lf, lk, sd, ld, isp, ef, mes, ref, clo, autoSave,sortid,messageTip,rowid) {
    var flag = checkSession(); // session失效后弹出登录框,flag为true时表示已经失效
    if(flag){
        return;
@@ -1331,7 +1385,7 @@
    lfs=lf.split(";"); // 字段分隔固定用;
    sfs=sf.split(split);
    if (sfs.length != lfs.length) {
        $.messager.alert('警告', "请检查外表字段与自身字段是否设置正确!", 'error');
        $.messager.alert('警告', "外表字段与自身字段个数不一致,请检查外表字段与自身字段是否设置正确!", 'error');
        return;
    }
    if (mes&&mes.indexOf("&") != -1 && t == "22") {
@@ -1364,8 +1418,8 @@
       //$.messager.defaults = { ok: "是", cancel: "否" };
        $.messager.confirm('提示', mes, function(r) {
            if (r) {
                funcLink$(f, t, sfs, lfs, lk, sd, ld, isp, ef, ref, clo,
                    autoSave, sortid, messageTip, mes);
                    funcLink$(f, t, sfs, lfs, lk, sd, ld, isp, ef, ref, clo,
                        autoSave, sortid, messageTip, mes, rowid);
                $('.panel-tool-close').show();
            }else {
               closeLoading(); //更新客户状态的取消
@@ -1374,7 +1428,7 @@
        }, "warning");
        $('.panel-tool-close').hide(); //取消更新客户状态的弹出框红叉      yang 2020-04-26
    } else {
        funcLink$(f, t, sfs, lfs, lk, sd, ld, isp, ef, ref, clo, autoSave,sortid,messageTip);
        funcLink$(f, t, sfs, lfs, lk, sd, ld, isp, ef, ref, clo, autoSave,sortid,messageTip,"",rowid);
    }
    // 系统消息
    if(messageTip!=null && messageTip.indexOf(",")!=-1){
@@ -1387,18 +1441,18 @@
    //moreWindowClose(); // 2、3类型更多按钮的关闭事件
}
function funcLink$(f, t, sfs, lfs, lk, sd, ld, isp, ef, ref, clo, autoSave, sortid, messageTip, mes) {
function funcLink$(f, t, sfs, lfs, lk, sd, ld, isp, ef, ref, clo, autoSave, sortid, messageTip, mes,rowid) {
    if (isp && isp == "1") {
        showPwd(f, t, function () {
            funcLink$$(f, t, sfs, lfs, lk, sd, ld, ef, ref, clo, autoSave, sortid, messageTip, mes);
            funcLink$$(f, t, sfs, lfs, lk, sd, ld, ef, ref, clo, autoSave, sortid, messageTip, mes,rowid);
        });
    } else {
        funcLink$$(f, t, sfs, lfs, lk, sd, ld, ef, ref, clo, autoSave, sortid, messageTip, mes);
        funcLink$$(f, t, sfs, lfs, lk, sd, ld, ef, ref, clo, autoSave, sortid, messageTip, mes,rowid);
    }
}
var savedExecFunclink;
function funcLink$$(f, t, sfs, lfs, lk, sd, ld, ef, ref, clo, autoSave, sortid, messageTip, mes) {
function funcLink$$(f, t, sfs, lfs, lk, sd, ld, ef, ref, clo, autoSave, sortid, messageTip, mes,rowid) {
    savedExecFunclink = null;
    if (t == "22") {
        // autoSave=='1'是要先执行保存
@@ -1410,11 +1464,11 @@
            } else {
                savedExecFunclink = $(function () {
                    execProc(param[0], param[1], param[2], param[3], param[4],
                        param[8], param[9], messageTip, mes);
                        param[8], param[9], messageTip, mes,rowid);
                });
            }
        } else {
            execProc(f, t, sfs, lfs, lk, ref, clo, messageTip, mes);
            execProc(f, t, sfs, lfs, lk, ref, clo, messageTip, mes,rowid);
        }
    } else {
        // autoSave=='1'是要先执行保存
@@ -1422,7 +1476,7 @@
            var param = arguments;
            savedExecFunclink = $(function(){
                funclink$$$(param[0], param[1], param[2], param[3], param[4],
                    param[5], param[6], param[7], param[8], param[9]);
                    param[5], param[6], param[7], param[8], param[9],rowid);
            });
        } else {
            var lfsStr=lfs.join(","); // 把传进来的外表字段(数组类型)跟自表字段(数组类型)转换成字符串
@@ -1441,7 +1495,7 @@
            }
            funclink$$$(f, t, sfs, lfs, lk, sd, ld, ef, ref, clo,messageTip);
            funclink$$$(f, t, sfs, lfs, lk, sd, ld, ef, ref, clo,messageTip,rowid);
        }
    }
}
@@ -1453,12 +1507,16 @@
        }
    }catch(e){}
}
function funclink$$$(f, t, sfs, lfs, lk, sd, ld, ef, ref, clo,messageTip) {
function funclink$$$(f, t, sfs, lfs, lk, sd, ld, ef, ref, clo,messageTip,rowid) {
    var rows=[];
    var num=0;
    if (typeof (mygrid) != "undefined") {
        rows=mygrid.getFieldForNew();
        if(rowid!=undefined&&rowid!=""){
            rows.push(mygrid.Rows[rowid]);
        }else{
            rows=mygrid.getFieldForNew();
        }
        if(rows.length==0){
            num=1;
        }else {
@@ -1527,27 +1585,31 @@
    var wp = $.trim(selfStr).length > 0 ? ("wherePan=" + strPam) : "";
    let wp = $.trim(strPam).length > 0 ? (strPam) : "";
    if (ef != undefined && ef != null && ef != "")
        wp = (wp == "") ? "wherePan=" + encodeURI(encodeURI(ef)) : wp + " and "
        wp = (wp == "") ?  encodeURI(encodeURI(ef)) : wp + " and "
            + encodeURI(encodeURI(ef));
    try {
        closeLoading();
        parent.addTab("", f, t, wp);
        parent.addTab("", f, t, "wherePan=" +encodeURIComponent(wp));
    } catch (e) {
        closeLoading();
        showWindow("/app" + spellPath + f + "/" + t + "/index.jsp?" + wp, "");
        showWindow("/app" + spellPath + f + "/" + t + "/index.jsp?" + "wherePan=" +wp, "");
    }
}
var execParams = []; // 22窗体传值 lk表示是否打开界面或弹出层
function execProc(f, ft, sfs, lfs, lk, ref, clo, exec, mes) { // 储存过程
function execProc(f, ft, sfs, lfs, lk, ref, clo, exec, mes,rowid) { // 储存过程
    var paramVa = "";
    var t = null;
    var rows = [];
    var num = 0;
    if (typeof (mygrid) != "undefined") {
        rows = mygrid.getFieldForNew();
        if(rowid!=undefined&&rowid!=""){
            rows.push(mygrid.Rows[rowid]);
        }else {
            rows = mygrid.getFieldForNew();
        }
        if(rows.length==0){
            num=1;
        }else {
@@ -1632,6 +1694,8 @@
            data: {
                "formid": f,
                "param": paramVa,
                "paramFields": lfs.join(";"),//值对应该的字段列表
                "paramExprs": paramExprs.join(";"),//值对应该的字段权限=0列表
                "disableDuplicateSubmitUUID": systemUuid.uuid //by danaus 2019/11/22 11:12
            },
            beforeSend: function (XMLHttpRequest) {
@@ -1763,10 +1827,54 @@
            }
        }
        $.messager.alert('提示', msg || '出现错误', "info");
    } else {
    }else if(data.state != null && data.state==-1007){//
        //百望云平台账号已过期,重新登录
        $.messager.alert('提示', data.msg, "info", function () {
            /*layer.open({
                type: 2,
                title: '登录百望云平台',
                maxmin: false,
                skin: 'layui-layer-molv',
                shadeClose: true, //点击遮罩关闭层
                area : ['1300px' , '800px'],
                content:  'https://www.baiwang.com/mainsite/src/html/login/login.html'
            });*/
            window.open(data.data.url,'',' width='+ (screen.availWidth - 10) +',height='+ (screen.availHeight-50) +',scrollbars,resizable=yes,toolbar=no');
            return;
        });
    }else  if(data.state != null && data.state==-1008){
        //百望云平台刷脸验证
        layer.open({
            type: 2,
            area: ['788px', '680px'],
            title: ['风控检测', 'font-size:18px;text-align:center;font-weight:600;'],
            resize: false,
            fixed: false,
            shade: 0,
            content: '/js/faceswiping/faceswiping.html',
            isOutAnim: false,
            success: function (layero, index) {
                // 获取弹出的 iframe 页面对象
                top.layIframeWindow = window[layero.find("iframe")[0]['name']];
                //obj={info:{taxNo:"xxxx",taxUserName:"张三",authId:"336363636"}}
                // console.log("faceswip:"+JSON.stringify(obj))
                top.layIframeWindow.faceSwipingInit(data);
                top.layeerFace=layero;
            }
        });
    } else if (data.errcode != null && data.errcode == 0) {
        $.messager.confirm('提示', "拉取企业微信标签已同步", function(r) {
            if(r){
                location.reload();
            }else{
                location.reload();
            }
        });
    }else {
        try{
            var obj=JSON.parse(data);
            $.messager.alert('提示', obj.msg, "info");
                $.messager.alert('提示', obj.msg, "info");
        }catch (e) {
            $.messager.alert('提示', data || '状态无法识别:' + data.state, "info");
        }
@@ -1874,7 +1982,17 @@
    }else if(info.indexOf("open.callBack|") ==0){//处理第三方返回的数据,打开另一个页卡
        info=info.replace("open.callBack|","").split("|");
        var obj=JSON.parse(info[1]);
        window.open(info[0]+obj.Url,'','width=800px;height=800px');
       /* var perContent= layer.open({
            type: 2,
            title: '德立测量单信息',
            maxmin: false,
            skin: 'layui-layer-molv',
            shadeClose: true, //点击遮罩关闭层
            area : ['1300px' , '800px'],
            content:  info[0]+obj.Url       //'/app/67/0/cnzh/110502/1/index.jsp'
        });
        layer.full(perContent);*/
        window.open(info[0]+obj.Url,'',' width='+ (screen.availWidth - 10) +',height='+ (screen.availHeight-50) +',scrollbars,resizable=yes,toolbar=no');
    }else{ // 打开页面
        var tt=info.split("|");
        for(var i=0;i<tt.length;i++){
@@ -1916,7 +2034,10 @@
    if (r == "1") {
        if(location) location.reload();
    }else if(r=="2"){
        if(mygrid) mygrid.ReloadBody();
        if(mygrid){
            mygrid.ReloadBody();
            mygrid.AllSelected=0;//刷新表格时清除全选状态 by danaus 2023-08-26 15:14
        }
    }
    if (c == "1") {
       if(parent) parent.closeTab();
@@ -1989,6 +2110,18 @@
    }
}
//自定义控件布局的方法
function editCustomControl(){
    let formid = formId;
    let formtype = formType;
    let docCode = '';
    if (typeof getDoc !="undefined") {
        getDoc("doccode", ".value");
    }
    let queryString = "";
    let url = "/general/CustomControl/editLayout.html?formId=" + formid + "&formType=" + formtype + "&docCode=" + docCode+"&tabIndex="+top.tabindex;
    top.addTab(top.layoutTitle+'布局', '', '', '', url, '', '');
}
/**
 * top页面info按钮执行函数
 * @returns
@@ -2013,8 +2146,21 @@
function showLoading() {
    $("#loading").show();
}
function closeLoadingButton(){
    let close = $(".loadingClose");
    if (close) {close.remove();}
    $(".loadingMsg").after("<p class=\"loadingClose\">" +
        "<button class='easyui-linkbutton l-btn l-btn-small' onclick='javascript: closeLoading()'>关闭" +
        "</button></p>");
}
function closeLoading() {
    $("#loading").hide();
}
//错误异常的捕获 xin 2023-8-22 10:34:29
window.onerror=function (message, source, lineno, colno, error) {
    closeLoadingButton();
    console.log(message);
    return true; // 防止异常的默认行为
}
/** ***************************************** */
Object.extend = function(destination, source) {
@@ -2124,39 +2270,54 @@
    }
    return str;
}
function getValue(str,format,row) { // 获取页面值
    var t;
function getValue(fieldId, format, row) { // 获取页面值
    let value;
    try {
        t = getDoc(str.toLowerCase(), ".value");
        //TODO 是实现面板需要根据权限是否为0取不同的值 by danaus 2024-03-08 14:53
        value = getDoc(fieldId.toLowerCase(), ".value");
        let value_expr = getDoc(fieldId.toLowerCase() + "_expr", ".value");
        let value_expr_val = getDoc(fieldId.toLowerCase() + "_expr_val", ".value");
        if (value_expr != undefined&&value_expr != null&&value_expr !=="" && value_expr == 0) {
            value = value_expr_val;
            paramExprs.push(fieldId.toLowerCase());
        }
    } catch (e) {
        t=undefined; // by danaus  出现异常赋值   作为判断识别
        value = undefined; // by danaus  出现异常赋值   作为判断识别
    }
    if(t==null){ // 只有是这种情况才需要继续向下查找 by danaus 原则:如果页面上有这个字段定义,不管它是什么值,都把它替换,如果没有这个字段,就继续向下查找,直到没有 则不用替(传什么就是什么)
    if (value == null) { // 只有是这种情况才需要继续向下查找 by danaus 原则:如果页面上有这个字段定义,不管它是什么值,都把它替换,如果没有这个字段,就继续向下查找,直到没有 则不用替(传什么就是什么)
        if (typeof (mygrid) != "undefined") {
            try {
                if(row==undefined){
                    var tempRow=mygrid.getFristRow(1);//再判断一次,以确定这个字段是否存在于表格,存在才需要提示
                    if(tempRow!=null&&tempRow[str.toLowerCase()]!=undefined) {
                if (row == undefined) {
                    var tempRow = mygrid.getFristRow(1);//再判断一次,以确定这个字段是否存在于表格,存在才需要提示
                    if (tempRow != null && tempRow[fieldId.toLowerCase()] != undefined) {
                        alert("请从表格选中需要执行的行");
                        return false;
                    }
                }
                var d=t; // 保存原值
                if(row!=undefined){
                    t = (row[str.toLowerCase()+"Link"]!==undefined)?row[str.toLowerCase()+"Link"]:((row[str.toLowerCase()]==undefined)?null:row[str.toLowerCase()]);
                }else{
                    t=mygrid.getField(str.toLowerCase());
                let orgValue = value; // 保存原值
                if (row != undefined) {
                    value = (row[fieldId.toLowerCase() + "Link"] !== undefined) ? row[fieldId.toLowerCase() + "Link"] : ((row[fieldId.toLowerCase()] == undefined) ? null : row[fieldId.toLowerCase()]);
                    if (row[fieldId.toLowerCase() + "_expr"] != undefined&& row[fieldId.toLowerCase() + "_expr"]!=="" && row[fieldId.toLowerCase() + "_expr"] === 0) {
                        //密文,取_expr_val的值
                        value = row[fieldId.toLowerCase() + "_expr_val"];
                        paramExprs.push(fieldId.toLowerCase());
                    }
                } else {
                    value = mygrid.getField(fieldId.toLowerCase());
                }
                if (t==null&&d==null) return str;
                if (value == null && orgValue == null) return fieldId;
            } catch (e) {
                return str;
                return fieldId;
            }
        }
        return t;
    }else{
        if(t=='null'){t="";}
        return t;
        return value;
    }else {
        if (value == 'null') {
            value = "";
        }
        return value;
    }
}
@@ -2216,6 +2377,7 @@
    }
    if (Warnnessage == "" || Warn()) {
        var proParam = "";
        let doccodes=[];//多个单据打印的处理(更新打印次数用到)
        if ($.trim(param) != "") {
            if (param.indexOf("@formid") != -1) {
                param = param.replaceAll("@formid", formId);
@@ -2250,8 +2412,29 @@
                        continue;
                    }
                    t = getValue(tempx.toLowerCase(),null,rows[k]);
                    if (t==null)
                    if (t==null){
                        t = tempx;
                    }else{
                        if (tempx.toLowerCase() == "doccode" && t != "") {//如果获取到的是单据固定字段名称进入处理
                            doccodes.push(t);
                        }
                    }
                    //43控件处理
                    let panM = panMain[panIndex];
                    if (panM != null) {
                        if (panM.panInfo[tempx.toLowerCase()] != null) {
                            if (panM.panInfo[tempx.toLowerCase()].controltype == 43) {
                                t = $("#" + tempx.toLowerCase()).val();
                                if (t != null && t != "") {
                                    if (t instanceof Array) {
                                        t = t.join("#p#");//用分号(;)做间隔的话再传参后台会被截断
                                    }
                                } else {
                                    t = "";
                                }
                            }
                        }
                    }
                    proParam += t; // 组装值
                }
                proParam +=";";
@@ -2262,6 +2445,9 @@
//        var servlet = "/" + format.toLowerCase() + ".do?"
        var servlet="/printReport.do?m="+format.toLowerCase()
        var doccode = getDoc("doccode", ".value");//只取表头 by danaus 2022/8/17 11:10 getValue('doccode');
        if (doccode == null && doccodes.length > 0) {//没找到这个单号,多个单号数组里有值的话就赋值 xin 2023-10-13 10:57:54
            doccode = doccodes.join(";");
        }
        var url = "formId=" + formid + "&reportId=" + reportid + "&parameter=" + proParam+";"
            + "&p=" + Math.round(Math.random() * 100000);
        //html方法打印
@@ -2436,6 +2622,7 @@
    if ((C_Grid != undefined && C_Grid != "" && eval('(' + C_Grid + ')').toP != "" && eval('(' + C_Grid + ')').toP != "null")
        || $.trim(postToThis).length > 0 || self_datafields != "") {
        $("#tpselect").show();
        $(".selected-icon-container").show();
    }
    parent.numId = ""; // 设置单号的值
})
@@ -2642,6 +2829,63 @@
    },'json')
})
/**
 * css样式编辑器 xin 2024-1-29 10:34:34
 * @param grid
 * @param panel
 */
//getTextCssEdit(option)//option是格线当前行触发的对象可以获取值和返回
var textCssOption={};
function getTextCssEdit(option){
    if (option && option.close) {//关闭
        if (option.type == 1 && option.value != null) {//给面板赋值
            $doc(textCssOption.id).val(option.value);
        }
        layer.closeAll();
        return false;
    }
    let cssText = "";
    let type = 0;
    let pindex = 0;
    if (typeof (panIndex) != "undefined") {
        pindex = panIndex;
    }
    textCssOption = option;
    if (option && option.id) {//获取值(面板)
        if (option.index != null) {//取对应元素的控件值
            panIndex = option.index;
            cssText = $doc(option.id).val();
        } else {
            cssText = $("#" + option.id).val();
        }
        type = 1;//面板控件
    }
    if(option.grid || option.value){//获取值(格线)
        cssText=option.value;
    }
    layer.open({
        type: 2,
        area: ['400px', '780px'],
        closeBtn: 0,
        isOutAnim: false,
        title: false,
        resize: false,
        fixed: false,
        shade: 0.6,
        skin: 'layui-layer-molv',
        shadeClose: false, // 点击遮罩区域,关闭弹层,
        content: encodeURL('/general/textCssEdit/textCssEdit.html?cssText=' + cssText + '&type=' + type + '&grid=' + option.grid),//cssText有值时候可以传过去
        move: false,
        success: function (layero, index) {
            // createFormElement();
        }, cancel: function (index, layero) {
            panIndex = pindex;
        }, end: function () {
            panIndex = pindex;
        }
    });
}
function checkVersion(){
    setTimeout(checkVersion, 86400000);
    setTimeout(checkVersion2, 86400000);//24小时调用一次