优化表格开关,无权限的退化为list;

This commit is contained in:
2022-08-22 16:32:54 +08:00
parent 198cdfff2f
commit 4de5b6a00e
10 changed files with 15 additions and 0 deletions

View File

@@ -5,6 +5,7 @@
data-auth-edit="{:auth('{{controllerUrl}}/edit')}"
data-auth-delete="{:auth('{{controllerUrl}}/delete')}"
data-auth-export="{:auth('{{controllerUrl}}/export')}"
data-auth-modify="{:auth('{{controllerUrl}}/modify')}"
lay-filter="currentTable">
</table>
</div>

View File

@@ -4,6 +4,7 @@
data-auth-add="{:auth('mall.cate/add')}"
data-auth-edit="{:auth('mall.cate/edit')}"
data-auth-delete="{:auth('mall.cate/delete')}"
data-auth-modify="{:auth('mall.cate/modify')}"
lay-filter="currentTable">
</table>
</div>

View File

@@ -5,6 +5,7 @@
data-auth-edit="{:auth('mall.goods/edit')}"
data-auth-delete="{:auth('mall.goods/delete')}"
data-auth-stock="{:auth('mall.goods/stock')}"
data-auth-modify="{:auth('mall.goods/modify')}"
lay-filter="currentTable">
</table>
</div>

View File

@@ -4,6 +4,7 @@
data-auth-add="{:auth('mall.tag/add')}"
data-auth-edit="{:auth('mall.tag/edit')}"
data-auth-delete="{:auth('mall.tag/delete')}"
lay-filter="currentTable">
</table>
</div>

View File

@@ -5,6 +5,7 @@
data-auth-edit="{:auth('system.admin/edit')}"
data-auth-delete="{:auth('system.admin/delete')}"
data-auth-password="{:auth('system.admin/password')}"
data-auth-modify="{:auth('system.admin/modify')}"
lay-filter="currentTable">
</table>
</div>

View File

@@ -5,6 +5,7 @@
data-auth-edit="{:auth('system.auth/edit')}"
data-auth-delete="{:auth('system.auth/delete')}"
data-auth-authorize="{:auth('system.auth/authorize')}"
data-auth-modify="{:auth('system.auth/modify')}"
lay-filter="currentTable">
</table>
</div>

View File

@@ -12,6 +12,7 @@
data-auth-add="{:auth('system.menu/add')}"
data-auth-edit="{:auth('system.menu/edit')}"
data-auth-delete="{:auth('system.menu/delete')}"
data-auth-modify="{:auth('system.menu/modify')}"
lay-filter="currentTable">
</table>
</div>

View File

@@ -3,6 +3,7 @@
<table id="currentTable" class="layui-table layui-hide"
data-auth-refresh="{:auth('system.node/refreshNode')}"
data-auth-clear="{:auth('system.node/clearNode')}"
data-auth-modify="{:auth('system.node/modify')}"
lay-filter="currentTable">
</table>
</div>

View File

@@ -4,6 +4,7 @@
data-auth-add="{:auth('system.quick/add')}"
data-auth-edit="{:auth('system.quick/edit')}"
data-auth-delete="{:auth('system.quick/delete')}"
data-auth-modify="{:auth('system.quick/modify')}"
lay-filter="currentTable">
</table>
</div>

View File

@@ -1065,9 +1065,15 @@ define(["jquery", "tableSelect", "ckeditor", 'miniTheme', 'tableData', 'citypick
},
switch: function (data) {
var option = data.LAY_COL;
if (!admin.checkAuth('modify', option.init.table_elem)) {
return admin.table.list(data);
}
option.filter = option.filter || option.field || null;
option.checked = option.checked || 1;
option.tips = option.tips || '|';
var value = admin.table.returnColumnValue(data);
var checked = value === option.checked ? 'checked' : '';
return laytpl('<input type="checkbox" name="' + option.field + '" value="' + data.id + '" lay-skin="switch" lay-text="' + option.tips + '" lay-filter="' + option.filter + '" ' + checked + ' >').render(data);