فهرست منبع

添加getDictListByName方法

lucw 8 ماه پیش
والد
کامیت
01f1a18a85
3فایلهای تغییر یافته به همراه21 افزوده شده و 6 حذف شده
  1. 18 0
      src/store/getters.js
  2. 1 4
      src/views/rulesManagement/releaseRules/index.vue
  3. 2 2
      vue.config.js

+ 18 - 0
src/store/getters.js

@@ -27,5 +27,23 @@ export default {
     }
 
     return obj && obj.dictValue;
+  },
+  // 根据字典enumName 获取字典列表 label value 格式
+  getDictListByName: (sate) => (enumName) => {
+    const dList = sate.dict[dictEnum[enumName]] || [];
+
+    if (!dList.length) {
+      // 提交dict模块下的actions的requestDict
+      store.dispatch('dict/requestDict', enumName);
+      return '';
+    }
+
+    return dList.map((i) => {
+      return {
+        ...i,
+        label: i.dictValue,
+        value: i.dictCode
+      };
+    });
   }
 };

+ 1 - 4
src/views/rulesManagement/releaseRules/index.vue

@@ -292,10 +292,7 @@
         cacheKeyUrl: 'maindata-25922-recordrules-index'
       };
     },
-    created() {
-      this.requestDict('记录规则类型');
-      this.requestDict('规则周期');
-    },
+    created() {},
     methods: {
       addPermit(row, type, title) {
         this.$refs.permitAddRef.open(row, type, title);

+ 2 - 2
vue.config.js

@@ -36,12 +36,12 @@ module.exports = {
         // target: 'http://192.168.1.158:18086',
         // target: 'http://192.168.1.176:18086',
         // target: 'http://192.168.1.125:18086',
-        target: 'http://192.168.1.251:18186', // 测试环境
+        // target: 'http://192.168.1.251:18186', // 测试环境
         // target: 'http://192.168.1.251:18087',
         // target: 'http://192.168.1.116:18086',
         // target: 'http://192.168.1.251:18086',
 
-        // target: 'http://192.168.1.251:18086', // 开发
+        target: 'http://192.168.1.251:18086', // 开发
         // target: 'http://192.168.1.116:18086', // 赵沙金
 
         changeOrigin: true, // 只有这个值为true的情况下 才表示开启跨域