From d8d636fdbdf79d17c459a00e9381be0bf6b17a86 Mon Sep 17 00:00:00 2001 From: fungleo Date: Tue, 4 Aug 2020 11:39:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E5=9B=9E=E6=98=BE?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=AD=97=E5=85=B8=EF=BC=88=E5=AD=97=E7=AC=A6?= =?UTF-8?q?=E4=B8=B2=E6=95=B0=E7=BB=84=EF=BC=89JS=20=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-ui/src/utils/ruoyi.js | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/ruoyi-ui/src/utils/ruoyi.js b/ruoyi-ui/src/utils/ruoyi.js index 23879aa..08fbd9d 100644 --- a/ruoyi-ui/src/utils/ruoyi.js +++ b/ruoyi-ui/src/utils/ruoyi.js @@ -78,18 +78,17 @@ export function selectDictLabel(datas, value) { } // 回显数据字典(字符串数组) -export function selectDictLabels(datas, value, separator) { - var actions = []; - var currentSeparator = undefined === separator ? "," : separator; - var temp = value.split(currentSeparator); - Object.keys(value.split(currentSeparator)).some((val) => { - Object.keys(datas).some((key) => { - if (datas[key].dictValue == ('' + temp[val])) { - actions.push(datas[key].dictLabel + currentSeparator); - } - }) - }) - return actions.join('').substring(0, actions.join('').length - 1); +export function selectDictLabels (datas = {}, value = '', separator = ',') { + const actions = [] + const temp = value.split(separator) + temp.forEach((_, index) => { + Object.keys(datas).forEach(key => { + if (datas[key].dictValue === temp[index].toString()) { + actions.push(datas[key].dictLabel) + } + }) + }) + return actions.join(separator) } // 通用下载方法