You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

198 lines
7.4 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="../../component/pear/css/pear.css" />
<style>
.woo-templet-url {
display: inline-block;
background: rgba(0, 0, 0, 0.3);
border-radius: 6px;
height: 20px;
line-height: 21px;
padding: 0 5px;
color: #fff;
max-width: 100%;
overflow: hidden;
margin-top: 5px;
}
.layui-card-body .layui-form {
margin-top: 0 !important;
}
</style>
</head>
<body class="pear-container">
<div class="layui-card">
<div class="layui-card-body">
<table id="dataTable"></table>
</div>
</div>
<script type="text/html" id="user-bar">
<button class="pear-btn pear-btn-primary pear-btn-sm" lay-event="edit" title="编辑"><i class="layui-icon layui-icon-edit"></i></button>
<button class="pear-btn pear-btn-danger pear-btn-sm" lay-event="remove" title="删除"><i class="layui-icon layui-icon-delete"></i></button>
</script>
<script src="../../component/layui/layui.js"></script>
<script src="../../component/pear/pear.js"></script>
<script>
layui.use(['table', 'form', 'jquery', 'common'], function () {
var table = layui.table;
var form = layui.form;
var $ = layui.jquery;
var common = layui.common;
table.render({
elem: '#dataTable',
url: '/QingLong/yx/matchSchoolNameList',
height: 'full-45',
request: {
pageName: 'pageNum', // 页码的参数名称默认page
limitName: 'pageSize' // 每页数据条数的参数名默认limit
},
page: {
limit: 14
, layout: ['count', 'prev', 'page', 'next', 'skip']
, prev: "上一页"
, next: "下一页"
},
cols: [[
{ title: '序号', field: 'username', align: 'center', width: "5%", type: 'numbers', },
{ title: '全局变量名称', field: 'global_name', align: 'center', width: "15%" },
{ title: '全局变量代码', field: 'global_code', align: 'center', width: "15%" },
{ title: '全局变量值', field: 'global_value', align: 'center', },
{ title: '操作', toolbar: '#user-bar', align: 'center', width: "15%" }
]],
skin: 'line',
defaultToolbar: [{
title: '刷新',
layEvent: 'refresh',
icon: 'layui-icon-refresh',
}, 'filter', 'print', 'exports']
});
table.on('tool(dataTable)', function (obj) {
if (obj.event === 'remove') {
window.remove(obj);
} else if (obj.event === 'edit') {
window.edit(obj);
}
});
table.on('toolbar(dataTable)', function (obj) {
if (obj.event === 'add') {
window.add();
} else if (obj.event === 'refresh') {
window.refresh();
} else if (obj.event === 'batchRemove') {
window.batchRemove(obj);
}
});
window.add = function () {
layer.open({
type: 2,
title: '新增',
shade: 0.1,
area: ['650px', '335px'],
content: './add.html'
});
}
window.edit = function (obj) {
layer.open({
type: 2,
title: '修改',
shade: 0.1,
area: ['650px', '335px'],
content: './update.html?global_id=' + obj.data.global_id
});
}
window.remove = function (obj) {
layer.confirm('确定要删除该全局变量吗?', {
icon: 3,
title: '提示'
}, function (index) {
layer.close(index);
let loading = layer.load();
$.ajax({
url: "/QingLong/global/delGlobalByIds",
data: { global_ids: obj.data['global_id'] },
type: 'post',
success: function (result) {
layer.close(loading);
if (result.success) {
layer.msg('删除成功!', {
icon: 1,
time: 1000
}, function () {
table.reload('dataTable');
});
} else {
layer.msg(result.message, {
icon: 2,
time: 1000
});
}
},
error: function (xhr, status, error) {
layer.close(loading);
console.log('请求出错:' + error + ',' + status);
}
})
});
}
window.batchRemove = function (obj) {
var globalIds = common.checkField(obj, 'global_id');
if (globalIds === "") {
layer.msg("请选择要删除的数据!", {
icon: 2,
time: 1500
});
return false;
}
layer.confirm('确定要删除选择的数据吗?', {
icon: 3,
title: '提示'
}, function (index) {
layer.close(index);
let loading = layer.load();
$.ajax({
url: "/QingLong/global/delGlobalByIds",
data: { global_ids: globalIds },
type: 'post',
success: function (result) {
layer.close(loading);
if (result.success) {
layer.msg('删除成功!', {
icon: 1,
time: 1000
}, function () {
table.reload('dataTable');
});
} else {
layer.msg(result.message, {
icon: 2,
time: 1000
});
}
}
});
});
}
window.refresh = function (param) {
table.reload('dataTable');
}
})
</script>
</body>
</html>