优化 回显数据字典(字符串数组)JS 函数
This commit is contained in:
parent
8deacb702e
commit
d8d636fdbd
@ -78,18 +78,17 @@ export function selectDictLabel(datas, value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 回显数据字典(字符串数组)
|
// 回显数据字典(字符串数组)
|
||||||
export function selectDictLabels(datas, value, separator) {
|
export function selectDictLabels (datas = {}, value = '', separator = ',') {
|
||||||
var actions = [];
|
const actions = []
|
||||||
var currentSeparator = undefined === separator ? "," : separator;
|
const temp = value.split(separator)
|
||||||
var temp = value.split(currentSeparator);
|
temp.forEach((_, index) => {
|
||||||
Object.keys(value.split(currentSeparator)).some((val) => {
|
Object.keys(datas).forEach(key => {
|
||||||
Object.keys(datas).some((key) => {
|
if (datas[key].dictValue === temp[index].toString()) {
|
||||||
if (datas[key].dictValue == ('' + temp[val])) {
|
actions.push(datas[key].dictLabel)
|
||||||
actions.push(datas[key].dictLabel + currentSeparator);
|
}
|
||||||
}
|
})
|
||||||
})
|
})
|
||||||
})
|
return actions.join(separator)
|
||||||
return actions.join('').substring(0, actions.join('').length - 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 通用下载方法
|
// 通用下载方法
|
||||||
|
Loading…
Reference in New Issue
Block a user