소스 검색

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

liujt 4 달 전
부모
커밋
2ec8ca7399
2개의 변경된 파일16개의 추가작업 그리고 10개의 파일을 삭제
  1. 3 2
      src/api/inventory/index.js
  2. 13 8
      src/views/warehouseManagement/stocktaking/work/components/disposeDialog.vue

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