Przeglądaj źródła

Merge branch 'master' of http://110.41.163.243:9980/kd-aiot/kd-aiot-frontend-wt

liujt 2 miesięcy temu
rodzic
commit
d72810d58a

+ 23 - 37
src/views/bpm/processInstance/detailNew.vue

@@ -1,4 +1,4 @@
-<template>
+<template>
   <div class="app-container" style="padding: 15px">
     <!-- 审批记录 -->
     <el-card class="box-card" v-loading="tasksLoad">
@@ -20,35 +20,37 @@
                   v-if="item.assigneeUser"
                   style="font-weight: normal; margin-right: 30px"
                 >
-                  {{ index == 0 ? ' 审批人' : '发起人' }}:{{
+                  {{ index == 0 ? '审批人' : '发起人' }}:{{
                     item.assigneeUser.nickname
                   }}
                   <el-tag type="info" size="mini">{{
                     item.assigneeUser.deptName
                   }}</el-tag>
                 </label>
-                <label style="font-weight: normal" v-if="item.createTime"
-                  >创建时间:</label
-                >
+                <label style="font-weight: normal" v-if="item.createTime">
+                  创建时间:
+                </label>
                 <label style="color: #8a909c; font-weight: normal">{{
                   item.createTime
                 }}</label>
                 <label
                   v-if="item.endTime"
                   style="margin-left: 30px; font-weight: normal"
-                  >审批时间:</label
                 >
+                  审批时间:
+                </label>
                 <label
                   v-if="item.endTime"
                   style="color: #8a909c; font-weight: normal"
                 >
-                  {{ item.endTime }}</label
-                >
+                  {{ item.endTime }}
+                </label>
                 <label
                   v-if="item.durationInMillis"
                   style="margin-left: 30px; font-weight: normal"
-                  >耗时:</label
                 >
+                  耗时:
+                </label>
                 <label
                   v-if="item.durationInMillis"
                   style="color: #8a909c; font-weight: normal"
@@ -152,9 +154,9 @@
     },
     watch: {
       id: {
-        handler(newVal, oldVal) {
+        handler(newVal) {
           if (newVal) {
-            console.log(newVal,'watchnewVal')
+            console.log(newVal, 'watchnewVal');
             this.getDetail();
           }
         },
@@ -168,11 +170,13 @@
     },
     methods: {
       getChildren(data) {
-        let arr = [];
-        arr.push(...data);
-        if (data.children) {
-          this.getChildren(data.children);
-        }
+        const arr = [];
+        (data || []).forEach((item) => {
+          if (item.children && item.children.length > 0) {
+            arr.push(...this.getChildren(item.children));
+          }
+          arr.push(item);
+        });
         return arr;
       },
 
@@ -180,7 +184,7 @@
       getDetail() {
         // 获得流程实例相关
         this.processInstanceLoading = true;
-        console.log(this.id,'this.id')
+        console.log(this.id, 'this.id');
         getProcessInstance(this.id).then((response) => {
           if (!response) {
             this.$message.error('查询不到流程信息!');
@@ -189,7 +193,7 @@
           // 设置流程信息
           this.processInstance = response;
 
-          // //将业务表单注册为动态组件
+          // // 将业务表单注册为动态组件
           // const path = this.processInstance.processDefinition.formCustomViewPath;
           // Vue.component("async-biz-form-component", function (resolve) {
           //   require([`@/views${path}`], resolve);
@@ -205,7 +209,6 @@
           getActivityList({
             processInstanceId: this.processInstance.id
           }).then((response) => {
-            
             this.activityList = response;
           });
 
@@ -221,27 +224,10 @@
           // console.log(response,'response')
           // 移除已取消的审批
           response.forEach((task) => {
-            if (task.children.length > 0) {
-              this.tasks.push(...this.getChildren(task.children));
-            }
             // if (task.result !== 4) {
-            this.tasks.push(task);
+            this.tasks.push(...this.getChildren([task]));
             // }
           });
-          // 排序,将未完成的排在前面,已完成的排在后面;
-          this.tasks.sort((a, b) => {
-            // 有已完成的情况,按照完成时间倒序
-            if (a.endTime && b.endTime) {
-              return b.endTime - a.endTime;
-            } else if (a.endTime) {
-              return 1;
-            } else if (b.endTime) {
-              return -1;
-              // 都是未完成,按照创建时间倒序
-            } else {
-              return b.createTime - a.createTime;
-            }
-          });
 
           // 需要审核的记录
           const userId = store.getters.userId;

+ 363 - 284
src/views/bpm/stockManagement/storage.vue

@@ -244,13 +244,13 @@
               </template>
 
               <!-- 数量 -->
-              <template v-slot:packingQuantity="{ row, $index }">
+              <template v-slot:quantity="{ row, $index }">
                 <template v-if="row.isSave">
-                  {{ row.packingQuantity }}
+                  {{ row.quantity }}
                 </template>
                 <el-form-item
                   v-else
-                  :prop="'productList.' + $index + '.packingQuantity'"
+                  :prop="'productList.' + $index + '.quantity'"
                   :rules="{
                     required: true,
                     message: '请输入数量',
@@ -258,12 +258,12 @@
                   }"
                 >
                   <el-input
-                    :ref="'packingQuantity' + $index"
+                    :ref="'quantity' + $index"
                     type="number"
                     @keyup.native="
-                      moveFocus($event, $index, 'packingQuantity', '产品', row)
+                      moveFocus($event, $index, 'quantity', '产品', row)
                     "
-                    v-model="row.packingQuantity"
+                    v-model="row.quantity"
                     @input="computeNum(row, $index, true)"
                   >
                   </el-input>
@@ -271,13 +271,13 @@
               </template>
 
               <!-- 单位 -->
-              <template v-slot:packingUnit="{ row, $index }">
+              <template v-slot:unit="{ row, $index }">
                 <template v-if="row.isSave">
-                  {{ row.packingUnit }}
+                  {{ row.unit }}
                 </template>
                 <el-form-item
                   v-else
-                  :prop="'productList.' + $index + '.packingUnit'"
+                  :prop="'productList.' + $index + '.unit'"
                   :rules="{
                     required: true,
                     message: '请选择单位',
@@ -285,7 +285,7 @@
                   }"
                 >
                   <el-select
-                    v-model="row.packingUnitId"
+                    v-model="row.unitId"
                     placeholder="请选择"
                     @change="computeNum(row, $index)"
                   >
@@ -319,7 +319,7 @@
                     :min="0"
                     controls-position="right"
                     @change="inputsingleWeight(row, $index)"
-                    :disabled="row.weightUnit == row.packingUnit"
+                    :disabled="row.weightUnit == row.unit"
                     :controls="false"
                     style="width: 100%"
                   ></el-input-number>
@@ -337,7 +337,7 @@
                   placeholder="请输入"
                   type="number"
                   @input="inputWeight(row, $index)"
-                  :disabled="row.weightUnit == row.packingUnit"
+                  :disabled="row.weightUnit == row.unit"
                 ></el-input>
               </template>
 
@@ -1144,16 +1144,30 @@
           // 数量
           {
             label: '数量',
-            prop: 'packingQuantity',
-            slot: 'packingQuantity',
+            prop: 'quantity',
+            slot: 'quantity',
             align: 'center',
             width: 100
           },
           // 单位
           {
             label: '单位',
+            prop: 'unit',
+            slot: 'unit',
+            align: 'center',
+            width: 100
+          },
+          // 数量
+          {
+            label: '包装数量',
+            prop: 'packingQuantity',
+            align: 'center',
+            width: 100
+          },
+          // 单位
+          {
+            label: '包装单位',
             prop: 'packingUnit',
-            slot: 'packingUnit',
             align: 'center',
             width: 100
           },
@@ -1453,17 +1467,17 @@
       async computeNum(row, index, isClear) {
         console.log('row, index', row, index);
         let data = row.packingSpecificationOption.find(
-          (item) => item.id == row.packingUnitId
+          (item) => item.id == row.unitId
         );
-        row.packingUnit = data.conversionUnit;
+        row.unit = data.conversionUnit;
         // 清空仓库(包装数量输入)
         if (isClear) {
-          if (row.packingQuantity < 0) {
-            this.$set(this.productList[index], 'packingQuantity', 1);
+          if (row.quantity < 0) {
+            this.$set(this.productList[index], 'quantity', 1);
           }
         }
         //如果有包装数量和包装单位
-        if (row.packingQuantity && row.packingUnit) {
+        if (row.quantity && row.unit) {
           //获取仓库
           const res = await warehouseDefinition.list({
             // inventoryType: this.form.categoryLevelTopId
@@ -1478,7 +1492,7 @@
             let table1 = [];
             table1.push({
               measureQuantity: row.measureQuantity,
-              packingQuantity: row.packingQuantity,
+              packingQuantity: row.quantity,
               warehouseName: name,
               warehouseId: res[0].id
             });
@@ -1501,14 +1515,14 @@
 
           console.log(row, 'rowwwwwwwwwwwwww');
 
-          let total = Number(row.packingQuantity);
+          let total = Number(row.quantity);
           console.log(total, '111');
           if (
-            row.packingUnit == row.measureUnit &&
+            row.unit == row.measureUnit &&
             row.measureUnit == '立方' &&
             row.netWeight
           ) {
-            total = Number(row.packingQuantity) * row.netWeight;
+            total = Number(row.quantity) * row.netWeight;
             console.log(
               total,
               '单位是立方,计量单位也是立方,如果有单重,就计量数量x单重=总重'
@@ -1535,7 +1549,7 @@
           console.log(packingBoolen, 'packingBoolen');
           console.log(measureBoolen, 'measureBoolen');
 
-          if (packingBoolen && measureBoolen && row.packingUnit != 'L') {
+          if (packingBoolen && measureBoolen && row.unit != 'L') {
             row.weight = total;
             console.log(total, '6');
           }
@@ -1543,20 +1557,54 @@
           if (row.measureUnit == row.weightUnit) {
             weight = row.measureQuantity;
             // 如果重量单位和包装单位一致,则单重0
-            if (row.weightUnit == row.packageUnit) {
+            if (row.weightUnit == row.unit) {
               row.singleWeight = 0;
             } else {
               row.singleWeight =
-                Math.trunc(
-                  (row.measureQuantity / row.packingQuantity) * 10000
-                ) / 10000;
+                Math.trunc((row.measureQuantity / row.quantity) * 10000) /
+                10000;
             }
           } else if (row.singleWeight) {
             weight = row.measureQuantity * Number(row.singleWeight);
           }
           this.$set(this.productList[index], 'weight', weight);
+          this.$set(
+            this.productList[index],
+            'packingQuantity',
+            this.setPNum(row)
+          );
         }
       },
+
+      setPNum(row) {
+        let pNum = 0;
+        if (row.unitId) {
+          let splitIndex = row.packingSpecificationOption.findIndex(
+            (item) => item.id == row.unitId
+          );
+          if (splitIndex == 0) {
+            pNum = Math.ceil(
+              row.measureQuantity /
+                row.packingSpecificationOption[1]?.packageCell
+            );
+          }
+          if (splitIndex == 1) {
+            pNum = row.quantity;
+          }
+
+          for (; splitIndex > 1; splitIndex--) {
+            pNum = Math.ceil(
+              row.quantity *
+                row.packingSpecificationOption[splitIndex].packageCell
+            );
+          }
+        } else {
+          pNum = Math.ceil(
+            row.measureQuantity / row.packingSpecificationOption[1]?.packageCell
+          );
+        }
+        return pNum;
+      },
       // 获取动态表头
       getFieldModel() {
         storageApi.fieldModel({ fieldModel: 't_main_category' }).then((res) => {
@@ -1568,7 +1616,9 @@
               showOverflowTooltip: true
             };
           });
-          this.newColumns = [...newRes].filter(item => item.prop != 'extField.packingSpecification');
+          this.newColumns = [...newRes].filter(
+            (item) => item.prop != 'extField.packingSpecification'
+          );
         });
       },
       // 初始化信息
@@ -1652,16 +1702,19 @@
               await storageApi.getCategoryPackageDisposition({
                 categoryIds: res.map((item) => item.id)
               });
-            
+
             let packingSpecificationOption = res.map((item) => {
               return {
                 id: item.id,
                 packingSpecification: packingSpecification
                   .filter((ite) => item.id == ite.categoryId)
                   .sort((a, b) => a.sort - b.sort)
-              }
+              };
             });
-            console.log(packingSpecificationOption,'packingSpecificationOption')
+            console.log(
+              packingSpecificationOption,
+              'packingSpecificationOption'
+            );
 
             this.productList = this.saleProductList.map(
               (filtersItem, index) => {
@@ -1670,16 +1723,21 @@
                     detailItem.code == filtersItem.productCode ||
                     detailItem.code == filtersItem.categoryCode
                 );
-                const packingSpecificationItem = packingSpecificationOption.find(packingSpecificationItem=>packingSpecificationItem.id==filtersItem.productId||packingSpecificationItem.id==filtersItem.categoryId)?.packingSpecification
+                const packingSpecificationItem =
+                  packingSpecificationOption.find(
+                    (packingSpecificationItem) =>
+                      packingSpecificationItem.id == filtersItem.productId ||
+                      packingSpecificationItem.id == filtersItem.categoryId
+                  )?.packingSpecification;
 
                 // 显示规格
                 let packingSpecificationLabel = packingSpecificationItem
-                .map((item) => {
-                  if (item.sort > 0) {
-                    return `${item.packageCell}${item.packageUnit}/${item.conversionUnit}`;
-                  }
-                })
-                .filter((item) => !!item);
+                  .map((item) => {
+                    if (item.sort > 0) {
+                      return `${item.packageCell}${item.packageUnit}/${item.conversionUnit}`;
+                    }
+                  })
+                  .filter((item) => !!item);
 
                 const newSpecificationOption = packingSpecificationItem;
                 console.log(
@@ -1703,17 +1761,27 @@
                     filtersItem.sendTotalWeight ||
                     filtersItem.receiveTotalWeight;
                 }
-                let packingQuantity =
+                let quantity =
                   filtersItem.totalCountNew ||
                   filtersItem.purchaseCount ||
                   filtersItem.totalCount ||
                   0;
-                console.log(packingQuantity, 'packingQudasdasdantity');
-                let packingUnit =
-                  filtersItem.purchaseUnit || filtersItem.measuringUnit || '';
 
+                let unit =
+                  filtersItem.purchaseUnit || filtersItem.measuringUnit || '';
                 let unitPrice = filtersItem.singlePrice || 0;
                 let pricingWay = filtersItem.pricingWay || '';
+                let packingQuantity = this.setPNum({
+                  unitId: filtersItem.purchaseUnitId || filtersItem.saleUnitId,
+                  packingSpecificationOption: newSpecificationOption, // 包装规格选项
+                  measureQuantity:
+                    filtersItem &&
+                    filtersItem.isAllPackageData &&
+                    filtersItem.isAllPackageData == 1
+                      ? filtersItem.quantity
+                      : measureQuantity, // 计量数量
+                  quantity
+                });
                 let singleWeight =
                   filtersItem.singleWeight ||
                   this.detailProductList[0]?.singleWeight ||
@@ -1745,7 +1813,7 @@
                 } else {
                   batchNo = batchNo1;
                 }
-              console.log(newSpecificationOption,'dsd')
+                console.log(newSpecificationOption, 'dsd');
 
                 return {
                   index: this.productList.length + index,
@@ -1768,7 +1836,12 @@
                   packingSpecification: item.packingSpecification, // 包装规格
                   packingSpecificationOption: newSpecificationOption, // 包装规格选项
                   packingSpecificationLabel: packingSpecificationLabel, // 包装规格显示
-                  // minPackingQuantity: minPackingQuantity, // 最小包装单元数量
+                  quantity:
+                    filtersItem &&
+                    filtersItem.isAllPackageData &&
+                    filtersItem.isAllPackageData == 1
+                      ? filtersItem.packingCount
+                      : quantity,
                   packingQuantity:
                     filtersItem &&
                     filtersItem.isAllPackageData &&
@@ -1780,7 +1853,14 @@
                     filtersItem.isAllPackageData &&
                     filtersItem.isAllPackageData == 1
                       ? filtersItem.packingUnit
-                      : packingUnit, // 单位
+                      : item.packingUnit, // 单位
+
+                  unit:
+                    filtersItem &&
+                    filtersItem.isAllPackageData &&
+                    filtersItem.isAllPackageData == 1
+                      ? filtersItem.packingUnit
+                      : unit, // 单位
                   measureQuantity:
                     filtersItem &&
                     filtersItem.isAllPackageData &&
@@ -1794,14 +1874,9 @@
                     filtersItem.isAllPackageData == 1
                       ? filtersItem.measuringUnit
                       : item.measuringUnit, // 计量单位
-                  packingUnitId:
-                    filtersItem.purchaseUnitId || filtersItem.saleUnitId,
-                  modelKey: filtersItem.modelKey
-                    ? filtersItem.modelKey
-                    : '', // 机型
-                  colorKey: filtersItem.colorKey
-                    ? filtersItem.colorKey
-                    : '', // 颜色
+                  unitId: filtersItem.purchaseUnitId || filtersItem.saleUnitId,
+                  modelKey: filtersItem.modelKey ? filtersItem.modelKey : '', // 机型
+                  colorKey: filtersItem.colorKey ? filtersItem.colorKey : '', // 颜色
                   measureType: item.measureType, // 计量方式
                   netWeight: item.netWeight > -1 ? item.netWeight : 0, // 净重
                   singleWeight: singleWeight || 0, // 单重重量
@@ -1855,13 +1930,14 @@
           this.detailList.forEach((item) => {
             const key = `${item.productCode}_${item.batchNo}_${item.colorKey}_${item.warehouseId}_${item.modelType}`;
             const existIndex = mergedList.findIndex(
-              (m) => `${m.productCode}_${m.batchNo}_${m.colorKey}_${m.warehouseId}_${m.modelType}` === key
+              (m) =>
+                `${m.productCode}_${m.batchNo}_${m.colorKey}_${m.warehouseId}_${m.modelType}` ===
+                key
             );
             if (existIndex > -1) {
               mergedList[existIndex].quantity += item.quantity;
               mergedList[existIndex].packingWeight += item.packingWeight;
               mergedList[existIndex].packingQuantity += item.packingQuantity;
-
             } else {
               mergedList.push({ ...item });
             }
@@ -1901,9 +1977,12 @@
                   packingSpecification: packingSpecification
                     .filter((ite) => item.id == ite.categoryId)
                     .sort((a, b) => a.sort - b.sort)
-                }
+                };
               });
-              console.log(packingSpecificationOptions,'packingSpecificationOptions')
+              console.log(
+                packingSpecificationOptions,
+                'packingSpecificationOptions'
+              );
               // this.packingSpecificationOption = res.map((item) => {
               //   return packingSpecification
               //     .filter((ite) => item.id == ite.categoryId)
@@ -1955,9 +2034,20 @@
                 //     }
                 //   })
                 //   .filter((item) => !!item);
-                const packingSpecificationItem = packingSpecificationOptions.find(packingSpecificationItem=>packingSpecificationItem.id==filtersItem.productId)?.packingSpecification
+                const packingSpecificationItem =
+                  packingSpecificationOptions.find(
+                    (packingSpecificationItem) =>
+                      packingSpecificationItem.id == filtersItem.productId
+                  )?.packingSpecification;
 
-                console.log('packingSpecificationLabel~~~~~~', this.detailList, res, packingSpecification, packingSpecificationOptions, packingSpecificationItem);
+                console.log(
+                  'packingSpecificationLabel~~~~~~',
+                  this.detailList,
+                  res,
+                  packingSpecification,
+                  packingSpecificationOptions,
+                  packingSpecificationItem
+                );
 
                 let packingQuantity =
                   filtersItem.totalCountNew ||
@@ -1966,14 +2056,13 @@
                   0;
                 console.log(packingQuantity, 'packingQudasdasdantity');
                 // 显示规格
-                let packingSpecificationLabel = packingSpecificationItem?.map((item) => {
-                  if (item.sort > 0) {
-                    return `${item.packageCell}${item.packageUnit}/${item.conversionUnit}`;
-                  }
-                })
-                .filter((item) => !!item);
-
-                
+                let packingSpecificationLabel = packingSpecificationItem
+                  ?.map((item) => {
+                    if (item.sort > 0) {
+                      return `${item.packageCell}${item.packageUnit}/${item.conversionUnit}`;
+                    }
+                  })
+                  .filter((item) => !!item);
 
                 const newSpecificationOption = packingSpecificationItem;
 
@@ -2078,12 +2167,9 @@
                       : '', // 机型
                   batchNo: filtersItem?.batchNo || batchNo, // 批次号
                   supplierListOptions: supplierList[item.id], // 供应商列表
-                  supplierId:
-                    filtersItem?.supplierId || item.supplierId, // 供应商id
-                  supplierCode:
-                    filtersItem?.supplierCode || item.supplierCode,
-                  supplierName:
-                    filtersItem?.supplierName || item.supplierName, // 供应商名称
+                  supplierId: filtersItem?.supplierId || item.supplierId, // 供应商id
+                  supplierCode: filtersItem?.supplierCode || item.supplierCode,
+                  supplierName: filtersItem?.supplierName || item.supplierName, // 供应商名称
                   approvalNumber: item.approvalNumber, // 批准文号
                   productionRequirements: filtersItem.productionRequirements,
                   packingSpecification: item.packingSpecification, // 包装规格
@@ -2096,7 +2182,9 @@
                   //     ).length
                   //   : this.detailList.length || this.form.detailList.length, // 包装数量
 
-                  packingQuantity: this.isMoreProduct ? filtersItem.packingQuantity : filtersItem.packingQuantity || this.detailList.length, 
+                  packingQuantity: this.isMoreProduct
+                    ? filtersItem.packingQuantity
+                    : filtersItem.packingQuantity || this.detailList.length,
                   packingUnit: packingUnit, // 单位
                   measureQuantity: this.isMoreProduct
                     ? filtersItem.quantity
@@ -2428,7 +2516,7 @@
         switch (type) {
           case '产品':
             listLength = this.productList.length;
-            keyfield = ['batchNo', 'packingQuantity', 'unitPrice', 'purpose'];
+            keyfield = ['batchNo', 'quantity', 'unitPrice', 'purpose'];
             break;
           case '包装':
             listLength = this.showPackingList.length;
@@ -3074,8 +3162,9 @@
             packingSpecificationLabel: packingSpecificationLabel, // 包装规格显示
             minPackingQuantity: '', // 最小包装单元数量
             packingQuantity: '', // 包装数量
-            packingUnit: item.measuringUnit, // 单位
-            packingUnitId: newSpecificationOption[index].find(
+            packingUnit: item.packingUnit, // 包装数量
+            unit: item.measuringUnit, // 单位
+            unitId: newSpecificationOption[index].find(
               (v) => v.conversionUnit == item.measuringUnit
             )?.id, // 单位
             measureQuantity: 0, // 计量数量
@@ -3099,8 +3188,8 @@
           let list = this.productList.map(async (row, index) => {
             let fileds = [
               `productList.${index}.batchNo`,
-              `productList.${index}.packingQuantity`,
-              `productList.${index}.packingUnit`,
+              `productList.${index}.quantity`,
+              `productList.${index}.unit`,
               `productList.${index}.warehouseId`
             ];
             if (row.isSave) {
@@ -3245,8 +3334,8 @@
         return new Promise(async (resolve) => {
           let fileds = [
             `productList.${index}.batchNo`,
-            `productList.${index}.packingQuantity`,
-            `productList.${index}.packingUnit`,
+            `productList.${index}.quantity`,
+            `productList.${index}.unit`,
             `productList.${index}.warehouseId`
           ];
 
@@ -3355,24 +3444,22 @@
 
           // 处理单位为KG类的情况
           if (packingBoolen) {
-            if (!row.isUnpack && row.packingUnit == '立方') {
+            if (!row.isUnpack && row.unit == '立方') {
               packingNum = 1;
             } else {
               let filterArr = row.packingSpecificationOption.filter((item) => {
                 return (
-                  item.packageUnit == row.packingUnit &&
+                  item.packageUnit == row.unit &&
                   item.packageUnit != item.conversionUnit
                 );
               });
               if (filterArr?.length) {
-                packingNum = Math.ceil(
-                  row.packingQuantity / filterArr[0].packageCell
-                );
+                packingNum = Math.ceil(row.quantity / filterArr[0].packageCell);
               }
             }
           }
           // 处理单位不为KG类,计量单位为KG类的情况
-          let measureNum = row.packingQuantity;
+          let measureNum = row.quantity;
           let num = 0;
 
           if (measureBoolen) {
@@ -3395,7 +3482,7 @@
                   row.packingSpecificationOption[1]?.packageCell
               );
             } else {
-              num = row.packingQuantity;
+              num = row.quantity;
             }
           }
           console.log(packingNum, measureNum, num, '加油加油加油');
@@ -3407,8 +3494,8 @@
           }
           // 不拆包
           if (!row.isUnpack) {
-            if (row.packingUnit != row.measureUnit) {
-              let pNum = row.packingQuantity;
+            if (row.unit != row.measureUnit) {
+              let pNum = row.quantity;
               const { data } = await storageApi.getAssetNum([
                 {
                   assetCode: row.categoryCode + row.index,
@@ -3429,9 +3516,9 @@
             }
           } else {
             if (!packingNum) {
-              if (row.packingUnitId) {
+              if (row.unitId) {
                 let splitIndex = row.packingSpecificationOption.findIndex(
-                  (item) => item.id == row.packingUnitId
+                  (item) => item.id == row.unitId
                 );
                 if (splitIndex == 0) {
                   packingNum = Math.ceil(
@@ -3440,12 +3527,12 @@
                   );
                 }
                 if (splitIndex == 1) {
-                  packingNum = row.packingQuantity;
+                  packingNum = row.quantity;
                 }
 
                 for (; splitIndex > 1; splitIndex--) {
                   packingNum = Math.ceil(
-                    row.packingQuantity *
+                    row.quantity *
                       row.packingSpecificationOption[splitIndex].packageCell
                   );
                 }
@@ -3469,6 +3556,7 @@
             ]);
 
             this.generateWrappers(row, index, data);
+            this.$set(this.productList[index], 'packingQuantity', data.length);
           }
           this.$set(this.productList[index], 'isSave', true);
           this.$set(this.productList[index], 'warehouseId', row.warehouseId);
@@ -3509,11 +3597,11 @@
         console.log(measureBoolen, 'measureBoolen');
         //行内选择仓库
         if (idx > -1 && type != 'batch') {
-          if (row.packingQuantity > 0) {
+          if (row.quantity > 0) {
             //不拆
             if (!row.isUnpack) {
               //计量和包装单位相同
-              if (row.measureUnit == row.packingUnit) {
+              if (row.measureUnit == row.unit) {
                 let pNum = 0;
                 let mNum = row.measureQuantity;
                 this.$refs.wareHouseDailogRef.open(
@@ -3525,7 +3613,7 @@
                   // this.form.categoryLevelTopId
                 );
               } else {
-                let pNum = row.packingQuantity;
+                let pNum = row.quantity;
                 let mNum = row.measureQuantity;
                 this.$refs.wareHouseDailogRef.open(
                   pNum,
@@ -3537,99 +3625,106 @@
                 );
               }
             } else {
-              if (packingBoolen) {
-                console.log(
-                  packingBoolen,
-                  'packingBoolen',
-                  row.packageUnit,
-                  row.isUnpack
-                );
-
-                let filterArr = row.packingSpecificationOption.filter(
-                  (item) => {
-                    return (
-                      item.packageUnit == row.packingUnit &&
-                      item.packageUnit != item.conversionUnit
-                    );
-                  }
-                );
+              let num = Math.ceil(
+                row.measureQuantity /
+                  row.packingSpecificationOption[1]?.packageCell
+              );
 
-                let num = Math.ceil(
-                  row.packingQuantity / filterArr[0].packageCell
-                );
-                this.$refs.wareHouseDailogRef.open(
-                  num,
+              this.$refs.wareHouseDailogRef.open(
+                                  num,
                   row.measureQuantity,
                   idx,
                   row.warehouseId,
                   row.warehouseName + ''
-                  // this.form.categoryLevelTopId
-                );
-              } else {
-                console.log(measureBoolen, 'measureBoolen');
-                let num = row.packingQuantity;
-                if (measureBoolen) {
-                  let splitIndex = row.packingSpecificationOption.findIndex(
-                    (item) =>
-                      item.conversionUnit == row.packingUnit &&
-                      item.packageUnit != item.conversionUnit
-                  );
-                  for (; splitIndex > 1; splitIndex--) {
-                    num = this.$math.format(
-                      num *
-                        row.packingSpecificationOption[splitIndex].packageCell,
-                      14
-                    );
-                  }
-                  this.$refs.wareHouseDailogRef.open(
-                    num,
-                    row.measureQuantity,
-                    idx,
-                    row.warehouseId,
-                    row.warehouseName + ''
-                    // this.form.categoryLevelTopId
-                  );
-                } else {
-                  if (
-                    row.measureType != 1 &&
-                    row.measureUnit == row.packingUnit
-                  ) {
-                    let pNum = 0;
-                    let mNum = row.measureQuantity;
-                    this.$refs.wareHouseDailogRef.open(
-                      pNum,
-                      mNum,
-                      idx,
-                      row.warehouseId,
-                      row.warehouseName + ''
-                      // this.form.categoryLevelTopId
-                    );
-                  } else {
-                    if (row.packingSpecificationOption[1]?.packageCell) {
-                      let num = Math.ceil(
-                        row.measureQuantity /
-                          row.packingSpecificationOption[1]?.packageCell
-                      );
-                      this.$refs.wareHouseDailogRef.open(
-                        num,
-                        row.measureQuantity,
-                        idx,
-                        row.warehouseId,
-                        row.warehouseName + ''
-                      );
-                    } else {
-                      this.$refs.wareHouseDailogRef.open(
-                        row.packingQuantity,
-                        row.measureQuantity,
-                        idx,
-                        row.warehouseId,
-                        row.warehouseName + ''
-                      );
-                    }
-                    console.log(num, 'num');
-                  }
-                }
-              }
+              );
+              // if (packingBoolen) {
+              //   console.log(
+              //     packingBoolen,
+              //     'packingBoolen',
+              //     row.packageUnit,
+              //     row.isUnpack
+              //   );
+
+              //   let filterArr = row.packingSpecificationOption.filter(
+              //     (item) => {
+              //       return (
+              //         item.packageUnit == row.unit &&
+              //         item.packageUnit != item.conversionUnit
+              //       );
+              //     }
+              //   );
+
+              //   let num = Math.ceil(row.quantity / filterArr[0].packageCell);
+              //   this.$refs.wareHouseDailogRef.open(
+              //     num,
+              //     row.measureQuantity,
+              //     idx,
+              //     row.warehouseId,
+              //     row.warehouseName + ''
+              //     // this.form.categoryLevelTopId
+              //   );
+              // } else {
+              //   console.log(measureBoolen, 'measureBoolen');
+              //   let num = row.quantity;
+              //   if (measureBoolen) {
+              //     let splitIndex = row.packingSpecificationOption.findIndex(
+              //       (item) =>
+              //         item.conversionUnit == row.unit &&
+              //         item.packageUnit != item.conversionUnit
+              //     );
+              //     for (; splitIndex > 1; splitIndex--) {
+              //       num = this.$math.format(
+              //         num *
+              //           row.packingSpecificationOption[splitIndex].packageCell,
+              //         14
+              //       );
+              //     }
+              //     this.$refs.wareHouseDailogRef.open(
+              //       num,
+              //       row.measureQuantity,
+              //       idx,
+              //       row.warehouseId,
+              //       row.warehouseName + ''
+              //       // this.form.categoryLevelTopId
+              //     );
+              //   } else {
+              //     if (row.measureType != 1 && row.measureUnit == row.unit) {
+              //       let pNum = 0;
+              //       let mNum = row.measureQuantity;
+              //       this.$refs.wareHouseDailogRef.open(
+              //         pNum,
+              //         mNum,
+              //         idx,
+              //         row.warehouseId,
+              //         row.warehouseName + ''
+              //         // this.form.categoryLevelTopId
+              //       );
+              //     } else {
+              //       if (row.packingSpecificationOption[1]?.packageCell) {
+              //         let num = Math.ceil(
+              //           row.measureQuantity /
+              //             row.packingSpecificationOption[1]?.packageCell
+              //         );
+              //         this.$refs.wareHouseDailogRef.open(
+              //           num,
+              //           row.measureQuantity,
+              //           idx,
+              //           row.warehouseId,
+              //           row.warehouseName + ''
+              //         );
+              //       } else {
+              //         this.$refs.wareHouseDailogRef.open(
+              //           row.quantity,
+              //           row.measureQuantity,
+              //           idx,
+              //           row.warehouseId,
+              //           row.warehouseName + ''
+              //         );
+              //       }
+              //       console.log(num, 'num');
+              //     }
+              //   }
+              // }
             }
           } else {
             this.$message.error('请先填写包装数量!');
@@ -3640,17 +3735,14 @@
           console.log(idx, `idx`);
           console.log(type, 'type');
           // 批量设置
-          if (row.some((item) => !item.packingQuantity)) {
+          if (row.some((item) => !item.quantity)) {
             this.$message.error('请先填写所有行的包装数量!');
             return;
           }
 
           for (let i = 0; i < row.length; i++) {
             //测量单位等于包装单位
-            if (
-              row[i].measureType != 1 &&
-              row[i].measureUnit === row[i].packingUnit
-            ) {
+            if (row[i].measureType != 1 && row[i].measureUnit === row[i].unit) {
               row[i].packingQuantity2 = 0;
               console.log(row[i].packingQuantity2);
             } else {
@@ -3768,7 +3860,7 @@
         }
 
         // 判断单位和计量单位是否为不拆物料层规格
-        let packingBoolen = !!this.getDict('不拆物料层规格', row.packingUnit)
+        let packingBoolen = !!this.getDict('不拆物料层规格', row.unit)
           .dictValue;
         let measureBoolen = !!this.getDict('不拆物料层规格', row.measureUnit)
           .dictValue;
@@ -3781,12 +3873,12 @@
             packingBoolen,
             'packingBoolenpackingBoolenpackingBoolenpackingBoolenpackingBoolenpackingBoolen'
           );
-          if (!row.isUnpack && row.packingUnit == '立方') {
+          if (!row.isUnpack && row.unit == '立方') {
             num = 1;
           } else {
             filterArr = row.packingSpecificationOption.filter((item) => {
               return (
-                item.packageUnit == row.packingUnit &&
+                item.packageUnit == row.unit &&
                 item.packageUnit != item.conversionUnit
               );
             });
@@ -3798,7 +3890,7 @@
             // 处理单位不为KG类,计量单位为KG类的情况
             let splitIndex = row.packingSpecificationOption.findIndex(
               (item) =>
-                item.conversionUnit == row.packingUnit &&
+                item.conversionUnit == row.unit &&
                 item.packageUnit != item.conversionUnit
             );
             for (; splitIndex > 1; splitIndex--) {
@@ -3815,7 +3907,7 @@
               );
               filterArr = row.packingSpecificationOption.filter((item) => {
                 return (
-                  item.packageUnit == row.packingUnit &&
+                  item.packageUnit == row.unit &&
                   item.packageUnit != item.conversionUnit
                 );
               });
@@ -3832,10 +3924,10 @@
           // 处理单位为KG类,计算每桶KG值
           if (packingBoolen) {
             measureQuantity =
-              Number(row.packingQuantity) >
+              Number(row.quantity) >
               this.$math.format(filterArr[0].packageCell * (index + 1), 14)
                 ? filterArr[0].packageCell
-                : Number(row.packingQuantity) -
+                : Number(row.quantity) -
                   this.$math.format(filterArr[0].packageCell * index, 14);
             console.log(measureQuantity, 'measureQuantit1111y');
           } else {
@@ -3846,19 +3938,6 @@
               measureQuantity =
                 Math.trunc((row.weight / packingCodeList.length) * 10000) /
                 10000;
-            } else if (measureBoolen) {
-              let splitIndex = row.packingSpecificationOption.findIndex(
-                (item) =>
-                  item.conversionUnit == row.packingUnit &&
-                  item.packageUnit != item.conversionUnit
-              );
-              for (; splitIndex > 0; splitIndex--) {
-                measureQuantity = this.$math.format(
-                  measureQuantity *
-                    row.packingSpecificationOption[splitIndex].packageCell,
-                  14
-                );
-              }
             } else {
               measureQuantity = row.packingSpecificationOption[1].packageCell;
             }
@@ -3950,90 +4029,90 @@
            *                     : row.packingSpecificationOption[1].conversionUnit: row.measureUnit: packingBoolen ? filterArr[0].conversionUnit : row.packingUnit,
            */
           if (row.isUnpack) {
-            // 第二层条件: packingBoolen
-            if (packingBoolen) {
-              // 空值保护: 确保 filterArr[0] 存在
               item.packingUnit =
                 row.packingSpecificationOption[1].conversionUnit;
-            } else {
-              // 第三层条件: measureBoolen
-              if (measureBoolen) {
-                // 处理 packingSpecificationOption 的索引
-                const option =
-                  row.packingSpecificationOption?.[1] ||
-                  row.packingSpecificationOption?.[0];
-                item.packingUnit = option?.conversionUnit;
-              } else {
-                item.packingUnit =
-                  row.packingSpecificationOption[1].conversionUnit;
-              }
-            }
+            // // 第二层条件: packingBoolen
+            // if (packingBoolen) {
+            //   // 空值保护: 确保 filterArr[0] 存在
+            //   item.packingUnit =
+            //     row.packingSpecificationOption[1].conversionUnit;
+            // } else {
+            //   // 第三层条件: measureBoolen
+            //   if (measureBoolen) {
+            //     // 处理 packingSpecificationOption 的索引
+            //     const option =
+            //       row.packingSpecificationOption?.[1] ||
+            //       row.packingSpecificationOption?.[0];
+            //     item.packingUnit = option?.conversionUnit;
+            //   } else {
+            //     item.packingUnit =
+            //       row.packingSpecificationOption[1].conversionUnit;
+            //   }
+            // }
           }
           let outBoolen = !!this.getDict('不拆物料层规格', item.measureUnit)
             .dictValue;
           //计量单位等于重量单位
           if (row.weightUnit == row.measureUnit) {
-            item.weight = item.measureQuantity
-              ? Number(item.measureQuantity)
-              : 0;
-          } else if (outBoolen) {
-            // 计量单位为KG类,直接替换
-
             item.weight = item.measureQuantity
               ? Number(item.measureQuantity)
               : 0;
           } else {
-            console.log('计量单位为不为KG类======================');
-            // 计量单位为不为KG类,重新统计计算
-            let inBoolen = !!this.getDict(
-              '不拆物料层规格',
-              item.packingSpecificationOption[0].packageUnit
-            ).dictValue;
-            let startIndex = item.packingSpecificationOption.findIndex(
-              (ite) => {
-                return (
-                  item.measureUnit == ite.packingUnit &&
-                  ite.packingUnit != ite.conversionUnit
-                );
-              }
-            );
+                 item.weight = this.$math.format(
+                (row.singleWeight || 0) * item.measureQuantity,
+                14
+              );
+            // console.log('计量单位为不为KG类======================');
+            // // 计量单位为不为KG类,重新统计计算
+            // let inBoolen = !!this.getDict(
+            //   '不拆物料层规格',
+            //   item.packingSpecificationOption[0].packageUnit
+            // ).dictValue;
+            // let startIndex = item.packingSpecificationOption.findIndex(
+            //   (ite) => {
+            //     return (
+            //       item.measureUnit == ite.packingUnit &&
+            //       ite.packingUnit != ite.conversionUnit
+            //     );
+            //   }
+            // );
 
-            let endIndex = item.packingSpecificationOption.findIndex(
-              (ite) => item.packingUnit == ite.conversionUnit
-            );
-            if (measureBoolen) {
-              let total = item.packingQuantity
-                ? Number(item.packingQuantity)
-                : 0;
-              for (; startIndex < endIndex; endIndex--) {
-                total = this.$math.format(
-                  item.packingSpecificationOption[endIndex].packageCell * total,
-                  14
-                );
-              }
-              if (inBoolen) {
-                // 第二层为KG类
-                item.weight = total ? Number(total) : 0;
-              } else {
-                // 第二层不为KG类
-                item.weight = this.$math.format(total * item.netWeight, 14);
-              }
-            } else if (!measureBoolen) {
-              if (inBoolen) {
-                // 第二层为KG类
-                item.weight = item.measureQuantity
-                  ? Number(item.measureQuantity)
-                  : 0;
-              } else {
-                // 第二层不为KG类
-                if (row.singleWeight && item.measureQuantity) {
-                  item.weight =
-                    Number(item.measureQuantity) * Number(row.singleWeight);
-                } else {
-                  item.weight = 0;
-                }
-              }
-            }
+            // let endIndex = item.packingSpecificationOption.findIndex(
+            //   (ite) => item.packingUnit == ite.conversionUnit
+            // );
+            // if (measureBoolen) {
+            //   let total = item.packingQuantity
+            //     ? Number(item.packingQuantity)
+            //     : 0;
+            //   for (; startIndex < endIndex; endIndex--) {
+            //     total = this.$math.format(
+            //       item.packingSpecificationOption[endIndex].packageCell * total,
+            //       14
+            //     );
+            //   }
+            //   if (inBoolen) {
+            //     // 第二层为KG类
+            //     item.weight = total ? Number(total) : 0;
+            //   } else {
+            //     // 第二层不为KG类
+            //     item.weight = this.$math.format(total * item.netWeight, 14);
+            //   }
+            // } else if (!measureBoolen) {
+            //   if (inBoolen) {
+            //     // 第二层为KG类
+            //     item.weight = item.measureQuantity
+            //       ? Number(item.measureQuantity)
+            //       : 0;
+            //   } else {
+            //     // 第二层不为KG类
+            //     if (row.singleWeight && item.measureQuantity) {
+            //       item.weight =
+            //         Number(item.measureQuantity) * Number(row.singleWeight);
+            //     } else {
+            //       item.weight = 0;
+            //     }
+            //   }
+            // }
           }
           packingList.push(item);
           console.log(