|
@@ -32,10 +32,10 @@ const getDictList = async () => {
|
|
|
dictObj[val.value] = data
|
|
|
})
|
|
|
}
|
|
|
-export const getData = async () => {
|
|
|
+export const getDictListData = async () => {
|
|
|
await getDictList()
|
|
|
}
|
|
|
-getData()
|
|
|
+getDictListData()
|
|
|
|
|
|
export const dealDictArrayData = (res, list) => {
|
|
|
res = list.map(item => {
|
|
@@ -44,7 +44,7 @@ export const dealDictArrayData = (res, list) => {
|
|
|
if (!data) return
|
|
|
const valueKey = data.nameKey ? data.nameKey : 'label'
|
|
|
const idKey = data.valueKey ? data.valueKey : 'value'
|
|
|
- if (!Object.keys(dictObj[data.value]).length) return
|
|
|
+ if (!dictObj[data.value] || !Object.keys(dictObj[data.value]).length) return
|
|
|
const result = dictObj[data.value].find(val => val[idKey] === item[e])
|
|
|
if (!result) return
|
|
|
item[data.label] = result[valueKey] || ''
|