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.

161 lines
5.1 KiB

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="../../../component/pear/css/pear.css" />
<style>
.woo-tool-text-delimiter {
width: 1px;
height: 12px;
background: #EEEEEE;
display: inline-block;
margin: 0 6px 0 4px;
}
.woo-theme-color {
color: #2d8cf0 !important;
}
.woo-tool-span {
margin: 0 3px;
position: relative;
top: -1px;
cursor: pointer;
}
.layui-table-tool-temp {
padding-right: 0;
}
</style>
</head>
<body class="pear-container layui-form">
<div class="layui-card">
<div class="layui-card-body">
<table id="data-table"></table>
</div>
</div>
<script type="text/html" id="table-bar">
<span class="woo-tool-span woo-tool-text-span" lay-event="viewTableStructure"><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="viewPartition"><a
class="woo-theme-color">查看分区</a></span>
</script>
<script src="../../../component/layui/layui.js"></script>
<script src="../../../component/pear/pear.js"></script>
<script>
layui.use(['table', 'form', 'jquery', 'common', 'laytpl'], 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: '/dsBase/dataShare/getAllFenQuBiao',
where: {
page: 1,
limit: 100,
system_id: 0
},
height: 'full-60',
cols: [[
{ title: '序号', align: 'center', width: "5%", type: 'numbers' },
{ title: '表名', field: 'table_name', align: 'center' },
{ title: '操作', toolbar: '#table-bar', align: 'center', width: "20%" }
]],
skin: 'line',
defaultToolbar: []
});
}
table.on('tool(data-table)', function (obj) {
if (obj.event === 'viewTableStructure') {
window.viewTableStructure(obj);
} else if (obj.event === 'viewPartition') {
window.viewPartition(obj);
}
});
window.viewPartition = function (obj) {
layer.open({
type: 2,
title: '查看分区',
shade: 0.1,
area: ['800px', '500px'],
content: './view_table_partition.html?table_name=' + obj.data.table_name
});
}
window.viewTableStructure = function (obj) {
layer.open({
type: 2,
title: '查看表结构',
shade: 0.1,
area: ['800px', '500px'],
content: './view_table_structure.html?table_name=' + obj.data.table_name
});
}
window.refreshTable = function () {
$.ajax({
url: "/dsBase/dataShare/refreshTable",
type: 'post',
success: function (result) {
if (result.success) {
layer.msg('刷新成功!', {
icon: 1,
time: 1000
}, function () {
table.reload('data-table');
});
} else {
layer.msg(result.message, {
icon: 2,
time: 1000
});
}
},
error: function (xhr, status, error) {
layer.close(loading);
console.log('请求出错:' + error + ',' + status);
}
});
}
function GetQueryString(name, istop) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = window.location.search.substr(1).match(reg);
if (typeof (istop) != "undefined") r = top.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]);
return null;
}
});
</script>
</body>
</html>