소스 검색

新增仓库委外申请流程

huang_an 2 년 전
부모
커밋
c9ad5ff7fd

+ 1 - 1
src/views/bpm/handleTask/components/purchaseOrder/outSourceSendCk/boxTabPage.vue

@@ -58,7 +58,7 @@
       tabOption() {
         let list = [
           {
-            label: '发货单详情',
+            label: '委外申请单详情',
             name: 'tab1',
             isShow: true
           },

+ 7 - 0
src/views/bpm/handleTask/components/purchaseOrder/outSourceSendCk/detailDialog.vue

@@ -204,6 +204,13 @@
             label: '规格',
             slot: 'specification',
             align: 'center'
+          },
+          {
+            width: 120,
+            prop: 'totalCount',
+            label: '数量',
+            slot: 'totalCount',
+            align: 'center'
           }
         ]
       };

+ 74 - 56
src/views/bpm/handleTask/components/purchaseOrder/outSourceSendCk/outsourcingOutbound.vue

@@ -1,4 +1,4 @@
-<!-- 采购委外发货审批(委外发货出库) 出库标识 -->
+<!-- 仓库委外申请(委外发货出库) 出库标识 -->
 <template>
   <div class="ele-body">
     <el-card shadow="never">
@@ -338,6 +338,7 @@
 </template>
 
 <script>
+  import { getById } from '@/api/bpm/components/outsourcedWarehousing/index';
   import outin from '@/api/warehouseManagement/outin';
   import { getPurchaseOutSourceSendDetailAPI } from '@/api/bpm/components/purchasingManage/outSourceSend';
   import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
@@ -345,6 +346,7 @@
   import {
     getTreeByPid,
     getTreeByGroup,
+    allCategoryLevel,
     getOutInBySourceBizNoOrError
   } from '@/api/classifyManage';
   import pickOrder from '@/views/bpm/outgoingManagement/components/pickOrder.vue';
@@ -448,60 +450,76 @@
     },
     async mounted() {
       await this.initData();
-      let returnDetailsForm = await getPurchaseOutSourceSendDetailAPI(
-        this.businessId
-      );
-      this.form = returnDetailsForm;
-      console.log(returnDetailsForm);
-      getOutInBySourceBizNoOrError(returnDetailsForm.code)
-        .then((data) => {
-          // 已经出库(详情)
-          console.log('有订单来源');
-          this.isStorage = true; // 已经出库
-          this.formData = deepClone(data);
-          // 填充遍历数据
-          console.log('this.formData-----', this.formData);
-          if (this.formData.outInDetailVOList?.length > 0) {
-            this.warehousingMaterialList = []; // 物品列表
-            this.batchDetailsVOList = []; // 包装列表
-            this.materialCodeReqList = []; // 物料列表
-            this.formData.outInDetailVOList.forEach((goodsiItem) => {
-              goodsiItem.assetName = goodsiItem.name;
-              goodsiItem.assetCode = goodsiItem.categoryCode;
-              goodsiItem.outInNum = goodsiItem.packingCount;
-              this.warehousingMaterialList.push(goodsiItem);
-              goodsiItem.outInDetailRecordVOList.forEach((wrapItem) => {
-                wrapItem.assetName = goodsiItem.name;
-                wrapItem.assetCode = goodsiItem.categoryCode;
-                // wrapItem.count =
-                //   wrapItem.outInDetailRecordMaterialDetailVOList.length; // 增加包装计量数量
-                this.batchDetailsVOList.push(wrapItem);
-                wrapItem.outInDetailRecordMaterialDetailVOList.forEach(
-                  (materialItem) => {
-                    materialItem.isPack = true;
-                    this.materialCodeReqList.push(materialItem);
-                  }
-                );
-              });
-            });
-          }
-        })
-        .catch(() => {
-          //未出库
-          this.isStorage = false;
-          // 物品类型
-          this.formData.extInfo.assetType =
-            returnDetailsForm.categoryLevelTopId;
-          // 出库类型(委外出库)
-          this.formData.bizType = '6';
-          // 增加添加物品判断条件
-          this.title = this.assetTypeMapping[this.formData.extInfo.assetType];
-          // 添加单据来源
-          this.formData.sourceBizNo = returnDetailsForm.code;
-          // 将出库状态改成出库状态 2出库 1入库
-          this.formData.type = 2;
-          this.$forceUpdate();
-        });
+      const data = await getById(this.businessId);
+      console.log(data);
+      //未出库
+      this.isStorage = false;
+      // 物品类型
+      this.formData.extInfo.assetType = data.categoryLevelId;
+      // 出库类型(委外出库)
+      this.formData.bizType = '9';
+      // 增加添加物品判断条件
+      this.title = this.assetTypeMapping[this.formData.extInfo.assetType];
+      // 添加单据来源
+      this.formData.sourceBizNo = data.code;
+      // 将出库状态改成出库状态 2出库 1入库
+      this.formData.type = 2;
+      console.log(this.formData);
+      this.$forceUpdate();
+      // let returnDetailsForm = await getPurchaseOutSourceSendDetailAPI(
+      //   this.businessId
+      // );
+      // this.form = returnDetailsForm;
+      // console.log(returnDetailsForm);
+      // getOutInBySourceBizNoOrError(returnDetailsForm.code)
+      //   .then((data) => {
+      //     // 已经出库(详情)
+      //     console.log('有订单来源');
+      //     this.isStorage = true; // 已经出库
+      //     this.formData = deepClone(data);
+      //     // 填充遍历数据
+      //     console.log('this.formData-----', this.formData);
+      //     if (this.formData.outInDetailVOList?.length > 0) {
+      //       this.warehousingMaterialList = []; // 物品列表
+      //       this.batchDetailsVOList = []; // 包装列表
+      //       this.materialCodeReqList = []; // 物料列表
+      //       this.formData.outInDetailVOList.forEach((goodsiItem) => {
+      //         goodsiItem.assetName = goodsiItem.name;
+      //         goodsiItem.assetCode = goodsiItem.categoryCode;
+      //         goodsiItem.outInNum = goodsiItem.packingCount;
+      //         this.warehousingMaterialList.push(goodsiItem);
+      //         goodsiItem.outInDetailRecordVOList.forEach((wrapItem) => {
+      //           wrapItem.assetName = goodsiItem.name;
+      //           wrapItem.assetCode = goodsiItem.categoryCode;
+      //           // wrapItem.count =
+      //           //   wrapItem.outInDetailRecordMaterialDetailVOList.length; // 增加包装计量数量
+      //           this.batchDetailsVOList.push(wrapItem);
+      //           wrapItem.outInDetailRecordMaterialDetailVOList.forEach(
+      //             (materialItem) => {
+      //               materialItem.isPack = true;
+      //               this.materialCodeReqList.push(materialItem);
+      //             }
+      //           );
+      //         });
+      //       });
+      //     }
+      //   })
+      //   .catch(() => {
+      //     //未出库
+      //     this.isStorage = false;
+      //     // 物品类型
+      //     this.formData.extInfo.assetType =
+      //       returnDetailsForm.categoryLevelTopId;
+      //     // 出库类型(委外出库)
+      //     this.formData.bizType = '6';
+      //     // 增加添加物品判断条件
+      //     this.title = this.assetTypeMapping[this.formData.extInfo.assetType];
+      //     // 添加单据来源
+      //     this.formData.sourceBizNo = returnDetailsForm.code;
+      //     // 将出库状态改成出库状态 2出库 1入库
+      //     this.formData.type = 2;
+      //     this.$forceUpdate();
+      //   });
     },
     methods: {
       //获取回执附件
@@ -775,7 +793,7 @@
       },
       // 获取物品类型列表
       async getAssetTypeOptions() {
-        const { data } = await getTreeByGroup({ type: 1 });
+        const { data } = await allCategoryLevel();
         this.codeList = data;
         let obj = {};
         data.forEach((item) => {

+ 100 - 111
src/views/bpm/handleTask/components/purchaseOrder/outSourceSendCk/submit.vue

@@ -52,6 +52,7 @@
 </template>
 
 <script>
+  import outin from '@/api/warehouseManagement/outin';
   import { cancel } from '@/api/bpm/components/purchasingManage/outSourceSend';
   import { approveTaskWithVariables } from '@/api/bpm/task';
 
@@ -80,123 +81,111 @@
         isLoading: false,
         form: {
           reason: ''
-        },
-
-        async handleAudit(status) {
-          let storemanIds = '';
-          let permissionType = this.tabOptions.find(
-            (item) => item.key == this.taskDefinitionKey
-          )?.permissionType;
-          // if (this.taskDefinitionKey === 'deptLeaderApprove') {
-          //   let arr = await this.getTableValue();
-          //   let ids = arr.productList.map((item) => item.warehouseId);
-          //   let data = await getWarehouseListByIds(ids || []);
-          //   storemanIds = [...new Set(data.map((item) => item.ownerId))].join(
-          //     ','
-          //   );
-          // }
-          if (this.taskDefinitionKey === 'storeman') {
-            let data = await this.getTableValue();
-            let storageData = data.returnStorageData;
-            // 入库来源storageSource 0-正常  1-外部(外部跳过内部审核流程)
-            storageData.storageSource = 1;
-            console.log(storageData);
-            try {
-              this.isLoading = true;
-              const res = await outin.saveNew(storageData);
-              if (res.code == 0) {
-                approveTaskWithVariables({
-                  id: this.taskId,
-                  reason: this.form.reason,
-                  variables: {
-                    pass: !!status
-                  }
-                }).then((res) => {
-                  if (res.code != '-1') {
-                    this.$emit('handleAudit', {
-                      status: status,
-                      title: !status ? '驳回' : ''
-                    });
-                  }
-                  this.isLoading = false;
-                });
-              }
-            } catch (error) {
-              this.isLoading = false;
-              console.error('保存失败:', error);
-            }
-          } else {
-            // await this._approveTaskWithVariables(status, storemanIds);
-            await this._approveTaskWithVariables(status);
-          }
-        },
-        async _approveTaskWithVariables(status, storemanIds) {
-          let variables = {
-            pass: !!status
-          };
-          approveTaskWithVariables({
-            id: this.taskId,
-            reason: this.form.reason,
-            variables
-          }).then((res) => {
-            if (res.data.code != '-1') {
-              this.$emit('handleAudit', {
-                status,
-                title: status === 0 ? '驳回' : ''
+        }
+      };
+    },
+    methods: {
+      async handleAudit(status) {
+        // console.log(status);
+        // let storemanIds = '';
+        // let permissionType = this.tabOptions.find(
+        //   (item) => item.key == this.taskDefinitionKey
+        // )?.permissionType;
+        // if (this.taskDefinitionKey === 'deptLeaderApprove') {
+        //   let arr = await this.getTableValue();
+        //   let ids = arr.productList.map((item) => item.warehouseId);
+        //   let data = await getWarehouseListByIds(ids || []);
+        //   storemanIds = [...new Set(data.map((item) => item.ownerId))].join(
+        //     ','
+        //   );
+        // }
+        if (!this.form.reason && !!status) {
+          this.$message.error('请输入审批意见');
+          return false;
+        }
+        if (this.taskDefinitionKey === 'storeman') {
+          let data = await this.getTableValue();
+          let storageData = data.returnStorageData;
+          // 入库来源storageSource 0-正常  1-外部(外部跳过内部审核流程)
+          storageData.storageSource = 1;
+          console.log(storageData);
+          try {
+            this.isLoading = true;
+            const res = await outin.saveNew(storageData);
+            if (res.code == 0) {
+              approveTaskWithVariables({
+                id: this.taskId,
+                reason: this.form.reason,
+                variables: {
+                  pass: !!status
+                }
+              }).then((res) => {
+                if (res.code != '-1') {
+                  this.$emit('handleAudit', {
+                    status: status,
+                    title: !status ? '驳回' : ''
+                  });
+                }
+                this.isLoading = false;
               });
             }
-          });
-        },
-
-        async handleAudit(status) {
-          if (this.taskDefinitionKey === 'deptLeaderApprove') {
-            await this._approveTaskWithVariables(status);
+          } catch (error) {
+            this.isLoading = false;
+            console.error('保存失败:', error);
           }
-        },
-
-        async _approveTaskWithVariables(status) {
-          let variables = {
-            pass: !!status
-          };
-          approveTaskWithVariables({
-            id: this.taskId,
-            reason: this.form.reason,
-            variables
-          }).then((res) => {
-            if (res.data.code != '-1') {
-              this.$emit('handleAudit', {
-                status,
-                title: status === 0 ? '驳回' : ''
-              });
-            }
+        } else {
+          // await this._approveTaskWithVariables(status, storemanIds);
+          await this._approveTaskWithVariables(status);
+        }
+      },
+      getTableValue() {
+        return new Promise((resolve, reject) => {
+          this.$emit('getTableValue', async (data) => {
+            resolve(await data);
           });
-        },
-
-        //更多
-        handleCommand(command) {
-          if (command === 'cancel') {
-            this.$confirm('是否确认作废?', {
-              type: 'warning',
-              cancelButtonText: '取消',
-              confirmButtonText: '确定'
-            })
-              .then(() => {
-                cancel({
-                  id: this.taskId,
-                  reason: this.form.reason,
-                  businessId: this.businessId
-                })
-                  .then(() => {
-                    this.$emit('handleClose');
-                  })
-                  .catch(() => {
-                    this.$message.error('流程作废失败');
-                  });
-              })
-              .catch(() => {});
+        });
+      },
+      async _approveTaskWithVariables(status, storemanIds) {
+        let variables = {
+          pass: !!status
+        };
+        approveTaskWithVariables({
+          id: this.taskId,
+          reason: this.form.reason,
+          variables
+        }).then((res) => {
+          if (res.data.code != '-1') {
+            this.$emit('handleAudit', {
+              status,
+              title: status === 0 ? '驳回' : ''
+            });
           }
+        });
+      },
+      //更多
+      handleCommand(command) {
+        if (command === 'cancel') {
+          this.$confirm('是否确认作废?', {
+            type: 'warning',
+            cancelButtonText: '取消',
+            confirmButtonText: '确定'
+          })
+            .then(() => {
+              cancel({
+                id: this.taskId,
+                reason: this.form.reason,
+                businessId: this.businessId
+              })
+                .then(() => {
+                  this.$emit('handleClose');
+                })
+                .catch(() => {
+                  this.$message.error('流程作废失败');
+                });
+            })
+            .catch(() => {});
         }
-      };
+      }
     }
   };
 </script>

+ 46 - 4
src/views/bpm/outgoingManagement/components/AssetsDialog.vue

@@ -80,7 +80,7 @@
             <el-input
               type="text"
               placeholder="搜索物品名称"
-              v-model="searchForm.name"
+              v-model="searchForm.assetName"
             ></el-input>
           </el-form-item>
         </el-col>
@@ -111,6 +111,24 @@
             ></el-input>
           </el-form-item>
         </el-col>
+        <el-col :span="6">
+          <el-form-item label="质检状态">
+            <el-select
+              v-if="dimension != 3 || dimension != 4"
+              clearable
+              v-model="searchForm.qualityStatus"
+              placeholder="请选择质检状态"
+            >
+              <el-option
+                v-for="item in qualityStatusOption"
+                :label="item.label"
+                :value="item.value"
+                :key="item.value"
+              >
+              </el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
         <el-col style="text-align: right">
           <el-button type="primary" @click="doSearch">搜索</el-button>
           <el-button icon="el-icon-refresh-left" @click="reset">重置</el-button>
@@ -349,6 +367,26 @@
     },
     data() {
       return {
+        qualityResultOption: [
+          {
+            value: 0,
+            label: '合格'
+          },
+          {
+            value: 1,
+            label: '不合格'
+          }
+        ],
+        qualityStatusOption: [
+          {
+            value: 1,
+            label: '已质检'
+          },
+          {
+            value: 0,
+            label: '未质检'
+          }
+        ],
         visible: false,
         tableData: [],
         total: 0,
@@ -358,9 +396,11 @@
         },
         searchForm: {
           code: '',
-          name: '',
+          assetName: '',
           batchNo: '',
-          engrave: ''
+          engrave: '',
+          barcodes: '',
+          qualityStatus: ''
         },
         selectionList: [],
         materialType: '',
@@ -586,9 +626,11 @@
       },
       reset() {
         this.searchForm.code = '';
-        this.searchForm.name = '';
+        this.searchForm.assetName = '';
         this.searchForm.batchNo = '';
         this.searchForm.engrave = '';
+        this.searchForm.barcodes = '';
+        this.searchForm.qualityStatus = '';
         this.doSearch();
       },
       doSearch() {