46 lines
1.5 KiB
JavaScript
46 lines
1.5 KiB
JavaScript
layui.use(['jquery', 'laytpl', 'table', 'miniTab'], function () {
|
|
let $ = layui.jquery,
|
|
table = layui.table,
|
|
layer = layui.layer,
|
|
miniTab = layui.miniTab;
|
|
|
|
/**** index begin ***/
|
|
//index页面
|
|
if ($('.location-index-page').length > 0) {
|
|
miniTab.listen();
|
|
|
|
// 渲染表格
|
|
let listUrl = $('#table-container').data('url');
|
|
let insTb = table.render({
|
|
elem: '#table-container',
|
|
toolbar: '#toolbar-tpl',
|
|
defaultToolbar: [],
|
|
url: listUrl,
|
|
method: 'post',
|
|
request: {
|
|
pageName: 'page',
|
|
limitName: 'size',
|
|
},
|
|
parseData: function (res) {
|
|
return {
|
|
"code": res.code, //解析接口状态
|
|
"msg": res.msg, //解析提示文本
|
|
"count": res.data.total, //解析数据长度
|
|
"data": res.data.list //解析数据列表
|
|
};
|
|
},
|
|
page: true,
|
|
cols: [[
|
|
{type: 'checkbox'},
|
|
{field: 'title', minWidth: 200, title: '分组标题'},
|
|
{field: 'name', minWidth: 200, title: '分组标识'},
|
|
{field: 'sort', align: 'center', title: '排序', edit: 'text'},
|
|
{templet: '#row-operate', align: 'center', title: '操作'}
|
|
]],
|
|
done: function () {
|
|
Tools.setInsTb(insTb);
|
|
}
|
|
});
|
|
}
|
|
/*** index end ***/
|
|
}); |