let element, layer, table; const bidCode = parent.$("#bidPro").val(); var alarmTableIns; let weatherArray = []; let weatherIconArray = []; let temperatureArray = []; let timeArray = []; layui.use(["layer", "element", "table"], function () { element = layui.element; layer = layui.layer; table = layui.table; // 响应成功后的拦截器 $.ajaxSetup({ beforeSend: function (xhr, options) { var originalSuccess = options.success; options.success = function (data, textStatus, jqXhr) { data = modifyResponseData(data); // success(data,textStatus, jqXhr); originalSuccess.apply(this, arguments); }; }, }); //边坡位移监测列表 DaylightDisplacementList(""); DaylightDisplacementApi(); //和风天气API调用 // zephyrineWeather(); //有限空间 LimitedSpaceApi(); //GPS安装检测 GPSInstallationApi(); //实时监测 realTimeMonitoring(); // 智慧手环-table loadZhshTable(); }); //实时监测 function realTimeMonitoring() { const url = commonUrl + "screen/largeScreen/operatingEnvironment/RealTimeMonitoring"; const params = { bidCode: bidCode, roleCode: roleCode, orgId: orgId, userId: userId, }; let encryptStr = encryptCBC(JSON.stringify(params)); ajaxRequest( url, "POST", encryptStr, true, function () {}, function (result) { if (result.code === 200) { setData(result.data); } else if (result.code === 500) { console.error("实时监测" + result.msg); setData(null); } else if (result.code === 401) { loginout(1); } }, function (xhr, status, error) { error(xhr, status, error); setData(null); }, "application/json", aqEnnable ); /* 实时检测赋值 */ function setData(data) { if (data && data.length > 0) { $.each(data, function (index, item) { var itemHtml = ""; if (item.isWarn == "0") { itemHtml = `
${item.val}${item.unit}
${item.dataType}
${item.val}${item.unit}
${item.dataType}
' +
"" + item.deviceName + "
" + "
' +
"" + item.deviceName + "
" + "' + item.val + "" + item.unit + "
" + item.modeName + "
"; $("#yxkjId").append(div); }); } } else if (result.code === 500) { layer.msg(result.msg, { icon: 2 }); } else if (result.code === 401) { loginout(1); } }, function (xhr, status, error) { error(xhr, status, error); }, "application/json", aqEnnable ); } //GPS安装检测 function GPSInstallationApi() { const url = commonUrl + "screen/largeScreen/operatingEnvironment/getGPSInstallation"; const params = { roleCode: roleCode, orgId: orgId, userId: userId, bidCode: bidCode, deviceType: "1910", }; let encryptStr = encryptCBC(JSON.stringify(params)); ajaxRequest( url, "POST", encryptStr, true, function () {}, function (result) { console.log(result); if (result.code === 200) { GPSInstallation(result.data); } else if (result.code === 500) { layer.msg(result.msg, { icon: 2 }); } else if (result.code === 401) { loginout(1); } }, function (xhr, status, error) { error(xhr, status, error); }, "application/json", aqEnnable ); } function GPSInstallation(environmentData) { let html = ""; $.each(environmentData, function (index, item) { if (index === 0) { GPSInstallationEnvironmentApi(item.deviceId); } html += '
' +
"" + item.deviceName + "
" + "' + item.val + "" + item.unit + "
" + "" + item.modeName + "
" + " "; $("#gisId").append(gisDiv); }); } } else if (result.code === 500) { layer.msg(result.msg, { icon: 2 }); } else if (result.code === 401) { loginout(1); } }, function (xhr, status, error) { error(xhr, status, error); }, "application/json", aqEnnable ); } /* 智慧手环-table */ function loadZhshTable() { const url = commonUrl + "screen/largeScreen/operatingEnvironment/getUserShList"; alarmTableIns = table.render({ elem: "#zhsh-table", url: url, height: "#zhsh-table-box-20", // skin: 'line', // height: 'full', headers: { decrypt: "decrypt", Authorization: token, }, where: { roleCode: roleCode, orgId: orgId, userId: userId, bidCode: bidCode, }, cols: [ [ { field: "number", width: "5%", title: "序号", align: "center", type: "numbers", fixed: "left", }, { field: "deviceName", title: "设备名称", width: "25%" }, { field: "userName", title: "姓名", width: "20%" }, { field: "xl", title: "心率", width: "15%" }, { field: "xy", title: "血压", width: "20%" }, { field: "wd", title: "温度", width: "15%" }, ], ], 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); }, page: true, //开启分页 loading: true, //数据加载中。。。 limits: [5, 10, 20, 100], limit: 5, }); }