表格operat使用_if替代if

This commit is contained in:
2022-08-30 15:13:03 +08:00
parent bb1edee5e1
commit 361b711670
2 changed files with 7 additions and 7 deletions

View File

@@ -69,7 +69,7 @@ define(["jquery", "easy-admin", "treetable", "iconPickerFa", "autocomplete"], fu
auth: 'add',
class: 'layui-btn layui-btn-xs layui-btn-normal',
extend: 'data-full="true"',
if: function (data) {
_if: function (data) {
if (data.pid == 99999999) {
return false;
}
@@ -84,7 +84,7 @@ define(["jquery", "easy-admin", "treetable", "iconPickerFa", "autocomplete"], fu
auth: 'edit',
class: 'layui-btn layui-btn-xs layui-btn-success',
extend: 'data-full="true"',
if: 'status'
_if: 'status'
}, {
text: '删除',
method: 'none',

View File

@@ -751,17 +751,17 @@ define(["jquery", "tableSelect", "ckeditor", 'miniTheme', 'tableData', 'citypick
operat.titleField = operat.titleField || 'title';
operat.title = operat.title || operat.text;
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 (typeof operat._if == 'function') {
if (operat.if(data, operat) !== true) {
if (operat._if(data, operat) !== true) {
return '';
}
} else if (typeof operat.if == 'string') {
} else if (typeof operat._if == 'string') {
var ifValue = admin.table.returnColumnValue(data, operat.if, false);
var ifValue = admin.table.returnColumnValue(data, operat._if, false);
if (!ifValue) {
return ''