Explorar o código

feat(流程待办): 添加售后退货仓库管理员入库功能及审批流程优化

liujt hai 7 meses
pai
achega
61d9b26959

+ 38 - 3
src/views/bpm/handleTask/components/saleOrder/returnGoods/detailDialog.vue

@@ -150,6 +150,24 @@
       :isProduceDeliveryDeadline="taskDefinitionKey == 'produceLeader'"
       :isDiscount="false"
     ></inventoryTable>
+
+    <div style="margin-top: 20px">
+      <add
+        v-if="taskDefinitionKey == 'warehouseManager'" 
+        ref="add"
+        :form="form"
+        :sourceBizNo="form.returnNo"
+        :detailList="form?.productList?.filter((item) => item.packageId)"
+        :saleProductList="form?.productList?.filter((item) => !item.packageId)"
+        :bizType="6"
+        :isMoreProduct="true"
+      ></add>
+      <detailDialog
+        v-if="taskDefinitionKey == 'warehouseManager' && isView"
+        :businessId="form.returnNo"
+        ref="detailDialog"
+      ></detailDialog>
+    </div>
   </div>
 </template>
 
@@ -164,12 +182,16 @@
   import inventoryTabledetail from '@/BIZComponents/inventoryTableDetails.vue';
   import inventoryTable from '@/BIZComponents/inventoryTable.vue';
   // import fileMain from '@/components/addDoc/index.vue';
+  import add from '@/views/bpm/stockManagement/storage.vue';
+  import detailDialog from '@/views/bpm/stockManagement/details.vue';
 
   export default {
     mixins: [dictMixins],
     components: {
       inventoryTabledetail,
-      inventoryTable
+      inventoryTable,
+      add,
+      detailDialog
       // fileMain
     },
     data() {
@@ -706,18 +728,22 @@
       },
       taskDefinitionKey: {
         default: ''
+      },
+      isView: {
+        default: false
       }
     },
     created() {
-      this.getDetailData(this.businessId);
+      this.getDetailData('isView~~~', this.isView);
       this.requestDict('产地');
+      console.log(this.detailData);
     },
     methods: {
       downloadFile(file) {
         getFile({ objectName: file.storePath }, file.name);
       },
       async getTableValue() {
-        console.log(await this.getValidate());
+        // console.log(await this.getValidate());
         try {
           // 表单验证通过,执行保存操作
           this.loading = true;
@@ -730,9 +756,14 @@
             redressProductList = redressProductList.productList;
           }
 
+          if (this.taskDefinitionKey == 'warehouseManager') {
+            this.form.returnStorageData = await this.$refs.add.getReturnStorage();
+          }
+
           let commitData = Object.assign({}, this.form, {
             redressProductList
           });
+          
           return commitData;
         } catch (error) {
           console.log(error);
@@ -765,6 +796,10 @@
         if (data) {
           this.detailData = data;
           this.form = data;
+          this.form.productList.forEach((item) => {
+            item['packingWeight'] = item.receiveTotalWeight;
+            item['quantity'] = item.totalCount;
+          });
           this.form.pricingWay = data?.saleOrder?.pricingWay;
           this.$nextTick(() => {
             this.$refs.inventoryTabledetailRef &&

+ 63 - 10
src/views/bpm/handleTask/components/saleOrder/returnGoods/submit.vue

@@ -23,7 +23,7 @@
         type="success"
         size="mini"
         @click="handleAudit(1)"
-        v-if="outInData.verifyStatus == 2"
+        v-if="outInData.verifyStatus == 2 || !['warehouseManager'].includes(taskDefinitionKey)"
         >通过
       </el-button>
       <el-button
@@ -32,11 +32,11 @@
         size="mini"
         @click="storemanApprove"
         v-if="
-          ['storemanApprove'].includes(taskDefinitionKey) &&
+          (['storemanApprove'].includes(taskDefinitionKey) &&
           activeComp == 'main' &&
-          [0, 3].includes(outInData.verifyStatus)
+          [0, 3].includes(outInData.verifyStatus)) || ['warehouseManager'].includes(taskDefinitionKey)
         "
-        >申请
+        >申请
       </el-button>
       <el-button
         icon="el-icon-circle-close"
@@ -44,8 +44,9 @@
         size="mini"
         @click="handleAudit(0)"
         v-if="
-          !['starter'].includes(taskDefinitionKey) &&
-          outInData.verifyStatus != 1
+          !((['starter'].includes(taskDefinitionKey) &&
+          outInData.verifyStatus != 1) || 
+          ['warehouseManager'].includes(taskDefinitionKey))
         "
         >驳回
       </el-button>
@@ -93,7 +94,9 @@
     UpdateReturnInformation,
     getWarehouseListByIds,
     approve,
-    saleReturnProcessCancel
+    saleReturnProcessCancel,
+    getReturnSaleOrderrecordDetail
+
   } from '@/api/bpm/components/saleManage/saleorder';
   import {
     approveTaskWithVariables,
@@ -101,6 +104,7 @@
     cancelTask
   } from '@/api/bpm/task';
   import { listAllUserBind } from '@/api/system/organization';
+  import storageApi from '@/api/warehouseManagement';
 
   // 流程实例的详情页,可用于审批
   export default {
@@ -133,7 +137,8 @@
         },
         userOptions: [],
         activeComp: '',
-        outInData: { verifyStatus: 2 }
+        outInData: { verifyStatus: 2 },
+        isSaveLoading: false
       };
     },
     async created() {
@@ -141,7 +146,7 @@
       listAllUserBind().then((data) => {
         this.userOptions.push(...data);
       });
-      if (this.taskDefinitionKey == 'storemanApprove') {
+      if (this.taskDefinitionKey == 'storemanApprove' || this.taskDefinitionKey == 'warehouseManager') {
         let data = await getReturnSaleOrderrecordDetail(this.businessId);
         try {
           this.outInData = await getOutInBySourceBizNo(data.orderNo);
@@ -159,7 +164,54 @@
         this.$emit('handleBackList');
       },
       async storemanApprove() {
-        this.$emit('submit');
+        // this.$emit('submit');
+        let res = await this.getTableValue();
+        let storageData = res.returnStorageData;
+   
+        if (!storageData) {
+          return;
+        }
+
+        // 入库来源isSkip 0-正常  1-外部(外部跳过内部审核流程)
+        storageData.isSkip = 1;
+
+        try {
+          this.isSaveLoading = true;
+
+          // 用于回显
+          if (storageData?._packingList?.length) {
+            res.productList.forEach((val, index) => {
+              val.receiveTotalWeight = storageData._packingList[index].weight;
+              val.materielDesignation =
+                storageData._packingList[index].materielDesignation;
+              val.clientCode = storageData._packingList[index].clientCode;
+              val.engrave = storageData._packingList[index].engrave;
+            });
+          }
+          await UpdateReturnInformation(res);
+
+
+          await storageApi.storage(storageData);
+          // approveTaskWithVariables({
+          //   id: this.taskId,
+          //   reason: this.form.reason,
+          //   variables: {
+          //     pass: true
+          //   }
+          // }).then((res) => {
+          //   if (res.code != '-1') {
+          //     this.$emit('handleAudit', {
+          //       status: 1,
+          //       title: '入库'
+          //     });
+          //   }
+          //   this.isSaveLoading = false;
+          // });
+          this.approveTaskWithVariables(1, res.type)
+        } catch (error) {
+          this.isSaveLoading = false;
+          this.$message.error('保存失败');
+        }
       },
       async handleAudit(status) {
         let returnType = '';
@@ -226,6 +278,7 @@
           id: this.taskId,
           reason: this.form.reason,
           operateType: status == 0 ? 2 : 1,
+          businessId: this.businessId,
           returnType
         }).then((res) => {
           if (res.code != '-1') {