main
kgdxpr 7 months ago
parent d73ba0057a
commit 275d0fb321

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