Browse Source

批量下载

Reiskuchen 5 năm trước cách đây
mục cha
commit
07e3483bb0
1 tập tin đã thay đổi với 30 bổ sung1 xóa
  1. 30 1
      ys_vue/src/views/mold/moldDownload.vue

+ 30 - 1
ys_vue/src/views/mold/moldDownload.vue

@@ -188,6 +188,7 @@ export default {
         }
       );
     },
+    //点击复选时
     selectionChanged(row) {
       this.selectedArray = [];
       row.forEach(item => {
@@ -197,12 +198,13 @@ export default {
     },
     //下载
     download(type) {
-      if (this.selectedArray == []) {
+      if (this.selectedArray.length == 0) {
         this.$message("请选择要下载的文档");
       } else {
         switch (type) {
           case 0:
             console.log("点击了下载全部");
+            this.downloadPost();
             break;
           case 1:
             console.log("点击了下载模具3D图档");
@@ -221,6 +223,33 @@ export default {
             break;
         }
       }
+    },
+    //具体的下载
+    downloadPost() {
+      this.http.post(
+        this.port.mold.moldFileDowloadFile,
+        {
+          ids: this.selectedArray.join(",")
+        },
+        res => {
+          this.listLoading = false;
+          if (res.code == "ok") {
+            console.log(res);
+          } else {
+            this.$message({
+              message: res.msg,
+              type: "error"
+            });
+          }
+        },
+        error => {
+          this.listLoading = false;
+          this.$message({
+            message: error,
+            type: "error"
+          });
+        }
+      );
     }
   },
   created() {