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.

78 lines
2.8 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 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"><font color="red"><b><i><u><font size="6">添加情况</font></u></i></b></font></a> <br>
<br>
<table id = 'tabledemo'lay-filter="test">
<thead>
<tr>
<th lay-data="{field:'donor_code', width:100}">捐赠方代码</th>
<th lay-data="{field:'donor_name', width:100}">捐赠方名字</th>
<th lay-data="{field:'type1', width:100}">捐赠方类型</th>
<th lay-data="{field:'ded_code', width:100}">被赠方代码</th>
<th lay-data="{field:'ded_name', width:100}">被赠方名字</th>
<th lay-data="{field:'amount', width:100}">金额</th>
<th lay-data="{field:'date', width:100}">日期</th>
<th lay-data="{field:'trans', width:100}">物流</th>
<th lay-data="{fixed: 'right', width: 165, align:'center', toolbar: '#barDemo'}"></th>
</tr>
</thead>
<tbody>
{% for item in donor_list %}
<tr>
<td>{{ item.donor_code }}</td>
<td>{{ item.donor_name }}</td>
<td>{{ item.type1 }}</td>
<td>{{ item.ded_code }}</td>
<td>{{ item.ded_name }}</td>
<td>{{ item.amount }}</td>
<td>{{ item.date }}</td>
<td>{{ item.trans }}</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: 1500//设置高度
,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?id='+data.id; });
} else if(layEvent === 'edit'){
location.href='/alter?id=' + data.id + "&donor_code=" +data.donor_code + "&donor_name=" + data.donor_name + "&type=" + data.type+ "&ded_name=" + data.ded_name+ "&ded_code=" +data.ded_code+ "&amount=" +data.amount+ "&trans=" +data.trans;
}
});
});
</script>
</body>
</html>