You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
454 B
15 lines
454 B
// 获取字典的dictLabel
|
|
export const getDictLabel = (dictData: {dictLabel: string; dictValue: string}[], key: string) => {
|
|
if(dictData?.length && key){
|
|
let resStr = ''
|
|
let keyArr = key.split(',')
|
|
for (let i = 0; i < keyArr.length; i++) {
|
|
const element = dictData.find(item => item.dictValue === keyArr[i])
|
|
if(element){
|
|
resStr += element.dictLabel + ','
|
|
}
|
|
}
|
|
return resStr.slice(0, -1)
|
|
}
|
|
return '-'
|
|
}
|