xinyb
2023-01-05 565d5f11cc81abf6a93bd80056208e74b5ddb6d3
WebRoot/general/gridFileInput.jsp
@@ -88,6 +88,20 @@
            margin: 0px 5px !important;
            border-radius: 6px;
        }
        .batchDowCss{
            width: 100%;
            height: 24px;
            line-height:0px!important;
            font-size: 0.2rem!important;
        }
        /*  控制附件浏览现在次数的样式  */
        .kv-zoom-actions{
            max-width: 500px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-direction: row;
        }
    </style>
</head>
<body>
@@ -117,6 +131,7 @@
                uploadAsync: false,   // bool是否多文件批量上传将并行异步/。默认为true
                showCaption: false,//是否显示被选文件的简介
                showBrowse: false,//是否显示文件浏览按钮
                showBatchDownload:true,//是否显示批量下载按钮
                showUpload: false,//是否显示上传按钮
                showCancel: false,//是否显示取消按钮
                showRemove: false,//是否显示移除按钮
@@ -199,6 +214,7 @@
            fileInput: function () {//渲染,并且绑定事件
                let F = this.e;
                let g = this.grid;
                let Event=this;
                F.fileinput(this.option).on("filebatchselected", function (event, files) {
                    //触发上传功能
                    F.fileinput('upload');
@@ -260,23 +276,34 @@
                    })
                }).on('filezoomshown', function (event, params) {
                    //此事件在模态对用户可见后触发(将等待 CSS 转换完成)
                    let kv = $('#kvFileinputModal .file-zoom-content img');
                    if (kv.length > 0) {
                        isFileInputImage = new Viewer(kv[0], {title: false});
                    }
                    Event.imageEvent(params);
                }).on('filezoomprev', function (event, params) {
                    //事件在缩放预览模式下,当点击上一个导航按钮查看上一个文件时触发(也在缩放模式下按下键盘左箭头时触发)
                    let kv = $('#kvFileinputModal .file-zoom-content img');
                    if (kv.length > 0) {
                        isFileInputImage = new Viewer(kv[0], {title: false});
                    }
                    setTimeout(function(){//这个事件不是渲染完进入,导致提前渲染图片查看器。 没什么决绝办法用setTimeout吧
                        Event.imageEvent(params)
                    },300);
                }).on('filezoomnext', function (event, params) {
                    //该事件在缩放预览模式下,当点击下一个导航按钮查看下一个文件时触发(也在缩放模式下按下键盘右箭头时触发)。
                    let kv = $('#kvFileinputModal .file-zoom-content img');
                    if (kv.length > 0) {
                        isFileInputImage = new Viewer(kv[0], {title: false});
                    }
                    setTimeout(function(){
                        Event.imageEvent(params)
                    },300);
                }).on('filezoomhidden',function (event,params) {
                    top.$('.layui-layer-setwin').show();//隐藏图片的时候打开弹出层的关闭按钮 xin 2022-10-28 09:08:24
                });
            },imageEvent:function (param) {
                try {
                    isFileInputImage = new Viewer(param.modal.find('ul')[0], {
                        title: true, inline: true, button: false
                        , viewed: function () {// 图片渲染完后进入,旋转大图片
                            param.modal.css('overflow-y','hidden');
                            top.$('.layui-layer-setwin').hide();//打开图片的时候隐藏弹出层的关闭按钮 xin 2022-10-28 09:07:59
                        }
                    });
                    isFileInputImage.imageCurrent = 0
                    isFileInputImage.view(param.viewerIndex || 0);
                } catch (e) {
                    isFileInputImage = null;
                }
            }
        }
        return o;
@@ -313,16 +340,18 @@
        param.controltype = controlType;
        param.formid = value.formid;
        param.ishd = value.ishd;
        let strIs = "";
        let strIs = "";//判断更新单据字段值需要到
        if (value.is1 != null && value.is1 != "") {
            strIs = "&is1=" + value.is1 + "&ishd=" + value.ishd;
        } else if (value.is8 != null && value.is8 != "") {
            strIs = "&is8=" + value.is8 + "&ishd=" + value.ishd;
        } else {
        } else if(value.ishd==2){
            strIs = "&is16=1&ishd=" + value.ishd;
        }else {
            strIs = "&ishd=" + value.ishd;
        }
        param.docstatus = value.docstatus == null ? 0 : value.docstatus;
        param.rowid = value.rowid;
        param.rowid = (value.detailrowid || value.rowid);//value.rowid;
        param.usercode = value.usercode;
        param.doccode = value.doccode;
        param.headflag = (value.ishd == 0) ? 1 : 0;
@@ -411,6 +440,7 @@
                                'type': jsons[i].fileType,   // 上传的图片类型
                                'filetype': jsons[i].fileType + '/' + jsons[i].orgFileType,
                                'key': jsons[i].unid + ';' + jsons[i].seq,
                                'seq': jsons[i].seq,
                                'title': title,//title
                                'downloadUrl': jsons[i].allowDownload ? Down : false,//jsons[i].domain + "/attachment/downLoadAttachment.do?filePath=" + fileURL,//top.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': deleURL,//删除
@@ -421,16 +451,18 @@
                            });
                        }
                    }
                    //下载地址
                    //上传地址
                    let upURL = value.domain + '/attachment/uploadAttachmentV2.do?type=' +
                        (controlType == 9 ? '1' : '3') + '&formid=' + value.formid
                        + '&doccode=' + value.doccode + '&fieldid=' + value.fieldid
                        + '&usercode=' + encodeURIComponent(encrypt.encrypt(value.usercode)) +
                        '&username=' + encodeURIComponent(encrypt.encrypt(value.username)) +
                        '&dbid=' + encodeURIComponent(encrypt.encrypt(value.dbid))
                        + strIs + '&rowid=' + value.rowid + '&uuid=' + (value.unid == undefined ? "" : value.unid);
                        '&dbid=' + encodeURIComponent(encrypt.encrypt(value.dbid))+
                        '&rowid=' + (value.detailrowid || value.rowid) + '&uuid=' + (value.unid == undefined ? "" : value.unid)+
                         strIs;
                    fileInput.option.uploadUrl = upURL; // 附件上传路径
                    fileInput.option.maxFileCount = 1;   // 为每个多次上载允许的最大文件数。如果设置为0,则意味着允许的文件数是无限的。默认值为0。
                    // fileInput.option.maxFileCount = 1;   // 为每个多次上载允许的最大文件数。如果设置为0,则意味着允许的文件数是无限的。默认值为0。
                    fileInput.option.maxTotalFileCount = 1;
                    fileInput.option.isNine = true;
                    fileInput.option.validateInitialCount = true;   // 是否包括初始预览文件数(服务器上传文件)验证minfilecount和maxfilecount。默认为false.
                    fileInput.option.overwriteInitial = false;   // 是否要覆盖初始预览内容和标题设置