huang_an 2 лет назад
Родитель
Сommit
a535cc4aa1

+ 82 - 32
src/views/warehouseManagement/stockLedger/components/item-list.vue

@@ -65,6 +65,19 @@
           <span slot="reference"> {{ row.batchNo }}</span>
           <span slot="reference"> {{ row.batchNo }}</span>
         </el-popover>
         </el-popover>
       </template>
       </template>
+      <!-- 库存保质期 -->
+      <template v-slot:expirationDate="{ row }">
+        <span v-if="row.expirationDate">
+          {{ row.expirationDate ? row.expirationDate : '-' }}
+          {{
+            row.expirationDateUnit == 'year'
+              ? '年'
+              : row.expirationDateUnit == 'month'
+              ? '月'
+              : '日'
+          }}
+        </span>
+      </template>
       <!-- 操作列 -->
       <!-- 操作列 -->
       <template v-slot:action="{ row }">
       <template v-slot:action="{ row }">
         <el-link
         <el-link
@@ -115,6 +128,7 @@
         },
         },
         isShow: false,
         isShow: false,
         isPack: false,
         isPack: false,
+        isMeta: false,
         selectedDime: 1
         selectedDime: 1
       };
       };
     },
     },
@@ -184,25 +198,26 @@
           //   showOverflowTooltip: true
           //   showOverflowTooltip: true
           // },
           // },
           {
           {
-            prop: '',
+            prop: 'expirationDate',
+            slot: 'expirationDate',
             label: '库存保质期',
             label: '库存保质期',
             showOverflowTooltip: true,
             showOverflowTooltip: true,
             width: 100
             width: 100
           },
           },
           {
           {
-            prop: '',
+            prop: 'expirationTime',
             label: '周期倒计时',
             label: '周期倒计时',
             showOverflowTooltip: true,
             showOverflowTooltip: true,
             width: 100
             width: 100
           },
           },
           {
           {
-            prop: '',
+            prop: 'qualityStatus',
             label: '质检状态',
             label: '质检状态',
             showOverflowTooltip: true,
             showOverflowTooltip: true,
             width: 100
             width: 100
           },
           },
           {
           {
-            prop: '',
+            prop: 'qualityResult',
             label: '质检结果',
             label: '质检结果',
             showOverflowTooltip: true,
             showOverflowTooltip: true,
             width: 100
             width: 100
@@ -251,6 +266,36 @@
             label: '批次号',
             label: '批次号',
             showOverflowTooltip: true
             showOverflowTooltip: true
           });
           });
+          // 寻找现有的 'code' 对象的索引
+          let codeIndex = obj.findIndex((item) => item.prop === 'code');
+
+          if (codeIndex !== -1) {
+            // 删除现有的 'code' 对象
+            obj.splice(codeIndex, 1, {
+              prop: 'packagingCode',
+              label: '包装编码',
+              showOverflowTooltip: true
+            });
+          }
+        }
+        if (this.isMeta) {
+          obj.splice(1, 0, {
+            slot: 'batchNum',
+            prop: 'batchNum',
+            label: '批次号',
+            showOverflowTooltip: true
+          });
+          // 寻找现有的 'code' 对象的索引
+          let codeIndex = obj.findIndex((item) => item.prop === 'code');
+
+          if (codeIndex !== -1) {
+            // 删除现有的 'code' 对象
+            obj.splice(codeIndex, 1, {
+              prop: 'materialCode',
+              label: '物料编码',
+              showOverflowTooltip: true
+            });
+          }
         }
         }
         return obj;
         return obj;
       }
       }
@@ -259,6 +304,7 @@
       handledime(val) {
       handledime(val) {
         this.$set(this, 'isShow', val == 2);
         this.$set(this, 'isShow', val == 2);
         this.$set(this, 'isPack', val == 3);
         this.$set(this, 'isPack', val == 3);
+        this.$set(this, 'isMeta', val == 4);
         // this.reload({
         // this.reload({
         //   ...this.$refs.refSeavch.params,
         //   ...this.$refs.refSeavch.params,
         //   dimension: this.$refs.refSeavch.dimension
         //   dimension: this.$refs.refSeavch.dimension
@@ -307,13 +353,13 @@
             size: limit,
             size: limit,
             dimension: dimension
             dimension: dimension
           });
           });
-          return data;
-          // data.then((res) => {
-          //   let item = res.list.map((item) => {
-          //     return { ...item, paths: item.pathName.split(',')[0] };
-          //   });
-          //   return item;
-          // });
+          const result = data.then((res) => {
+            let item = res.list.map((item) => {
+              return { ...item, paths: item.pathName.split(',')[0] };
+            });
+            return { ...res, list: item };
+          });
+          return result;
         } else if (this.selectedDime == 2) {
         } else if (this.selectedDime == 2) {
           const params = {
           const params = {
             categoryLevelId: treeId,
             categoryLevelId: treeId,
@@ -323,17 +369,20 @@
           };
           };
           const data = getBatchDetails({
           const data = getBatchDetails({
             ...params,
             ...params,
-            page: page,
+            pageNum: page,
             size: limit
             size: limit
           });
           });
 
 
-          return data;
-          // data.then((res) => {
-          //   let item = res.list.map((item) => {
-          //     return { ...item, minUnit: item.packingUnit };
-          //   });
-          //   return item;
-          // });
+          const result = data.then((res) => {
+            let item = res.list.map((item) => {
+              return {
+                ...item,
+                minUnit: item.packingUnit
+              };
+            });
+            return { ...res, list: item };
+          });
+          return result;
         } else {
         } else {
           const params = {
           const params = {
             categoryLevelId: treeId,
             categoryLevelId: treeId,
@@ -343,21 +392,22 @@
           };
           };
           const data = ouint.getInventoryDetails({
           const data = ouint.getInventoryDetails({
             ...params,
             ...params,
-            page: page,
+            pageNum: page,
             size: limit
             size: limit
           });
           });
-          return data;
-          // return data.then((res) => {
-          //   let item = res.list.map((item) => {
-          //     return {
-          //       ...item,
-          //       minUnit: item.packingUnit,
-          //       paths: item.pathName.split(',')[0]
-          //     };
-          //   });
-          //   console.log('item', item);
-          //   return item;
-          // });
+          const result = data.then((res) => {
+            const data = res.list.map((item) => {
+              return {
+                ...item,
+                minUnit: item.packingUnit,
+                paths: item.pathName.split(',')[0],
+                availableCountBase: 1,
+                packagingCode: item.code
+              };
+            });
+            return { ...res, list: data };
+          });
+          return result;
         }
         }
       },
       },
       /* 刷新表格 */
       /* 刷新表格 */

+ 19 - 14
src/views/warehouseManagement/stockManagement/add.vue

@@ -872,12 +872,21 @@
             </el-table-column>
             </el-table-column>
             <el-table-column
             <el-table-column
               v-if="formData.bizType == 2 || formData.bizType == 1"
               v-if="formData.bizType == 2 || formData.bizType == 1"
-              label="重量"
+              label="重量1"
               prop="weight"
               prop="weight"
               width="100"
               width="100"
             >
             >
               <template slot-scope="{ row }">
               <template slot-scope="{ row }">
-                <el-input v-if="!row.isPack" v-model="row.weight"></el-input>
+                <el-input
+                  v-if="!row.isPack"
+                  v-model.number="row.weight"
+                  @input="
+                    (value) => {
+                      const newValue = value.replace(/^(0+)|[^\d]+/g, '');
+                      row.weight = parseInt(newValue, 10); // 转换为数字类型
+                    }
+                  "
+                ></el-input>
                 <span v-else>{{ row.weight }}</span>
                 <span v-else>{{ row.weight }}</span>
               </template>
               </template>
             </el-table-column>
             </el-table-column>
@@ -1244,25 +1253,21 @@
       },
       },
       //包装明细保存
       //包装明细保存
       packCout(row) {
       packCout(row) {
-        console.log(row);
-        console.log('is', !row.isPack);
         //true保存==》反之
         //true保存==》反之
         if (!row.isPack) {
         if (!row.isPack) {
           row.isPack = true;
           row.isPack = true;
           const code = row.assetCode;
           const code = row.assetCode;
-          const list = this.warehousingMaterialList;
+          const batchNo = row.batchNo;
+          const count = this.materialCodeReqList.reduce(
+            (acc, curr) => acc + curr.weight,
+            0
+          );
           this.warehousingMaterialList.forEach((item) => {
           this.warehousingMaterialList.forEach((item) => {
-            if (item.assetCode == code) {
-              // item.
+            if (item.assetCode == code && item.batchNo == batchNo) {
+              item.weight = count;
             }
             }
           });
           });
-          // for (const k in list) {
-          //   if (list[k].assetCode == code) {
-          //     const weight = this.weightTotal(list[k]);
-          //     console.log('we', weight);
-          //     console.log('当前重量', list[k]);
-          //   }
-          // }
+          console.log(',,,,', this.warehousingMaterialList);
         } else {
         } else {
           row.isPack = false;
           row.isPack = false;
         }
         }