From c48c76754a464057804840bde4e51491aad196fb Mon Sep 17 00:00:00 2001 From: tangliu Date: Mon, 15 Mar 2021 12:14:34 +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=EF=BC=8C?= =?UTF-8?q?=E5=88=99=E8=BF=94=E5=9B=9E=E5=AD=97=E5=85=B8=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/static/ruoyi/js/ry-ui.js | 34 +++++++++++++++---- 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js index f5c0d8544..d8864e8b1 100644 --- a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js +++ b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js @@ -497,9 +497,16 @@ var table = { }, // 回显数据字典 selectDictLabel: function(datas, value) { - if ($.common.isEmpty(datas) || $.common.isEmpty(value)) { - return ''; - } + if ($.common.isEmpty(value)) { + return '' + } + if ($.common.isEmpty(datas)) { + if($.common.isEmpty(value)){ + return '' + }else{ + return value + } + } var actions = []; $.each(datas, function(index, dict) { if (dict.dictValue == ('' + value)) { @@ -508,23 +515,38 @@ var table = { return false; } }); + if (actions.length === 0) { + actions.push($.common.sprintf("%s", value)) + } return actions.join(''); }, // 回显数据字典(字符串数组) selectDictLabels: function(datas, value, separator) { - if ($.common.isEmpty(datas) || $.common.isEmpty(value)) { - return ''; - } + if ($.common.isEmpty(value)) { + return '' + } + if ($.common.isEmpty(datas)) { + if($.common.isEmpty(value)){ + return '' + }else{ + return value + } + } var currentSeparator = $.common.isEmpty(separator) ? "," : separator; var actions = []; $.each(value.split(currentSeparator), function(i, val) { + var match = false $.each(datas, function(index, dict) { if (dict.dictValue == ('' + val)) { var listClass = $.common.equals("default", dict.listClass) || $.common.isEmpty(dict.listClass) ? "" : "badge badge-" + dict.listClass; actions.push($.common.sprintf("%s ", listClass, dict.dictLabel)); + match = true return false; } }); + if (!match) { + actions.push($.common.sprintf("%s ", val)); + } }); return actions.join(''); },