diff --git a/public/static/plugs/easy-admin/easy-admin.js b/public/static/plugs/easy-admin/easy-admin.js index 9c561f0..7c8a7ea 100644 --- a/public/static/plugs/easy-admin/easy-admin.js +++ b/public/static/plugs/easy-admin/easy-admin.js @@ -501,7 +501,7 @@ define(["jquery", "tableSelect"], function ($, tableSelect) { return html; }, - buildOperatHtml: function (operat) { + buildOperatHtml: function (operat, data) { var html = ''; operat.class = operat.class || ''; operat.icon = operat.icon || ''; @@ -512,6 +512,7 @@ define(["jquery", "tableSelect"], function ($, tableSelect) { operat.field = operat.field || 'id'; operat.title = operat.title || operat.text; operat.text = operat.text || operat.title; + operat.visible = typeof operat.visible !== 'undefined' ? operat.visible : true; var formatOperat = operat; formatOperat.icon = formatOperat.icon !== '' ? ' ' : ''; @@ -525,6 +526,17 @@ define(["jquery", "tableSelect"], function ($, tableSelect) { } html = '' + formatOperat.icon + formatOperat.text + ''; + if ('function' === typeof formatOperat.visible) { + let visible = formatOperat.visible(data); + if (typeof visible === 'boolean') { + if (!visible) html = '' + } + } else { + if (typeof formatOperat.visible === 'boolean') { + if (!formatOperat.visible) html = '' + } + } + return html; }, toolSpliceUrl(url, field, data) { @@ -611,7 +623,7 @@ define(["jquery", "tableSelect"], function ($, tableSelect) { }; operat.url = admin.table.toolSpliceUrl(operat.url, operat.field, data); if (admin.checkAuth(operat.auth, elem)) { - html += admin.table.buildOperatHtml(operat); + html += admin.table.buildOperatHtml(operat, data); } break; case 'delete': @@ -628,7 +640,7 @@ define(["jquery", "tableSelect"], function ($, tableSelect) { }; operat.url = admin.table.toolSpliceUrl(operat.url, operat.field, data); if (admin.checkAuth(operat.auth, elem)) { - html += admin.table.buildOperatHtml(operat); + html += admin.table.buildOperatHtml(operat, data); } break; } @@ -655,7 +667,7 @@ define(["jquery", "tableSelect"], function ($, tableSelect) { operat.url = admin.table.toolSpliceUrl(operat.url, operat.field, data); if (admin.checkAuth(operat.auth, elem)) { - html += admin.table.buildOperatHtml(operat); + html += admin.table.buildOperatHtml(operat, data); } }); }