// import {layuiElement} from '../../tool/tool.js';
// import {deviceHash} from '../../api/moveDeviceWebsocket.js';
// import {mainMap,mapPlugin} from "../../pages/index/js/httpInit.js";
// import {openMapInfo} from "../index/js/moveDeviceMarker.js"
// import {aloneVideo,aloneTalk} from "../index/js/tree.js";
// import {popTalkPage} from "./popTalk.js";
// import {popTask} from "./popTask.js";
// import {getOptionsToolPerson,drawMoserToolMarker} from "../index/js/mapOperEvent.js";
import { deviceHash } from "../api/moveDeviceWebsocket.js";
import { layuiObj,mainMap,mapPlugin } from "./index.js";
import { moveDeviceMarkerHash } from "./marker/moveDeviceMarker.js";
import { drawMoserToolMarker } from "./pageEventTool.js";
import { aloneOpenVideo } from "./openMoveDeviceVideo.js";
let eventHandleIndex=null;
let alarmCirclePerson=[];//保存框选里面的人员
let routerTempArr=[];//计算行驶里程用的。
let alarmManageInfo={
"alarmR":100,
"circle":null,
"longitude":0,
"latitude":0
}
//处置事件
function openEventHandle(){
var deviceid=alarmManageInfo["deviceid"];
if(eventHandleIndex==null){
eventHandleIndex=layuiObj["layer"].open({
type: 1,
title: false, //不显示标题栏
closeBtn: false,
area: ['588px', '322px'],
shade: 0,
id: new Date().getTime(), //设定一个id,防止重复弹出
offset: ['100px',"-10px"],
move:'.layui-move',
offset:'rt',
moveType: 1, //拖拽模式,0或者1
content:`
选择对象
`,
success:function(layero){
//loadOffsetLeft=parseFloat($(".taskSendL").offset().left)+240
//loadOffsetTop=parseFloat($(".taskSendL").offset().top)+40
initAlarmInfo();
}
});
}else{
closeEventIndex();
openEventHandle(deviceid);
}
//关闭
$(".taskSendListEventTitle>img").click(function(){
//关闭画圈
if(alarmManageInfo["circle"]!=null){
mainMap.remove(alarmManageInfo["circle"]);
alarmManageInfo["circle"]=null;
}
closeEventIndex()
})
}
function initAlarmInfo(){
//画1.5公里的圈圈
alarmEmpty();
var circle=drawAlarmCircle();
alarmManageInfo["circle"]=circle;
var circlePerson=getOptionsToolPerson(alarmManageInfo["circle"]);
alarmCirclePerson=JSON.parse(JSON.stringify(circlePerson));
routerTempArr=JSON.parse(JSON.stringify(circlePerson));
selectAlarmWalking();
taskSendEvent();
}
//通过工具获取圈里里面的人员
function getOptionsToolPerson(overlayPath){
var alarmCirclePerson=[];
for(var deviceid in moveDeviceMarkerHash){
var lnglat=moveDeviceMarkerHash[deviceid].getPosition();
var point=[lnglat["lng"],lnglat["lat"]];
var range=overlayPath.contains(point);
if(range){//在圈里面,在去显示
var flag=0;
for(var i=0;i
${showname}
(预计${ridingTime}分钟,共${ridingDistance}千米)
`;
}
$(".taskSendL").html(div);
$(".alarmTaskCount").html(`(${alarmCirclePerson.length})`);
taskSendEvent();
}
function addCirclePerson(overlayPath){
for(var deviceid in deviceHash){
var status=deviceHash[deviceid]["status"];
if(status!="offline"){
var point=[deviceHash[deviceid]["longitude"],deviceHash[deviceid]["latitude"]];
var range=overlayPath.contains(point);
if(range){//在圈里面,在去显示
var flag=0;
for(var i=0;idiv>p>span:first-child");
var totalArr = []
for(var i = 0; i < receivers.length; i++) {
var receiver= receivers[i];
var length=$(receiver).children().length
var deviceid=$(receiver).parent().parent().attr("deviceid");
if(length>0){
if(deviceid in deviceHash){
totalArr.push(deviceHash[deviceid]);
}
}
}
return totalArr;
}
function taskSendEvent(){
//全选
$(".taskSendOptions>ul>li>span:first-child").off('click');
$(".taskSendOptions>ul>li>span:first-child").on('click',function(){
var spanOption=$(this).children().length;
var otherOption=$(".taskSendL>div>p>span:nth-child(1)");
if(spanOption>0){
$(this).empty();
$(otherOption).empty();
}else{
var img=""
$(this).append(img);
for(var i=0;idiv>p>span:first-child").off('click');
$(".taskSendL>div>p>span:first-child").on('click',function(){
var spanOption=$(this).children().length;
var otherOption=$(".taskSendOptions>ul>li>span:first-child");
if(spanOption>0){
$(this).empty();
$(otherOption).empty();
}else{
var img=""
$(this).append(img);
var thisSpan=$(".taskSendL>div>p>span:first-child");
var flag=0;
for(var i=0;iul>li>span:first-child").empty();
var alarmManageData=alarmManageGroupData();
for(var i=0;iul>li>span:first-child").empty();
if(range<100){
layer.msg("最小范围为100");
return;
}else{
alarmManageInfo["alarmR"]=range;
initAlarmInfo();
}
$(".freeAlarmRange").val(range);
}
function alarmEmpty(){
routerTempArr=[];
alarmCirclePerson=[];
if(alarmManageInfo["circle"]!=null){
mainMap.remove(alarmManageInfo["circle"]);
alarmManageInfo["circle"]=null;
}
if('alarminfo' in alarmManageInfo){
delete alarmManageInfo["alarminfo"];
}
}
export {
openEventHandle,
alarmEmpty,
closeEventIndex,
alarmManageInfo,
initAlarmInfo
}