parent
fad7e04389
commit
c09796316b
@ -0,0 +1,61 @@
|
||||
<!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="//unpkg.com/layui@2.9.9/dist/css/layui.css" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<table class="layui-hide" id="ID-table-demo-filter"></table>
|
||||
|
||||
<!-- 请勿在项目正式环境中引用该 layui.js 地址 -->
|
||||
<script src="//unpkg.com/layui@2.9.9/dist/layui.js"></script>
|
||||
<script>
|
||||
layui.use(function(){
|
||||
var $ = layui.$;
|
||||
var table = layui.table;
|
||||
// 渲染
|
||||
table.render({
|
||||
elem: '#ID-table-demo-filter',
|
||||
url:'/static/json/2/table/user.json', // 此处为静态模拟数据,实际使用时需换成真实接口
|
||||
// toolbar: 'default',
|
||||
height: 315,
|
||||
cols: [function(){
|
||||
var arr = [
|
||||
{field:'id', title:'ID', width:80, fixed: 'left'},
|
||||
{field:'username', title:'用户', width:120},
|
||||
{field:'sex', title:'性别'},
|
||||
{field:'city', title:'城市'},
|
||||
{field:'sign', title:'签名'},
|
||||
{field:'classify', title:'职业'}
|
||||
];
|
||||
|
||||
// 初始化筛选状态
|
||||
var local = layui.data('table-filter-test'); // 获取对应的本地记录
|
||||
layui.each(arr, function(index, item){
|
||||
if(item.field in local){
|
||||
item.hide = local[item.field];
|
||||
}
|
||||
});
|
||||
return arr;
|
||||
}() ],
|
||||
done: function(){
|
||||
// 记录筛选状态
|
||||
var that = this;
|
||||
that.elem.next().on('mousedown', 'input[lay-filter="LAY_TABLE_TOOL_COLS"]+', function(){
|
||||
var input = $(this).prev()[0];
|
||||
// 此处表名可任意定义
|
||||
layui.data('table-filter-test', {
|
||||
key: input.name
|
||||
,value: input.checked
|
||||
})
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,168 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title></title>
|
||||
<link rel="stylesheet" href="../../../component/layui/css/layui.css" />
|
||||
<link rel="stylesheet" href="../../../component/pear/css/module/toast.css" />
|
||||
|
||||
<style>
|
||||
th {
|
||||
color: #303133;
|
||||
background-color: #f5f7fa;
|
||||
}
|
||||
|
||||
.layui-card {
|
||||
box-shadow: 0 0 0 0 rgba(0, 0, 0, 0) !important;
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
|
||||
.layui-form-item {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.layui-table td,
|
||||
.layui-table th {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.bp {
|
||||
background-color: rgba(23, 179, 163, .1);
|
||||
padding: 5px 10px;
|
||||
height: 32px;
|
||||
line-height: 30px;
|
||||
font-size: 12px;
|
||||
color: #17b3a3;
|
||||
border-radius: 4px;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
border: 1px solid rgba(23, 179, 163, .2);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.xp {
|
||||
background-color: rgba(144, 147, 153, .1);
|
||||
padding: 5px 10px;
|
||||
height: 32px;
|
||||
line-height: 30px;
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
border-radius: 4px;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
border: 1px solid rgba(144, 147, 153, .2);
|
||||
white-space: nowrap;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body class="layui-form">
|
||||
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body">
|
||||
<!-- <div class="layui-form-item layui-inline">
|
||||
<button class="layui-btn layui-btn-sm" lay-submit lay-filter="user-query">
|
||||
<i class="layui-icon layui-icon-search"></i>
|
||||
查询
|
||||
</button>
|
||||
</div> -->
|
||||
|
||||
<table class="layui-table" id="myTable"></table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script src="../../../component/layui/layui.js"></script>
|
||||
<script src="../../../component/pear/xm-select.js"></script>
|
||||
|
||||
<script>
|
||||
layui.extend({
|
||||
toast: '../../../component/pear/module/toast' // {/}的意思即代表采用自有路径,即不跟随 base 路径
|
||||
}).use(['toast'], function () {
|
||||
var $ = layui.jquery;
|
||||
var table = layui.table;
|
||||
var form = layui.form;
|
||||
|
||||
|
||||
|
||||
table.render({
|
||||
elem: '#myTable',
|
||||
id: 'test',
|
||||
url: '/QingLong/zbdc/getSummaryCgzb',
|
||||
cellExpandedMode: "tips",
|
||||
height: 'full-35',
|
||||
cols: [
|
||||
[
|
||||
{ title: '序号', align: 'center', width: "60", type: 'numbers', rowspan: 2 },
|
||||
{ title: '行政区域', field: 'area_name', align: 'center', width: "190", rowspan: 2 },
|
||||
|
||||
|
||||
{ title: '基础环境', align: 'center', colspan: 4 },
|
||||
{ title: '数字终端', align: 'center', colspan: 7 },
|
||||
{ title: '数字化教学空间', align: 'center', colspan: 7 },
|
||||
{ title: '文化生活空间', align: 'center', colspan: 4 },
|
||||
{ title: '网络安全', align: 'center', colspan: 1 },
|
||||
],
|
||||
[
|
||||
//基础环境
|
||||
{ title: '设备总数', field: 'wl_cgss', align: 'center', width: "100" },
|
||||
{ title: '网络环境设备(台)', field: 'wl_tjss', align: 'center', width: "125" },
|
||||
{ title: '存储容量设备(台)', field: 'wl_yqsss', align: 'center', width: "125" },
|
||||
{ title: '校园安全监控设备(台)', field: 'wl_pbl', align: 'center', width: "155" },
|
||||
//数字终端
|
||||
{ title: '设备总数', field: 'hx_cgss', align: 'center', width: "100" },
|
||||
{ title: '正常使用(台)', field: 'hx_tjss', align: 'center', width: "115" },
|
||||
{ title: '学生计算机教室设(台)', field: 'hx_yqsss', align: 'center', width: "155" },
|
||||
{ title: '智慧教室设备(台)', field: 'hx_pbl', align: 'center', width: "125" },
|
||||
{ title: '电子图书阅览室设备(台)', field: 'hx_pbl', align: 'center', width: "160" },
|
||||
{ title: '教师用计算机(台)', field: 'hx_pbl', align: 'center', width: "125" },
|
||||
{ title: '电子备课室设备(台)', field: 'hx_pbl', align: 'center', width: "135" },
|
||||
//数字化教学空间
|
||||
{ title: '设备总数', field: 'hx_cgss', align: 'center', width: "100" },
|
||||
{ title: '多媒体教室设备(台)', field: 'hx_tjss', align: 'center', width: "135" },
|
||||
{ title: '多功能教室设备(台)', field: 'hx_yqsss', align: 'center', width: "135" },
|
||||
{ title: '竞品录播教室设备(台)', field: 'hx_pbl', align: 'center', width: "155" },
|
||||
{ title: '常态化录播教室设备(台)', field: 'hx_pbl', align: 'center', width: "160" },
|
||||
{ title: '语音系统设备(台)', field: 'hx_pbl', align: 'center', width: "125" },
|
||||
{ title: '创新类活动室设备(台)', field: 'hx_pbl', align: 'center', width: "155" },
|
||||
//文化生活空间
|
||||
{ title: '设备总数', field: 'hx_cgss', align: 'center', width: "100" },
|
||||
{ title: '校园广播设备(台)', field: 'hx_cgss', align: 'center', width: "125" },
|
||||
{ title: '虚拟演播室设备(台)', field: 'hx_cgss', align: 'center', width: "135" },
|
||||
{ title: '校园电视系统设备(台)', field: 'hx_cgss', align: 'center', width: "155" },
|
||||
//网络安全
|
||||
{ title: '互联网带宽(MB)', field: 'hx_cgss', align: 'center', width: "125" },
|
||||
|
||||
|
||||
|
||||
]
|
||||
],
|
||||
// skin: 'line',
|
||||
// defaultToolbar: []
|
||||
|
||||
});
|
||||
|
||||
form.on('submit(user-query)', function () {
|
||||
|
||||
table.exportFile([[['a','b'], '性别', '年龄']], [
|
||||
['张三', '男', '20'],
|
||||
['李四', '女', '18'],
|
||||
['王五', '女', '19']
|
||||
], {
|
||||
type: 'csv', // 导出的文件格式,支持: csv,xls
|
||||
title: '导出的文件标题'
|
||||
});
|
||||
|
||||
// 阻止表单的默认提交行为
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
Loading…
Reference in new issue