91 lines
3.2 KiB
Plaintext
91 lines
3.2 KiB
Plaintext
define(["jquery", "easy-admin"], function ($, ea) {
|
|
|
|
var init = {
|
|
table_elem: '#currentTable',
|
|
table_render_id: 'currentTableRenderId',
|
|
index_url: '{{controllerUrl}}/index',
|
|
add_url: '{{controllerUrl}}/add',
|
|
edit_url: '{{controllerUrl}}/edit',
|
|
delete_url: '{{controllerUrl}}/delete',
|
|
export_url: '{{controllerUrl}}/export',
|
|
modify_url: '{{controllerUrl}}/modify',
|
|
recycle_url: '{{controllerUrl}}/recycle',
|
|
};
|
|
|
|
return {
|
|
|
|
index: function () {
|
|
ea.table.render({
|
|
init: init,
|
|
cols: [[
|
|
{{indexCols}}
|
|
]],
|
|
});
|
|
|
|
ea.listen();
|
|
},
|
|
add: function () {
|
|
ea.listen();
|
|
},
|
|
edit: function () {
|
|
ea.listen();
|
|
},
|
|
recycle: function () {
|
|
init.index_url = init.recycle_url;
|
|
ea.table.render({
|
|
init: init,
|
|
toolbar: ['refresh',
|
|
[{
|
|
class: 'layui-btn layui-btn-sm',
|
|
method: 'get',
|
|
field: 'id',
|
|
icon: 'fa fa-refresh',
|
|
text: '全部恢复',
|
|
title: '确定恢复?',
|
|
auth: 'recycle',
|
|
url: init.recycle_url + '?type=restore',
|
|
checkbox: true
|
|
}, {
|
|
class: 'layui-btn layui-btn-danger layui-btn-sm',
|
|
method: 'get',
|
|
field: 'id',
|
|
icon: 'fa fa-delete',
|
|
text: '彻底删除',
|
|
title: '确定彻底删除?',
|
|
auth: 'recycle',
|
|
url: init.recycle_url + '?type=delete',
|
|
checkbox: true
|
|
}], 'export',
|
|
],
|
|
cols: [[
|
|
{{recycleCols}}
|
|
{
|
|
width: 250,
|
|
title: '操作',
|
|
templet: ea.table.tool,
|
|
operat: [
|
|
[{
|
|
title: '确认恢复?',
|
|
text: '恢复数据',
|
|
filed: 'id',
|
|
url: init.recycle_url + '?type=restore',
|
|
method: 'get',
|
|
auth: 'recycle',
|
|
class: 'layui-btn layui-btn-xs layui-btn-success',
|
|
}, {
|
|
title: '想好了吗?',
|
|
text: '彻底删除',
|
|
filed: 'id',
|
|
method: 'get',
|
|
url: init.recycle_url + '?type=delete',
|
|
auth: 'recycle',
|
|
class: 'layui-btn layui-btn-xs layui-btn-normal layui-bg-red',
|
|
}]]
|
|
}
|
|
]],
|
|
});
|
|
|
|
ea.listen();
|
|
},
|
|
};
|
|
}); |