From 565d5f11cc81abf6a93bd80056208e74b5ddb6d3 Mon Sep 17 00:00:00 2001
From: xinyb <574600396@qq.com>
Date: 星期四, 05 一月 2023 16:10:35 +0800
Subject: [PATCH] 优化附件功能模块,图标显示和格线附件上传

---
 WebRoot/general/gridFileInput.jsp |   72 ++++++++++++++++++++++++++----------
 1 files changed, 52 insertions(+), 20 deletions(-)

diff --git a/WebRoot/general/gridFileInput.jsp b/WebRoot/general/gridFileInput.jsp
index 7992d13..cb04260 100644
--- a/WebRoot/general/gridFileInput.jsp
+++ b/WebRoot/general/gridFileInput.jsp
@@ -11,7 +11,7 @@
 %>
 <html>
 <head>
-    <title>鏍肩嚎闄勪欢涓婁紶鎺т欢</title>銆傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘��
+    <title>鏍肩嚎闄勪欢涓婁紶鎺т欢</title>
     <link rel="stylesheet" type="text/css"
           href="<%=hostUrl%>/js/bootstrap/v5.1.3/css/bootstrap.css?v=<%=com.yc.utils.FileUtil.getVerstion(request,"/js/bootstrap/v5.1.3/css/bootstrap.css")%>">
     <link rel="stylesheet" type="text/css"
@@ -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鍜宮axfilecount銆傞粯璁や负false.
                     fileInput.option.overwriteInitial = false;   // 鏄惁瑕佽鐩栧垵濮嬮瑙堝唴瀹瑰拰鏍囬璁剧疆

--
Gitblit v1.8.0