|
|
<!DOCTYPE html>
|
|
|
<html lang="en">
|
|
|
<head>
|
|
|
<meta charset="UTF-8">
|
|
|
<title>首页</title>
|
|
|
<link rel="stylesheet" href="/static/layui/css/layui.css">
|
|
|
</head>
|
|
|
<body>
|
|
|
<div align="center">
|
|
|
<br>
|
|
|
<a href="insert_page">添加数据</a>
|
|
|
<br>
|
|
|
<br>
|
|
|
<table data = 'tabledemo'lay-filter="test">
|
|
|
<thead>
|
|
|
<tr>
|
|
|
<th lay-data="{field:'data', width:100}">时间</th>
|
|
|
<th lay-data="{field:'province', width:100}">省份</th>
|
|
|
<th lay-data="{field:'add_input', width:80, sort:true}">新增输入人数</th>
|
|
|
<th lay-data="{field:'new_confirmed'}">新增确诊</th>
|
|
|
<th lay-data="{field:'total_confirmed'}">累计确诊</th>
|
|
|
<th lay-data="{field:'total_recovery'}">累计治愈</th>
|
|
|
<th lay-data="{fixed: 'right', width: 165, align:'center', toolbar: '#barDemo'}"></th>
|
|
|
</tr>
|
|
|
</thead>
|
|
|
<tbody>
|
|
|
{% for importation in importation_list %}
|
|
|
<tr>
|
|
|
<td>{{ importation.data }}</td>
|
|
|
<td>{{ importation.province }}</td>
|
|
|
<td>{{ importation.add_input }}</td>
|
|
|
<td>{{ importation.new_confirmed }}</td>
|
|
|
<td>{{ importation.total_confirmed }}</td>
|
|
|
<td>{{ importation.total_recovery }}</td>
|
|
|
</tr>
|
|
|
{% endfor %}
|
|
|
</tbody>
|
|
|
</table>
|
|
|
</div>
|
|
|
<script type="text/html" id="barDemo">
|
|
|
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
|
|
|
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
|
|
|
</script>
|
|
|
|
|
|
|
|
|
<script src="/static/layui/layui.js"></script>
|
|
|
<script>
|
|
|
|
|
|
layui.use('table', function () {
|
|
|
var table = layui.table;
|
|
|
|
|
|
//转换静态表格
|
|
|
table.init('test', {
|
|
|
height: 1000,
|
|
|
width: 600//设置高度
|
|
|
,limit:100
|
|
|
});
|
|
|
table.on('tool(test)', function(obj){ //注:tool 是工具条事件名,test 是 table 原始容器的属性 lay-filter="对应的值"
|
|
|
var data = obj.data //获得当前行数据
|
|
|
,layEvent = obj.event; //获得 lay-event 对应的值
|
|
|
if(layEvent === 'detail'){
|
|
|
layer.msg('查看操作');
|
|
|
} else if(layEvent === 'del'){
|
|
|
layer.confirm('真的删除行么', function(index){
|
|
|
location.href='/delete?data='+data.data;
|
|
|
});
|
|
|
} else if(layEvent === 'edit'){
|
|
|
location.href='/alter?data=' + data.data + "&province=" +data.province + "&add_input=" + data.add_input + "&new_confirmed=" + data.new_confirmed+ "&total_confirmed=" + data.total_confirmed+ "&total_recovery=" + data.total_recovery;
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
</script>
|
|
|
</body>
|
|
|
</html> |