|
@@ -3,7 +3,7 @@ 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)
|
|
|
+ dictionary: type=>`/api/code/${type}/items`, //type === xzqh:query:level(1/2);parent(无/code)
|
|
|
};
|
|
|
const state = () => ({});
|
|
|
const mutations = {};
|
|
@@ -13,13 +13,13 @@ const actions = {
|
|
|
async dicOperation({ state }, type) {
|
|
|
let result;
|
|
|
if (!_.isObject(type)) {
|
|
|
- result = await this.$axios.$get(api.dictionary, { type: type });
|
|
|
+ result = await this.$axios.$get(api.dictionary(type));
|
|
|
} else {
|
|
|
let { level, parent, name } = type;
|
|
|
if (name) {
|
|
|
result = await this.$axios.$get(api.findOne, {}, { name: name });
|
|
|
} else {
|
|
|
- result = await this.$axios.$get(api.dictionary, { type: 'xzqh' }, { level: level, parent: parent });
|
|
|
+ result = await this.$axios.$get(api.dictionary(type), { level: level, parent: parent });
|
|
|
}
|
|
|
}
|
|
|
return result;
|