huang_an před 2 roky
rodič
revize
1e82214672

+ 6 - 2
src/views/bpm/handleTask/components/purchaseOrder/invoice/procurementWarehousing.vue

@@ -1243,7 +1243,8 @@
                 }
                 wrapItem.assetName = goodsiItem.name;
                 wrapItem.assetCode = goodsiItem.categoryCode;
-                wrapItem.result = String(wrapItem.result);
+                wrapItem.result =
+                  wrapItem.result === null ? '' : String(wrapItem.result);
                 wrapItem.count =
                   wrapItem.outInDetailRecordMaterialDetailVOList.length; // 增加包装计量数量
                 this.materialCodeReqListOrStorage.push(wrapItem);
@@ -1252,7 +1253,10 @@
                 ) {
                   wrapItem.outInDetailRecordMaterialDetailVOList.forEach(
                     (materialItem) => {
-                      materialItem.result = String(materialItem.result);
+                      materialItem.result =
+                        materialItem.result === null
+                          ? ''
+                          : String(materialItem.result);
                       if (this.taskDefinitionKey === 'qualityInspection') {
                         // 生产性采购
                         materialItem.isPack = false;

+ 6 - 6
src/views/bpm/handleTask/components/saleOrder/customerReturnGoods/customerReturnOrder.vue

@@ -384,11 +384,7 @@
           </ele-pro-table>
         </el-form>
       </el-tab-pane>
-      <el-tab-pane
-        v-if="taskDefinitionKey === 'storeman' && activeComp === 'storeman'"
-        label="入库明细"
-        name="入库明细"
-      >
+      <el-tab-pane v-if="isShowReturnOrder" label="入库明细" name="入库明细">
         <inbound-details
           ref="inboundDetails"
           :returnDetailsForm="form"
@@ -438,6 +434,10 @@
       businessId: {
         type: String,
         default: ''
+      },
+      isShowReturnOrder: {
+        type: Boolean,
+        default: false
       }
     },
     components: { outboundDetailsDialog, headList, inboundDetails },
@@ -531,7 +531,7 @@
             minWidth: 80,
             prop: 'measuringUnit',
             label: '计量单位',
-            align: 'center',
+            align: 'center'
           },
           {
             minWidth: 80,

+ 52 - 8
src/views/bpm/handleTask/components/saleOrder/customerReturnGoods/customerReturnOrderDialog.vue

@@ -20,6 +20,7 @@
       :is="customerReturnOrder"
       :key="key"
       ref="componentRef"
+      :isShowReturnOrder="isShowReturnOrder"
       :taskDefinitionKey="taskDefinitionKey"
       :activeComp="activeComp"
       :businessId="businessId"
@@ -53,26 +54,68 @@
         dialogType: 'add',
         customerReturnOrder: 'customerReturnOrder',
         tabOptions: [
-          { key: 'stater', permissionType: 'update', name: '发起人申请' },
-          { key: 'deptLeader', permissionType: 'view', name: '销售主管审批' },
-          { key: 'storeman', permissionType: 'update', name: '仓管入库' },
-          { key: 'QCLeader', permissionType: 'view', name: '质量部主管指派' },
-          { key: 'QCApprove', permissionType: 'update', name: '质检员审核' },
-          { key: 'techLeader', permissionType: 'view', name: '技术部主管指派' },
-          { key: 'techApprove', permissionType: 'update', name: '技术员审核' },
+          {
+            key: 'stater',
+            permissionType: 'update',
+            isShowReturnOrder: false,
+            name: '发起人申请'
+          },
+          {
+            key: 'deptLeader',
+            permissionType: 'view',
+            isShowReturnOrder: false,
+            name: '销售主管审批'
+          },
+          {
+            key: 'storeman',
+            permissionType: 'update',
+            isShowReturnOrder: true,
+            name: '仓管入库'
+          },
+          {
+            key: 'QCLeader',
+            permissionType: 'view',
+            isShowReturnOrder: false,
+            name: '质量部主管指派'
+          },
+          {
+            key: 'QCApprove',
+            permissionType: 'update',
+            isShowReturnOrder: false,
+            name: '质检员审核'
+          },
+          {
+            key: 'techLeader',
+            permissionType: 'view',
+            isShowReturnOrder: false,
+            name: '技术部主管指派'
+          },
+          {
+            key: 'techApprove',
+            permissionType: 'update',
+            isShowReturnOrder: false,
+            name: '技术员审核'
+          },
           {
             key: 'produceLeader',
             permissionType: 'view',
+            isShowReturnOrder: false,
             name: '生产部主管指派'
           },
           {
             key: 'produceApprove',
             permissionType: 'update',
+            isShowReturnOrder: false,
             name: '生产员审核'
           },
           // { key: 'outerStoremanOut', permissionType: 'view',  name: '物品出库给外协' },
           // { key: 'innerStoremanIn', permissionType: 'view', name: '内部生产物品入库' },
-          { key: 'QCApprove2', permissionType: 'update', name: '质检员反馈' }
+          {
+            key: 'QCApprove2',
+            permissionType: 'update',
+            isShowReturnOrder: false,
+            name: '质检员反馈'
+          }
         ],
         activeComp: '',
         permissionType: '',
@@ -102,6 +145,7 @@
       handleCard(val) {
         this.activeComp = val.key;
         this.permissionType = val.permissionType;
+        this.isShowReturnOrder = val.isShowReturnOrder;
         this.key++;
         this.getActiveCompValue();
       },

+ 287 - 277
src/views/bpm/handleTask/components/saleOrder/customerReturnGoods/inboundDetails.vue

@@ -46,7 +46,7 @@
       <div class="mt20">
         <div class="mt10">
           <el-table
-						v-if="showTable"
+            v-if="showTable"
             ref="multipleTable"
             :data="warehousingMaterialList"
             tooltip-effect="dark"
@@ -160,38 +160,34 @@
               </template>
             </el-table-column>
             <el-table-column
-                label="货位"
-                prop="houseList"
-                :show-overflow-tooltip="true"
-                width="250"
-                required
-              >
-                <template slot-scope="{ row, $index }">
-                    <div v-if="isEdit" @click="handleWareHouse(row, $index)">
-                      <div
-                        style="color: #ff4949"
-                        v-if="row.houseList.length === 0"
+              label="货位"
+              prop="houseList"
+              :show-overflow-tooltip="true"
+              width="250"
+              required
+            >
+              <template slot-scope="{ row, $index }">
+                <div v-if="isEdit" @click="handleWareHouse(row, $index)">
+                  <div style="color: #ff4949" v-if="row.houseList.length === 0">
+                    ---(必填)
+                  </div>
+                  <div v-else>
+                    <div
+                      class="fontOmitted"
+                      v-for="(item, index) in row.houseList"
+                      :key="index"
+                    >
+                      {{ item.warehouseName }}- {{ item.areaName }}-
+                      {{ item.shelfCode }}- {{ item.cargoSpaceCode
+                      }}<span style="color: #ff4949" v-if="item.num">
+                        - {{ item.num }}(数)</span
                       >
-                        ---(必填)
-                      </div>
-                      <div v-else>
-                        <div
-                          class="fontOmitted"
-                          v-for="(item, index) in row.houseList"
-                          :key="index"
-                        >
-                          {{ item.warehouseName }}- {{ item.areaName }}-
-                          {{ item.shelfCode }}- {{ item.cargoSpaceCode
-                          }}<span style="color: #ff4949" v-if="item.num">
-                            - {{ item.num }}(数)</span
-                          >
-                          <br />
-                        </div>
-                      </div>
+                      <br />
                     </div>
-										<div v-else>{{ row.position }}</div>
-                </template>
-              </el-table-column>
+                  </div>
+                </div>
+                <div v-else>{{ row.position }}</div>
+              </template>
             </el-table-column>
             <!-- <el-table-column
                 label="质检单"
@@ -387,10 +383,10 @@
         </el-table-column>
       </el-table>
     </div>
-		<WareHouseDailog
-		ref="wareHouseDailogRef"
-		@houseData="houseData"
-	></WareHouseDailog>
+    <WareHouseDailog
+      ref="wareHouseDailogRef"
+      @houseData="houseData"
+    ></WareHouseDailog>
   </div>
 </template>
 
@@ -398,9 +394,9 @@
   // import { getInfo } from '@/api/stockManagement/outgoingManagement' '@/components/PageHeader'
   // import PageHeader from '@/components/PageHeader';
   // import { tableHeader } from '../common';
-	import WareHouseDailog from '@/components/WareHouseDailog/index.vue'
+  import WareHouseDailog from '@/components/WareHouseDailog/index.vue';
   import { mapGetters, mapActions } from 'vuex';
-	import { getOutInBySourceBizNoOrError } from '@/api/classifyManage/index'
+  import { getOutInBySourceBizNoOrError } from '@/api/classifyManage/index';
   //import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
 
   // import {
@@ -425,14 +421,14 @@
         }
       }
     },
-		components: {
-			WareHouseDailog
-  	},
+    components: {
+      WareHouseDailog
+    },
 
     data() {
       return {
-				isEdit: true, // 是否可以编辑(货位和质检状态)
-				showTable: true, // 解决set数组Table不刷新问题
+        isEdit: true, // 是否可以编辑(货位和质检状态)
+        showTable: true, // 解决set数组Table不刷新问题
         title: '信息',
         qualityStatus: {
           0: '未检',
@@ -447,49 +443,52 @@
         infoData: {}, // 上传入库信息
         warehousingMaterialList: [], // 物品列表
         materialCodeReqList: [], // 包装列表
-				metaList: [], // 物料列表
+        metaList: [] // 物料列表
       };
     },
     computed: {
       ...mapGetters(['getDictValue'])
     },
     methods: {
-			// 仓库选择
-			houseData(argum, idx) {
-				console.log(argum)
-				console.log(idx)
-				this.showTable = false
+      // 仓库选择
+      houseData(argum, idx) {
+        console.log(argum);
+        console.log(idx);
+        this.showTable = false;
         this.$set(this.warehousingMaterialList[idx], 'houseList', argum);
-				this.$set(this.infoData.outInDetailAddPOList[idx], 'houseList', argum);
-				this.$nextTick(() => {
-					this.showTable = true
-					// 添加货位字段
-					for (let key in this.infoData.outInDetailAddPOList) {
-          for (let k in this.infoData.outInDetailAddPOList[key].houseList) {
-            let house = this.infoData.outInDetailAddPOList[key].houseList[k];
-						this.infoData.outInDetailAddPOList[key].pathName = `${house.warehouseName},${house.areaName},${house.shelfCode},${house.cargoSpaceCode}`,
-						this.infoData.outInDetailAddPOList[key].pathIds = `${house.warehouseId},${house.areaId},${house.shelfId},${house.cargoSpaceId}`
-						this.infoData.outInDetailAddPOList[key].num = 1 // 有问题
-            // this.infoData.outInDetailAddPOList[key].warehouseName =
-            //   house.warehouseName;
-						// 	this.infoData.outInDetailAddPOList[key].areaName = house.areaName;
-						// 	this.infoData.outInDetailAddPOList[key].shelfCode = house.shelfCode;
-						// 	this.infoData.outInDetailAddPOList[key].cargoSpaceCode =
-            //   house.cargoSpaceCode;
-						// 	this.infoData.outInDetailAddPOList[key].warehouseId = house.warehouseId;
-						// 	this.infoData.outInDetailAddPOList[key].areaId = house.areaId;
-						// 	this.infoData.outInDetailAddPOList[key].shelfId = house.shelfId;
-						// 	this.infoData.outInDetailAddPOList[key].cargoSpaceId = house.cargoSpaceId;
-						// 	this.infoData.outInDetailAddPOList[key].num = house.num;
+        this.$set(this.infoData.outInDetailAddPOList[idx], 'houseList', argum);
+        this.$nextTick(() => {
+          this.showTable = true;
+          // 添加货位字段
+          for (let key in this.infoData.outInDetailAddPOList) {
+            for (let k in this.infoData.outInDetailAddPOList[key].houseList) {
+              let house = this.infoData.outInDetailAddPOList[key].houseList[k];
+              (this.infoData.outInDetailAddPOList[
+                key
+              ].pathName = `${house.warehouseName},${house.areaName},${house.shelfCode},${house.cargoSpaceCode}`),
+                (this.infoData.outInDetailAddPOList[
+                  key
+                ].pathIds = `${house.warehouseId},${house.areaId},${house.shelfId},${house.cargoSpaceId}`);
+              this.infoData.outInDetailAddPOList[key].num = 1; // 有问题
+              // this.infoData.outInDetailAddPOList[key].warehouseName =
+              //   house.warehouseName;
+              // 	this.infoData.outInDetailAddPOList[key].areaName = house.areaName;
+              // 	this.infoData.outInDetailAddPOList[key].shelfCode = house.shelfCode;
+              // 	this.infoData.outInDetailAddPOList[key].cargoSpaceCode =
+              //   house.cargoSpaceCode;
+              // 	this.infoData.outInDetailAddPOList[key].warehouseId = house.warehouseId;
+              // 	this.infoData.outInDetailAddPOList[key].areaId = house.areaId;
+              // 	this.infoData.outInDetailAddPOList[key].shelfId = house.shelfId;
+              // 	this.infoData.outInDetailAddPOList[key].cargoSpaceId = house.cargoSpaceId;
+              // 	this.infoData.outInDetailAddPOList[key].num = house.num;
+            }
           }
-        }
-				console.log(this.infoData.outInDetailAddPOList)
-			})
-				
+          console.log(this.infoData.outInDetailAddPOList);
+        });
       },
-			// 仓库编辑
+      // 仓库编辑
       handleWareHouse(row, idx) {
-					this.$refs.wareHouseDailogRef.open(row, idx);
+        this.$refs.wareHouseDailogRef.open(row, idx);
       },
       // 包装维度修改质检改变物料维度质检(结果和状态)
       changeMaterialResult() {
@@ -617,8 +616,8 @@
           });
         } else {
           this.$nextTick(() => {
-            this.changeMaterialResult()
-          })
+            this.changeMaterialResult();
+          });
         }
         // 缺少包装明细让步接收物料如何选择结果
       },
@@ -626,7 +625,7 @@
       calcSumTotal(packingCount, outInNum, univalence) {
         //最小包装单元,包装数量,单价
         const total = {
-          PackingCount: Number(packingCount > 0? packingCount : 0),
+          PackingCount: Number(packingCount > 0 ? packingCount : 0),
           outInNum: Number(outInNum > 0 ? outInNum : 0),
           univalence: Number(univalence > 0 ? univalence : 0)
         };
@@ -636,135 +635,146 @@
       async initialize() {
         // returnInReceiptId退货入库单id(有说明已入库)
         if (this.returnDetailsForm.returnInReceiptId) {
-          getOutInByIdAPI(this.returnDetailsForm.returnInReceiptId).then((data) => {
-            console.log(data)
-            console.log('有订单来源')
-            this.isEdit = false
-            this.infoData = deepClone(data)
-            // 增加是否已经入库字段
-            this.infoData.isStorage = true
-            // 填充遍历数据
-            if (this.infoData.outInDetailVOList?.length > 0) {
-              this.warehousingMaterialList = []; // 物品列表
-              this.materialCodeReqList = []; // 包装列表
-              this.metaList = []; // 物料列表
-              this.infoData.outInDetailVOList.forEach((goodsiItem) => {
-                this.warehousingMaterialList.push(goodsiItem);
-                goodsiItem.outInDetailRecordVOList.forEach((wrapItem) => {
-                  wrapItem.count =
-                    wrapItem.outInDetailRecordMaterialDetailVOList.length; // 增加包装计量数量
-                  this.materialCodeReqList.push(wrapItem);
-                  wrapItem.outInDetailRecordMaterialDetailVOList.forEach((materialItem) => {
-                    this.metaList.push(materialItem);
+          getOutInByIdAPI(this.returnDetailsForm.returnInReceiptId).then(
+            (data) => {
+              console.log(data);
+              console.log('有订单来源');
+              this.isEdit = false;
+              this.infoData = deepClone(data);
+              // 增加是否已经入库字段
+              this.infoData.isStorage = true;
+              // 填充遍历数据
+              if (this.infoData.outInDetailVOList?.length > 0) {
+                this.warehousingMaterialList = []; // 物品列表
+                this.materialCodeReqList = []; // 包装列表
+                this.metaList = []; // 物料列表
+                this.infoData.outInDetailVOList.forEach((goodsiItem) => {
+                  this.warehousingMaterialList.push(goodsiItem);
+                  goodsiItem.outInDetailRecordVOList.forEach((wrapItem) => {
+                    wrapItem.count =
+                      wrapItem.outInDetailRecordMaterialDetailVOList.length; // 增加包装计量数量
+                    this.materialCodeReqList.push(wrapItem);
+                    wrapItem.outInDetailRecordMaterialDetailVOList.forEach(
+                      (materialItem) => {
+                        this.metaList.push(materialItem);
+                      }
+                    );
                   });
                 });
-              });
+              }
             }
-          })
+          );
         } else {
-          console.log('没有订单来源')
-          this.isEdit = true
-					// outboundType 1包装 2物料
-					let sendNo = this.returnDetailsForm.detailList[0]?.outInId;
-					// 将退货物品明细划分为包装和物料(从物料往上反推形成tree)
-					// 包装清单
-					let wrapList =
-						this.returnDetailsForm.detailList?.length > 0
-							? this.returnDetailsForm.detailList.filter(
-									(item) => item.outboundType === 1
-								)
-							: [];
-					// 物料清单
-					let material =
-						this.returnDetailsForm.detailList?.length > 0
-							? this.returnDetailsForm.detailList.filter(
-									(item) => item.outboundType === 2
-								)
-							: [];
-					// 获取出库单详情
-					const data = await getOutInByIdAPI(sendNo);
-					// 复制出库单详情
-					this.infoData = deepClone(data);
-					// 添加单据来源
-					this.infoData.sourceBizNo = this.returnDetailsForm.returnHandleNo
-					// 增加是否已经入库字段
-					this.infoData.isStorage = false
-					// 将出库状态改成入库状态 2出库 1入库
-					this.infoData.type = 1;
-					// 通过物料过滤出库单详情树
-					this.infoData.outInDetailVOList.forEach((goodsItem) => {
-						// 过滤物料维度
-						goodsItem.outInDetailRecordVOList.forEach((wrapItem) => {
-							wrapItem.outInDetailRecordMaterialDetailVOList =
-								wrapItem.outInDetailRecordMaterialDetailVOList.map(
-									(materialItem) => {
-										let hasMaterialItem = material.some(
-											(item) => item.outboundDetailId === materialItem.id
-										);
-										if (hasMaterialItem) {
-                      console.log(materialItem)
-											return materialItem;
-										}
-									}
-								);
-						});
-					});
-					// 通过包装过滤出库单详情树
-					this.infoData.outInDetailVOList.forEach((goodsItem) => {
-						// 过滤包装维度
-						goodsItem.outInDetailRecordVOList =
-							goodsItem.outInDetailRecordVOList.map((wrapItem) => {
-								// 过滤在包装清单内或者存在过滤物料的包装
-								if (wrapList.length > 0) {
-									let hasWrapItem = wrapList.some((item) => {
-										return (
-											item.outboundDetailId === wrapItem.id ||
-											wrapItem.outInDetailRecordMaterialDetailVOList?.length > 0
-										);
-									});
-									if (hasWrapItem) {
-										return wrapItem;
-									}
-								} else {
-									// 返回存在物料维度的包装维度
-									if (
-										wrapItem.outInDetailRecordMaterialDetailVOList?.length > 0
-									) {
-										return wrapItem;
-									}
-								}
-							});
-					});
-					// 过滤没有包装的物品维度
-					this.infoData.outInDetailVOList = this.infoData.outInDetailVOList.map(
-						(goodsItem) => {
-							if (goodsItem.outInDetailRecordVOList?.length > 0) {
-								return goodsItem;
-							}
-						}
-					);
+          console.log('没有订单来源');
+          this.isEdit = true;
+          // outboundType 1包装 2物料
+          let sendNo = this.returnDetailsForm.detailList[0]?.outInId;
+          // 将退货物品明细划分为包装和物料(从物料往上反推形成tree)
+          // 包装清单
+          let wrapList =
+            this.returnDetailsForm.detailList?.length > 0
+              ? this.returnDetailsForm.detailList.filter(
+                  (item) => item.outboundType === 1
+                )
+              : [];
+          // 物料清单
+          let material =
+            this.returnDetailsForm.detailList?.length > 0
+              ? this.returnDetailsForm.detailList.filter(
+                  (item) => item.outboundType === 2
+                )
+              : [];
+          // 获取出库单详情
+          const data = await getOutInByIdAPI(sendNo);
+          // 复制出库单详情
+          this.infoData = deepClone(data);
+          // 添加单据来源
+          this.infoData.sourceBizNo = this.returnDetailsForm.returnHandleNo;
+          // 增加是否已经入库字段
+          this.infoData.isStorage = false;
+          // 将出库状态改成入库状态 2出库 1入库
+          this.infoData.type = 1;
+          // 通过物料过滤出库单详情树
+          this.infoData.outInDetailVOList.forEach((goodsItem) => {
+            // 过滤物料维度
+            goodsItem.outInDetailRecordVOList.forEach((wrapItem) => {
+              wrapItem.outInDetailRecordMaterialDetailVOList =
+                wrapItem.outInDetailRecordMaterialDetailVOList.map(
+                  (materialItem) => {
+                    let hasMaterialItem = material.some(
+                      (item) => item.outboundDetailId === materialItem.id
+                    );
+                    if (hasMaterialItem) {
+                      console.log(materialItem);
+                      return materialItem;
+                    }
+                  }
+                );
+            });
+          });
+          // 通过包装过滤出库单详情树
+          this.infoData.outInDetailVOList.forEach((goodsItem) => {
+            // 过滤包装维度
+            goodsItem.outInDetailRecordVOList =
+              goodsItem.outInDetailRecordVOList.map((wrapItem) => {
+                // 过滤在包装清单内或者存在过滤物料的包装
+                if (wrapList.length > 0) {
+                  let hasWrapItem = wrapList.some((item) => {
+                    return (
+                      item.outboundDetailId === wrapItem.id ||
+                      wrapItem.outInDetailRecordMaterialDetailVOList?.length > 0
+                    );
+                  });
+                  if (hasWrapItem) {
+                    return wrapItem;
+                  }
+                } else {
+                  // 返回存在物料维度的包装维度
+                  if (
+                    wrapItem.outInDetailRecordMaterialDetailVOList?.length > 0
+                  ) {
+                    return wrapItem;
+                  }
+                }
+              });
+          });
+          // 过滤没有包装的物品维度
+          this.infoData.outInDetailVOList = this.infoData.outInDetailVOList.map(
+            (goodsItem) => {
+              if (goodsItem.outInDetailRecordVOList?.length > 0) {
+                return goodsItem;
+              }
+            }
+          );
           // 处理过滤map为空的数组
-          this.infoData.outInDetailVOList = this.infoData.outInDetailVOList.filter((item) => !!item)
+          this.infoData.outInDetailVOList =
+            this.infoData.outInDetailVOList.filter((item) => !!item);
           this.infoData.outInDetailVOList.forEach((goodsItem) => {
-            goodsItem.outInDetailRecordVOList = goodsItem.outInDetailRecordVOList.filter((wrapItem) => !!wrapItem)
-					});
+            goodsItem.outInDetailRecordVOList =
+              goodsItem.outInDetailRecordVOList.filter(
+                (wrapItem) => !!wrapItem
+              );
+          });
           this.infoData.outInDetailVOList.forEach((goodsItem) => {
             goodsItem.outInDetailRecordVOList.forEach((wrapItem) => {
-              wrapItem.outInDetailRecordMaterialDetailVOList = wrapItem.outInDetailRecordMaterialDetailVOList.filter((metail) => !!metail)
-            })
-          })
-					this.initData();
+              wrapItem.outInDetailRecordMaterialDetailVOList =
+                wrapItem.outInDetailRecordMaterialDetailVOList.filter(
+                  (metail) => !!metail
+                );
+            });
+          });
+          this.initData();
         }
         // returnHandleNo 有单据来源说明已入库(被驳回状态)
-				// getOutInBySourceBizNoOrError(this.returnDetailsForm.returnHandleNo).then((data) => {
+        // getOutInBySourceBizNoOrError(this.returnDetailsForm.returnHandleNo).then((data) => {
         //   console.log(data)
         //   console.log('有订单来源')
         //   this.isEdit = false
-				// 	this.infoData = deepClone(data)
-				// 	// 增加是否已经入库字段
-				// 	this.infoData.isStorage = true
-				// 	// 填充遍历数据
-				// 	if (this.infoData.outInDetailVOList?.length > 0) {
+        // 	this.infoData = deepClone(data)
+        // 	// 增加是否已经入库字段
+        // 	this.infoData.isStorage = true
+        // 	// 填充遍历数据
+        // 	if (this.infoData.outInDetailVOList?.length > 0) {
         //     this.warehousingMaterialList = []; // 物品列表
         //     this.materialCodeReqList = []; // 包装列表
         //     this.metaList = []; // 物料列表
@@ -783,97 +793,97 @@
         // }).catch(async() => {
         //   console.log('没有订单来源')
         //   this.isEdit = true
-				// 	// outboundType 1包装 2物料
-				// 	let sendNo = this.returnDetailsForm.detailList[0]?.outInId;
-				// 	// 将退货物品明细划分为包装和物料(从物料往上反推形成tree)
-				// 	// 包装清单
-				// 	let wrapList =
-				// 		this.returnDetailsForm.detailList?.length > 0
-				// 			? this.returnDetailsForm.detailList.filter(
-				// 					(item) => item.outboundType === 1
-				// 				)
-				// 			: [];
-				// 	// 物料清单
-				// 	let material =
-				// 		this.returnDetailsForm.detailList?.length > 0
-				// 			? this.returnDetailsForm.detailList.filter(
-				// 					(item) => item.outboundType === 2
-				// 				)
-				// 			: [];
-				// 	// 获取出库单详情
-				// 	const data = await getOutInByIdAPI(sendNo);
-				// 	// 复制出库单详情
-				// 	this.infoData = deepClone(data);
-				// 	// 添加单据来源
-				// 	this.infoData.sourceBizNo = this.returnDetailsForm.returnHandleNo
-				// 	// 增加是否已经入库字段
-				// 	this.infoData.isStorage = false
-				// 	// 将出库状态改成入库状态 2出库 1入库
-				// 	this.infoData.type = 1;
-				// 	// 通过物料过滤出库单详情树
-				// 	this.infoData.outInDetailVOList.forEach((goodsItem) => {
-				// 		// 过滤物料维度
-				// 		goodsItem.outInDetailRecordVOList.forEach((wrapItem) => {
-				// 			wrapItem.outInDetailRecordMaterialDetailVOList =
-				// 				wrapItem.outInDetailRecordMaterialDetailVOList.map(
-				// 					(materialItem) => {
-				// 						let hasMaterialItem = material.some(
-				// 							(item) => item.outboundDetailId === materialItem.id
-				// 						);
-				// 						if (hasMaterialItem) {
+        // 	// outboundType 1包装 2物料
+        // 	let sendNo = this.returnDetailsForm.detailList[0]?.outInId;
+        // 	// 将退货物品明细划分为包装和物料(从物料往上反推形成tree)
+        // 	// 包装清单
+        // 	let wrapList =
+        // 		this.returnDetailsForm.detailList?.length > 0
+        // 			? this.returnDetailsForm.detailList.filter(
+        // 					(item) => item.outboundType === 1
+        // 				)
+        // 			: [];
+        // 	// 物料清单
+        // 	let material =
+        // 		this.returnDetailsForm.detailList?.length > 0
+        // 			? this.returnDetailsForm.detailList.filter(
+        // 					(item) => item.outboundType === 2
+        // 				)
+        // 			: [];
+        // 	// 获取出库单详情
+        // 	const data = await getOutInByIdAPI(sendNo);
+        // 	// 复制出库单详情
+        // 	this.infoData = deepClone(data);
+        // 	// 添加单据来源
+        // 	this.infoData.sourceBizNo = this.returnDetailsForm.returnHandleNo
+        // 	// 增加是否已经入库字段
+        // 	this.infoData.isStorage = false
+        // 	// 将出库状态改成入库状态 2出库 1入库
+        // 	this.infoData.type = 1;
+        // 	// 通过物料过滤出库单详情树
+        // 	this.infoData.outInDetailVOList.forEach((goodsItem) => {
+        // 		// 过滤物料维度
+        // 		goodsItem.outInDetailRecordVOList.forEach((wrapItem) => {
+        // 			wrapItem.outInDetailRecordMaterialDetailVOList =
+        // 				wrapItem.outInDetailRecordMaterialDetailVOList.map(
+        // 					(materialItem) => {
+        // 						let hasMaterialItem = material.some(
+        // 							(item) => item.outboundDetailId === materialItem.id
+        // 						);
+        // 						if (hasMaterialItem) {
         //               console.log(materialItem)
-				// 							return materialItem;
-				// 						}
-				// 					}
-				// 				);
-				// 		});
-				// 	});
-				// 	// 通过包装过滤出库单详情树
-				// 	this.infoData.outInDetailVOList.forEach((goodsItem) => {
-				// 		// 过滤包装维度
-				// 		goodsItem.outInDetailRecordVOList =
-				// 			goodsItem.outInDetailRecordVOList.map((wrapItem) => {
-				// 				// 过滤在包装清单内或者存在过滤物料的包装
-				// 				if (wrapList.length > 0) {
-				// 					let hasWrapItem = wrapList.some((item) => {
-				// 						return (
-				// 							item.outboundDetailId === wrapItem.id ||
-				// 							wrapItem.outInDetailRecordMaterialDetailVOList?.length > 0
-				// 						);
-				// 					});
-				// 					if (hasWrapItem) {
-				// 						return wrapItem;
-				// 					}
-				// 				} else {
-				// 					// 返回存在物料维度的包装维度
-				// 					if (
-				// 						wrapItem.outInDetailRecordMaterialDetailVOList?.length > 0
-				// 					) {
-				// 						return wrapItem;
-				// 					}
-				// 				}
-				// 			});
-				// 	});
-				// 	// 过滤没有包装的物品维度
-				// 	this.infoData.outInDetailVOList = this.infoData.outInDetailVOList.map(
-				// 		(goodsItem) => {
-				// 			if (goodsItem.outInDetailRecordVOList?.length > 0) {
-				// 				return goodsItem;
-				// 			}
-				// 		}
-				// 	);
+        // 							return materialItem;
+        // 						}
+        // 					}
+        // 				);
+        // 		});
+        // 	});
+        // 	// 通过包装过滤出库单详情树
+        // 	this.infoData.outInDetailVOList.forEach((goodsItem) => {
+        // 		// 过滤包装维度
+        // 		goodsItem.outInDetailRecordVOList =
+        // 			goodsItem.outInDetailRecordVOList.map((wrapItem) => {
+        // 				// 过滤在包装清单内或者存在过滤物料的包装
+        // 				if (wrapList.length > 0) {
+        // 					let hasWrapItem = wrapList.some((item) => {
+        // 						return (
+        // 							item.outboundDetailId === wrapItem.id ||
+        // 							wrapItem.outInDetailRecordMaterialDetailVOList?.length > 0
+        // 						);
+        // 					});
+        // 					if (hasWrapItem) {
+        // 						return wrapItem;
+        // 					}
+        // 				} else {
+        // 					// 返回存在物料维度的包装维度
+        // 					if (
+        // 						wrapItem.outInDetailRecordMaterialDetailVOList?.length > 0
+        // 					) {
+        // 						return wrapItem;
+        // 					}
+        // 				}
+        // 			});
+        // 	});
+        // 	// 过滤没有包装的物品维度
+        // 	this.infoData.outInDetailVOList = this.infoData.outInDetailVOList.map(
+        // 		(goodsItem) => {
+        // 			if (goodsItem.outInDetailRecordVOList?.length > 0) {
+        // 				return goodsItem;
+        // 			}
+        // 		}
+        // 	);
         //   // 处理过滤map为空的数组
         //   this.infoData.outInDetailVOList = this.infoData.outInDetailVOList.filter((item) => !!item)
         //   this.infoData.outInDetailVOList.forEach((goodsItem) => {
         //     goodsItem.outInDetailRecordVOList = goodsItem.outInDetailRecordVOList.filter((wrapItem) => !!wrapItem)
-				// 	});
+        // 	});
         //   this.infoData.outInDetailVOList.forEach((goodsItem) => {
         //     goodsItem.outInDetailRecordVOList.forEach((wrapItem) => {
         //       wrapItem.outInDetailRecordMaterialDetailVOList = wrapItem.outInDetailRecordMaterialDetailVOList.filter((metail) => !!metail)
         //     })
         //   })
         //   console.log(this.infoData)
-				// 	this.initData();
+        // 	this.initData();
         // })
       },
       // 初始化显示数据
@@ -886,13 +896,13 @@
           this.materialCodeReqList = []; // 包装列表
           this.metaList = []; // 物料列表
           this.infoData.outInDetailAddPOList.forEach((goodsiItem) => {
-						goodsiItem.houseList = []
-            goodsiItem.count = goodsiItem.outInDetailRecordVOList.length
+            goodsiItem.houseList = [];
+            goodsiItem.count = goodsiItem.outInDetailRecordVOList.length;
             goodsiItem.outInDetailRecordAddPOList =
               goodsiItem.outInDetailRecordVOList;
             delete goodsiItem.outInDetailRecordVOList;
             console.log(goodsiItem);
-            
+
             this.warehousingMaterialList.push(goodsiItem);
             goodsiItem.outInDetailRecordAddPOList.forEach((wrapItem) => {
               wrapItem.minUnit = wrapItem.minPackingCount;

+ 158 - 150
src/views/bpm/handleTask/components/saleOrder/customerReturnGoods/submit.vue

@@ -44,7 +44,7 @@
         type="success"
         size="mini"
         @click="handleAudit(1)"
-      >通过
+        >通过
       </el-button>
 
       <el-button
@@ -53,100 +53,157 @@
         size="mini"
         v-if="taskDefinitionKey !== 'stater'"
         @click="handleAudit(0)"
-      >驳回
+        >驳回
       </el-button>
     </div>
   </el-col>
 </template>
 
 <script>
-import {
-  approveTaskWithVariablesAPI,
-  saleReturnUpdateAPI
-} from '@/api/bpm/components/saleManage/saleorder';
-import {listAllUserBind} from '@/api/system/organization';
-import {EventBus} from './eventBus.js';
-import outin from '@/api/warehouseManagement/outin';
-// 流程实例的详情页,可用于审批
-//qcId techId produceId
-export default {
-  name: '',
-  components: {
-    //   Parser
-  },
-  props: {
-    businessId: {
-      default: ''
+  import {
+    approveTaskWithVariablesAPI,
+    saleReturnUpdateAPI
+  } from '@/api/bpm/components/saleManage/saleorder';
+  import { listAllUserBind } from '@/api/system/organization';
+  import { EventBus } from './eventBus.js';
+  import outin from '@/api/warehouseManagement/outin';
+  // 流程实例的详情页,可用于审批
+  //qcId techId produceId
+  export default {
+    name: '',
+    components: {
+      //   Parser
     },
-    taskId: {
-      default: ''
-    },
-    id: {
-      default: ''
-    },
-    taskDefinitionKey: {
-      default: ''
-    }
-  },
-  data() {
-    return {
-      form: {
-        userId: '',
-        reason: ''
+    props: {
+      businessId: {
+        default: ''
       },
-      submitParams: {
-        QCLeader: 'qcId',
-        techLeader: 'techId',
-        produceLeader: 'produceId'
+      taskId: {
+        default: ''
       },
-      rules: {
-        reason: {
-          required: true,
-          message: '请输入审批建议',
-          trigger: 'blur'
-        },
-        userId: {required: true, message: '请选择指派人', trigger: 'change'}
+      id: {
+        default: ''
       },
-      userOptions: [],
-      activeComp: '',
-      permissionType: ''
-    };
-  },
-  async created() {
-    this.userOptions = [];
-    listAllUserBind().then((data) => {
-      this.userOptions.push(...data);
-    });
-    this.activeComp = this.taskDefinitionKey;
-    EventBus.$on('getActiveCompValue', (row) => {
-      this.activeComp = row.activeComp;
-      this.permissionType = row.permissionType;
-    });
-  },
-  mounted() {
-  },
-  methods: {
-    //保存表格数据
-    async handleAudit(pass) {
-      let data = await this.getTableValue();
-      let updateCode = '1' //判断saleReturnUpdateAPI方法是否执行成功
-      this.$refs.formRef.validate(async (validate) => {
-        if ((!validate || !data) && !!pass) return this.$message.warning('有必填项未填,请检查');
-        if (this.permissionType == 'update' && !!pass) updateCode = await saleReturnUpdateAPI(data);
-        if (typeof updateCode !== 'string') return
-        let variables = {
-          pass: !!pass
-        };
-        if (this.submitParams[this.taskDefinitionKey]) {
-          variables[this.submitParams[this.taskDefinitionKey]] =
-            this.form.userId;
+      taskDefinitionKey: {
+        default: ''
+      }
+    },
+    data() {
+      return {
+        form: {
+          userId: '',
+          reason: ''
+        },
+        submitParams: {
+          QCLeader: 'qcId',
+          techLeader: 'techId',
+          produceLeader: 'produceId'
+        },
+        rules: {
+          reason: {
+            required: true,
+            message: '请输入审批建议',
+            trigger: 'blur'
+          },
+          userId: { required: true, message: '请选择指派人', trigger: 'change' }
+        },
+        userOptions: [],
+        activeComp: '',
+        permissionType: ''
+      };
+    },
+    async created() {
+      this.userOptions = [];
+      listAllUserBind().then((data) => {
+        this.userOptions.push(...data);
+      });
+      this.activeComp = this.taskDefinitionKey;
+      EventBus.$on('getActiveCompValue', (row) => {
+        this.activeComp = row.activeComp;
+        this.permissionType = row.permissionType;
+      });
+    },
+    mounted() {},
+    methods: {
+      // 销售退货入库
+      async salesReturnsInStorage(data, pass) {
+        // 获取销售退货入库信息
+        let storageData = await this.getReturnStorage();
+        // 是否已经入库
+        if (storageData.isStorage) {
+          approveTaskWithVariablesAPI({
+            id: this.taskId,
+            reason: this.form.reason,
+            variables: {
+              pass: !!pass
+            }
+          }).then((res) => {
+            if (res.code != '-1') {
+              this.$emit('handleAudit', {
+                status: pass,
+                title: !pass ? '驳回' : ''
+              });
+            }
+          });
+        } else {
+          // 入库来源storageSource 0-正常  1-外部(外部跳过内部审核流程)
+          storageData.storageSource = 1;
+          // 获取货位信息(判断货位信息是否填写)
+          let houseListLength = storageData.outInDetailAddPOList.map((item) => {
+            return item.houseList.length;
+          });
+          let boolen = houseListLength.every((item) => item > 0);
+          if (boolen) {
+            try {
+              const res = await outin.save(storageData);
+              console.log('res------------------', res);
+              data.returnInReceiptId = res.data;
+              const updateRes = await saleReturnUpdateAPI(data);
+              if (updateRes.code == 0) {
+                approveTaskWithVariablesAPI({
+                  id: this.taskId,
+                  reason: this.form.reason,
+                  variables: {
+                    pass: !!pass
+                  }
+                }).then((res) => {
+                  if (res.code != '-1') {
+                    this.$emit('handleAudit', {
+                      status: pass,
+                      title: !pass ? '驳回' : ''
+                    });
+                  }
+                });
+              }
+            } catch (error) {
+              console.error('保存失败:', error);
+            }
+          } else {
+            this.$message.error('请选择物品货位信息');
+          }
         }
-        // 销售退货入库
-        if (this.taskDefinitionKey === 'storeman' && !!pass) {
-          // 获取销售退货入库信息
-          let storageData = await this.getReturnStorage();
-          // 是否已经入库
-          if (storageData.isStorage) {
+      },
+      //保存表格数据
+      async handleAudit(pass) {
+        let data = await this.getTableValue();
+        let updateCode = '1'; //判断saleReturnUpdateAPI方法是否执行成功
+        this.$refs.formRef.validate(async (validate) => {
+          if ((!validate || !data) && !!pass)
+            return this.$message.warning('有必填项未填,请检查');
+          // 销售退货入库节点
+          if (this.taskDefinitionKey === 'storeman' && !!pass) {
+            this.salesReturnsInStorage(data, pass);
+          } else {
+            if (this.permissionType == 'update' && !!pass)
+              updateCode = await saleReturnUpdateAPI(data);
+            if (typeof updateCode !== 'string') return;
+            let variables = {
+              pass: !!pass
+            };
+            if (this.submitParams[this.taskDefinitionKey]) {
+              variables[this.submitParams[this.taskDefinitionKey]] =
+                this.form.userId;
+            }
             approveTaskWithVariablesAPI({
               id: this.taskId,
               reason: this.form.reason,
@@ -159,77 +216,28 @@ export default {
                 });
               }
             });
-          } else {
-            // 入库来源storageSource 0-正常  1-外部(外部跳过内部审核流程)
-            storageData.storageSource = 1;
-            // 获取货位信息(判断货位信息是否填写)
-            let houseListLength = storageData.outInDetailAddPOList.map(
-              (item) => {
-                return item.houseList.length;
-              }
-            );
-            let boolen = houseListLength.every((item) => item > 0);
-            if (boolen) {
-              console.log(storageData);
-              try {
-                const res = await outin.save(storageData);
-                console.log(res);
-                if (res.code == 0) {
-                  approveTaskWithVariablesAPI({
-                    id: this.taskId,
-                    reason: this.form.reason,
-                    variables
-                  }).then((res) => {
-                    if (res.code != '-1') {
-                      this.$emit('handleAudit', {
-                        status: pass,
-                        title: !pass ? '驳回' : ''
-                      });
-                    }
-                  });
-                }
-              } catch (error) {
-                console.error('保存失败:', error);
-              }
-            } else {
-              this.$message.error('请选择物品货位信息');
-            }
           }
-        } else {
-          approveTaskWithVariablesAPI({
-            id: this.taskId,
-            reason: this.form.reason,
-            variables
-          }).then((res) => {
-            if (res.code != '-1') {
-              this.$emit('handleAudit', {
-                status: pass,
-                title: !pass ? '驳回' : ''
-              });
-            }
+        });
+      },
+      getTableValue() {
+        return new Promise((resolve, reject) => {
+          this.$emit('getTableValue', async (data) => {
+            resolve(await data);
           });
-        }
-      });
-    },
-    getTableValue() {
-      return new Promise((resolve, reject) => {
-        this.$emit('getTableValue', async (data) => {
-          resolve(await data);
         });
-      });
-    },
-    getReturnStorage() {
-      return new Promise((resolve, reject) => {
-        this.$emit('getReturnStorage', async (data) => {
-          resolve(await data);
+      },
+      getReturnStorage() {
+        return new Promise((resolve, reject) => {
+          this.$emit('getReturnStorage', async (data) => {
+            resolve(await data);
+          });
         });
-      });
+      }
+    },
+    beforeDestroy() {
+      EventBus.$off('getActiveCompValue');
     }
-  },
-  beforeDestroy() {
-    EventBus.$off('getActiveCompValue');
-  }
-};
+  };
 </script>
 
 <style lang="scss"></style>