anxiao_web/pages/intelligenceEarlyWarning/js/index.js

85 lines
2.4 KiB
JavaScript

import {mapUrl} from "../../../public/js/url.js";
import {getstationcount,stationInfoPageReq} from "../../cmddispatch/js/orgApi/getStationInfo.js";
import { showAiAlarmList } from "./showAiAlarmList.js";
import { showPushbuttonAlarmList } from "./showPushbuttonAlarmList.js";
import { showPoliceAlarm } from "./showPoliceAlarm.js";
import { openAlarmHistory } from "./history.js";
let layuiObj={};
let clockloginInfo=null;
let eventMap=null;
let stationInfoTableList=[];
layui.use(['carousel','table','form','laydate','slider','element'],function() {
layuiObj["layer"] = layui.layer;
layuiObj["carousel"] = layui.carousel;
layuiObj["layuitable"] = layui.table;
layuiObj["rate"] = layui.rate;
layuiObj["layuiForm"] = layui.form;
layuiObj["laydate"] =layui.laydate;
layuiObj["slider"] =layui.slider;
layuiObj["element"] =layui.element;
var loginJson=sessionStorage.getItem("unameInfoStr");
clockloginInfo=JSON.parse(loginJson);
axios.defaults.headers.common['Authorization'] = clockloginInfo["session"];
eventMapInit();
})
async function eventMapInit(){
eventMap = L.map('eventMap',{
center: [28.19,113.03],
zoom: 15,
attributionControl:false,
zoomControl:false,
minZoom :1,
maxZoom :18
});
L.tileLayer(`${mapUrl}/roadmap/{z}/{x}/{y}.png`, {
attribution: ''
}).addTo(eventMap);
//获取学校的信息
var stationcountRes=await getstationcount();
var stationcount=stationcountRes.data.data.count;
var stationlistRes= await stationInfoPageReq(stationcount)
stationlistRes.forEach(item=>{
var data=item.data.data;
for(let i=0;i<data.length;i++){
stationInfoTableList.push(data[i]);
}
})
//获取天网预警的数据
showPoliceAlarm();
addHistoryEvent();
}
function addHistoryEvent(){
$(".historyMore").on('click',function(){
openAlarmHistory();
})
layuiObj.layuiForm.on("radio(earlyWarningRadio)", function (data) {
var value=parseInt(data["value"]);
switch(value){
case 1:
showPoliceAlarm();
break;
case 2:
showPushbuttonAlarmList();
break;
case 3:
break;
case 4:
showAiAlarmList();
break;
}
})
}
export {
eventMap,
layuiObj,
stationInfoTableList
}