Commit 7edeaf19 authored by 周远喜's avatar 周远喜

数据字典修改,返回数据字典对象集合

parent 3ff578c0
......@@ -3,7 +3,7 @@ import Api from '@/plugins/request'
// import Mock from 'mockjs'
export const state = () => ({
counter: 0,
dictionary: new Map(), //所有字典项
dictionary: [], //所有字典项
userMap: new Map(), //所有用户缓存;
userNameMap: new Map(), //所有用户名称缓存;
departmentsMap: new Map(), //部门缓存;
......@@ -25,10 +25,11 @@ export const getters = {
dictionaryByKey: (state) => (key) => {
let result = [];
if (state && state.dictionary) {
let items = state.dictionary.get(key);
if (items) {
// console.info("items",items)
return items;
let items = state.dictionary.filter(u=>{
return u.code===key
});
if (items.length>0) {
return items[0].items;
}
}
......@@ -36,12 +37,11 @@ export const getters = {
},
dictionaryByCode: (state) => (key, code) => {
let result = null;
let items = state.dictionary.get(key);
if (items) {
// console.info("items",items)
return items.filter(u => {
return u.code == code
})[0];
let items = state.dictionary.filter(u=>{
return u.code===key
});
if (items.length>0) {
return items[0];
}
return result;
},
......@@ -167,18 +167,12 @@ export const actions = {
async loadDictionary({
commit
}) {
let url = `${systemUrl}/Dictionary/GetAll`
let url = `${systemUrl}/Dictionary/getallanditems`
let {
result
} = await Api.get(url);
var map = new Map();
for (const key in result) {
if (result.hasOwnProperty(key)) {
map.set(key, result[key])
}
}
commit("setDictionary", map);
commit("setDictionary", result);
let r = await Api.get(`${systemUrl}/user/getuserlist`);
var umap = new Map();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment