ah_jjzhgd_webscreen/js/pages/video/moreData.js

56 lines
2.0 KiB
JavaScript

let form, laydate, layer, table;
let objParams = {};
function setParams(obj) {
objParams = JSON.parse(obj);
layui.use(["form", 'layer', 'table', 'laydate'], function () {
form = layui.form;
layer = layui.layer;
table = layui.table;
laydate = layui.laydate;
layui.form.render();
laydate.render({
elem: '#ID-laydate-rangeLinked',
range: ['#startDate', '#endDate'],
rangeLinked: true // 开启日期范围选择时的区间联动标注模式 --- 2.8+ 新增
});
$('#startDate').val(getNowTime());
$('#endDate').val(getNowTime());
initTable(parent.$('#bidPro').val());
});
}
function initTable(bidCode) {
const url = commonUrl + "screen/largeScreen/dataAnalysis/getListByType";
table.render({
elem: '#demo2',
url: url,
skin: 'line',
page: true,
height: 'full-200',
headers: {
"decrypt": "decrypt",
"Authorization": token
},
where: {
bidCode: bidCode,
},
cols: [[
{ type: 'numbers', title: '序号', width: '10%' }, // 添加序号列
{ field: 'date', title: '日期', align: 'center', width: '20%' },
{ field: 'warnContent', title: '预警内容', align: 'center', width: '20%' },
{ field: 'photo', title: '照片', align: 'center', width: '25%' },
{ field: 'status', title: '状态', align: 'center', width: '25%' }
]],
initComplete: function () {
// 在表格渲染完成后,重新渲染序号列
var that = this.elem.next();
var tool = that.children('.layui-table-box').children('.layui-table-fixed').children('.layui-table-body').children('.layui-table');
tool.find("tr").each(function (index, item) {
$(this).find('td[data-field="LAY_TABLE_INDEX"]').text(index + 1);
});
},
done: function (res, curr, count, origin) {
// console.log(res);
}
})
}