guhongwei преди 5 години
родител
ревизия
9fa44f36e6
променени са 1 файла, в които са добавени 23 реда и са изтрити 0 реда
  1. 23 0
      src/store/otherList.js

+ 23 - 0
src/store/otherList.js

@@ -0,0 +1,23 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+import _ from 'lodash';
+
+Vue.use(Vuex);
+const api = {
+  dictionary: '/api/code/{type}/items', //type === xzqh:query:level(1/2);parent(无/code)
+};
+export const state = () => ({});
+export const mutations = {};
+export const actions = {
+  // 字典表
+  async dicOperation({ state }, type) {
+    let result;
+    if (!_.isObject(type)) {
+      result = await this.$axios.$get(api.dictionary, { type: type });
+    } else {
+      let { level, parent } = type;
+      result = await this.$axios.$get(api.dictionary, { type: 'xzqh' }, { level: level, parent: parent });
+    }
+    return result;
+  },
+};