anxiao_web/pages/cmddispatch/js/pageEventTool.js

228 lines
7.4 KiB
JavaScript

import {loginInfo,layuiObj} from "./index.js";
import { mainMap } from "./index.js";
import {deleteSkynetIpcMarker,drawSkynetIpcMarker} from "./marker/skynetIpcMarker.js"
import { openAlarmHistory } from "./eventHistory.js";
import {
drawSchoolMarker,
deleteSchoolMarker_y,
deleteSchoolMarker_x,
deleteSchoolMarker_z,
addSchoolMarker_y,
addSchoolMarker_x,
addSchoolMarker_z,
} from "./marker/schoolMarker.js"
import { drawMoveDeviceMarker,deleteAllMoveDeviceMarker } from "./marker/moveDeviceMarker.js";
import { drawPushButtonMarker,deletePushButtonMarker } from "./marker/pushButtonMarker.js";
//跳转页面
$(".videoShow").on('click',function(){
window.open(`./pages/video/index.html?session=${loginInfo["session"]}`)
})
function updateMarkerTitleState(that,name){
var state=$(that).attr("state");
if(state=="open"){
$(that).attr("state","close");
$(that).children("img:nth-child(1)").attr("src","./pages/cmddispatch/image/checkbox1.png");
if(name=="all"){
$(that).siblings("p").children("img:nth-child(1)").attr("src","./pages/cmddispatch/image/checkbox1.png");
$(that).siblings("p").attr("state","close");
}
}else{
$(that).attr("state","open");
$(that).children("img:nth-child(1)").attr("src","./pages/cmddispatch/image/checkbox2.png");
if(name=="all"){
$(that).siblings("p").children("img:nth-child(1)").attr("src","./pages/cmddispatch/image/checkbox2.png");
$(that).siblings("p").attr("state","open");
}
}
}
//查询报警
$(".cmdEventSelect").on('click',function(){
openAlarmHistory();
})
//过滤marker
$(".markerDetail>p").on('click',function(){
var name=$(this).attr("name");
var state=$(this).attr("state");
updateMarkerTitleState(this,name);
switch(name){
case "all":
if(state=="open"){
deleteSchoolMarker_y();
deleteSchoolMarker_x();
deleteSchoolMarker_z();
deleteSkynetIpcMarker();
deleteAllMoveDeviceMarker();
deletePushButtonMarker();
}else{
drawSchoolMarker()
drawSkynetIpcMarker()
drawMoveDeviceMarker();
drawPushButtonMarker();
}
break;
case "school_z":
if(state=="open"){
deleteSchoolMarker_z();
}else{
addSchoolMarker_z();
}
break;
case "school_x":
if(state=="open"){
deleteSchoolMarker_x();
}else{
addSchoolMarker_x();
}
break;
case "school_y":
if(state=="open"){
deleteSchoolMarker_y();
}else{
addSchoolMarker_y();
}
break;
case "ipc":
if(state=="open"){
deleteSkynetIpcMarker();
}else{
drawSkynetIpcMarker();
}
break;
case "staff"://保安
if(state=="open"){
deleteAllMoveDeviceMarker();
}else{
drawMoveDeviceMarker();
}
break;
case "pushbutton"://报警器
if(state=="open"){
deletePushButtonMarker();
}else{
drawPushButtonMarker();
}
default:
break;
}
})
//左侧显示与隐藏
$(".leftSlide").on('click', function () {
var state = $(this).attr("state");
var mainLeftW = 300;
var mainCenterW = parseFloat($(".mainContentC").css("width"));
if (state == "open") {//显示
$(this).attr("state", "close")
mainCenterW += mainLeftW + 5;
$(".mainContentL").css("display", "none")
$(".mainContentC").css("marginLeft", "0");
var src = "./pages/cmddispatch/image/rightSlideImg.png";
$(".mainContentC").css("left", "0");
} else {
$(this).attr("state", "open")
mainCenterW -= mainLeftW + 5;
$(".mainContentL").css("display", "block")
$(".mainContentC").css("marginLeft", "5px");
var src = "pages/cmddispatch/image/leftSlideImg.png";
$(".mainContentC").css("left", "360px");
}
setMainContentCsize(this,src,mainCenterW)
})
//右侧显示与隐藏
$(".rightSlide").on('click', function () {
var state = $(this).attr("state");
var mainRightW = 467;
var mainCenterW = parseFloat($(".mainContentC").css("width"));
if (state == "open") {//显示
$(this).attr("state", "close")
mainCenterW += mainRightW + 5;
$(".mainContentR").css("display", "none");
$(".mainContentC").css("marginRight", "0");
var src = "pages/cmddispatch/image/leftSlideImg.png";
} else {
$(this).attr("state", "open")
mainCenterW -= mainRightW + 5;
$(".mainContentR").css("display", "block");
$(".mainContentC").css("marginRight", "5px");
var src = "pages/cmddispatch/image/rightSlideImg.png";
}
setMainContentCsize(this,src,mainCenterW)
})
function setMainContentCsize(that,src,mainCenterW){
$(that).children("img").attr("src", src)
$(".mainContentC").css("width", mainCenterW + "px");
mainMap.invalidateSize(true)//动态改变以后,平移地图
//让表格自适应
layuiObj["layuitable"].resize();
}
//报警以后自动打开右侧菜单,如果右侧菜单关闭,自动打开
function autoOpenRightSlide(){
var state=$(".rightSlide").attr("state");
var mainRightW = 467;
var mainCenterW = parseFloat($(".mainContentC").css("width"));
if(state=="close"){
$(".rightSlide").attr("state","open");
mainCenterW -= mainRightW + 5;
$(".mainContentR").css("display", "block");
$(".mainContentC").css("marginRight", "5px");
var src = "pages/cmddispatch/image/rightSlideImg.png";
$(".rightSlide").children("img").attr("src", src)
$(".mainContentC").css("width", mainCenterW + "px");
mainMap.invalidateSize(true)
//让表格自适应
layuiObj["layuitable"].resize();
}
}
//底部的显示与隐藏
$(".mainCenterBottomList>div").on('click', function () {
var state = $(this).attr("state");
var mCenterHeight = parseFloat($(".mainContentC").css("height"));
if (state == "open") {//显示
$(".mainCbContent").css("display", "none")
$(this).children("p").children('span').html("显示");
$(this).children("p").children('img').attr("src", "./pages/cmddispatch/image/mainCenterOpen.png");
$(this).attr("state", "close");
var mCenterTopHeight = mCenterHeight - 40;
$(".mainContentC_b").css("height", "35px");
} else {//关闭
$(".mainCbContent").css("display", "block")
$(".mainContentC_b_t").css("borderBottom", "1px solid #3477B9")
$(this).children("p").children('span').html("隐藏");
$(this).children("p").children('img').attr("src", "./pages/cmddispatch/image/mainCenterClose.png");
$(this).attr("state", "open");
var mCenterTopHeight = mCenterHeight - 185;
$(".mainContentC_b").css("height", "180px");
$(".mainContentC_b_t").css("borderBottom","none")
}
$(".mainContentC_t").css("height", mCenterTopHeight + "px");
})
//顶部的显示与隐藏
$(".orgDetailTitle>div").on('click', function () {
var state = $(this).attr("state");
if (state == "open") {//显示
$(".orgDetailTitleContent").css("display", "none")
$(this).children("p").children('span').html("显示");
$(this).children("p").children('img').attr("src", "./pages/cmddispatch/image/mainCenterOpen.png");
$(this).attr("state","close");
}else{
$(".orgDetailTitleContent").css("display", "block")
$(this).children("p").children('span').html("隐藏");
$(this).children("p").children('img').attr("src", "./pages/cmddispatch/image/mainCenterClose.png");
$(this).attr("state","open");
}
})
export {autoOpenRightSlide}