Ver Fonte

fix:4107【盘点计划】选择仓库的物品维度去盘点,到工单去报工,不是按物品维度展示的了,增加一个报工处置项(报废),逻辑就是减掉报废的库存数即可

mlchen há 5 dias atrás
pai
commit
20773584cc

+ 20 - 10
src/views/warehouseManagement/stockLedger/components/details/ReportLoss.vue

@@ -4,7 +4,7 @@
     <el-form label-width="100px">
       <el-row>
         <el-col :span="5">
-          <el-form-item label="盈/损/亏"
+          <el-form-item label="盈/损/亏/废"
             ><el-select
               filterable
               placeholder="请选择"
@@ -64,7 +64,7 @@
     >
       <template v-slot:status="{ row }">
         <span :style="{ color: statusColor[row.status] }">{{
-          statusOpt[row.status]
+          statusLabel(row)
         }}</span>
       </template>
     </ele-pro-table>
@@ -150,22 +150,26 @@
           { label: '所有', code: '' },
           { label: '盘盈', code: 2 },
           { label: '盘亏', code: 3 },
-          { label: '盘损', code: 4 }
+          { label: '盘损', code: 4 },
+          { label: '报废', code: 5 }
         ],
         statusOpt: {
           2: '盘盈',
           3: '盘亏',
-          4: '盘损'
+          4: '盘损',
+          5: '报废'
         },
         countKey: {
           2: 'surplusQuantity',
           3: 'loseQuantity',
-          4: 'wornQuantity'
+          4: 'wornQuantity',
+          5: 'scrapQuantity'
         },
         statusColor: {
           2: 'red',
           3: '#70B603',
-          4: ''
+          4: '',
+          5: ''
         },
         columns: [
           {
@@ -191,7 +195,7 @@
           {
             slot: 'status',
             prop: 'status',
-            label: '盈/损/亏',
+            label: '盈/损/亏/废',
             align: 'center',
             showOverflowTooltip: true,
             minWidth: 110
@@ -202,9 +206,7 @@
             align: 'center',
             showOverflowTooltip: true,
             minWidth: 110,
-            formatter: (_row) => {
-              return _row[this.countKey[_row.status]];
-            }
+            formatter: (_row) => this.statusQuantity(_row)
           },
           {
             prop: 'planProfitLossCode',
@@ -242,6 +244,14 @@
       }
     },
     methods: {
+      // 未匹配到状态时返回空串,避免新增盘点状态后这里显示空白或报错
+      statusLabel(row) {
+        return this.statusOpt[row.status] || '';
+      },
+      statusQuantity(row) {
+        const key = this.countKey[row.status];
+        return key ? row[key] : '';
+      },
       async datasource({ page, limit, where, order }) {
         console.log(page);
         console.log(limit);

+ 5 - 0
src/views/warehouseManagement/stocktaking/reportLoss/components/addReportDialog.vue

@@ -446,6 +446,11 @@
             label: '破损',
             value: '4',
             numKey: 'wornQuantity'
+          },
+          {
+            label: '报废',
+            value: '5',
+            numKey: 'scrapQuantity'
           }
         ],
         visibleDialog: false,

+ 11 - 16
src/views/warehouseManagement/stocktaking/reportLoss/components/reportProcuts.vue

@@ -70,26 +70,12 @@
                       :show-overflow-tooltip="true"
                     >
                       <template slot-scope="{ row }">
-                        {{
-                          row.status > 0
-                            ? statusOption.filter(
-                                (item) => item.value == row.status
-                              )[0].label
-                            : ''
-                        }}
+                        {{ row.status > 0 ? statusLabel(row.status) : '' }}
                       </template>
                     </el-table-column>
                     <el-table-column label="数量" :show-overflow-tooltip="true">
                       <template slot-scope="{ row }">
-                        {{
-                          row.status > 0
-                            ? row[
-                                statusOption.filter(
-                                  (item) => item.value == row.status
-                                )[0].numKey
-                              ]
-                            : 0
-                        }}
+                        {{ row.status > 0 ? statusQuantity(row) : 0 }}
                       </template>
                     </el-table-column>
                     <el-table-column
@@ -273,6 +259,15 @@
       };
     },
     methods: {
+      // 未匹配到状态时返回空串,避免新增盘点状态后这里取 [0] 报错
+      statusLabel(status) {
+        const item = this.statusOption.filter((m) => m.value == status)[0];
+        return item ? item.label : '';
+      },
+      statusQuantity(row) {
+        const item = this.statusOption.filter((m) => m.value == row.status)[0];
+        return item ? row[item.numKey] : 0;
+      },
       selectable(row) {
         return !this.selectionIds.includes(row.categoryId);
       },

+ 7 - 0
src/views/warehouseManagement/stocktaking/work/components/disposeDialog.vue

@@ -285,6 +285,10 @@
           {
             label: '破损',
             value: '4'
+          },
+          {
+            label: '报废',
+            value: '5'
           }
         ],
         visibleDialog: false,
@@ -429,6 +433,9 @@
               case '4':
                 key = 'wornQuantity';
                 break;
+              case '5':
+                key = 'scrapQuantity';
+                break;
             }
             return {
               id: item.id,

+ 16 - 15
src/views/warehouseManagement/stocktaking/work/details.vue

@@ -191,25 +191,12 @@
               :show-overflow-tooltip="true"
             >
               <template slot-scope="{ row }">
-                {{
-                  row.status > 0
-                    ? statusOption.filter((item) => item.value == row.status)[0]
-                        .label
-                    : ''
-                }}
+                {{ row.status > 0 ? statusLabel(row.status) : '' }}
               </template>
             </el-table-column>
             <el-table-column label="数量" :show-overflow-tooltip="true">
               <template slot-scope="{ row }">
-                {{
-                  row.status > 0
-                    ? row[
-                        statusOption.filter(
-                          (item) => item.value == row.status
-                        )[0].numKey
-                      ]
-                    : 0
-                }}
+                {{ row.status > 0 ? statusQuantity(row) : 0 }}
               </template>
             </el-table-column>
             <el-table-column
@@ -330,6 +317,11 @@
             label: '破损',
             value: '4',
             numKey: 'wornQuantity'
+          },
+          {
+            label: '报废',
+            value: '5',
+            numKey: 'scrapQuantity'
           }
         ]
       };
@@ -338,6 +330,15 @@
       this._getDetail();
     },
     methods: {
+      // 未匹配到状态时返回空串,避免新增盘点状态后这里取 [0] 报错
+      statusLabel(status) {
+        const item = this.statusOption.filter((m) => m.value == status)[0];
+        return item ? item.label : '';
+      },
+      statusQuantity(row) {
+        const item = this.statusOption.filter((m) => m.value == row.status)[0];
+        return item ? row[item.numKey] : 0;
+      },
       async _getDetail() {
         const data = await getOrderInfoByPlanId({
           planOrderId: this.$route.query.id,