Procházet zdrojové kódy

优化质检模板类型选择,使用DictSelection组件替代手动处理

yusheng před 9 měsíci
rodič
revize
197dc68312
1 změnil soubory, kde provedl 26 přidání a 23 odebrání
  1. 26 23
      src/views/inspectionTemplate/index.vue

+ 26 - 23
src/views/inspectionTemplate/index.vue

@@ -135,12 +135,20 @@
             type: 'input',
             placeholder: ''
           },
+          // {
+          //   label: '类型:',
+          //   value: 'type',
+          //   type: 'select',
+          //   placeholder: '',
+          //   planList: []
+          // },
           {
             label: '类型:',
             value: 'type',
-            type: 'select',
+            type: 'DictSelection',
+            dictName: '质检计划类型',
             placeholder: '',
-            planList: []
+            
           },
           {
             label: '状态:',
@@ -225,29 +233,24 @@
       };
     },
     async created() {
-      const res = await this.requestDict('质检计划类型');
-      console.log(res, 'res 000');
-      this.typeList = res.map((item) => {
-        // let values = Object.keys(item);
-        // return {
-        //   value: Number(values[0]),
-        //   label: item[values[0]]
-        // };
-        return {
-          value: item.dictCode,
-          label: item.dictValue
-        };
-      });
+      // const res = await this.requestDict('质检计划类型');
+      // console.log(res, 'res 000');
+      // this.typeList = res.map((item) => {
+      //   console.log(item,'item')
+      //   // let values = Object.keys(item);
+      //   // return {
+      //   //   value: Number(values[0]),
+      //   //   label: item[values[0]]
+      //   // };
+      //   return {
+      //     value: item.dictCode,
+      //     label: item.dictValue
+      //   };
+      // });
 
-      const index = this.seekList.findIndex((item) => item.value === 'type');
+      // const index = this.seekList.findIndex((item) => item.value === 'type');
 
-      this.$set(this.seekList, index, {
-        label: '类型:',
-        value: 'type',
-        type: 'select',
-        placeholder: '',
-        planList: this.typeList
-      });
+      // this.$set(this.seekList, index, );
       this.renderFlag = true;
     },
     methods: {