hb_zhgd_screen/js/pages/newDataAnalysis/environmentalReadings.js

56 lines
1.9 KiB
JavaScript

let table, layer, form;
let myChart = null, myChart2 = null;
layui.use(['layer', 'table', 'form'], function () {
layer = layui.layer;
table = layui.table;
form = layui.form;
let bidCode = parent.parent.parent.$('#bidPro').val()
initTable(bidCode,"");
});
function initTable(bidCode,name) {
const url = commonUrl + "screen/largeScreen/engineeringSafetyAnalysis/getEnvironmentalList";
table.render({
elem: '#demo2',
url: url,
id: 'demo2',
skin: 'line',
page: true,
headers: {
"decrypt": "decrypt",
"Authorization": token
},
where: {
bidCode: bidCode,
name:name
},
cols: [[
{ type: 'numbers', title: '序号', width: '10%' }, // 添加序号列
{ field: 'id', title: '监测点编号', align: 'center' },
{ field: 'date', title: '环境数据记录日期', align: 'center' },
{ field: 'temperature', title: '当前温度', align: 'center' },
{ field: 'humidity', title: '当前湿度', align: 'center'},
{ field: 'windSpeed', title: '当前风速', align: 'center'},
{ field: 'gasValue', title: '当前气体值', align: 'center'},
]],
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);
}
})
}
function query(type) {
let name = $('#name').val();
let bidCode = parent.parent.parent.$('#bidPro').val()
initTable(bidCode,name);
}