Explorar o código

fix:5257【仓库定义】列表仓库类型获取的是物品类型的信息

mlchen hai 1 semana
pai
achega
2023037993
Modificáronse 1 ficheiros con 35 adicións e 4 borrados
  1. 35 4
      src/views/warehouseManagement/warehouseDefinition/index.vue

+ 35 - 4
src/views/warehouseManagement/warehouseDefinition/index.vue

@@ -22,7 +22,7 @@
               ></el-input> </el-form-item
           ></el-col>
           <el-col :span="4">
-            <el-form-item label="仓库类型" prop="inventoryType">
+            <el-form-item label="物品类型" prop="inventoryType">
               <el-select
                 filterable
                 size="small"
@@ -220,6 +220,7 @@
   } from '@/utils/dict/index';
   import { mapGetters, mapActions } from 'vuex';
   import dictEnum from '@/enum/dict';
+  import { getByCode } from '@/api/system/dictionary-data';
   // import selectTree from '@/components/selectTree';
   import WarehouseEdit from './components/WarehouseEdit';
   import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
@@ -299,11 +300,19 @@
           },
           {
             prop: 'inventoryName',
-            label: '仓库类型',
+            label: '物品类型',
             align: 'center',
             showOverflowTooltip: true,
             minWidth: 180
           },
+          {
+            prop: 'warehouseType',
+            label: '仓库类型',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 180,
+            formatter: (row) => this.getWarehouseTypeLabel(row.warehouseType)
+          },
           {
             prop: 'areaNumber',
             label: '库区数',
@@ -359,27 +368,49 @@
             filter: useDictLabel(warehouseDefinition_statusList)
           },
           {
-            label: '仓库类型',
+            label: '物品类型',
             key: 'inventoryName'
             // filter: (value) => {
             //   return this.getDictValue('仓库类型', value);
             // }
           },
+          {
+            label: '仓库类型',
+            key: 'warehouseType',
+            filter: (value) => this.getWarehouseTypeLabel(value)
+          },
           { label: '库区数', key: 'areaNumber' },
           { label: '货架数', key: 'goodNumber' },
           { label: '货位数', key: 'allocationNumber' },
           { label: '空货位数', key: 'emptyAllocationNumber' },
           { label: '所属工厂', key: 'factoryId' }
         ],
-        inventoryTypeList: []
+        inventoryTypeList: [],
+        warehouseTypeList: []
       };
     },
     async created() {
       this.requestDict('仓库类型');
+      this.loadWarehouseTypeList();
       this.initData();
     },
     methods: {
       ...mapActions('dict', ['requestDict']),
+      async loadWarehouseTypeList() {
+        try {
+          const res = await getByCode('warehouse_type');
+          this.warehouseTypeList = Object.values(res.data || {}).map((item) => {
+            const key = Object.keys(item)[0];
+            return { code: key, label: Object.values(item)[0] };
+          });
+        } catch (err) {
+          this.$message.error(err.message);
+        }
+      },
+      getWarehouseTypeLabel(value) {
+        const item = this.warehouseTypeList.find((dict) => dict.code == value);
+        return item ? item.label : '';
+      },
       filterFactoryId(factoryId) {
         console.log(this.factoryList);
         let obj = this.factoryList.find((f) => f.id === factoryId);