From becd079766323b258cc3c30fac839aa2b886eea8 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Wed, 23 Feb 2022 16:56:35 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E8=8B=A5=E6=9C=AA=E5=8C=B9?= =?UTF-8?q?=E9=85=8D=E5=88=B0=E5=AD=97=E5=85=B8=E6=A0=87=E7=AD=BE=E5=88=99?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E5=8E=9F=E5=AD=97=E5=85=B8=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/ruoyi.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/utils/ruoyi.js b/src/utils/ruoyi.js index 5d46531..a051e82 100644 --- a/src/utils/ruoyi.js +++ b/src/utils/ruoyi.js @@ -70,6 +70,9 @@ export function addDateRange(params, dateRange, propName) { // 回显数据字典 export function selectDictLabel(datas, value) { + if (value === undefined) { + return ""; + } var actions = []; Object.keys(datas).some((key) => { if (datas[key].value == ('' + value)) { @@ -77,23 +80,31 @@ export function selectDictLabel(datas, value) { return true; } }) + if (actions.length === 0) { + actions.push(value); + } return actions.join(''); } // 回显数据字典(字符串数组) export function selectDictLabels(datas, value, separator) { - if(value === undefined) { + if (value === undefined) { return ""; } var actions = []; 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].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); }