hanbing@agilestar.cn 3 gadi atpakaļ
vecāks
revīzija
f2eef680ca
1 mainītis faili ar 60 papildinājumiem un 60 dzēšanām
  1. 60 60
      src/pages/main/file/flieList.vue

+ 60 - 60
src/pages/main/file/flieList.vue

@@ -426,69 +426,69 @@ export default {
       this.getList(this.params, this.pageSize);
     },
     moreDown() {
-      // let arr = [];
-      // this.idList.forEach((item) => {
-      //   arr.push({
-      //     id: item.fileCode,
-      //     fileName: item.fileName,
-      //   });
-      // });
-      // this.$http({
-      //   url: "/market/cmkFileShare/downAllFile",
-      //   method: "post",
-      //   headers: {
-      //     "Content-Type": "application/json",
-      //   },
-      //   responseType: "blob",
-      //   data: { mkFileShareAttachList: arr },
-      // }).then((response) => {
-      //   if (window.navigator && window.navigator.msSaveOrOpenBlob) {
-      //     let blob = new Blob([response.data], {
-      //       type: "application/vnd.ms-excel",
-      //     });
-      //     window.navigator.msSaveOrOpenBlob(blob, "ceshi");
-      //   } else {
-      //     /* 火狐谷歌的文件下载方式 */
-      //     var blob = new Blob([response.data]);
-      //     var downloadElement = document.createElement("a");
-      //     var href = window.URL.createObjectURL(blob);
-      //     downloadElement.href = href;
-      //     downloadElement.download = "cehi";
-      //     document.body.appendChild(downloadElement);
-      //     downloadElement.click();
-      //     document.body.removeChild(downloadElement);
-      //     window.URL.revokeObjectURL(href);
-      //   }
-      // });
+      let arr = [];
       this.idList.forEach((item) => {
-        this.$http({
-          url: "/market/cmkFileShare/downFile",
-          method: "post",
-          headers: {
-            "Content-Type": "application/json",
-          },
-          responseType: "blob",
-          data: { id: item.fileCode, fileName: item.fileName },
-        }).then((response) => {
-          if (window.navigator && window.navigator.msSaveOrOpenBlob) {
-            let blob = new Blob([response.data], {
-              type: "application/vnd.ms-excel",
-            });
-            window.navigator.msSaveOrOpenBlob(blob, item.fileName);
-          } else {
-            /* 火狐谷歌的文件下载方式 */
-            var blob = new Blob([response.data]);
-            var downloadElement = document.createElement("a");
-            var href = window.URL.createObjectURL(blob);
-            downloadElement.href = href;
-            downloadElement.download = item.fileName;
-            document.body.appendChild(downloadElement);
-            downloadElement.click();
-            document.body.removeChild(downloadElement);
-            window.URL.revokeObjectURL(href);
-          }
+        arr.push({
+          id: item.fileCode,
+          fileName: item.fileName,
         });
       });
+      this.$http({
+        url: "/market/cmkFileShare/downAllFile",
+        method: "post",
+        headers: {
+          "Content-Type": "application/json",
+        },
+        responseType: "blob",
+        data: { mkFileShareAttachList: arr },
+      }).then((response) => {
+        if (window.navigator && window.navigator.msSaveOrOpenBlob) {
+          let blob = new Blob([response.data], {
+            type: "application/vnd.ms-excel",
+          });
+          window.navigator.msSaveOrOpenBlob(blob, "batch.zip");
+        } else {
+          /* 火狐谷歌的文件下载方式 */
+          var blob = new Blob([response.data]);
+          var downloadElement = document.createElement("a");
+          var href = window.URL.createObjectURL(blob);
+          downloadElement.href = href;
+          downloadElement.download = "batch.zip";
+          document.body.appendChild(downloadElement);
+          downloadElement.click();
+          document.body.removeChild(downloadElement);
+          window.URL.revokeObjectURL(href);
+        }
+      });
+      // this.idList.forEach((item) => {
+      //   this.$http({
+      //     url: "/market/cmkFileShare/downFile",
+      //     method: "post",
+      //     headers: {
+      //       "Content-Type": "application/json",
+      //     },
+      //     responseType: "blob",
+      //     data: { id: item.fileCode, fileName: item.fileName },
+      //   }).then((response) => {
+      //     if (window.navigator && window.navigator.msSaveOrOpenBlob) {
+      //       let blob = new Blob([response.data], {
+      //         type: "application/vnd.ms-excel",
+      //       });
+      //       window.navigator.msSaveOrOpenBlob(blob, item.fileName);
+      //     } else {
+      //       /* 火狐谷歌的文件下载方式 */
+      //       var blob = new Blob([response.data]);
+      //       var downloadElement = document.createElement("a");
+      //       var href = window.URL.createObjectURL(blob);
+      //       downloadElement.href = href;
+      //       downloadElement.download = item.fileName;
+      //       document.body.appendChild(downloadElement);
+      //       downloadElement.click();
+      //       document.body.removeChild(downloadElement);
+      //       window.URL.revokeObjectURL(href);
+      //     }
+      //   });
+      // });
     },
     handleSelectionChange(val) {
       this.idList = val;