diff --git a/ZR.Vue/src/utils/ruoyi.js b/ZR.Vue/src/utils/ruoyi.js index 4e4f5aa..55ad82a 100644 --- a/ZR.Vue/src/utils/ruoyi.js +++ b/ZR.Vue/src/utils/ruoyi.js @@ -99,6 +99,9 @@ export function addDateRange2(dateRange, index) { // 回显数据字典 export function selectDictLabel(datas, value) { + if (value === undefined) { + return ""; + } var actions = []; Object.keys(datas).some((key) => { if (datas[key].dictValue == ('' + value)) { @@ -106,6 +109,9 @@ export function selectDictLabel(datas, value) { return true; } }) + if (actions.length === 0) { + actions.push(value); + } return actions.join(''); } @@ -118,11 +124,16 @@ export function selectDictLabels(datas, value, separator) { var currentSeparator = undefined === separator ? "," : separator; var temp = value.split(currentSeparator); Object.keys(value.split(currentSeparator)).some((val) => { + var match = false; Object.keys(datas).some((key) => { - if (datas[key].dictValue == ('' + temp[val])) { - actions.push(datas[key].dictLabel + currentSeparator); + if (datas[key].value == ('' + temp[val])) { + actions.push(datas[key].label + currentSeparator); + match = true; } }) + if (!match) { + actions.push(temp[val] + currentSeparator); + } }) return actions.join('').substring(0, actions.join('').length - 1); }