mirror of https://github.com/1099438829/apeblog
244 lines
11 KiB
HTML
244 lines
11 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="zh">
|
||
<head>
|
||
<title>表单配置 - {:system_config('title')}后台管理系统</title>
|
||
{include file="public/header" /}
|
||
</head>
|
||
|
||
<body>
|
||
<div class="container-fluid p-t-15">
|
||
<div class="row">
|
||
<div class="col-lg-12">
|
||
<div class="card">
|
||
<div class="card-header">
|
||
<h4>{$tab.name}</h4>
|
||
<ul class="card-actions">
|
||
<li>
|
||
<button type="button" data-toggle="tooltip" title="" data-original-title="返回" onclick="history.back(-1);return false;"><i class="mdi mdi-undo"></i></button>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
<div class="card-body">
|
||
<div id="toolbar" class="toolbar-btn-action">
|
||
<button id="btn_add" type="button" class="btn btn-primary m-r-5"
|
||
onclick="iframe.createIframe('{$tab.name}-添加字段','/admin/system_config/add?tab_id={$tab.id}')">
|
||
<span class="mdi mdi-plus" aria-hidden="true"></span>新增
|
||
</button>
|
||
<button id="btn_edit" type="button" class="btn btn-success m-r-5" onclick="isEnable('enable')">
|
||
<span class="mdi mdi-check" aria-hidden="true"></span>启用
|
||
</button>
|
||
<button id="btn_disable" type="button" class="btn btn-warning m-r-5"
|
||
onclick="isEnable('disable')">
|
||
<span class="mdi mdi-block-helper" aria-hidden="true"></span>禁用
|
||
</button>
|
||
<button id="btn_delete" type="button" class="btn btn-danger" onclick="del()">
|
||
<span class="mdi mdi-window-close" aria-hidden="true"></span>删除
|
||
</button>
|
||
</div>
|
||
<table id="tb_departments"></table>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
{include file="public/footer"/}
|
||
<script type="text/javascript">
|
||
$('#tb_departments').bootstrapTable({
|
||
classes: 'table table-bordered table-hover table-striped',
|
||
url: '/admin/system_config/lst?tab_id={$tab.id}',
|
||
method: 'post',
|
||
dataType: 'json', // 因为本示例中是跨域的调用,所以涉及到ajax都采用jsonp,
|
||
uniqueId: 'id',
|
||
idField: 'id', // 每行的唯一标识字段
|
||
toolbar: '#toolbar', // 工具按钮容器
|
||
//clickToSelect: true, // 是否启用点击选中行
|
||
showColumns: true, // 是否显示所有的列
|
||
showRefresh: true, // 是否显示刷新按钮
|
||
responseHandler: function (res) {
|
||
return {
|
||
"total": res.count,
|
||
"rows": res.data,
|
||
};
|
||
},
|
||
//showToggle: true, // 是否显示详细视图和列表视图的切换按钮(clickToSelect同时设置为true时点击会报错)
|
||
|
||
pagination: true, // 是否显示分页
|
||
sortOrder: "asc", // 排序方式
|
||
queryParams: function (params) {
|
||
var temp = {
|
||
limit: params.limit, // 每页数据量
|
||
offset: params.offset, // sql语句起始索引
|
||
page: (params.offset / params.limit) + 1,
|
||
sort: params.sort, // 排序的列名
|
||
sortOrder: params.order // 排序方式'asc' 'desc'
|
||
};
|
||
return temp;
|
||
}, // 传递参数
|
||
sidePagination: "server", // 分页方式:client客户端分页,server服务端分页
|
||
pageNumber: 1, // 初始化加载第一页,默认第一页
|
||
pageSize: 20, // 每页的记录行数
|
||
pageList: [20, 50, 100], // 可供选择的每页的行数
|
||
columns: [{
|
||
checkbox: true // 是否显示复选框
|
||
}, {
|
||
field: 'id',
|
||
title: 'ID',
|
||
sortable: true // 是否排序
|
||
}, {
|
||
field: 'name',
|
||
title: '标题名称'
|
||
}, {
|
||
field: 'tag_type',
|
||
title: '标签类型'
|
||
}, {
|
||
field: 'form_type',
|
||
title: '表单类型'
|
||
}, {
|
||
field: 'form_name',
|
||
title: '表单名称'
|
||
}, {
|
||
field: 'param',
|
||
title: '参数'
|
||
}, {
|
||
field: 'value',
|
||
title: '内容'
|
||
}, {
|
||
field: 'remark',
|
||
title: '备注'
|
||
}, {
|
||
field: 'upload_type',
|
||
title: '上传配置'
|
||
}, {
|
||
field: 'rank',
|
||
title: '排序'
|
||
}, {
|
||
field: 'status',
|
||
title: '状态',
|
||
formatter: function (value, row, index) {
|
||
switch (value) {
|
||
case 0:
|
||
return '禁用';
|
||
case 1:
|
||
return '启用';
|
||
}
|
||
},
|
||
}, {
|
||
field: 'operate',
|
||
title: '操作',
|
||
formatter: btnGroup, // 自定义方法
|
||
events: {
|
||
'click .btn-edit': function (event, value, row, index) {
|
||
iframe.createIframe('{$tab.name}-修改字段', '/admin/system_config/edit?id=' + row.id)
|
||
},
|
||
'click .btn-del': function (event, value, row, index) {
|
||
$.alert({
|
||
title: '系统提示',
|
||
content: '删除提醒',
|
||
buttons: {
|
||
confirm: {
|
||
text: '确认',
|
||
btnClass: 'btn-primary',
|
||
action: function () {
|
||
$.post(url = "/admin/system_config/del", data = {"id": row.id}, function (res) {
|
||
if (res.status == 200) {
|
||
parent.lightyear.notify('删除成功', 'success', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
||
$("#tb_departments").bootstrapTable('refresh');
|
||
} else parent.lightyear.notify('删除失败', 'danger', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
||
});
|
||
}
|
||
},
|
||
cancel: {
|
||
text: '取消'
|
||
}
|
||
}
|
||
});
|
||
}
|
||
}
|
||
}],
|
||
});
|
||
|
||
// 操作按钮
|
||
function btnGroup() {
|
||
let html =
|
||
'<a href="#!" class="btn btn-xs btn-default m-r-5 btn-edit" title="编辑" data-toggle="tooltip"><i class="mdi mdi-pencil"></i></a>' +
|
||
'<a href="#!" class="btn btn-xs btn-default m-r-5 btn-del" title="删除" data-toggle="tooltip"><i class="mdi mdi-window-close"></i></a>';
|
||
return html;
|
||
}
|
||
|
||
// 删除
|
||
function del() {
|
||
var checkID = "";
|
||
var selectedItem = $('#tb_departments').bootstrapTable('getAllSelections');
|
||
if (selectedItem == "") return lightyear.notify("没有选中项", 'danger', 3000, 'mdi mdi-emoticon-neutral', 'top', 'center');
|
||
for (var i = 0; i < selectedItem.length; i++) {
|
||
checkID += selectedItem[i]['id'] + ",";
|
||
}
|
||
if (checkID == "") return lightyear.notify("没有选中项", 'danger', 3000, 'mdi mdi-emoticon-neutral', 'top', 'center');
|
||
$.confirm({
|
||
title: '重要提醒!',
|
||
content: '选中项将全部被删除,请谨慎操作!',
|
||
backgroundDismiss: true,
|
||
buttons: {
|
||
ok: {
|
||
text: '确认',
|
||
btnClass: 'btn-danger',
|
||
action: function () {
|
||
$.post("/admin/system_config/del", data = {id: checkID}, function (res) {
|
||
if (res.status == 200) {
|
||
lightyear.notify(res.msg, 'success', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
||
location.reload();
|
||
} else lightyear.notify(res.msg, 'danger', 3000, 'mdi mdi-emoticon-neutral', 'top', 'center');
|
||
})
|
||
}
|
||
},
|
||
cancel: {
|
||
text: '取消',
|
||
btnClass: 'btn-primary'
|
||
}
|
||
}
|
||
});
|
||
}
|
||
|
||
// 批量启用或者禁用
|
||
function isEnable(type) {
|
||
var checkID = "";
|
||
var selectedItem = $('#tb_departments').bootstrapTable('getAllSelections');
|
||
if (selectedItem == "") return lightyear.notify("没有选中项", 'danger', 3000, 'mdi mdi-emoticon-neutral', 'top', 'center');
|
||
for (var i = 0; i < selectedItem.length; i++) {
|
||
checkID += selectedItem[i]['id'] + ",";
|
||
}
|
||
if (checkID == "") return lightyear.notify("没有选中项", 'danger', 3000, 'mdi mdi-emoticon-neutral', 'top', 'center');
|
||
$.confirm({
|
||
title: '重要提醒!',
|
||
content: type == 'enable' ? '选中项将全部启用,请谨慎操作!' : '选中项将全部禁用,请谨慎操作!',
|
||
backgroundDismiss: true,
|
||
buttons: {
|
||
ok: {
|
||
text: '确认',
|
||
btnClass: 'btn-danger',
|
||
action: function () {
|
||
if (type == 'enable') {
|
||
$.post("/admin/system_config/enabled", data = {id: checkID}, function (res) {
|
||
if (res.status == 200) lightyear.notify(res.msg, 'success', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
||
else lightyear.notify(res.msg, 'danger', 3000, 'mdi mdi-emoticon-neutral', 'top', 'center');
|
||
location.reload();
|
||
})
|
||
} else {
|
||
$.post("/admin/system_config/disabled", data = {id: checkID}, function (res) {
|
||
if (res.status == 200) lightyear.notify(res.msg, 'success', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
||
else lightyear.notify(res.msg, 'danger', 3000, 'mdi mdi-emoticon-neutral', 'top', 'center');
|
||
location.reload();
|
||
})
|
||
}
|
||
}
|
||
},
|
||
cancel: {
|
||
text: '取消',
|
||
btnClass: 'btn-primary'
|
||
}
|
||
}
|
||
});
|
||
}
|
||
</script>
|
||
</body>
|
||
</html> |