parent
8dbc147f39
commit
a140fcf976
@ -0,0 +1,136 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Demo</title>
|
||||
<!-- 请勿在项目正式环境中引用该 layui.css 地址 -->
|
||||
<link href="../js/layui/css/layui.css" rel="stylesheet">
|
||||
<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="table-bar">
|
||||
<span class="woo-tool-span woo-tool-text-span" lay-event="uploadData"><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="downloadData"><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="mod"><a
|
||||
class="woo-theme-color">数据维护</a></span>
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 请勿在项目正式环境中引用该 layui.js 地址 -->
|
||||
<script src="../js/layui/layui.js"></script>
|
||||
<script>
|
||||
layui.use('table', function () {
|
||||
var table = layui.table;
|
||||
var $ = layui.jquery;
|
||||
|
||||
|
||||
table.render({
|
||||
elem: '#data-table',
|
||||
url: '/dsBase/dataease/getDataSetByCity',
|
||||
height: 'full-35',
|
||||
page: {
|
||||
limit: 20
|
||||
, layout: ['count', 'prev', 'page', 'next', 'skip']
|
||||
, prev: "上一页"
|
||||
, next: "下一页"
|
||||
},
|
||||
cols: [[
|
||||
{ title: '序号', align: 'center', width: "5%", type: 'numbers' },
|
||||
{ title: '分类', field: 'parent_name', align: 'center' },
|
||||
{ title: '数据集', field: 'dataset_name', align: 'center' },
|
||||
{ title: '已填数据(条)', field: 'fill_count', align: 'center' },
|
||||
// { title: '表名', field: 'table_name', align: 'center' },
|
||||
{ title: '操作', toolbar: '#table-bar', align: 'center', width: 390 }
|
||||
]],
|
||||
skin: 'line',
|
||||
defaultToolbar: [],
|
||||
parseData: function (res) {
|
||||
var data = res.data;
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
if (data[i].fill_count > 0) {
|
||||
data[i].LAY_CHECKED = true;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
});
|
||||
|
||||
table.on('tool(data-table)', function (obj) {
|
||||
window.location.href = "./dataMod_proxy_city.html?id=" + obj.data.id;
|
||||
});
|
||||
|
||||
|
||||
table.on('tool(data-table)', function (obj) {
|
||||
if (obj.event === 'uploadData') {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '上传数据',
|
||||
area: ['600px', '230px'],
|
||||
shade: 0.1,
|
||||
content: './upload_proxy_city.html?id=' + obj.data.id
|
||||
});
|
||||
|
||||
} else if (obj.event === 'downloadSample') {
|
||||
window.location.href = "/dsBase/dataease/downSampleExcel?id=" + obj.data.id;
|
||||
} else if (obj.event === 'downloadData') {
|
||||
window.location.href = "/dsBase/dataease/downloadExcelByCity?id=" + obj.data.id;
|
||||
} else {
|
||||
window.location.href = "./dataMod_proxy.html?id=" + obj.data.id
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
@ -0,0 +1,200 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Demo</title>
|
||||
<!-- 请勿在项目正式环境中引用该 layui.css 地址 -->
|
||||
<link href="../js/layui/css/layui.css" rel="stylesheet">
|
||||
<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;
|
||||
}
|
||||
|
||||
.layui-fixbar li {
|
||||
height: 38px;
|
||||
line-height: 38px;
|
||||
border: 1px solid transparent;
|
||||
padding: 0 18px;
|
||||
background-color: #16baaa;
|
||||
color: #fff;
|
||||
white-space: nowrap;
|
||||
text-align: center;
|
||||
font-size: 14px !important;
|
||||
border-radius: 2px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.fix {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 10px;
|
||||
background-color: white;
|
||||
padding: 10px;
|
||||
z-index: 1000;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body class="layui-form">
|
||||
<div class="layui-card" style="margin-top: 50px;">
|
||||
<div class="layui-card-body">
|
||||
<!-- <button type="button" class="layui-btn" id="getData">获取数据</button> -->
|
||||
<div class="fix">
|
||||
<button type="button" class="layui-btn" id="saveData">保存</button>
|
||||
<button type="button" class="layui-btn" id="back">返回</button>
|
||||
</div>
|
||||
<table id="ID-table-demo-data"></table>
|
||||
|
||||
<script type="text/html" id="table-bar">
|
||||
<span class="woo-tool-span woo-tool-text-span" lay-event="add"><a
|
||||
class="woo-theme-color">向下插入</a></span>
|
||||
<span class="woo-tool-span woo-tool-text-span" lay-event="delete"><a
|
||||
class="woo-theme-color">删除</a></span>
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 请勿在项目正式环境中引用该 layui.js 地址 -->
|
||||
<script src="../js/layui/layui.js"></script>
|
||||
<script>
|
||||
layui.use('table', function () {
|
||||
var table = layui.table;
|
||||
var $ = layui.jquery;
|
||||
var util = layui.util;
|
||||
|
||||
var id = GetQueryString("id");
|
||||
|
||||
// var id = "3";
|
||||
|
||||
var _data = [];
|
||||
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
async: false,
|
||||
url: '/dsBase/dataease/getDataSetContentByCity?id=' + id,
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
_data = res.data;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
var _emptyData = {};
|
||||
var _cols = [];
|
||||
let keys = Object.keys(_data[0]);
|
||||
|
||||
keys.forEach((item, index) => {
|
||||
_emptyData[item] = "";
|
||||
var _obj = { field: item, title: item, edit: 'text', align: 'center' }
|
||||
_cols.push(_obj);
|
||||
});
|
||||
_cols.push({ title: '操作', align: 'center', toolbar: '#table-bar' });
|
||||
|
||||
table.render({
|
||||
elem: '#ID-table-demo-data',
|
||||
id: 'ID-table-demo-data',
|
||||
page: false,
|
||||
cols: [_cols],
|
||||
data: _data
|
||||
});
|
||||
|
||||
table.on('tool(ID-table-demo-data)', function (obj) {
|
||||
if (obj.event === 'add') {
|
||||
_data.splice(obj.index + 1, 0, _emptyData);
|
||||
table.cache['ID-table-demo-data'] = _data;
|
||||
table.renderData('ID-table-demo-data');
|
||||
} else {
|
||||
var cacheData = table.cache['ID-table-demo-data'];
|
||||
cacheData.splice(obj.index, 1)
|
||||
table.renderData('ID-table-demo-data');
|
||||
}
|
||||
});
|
||||
|
||||
$("#saveData").click(function () {
|
||||
|
||||
const cleanedData = table.cache['ID-table-demo-data'].map(item => {
|
||||
const { LAY_NUM, LAY_INDEX, ...rest } = item;
|
||||
return rest;
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
async: false,
|
||||
url: '/dsBase/dataease/saveDataSetByCity',
|
||||
data: {
|
||||
"id": id,
|
||||
"data": JSON.stringify(cleanedData)
|
||||
},
|
||||
success: function (res) {
|
||||
if (res.success) {
|
||||
layer.msg("保存成功!", {
|
||||
icon: 1,
|
||||
time: 1300
|
||||
});
|
||||
} else {
|
||||
layer.msg(res.message, {
|
||||
icon: 2,
|
||||
time: 2000
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$("#back").click(function () {
|
||||
history.back();
|
||||
});
|
||||
|
||||
|
||||
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>
|
@ -0,0 +1,133 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title></title>
|
||||
<link href="../js/layui/css/layui.css" rel="stylesheet">
|
||||
<style>
|
||||
.require-star {
|
||||
position: absolute;
|
||||
width: 3px;
|
||||
height: 14px;
|
||||
background-color: #ea4335;
|
||||
top: 12px;
|
||||
right: 8px;
|
||||
border-radius: 1.5px;
|
||||
}
|
||||
|
||||
.input-width {
|
||||
max-width: 455px
|
||||
}
|
||||
|
||||
.mainBox {
|
||||
width: 100%;
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
bottom: 50px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.main-container {
|
||||
margin: 15px;
|
||||
}
|
||||
|
||||
.bottom {
|
||||
width: 100%;
|
||||
position: absolute;
|
||||
bottom: 0px;
|
||||
left: 0px;
|
||||
height: 50px;
|
||||
line-height: 50px;
|
||||
background-color: #F8F8F8;
|
||||
border-top: 1px solid #eee;
|
||||
}
|
||||
|
||||
.button-container {
|
||||
position: absolute;
|
||||
right: 15px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<form class="layui-form" action="">
|
||||
<div class="mainBox">
|
||||
<div class="main-container">
|
||||
<!-- <div class="layui-form-item">
|
||||
<label class="layui-form-label" style="width: auto;"><span class="require-star"></span>文件名称</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="fileName" lay-verify="required" autocomplete="off" placeholder="请输入文件名称"
|
||||
class="layui-input input-width">
|
||||
</div>
|
||||
</div> -->
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label" style="width: auto;"><span
|
||||
class="require-star"></span>上传数据文件</label>
|
||||
<div class="layui-input-block">
|
||||
<button type="button" class="layui-btn layui-btn-normal"
|
||||
id="ID-upload-demo-choose">选择数据文件</button>
|
||||
</div>
|
||||
<!-- <button type="button" class="layui-btn" id="ID-upload-demo-action">开始上传</button> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="bottom">
|
||||
<div class="button-container">
|
||||
<button type="button" class="layui-btn layui-btn-sm" id="ID-upload-demo-action">
|
||||
<i class="layui-icon layui-icon-upload-drag"></i>
|
||||
上传
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<script src="../js/layui/layui.js"></script>
|
||||
|
||||
<script>
|
||||
layui.use(function () {
|
||||
var form = layui.form;
|
||||
var $ = layui.jquery;
|
||||
var laytpl = layui.laytpl;
|
||||
var upload = layui.upload;
|
||||
|
||||
var id = GetQueryString("id");
|
||||
|
||||
upload.render({
|
||||
elem: '#ID-upload-demo-choose',
|
||||
url: '/dsBase/dataease/uploadExcelByCity',
|
||||
data: {
|
||||
id,
|
||||
},
|
||||
accept: "file",
|
||||
exts: "xls|xlsx",
|
||||
auto: false,
|
||||
bindAction: '#ID-upload-demo-action',
|
||||
done: function (res) {
|
||||
layer.msg("上传成功!", {
|
||||
icon: 1,
|
||||
time: 1300
|
||||
}, function () {
|
||||
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
||||
parent.layui.table.reload("data-table");
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
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>
|
||||
<script>
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
Loading…
Reference in new issue