修改日志

This commit is contained in:
邹景立 2021-07-22 15:12:55 +08:00
parent e5f60e8717
commit 0b868f7a63
2 changed files with 17 additions and 8 deletions

View File

@ -24,14 +24,22 @@
cols: [[
{checkbox: true},
{field: 'id', title: 'ID', width: 80, sort: true, align: 'center'},
{field: 'username', title: '操作账号', sort: true, align: 'center'},
{field: 'node', title: '操作节点', sort: true},
{field: 'action', title: '操作行为', sort: true},
{field: 'content', title: '操作描述', sort: false},
{field: 'geoip', title: '访问地址', sort: true},
{field: 'geoisp', title: '网络服务商', sort: false},
{field: 'create_at', title: '操作时间', sort: true},
{toolbar: '#toolbar', align: 'center'}
]]
});
});
</script>
<script type="text/html" id="toolbar">
<!--{if auth('remove')}-->
<a data-action='{:url("remove")}' data-value="id#{{d.id}}" data-table-id="oplog" data-confirm="确认要删除这条记录吗?" class="layui-btn layui-btn-danger layui-btn-sm"> </a>
<!--{/if}-->
</script>
{/block}

View File

@ -654,8 +654,6 @@ $(function () {
/*! 组件 LayUI table 功能封装 */
$.fn.layTable = function (options) {
return this.each(function (idx, elem) {
// 拦截异常标签对象
if (this.nodeName !== 'TABLE') return new Error('It is not a table tag.');
// 动态初始化数据表
this.id = this.id || 't' + Math.random().toString().replace('0.', '');
this.dataset.dataFilter = this.getAttribute('lay-filter') || this.id;
@ -665,15 +663,18 @@ $(function () {
opt.id = elem.id, opt.elem = elem, opt.url = options.url || elem.dataset.url || location.href;
opt.page = options.page !== false, opt.limit = options.limit || 20, opt.cols = options.cols || [[]];
// 实例表格组件
$(this).data('this', layui.table.render(bindData(opt)));
// 绑定重载事件
$(this).bind('reload', function (event, opts) {
layui.table.reload(elem.id, bindData(opts || {}));
});
var table = layui.table.render(bindData(opt));
table.bind = function (name, callable) {
return layui.table.on(name + '(' + elem.dataset.dataFilter + ')', callable), table;
}
// 排序事件处理
layui.table.on('sort(' + this.dataset.dataFilter + ')', function (object) {
table.bind('sort', function (object) {
(sort = object), $(elem).trigger('reload')
});
// 绑定生成对象,绑定重载事件
$(this).data('this', table).bind('reload', function (event, opts) {
layui.table.reload(elem.id, bindData(opts || {}));
});
// 搜索表单处理
var search = options.search || this.dataset.targetSearch;
if (search) $body.off('submit', search).on('submit', search, function () {