Browse Source

一键清空库区

Qukatie 5 days ago
parent
commit
005a8959ef

+ 22 - 8
src/views/tirePartsMall/purchasingManagement/warehouseEntryOrder/detailsPage.vue

@@ -90,13 +90,7 @@
                 >
                   清空库区
                 </el-button>
-                <el-button
-                  v-if="reservoirArea == 1"
-                  :size="size"
-                  :disabled="!row.id"
-                  type="text"
-                  @click="rowArea(row, index)"
-                >
+                <el-button v-if="reservoirArea == 1" :size="size" :disabled="!row.id" type="text" @click="rowArea(row, index)">
                   {{ row.historyList.length ? "查看库区" : "选择库区" }}
                 </el-button>
                 <el-button
@@ -993,7 +987,26 @@ export default {
         this.excelBox2 = true;
       }
       if (name == "一键清空库区") {
-        
+        this.$confirm("是否一键清空库区?", "提示", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(() => {
+          for (let row of this.form.shipItemsList) {
+            let ids = [];
+            if (row.historyList.filter(item => item.id).length) {
+              for (let item of row.historyList) {
+                ids.push(item.id);
+              }
+            } else {
+              row.historyList = [];
+            }
+            itemRemove({ ids: ids.join(",") }).then(res => {
+              this.$message.success("操作成功");
+              this.refresh(this.form.id);
+            });
+          }
+        });
       }
     },
     dicChange(name, row) {
@@ -1211,6 +1224,7 @@ export default {
               })
                 .then(res => {
                   this.refresh(res.data.data.id);
+                  this.isEdit = true;
                   this.$set(this.optionForm, "disabled", true);
                   this.$set(this.optionContactsBack, "disabled", true);
                   this.$message.success("入库完成");