From 4ac408e9a9c9c24ef0ea3e12004a500238956103 Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Wed, 28 Apr 2021 11:55:00 +0800
Subject: [PATCH] 地图 热力图 设备 视频 详情页 图标
---
public/map/widgets/supervisoryMap/SupervisoryMap.js | 147 ++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 128 insertions(+), 19 deletions(-)
diff --git a/public/map/widgets/supervisoryMap/SupervisoryMap.js b/public/map/widgets/supervisoryMap/SupervisoryMap.js
index 828588b..215c332 100644
--- a/public/map/widgets/supervisoryMap/SupervisoryMap.js
+++ b/public/map/widgets/supervisoryMap/SupervisoryMap.js
@@ -160,10 +160,16 @@
onceTime: 300,
// 警情缓存
Pdata: null,
+ // 警情图标缓存
+ Pdatas: null,
//业主缓存
Ydata: null,
+ // 业主图标缓存
+ Ydatas: null,
//设备缓存
Sdata: null,
+ // 设备图标缓存
+ Sdatas: null,
constructor: function (options, srcRefNode) {
this._map = options.map;
@@ -276,6 +282,27 @@
// if ($(this).index() == 1) { return };
// if ($(this).index() == 2) { return };
+ //解决打开热力图 切换top获取不了数据问题 警情
+ if ($('#policeHeatMap').prop('checked') == true) {
+ // console.log($('#policeHeatMap').prop('checked') == true)
+ $('#policeHeatMap').prop('checked', false);
+ that.checkBoxSelect($('#policeHeatMap'));
+ }else
+ //解决打开热力图 切换top获取不了数据问题 业主
+ if ($('#ownerHeatMap').prop('checked') == true) {
+ // console.log($('#ownerHeatMap').prop('checked') == true)
+ $('#ownerHeatMap').prop('checked', false);
+ that.checkBoxSelect($('#ownerHeatMap'));
+ }else
+ //解决打开热力图 切换top获取不了数据问题 设备
+ if ($('#equipmentHeatMap').prop('checked') == true) {
+ // console.log($('#equipmentHeatMap').prop('checked') == true)
+ $('#equipmentHeatMap').prop('checked', false);
+ that.checkBoxSelect($('#equipmentHeatMap'));
+ }
+
+
+ // console.log($('#policeHeatMap').prop('checked') == true)
if (that.entitysData.length > 0) {
that.analysisAddEntitys.clear();
that.entitysData = [];
@@ -286,6 +313,7 @@
that.heatmapfeatureLayer.setRenderer();
$('.analysis-category input').prop('checked', false);
}
+
$(this).addClass('on').siblings().removeClass('on');
@@ -704,7 +732,7 @@
$('.analysis-container > div .select-list').off('click', 'li').on('click', 'li', function (event) {
// console.log(event.currentTarget.innerHTML,'innerhtml')
var text = $(this).text().trim();
- // console.log(text,'text()')
+ // console.log(this,text,'text()')
// console.log(that.tabIndex,'tabIndex')
$(this).parent().parent().prev().html(text + '<i></i>');
@@ -730,17 +758,7 @@
} else if (that.tabIndex == 2) {
- var categoryText = $('#ownerCategory > div:eq(0)').text().trim() == '全部' ? '' : $('#ownerCategory > div:eq(0)').attr('ownerid');
- var levelText = $('#ownerLevel > div:eq(0)').text().trim() == '全部' ? '' : $('#ownerLevel > div:eq(0)').text().trim();
-
- var parentId = $(this).parent().parent().parent().attr('id');
- if (parentId == 'ownerCategory') {
- that.getOwnerDj($('#ownerLevel'), categoryText);
- that.getOwnerTable($('.analysis-container-owner').find('.tbody tbody'), categoryText, '');
- } else {
- that.getOwnerTable($('.analysis-container-owner').find('.tbody tbody'), categoryText, levelText);
- }
-
+ that.getOwnerTable($('.analysis-container-owner').find('.tbody tbody'), text == '全部' ? '' : text);
} else if (that.tabIndex == 0) {
that.getEquipmentTable($('.analysis-container-equipment').find('.tbody tbody'), text == '全部' ? '' : text);
}
@@ -798,7 +816,9 @@
lgtd: result[i].jd,
lttd: result[i].wd,
id: result[i].id
- }, result[i].jd, result[i].wd, './images/police-situation.png');
+ }, result[i].jd, result[i].wd,
+ // './images/police-situation.png'
+ );
t = result[i].alarmTime.substr(0, 10);
e = result[i].alarmTime.substr(11);
@@ -850,6 +870,7 @@
$('.analysis-category input').prop('checked', false);
};
that.flareClusterLayer(result);//图标渲染
+ that.Pdatas = result;
that.clusterLayer._setUserState('警情');//切换聚合图标点击事件
for (var i = 0; i < 1000; i++) {
@@ -892,7 +913,7 @@
// })
},
// 获取业主信息列表
- getOwnerTable: function (dom, type, dj) {
+ getOwnerTable: function (dom, deviceType) {
dom.empty();
var that = this;
$.ajax({
@@ -904,9 +925,37 @@
success: function (data) {
// var result = data.data;
var oldData = data.data;
- // console.log(oldData)
- var result = oldData;
+ // console.log(deviceType)
+ var result = [];
that.Ydata = oldData;
+
+ if (deviceType == '') {
+ result = oldData;
+ } else if (deviceType == '医院') {
+ for (var key in oldData) {
+ // console.log(oldData[key]);
+ if (oldData[key].type == '0') {
+ result.push(oldData[key]);
+ }
+ }
+ } else if (deviceType == '学校') {
+ for (var key in oldData) {
+ // console.log(oldData[key]);
+ if (oldData[key].type == '1') {
+ result.push(oldData[key]);
+ }
+ }
+ } else if (deviceType == '小区') {
+ for (var key in oldData) {
+ // console.log(oldData[key]);
+ if (oldData[key].type == '2') {
+ result.push(oldData[key]);
+ }
+ }
+ }
+
+
+
that.clearLayer();//图标清除
that.entityData = [];
for (var i = 0; i < result.length; i++) {
@@ -923,7 +972,9 @@
that.heatmapfeatureLayer.setRenderer();
$('.analysis-category input').prop('checked', false);
};
+
that.flareClusterLayer(result);//图标渲染
+ that.Ydatas = result;
that.clusterLayer._setUserState('业主');//切换聚合图标点击事件
@@ -947,7 +998,9 @@
lgtd: result[i].jd,
lttd: result[i].wd,
id: result[i].id
- }, result[i].jd, result[i].wd, './images/owner.png');
+ }, result[i].jd, result[i].wd,
+ // './images/业主.png'
+ );
a = Number(i) + 1;
if (result[i].type === "0") {
@@ -1051,13 +1104,16 @@
that.clusterLayer._setUserState('设备');//切换聚合图标点击事件
}
+ that.Sdatas = result;
for (var a, i = 0; i < result.length; i++) {
that.createEntitysAnalysis(that.analysisAddEntitys, that.entitysData, '设备信息', {
lgtd: result[i].jd,
lttd: result[i].wd,
id: result[i].id
- }, result[i].jd, result[i].wd, './images/ceshi.png');
+ }, result[i].jd, result[i].wd,
+ // './images/ceshi.png'
+ );
var stares = '';
a = Number(i) + 1;
@@ -1139,9 +1195,12 @@
checkBoxSelect: function (self) {//选择热力图
var that = this;
var heatmapRenderer = null;
+ // console.log(self);
// // return
// 选中
if ($(self).prop('checked') == true) {
+ that.clearLayer();//图标清除
+ // console.log($(self).attr('id'), 1);
// if (1) {
heatmapRenderer = new HeatmapRenderer({
colorStops: [
@@ -1163,6 +1222,56 @@
this.heatmapfeatureLayer.add(new esri.Graphic(point));
}
} else {
+ // console.log(self, 2);
+ if ($(self).attr('class') == 'p') {
+ that.entityData = [];
+ for (var i = 0; i < this.Pdatas.length; i++) {
+ this.Pdatas[i].x = Number(this.Pdatas[i].jd);
+ this.Pdatas[i].y = Number(this.Pdatas[i].wd);
+ that.entityData.push({
+ lgtd: Number(this.Pdatas[i].jd),
+ lttd: Number(this.Pdatas[i].wd)
+ })
+ }
+ if (that.heatmapfeatureLayer.graphics.length > 0) {//热力图数据映射
+ that.heatmapfeatureLayer.clear();
+ that.heatmapfeatureLayer.setRenderer();
+ // $('.analysis-category input').prop('checked', false);
+ };
+ that.flareClusterLayer(this.Pdatas);//图标渲染
+ } else if ($(self).attr('class') == 'Y') {
+ that.entityData = [];
+ for (var i = 0; i < this.Ydatas.length; i++) {
+ this.Ydatas[i].x = Number(this.Ydatas[i].jd);
+ this.Ydatas[i].y = Number(this.Ydatas[i].wd);
+ that.entityData.push({
+ lgtd: Number(this.Ydatas[i].jd),
+ lttd: Number(this.Ydatas[i].wd)
+ })
+ }
+ if (that.heatmapfeatureLayer.graphics.length > 0) {//热力图数据映射
+ that.heatmapfeatureLayer.clear();
+ that.heatmapfeatureLayer.setRenderer();
+ // $('.analysis-category input').prop('checked', false);
+ };
+ that.flareClusterLayer(this.Ydatas);//图标渲染
+ } else if ($(self).attr('class') == 'S') {
+ that.entityData = [];
+ for (var i = 0; i < this.Sdatas.length; i++) {
+ this.Sdatas[i].x = Number(this.Sdatas[i].jd);
+ this.Sdatas[i].y = Number(this.Sdatas[i].wd);
+ that.entityData.push({
+ lgtd: Number(this.Sdatas[i].jd),
+ lttd: Number(this.Sdatas[i].wd)
+ })
+ }
+ if (that.heatmapfeatureLayer.graphics.length > 0) {//热力图数据映射
+ that.heatmapfeatureLayer.clear();
+ that.heatmapfeatureLayer.setRenderer();
+ // $('.analysis-category input').prop('checked', false);
+ };
+ that.flareClusterLayer(this.Sdatas);//图标渲染
+ }
this.heatmapfeatureLayer.clear();
this.heatmapfeatureLayer.setRenderer();
}
@@ -1279,7 +1388,7 @@
});
//set up a class breaks renderer to render different symbols based on the cluster count. Use the required clusterCount property to break on.
- var defaultSym = new PictureMarkerSymbol("./images/jingbaored.png", 33, 48).setOffset(0, 15);
+ var defaultSym = new PictureMarkerSymbol("./images/jingbaored.png", 33, 48).setOffset(0, 1);
var renderer = new ClassBreaksRenderer(defaultSym, "clusterCount");
var xlSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE, 32, new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new dojo.Color([200, 52, 59, 0.8]), 1), new dojo.Color([250, 65, 74, 0.8]));
var lgSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE, 28, new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new dojo.Color([41, 163, 41, 0.8]), 1), new dojo.Color([51, 204, 51, 0.8]));
--
Gitblit v1.9.3