154 lines
7.2 KiB
JavaScript
154 lines
7.2 KiB
JavaScript
|
|
var example = null;
|
|||
|
|
var pers = null;
|
|||
|
|
var layer;
|
|||
|
|
var table;
|
|||
|
|
//var subName = localStorage.getItem("subName");
|
|||
|
|
$(function () {
|
|||
|
|
layui.use(['layer','form','table'], function () {
|
|||
|
|
layer = layui.layer;
|
|||
|
|
table = layui.table;
|
|||
|
|
var form = layui.form;
|
|||
|
|
|
|||
|
|
init();
|
|||
|
|
});
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
function init() {
|
|||
|
|
// 已知数据渲染
|
|||
|
|
table.render({
|
|||
|
|
elem: '#layuiTable',
|
|||
|
|
cols: [[ //标题栏
|
|||
|
|
{ field: 'ID', title: '序号',width:'5%', sort: true, type:'numbers'},
|
|||
|
|
{ field: 'alarmType', title: '告警类型', width: '19%', align:'center'},
|
|||
|
|
{ field: 'deviceName', title: '设备名称', width: '19%', align:'center'},
|
|||
|
|
{ field: 'devicePosition', title: '设备位置', width: '19%', align:'center'},
|
|||
|
|
{ field: 'alarmContent', title: '报警内容', width: '19%', align:'center'},
|
|||
|
|
{ field: 'alarmTime', title: '报警时间', width: '19%', align:'center'},
|
|||
|
|
]],
|
|||
|
|
data: [
|
|||
|
|
{"alarmType": "10001","deviceName": "张三1","devicePosition": "男","alarmContent": "浙江杭州","alarmTime": "浙江杭州"},
|
|||
|
|
{"alarmType": "10002","deviceName": "张三1","devicePosition": "男","alarmContent": "浙江杭州","alarmTime": "浙江杭州"},
|
|||
|
|
{"alarmType": "10003","deviceName": "张三1","devicePosition": "男","alarmContent": "浙江杭州","alarmTime": "浙江杭州"},
|
|||
|
|
{"alarmType": "10004","deviceName": "张三1","devicePosition": "男","alarmContent": "浙江杭州","alarmTime": "浙江杭州"},
|
|||
|
|
{"alarmType": "10005","deviceName": "张三1","devicePosition": "男","alarmContent": "浙江杭州","alarmTime": "浙江杭州"},
|
|||
|
|
{"alarmType": "10006","deviceName": "张三1","devicePosition": "男","alarmContent": "浙江杭州","alarmTime": "浙江杭州"},
|
|||
|
|
{"alarmType": "10007","deviceName": "张三1","devicePosition": "男","alarmContent": "浙江杭州","alarmTime": "浙江杭州"},
|
|||
|
|
{"alarmType": "10008","deviceName": "张三1","devicePosition": "男","alarmContent": "浙江杭州","alarmTime": "浙江杭州"},
|
|||
|
|
{"alarmType": "10009","deviceName": "张三1","devicePosition": "男","alarmContent": "浙江杭州","alarmTime": "浙江杭州"},
|
|||
|
|
{"alarmType": "10010","deviceName": "张三1","devicePosition": "男","alarmContent": "浙江杭州","alarmTime": "浙江杭州"},
|
|||
|
|
{"alarmType": "10011","deviceName": "张三1","devicePosition": "男","alarmContent": "浙江杭州","alarmTime": "浙江杭州"},
|
|||
|
|
{"alarmType": "10012","deviceName": "张三1","devicePosition": "男","alarmContent": "浙江杭州","alarmTime": "浙江杭州"},
|
|||
|
|
{"alarmType": "10013","deviceName": "张三1","devicePosition": "男","alarmContent": "浙江杭州","alarmTime": "浙江杭州"},
|
|||
|
|
{"alarmType": "10014","deviceName": "张三1","devicePosition": "男","alarmContent": "浙江杭州","alarmTime": "浙江杭州"},
|
|||
|
|
{"alarmType": "10015","deviceName": "张三1","devicePosition": "男","alarmContent": "浙江杭州","alarmTime": "浙江杭州"},
|
|||
|
|
{"alarmType": "10016","deviceName": "张三1","devicePosition": "男","alarmContent": "浙江杭州","alarmTime": "浙江杭州"},
|
|||
|
|
{"alarmType": "10017","deviceName": "张三1","devicePosition": "男","alarmContent": "浙江杭州","alarmTime": "浙江杭州"},
|
|||
|
|
{"alarmType": "10018","deviceName": "张三1","devicePosition": "男","alarmContent": "浙江杭州","alarmTime": "浙江杭州"},
|
|||
|
|
{"alarmType": "10019","deviceName": "张三1","devicePosition": "男","alarmContent": "浙江杭州","alarmTime": "浙江杭州"},
|
|||
|
|
{"alarmType": "10020","deviceName": "张三1","devicePosition": "男","alarmContent": "浙江杭州","alarmTime": "浙江杭州"},
|
|||
|
|
],
|
|||
|
|
id: 'testReload',
|
|||
|
|
height: 600,
|
|||
|
|
//skin: 'line', // 表格风格
|
|||
|
|
//even: true,
|
|||
|
|
page: true, // 是否显示分页
|
|||
|
|
limits: [50, 100, 200],
|
|||
|
|
limit: 10 // 每页默认显示的数量
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
/*table.render({
|
|||
|
|
elem: '#layuiTable'
|
|||
|
|
,url: ctxPath + "/acceptManage/getCheckAcceptList?keyWord="+keyWord+"&startDate="+startDate+"&endDate="+endDate
|
|||
|
|
,method:'post'
|
|||
|
|
,cols: [[
|
|||
|
|
{ field: 'ID', title: '序号',width:'5%', sort: true, type:'numbers'}
|
|||
|
|
, { field: 'orderDate',width:'8%', title: '时间',align:'center'}
|
|||
|
|
, { field: 'departName',width:'8%', title: '部门',align:'center'}
|
|||
|
|
, { field: 'orderId',width:'13%', title: '订单编号',align:'center'}
|
|||
|
|
, { field: 'empName',width:'8%', title: '员工',align:'center'}
|
|||
|
|
, { field: 'money',width:'5%', title: '金额',align:'center'}
|
|||
|
|
, { field: 'invoiceNumber',width:'15%', title: '发票号',align:'center'}
|
|||
|
|
, { field: 'remark',width:'18%', title: '备注',align:'center'}
|
|||
|
|
, {
|
|||
|
|
width:'10%'
|
|||
|
|
,title: '订单照片'
|
|||
|
|
,align:'center'
|
|||
|
|
,templet:function (d) {
|
|||
|
|
var fileNumber = d.fileNumber
|
|||
|
|
var id = d.id
|
|||
|
|
return '<div style="cursor: pointer;color: #0093FF" onclick="imgShow(' + id + ')">' + fileNumber + '</div>'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
// , { field: 'filePath',width:10, title: '照片路径',align:'center',hide:true}
|
|||
|
|
|
|||
|
|
, {field:'right',width: '10%', title: '操作',toolbar:"#barDemo",align:'center'}
|
|||
|
|
]]
|
|||
|
|
,limits: [5,10,20,50] //一页选择显示3,5或10条数据
|
|||
|
|
, limit: 10 //一页显示5条数据
|
|||
|
|
, response: {
|
|||
|
|
statusCode: 200 //规定成功的状态码,默认:0
|
|||
|
|
}
|
|||
|
|
, parseData: function (res) { //将原始数据解析成 table 组件所规定的数据,res为从url中get到的数据
|
|||
|
|
let result;
|
|||
|
|
if (res.count > 0) {
|
|||
|
|
if (this.page.curr) {
|
|||
|
|
result = res.data.slice(this.limit * (this.page.curr - 1), this.limit * this.page.curr);
|
|||
|
|
} else {
|
|||
|
|
result = res.data.slice(0, this.limit);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
return {
|
|||
|
|
"code": res.code, //解析接口状态
|
|||
|
|
"msg": res.msg, //解析提示文本
|
|||
|
|
"count": res.count, //解析数据长度
|
|||
|
|
"data": result //解析数据列表
|
|||
|
|
};
|
|||
|
|
}
|
|||
|
|
,id: 'testReload'
|
|||
|
|
,page: true //开启分页
|
|||
|
|
,height: 700
|
|||
|
|
});
|
|||
|
|
table.on('tool(contact)', function(obj){
|
|||
|
|
var data = obj.data;
|
|||
|
|
if(obj.event === 'del'){
|
|||
|
|
del(data.id);
|
|||
|
|
} else if(obj.event === 'edit'){
|
|||
|
|
edit(data.id);
|
|||
|
|
}
|
|||
|
|
});*/
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//获取工程集合
|
|||
|
|
/*function getProSelect(){
|
|||
|
|
$("#proId").empty();
|
|||
|
|
$.ajax({
|
|||
|
|
type: 'POST',
|
|||
|
|
url: dataUrl + 'select/getProSelectData',
|
|||
|
|
data: {},
|
|||
|
|
dataType: "json",
|
|||
|
|
async: false,
|
|||
|
|
success: function(data) {
|
|||
|
|
var html="";
|
|||
|
|
html += '<option value="">请选择工程</option>';
|
|||
|
|
for(var i=0;i<data.length;i++){
|
|||
|
|
html += '<option value="' + data[i].id + '">' + data[i].name + '</option>';
|
|||
|
|
}
|
|||
|
|
$("#proId").append(html);
|
|||
|
|
layui.form.render();
|
|||
|
|
},
|
|||
|
|
error:function(data){
|
|||
|
|
var html='<option value="">请选择工程</option>';
|
|||
|
|
$("#proId").append(html);
|
|||
|
|
layui.form.render();
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
};
|
|||
|
|
*/
|
|||
|
|
//设置弹窗关闭
|
|||
|
|
/*function reloading() {
|
|||
|
|
var index = parent.layer.getFrameIndex(window.name); //先得到当前 iframe层的索引
|
|||
|
|
parent.layer.close(index); //再执行关闭
|
|||
|
|
window.parent.location.reload();
|
|||
|
|
}*/
|