if参数支持传入一个字段名

This commit is contained in:
2022-08-08 15:04:54 +08:00
parent aee24d4f09
commit 4b15980445
2 changed files with 19 additions and 5 deletions

View File

@@ -83,6 +83,7 @@ define(["jquery", "easy-admin", "treetable", "iconPickerFa", "autocomplete"], fu
auth: 'edit', auth: 'edit',
class: 'layui-btn layui-btn-xs layui-btn-success', class: 'layui-btn layui-btn-xs layui-btn-success',
extend: 'data-full="true"', extend: 'data-full="true"',
if:'status'
}, { }, {
text: '删除', text: '删除',
method: 'none', method: 'none',

View File

@@ -746,9 +746,22 @@ define(["jquery", "tableSelect", "ckeditor", 'miniTheme', 'tableData', 'citypick
operat.text = operat.text || operat.title; operat.text = operat.text || operat.title;
operat.if = operat.if || function () { return true }; operat.if = operat.if || function () { return true };
if (typeof operat.if == 'function') {
if (operat.if(data, operat) !== true) { if (operat.if(data, operat) !== true) {
return ''; return '';
} }
} else if (typeof operat.if == 'string') {
var ifValue = admin.table.returnColumnValue(data,operat.if,false);
if(!ifValue){
return ''
}
}
var titleEndfix = ''; var titleEndfix = '';
@@ -1096,13 +1109,13 @@ define(["jquery", "tableSelect", "ckeditor", 'miniTheme', 'tableData', 'citypick
return '0B' return '0B'
}, },
// 统一列返回数据处理 // 统一列返回数据处理
returnColumnValue(data) { returnColumnValue(data, field, defaultValue) {
if (!data.LAY_COL) { if (!data.LAY_COL) {
return ''; return '';
} }
var option = data.LAY_COL; var option = data.LAY_COL;
var field = option.field; field = field || option.field;
var defaultValue = option.defaultValue; defaultValue = defaultValue || option.defaultValue;
var value = defaultValue; var value = defaultValue;
try { try {
value = eval("data." + field); value = eval("data." + field);