Просмотр исходного кода

refactor(stockManagement): 优化库存管理上下架功能与弹窗逻辑

liujt 5 дней назад
Родитель
Сommit
288a570fdc

+ 37 - 18
src/views/warehouseManagement/stockLedger/components/item-list.vue

@@ -149,6 +149,10 @@
         <el-link type="primary" @click="openQRCode(row, 3)"> 查看 </el-link>
       </template>
 
+      <template v-slot:areaName="{ row }">
+        <el-link type="primary" @click="openUploadDetail(row, 'list')"> 查看 </el-link>
+      </template>
+
       <!-- 最小包装单元 -->
       <template v-slot:minPackingCount="{ row }">
         <span v-if="row.minPackingCount">
@@ -215,6 +219,7 @@
       </span>
     </el-dialog>
     <printQRCode ref="printQRCodeRef"></printQRCode>
+    <ItemListed ref="itemListedRef"/>
     <importDialog
       :defModule="moudleName"
       ref="importDialogRef"
@@ -233,6 +238,7 @@
   // import printSr from './printSr.vue';
   // import printTg from './printTg.vue';
   import ItemSearch from './item-search.vue';
+  import ItemListed from '@/views/warehouseManagement/stockManagement/components/itemListed.vue';
   // import {
   //   getUserPage,
   //   removePersonnel,
@@ -261,7 +267,8 @@
       allot,
       importDialog,
       exportButton,
-      printQRCode
+      printQRCode,
+      ItemListed
     },
     props: {
       // 机构id
@@ -527,27 +534,35 @@
                 showOverflowTooltip: true
               }
             : '',
-          this.selectedDime == 3
+            this.selectedDime == 3 || this.selectedDime == 2
             ? {
                 prop: 'areaName',
-                label: '库区	',
-                showOverflowTooltip: true
-              }
-            : '',
-          this.selectedDime == 3
-            ? {
-                prop: 'goodsAllocationName',
-                label: '货架',
-                showOverflowTooltip: true
-              }
-            : '',
-          this.selectedDime == 3
-            ? {
-                prop: 'goodsShelfName',
-                label: '货位',
-                showOverflowTooltip: true
+                label: '货架记录',
+                showOverflowTooltip: true,
+                slot: 'areaName'
               }
             : '',
+          // this.selectedDime == 3
+          //   ? {
+          //       prop: 'areaName',
+          //       label: '库区	',
+          //       showOverflowTooltip: true
+          //     }
+          //   : '',
+          // this.selectedDime == 3
+          //   ? {
+          //       prop: 'goodsAllocationName',
+          //       label: '货架',
+          //       showOverflowTooltip: true
+          //     }
+          //   : '',
+          // this.selectedDime == 3
+          //   ? {
+          //       prop: 'goodsShelfName',
+          //       label: '货位',
+          //       showOverflowTooltip: true
+          //     }
+          //   : '',
           this.selectedDime == 3
             ? {
                 prop: 'productionDate',
@@ -674,6 +689,10 @@
       }
     },
     methods: {
+
+      openUploadDetail(row, type) {
+        this.$refs.itemListedRef.open(row, type, 'detail', this.selectedDime);
+      },
       openQRCode(row, type) {
         this.$refs.printQRCodeRef.open(row, type);
       },

+ 19 - 9
src/views/warehouseManagement/stockManagement/components/itemListed.vue

@@ -11,7 +11,7 @@
   >
     <el-row :gutter="20">
       <!-- 左侧:物品清单 -->
-      <el-col :span="10">
+      <el-col v-if="!initDimension" :span="10">
         <div class="section-title">物品清单</div>
         <div class="dimension-tabs">
           <span class="dimension-label">维度:</span>
@@ -76,7 +76,7 @@
       </el-col>
 
       <!-- 右侧:上架信息 -->
-      <el-col :span="14">
+      <el-col :span="initDimension ? 24 : 14">
         <div class="section-title">上架信息</div>
         <el-form :model="formData" label-width="100px">
           <el-row>
@@ -151,7 +151,7 @@
         </div>
         <el-table :data="shelvingList" max-height="400" style="width: 100%; margin-top: 8px;" border>
           <el-table-column label="序号" type="index" width="50" align="center" />
-          <el-table-column label="货位位置" min-width="320" align="center">
+          <el-table-column :label="locationType === 'shelf' ? '货架位置' : '货位位置'" prop="cargoSpaceId" min-width="320" align="center">
             <template slot-scope="scope">
               <el-select
                 v-model="scope.row.cargoSpaceId"
@@ -277,7 +277,9 @@
         shelvingList: [],
         confirmLoading: false,
         mode: 'edit',
-        // 'edit' | 'detail' 区分当前操作的是编辑还是详情
+        // 'edit' | 'detail' | 'down' 区分当前操作的是编辑还是详情,下架
+        initDimension: '',
+        
       };
     },
 
@@ -327,11 +329,12 @@
 
     methods: {
       // ==================== 打开/关闭 ====================
-      async open(row, type, mode) {
+      async open(row, type, mode, initDimension) {
         console.log('open', row, type, mode);
         this.mode = mode;
         this.rowData = row;
         this.dimension = type === 'package' ? 2 : 1;
+        this.initDimension = initDimension;
         this.type = type;
         this.selection = [];
         this.shelvingList = [];
@@ -383,11 +386,18 @@
 
       async getDetail() {
         try {
-          const data = await storageApi.getStorageRecordPage({
+          const params = {
             pageNum: 1,
             size: -1,
-            outInId: this.rowData.outInId || this.rowData.id
-          });
+          }
+          if (this.initDimension == 2) {
+            params.outInDetailId = this.rowData.id;
+          } else if (this.initDimension == 3) {
+            params.outInDetailRecordId = this.rowData.id;
+          } else {
+            params.outInId = this.rowData.outInId || this.rowData.id;
+          }
+          const data = await storageApi.getStorageRecordPage(params);
           if (data?.list?.length) {
             this.dimension = +data?.list[0].levelType;
             this.storageRecords = data.list;
@@ -695,7 +705,7 @@
       },
 
       checkSelectable(row) {
-        if(this.isDetail) return false;
+        if(this.mode === 'down' || this.isDetail) return false;
         return !this.shelvedItemKeys.includes(this._getRowKey(row));
       },
 

+ 6 - 8
src/views/warehouseManagement/stockManagement/details.vue

@@ -350,12 +350,11 @@
               align="center"
             >
               <template slot-scope="{ row, $index }">
-                <!-- <el-button
-                  v-if="isUpper(row)"
+                <el-button
                   type="text"
-                  @click="shelvesWarehouse(row, $index, '产品')"
+                  @click="handleShelving(row, 'product', 'down')"
                   >下架</el-button
-                > -->
+                >
                 <el-button
                   type="text"
                   @click="handleShelving(row, 'product')"
@@ -609,12 +608,11 @@
               align="center"
             >
               <template slot-scope="{ row, $index }">
-                <!-- <el-button
-                  v-if="row.areaId != null"
+                <el-button
                   type="text"
-                  @click="shelvesWarehouse(row, $index, '包装')"
+                  @click="handleShelving(row, 'package', 'down')"
                   >下架</el-button
-                > -->
+                >
                 <el-button
                   type="text"
                   @click="handleShelving(row, 'package')"

+ 5 - 5
src/views/warehouseManagement/stockManagement/index.vue

@@ -279,15 +279,15 @@
           >
             上架
           </el-link>
-          <!-- <el-link
+          <el-link
             v-if="row.verifyStatus == 2"
             type="primary"
             :underline="false"
             icon="el-icon-sort-down"
-            @click="details(row)"
+            @click="handleShelving(row, 'list', 'down')"
           >
             下架
-          </el-link> -->
+          </el-link>
           <el-link
             type="primary"
             v-if="row.verifyStatus == 0 || row.verifyStatus == 3"
@@ -604,8 +604,8 @@
       shelves() {
         console.log('上架');
       },
-      handleShelving(row, type) {
-        this.$refs.itemListedRef.open(row, type);
+      handleShelving(row, type, action) {
+        this.$refs.itemListedRef.open(row, type, action);
       },
       unShelves() {
         console.log('下架');