Browse Source

页面若未匹配到字典标签则返回原字典值

pull/372/head
RuoYi 3 years ago
parent
commit
c2743f949e
  1. 8
      ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js

8
ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js

@ -539,6 +539,9 @@ var table = {
return false; return false;
} }
}); });
if (actions.length === 0) {
actions.push($.common.sprintf("<span>%s</span>", value))
}
return actions.join(''); return actions.join('');
}, },
// 回显数据字典(字符串数组) // 回显数据字典(字符串数组)
@ -549,13 +552,18 @@ var table = {
var currentSeparator = $.common.isEmpty(separator) ? "," : separator; var currentSeparator = $.common.isEmpty(separator) ? "," : separator;
var actions = []; var actions = [];
$.each(value.split(currentSeparator), function(i, val) { $.each(value.split(currentSeparator), function(i, val) {
var match = false
$.each(datas, function(index, dict) { $.each(datas, function(index, dict) {
if (dict.dictValue == ('' + val)) { if (dict.dictValue == ('' + val)) {
var listClass = $.common.equals("default", dict.listClass) || $.common.isEmpty(dict.listClass) ? "" : "badge badge-" + dict.listClass; var listClass = $.common.equals("default", dict.listClass) || $.common.isEmpty(dict.listClass) ? "" : "badge badge-" + dict.listClass;
actions.push($.common.sprintf("<span class='%s'>%s</span>", listClass, dict.dictLabel)); actions.push($.common.sprintf("<span class='%s'>%s</span>", listClass, dict.dictLabel));
match = true
return false; return false;
} }
}); });
if (!match) {
actions.push($.common.sprintf("<span> %s </span>", val));
}
}); });
return actions.join(''); return actions.join('');
}, },

Loading…
Cancel
Save