Explorar el Código

fix: 优化批量下载附件toast提示

lanjianrong hace 3 años
padre
commit
a93abe441a
Se han modificado 3 ficheros con 16 adiciones y 9 borrados
  1. 2 2
      app/public/js/global.js
  2. 10 5
      app/public/js/ledger.js
  3. 4 2
      config/config.local.js

+ 2 - 2
app/public/js/global.js

@@ -401,8 +401,8 @@ const postCompressFile = function (url, data, successCallback, errorCallBack) {
           }
       },
       error: function(jqXHR, textStatus, errorThrown){
-          console.log(jqXHR, textStatus, errorThrown);
-          toastr.error('error: ' + textStatus + " " + errorThrown);
+          // console.log(jqXHR, textStatus, errorThrown);
+          // toastr.error('error: ' + textStatus + " " + errorThrown);
           if (errorCallBack) {
               errorCallBack();
           }

+ 10 - 5
app/public/js/ledger.js

@@ -3431,7 +3431,7 @@ $(document).ready(function() {
                 return false;
             }
             const fileext = '.' + file.name.toLowerCase().split('.').splice(-1)[0];
-            if (whiteList.indexOf(fileext) === -1) {
+            if (whiteList && !whiteList.includes(fileext)) {
                 toastr.error('只能上传指定格式的附件!');
                 return false;
             }
@@ -3609,7 +3609,7 @@ $(document).ready(function() {
           $('#change-att-btn').val('');
           return false;
       }
-      if (whiteList.indexOf(fileext) === -1) {
+      if (whiteList && !whiteList.includes(fileext)) {
           toastr.error('只能上传指定格式的附件!');
           $('#change-att-btn').val('');
           return false;
@@ -3653,17 +3653,22 @@ $(document).ready(function() {
         if (fileIds.length > 10) {
           return toastr.warning(`最大允许10个文件(当前${fileIds.length}个)`)
         }
-        toastr.success('正在进行压缩文件...')
+        toastr.success('正在进行压缩文件...', '', { timeOut: 0, extendedTimeOut: 0})
         $(this).attr('disabled', "true")
         const btn = $(this)
         postCompressFile(`/tender/${tender.id}/ledger/compresse/file`, {fileIds}, function(result) {
-          toastr.success('压缩文件成功,即将开始下载')
+          toastr.clear()
+          toastr.success('压缩文件成功')
           btn.removeAttr('disabled')
           const href = window.URL.createObjectURL(result)
           $('#zipDown').attr('href', href);
           $('#zipDown').attr('download', `${tender.name}-台账分解-附件.zip`);
           $("#zipDown")[0].click();
-        }, () => btn.removeAttr('disabled'))
+        }, () => {
+          btn.removeAttr('disabled')
+          toastr.clear()
+          toastr.error('批量下载失败')
+        });
           // const url = `/tender/${tender.id}/ledger/compresse/file?fileIds=${JSON.stringify(fileIds)}`;
           // console.log(url);
       }

+ 4 - 2
config/config.local.js

@@ -61,9 +61,11 @@ module.exports = appInfo => {
             '.xls', '.xlsx',
             '.doc', '.docx',
             '.pdf',
-            '.png', '.jpg', '.jpeg', '.gif', '.bmp',
-            '.zip', '.rar', '.7z'],
+            '.ppt', '.pptx',
+            '.png', '.jpg', '.jpeg', '.gif', '.bmp', '.cad', '.dwg',
+            '.zip', '.rar', '.7z', ''],
         fileSize: '100mb',
+        fields: '15',
     };
 
     // session配置