Explorar o código

feat(盘点报工): 盘点报工不选数据也能报

liujt hai 4 meses
pai
achega
2ec8ca7399

+ 3 - 2
src/api/inventory/index.js

@@ -95,9 +95,10 @@ export async function getPlanDetailList(params) {
 }
 
 // 盘点报工
-export async function reportWork(data) {
+export async function reportWork(data, params) {
   console.log(data);
-  const res = await request.post('/wms/planOrder/reportWork', data);
+  const urlParams = new URLSearchParams(params);
+  const res = await request.post('/wms/planOrder/reportWork?' + urlParams, data);
   if (res.data.code == 0) {
     return res.data.data;
   }

+ 13 - 8
src/views/warehouseManagement/stocktaking/work/components/disposeDialog.vue

@@ -409,6 +409,7 @@
         this.selectionIds = this.selectionIds.filter((item) => item !== row.id);
       },
       onConfirm() {
+        let arr = []
         if (this.controlTableData.length > 0) {
           let isBoolen = this.controlTableData.every(
             (item) => item.controlStatus > 0 && item.count > 0
@@ -416,7 +417,7 @@
           if (!isBoolen) {
             return this.$message.error('请选择盘点状态和数量!');
           }
-          let arr = this.controlTableData.map((item) => {
+          arr = this.controlTableData.map((item) => {
             let key = null;
             switch (item.controlStatus) {
               case '2':
@@ -436,15 +437,18 @@
               [key]: item.count
             };
           });
-          console.log(arr);
-          reportWork(arr).then(() => {
-            this.$message.success('报工成功!');
-            this.$emit('flushed');
-            this.closeWindows();
-          });
         } else {
-          this.$message.error('请选择物品!');
+          arr = []
         }
+        console.log(arr);
+        reportWork(arr, { planOrderId: this.planOrderId }).then(() => {
+          this.$message.success('报工成功!');
+          this.$emit('flushed');
+          this.closeWindows();
+        });
+        // } else {
+        //   this.$message.error('请选择物品!');
+        // }
       },
       open(id) {
         this.planOrderId = id;
@@ -457,6 +461,7 @@
         this.keyWord = '';
         this.pages.keyWord = '';
         this.selection = [];
+        this.controlTableData = [];
         this.visibleDialog = false;
       },
       async _getInformation() {