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.
79 lines
2.2 KiB
79 lines
2.2 KiB
3 months ago
|
<!DOCTYPE html>
|
||
|
<html>
|
||
|
<head>
|
||
|
<meta charset="utf-8">
|
||
|
<title>Layui</title>
|
||
|
<meta name="renderer" content="webkit">
|
||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||
|
<link rel="stylesheet" href="../layui/css/layui.css" media="all">
|
||
|
|
||
|
</head>
|
||
|
<body>
|
||
|
|
||
|
<table class="layui-hide" id="demo" lay-filter="demo"></table>
|
||
|
|
||
|
<script defer="defer" type="text/javascript" src="./js/jquery_3.3.1.min.js"></script>
|
||
|
<script src="../layui/layui.js" charset="utf-8"></script>
|
||
|
|
||
|
<script type="text/html" id="barDemo">
|
||
|
<a class="layui-btn layui-btn-xs" lay-event="edit">定位</a>
|
||
|
</script>
|
||
|
|
||
|
<script>
|
||
|
var data = parent._nullDataElementArr;
|
||
|
console.log(parent._nullDataElementArr);
|
||
|
var colsData=[];
|
||
|
for(var item of data){
|
||
|
colsData.push({
|
||
|
"id": item.split("#")[0],
|
||
|
"name": item.split("#")[1],
|
||
|
"type":"未填写"
|
||
|
});
|
||
|
}
|
||
|
layui.use('table', function(){
|
||
|
var table = layui.table;
|
||
|
|
||
|
//展示已知数据
|
||
|
table.render({
|
||
|
elem: '#demo'
|
||
|
,cols: [[ //标题栏
|
||
|
{field: 'id', title: 'ID', width: '15%', sort: true}
|
||
|
,{field: 'name', title: '元素名称', width: '50%'}
|
||
|
,{field: 'type', title: '质控类别', width: '20%'}
|
||
|
,{fixed: 'right', title:'操作', toolbar: '#barDemo', width:'15%'}
|
||
|
]]
|
||
|
,data: colsData
|
||
|
|
||
|
//,skin: 'line' //表格风格
|
||
|
,even: true
|
||
|
,limit: 6 //每页默认显示的数量
|
||
|
,page: { //支持传入 laypage 组件的所有参数(某些参数除外,如:jump/elem) - 详见文档
|
||
|
layout: ['limit', 'count', 'prev', 'page', 'next', 'skip'] //自定义分页布局
|
||
|
//,curr: 5 //设定初始在第 5 页
|
||
|
,groups: 1 //只显示 1 个连续页码
|
||
|
,first: false //不显示首页
|
||
|
,last: false //不显示尾页
|
||
|
}
|
||
|
});
|
||
|
//监听工具条
|
||
|
table.on('tool(demo)', function(obj){
|
||
|
var data = obj.data;
|
||
|
if(obj.event === 'edit'){
|
||
|
|
||
|
parent.layer.closeAll(); //再执行关闭
|
||
|
parent.traverseElementByIndex(data.id);
|
||
|
console.log("弹出页面关闭");
|
||
|
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
function callbackdata(){
|
||
|
|
||
|
}
|
||
|
|
||
|
</script>
|
||
|
|
||
|
|
||
|
</body>
|
||
|
</html>
|