Przeglądaj źródła

feat: 产品属性放入字典

wuzh 17 godzin temu
rodzic
commit
b5b1f9894e
1 zmienionych plików z 30 dodań i 56 usunięć
  1. 30 56
      src/views/material/product/detail.vue

+ 30 - 56
src/views/material/product/detail.vue

@@ -677,7 +677,7 @@
   import { addMaterial } from '@/api/material/list.js';
   import { deepClone } from '@/utils/index';
   import { finishPageTab, reloadPageTab } from '@/utils/page-tab-util';
-  import { produceTypeList } from '@/enum/dict.js';
+  // import { produceTypeList } from '@/enum/dict.js';
   import { copyObj } from '@/utils/util';
   import { parameterGetByCode } from '@/api/system/dictionary/index.js';
   import GetCodeDialog from '@/components/addDoc/getCode.vue';
@@ -769,7 +769,7 @@
         isReadOnly: false,
         isShow: true,
         industryAttribute: '',
-        produceTypeList,
+        produceTypeList:[],
         packagingSpecificationList: [],
         loading: false,
         productImgs: [],
@@ -842,24 +842,7 @@
             needProductSequence: 0
           }
         },
-        lbjtList: [
-          {
-            label: '自制件',
-            value: 1
-          },
-          {
-            label: '采购件',
-            value: 2
-          },
-          {
-            label: '外协件',
-            value: 3
-          },
-          {
-            label: '受托件',
-            value: 4
-          }
-        ],
+        lbjtList: [],
         attributeList: [],
         remarkform: {
           remarkAttach: [],
@@ -1151,15 +1134,6 @@
           this.industryAttribute = res.value;
         }
       });
-
-      parameterGetByCode({
-        code: 'component_attribute'
-      }).then((res) => {
-        this.lbjtList = this.parseComponentAttributeOptions(
-          res?.name || res?.value
-        );
-      });
-
       //新增
 
       this.$set(
@@ -1197,6 +1171,8 @@
       this.getAttributeList('inventory_type');
 
       this.getDictList('zeroPartPros');
+      this.getLbjtListList('categoryComponentAttribute');
+      this.getProduceTypeList('categoryProduceTypeList');
     },
     mounted() {
       if (this.clientEnvironmentId == 4) {
@@ -1643,34 +1619,32 @@
         }
       },
       // 生产类型字典
-      // async getProduceTypeList(code) {
-      //   let { data: res } = await getByCode(code);
-      //   console.log('res----', res);
-
-      //   this.produceTypeList = res.map((item) => {
-      //     let values = Object.keys(item);
-      //     return {
-      //       value: values[0],
-      //       label: item[values[0]]
-      //     };
-      //   });
-      //   console.log('produceTypeList',this.produceTypeList);
-      // },
-      parseComponentAttributeOptions(value) {
-        if (!value) {
-          return [];
-        }
+      async getProduceTypeList(code) {
+        let { data: res } = await getByCode(code);
+        console.log('res----', res);
 
-        const options = [];
-        const optionRegExp = /(\d+)\s*[::]\s*([^;;))]+)/g;
-        let match;
-        while ((match = optionRegExp.exec(String(value))) !== null) {
-          options.push({
-            value: Number(match[1]),
-            label: match[2].trim()
-          });
-        }
-        return options;
+        this.produceTypeList = res.map((item) => {
+          let values = Object.keys(item);
+          return {
+            value: values[0],
+            label: item[values[0]]
+          };
+        });
+        console.log('produceTypeList',this.produceTypeList);
+      },
+      // 属性类型字典
+      async getLbjtListList(code) {
+        let { data: res } = await getByCode(code);
+        console.log('res----', res);
+
+        this.lbjtList = res.map((item) => {
+          let values = Object.keys(item);
+          return {
+            value: Number(values[0]),
+            label: item[values[0]]
+          };
+        });
+        console.log('lbjtList',this.lbjtList);
       },
       async getDictList(code) {
         let { data: res } = await getByCode(code);