xinyb
2022-09-13 faf4ababded41c4653010482b601f44cac2dd461
WebRoot/js/index/funcLink.js
@@ -1,7 +1,7 @@
var version = 0;// 版本号
var pwdCallBack = null;// 密码输入点击确定后回调函数
var obj22 = null;// 22类型传值对象
var shx=false;
var shx=false;
var leftWidth="0";
var gridId=[];
//var uploadObj = null;
@@ -12,17 +12,18 @@
};
//拼接附件url
function getAttachmentUrl(staticUrl,formid,unid,domain,dbid,isShowOrgPic,width,height,fileExt,isDownLoad){
    if(staticUrl!=null &&staticUrl!=""){
        if(isDownLoad)
            return unid+"_"+dbid+"_"+formid+"_"+fileExt;
        else
            return domain+staticUrl;
    }
    width=width||80;
    height=height||80;
    isShowOrgPic=isShowOrgPic||false;
    fileExt="."+fileExt||"";
    return domain+"/uploads/attachment/"+dbid+"/"+formid+"/"+unid+(isShowOrgPic?("_"+width+"x"+height):"")+fileExt;
    // if (staticUrl != null && staticUrl != "") {
    //     if (isDownLoad) {
    //         return unid + "_" + dbid + "_" + formid + "_" + fileExt;
    //     } else {
    //         return domain + staticUrl;
    //     }
    // }
    width = width || 80;
    height = height || 80;
    isShowOrgPic = isShowOrgPic || false;
    fileExt = "." + fileExt || "";
    return domain + "/uploads/attachment/" + dbid + "/" + formid + "/" + unid + (isShowOrgPic ? ("_" + width + "x" + height) : "") + fileExt;
}
//31类型新增sqlWhere设置,拼接sql,在可编辑状态时调用
//dysql:select * from gfield where formid=120201 order by statisid desc, sqlWhere: formname='xxx'
@@ -93,399 +94,425 @@
/**
 *下面的方法是针对9/19附件控件类型 xin 2021-5-13 09:59:58
 */
//面板遍历9或19控件
$(function(){
    $(".isFileInput").each(function () {
        var option = {//加载附件需要到参数信息
            fieldId: this.id,
            Envt: '#' + this.id + '_upload',
            controlType: $(this).data("type"),
            formId: formId,
            unId: this.value,
            maxFileSize: $(this).data("size"),
            docStatus: $(this).data("status"),
            ReadOnly: $(this).data("readonly"),//是否只读
            rowId: 0,
            userCode: '',
            docCode: $('#doccode').val(),
            readerUserCodes: $('#readerusercodes').val()
//渲染出附件界面出来
 var BootstrapFileInputOption = function(id){
    let o = {
        e: $('#' + id + '_up'),
        id:$('#'+id),
        name:id,
        option: {//属性
            uploadUrl: '#',   // String,用于上传处理操作的URL(通常是基于Ajax的处理)
            uploadIdEvnt:$('#'+id),
            language: 'zh',   // 语言
            uploadAsync: false,   // bool是否多文件批量上传将并行异步/。默认为true
            showCaption: false,//是否显示被选文件的简介
            showBrowse: false,//是否显示文件浏览按钮
            showBatchDownload:true,//显示批量下载按钮
            showUpload: false,//是否显示上传按钮
            showCancel: false,//是否显示取消按钮
            showRemove: false,//是否显示移除按钮
            showDrag:false,//是否显示拖动按钮
            showClose: false,//是否显示关闭按钮
            dropZoneEnabled: true,   //是否显示拖拽区域
            browseOnZoneClick: false,   //布尔值,是否在点击预览区域时触发文件浏览/选择。默认为false
            showUploadedThumbs: true,   // 是否在预览窗口中持续显示已经上传的文件缩略图(用于ajax上传),直到按下删除/清除按钮
            maxFilesNum: 10,   // 上传最大的文件数量
            maxFileCount: 0,   // 为每个多次上载允许的最大文件数。如果设置为0,则意味着允许的文件数是无限的。默认值为0。
            isNine: false,   // 19类型就为false,9类型就为true,下面有判断
            validateInitialCount: false,   // 是否包括初始预览文件数(服务器上传文件)验证minfilecount和maxfilecount。默认为false.
            overwriteInitial: true,   // 是否要覆盖初始预览内容和标题设置
            initialPreviewAsData:true,
            allowedFileExtensions:null,//允许上传的文件扩展名列表。默认情况下设置为 null
            dropZoneTitle:'点击或拖拽文件',
            dropZoneClickTitle:'',
            layoutTemplates : {
                 indicator:''//去掉上传状态图标
                ,actionUpload: ''//去除缩略图中文件上传操作按钮的模板
                ,actionDrag:''//去掉缩略图拖动图标
                ,footer : '<div class="file-thumbnail-footer" style="height: auto">\n' +
                '    {actions}\n' +
                '</div>'
            },
            //自定义按钮(权限)
            otherActionButtons:'<button type="button" onclick="mylockFile(this)" ' +
                'class="kv-file-lock btn btn-sm btn-kv btn-default btn-outline-secondary"' +
                'title="权限"{dataKey}><i class="bi-shield-lock"></i></button>'
            ,previewSettings: {   // 设置显示的图片相同的宽度高度
                image: {width: '110px', height: '110px'},
                html: {width: "110px", height: "110px"},
                text: {width: "110px", height: "110px"},
                office: {width: "110px", height: "110px"},
                gdocs: {width: "110px", height: "110px"},
                video: {width: "110px", height: "110px"},
                audio: {width: "110px", height: "110px"},
                flash: {width: "110px", height: "110px"},
                object: {width: "110px", height: "110px"},
                pdf: {width: "110px", height: "110px"},
                other: {width: "110px", height: "110px"}
            },
            previewSettingsSmall: {
                image: {width: '110px', height: '110px', 'max-width': '110px', 'max-height': '110px'},
                html: {width: '110px', height: '110px'},
                text: {width: '110px', height: '110px'},
                office: {width: '110px', height: '110px'},
                gdocs: {width: '110px', height: '110px'},
                video: {width: '110px', height: '110px'},
                audio: {width: '110px', height: '110px'},
                flash: {width: '110px', height: '110px'},
                object: {width: '110px', height: '110px'},
                pdf: {width: '110px', height: '110px'},
                other: {width: '110px', height: '110px'}
            },
            preferIconicPreview: true,
            previewFileIconSettings: {
                'doc': '<i class="bi bi-filetype-doc" style="color: #3b93e7"></i>',
                'xls': '<i class="bi bi-filetype-exe" style="color: #479347"></i>',
                'ppt': '<i class="bi bi-filetype-ppt" style="color: #ea500a"></i>',
                'pdf': '<i class="bi bi-filetype-pdf" style="color: red"></i>',
                'zip': '<i class="bi bi-file-earmark-zip" style="color: #2a7e77"></i>',
                '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>'
            },
            previewFileExtSettings: {
                'doc': function(ext) {
                    return ext.match(/(doc|docx)$/i);
                },
                'xls': function(ext) {
                    return ext.match(/(xls|xlsx)$/i);
                },
                'ppt': function(ext) {
                    return ext.match(/(ppt|pptx)$/i);
                },
                'zip': function(ext) {
                    return ext.match(/(zip|rar|tar|gzip|gz|7z)$/i);
                },
                'htm': function(ext) {
                    return ext.match(/(htm|html)$/i);
                },
                'txt': function(ext) {
                    return ext.match(/(txt|ini|csv|java|php|js|css)$/i);
                },
                'mov': function(ext) {
                    return ext.match(/(avi|mpg|mkv|mov|mp4|3gp|webm|wmv)$/i);
                },
                'mp3': function(ext) {
                    return ext.match(/(mp3|wav)$/i);
                }
            },
            isNodragging:false,//自定义属性,在只读状态是否可以执行拖拽
            fileActionSettings:{//用于在预览窗口中为新选择的文件缩略图设置文件操作的配置
                // showDownload:false,//是否在缩略图中显示下载按钮
                showUpload:false//是否在缩略图中显示上传按钮
            },
            // usePdfRenderer: true,//启动自定义的内部插件,false值或不设置这个属性将是默认的插件
            // pdfRendererUrl: '',//'/general/pdf/web/viewer.jsp',//预览pdf格式的插件路径
            initialPreview: [],   // 字符串或者数组,要显示的初始预览内容
            initialPreviewConfig: [],   // 数组,为每个initialPreview条目(就是initialPreview中的每个预览)设置重要属性的配置
            showPreview: true,   // 布尔值,是否显示文件预览。默认值为true
            maxFileSize: 0//允许上传的文件大小(默认为0,不限制)
        },
        fileInput: function () {//渲染,并且绑定事件
            this.e.fileinput(this.option);
        },
        events:function (isGrid,g) {
            let fileInputId=this.e;
            let id=this.id;
            let name=this.name;
            let Event=this;
            let datas={};
            fileInputId.on("filebatchselected", function(event, files) {
                // 在预览中选择并显示一批文件后触发此事件(选择结束后触发的事件)
                if(!g){   // 不是格线
                    // 触发修改(面板有内容改动,刷新界面时候有提示)
                    upSub(name);
                }
                //触发上传功能
                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]+";",";");
                    }
                }
                tmp.key=newKey;
                tmp.type=data.response.type;
                tmp.filedId=name;
                tmp.oldKey=oldKey;
                let unid = data.response.uuid?data.response.uuid:"";
                id.val(unid);
                if(data.thumbs!=null){
                    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);
                    grid.RefreshCell(g.row, g.col);
                }
            }).on('filebeforedelete', function(event, params) {
                // 在删除initialPreview内容集中的每个缩略图文件之前触发此事件
                let e=!confirm("您确定要删除吗?");
                return e;
            }).on('filedeleted', function(event, key) {
                // 在删除initialPreview内容集中的每个缩略图文件之后触发此事件
                // 格线调用
                if (isGrid != null && isGrid == 'grid') {
                    if (g) {
                        let grid = g.id;
                        let obj = "";
                        grid.SetValue(g.row, g.col, obj, 0);
                        grid.RefreshCell(g.row, g.col);
                    }
                } else {   // 面板
                    let va = id.val();
                    key = key.split(";")[1];
                    va = va.replace(";" + key, "");
                    if (va.indexOf(";") < 0) {
                        va = "";
                    }
                    id.val(va);
                    panMain[panIndex].isChange = 1;  //解决110101上传后删除附件不成功,而出现多个序号的问题
                }
            }).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];
                    }
                    $.ajax({
                        type: "POST",
                        dataType: 'json',
                        url: '/attachment/deleteOwnerAttachment.do?type=' + val.type + '&unid=' + uuid + '&seq=' + seq,   // 删除路径
                        success: function (data) {
                            let newUid = val.oldKey == "" ? "" : val.oldKey.replace(";" + seq, "");
                            id.val(newUid);
                        }
                    });
                }
            }).on('filezoomshown', function(event, params) {
                //此事件在模态对用户可见后触发(将等待 CSS 转换完成)
                Event.imageEvent();
            }).on('filezoomprev', function(event, params) {
                //事件在缩放预览模式下,当点击上一个导航按钮查看上一个文件时触发(也在缩放模式下按下键盘左箭头时触发)
                Event.imageEvent();
            }).on('filezoomnext', function(event, params) {
                //该事件在缩放预览模式下,当点击下一个导航按钮查看下一个文件时触发(也在缩放模式下按下键盘右箭头时触发)。
                Event.imageEvent();
            });
        },imageEvent:function () {
            let kv = $('#kvFileinputModal .file-zoom-content img');
            if (kv.length > 0) {
                try {
                    isFileInputImage = new Viewer(kv[0], {
                        title: false, viewed: function () {
                            if (isFileInputImage.imageCurrent != null) {
                                isFileInputImage.rotate(isFileInputImage.imageCurrent);
                            }
                        }
                    });
                    isFileInputImage.imageCurrent = 0
                } catch (e) {
                    isFileInputImage = null;
                }
            }
        }
    }
    return o;
}
/**
 *-----end-----上面的方法是针对9/19附件控件类型 xin 2021-5-13 09:59:58
 */
/**
 * 加载面板附件内容
 * @param formid 功能号
 * @param id 控件ID
 * @param controlType 控件类型
 * @param docstatus 单据状态值
 * @param rowid rowId
 * @param usercode 账号
 * @param uuid uuId
 * @param maxFileSize 上传附件大小限制值
 */
function onfileiput(formid,id,controlType,docstatus,rowid,usercode,uuid,maxFileSize){
    //获取到插件基本属性
    let fileInput = BootstrapFileInputOption(id);
    var isReadOnly = false;
    try {
        // 上传附件需要的参数
        var param = {};
        var panelautoSave = "";//标记是否为单据
        var readerUserCodes = $('#readerusercodes').val();
        var uid = $('#' + id).val();
        uid = uid == undefined ? "" : uid.replace(/^;+/g, "");//处理值是;;;这样1个或多个的情况
        param.fieldid = id;
        param.controltype = controlType;
        param.formid = formid;
        param.unid = (uuid == undefined ? uid : uuid);
        param.maxFileSize = maxFileSize;
        param.docstatus = docstatus;
        param.rowid = rowid;
        param.usercode = usercode;
        try {
            param.doccode = $('#doccode').val();
            if (param.doccode == undefined) {
                param.doccode = panMain[panIndex].panelAuditValue.doccode;
            }
            if (param.doccode && readerUserCodes != undefined && readerUserCodes != '') {
                param.readerusercodes = readerUserCodes;
            }
        } catch (e) {
            param.doccode = panMain[panIndex].panelAuditValue.doccode;
        }
        if (formType && (formType == 5 || formType == 9
            || formType == 15 || formType == 8
            || formType == 496 || formType == 497
            || formType == 16 || formType == 17)) {
            panelautoSave = "&is16=1";
            for (var i in panMain) {   // 循环状态值,如果面板有这个0或1就循环下去,没有就直接跳过
                if (panMain[i].picState[this.id] != undefined) {
                    var ed = panMain[i].picState[this.id].split(";pb#");
                    option.headFlag = ed[0];
                    option.editStatus = (ed.length > 1 && ed[1] != null ? ed[1] : ed[0]);
                }
            }
            option.is16 = "&is16=1";
        }
        getFileInput(option, function (e) {
            if (e != null) {
                layer.alert(e.msg);
                loadingFileInput({});
            }
        });
    });
})
//处理格线上的附件控件
function showFileInput(id, pant, obj, callback) {
    try {
        var op = {};
        var pants = pant.split("?")[1].split("&");
        if (pants != null) {
            for (var p=0; p<pants.length;p++) {
                var v = pants[p].split("=");
                op[v[0]] = (v[1]!='undefined'?v[1]:"");
            }
        }
        var option = {//加载附件需要到参数信息
            isGrid:"grid",
            fieldId: op["fieldid"],
            Envt: '#fileUpload_up',
            controlType: 9,
            formId: op["formid"],
            userCode: op["usercode"],
            docStatus: (op["docstatus"] != null ? op["docstatus"] : 0),
            rowId: (op["rowid"]==""?0:op["rowid"]),
            docCode: (op["doccode"] != null ? op["doccode"] : $('#doccode').val()),
            headFlag: (op['ishd'] == 0 ? 1 : 0),
            readerUserCodes: ($('#readerusercodes').val()==undefined?"":$('#readerusercodes').val())
        }
        if ((op.uuid == null || pic.uuid == '') && (op.oldgrid != null && op.oldgrid != '')) {
            var unid = op.oldgrid.split(';');
            option.unId = (unid[0] + ";" + unid[1]).replace("|48|48|", "");
            if (unid.length == 4 && unid[0].indexOf('.do') != -1) {
                option.unId = (unid[1] + ";" + unid[2]).replace("|48|48|", "");//uuid+seq
            }
        }
        if (option.docCode == null) {
            option.docCode = panMain[panIndex].panelAuditValue.doccode;
        }
        getFileInput(option, callback);
    } catch (e) {
        callback(e);
    }
}
//请求加载附件和渲染附件前的参数配置
function getFileInput(option,callback) {
    //发送请求
    $.post("/LoadFileInput.do", option, function (data) {
        if (data.state != null) {
            callback({"msg": "附件控件出错:" + data.msg});
        } else {
            //渲染前的参数组装
            if (data != null) {
                loadingFileInput(data,option);//渲染附件控件
            } else {
                callback({"msg": "附件控件出错:" + data});
            }
        }
    }).error(function (xhr, errorText, errorType) {//错误处理
        callback({"msg": "附件控件出错:" + errorText});
    });
}
//渲染附件控件
function loadingFileInput(json,option){
    //初始化控件
    $(json.EnvtId).fileinput({
        uploadUrl: json.url,   // String,用于上传处理操作的URL(通常是基于Ajax的处理)
        language: 'zh',   // 语言
        uploadAsync: false,   // bool是否多文件批量上传将并行异步/。默认为true
        showCaption: false,//是否显示被选文件的简介
        showBrowse: false,//是否显示文件浏览按钮
        showRemove: false,//是否显示移除按钮
        showUpload: false,//是否显示上传按钮
        showCancel: false,//是否显示取消按钮
        showClose: false,//是否显示关闭按钮
        browseOnZoneClick: json.isReadOnly,   //布尔值,是否在点击预览区域时触发文件浏览/选择。默认为false
        initialPreviewShowDelete: !json.isReadOnly,//是否将为使用创建的每个缩略图显示删除按钮
        maxFilesNum: 10,   // 上传最大的文件数量
        previewSettings: {image: {width: "110px", height: "110px"}}, // 设置显示的图片相同的宽度高度
        initialPreview: json.view,   // 字符串或者数组,要显示的初始预览内容
        initialPreviewConfig: json.config,   // 数组,为每个initialPreview条目(就是initialPreview中的每个预览)设置重要属性的配置
        otherActionButtons: json.otherbut,//用于在初始预览缩略图中显示其他操作按钮的标记
        maxFileSize: json.size,//单位为kb,如果为0表示不限制文件大小
        autoReplace: (json.type == 9 ? true : false),//是否自动替换当前图片,设置为true时,再次选择文件,会将当前的文件替换掉。
        maxFileCount: (json.type == 9 ? 1 : 0),   // 为每个多次上载允许的最大文件数。如果设置为0,则意味着允许的文件数是无限的。
        isNine: (json.type == 9 ? true : false),   // 19类型就为false,9类型就为true,
        validateInitialCount: (json.type == 9 ? true : false),   // 是否包括初始预览文件数(服务器上传文件)验证minfilecount和maxfilecount。默认为false.
        overwriteInitial: (json.type == 9 ? false : true)  // 是否要覆盖初始预览内容和标题设置
    }).on('filesuccessremove', function (event, id) {   // 使用缩略图删除按钮删除成功上传的缩略图后,会触发此事件
        var unid = $('#' + json.id).find("img").attr("unid");
        var val = JSON.parse(unid);
        var uuid = val.key.split(";")[0];
        var seq = val.key.split(";")[1];
        $.ajax({
            type: "POST",
            dataType: 'json',
            url: '/attachment/deleteOwnerAttachment.do?type=' + val.type + '&unid=' + uuid + '&seq=' + seq,   // 删除路径
            success: function (data) {
                var newUid = val.oldKey == "" ? "" : val.oldKey.replace(";" + seq, "");
                $('#' + val.filedId).val(newUid);
            }
        });
    }).on('filepredelete', function (event, key, jqXHR, data) {   // 在删除initialPreview内容集中的每个缩略图文件之前触发此事件
        if (!confirm("您确定要删除吗?")) {
            //处理不删除图片操作
            return false;
        }
    }).on('filedeleted', function (event, key) {   // 在删除initialPreview内容集中的每个缩略图文件之后触发此事件
        if (option.isGrid !=null && option.isGrid == 'grid') {   // 格线
            try {
                if (top.myFresh.mygrid) {
                    var grid = top.myFresh.mygrid.id;
                    var obj = "";
                    grid.SetValue(top.myFresh.mygrid.row, top.myFresh.mygrid.col, obj, 0);
                    grid.RefreshCell(top.myFresh.mygrid.row, top.myFresh.mygrid.col);
                }
            } catch (e) {
                alert(e);
            }
        } else {   // 面板
            var va = $('#' + json.id).val();
            va = va.replace(";" + key, "");
            if (va.indexOf(";") < 0) va = "";
            $('#' + json.id).val(va);
            $(json.EnvtId).fileinput('reset');//重启
            panMain[panIndex].isChange = 1;  //解决110101上传后删除附件不成功,而出现多个序号的问题
        }
        $(json.EnvtId).fileinput({uuidkey: key});
    }).on('filebatchuploadsuccess', function (event, data, previewId, index) {   // 此事件仅在ajax上传且文件批量上传成功之后触发
        var tmp = {};
        var oldKey = $('#' + json.id).val();   // 旧的值
        var 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.type = data.response.type;
        tmp.filedId = json.id;
        tmp.oldKey = oldKey;
        var unid = data.response.uuid ? data.response.uuid : "";
        data.thumb.find("img").attr("unid", JSON.stringify(tmp));
        this.uuidkey = unid;
        $('#' + json.id).val(unid);
        if (top.myFresh.mygrid) {   // 格线
            var grid = top.myFresh.mygrid.id;
            var obj = unid + ";" + data.response.fileType;// by by danaus 2020/4/30 11:32
            grid.SetValue(top.myFresh.mygrid.row, top.myFresh.mygrid.col, obj, 0);
            grid.RefreshCell(top.myFresh.mygrid.row, top.myFresh.mygrid.col);
        }
    }).on("filebatchselected", function (event, files) {   // 在预览中选择并显示一批文件后触发此事件
        if (top.myFresh != null && top.myFresh.mygrid) {   // 格线
            $(json.EnvtId).fileinput('upload');
        } else {//面板
            upSub(json.id);   // 触发修改(面板有内容改动)
            //直接上传后台
            $(json.EnvtId).fileinput('upload', {uuidurl: $('#' + json.id).val()});   // 触发所选文件的ajax上传。仅适用于uploadUrl已设置的情况。此方法将文件输入元素作为jQuery对象返回,因此可以链式调用其他方法。
        }
    }).on('filezoomshown', function (event, params) {   // 在模态框已被用户看到之后触发此事件(将等待CSS转换完成)
        $(".modal-backdrop").attr("class", "");
        $(".modal-content").css("zIndex", 999999);
    }).on('filebrowse', function (event) {   // 单击文件浏览按钮以打开文件选择对话框时触发此事件
        try {
            if (typeof (fileupload_config) == "undefined") {
                if (top.myFresh.mygrid) {
                    var grid = top.myFresh.mygrid.id;
                    if (grid.Cols[top.myFresh.mygrid.col].CanEdit == 0) {
                        event.preventDefault = false;
                        return false;
                    }
                }
            } else {
                if (!fileupload_config.browseOnZoneClick) {
                    event.preventDefault();
                }
            }
        } catch (e) {
            alert(e);
        }
    });
    if (json.isReadOnly) {//只读后的样式
        $(".file-preview ").css("background", "#CCC");
        $(".file-footer-buttons").find("a").css("background", "#CCC");
        $(".file-footer-buttons").find("button").css("background", "#CCC");
    }
    $('.glyphicon-download').css("margin-top", "5px");
}
/**
 *-----end-----上面的方法是针对9/19附件控件类型 xin 2021-5-13 09:59:58
 */
// 加载面板附件内容(旧版本)
function onfileiput(formid,id,controlType,docstatus,rowid,usercode,uuid,maxFileSize){
    var picPer=[];var authBtn='';
    // 上传附件需要的参数
    var picpant={};
    try{   // 赋值
        var uid=$('#'+id).val();
        uid=uid==undefined?"":uid.replace(/^;+/g,"");//处理值是;;;这样1个或多个的情况
        picpant['fieldid']=id;
        picpant['controltype']=controlType;
        picpant['formid']=formid;
        picpant['unid']=(uuid==undefined?uid:uuid);
        picpant['maxFileSize']=maxFileSize;
        picpant['docstatus']=docstatus;
        picpant['rowid']=rowid;
        picpant['usercode']=usercode;
        var readerUserCodes = $('#readerusercodes').val();
        try{
            picpant['doccode']=$('#doccode').val();
            if(picpant.doccode==undefined){
                picpant.doccode=panMain[panIndex].panelAuditValue.doccode;
            }
            if (picpant['doccode'] && readerUserCodes!=undefined && readerUserCodes!='') {
                picpant['readerusercodes']=readerUserCodes;
            }
        }catch(e){
            picpant.doccode=panMain[panIndex].panelAuditValue.doccode;
        }
        var isReadOnly = false ;
        var panelautoSave="";//标记是否为单据
        if(formType && (formType == 5 || formType == 9
            || formType == 15 || formType == 8
            || formType == 496|| formType == 497
            || formType == 16 || formType == 17)){
            panelautoSave="&is16=1";
           for(var i in panMain){   // 循环状态值,如果面板有这个0或1就循环下去,没有就直接跳过
              if(panMain[i].picState[id]!=undefined){
                 var ed = panMain[i].picState[id].split(";pb#");
                    picpant['headflag'] = ed[0];
                    picpant['editstatus'] = (ed.length > 1 && ed[1] != null?ed[1] : ed[0]);
                    if(picpant['editstatus']!=""){
                       if((";" + picpant['editstatus'] + ";").indexOf(";" + docstatus + ";") > -1){
                           isReadOnly = false;
                        }else{
                           isReadOnly = true;
                if (panMain[i].picState[id] != undefined) {
                    var ed = panMain[i].picState[id].split(";pb#");
                    param.headflag = ed[0];
                    param.editstatus = (ed.length > 1 && ed[1] != null ? ed[1] : ed[0]);
                    if (param.editstatus != "") {
                        if ((";" + param.editstatus + ";").indexOf(";" + docstatus + ";") > -1) {
                            isReadOnly = false;
                        } else {
                            isReadOnly = true;
                        }
                    }
                    //注释:这样获取只读值,只会把控件隐藏起来,不是想要的只读 xin 2021-3-3 10:36:04
                    // if(panMain[i].panInfo[id].ReadOnly && panMain[i].panInfo[id].ReadOnly == 1){
                    //    isReadOnly = true ;
                    // }
               }
                }
            }
        }
        var picpants = JSON.stringify(picpant);
        // 图片显示的方法
        $.ajax({url:'/attachment/getAttachmentList.do',
            type:"POST",
            async:false,
            data:{pant:picpants},
            dataType:'json',
            success :function(data){
                var jsons=data;
                // 加载图片需要的属性
        // 请求后台数据信息
        $.ajax({
            url: '/attachment/getAttachmentList.do',
            type: "POST",
            async: false,
            data: {pant: JSON.stringify(param)},
            dataType: 'json',
            success: function (jsons) {
                if (isReadOnly) {//只读状态时候
                    fileInput.option.layoutTemplates.actionDelete = '';//隐藏删除
                    fileInput.option.otherActionButtons = '';//隐藏权限
                    fileInput.option.isNodragging=true;//禁止拖拽(自定义)
                }
                fileInput.option.browseOnZoneClick = !isReadOnly;//是只读状态就禁用点击区域上传附件功能
                fileInput.option.maxFileSize = maxFileSize;//上传大小(kb)
                var encrypt = new JSEncrypt();
                encrypt.setPublicKey(rsakey.pubkey);
                var picupload={
                    uploadUrl: '#',   // String,用于上传处理操作的URL(通常是基于Ajax的处理)
                    language: 'zh',   // 语言
                    uploadAsync: false,   // bool是否多文件批量上传将并行异步/。默认为true
                    showUpload: true,   // 布尔值,是否显示缩略图中的上传按钮
                    showRemove: true,   // 布尔值,是否显示缩略图中的删除按钮
                    showCaption: true,   // 布尔值,是否显示文件名。默认值为true
                    showPreview: true,   // 布尔值,是否显示文件预览。默认值为true
                    dropZoneEnabled: true,   //是否显示拖拽区域
                    browseOnZoneClick: isReadOnly,   //布尔值,是否在点击预览区域时触发文件浏览/选择。默认为false
                    showUploadedThumbs: true,   // 是否在预览窗口中持续显示已经上传的文件缩略图(用于ajax上传),直到按下删除/清除按钮
                    maxFilesNum: 10,   // 上传最大的文件数量
                    maxFileCount: 0,   // 为每个多次上载允许的最大文件数。如果设置为0,则意味着允许的文件数是无限的。默认值为0。
                    isNine:false,   // 19类型就为false,9类型就为true,下面有判断
                    validateInitialCount: false,   // 是否包括初始预览文件数(服务器上传文件)验证minfilecount和maxfilecount。默认为false.
                    overwriteInitial: true,   // 是否要覆盖初始预览内容和标题设置
                    previewSettings: {   // 设置显示的图片相同的宽度高度
                        image: {width: "110px", height: "110px"},
                    },
                    initialPreview:[],   // 字符串或者数组,要显示的初始预览内容
                    initialPreviewConfig:[],   // 数组,为每个initialPreview条目(就是initialPreview中的每个预览)设置重要属性的配置
                    showPreview: true,   // 布尔值,是否显示文件预览。默认值为true
                    maxFileSize: maxFileSize
                }
                for(var i=0;i<jsons.length;i++){
                    if(jsons.length==1&&jsons[0].isNewAttachment==1){//表示返回的新单需要的数据,而不是附件的内容
                        picpant.domain=jsons[0].domain;
                        picpant.dbid=jsons[0].dbid;
                        picpant.usercode=jsons[0].userCode;
                        picpant.username=jsons[0].userName;
                for (var i = 0; i < jsons.length; i++) {
                    //表示返回的新单需要的数据,而不是附件的内容
                    if (jsons.length == 1 && jsons[0].isNewAttachment == 1) {
                        param.domain = jsons[0].domain;
                        param.dbid = jsons[0].dbid;
                        param.usercode = jsons[0].userCode;
                        param.username = jsons[0].userName;
                        break;
                    }
                    // 图片属性
                    if(i==0) {
                        picpant.domain = jsons[i].domain;
                        picpant.usercode = jsons[i].userCode;
                        picpant.username = jsons[i].userName;
                        picpant.dbid = jsons[i].dbid;
                    if (i == 0) {
                        param.domain = jsons[i].domain;
                        param.usercode = jsons[i].userCode;
                        param.username = jsons[i].userName;
                        param.dbid = jsons[i].dbid;
                    }
                    var encrypt = new JSEncrypt();
                    encrypt.setPublicKey(rsakey.pubkey);
                    var deleToken= 'type='+(controlType == 9?'1':'3')+'&formid='+picpant.formid+'&doccode='+picpant.doccode+'&fieldid='+id+'&unid='+jsons[i].unid+'&seq='+
                    jsons[i].seq+'&docstatus='+picpant.docstatus+'&ishd=1&usercode='+encodeURIComponent(encrypt.encrypt(jsons[i].authorCode))+'&readerusercodes='+readerUserCodes+'&dbid='+encodeURIComponent(encrypt.encrypt(jsons[i].dbid))+'&curUsername='+encodeURIComponent(encrypt.encrypt(jsons[i].userName))+'&curUsercode='+encodeURIComponent(encrypt.encrypt(jsons[i].userCode));
                    picupload.initialPreviewConfig.push({
                        'caption':jsons[i].originalFileName,   // 上传的图片名称
                        'filename':jsons[i].physicalFile,   //物理文件
                        'time':jsons[i].uploadTimeStr,  //上传开始时间
                        'name':jsons[i].authorName,  //作者名称
                        'size':jsons[i].fileSizeStr,   // 上传的图片大小
                        'type':jsons[i].fileType,   // 上传的图片类型
                        'key':jsons[i].seq,
                        'downloadUrl':jsons[i].domain+"/attachment/downLoadAttachment.do?filePath="+getAttachmentUrl(jsons[i].staticUrl,jsons[i].formid,jsons[i].unid+"@p@"+jsons[i].seq,"",jsons[i].dbid,false,60,60,jsons[i].orgFileType,true),   // 附件下载路径
                        'url':jsons[i].domain+'/attachment/deleteAttachmentV2.do?'+deleToken
                    });   // 附件删除路径
                    // 判断是否需要权限,如果要那么就加载权限按钮属性
                    if(jsons[i].authorCode != null && jsons[i].authorCode == picpant.usercode){   // authorCode 作者
                        authBtn='<a href="javascript:authorize(\''+jsons[i].unid +'\',\''+jsons[i].seq +'\');" '+
                            'class="btn btn-kv btn-default btn-outline-secondary" title="授权" style="padding: 0px;">'+
                            '<i class="glyphicon glyphicon-lock" style="padding-top: 6px;"></i></a>';   // 授权按钮
                    //文件路径
                    let fileURL = getAttachmentUrl(jsons[i].staticUrl, jsons[i].formid,
                        jsons[i].unid + "@p@" + jsons[i].seq, jsons[i].domain, jsons[i].dbid,
                        false, 60, 60, jsons[i].orgFileType);
                    //文件显示信息
                    let title = '文件名:' + jsons[i].originalFileName +
                        ' \n类型:' + jsons[i].fileType +
                        ' \n大小:' + jsons[i].fileSizeStr +
                        ' \n上传者:' + jsons[i].authorName +
                        ' \n上传时间:' + jsons[i].uploadTimeStr;
                    //下载地址
                    let Down = jsons[i].domain + "/attachment/downLoadAttachment.do?filePath=" +
                        jsons[i].unid + "@p@" + jsons[i].seq + "_" + jsons[i].dbid + "_" +
                        jsons[i].formid + "_" + jsons[i].orgFileType;
                    //删除地址
                    let deleURL = '#';
                    if (!isReadOnly) {//不是只读
                        deleURL = jsons[i].domain + '/attachment/deleteAttachmentV2.do?' +
                            'type=' + (controlType == 9 ? '1' : '3') + '&formid=' + param.formid +
                            '&doccode=' + param.doccode + '&fieldid=' + id + '&unid=' + jsons[i].unid + '&seq=' +
                            jsons[i].seq + '&docstatus=' + param.docstatus + '&ishd=1&usercode=' +
                            encodeURIComponent(encrypt.encrypt(jsons[i].authorCode)) + '&readerusercodes=' +
                            readerUserCodes + '&dbid=' + encodeURIComponent(encrypt.encrypt(jsons[i].dbid)) +
                            '&curUsername=' + encodeURIComponent(encrypt.encrypt(jsons[i].userName)) + '&curUsercode=' +
                            encodeURIComponent(encrypt.encrypt(jsons[i].userCode));
                    }
//                    var fileSize=null;
//                    if(fileSize == null) fileSize = jsons[i].fileSize;   //附件上传参数控制,上传附件大小控制
//                    picupload.maxFileSize = (fileSize == 0 || fileSize == null || fileSize == "null")?10240:fileSize;   //附件上传参数控制,上传附件大小控制
                    // 添加图片权限
                    picPer.push({key:jsons[i].seq,isAllowDelete:jsons[i].hasDelete,isAllowUpdate:jsons[i].hasUpdate,
                        isAllowDownload:jsons[i].hasDownload,authBtn:authBtn});
                    // 图片
                    picupload.initialPreview.push('<img src="'+getAttachmentUrl(jsons[i].staticUrl,formid,jsons[i].unid+"@p@"+jsons[i].seq,jsons[i].domain,jsons[i].dbid,false,60,60,jsons[i].orgFileType)+'" style="height: 60px;" class="kv-preview-data file-preview-image" title="文件名:'+jsons[i].originalFileName+' \n类型:'+jsons[i].fileType+' \n大小:'+jsons[i].fileSizeStr+' \n上传者:'+jsons[i].authorName+' \n上传时间:'+jsons[i].uploadTimeStr+'">');
                    //注释,不用viewer.jsp打开pdf文件,因为用这个打开有印章的pdf,印章会被屏蔽 xin 2022-6-23 09:44:07
                    // 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';
                        fileURL = encodeURIComponent(fileURL);
                    }
                    fileInput.option.initialPreview.push(fileURL);
                    fileInput.option.initialPreviewConfig.push({
                        'caption': jsons[i].originalFileName,   // 上传的图片名称
                        'time': jsons[i].uploadTimeStr,  //上传开始时间
                        'name': jsons[i].authorName,  //作者名称
                        'size': jsons[i].fileSizeStr,   // 上传的图片大小
                        'type': jsons[i].fileType,   // 上传的图片类型
                        'filename': jsons[i].originalFileName,//jsons[i].physicalFile,   //物理文件
                        'filetype': jsons[i].fileType + '/' + jsons[i].orgFileType,
                        'title': title,//title
                        'key': jsons[i].unid + ';' + jsons[i].seq,//key
                        'downloadUrl': jsons[i].allowDownload ? Down : false,   // true值时候设置下载地址,否则设置false不显示下载按钮
                        'url': deleURL,// 附件删除路径
                        'hasZoom': jsons[i].allowView,//是否能查看
                        // 'hasDwn': jsons[i].allowDownload,//是否能下载
                        'hasDel': jsons[i].allowDelete,//是否能删除
                        'hasLock': jsons[i].authorCode != null && jsons[i].authorCode == param.usercode ? true : false//是否能显示权限
                    });
                }
                // 附件上传路径(组装参数)
                let upURL = '';
                if(!isReadOnly) {//不是只读
                    upURL= param.domain + '/attachment/uploadAttachmentV2.do?' +
                    'type=' + (controlType == 9 ? '1' : '3') + '&formid=' + param.formid +
                    '&doccode=' + param.doccode + '&fieldid=' + id + '&rowid=' + Math.random() +
                    '&usercode=' + encodeURIComponent(encrypt.encrypt(param.usercode)) +
                    '&username=' + encodeURIComponent(encrypt.encrypt(param.username)) +
                    '&ishd=1' + panelautoSave + '&dbid=' + encodeURIComponent(encrypt.encrypt(param.dbid));
                    // '&uuid=' + uid;//$('#' + id).val();
                }
                fileInput.option.uploadUrl = upURL;
                // 判断如果是9类型就输出,如果是19类型就不输出
                if(controlType==9){
                    picupload.maxFileCount=1;   // 为每个多次上载允许的最大文件数。如果设置为0,则意味着允许的文件数是无限的。默认值为0。
                    picupload.isNine=true;   // 19类型就为false,9类型就为true
                    picupload.validateInitialCount= true;   // 是否包括初始预览文件数(服务器上传文件)验证minfilecount和maxfilecount。默认为false.
                    picupload.overwriteInitial= false;   // 是否要覆盖初始预览内容和标题设置
                if (controlType == 9) {
                    fileInput.option.maxTotalFileCount = 1;// 为每个多次上载允许的最大文件数。如果设置为0,则意味着允许的文件数是无限的。默认值为0。
                    fileInput.option.isNine = true;   // 19类型就为false,9类型就为true---(忽略验证检查)
                    fileInput.option.validateInitialCount = true;   // 是否包括初始预览文件数(服务器上传文件)验证minfilecount和maxfilecount。默认为false.
                    fileInput.option.overwriteInitial = false;   // 是否要覆盖初始预览内容和标题设置
                }
                // 附件上传路径
                var upToken = 'type='+(controlType == 9?'1':'3')+'&formid='+picpant.formid+
                '&doccode='+picpant.doccode+'&fieldid='+id+'&rowid='+Math.random()+
                '&usercode='+encodeURIComponent(encrypt.encrypt(picpant.usercode))+'&username='+encodeURIComponent(encrypt.encrypt(picpant.username))+'&ishd=1'+panelautoSave+'&dbid='+encodeURIComponent(encrypt.encrypt(picpant.dbid))+
                '&uuid='+ $('#'+id).val();
                picupload.uploadUrl=picpant.domain+'/attachment/uploadAttachmentV2.do?'+upToken;
                // 加载图片显示
                var uploadObj = $('#'+id+'_up').fileinput(picupload);
                if(isReadOnly){
                    $(".file-preview ").css("background","#CCC");
                    $(".file-footer-buttons").find("a").css("background","#CCC");
                    $(".file-footer-buttons").find("button").css("background","#CCC");
                }
                others();
                picBtn(picPer,picupload,id);
            }
        });
    }catch(e){
    } catch (e) {
        $.messager.alert("提示", "未能加载附件信息!" + e, "warning");
    } finally {
        // 渲染显示
        fileInput.fileInput();
        if (isReadOnly) {//是只读
            $("#"+id+"_show_type .file-preview").css("background", "#CCC");
            $("#"+id+"_show_type .file-footer-buttons").find("a").css("background", "#CCC").css("color","#6c757d");
            $("#"+id+"_show_type .file-footer-buttons").find("button").css("background", "#CCC");
        }
    }
}
@@ -499,7 +526,7 @@
    var image = new Image();
    // 原图片原始地址(用于获取原图片的真实宽高,当<img>标签指定了宽、高时不受影响)
    image.src = Img.src;
    // 当图片比图片框小时不做任何改变
    // 当图片比图片框小时不做任何改变
    if (image.width < maxWidth&& image.height < maxHeight) {
        Img.width = image.width;
        Img.height = image.height;
@@ -516,373 +543,373 @@
    }
}
// 40类型 查看图片
function showModalImg(value,controlType){
    try{
        var pant=value.split("?")[1];
        var pants=pant.split("&");
        var pic={};
        for(var i=0;i<pants.length;i++){
            c=pants[i].split("=");
            pic[c[0]]=c[1];
        }
        var src="#";
        var results="";
        if(pic.oldgrid!=undefined){
           if(pic.oldgrid.indexOf('http')!=-1){   //判断http协议,有无地址
              results=pic.oldgrid.split(";")[1]; //显示网址图片
           }else{
              src = pic.oldgrid.replace(".do;",".do?type="+(controlType == 9?"1":"3")+"&uuid=");
              var unid=pic.oldgrid.split(";")[1];
              var seq=pic.oldgrid.split(";")[2];
              var fileExt=pic.oldgrid.split(";")[3];
              if(seq!=null&&seq!=undefined&&seq!=""){
                  unid=unid+"@p@"+seq;
                }
              results=getAttachmentUrl(pic.staticUrl,pic.formid,unid,pic.domain,pic.dbid,false,80,80,fileExt);
           }
        }else{
            return false;
        }
        $("#bimg").attr("src",results);
        document.getElementById("uploadForm").style.display="none";
        document.getElementById("bimg").style.display="inline-block";
        //AutoSize($("#bimg"),600,500);
        return true ;
    }catch(e){alert(e);}
// 40类型 查看图片(旧的,可放弃)
function showModalImg(value,controlType,callback){
    // try{
    //     var pant=value.split("?")[1];
    //     var pants=pant.split("&");
    //     var pic={};
    //     for(var i=0;i<pants.length;i++){
    //         c=pants[i].split("=");
    //         pic[c[0]]=c[1];
    //     }
    //     var src="#";
    //     var results="";
    //     if(pic.oldgrid!=undefined){
    //        if(pic.oldgrid.indexOf('http')!=-1){   //判断http协议,有无地址
    //           results=pic.oldgrid.split(";")[1]; //显示网址图片
    //        }else{
    //           src = pic.oldgrid.replace(".do;",".do?type="+(controlType == 9?"1":"3")+"&uuid=");
    //           var picobj=pic.oldgrid.split(";");
    //           var unid=picobj[1];
    //           var seq=picobj[2];
    //           var fileExt=picobj[picobj.length-1];
    //           if(picobj.length>4){
    //                 fileExt="unknown";
    //             }
    //           if('jpge;jpg;png;gif'.indexOf(fileExt.toLowerCase())==-1){//不是图片后缀的
    //                 callback();//执行回调
    //               return true;//如果不是图片的后缀那就返回true xin 2021-7-15 10:11:50
    //             }
    //           if(seq!=null&&seq!=undefined&&seq!=""){
    //               unid=unid+"@p@"+seq;
    //             }
    //           results=getAttachmentUrl(pic.staticUrl,pic.formid,unid,pic.domain,pic.dbid,false,80,80,fileExt);
    //        }
    //     }else{
    //         return false;
    //     }
    //     $("#bimg").attr("src",results);
    //     document.getElementById("uploadForm").style.display="none";
    //     document.getElementById("bimg").style.display="inline-block";
    //     //AutoSize($("#bimg"),600,500);
    //     return true ;
    // }catch(e){alert(e);}
}
// 格线执行 附件 进入的函数,主要是9类型
// 格线执行 附件 进入的函数,主要是9类型(旧的,可以放弃)
function showModal(id,value){
    var controlType = 9 ;  // 专用于格线
    var readerUserCodes = $('#readerusercodes').val();
// 加载图片需要的属性
    var picupload={
        uploadUrl: '#',
        language: 'zh',
        uploadAsync: false,
        showUpload: true,
        showRemove: true,
        showCaption: true,
        showPreview: true,
        browseOnZoneClick: false,
        maxFileSize: 10000,   //文件最大不超过...kb
        showUploadedThumbs: true,
        maxFilesNum: 10,
        maxFileCount: 0,   // 为每个多次上载允许的最大文件数。如果设置为0,则意味着允许的文件数是无限的。默认值为0。
        isNine:false,
        validateInitialCount: false,   // 是否包括初始预览文件数(服务器上传文件)验证minfilecount和maxfilecount。默认为false.
        overwriteInitial: true,   // 是否要覆盖初始预览内容和标题设置
        previewSettings: {   // 设置显示的图片相同的宽度高度
            image: {width: "110px", height: "110px"},
        },
        initialPreview:[],   // 字符串或者数组,要显示的初始预览内容
        initialPreviewConfig:[],
        showPreview: true
    }
// 定义属性,拆分值
    document.getElementById("uploadForm").style.display="block";
    document.getElementById("bimg").style.display="none";
    picupload.initialPreview=[];
    var picPer=[];var authBtn='';
    var c;var unid;var seq;pic={};
    var pant=value.split("?")[1];
    var pants=pant.split("&");
    for(var i=0;i<pants.length;i++){
        c=pants[i].split("=");
        pic[c[0]]=c[1];
    }
    var encrypt = new JSEncrypt();
    encrypt.setPublicKey(rsakey.pubkey);
// 判断是否存在附件信息 unid有值才执行 by by danaus 2020/4/30 11:34
    //if ((pic.uuid != undefined&&pic.uuid != '')||(pic.oldgrid!=null && pic.oldgrid != undefined && pic.oldgrid != '') ) {   // pic.oldgrid!=null && pic.oldgrid != undefined && pic.oldgrid != ''
        var picpant={};
        try{// 赋值
            if((pic.uuid == undefined||pic.uuid == '')&&(pic.oldgrid!=null && pic.oldgrid != undefined && pic.oldgrid != ''))
            {
                var  unid = pic.oldgrid.split(';');
                pic['uuid'] =unid[0]+";"+unid[1];//uuid+seq
                if(unid.length==4 && unid[0].indexOf('.do')!=-1){
                    pic['uuid'] =unid[1]+";"+unid[2];//uuid+seq
                }
                // pic['seq'] = unid[1];
                picpant['unid']=pic['uuid'].replace("|48|48|","");
            }
            picpant['fieldid']=pic["fieldid"];
            picpant['controltype']=controlType;
            picpant['formid']=pic["formid"];
            picpant['ishd']=pic['ishd'];
            var strIs="";
            if(pic["is1"]!=undefined&&pic["is1"]!=""){
                strIs="&is1="+pic['is1']+"&ishd="+pic['ishd'];
            }else if(pic["is8"]!=undefined&&pic["is8"]!=""){
                strIs="&is8="+pic['is8']+"&ishd="+pic['ishd'];
            }else{
                strIs="&ishd="+pic['ishd'];
            }
            picpant['docstatus']=pic["docstatus"]==undefined?0:pic["docstatus"];
            picpant['rowid']=pic["rowid"];
            picpant['usercode']=pic["usercode"];
            picpant['doccode']=pic["doccode"];
            picpant['headflag']=(pic['ishd']==0)?1:0;
            try{
                if(picpant.doccode==undefined){
                    picpant['doccode']=$('#doccode').val();
                    if(picpant.doccode==undefined)
                        picpant.doccode=panMain[panIndex].panelAuditValue.doccode;
                }
                if (picpant['doccode']&&readerUserCodes!=undefined &&readerUserCodes!='') {
                    picpant['readerusercodes'] = readerUserCodes ;
                }
            }catch(e){
                picpant.doccode="";
            }
            try{
                var picpants = JSON.stringify(picpant);
            }catch(e){
                alert(e);
            }
            // 图片显示的方法
            $.ajax({url:'/attachment/getAttachmentList.do',
                type:"POST",
                async:false,
                data:{pant:picpants},
                dataType:'json',
                success :function(data) {
                    try {
                        var jsons = data;
                         if ((pic.uuid != undefined&&pic.uuid != '')||(pic.oldgrid!=null && pic.oldgrid != undefined && pic.oldgrid != '') ) {
                        for (var i = 0; i < jsons.length; i++) {
                            // 图片属性
                            if (picpant.usercode == "") {
                                picpant.usercode = jsons[i].userCode;
                            }
                            if (i == 0) {
                                picpant.username = jsons[i].userName;
                                picpant.dbid = jsons[i].dbid;
                                picpant.domain = jsons[i].domain;
                            }
                            var deleToken = 'type=' + (controlType == 9 ? '1' : '3') + '&formid=' + picpant.formid + '&doccode=' + picpant.doccode + '&fieldid=' + id + '&unid=' + jsons[i].unid + '&seq=' +
                                jsons[i].seq + '&docstatus=' + picpant.docstatus + '&ishd=' + picpant.ishd + '&usercode=' + encodeURIComponent(encrypt.encrypt(jsons[i].authorCode)) + '&readerusercodes=' + readerUserCodes + '&dbid=' + encodeURIComponent(encrypt.encrypt(jsons[i].dbid)) + '&curUsername=' + encodeURIComponent(encrypt.encrypt(jsons[i].userName)) + '&curUsercode=' + encodeURIComponent(encrypt.encrypt(jsons[i].userCode));
                            picupload.initialPreviewConfig.push({
                                'caption': jsons[i].originalFileName,   // 上传的图片名称
                                'filename': jsons[i].physicalFile,   // 上传文件名
                                'time': jsons[i].uploadTimeStr,  //上传开始时间
                                'name': jsons[i].authorName,  //作者名称
                                'size': jsons[i].fileSizeStr,   // 上传的图片大小
                                'type': jsons[i].fileType,   // 上传的图片类型
                                'key': jsons[i].seq,
                                'downloadUrl': jsons[i].domain + "/attachment/downLoadAttachment.do?filePath=" + getAttachmentUrl(jsons[i].staticUrl, jsons[i].formid, jsons[i].unid + "@p@" + jsons[i].seq, "", jsons[i].dbid, false, 60, 60, jsons[i].orgFileType, true),
                                'url': jsons[i].domain + '/attachment/deleteAttachmentV2.do?' + deleToken
                            });   // 附件删除路径
                            // 判断是否需要权限,如果要那么就加载权限按钮属性
                            if (jsons[i].authorCode != null && jsons[i].authorCode == picpant.usercode) {   // authorCode 作者
                                authBtn = '<a href="javascript:authorize(\'' + jsons[i].unid + '\',\'' + jsons[i].seq + '\');" ' +
                                    'class="btn btn-kv btn-default btn-outline-secondary" title="授权" style="padding: 0px;">' +
                                    '<i class="glyphicon glyphicon-lock" style="padding-top: 6px;"></i></a>';   // 授权按钮
                            }
                            // 添加图片权限
                            picPer.push({
                                key: jsons[i].seq, isAllowDelete: jsons[i].hasDelete, isAllowUpdate: jsons[i].hasUpdate,
                                isAllowDownload: jsons[i].hasDownload, authBtn: authBtn
                            });
                            // 图片
                            picupload.initialPreview.push('<img src="' + getAttachmentUrl(jsons[i].staticUrl, jsons[i].formid, jsons[i].unid + "@p@" + jsons[i].seq, jsons[i].domain, jsons[i].dbid, false, 60, 60, jsons[i].orgFileType) + '" style="height: 60px;" class="kv-preview-data file-preview-image" title="文件名:' + jsons[i].originalFileName + ' \n类型:' + jsons[i].fileType + ' \n大小:' + jsons[i].fileSizeStr + ' \n上传者:' + jsons[i].authorName + ' \n上传时间:' + jsons[i].uploadTimeStr + '">');
//                            picupload.initialPreview.push('<img src="'+jsons[i].domain+jsons[i].src+'" style="height: 60px;" class="kv-preview-data file-preview-image">');
                        }
                        var upToken = 'type=' + (controlType == 9 ? '1' : '3') + '&formid=' + picpant.formid
                            + '&doccode=' + picpant.doccode + '&fieldid=' + picpant.fieldid
                            + '&usercode=' + encodeURIComponent(encrypt.encrypt(picpant.usercode)) + '&username=' + encodeURIComponent(encrypt.encrypt(picpant.username)) + '&dbid=' + encodeURIComponent(encrypt.encrypt(picpant.dbid))
                            +strIs+'&rowid=' + picpant.rowid + '&uuid=' + (picpant.unid == undefined ? "" : picpant.unid);
                        picupload.uploadUrl = picpant.domain + '/attachment/uploadAttachmentV2.do?' + upToken; // 附件上传路径
                        // $('#'+id).val(pic.unid);
                        picupload.maxFileCount = 1;   // 为每个多次上载允许的最大文件数。如果设置为0,则意味着允许的文件数是无限的。默认值为0。
                        picupload.isNine = true;
                        picupload.validateInitialCount = true;   // 是否包括初始预览文件数(服务器上传文件)验证minfilecount和maxfilecount。默认为false.
                        picupload.overwriteInitial = false;   // 是否要覆盖初始预览内容和标题设置
                        $('#fileUpload_up').fileinput('destroy');   // 销毁文件输入控件并恢复到普通的本地文件输入
                        var uploadObj = $('#fileUpload_up').fileinput(picupload);   // 加载图片显示
                        others();
                        picBtn(picPer, picupload, pic["fieldid"]);   //picupload 控制审核后不能删除
                         }else{
                             picupload.maxFileSize=jsons[0].allowMaxFileSize;//从后台取数回来 by danaus 2020/8/7 10:47
                             picupload.initialPreviewConfig.push({
                                 'caption':'',   // 上传的图片名称
                                 'filename':'',   // 上传文件名
                                 'time':'',  //上传开始时间
                                 'name':'',  //作者名称
                                 'size':'',   // 上传的图片大小
                                 'type':'',   // 上传的图片类型
                                 'key':''
                             });
                             picupload.initialPreview=[];   // 字符串或者数组,要显示的初始预览内容
                             picupload.uploadUrl = pic.domain+'/attachment/uploadAttachmentV2.do?type='+(controlType == 9?'1':'3')+'&formid=' + pic.formid
                                 + '&doccode=' + pic.doccode + '&fieldid=' + pic.fieldid
                                 + '&usercode='+encodeURIComponent(encrypt.encrypt(pic.usercode))+'&username='+encodeURIComponent(encrypt.encrypt(pic.username))+'&dbid='+encodeURIComponent(encrypt.encrypt(pic.dbid))
                                 + strIs+'&rowid=' + pic.rowid + '&uuid=' + (pic.unid==undefined?"":pic.unid); // 附件上传路径
                             //$('#'+id).val(pic.unid);
                             picupload.maxFileCount=1;   // 为每个多次上载允许的最大文件数。如果设置为0,则意味着允许的文件数是无限的。默认值为0。
                             picupload.isNine=true;
                             picupload.validateInitialCount=true;   // 是否包括初始预览文件数(服务器上传文件)验证minfilecount和maxfilecount。默认为false.
                             picupload.overwriteInitial=false;   // 是否要覆盖初始预览内容和标题设置
                             $('#fileUpload_up').fileinput('destroy');   // 销毁文件输入控件并恢复到普通的本地文件输入
                             var uploadObj = $('#fileUpload_up').fileinput(picupload);   // 加载图片显示
                             others();
                             picBtn(picPer,picupload,id);   //picupload 控制审核后不能删除
                         }
                    } catch (e) {
                        console.log(e);
                        alert(e);
                    }
                }
            });
        }catch(e){alert(e);}
    // var controlType = 9;  // 专用于格线
    // var readerUserCodes = $('#readerusercodes').val();
    // // 加载图片需要的属性(固定ID)
    // let fileInput = BootstrapFileInputOption('fileUpload');
    // // 定义属性,拆分值
    // document.getElementById("uploadForm").style.display = "block";
    // document.getElementById("bimg").style.display = "none";
    // var picPer = [];
    // var authBtn = '';
    // var c;
    // var unid;
    // var seq;
    // pic = {};
    // var pant = value.split("?")[1];
    // var pants = pant.split("&");
    // for (var i = 0; i < pants.length; i++) {
    //     c = pants[i].split("=");
    //     pic[c[0]] = c[1];
    // }
    // var encrypt = new JSEncrypt();
    // encrypt.setPublicKey(rsakey.pubkey);
    // var picpant = {};
    // try {// 赋值
    //     if ((pic.uuid == undefined || pic.uuid == '') && (pic.oldgrid != null &&
    //         pic.oldgrid != undefined && pic.oldgrid != '')) {
    //         var unid = pic.oldgrid.split(';');
    //         pic['uuid'] = unid[0] + ";" + unid[1];//uuid+seq
    //         if (unid.length >= 4 && unid[0].indexOf('.do') != -1) {
    //             if (unid.length > 4) {
    //                 if (unid[unid.length - 2] != null && !isNaN(unid[unid.length - 2])) {
    //                     controlType = 19;//存在多个seq,表示是多附件
    //                 }
    //             }
    //             pic['uuid'] = unid[1] + ";" + unid[2];//uuid+seq
    //         }
    //         picpant['unid'] = pic['uuid'].replace("|48|48|", "");
    //     }
    //     picpant['fieldid'] = pic["fieldid"];
    //     picpant['controltype'] = controlType;
    //     picpant['formid'] = pic["formid"];
    //
    //     picpant['ishd'] = pic['ishd'];
    //     var strIs = "";
    //     if (pic["is1"] != undefined && pic["is1"] != "") {
    //         strIs = "&is1=" + pic['is1'] + "&ishd=" + pic['ishd'];
    //     } else if (pic["is8"] != undefined && pic["is8"] != "") {
    //         strIs = "&is8=" + pic['is8'] + "&ishd=" + pic['ishd'];
    //     } else {
    //         strIs = "&ishd=" + pic['ishd'];
    //     }
    //     picpant['docstatus'] = pic["docstatus"] == undefined ? 0 : pic["docstatus"];
    //     picpant['rowid'] = pic["rowid"];
    //     picpant['usercode'] = pic["usercode"];
    //     picpant['doccode'] = pic["doccode"];
    //     picpant['headflag'] = (pic['ishd'] == 0) ? 1 : 0;
    //     try {
    //         if (picpant.doccode == undefined) {
    //             picpant['doccode'] = $('#doccode').val();
    //             if (picpant.doccode == undefined)
    //                 picpant.doccode = panMain[panIndex].panelAuditValue.doccode;
    //         }
    //         if (picpant['doccode'] && readerUserCodes != undefined && readerUserCodes != '') {
    //             picpant['readerusercodes'] = readerUserCodes;
    //         }
    //     } catch (e) {
    //         picpant.doccode = "";
    //     }
    //     try {
    //         var picpants = JSON.stringify(picpant);
    //     } catch (e) {
    //         alert(e);
    //     }
    //     // 图片显示的方法
    //     $.ajax({
    //         url: '/attachment/getAttachmentList.do',
    //         type: "POST",
    //         async: false,
    //         data: {pant: picpants},
    //         dataType: 'json',
    //         success: function (data) {
    //             try {
    //                 var jsons = data;
    //                 if ((pic.uuid != undefined && pic.uuid != '') || (pic.oldgrid != null &&
    //                     pic.oldgrid != undefined && pic.oldgrid != '')) {
    //                     for (var i = 0; i < jsons.length; i++) {
    //                         // 图片属性
    //                         if (picpant.usercode == "") {
    //                             picpant.usercode = jsons[i].userCode;
    //                         }
    //                         if (i == 0) {
    //                             picpant.username = jsons[i].userName;
    //                             picpant.dbid = jsons[i].dbid;
    //                             picpant.domain = jsons[i].domain;
    //                         }
    //                         var deleToken = 'type=' + (controlType == 9 ? '1' : '3') + '&formid=' + picpant.formid + '&doccode=' + picpant.doccode + '&fieldid=' + id + '&unid=' + jsons[i].unid + '&seq=' +
    //                             jsons[i].seq + '&docstatus=' + picpant.docstatus + '&ishd=' + picpant.ishd + '&usercode=' + encodeURIComponent(encrypt.encrypt(jsons[i].authorCode)) + '&readerusercodes=' + readerUserCodes + '&dbid=' + encodeURIComponent(encrypt.encrypt(jsons[i].dbid)) + '&curUsername=' + encodeURIComponent(encrypt.encrypt(jsons[i].userName)) + '&curUsercode=' + encodeURIComponent(encrypt.encrypt(jsons[i].userCode));
    //                         fileInput.option.initialPreviewConfig.push({
    //                             'caption': jsons[i].originalFileName,   // 上传的图片名称
    //                             'filename': jsons[i].physicalFile,   // 上传文件名
    //                             'time': jsons[i].uploadTimeStr,  //上传开始时间
    //                             'name': jsons[i].authorName,  //作者名称
    //                             'size': jsons[i].fileSizeStr,   // 上传的图片大小
    //                             'type': jsons[i].fileType,   // 上传的图片类型
    //                             'key': jsons[i].unid +';'+jsons[i].seq,
    //                             'downloadUrl': jsons[i].domain + "/attachment/downLoadAttachment.do?filePath=" + getAttachmentUrl(jsons[i].staticUrl, jsons[i].formid, jsons[i].unid + "@p@" + jsons[i].seq, "", jsons[i].dbid, false, 60, 60, jsons[i].orgFileType, true),
    //                             'url': jsons[i].domain + '/attachment/deleteAttachmentV2.do?' + deleToken
    //                         });   // 附件删除路径
    //
    //                         // 判断是否需要权限,如果要那么就加载权限按钮属性
    //                         if (jsons[i].authorCode != null && jsons[i].authorCode == picpant.usercode) {   // authorCode 作者
    //                             authBtn = '<a href="javascript:authorize(\'' + jsons[i].unid + '\',\'' + jsons[i].seq + '\');" ' +
    //                                 'class="btn btn-kv btn-default btn-outline-secondary" title="授权" style="padding: 0px;">' +
    //                                 '<i class="glyphicon glyphicon-lock" style="padding-top: 6px;"></i></a>';   // 授权按钮
    //                         }
    //                         // 添加图片权限
    //                         picPer.push({
    //                             key: jsons[i].seq, isAllowDelete: jsons[i].hasDelete, isAllowUpdate: jsons[i].hasUpdate,
    //                             isAllowDownload: jsons[i].hasDownload, authBtn: authBtn
    //                         });
    //                         // 图片
    //                         let t='文件名:' + jsons[i].originalFileName +
    //                                   ' \n类型:' + jsons[i].fileType +
    //                                   ' \n大小:' + jsons[i].fileSizeStr +
    //                                   ' \n上传者:' + jsons[i].authorName +
    //                                   ' \n上传时间:' + jsons[i].uploadTimeStr ;
    //                         // let img='<img src="' + getAttachmentUrl(jsons[i].staticUrl, jsons[i].formid,
    //                         //     jsons[i].unid + "@p@" + jsons[i].seq, jsons[i].domain, jsons[i].dbid,
    //                         //     false, 60, 60, jsons[i].orgFileType) + '" ' +
    //                         //     'style="height: 60px;" class="kv-preview-data file-preview-image" title='+t+'>';
    //                         let img=getAttachmentUrl(jsons[i].staticUrl, jsons[i].formid,
    //                                 jsons[i].unid + "@p@" + jsons[i].seq, jsons[i].domain, jsons[i].dbid,
    //                                 false, 60, 60, jsons[i].orgFileType);
    //                         fileInput.option.initialPreview.push(img);
    //                     }
    //                     var upToken = 'type=' + (controlType == 9 ? '1' : '3') + '&formid=' + picpant.formid
    //                         + '&doccode=' + picpant.doccode + '&fieldid=' + picpant.fieldid
    //                         + '&usercode=' + encodeURIComponent(encrypt.encrypt(picpant.usercode)) + '&username=' + encodeURIComponent(encrypt.encrypt(picpant.username)) + '&dbid=' + encodeURIComponent(encrypt.encrypt(picpant.dbid))
    //                         + strIs + '&rowid=' + picpant.rowid + '&uuid=' + (picpant.unid == undefined ? "" : picpant.unid);
    //                     fileInput.option.uploadUrl = picpant.domain + '/attachment/uploadAttachmentV2.do?' + upToken; // 附件上传路径
    //                     // $('#'+id).val(pic.unid);
    //                     fileInput.option.otherActionButtons='';
    //                     fileInput.option.maxFileCount = 1;   // 为每个多次上载允许的最大文件数。如果设置为0,则意味着允许的文件数是无限的。默认值为0。
    //                     fileInput.option.isNine = true;
    //                     fileInput.option.validateInitialCount = true;   // 是否包括初始预览文件数(服务器上传文件)验证minfilecount和maxfilecount。默认为false.
    //                     fileInput.option.overwriteInitial = false;   // 是否要覆盖初始预览内容和标题设置
    //                 } else {
    //                     fileInput.option.maxFileSize = jsons[0].allowMaxFileSize;//从后台取数回来 by danaus 2020/8/7 10:47
    //                     fileInput.option.initialPreviewConfig.push({
    //                         'caption': '',   // 上传的图片名称
    //                         'filename': '',   // 上传文件名
    //                         'time': '',  //上传开始时间
    //                         'name': '',  //作者名称
    //                         'size': '',   // 上传的图片大小
    //                         'type': '',   // 上传的图片类型
    //                         'key': ''
    //                     });
    //                      fileInput.option.uploadUrl = pic.domain + '/attachment/uploadAttachmentV2.do?type=' + (controlType == 9 ? '1' : '3') + '&formid=' + pic.formid
    //                         + '&doccode=' + pic.doccode + '&fieldid=' + pic.fieldid
    //                         + '&usercode=' + encodeURIComponent(encrypt.encrypt(pic.usercode)) + '&username=' + encodeURIComponent(encrypt.encrypt(pic.username)) + '&dbid=' + encodeURIComponent(encrypt.encrypt(pic.dbid))
    //                         + strIs + '&rowid=' + pic.rowid + '&uuid=' + (pic.unid == undefined ? "" : pic.unid); // 附件上传路径
    //                     fileInput.option.maxFileCount = 1;   // 为每个多次上载允许的最大文件数。如果设置为0,则意味着允许的文件数是无限的。默认值为0。
    //                     fileInput.option.isNine = true;
    //                     fileInput.option.validateInitialCount = true;   // 是否包括初始预览文件数(服务器上传文件)验证minfilecount和maxfilecount。默认为false.
    //                     fileInput.option.overwriteInitial = false;   // 是否要覆盖初始预览内容和标题设置
    //                 }
    //                 fileInput.destroy();// 销毁文件输入控件并恢复到普通的本地文件输入
    //                 fileInput.fileInput();// 加载图片显示
    //                 // others();
    //                 // picBtn(picPer, fileInput.option, id);   //fileInput.option 控制审核后不能删除
    //             } catch (e) {
    //                 alert(e);
    //             }
    //         }
    //     });
    // } catch (e) {
    //     alert(e);
    // }
}
var uploadKey=[];
//图片上传触发事件
function picevent(id,isGrid,obj){
    if(typeof(myFresh)=="undefined") myFresh={};
    myFresh.mygrid=obj;
    $('#'+id+'_up').on('fileuploaderror', function(event, data, msg) {
        var temp=data;
    }).on('filesuccessremove', function(event, id) {   // 使用缩略图删除按钮删除成功上传的缩略图后,会触发此事件
       var unid=$('#'+id ).find("img").attr("unid");
       var val=JSON.parse(unid);
       var uuid=val.key.split(";")[0];
        var seq=val.key.split(";")[1];
      $.ajax({
          type:"POST",
         dataType:'json',
          url:'/attachment/deleteOwnerAttachment.do?type='+val.type+'&unid='+uuid+'&seq='+seq,   // 删除路径
            success: function(data){
                var newUid=val.oldKey==""?"":val.oldKey.replace(";"+seq,"");
                $('#'+val.filedId).val(newUid);
            }
      });
//       $.each(uploadKey,function(i,val) {
//          if(val.md5==img_md5){
//             var uuid=val.key.split(";")[0];
//             var seq=val.key.split(";")[1];
//             $.ajax({
//                 type:"POST",
//                dataType:'json',
//                 url:'/attachment/deleteOwnerAttachment.do?type='+val.type+'&unid='+uuid+'&seq='+seq,   // 删除路径
//                    success: function(data){
//                        var newUid=val.oldKey==""?"":val.oldKey.replace(";"+seq,"");
//                        $('#'+val.filedId).val(newUid);
//                    }
//             });
    //绑定事件 xin 2022-2-26 10:06:25
    BootstrapFileInputOption(id).events(isGrid,obj);
//     if(typeof(myFresh)=="undefined") myFresh={};
//     myFresh.mygrid=obj;
//     $('#'+id+'_up').on('fileuploaderror', function(event, data, msg) {
//         var temp=data;
//
//     }).on('filesuccessremove', function(event, id) {   // 使用缩略图删除按钮删除成功上传的缩略图后,会触发此事件
//        var unid=$('#'+id ).find("img").attr("unid");
//        var val=JSON.parse(unid);
//        var uuid=val.key.split(";")[0];
//         var seq=val.key.split(";")[1];
//       $.ajax({
//           type:"POST",
//          dataType:'json',
//           url:'/attachment/deleteOwnerAttachment.do?type='+val.type+'&unid='+uuid+'&seq='+seq,   // 删除路径
//             success: function(data){
//                 var newUid=val.oldKey==""?"":val.oldKey.replace(";"+seq,"");
//                 $('#'+val.filedId).val(newUid);
//             }
//       });
// //       $.each(uploadKey,function(i,val) {
// //          if(val.md5==img_md5){
// //             var uuid=val.key.split(";")[0];
// //             var seq=val.key.split(";")[1];
// //             $.ajax({
// //                 type:"POST",
// //                dataType:'json',
// //                 url:'/attachment/deleteOwnerAttachment.do?type='+val.type+'&unid='+uuid+'&seq='+seq,   // 删除路径
// //                    success: function(data){
// //                        var newUid=val.oldKey==""?"":val.oldKey.replace(";"+seq,"");
// //                        $('#'+val.filedId).val(newUid);
// //                    }
// //             });
// //            }
// //       });
//
//     }).on('filepredelete', function(event, params) {   // 在删除initialPreview内容集中的每个缩略图文件之前触发此事件
//        event.stopImmediatePropagation();
//        if(!confirm("您确定要删除吗?")){
//           //处理不删除图片操作
//           return false;
//        }
//
//     }).on('filedeleted', function(event, key) {   // 在删除initialPreview内容集中的每个缩略图文件之后触发此事件
//         if(isGrid=='grid'){   // 格线
//             try{
//                 if(myFresh.mygrid){
//                     var grid=myFresh.mygrid.id;
//                     var obj="";
//                     grid.SetValue(myFresh.mygrid.row, myFresh.mygrid.col,obj,0);
//                     grid.RefreshCell(myFresh.mygrid.row, myFresh.mygrid.col);
//                 }
//             }catch(e){alert(e);}
//         }else{   // 面板
//             var va =$('#'+id).val();
//             va = va.replace(";"+key,"");
//             if(va.indexOf(";")<0) va="";
//             $('#'+id).val(va);
//             panMain[panIndex].isChange =1;  //解决110101上传后删除附件不成功,而出现多个序号的问题
//         }
//         $('#'+id+'_up').fileinput({uuidkey:key});
//
//     }).on('filebatchuploadsuccess', function(event, data, previewId, index) {   // 此事件仅在ajax上传且文件批量上传成功之后触发
//        // get_filemd5sum(data,id);
//        // console.log("tmp.md5:"+tmp.md5);
//         // tmp.md5=$.md5(data.reader.result);
//        var tmp={};
//        var oldKey=$('#'+id).val();   // 旧的值
//         var 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.type=data.response.type;
//         tmp.filedId=id;
//         tmp.oldKey=oldKey;
//        var unid = data.response.uuid?data.response.uuid:"";
//        data.thumb.find("img").attr("unid",JSON.stringify(tmp));
//           this.uuidkey = unid;
//           $('#'+id).val(unid);
//            if(myFresh.mygrid){   // 格线
//                var grid=myFresh.mygrid.id;
//                var obj=unid+";"+data.response.fileType;// by by danaus 2020/4/30 11:32
//                grid.SetValue(myFresh.mygrid.row, myFresh.mygrid.col,obj,0);
//                grid.RefreshCell(myFresh.mygrid.row, myFresh.mygrid.col);
//            }
//       });
    }).on('filepredelete', function(event, params) {   // 在删除initialPreview内容集中的每个缩略图文件之前触发此事件
       event.stopImmediatePropagation();
       if(!confirm("您确定要删除吗?")){
          //处理不删除图片操作
          return false;
       }
    }).on('filedeleted', function(event, key) {   // 在删除initialPreview内容集中的每个缩略图文件之后触发此事件
        if(isGrid=='grid'){   // 格线
            try{
                if(myFresh.mygrid){
                    var grid=myFresh.mygrid.id;
                    var obj="";
                    grid.SetValue(myFresh.mygrid.row, myFresh.mygrid.col,obj,0);
                    grid.RefreshCell(myFresh.mygrid.row, myFresh.mygrid.col);
                }
            }catch(e){alert(e);}
        }else{   // 面板
            var va =$('#'+id).val();
            va = va.replace(";"+key,"");
            if(va.indexOf(";")<0) va="";
            $('#'+id).val(va);
            panMain[panIndex].isChange =1;  //解决110101上传后删除附件不成功,而出现多个序号的问题
        }
        $('#'+id+'_up').fileinput({uuidkey:key});
    }).on('filebatchuploadsuccess', function(event, data, previewId, index) {   // 此事件仅在ajax上传且文件批量上传成功之后触发
       // get_filemd5sum(data,id);
       // console.log("tmp.md5:"+tmp.md5);
        // tmp.md5=$.md5(data.reader.result);
       var tmp={};
       var oldKey=$('#'+id).val();   // 旧的值
        var 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.type=data.response.type;
        tmp.filedId=id;
        tmp.oldKey=oldKey;
       var unid = data.response.uuid?data.response.uuid:"";
       data.thumb.find("img").attr("unid",JSON.stringify(tmp));
          this.uuidkey = unid;
          $('#'+id).val(unid);
           if(myFresh.mygrid){   // 格线
               var grid=myFresh.mygrid.id;
               var obj=unid+";"+data.response.fileType;// by by danaus 2020/4/30 11:32
               grid.SetValue(myFresh.mygrid.row, myFresh.mygrid.col,obj,0);
               grid.RefreshCell(myFresh.mygrid.row, myFresh.mygrid.col);
           }
    }).on('filebatchuploadcomplete', function(event, files, extra) {   // 此事件仅对于ajax上传且完成同步或异步ajax批量上传后触发
       console.log(event);
        console.log('File batch upload complete');
    }).on("filebatchselected", function(event, files) {   // 在预览中选择并显示一批文件后触发此事件
       if(myFresh.mygrid){   // 格线
          $('#'+id+'_up').fileinput('upload');
       }
       else{
          upSub(id);   // 触发修改(面板有内容改动)
          $('#'+id+'_up').fileinput('upload',{uuidurl:$('#'+id).val()});   // 触发所选文件的ajax上传。仅适用于uploadUrl已设置的情况。此方法将文件输入元素作为jQuery对象返回,因此可以链式调用其他方法。
       }
    }).on('filezoomshown', function(event, params) {   // 在模态框已被用户看到之后触发此事件(将等待CSS转换完成)
        $(".modal-backdrop").attr("class", "");
        $(".modal-content").css( "zIndex", 999999);
    }).on('filebrowse', function(event) {   // 单击文件浏览按钮以打开文件选择对话框时触发此事件
        try{
            if(typeof(fileupload_config)=="undefined"){
                if(myFresh.mygrid){
                    var grid=myFresh.mygrid.id;
                    if(grid.Cols[myFresh.mygrid.col].CanEdit==0){
                        event.preventDefault=false;
                        return false;
                    }
                }
            }else{
                if(!fileupload_config.browseOnZoneClick){
//                  if(typeof(event.preventDefault)!=="function")
                   event.preventDefault();
//                   event.preventDefault=false;
//                  return false;
                }
            }
        }catch(e){
            alert(e);
        }
    }).on('fileuploaderror', function(event, data, msg) {   // 此事件仅在ajax上传时触发,并且主要针对ajax上传时遇到上载或文件输入验证错误
        var form = data.form, files = data.files, extra = data.extra,
            response = data.response, reader = data.reader;
    });
//
//     }).on('filebatchuploadcomplete', function(event, files, extra) {   // 此事件仅对于ajax上传且完成同步或异步ajax批量上传后触发
//        console.log(event);
//         console.log('File batch upload complete');
//
//     }).on("filebatchselected", function(event, files) {   // 在预览中选择并显示一批文件后触发此事件
//        if(myFresh.mygrid){   // 格线
//           $('#'+id+'_up').fileinput('upload');
//        }
//        else{
//           upSub(id);   // 触发修改(面板有内容改动)
//           $('#'+id+'_up').fileinput('upload',{uuidurl:$('#'+id).val()});   // 触发所选文件的ajax上传。仅适用于uploadUrl已设置的情况。此方法将文件输入元素作为jQuery对象返回,因此可以链式调用其他方法。
//        }
//
//     // }).on('filezoomshow', function(event, params) {   // 当单击缩放按钮以在模式对话框中显示内容详细预览时触发此事件。以下参数将另外作为一个 JSON 对象发送,其键是。
//     //     let modeal=params.modal.find(".file-zoom-content").find("object");
//     //     if(modeal!=null && modeal.length>0){
//     //         modeal.show();
//     //         params.modal.find(".file-zoom-content").find("img").hide();
//     //     }
//     }).on('filezoomshown', function(event, params) {   // 在模态框已被用户看到之后触发此事件(将等待CSS转换完成)
//         $(".modal-backdrop").attr("class", "");
//         $(".modal-content").css( "zIndex", 999999);
//
//     }).on('filebrowse', function(event) {   // 单击文件浏览按钮以打开文件选择对话框时触发此事件
//         try{
//             if(typeof(fileupload_config)=="undefined"){
//                 if(myFresh.mygrid){
//                     var grid=myFresh.mygrid.id;
//                     if(grid.Cols[myFresh.mygrid.col].CanEdit==0){
//                         event.preventDefault=false;
//                         return false;
//                     }
//                 }
//             }else{
//                 if(!fileupload_config.browseOnZoneClick){
// //                  if(typeof(event.preventDefault)!=="function")
//                    event.preventDefault();
// //                   event.preventDefault=false;
// //                  return false;
//                 }
//             }
//         }catch(e){
//             alert(e);
//         }
//
//     }).on('fileuploaderror', function(event, data, msg) {   // 此事件仅在ajax上传时触发,并且主要针对ajax上传时遇到上载或文件输入验证错误
//         var form = data.form, files = data.files, extra = data.extra,
//             response = data.response, reader = data.reader;
//     });
}
function get_filemd5sum(data, id) {
@@ -961,7 +988,7 @@
   } catch (e) {
      alert(e);
   }
}
function getReturnValue(str) {
   if (window.ActiveXObject) { // IE
@@ -977,38 +1004,48 @@
// 9 ,19控件授权
function authorize(unid,seq){
    parent.addTab('',9763,10,'wherePan=unid=\''+unid+'\' and seq='+seq);
    // parent.addTab('',9763,10,'wherePan=unid=\''+unid+'\' and seq='+seq);
}
function mylockFile(e){
    let u = $(e).data("key");
    if (u != null) {
        let s = u.split(";");
        if (s.length == 2) {
            parent.addTab('', 9763, 10, 'wherePan=unid=\'' + s[0] + '\' and seq=' + s[1]);
            layer.closeAll();
        }
    }
}
// 权限按钮属性显示
function picBtn(picPer,uploadObj,fieldid) {
   var findObj = "#uploadDiv_"+ fieldid + " .kv-file-remove" ;
   var delBtn = $(findObj); // 删除
   for (var i = 0; i < delBtn.length; i++) {
      var dataKey = $(delBtn[i]).attr("data-key");
      for (var j = 0; j < picPer.length; j++) {
         if ((dataKey == picPer[j].key && !picPer[j].isAllowDelete )
               ||uploadObj.browseOnZoneClick) {   //控制删除按钮在最终审核后,所有人都不能进行删除
            $(delBtn[i]).hide();
         }
      }
   }
   var downBtn = $(".glyphicon-download"); // 下载
   for (var i = 0; i < downBtn.length; i++) {
      var a = $(downBtn[i]).parent();
      var href = $(a).attr("href");
      if (href == null)
         continue;
      for (var j = 0; j < picPer.length; j++) {
         if (href.indexOf(";" + picPer[j].key) >= 0) {
            if (!picPer[j].isAllowDownload ) {
               $(a).hide();
            }
            if (picPer[j].authBtn != "") {
               $(a).before(picPer[j].authBtn)
            }
         }
      }
   }
    // var findObj = "#uploadDiv_" + fieldid + " .kv-file-remove";
    // var delBtn = $(findObj); // 删除
    // for (var i = 0; i < delBtn.length; i++) {
    //     var dataKey = $(delBtn[i]).attr("data-key");
    //     for (var j = 0; j < picPer.length; j++) {
    //         if ((dataKey == picPer[j].key && !picPer[j].isAllowDelete)
    //             || !uploadObj.browseOnZoneClick) {   //控制删除按钮在最终审核后,所有人都不能进行删除
    //             $(delBtn[i]).hide();
    //         }
    //     }
    // }
    // var downBtn = $(".glyphicon-download"); // 下载
    // for (var i = 0; i < downBtn.length; i++) {
    //     var a = $(downBtn[i]).parent();
    //     var href = $(a).attr("href");
    //     if (href == null)
    //         continue;
    //     for (var j = 0; j < picPer.length; j++) {
    //         if (href.indexOf(";" + picPer[j].key) >= 0) {
    //             if (!picPer[j].isAllowDownload) {
    //                 $(a).hide();
    //             }
    //             if (picPer[j].authBtn != "") {
    //                 $(a).before(picPer[j].authBtn)
    //             }
    //         }
    //     }
    // }
}
function openNewDoc() {
    var flag = checkSession();// session失效后弹出登录框,flag为true时表示已经失效
@@ -1218,11 +1255,11 @@
        $.messager.confirm('提示', mes, function(r) {
            if (r) {
                funcLink$(f, t, sfs, lfs, lk, sd, ld, isp, ef, ref, clo,
                    autoSave,sortid,messageTip);
                $('.panel-tool-close').show();
                    autoSave, sortid, messageTip, mes);
                $('.panel-tool-close').show();
            }else {
               closeLoading(); //更新客户状态的取消
               $('.panel-tool-close').show();
               $('.panel-tool-close').show();
            }
        }, "warning");
        $('.panel-tool-close').hide(); //取消更新客户状态的弹出框红叉      yang 2020-04-26
@@ -1240,33 +1277,34 @@
    //moreWindowClose(); // 2、3类型更多按钮的关闭事件
}
function funcLink$(f, t, sfs, lfs, lk, sd, ld, isp, ef, ref, clo, autoSave,sortid,messageTip) {
function funcLink$(f, t, sfs, lfs, lk, sd, ld, isp, ef, ref, clo, autoSave, sortid, messageTip, mes) {
    if (isp && isp == "1") {
        showPwd(f, t, function() {
            funcLink$$(f, t, sfs, lfs, lk, sd, ld, ef, ref, clo, autoSave,sortid,messageTip);
        showPwd(f, t, function () {
            funcLink$$(f, t, sfs, lfs, lk, sd, ld, ef, ref, clo, autoSave, sortid, messageTip, mes);
        });
    } else {
        funcLink$$(f, t, sfs, lfs, lk, sd, ld, ef, ref, clo, autoSave,sortid,messageTip);
        funcLink$$(f, t, sfs, lfs, lk, sd, ld, ef, ref, clo, autoSave, sortid, messageTip, mes);
    }
}
var savedExecFunclink;
function funcLink$$(f, t, sfs, lfs, lk, sd, ld, ef, ref, clo, autoSave,sortid,messageTip) {
function funcLink$$(f, t, sfs, lfs, lk, sd, ld, ef, ref, clo, autoSave, sortid, messageTip, mes) {
    savedExecFunclink = null;
    if (t == "22") {
        // autoSave=='1'是要先执行保存
        if (typeof (autoSave) != 'undefined' && '1' == autoSave) {
            var param = arguments;
            if(typeof (sortid) != 'undefined'&&(formType == "16"||formType == "5")){
                savedFunclink16=param[0]+";"+param[1]+";"+sortid+";taobao";
            if (typeof (sortid) != 'undefined' && (formType == "16" || formType == "5")) {
                savedFunclink16 = param[0] + ";" + param[1] + ";" + sortid + ";taobao";
                save(2);
            }else{
                savedExecFunclink = $(function(){
            } else {
                savedExecFunclink = $(function () {
                    execProc(param[0], param[1], param[2], param[3], param[4],
                        param[8], param[9],messageTip);
                        param[8], param[9], messageTip, mes);
                });
            }
        } else {
            execProc(f, t, sfs, lfs, lk, ref, clo,messageTip);
            execProc(f, t, sfs, lfs, lk, ref, clo, messageTip, mes);
        }
    } else {
        // autoSave=='1'是要先执行保存
@@ -1311,7 +1349,11 @@
    var num=0;
    if (typeof (mygrid) != "undefined") {
        rows=mygrid.getFieldForNew();
        num=rows.length;
        if(rows.length==0){
            num=1;
        }else {
            num = rows.length;
        }
    }else{ // 没格线则取0;
        num=1;
    }
@@ -1329,11 +1371,30 @@
                    temp=sfs[i];
                }
            }else{ // end
                var key=sfs[i].toLowerCase();
                var key = sfs[i].toLowerCase();
                if (typeof (mygrid) != "undefined") {
                    prossDate(key, mygrid, rows, k);
                }
                temp = getValue(key,null,rows[k]);
                temp = getValue(key, null, rows[k]);
                if(typeof temp!="string"&&typeof temp!="number"&& temp==false){
                    closeLoading();
                    return;
                }
                if(typeof panMain !="undefined") {
                    let info = panMain[panIndex].panInfo;
                    if (info != null) {
                        if (info[key] != null && info[key].controltype == 43) {
                            temp = $("#" + key).val();
                            if (temp != null && temp != "") {
                                if (temp instanceof Array) {
                                    temp = temp.join(";");
                                }
                            } else {
                                temp = "";
                            }
                        }
                    }
                }
            }
            if (temp == undefined || temp == null) {
                temp = sfs[i];
@@ -1370,16 +1431,20 @@
}
var execParams = []; // 22窗体传值 lk表示是否打开界面或弹出层
function execProc(f, ft, sfs, lfs, lk, ref, clo,exec) { // 储存过程
function execProc(f, ft, sfs, lfs, lk, ref, clo, exec, mes) { // 储存过程
    var paramVa = "";
    var t = null;
    var rows=[];
    var num=0;
    var rows = [];
    var num = 0;
    if (typeof (mygrid) != "undefined") {
        rows=mygrid.getFieldForNew();
        num=rows.length;
    }else{ // 没格线则取0;
        num=1;
        rows = mygrid.getFieldForNew();
        if(rows.length==0){
            num=1;
        }else {
            num = rows.length;
        }
    } else { // 没格线则取0;
        num = 1;
    }
    var sp=";";
    for(var s=0;s<sfs.length;s++){
@@ -1407,6 +1472,11 @@
                }
            }catch(e){}
            t = getValue(key,null,rows[k]);
            if(typeof t!="string"&&typeof t!="number"&&t==false){
                //没选中格线行数据,返回不执行
                closeLoading();
                return;
            }
            if (t==null||t=="null")
                t = sfs[i];
            if(isNaN(t)&&t.indexOf(";")>0){ // 当内容存在;情况,需要替换 by danaus
@@ -1435,15 +1505,54 @@
    }
    paramVa=st;
    if (lk == "1") { // 直接执行存储过程
       //注释,执行自定义.do在后台执行,不需要在这里处理 xin 2020-5-14 11:01:40
        exec=((exec!=undefined&&exec.indexOf(".do")!=-1)?exec:"/execProc.do");
        $.post(exec, {
            "formid" :f,
            "param" :paramVa,
            "disableDuplicateSubmitUUID":systemUuid.uuid //by danaus 2019/11/22 11:12
        }, function(data) {
        //注释,执行自定义.do在后台执行,不需要在这里处理 xin 2020-5-14 11:01:40
        exec = ((exec != undefined && exec.indexOf(".do") != -1) ? exec : "/execProcV2.do");///execProc.do
        /*
                $.post(exec, {
                    "formid" :f,
                    "param" :paramVa,
                    "disableDuplicateSubmitUUID":systemUuid.uuid //by danaus 2019/11/22 11:12
                }, function(data) {
                        procCallBack(data, ref, clo);
                });
        */
        $.ajax({
            type: 'post',
            url: exec,
            data: {
                "formid": f,
                "param": paramVa,
                "disableDuplicateSubmitUUID": systemUuid.uuid //by danaus 2019/11/22 11:12
            },
            beforeSend: function (XMLHttpRequest) {
                //ShowLoading();
                if (mes != null && mes != "" && $.messager.progress != undefined) {
                    $.messager.progress({
                        title: '提示',
                        msg: '处理数据',
                        text: '努力中...',
                        interval: '300'
                    });
                }
            },
            success: function (data, textStatus) {
                procCallBack(data, ref, clo);
                if (mes != null && mes != "") {
                    $.messager.progress('close');
                }
            },
            complete: function (XMLHttpRequest, textStatus) {
                // $.messager.progress('close');
            },
            error: function () {
                //请求出错处理
                if (mes != null && mes != "") {
                    $.messager.progress('close');
                }
            }
        });
    } else {
        var stemp=paramVa.split("こ");
        var values =stemp[0].split(sp); // 只取第一个,因为新实现已可以选多行传值, paramVa.split(";");// 通过功能连接打开22类型直接通过execParams数组赋值
@@ -1478,68 +1587,144 @@
    closeLoading();
}
function procCallBack(data, ref, clo) {
    if (data == null || data == "") {// 什么也没返回
        $.messager.alert('提示', "进程处理完毕.", "info", function()
            {
    if (data.state != null && data.state == 0) {
        refreshOrClose(ref, clo);
        let info = data.data;
        if (info == null) {
            $.messager.alert('提示', '返回错误:' + info, "info");
            return;
        }
        let doc = info.linkdocinfo;
        let msg = info.memo;
        if (doc == null || doc == '') {
            $.messager.alert('提示', msg || '进程处理完毕', "info", function () {
                if (typeof (savedExecFunclink) == "function") {
                    location.reload();
                }
                refreshOrClose(ref, clo);
            }
        );
            });
            return;
        }
        if (msg != null && msg != '') {
            $.messager.alert('提示', msg, "info", function () {
                redirect(doc);
            });
            return;
        }
        redirect(doc);
    } else if (data.state != null && data.state == -1) {
        let msg = data.error || data.msg;
        if (data.data != null && data.data.isuuid) {
            $.messager.show({
                title: '提示',
                msg: msg,
                showType: 'show',
                //timeout:3,
                style: {
                    right: '',
                    top: document.body.scrollTop + document.documentElement.scrollTop,
                    bottom: ''
                }
            });
            return;
        }
        $.messager.alert('提示', msg || '出现错误', "info");
    } else {
        try {
            if(data.replace(/\s+/g,"")==="(null)"){
                $.messager.alert('提示', data, "info");
                return;
            }else{
                data = JSON.parse(data);
            if((data.msg!=undefined&&data.msg=="")&&(data.data==undefined||data.data=="")){
                $.messager.alert('提示', "进程处理完毕.", "info", function()
                    {
                        if (typeof (savedExecFunclink) == "function") {
                            location.reload();
                        }
                        refreshOrClose(ref, clo);
                    }
                );
            }
            }
        } catch (e) {
           alert(data.msg!=undefined?data.msg:data);
            refreshOrClose(ref, clo);
            return;
        }
        try {//by danaus 2019/11/22 17:42
            if (data.state=-1&&JSON.parse(data.data).isuuid) {
                $.messager.show({
                    title: '提示',
                    msg: data.msg,
                    showType: 'show',
                    //timeout:3,
                    style: {
                        right: '',
                        top: document.body.scrollTop + document.documentElement.scrollTop,
                        bottom: ''
                    }
                });
                return;
            }
        }catch (e) {}
        if (data.msg!=undefined&&data.msg != ""&&data.msg!=null&&data.msg!="null"){
            alert(data.msg);
            refreshOrClose(ref, clo);
           // return;
        }
        if (data.data!=undefined&&data.data!=null&&data.data !=""&&data.data !="null") {
            redirect(data.data);
            return;
        }
        $.messager.alert('提示', data.msg || '状态无法识别:' + data.state, "info");
    }
    // if(data.state!=null && data.state==0){
    //
    //
    // }else if(data.state!=null && data.state==-1){
    //
    // }else{
    //
    // }
    // if (data == null || data == "") {// 什么也没返回
    //     $.messager.alert('提示', "进程处理完毕.", "info", function () {
    //             if (typeof (savedExecFunclink) == "function") {
    //                 location.reload();
    //             }
    //             refreshOrClose(ref, clo);
    //         }
    //     );
    // } else {
    //     try {
    //         if (data.error != null && data.error != '') {
    //             $.messager.alert('提示', data.error, "info");
    //             return;
    //         }
    //         // if (data.replace(/\s+/g, "") === "(null)") {
    //         //     $.messager.alert('提示', data, "info");
    //         //     return;
    //         // }
    //         // data = JSON.parse(data);
    //         // if ((data.msg != undefined && data.msg == "") && (data.data == undefined || data.data == "")) {
    //         if (data.data == null || data.data == "") {
    //             $.messager.alert('提示', "进程处理完毕.", "info", function () {
    //                     if (typeof (savedExecFunclink) == "function") {
    //                         location.reload();
    //                     }
    //                     refreshOrClose(ref, clo);
    //                 }
    //             );
    //         }
    //     } catch (e) {
    //         alert(data.data.memo || data);
    //         refreshOrClose(ref, clo);
    //         return;
    //     }
    //     try {//by danaus 2019/11/22 17:42
    //         if (data.state = -1 && JSON.parse(data.data).isuuid) {
    //             $.messager.show({
    //                 title: '提示',
    //                 msg: data.msg,
    //                 showType: 'show',
    //                 //timeout:3,
    //                 style: {
    //                     right: '',
    //                     top: document.body.scrollTop + document.documentElement.scrollTop,
    //                     bottom: ''
    //                 }
    //             });
    //
    //             return;
    //         }
    //     } catch (e) {
    //     }
    //     // let memo=data.data.memo;
    //     // if (memo!=null && memo!="") {
    //     //     alert(memo);
    //     //     if (data.state != null && data.state == 0) {
    //     //         refreshOrClose(ref, clo);
    //     //     }
    //     // }
    //     // if (data.msg!=undefined&&data.msg != ""&&data.msg!=null&&data.msg!="null"){
    //     //     alert(data.msg);
    //     //     if(data.state!=undefined&&data.state==0) {
    //     //         refreshOrClose(ref, clo);
    //     //     }
    //     // return;
    //     // }
    //     // if (data.msg!=undefined&&data.msg != ""&&data.msg!=null&&data.msg!="null"){
    //     //     alert(data.msg);
    //     //     if(data.state!=undefined&&data.state==0) {
    //     //         refreshOrClose(ref, clo);
    //     //     }
    //     //    // return;
    //     // }
    //     if (data.state == 0 && data.data != null) {
    //         refreshOrClose(ref, clo);
    //         let msg = data.data.memo;
    //         $.messager.alert('提示', msg, "info", function () {
    //             redirect(data.data.linkdocinfo);
    //         });
    //         return;
    //     }
    //     // if (data.data!=undefined&&data.data!=null&&data.data !=""&&data.data !="null") {
    //     //     redirect(data.data);
    //     //     return;
    //     // }
    // }
}
function redirect(info) {
    if(info.indexOf("buildv2.do") > -1){ // 生成页面 by danaus 13-6-28 增加返回生成页面和打开多个功能号多张单的功能
@@ -1665,7 +1850,9 @@
        }
    }else{
        location.reload();
        top.myFresh.panel[top.tabindex+'-t']=false;
        if( top.myFresh!=null){
            top.myFresh.panel[top.tabindex+'-t']=false;
        }
    }
}
@@ -1815,6 +2002,13 @@
        if (typeof (mygrid) != "undefined") {
            try {
                if(row==undefined){
                    var tempRow=mygrid.getFristRow(1);//再判断一次,以确定这个字段是否存在于表格,存在才需要提示
                    if(tempRow!=null&&tempRow[str.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()]);
@@ -1907,7 +2101,11 @@
                var num=0;
                if (typeof (mygrid) != "undefined") {
                    rows=mygrid.getFieldForNew();
                    num=rows.length;
                    if(rows.length==0){
                        num=1;
                    }else {
                        num = rows.length;
                    }
                }else{ // 没格线则取0;
                    num=1;
                }
@@ -1926,13 +2124,13 @@
                proParam +=";";
            }
            proParam = proParam.substring(0, proParam.length - 1);
            proParam = encodeURI(encodeURI(proParam)); // 对参数进行编码。(进行二次编码)
            proParam = encodeURI(encodeURI(proParam)); // 对参数进行编码。(进行二次编码)
        }
//        var servlet = "/" + format.toLowerCase() + ".do?"
        var servlet="/printReport.do?m="+format.toLowerCase()
        var doccode = getValue('doccode');
        var doccode = getDoc("doccode", ".value");//只取表头 by danaus 2022/8/17 11:10 getValue('doccode');
        var url = "formId=" + formid + "&reportId=" + reportid + "&parameter=" + proParam+";"
            + "&p=" + Math.round(Math.random() * 100000);
            + "&p=" + Math.round(Math.random() * 100000);
        //html方法打印
        if (format.toLowerCase() == "html") {
            parent.addTab("flash打印", "", "", "", encodeURL("/swf.jsp?parm="
@@ -1956,14 +2154,14 @@
                       }
                    }
                 });
         }
         }
         //如果谷歌浏览器高于50版本才执行最新打印方式否则执行旧版打印方式
         if(format.toLowerCase() == "pdf" && getChromeVersion()>50){
                //执行pdf打印,添加一个页卡显示。
                //viewer.jsp是pdfjs提供的加载pdf文件的容器 -xin 2020-6-12 15:00:30
                parent.addTab("PDF报表打印", "", "", "", "/general/pdf/web/viewer.jsp?file="+encodeURL(servlet
                       +"&"+ url)+"&formId="+formid+"&formType="+formtype+"&reportId="+reportid
                       +"&printFormat="+format+"&doccode="+doccode+"&parameter="+proParam+"&isDirectPrinter="+isDirectPrinter);
                       +"&printFormat="+format+"&doccode="+doccode+"&parameter="+proParam+"&isDirectPrinter="+isDirectPrinter);
                return false;
            }
            //执行pdf打印,添加一个页卡显示。
@@ -1985,7 +2183,7 @@
}
//获取谷歌浏览器版本
function getChromeVersion() {
    var arr = navigator.userAgent.split(' ');
    var arr = navigator.userAgent.split(' ');
    var chromeVersion = '';
    for(var i=0;i < arr.length;i++){
        if(/chrome/i.test(arr[i]))
@@ -2070,7 +2268,7 @@
        postToThis = parent.getIframeAttr("posttothis")!=undefined?parent.getIframeAttr("posttothis").split(";"):"";
        C_Grid = parent.getIframeAttr("t_grid");
    }
    recentFilesTo();
  //recentFilesTo();
});
// 【帮助】按钮事件函数,点击打开该功能的帮助页面
@@ -2149,7 +2347,7 @@
    $('#queryValue').unbind('keydown').keydown(function(event){
        if(event.keyCode == 13){
            tw.simpConfirm(); // query.js里面的一个方法
            windowClose();cas
            windowClose();
        }
    })
    //更多里面的收藏按钮 -xin 2020-6-23 16:39:45
@@ -2381,7 +2579,7 @@
                       }
                   }
               }
       }
       }
    }catch (e) {
        //window.open("help.jsp");
    }