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.

178 lines
6.1 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="../layui/css/layui.css" />
<style>
.woo-tool-text-delimiter {
width: 1px;
height: 12px;
background: #EEEEEE;
display: inline-block;
margin: 0 6px 0 4px;
}
.woo-theme-color {
color: #1e9fff !important;
}
.woo-tool-span {
margin: 0 3px;
position: relative;
top: -1px;
cursor: pointer;
}
.layui-card-body .layui-form {
margin-top: 0 !important;
}
.layui-form-select {
width: 300px;
}
.layui-card {
margin-bottom: 15px;
border-radius: 2px;
background-color: #fff;
box-shadow: none;
}
</style>
</head>
<body class="layui-form">
<div class="layui-card">
<div class="layui-card-body">
<table id="data-table"></table>
<script type="text/html" id="tableToolbar">
<div class="layui-btn-container">
<button class="layui-btn layui-btn-sm" lay-event="add"><i class="layui-icon layui-icon-addition"></i></button>
</div>
</script>
<script type="text/html" id="table-bar">
<span class="woo-tool-span woo-tool-text-span" lay-event="update"><a
class="woo-theme-color">修改</a></span>
<i class="woo-tool-text-delimiter"></i>
<span class="woo-tool-span woo-tool-text-span" lay-event="delete"><a
class="woo-theme-color">删除</a></span>
</script>
</div>
</div>
<script src="../layui/layui.js"></script>
<script src="../../../lib/base64.js"></script>
<script>
layui.use(function () {
var table = layui.table;
var form = layui.form;
var $ = layui.jquery;
var common = layui.common;
var laytpl = layui.laytpl;
tableRender();
function tableRender() {
table.render({
elem: '#data-table',
url: '/ZhuQue/station/getThirdPartyCompanyList',
request: {
pageName: 'pageNum', // 页码的参数名称默认page
limitName: 'pageSize' // 每页数据条数的参数名默认limit
},
height: 'full-35',
page: {
limit: 20
, layout: ['count', 'prev', 'page', 'next', 'skip']
, prev: "上一页"
, next: "下一页"
},
toolbar: '#tableToolbar',
cols: [[
{ title: '序号', align: 'center', width: "5%", type: 'numbers' },
{ title: '公司名称', field: 'company_name', align: 'center' },
{ title: '公司简称', field: 'short_name', align: 'center' },
{ title: '密码', field: 'password', align: 'center' },
{ title: '操作', toolbar: '#table-bar', align: 'center', width: "10%" }
]],
skin: 'line',
defaultToolbar: [],
parseData: function (res) {
if (res.code === 200) {
return {
"code": 0,
"msg": "",
"count": res.data.total,
"data": res.data.list
};
}
}
});
}
table.on('toolbar(data-table)', function (obj) {
if (obj.event === 'add') {
layer.open({
type: 2,
title: '新增',
area: ['490px', '240px'],
shade: 0.1,
content: './add.html'
});
}
});
table.on('tool(data-table)', function (obj) {
if (obj.event === 'update') {
layer.open({
type: 2,
title: '新增',
area: ['490px', '300px'],
shade: 0.1,
content: './update.html?id=' + obj.data.id
});
} else {
layer.confirm('确定要删除吗?', {
icon: 3,
title: '提示'
}, function (index) {
layer.close(index);
$.ajax({
url: "/ZhuQue/station/delThirdPartyCompany",
data: { id: obj.data.id },
type: 'post',
success: function (res) {
if (res.success) {
layer.msg('删除成功!', {
icon: 1,
time: 1300
}, function () {
table.reload('data-table');
});
} else {
layer.msg(res.message, {
icon: 2,
time: 2000
});
}
}
});
});
}
});
});
</script>
</body>
</html>