| | |
| | | * @LastEditTime: 2019-12-14 14:44:57 |
| | | */ |
| | | define([ |
| | | "dojo", |
| | | "dojo/_base/declare", |
| | | "dojo/_base/lang", |
| | | "base/BaseWidget", |
| | | "dojo/text!widgets/analysisAndJudgment/template.html", |
| | | "base/AppEvent", |
| | | "base/ConfigData", |
| | | "widgets/analysisAndJudgment/config", |
| | | "dojo/dom", |
| | | "dojo/dom-construct", |
| | | "dojo/dom-attr", |
| | | "dojo/dom-style", |
| | | "dojo/on", |
| | | "esri/layers/ArcGISDynamicMapServiceLayer", |
| | | "esri/layers/ArcGISTiledMapServiceLayer", |
| | | "esri/layers/FeatureLayer", |
| | | "controls/tab/TabControl", |
| | | "esri/dijit/SymbolStyler", |
| | | "esri/styles/basic", |
| | | "dojo/_base/array", |
| | | "esri/InfoTemplate", |
| | | "esri/tasks/query", |
| | | "esri/tasks/QueryTask", |
| | | "esri/Color", |
| | | "esri/graphic", |
| | | "esri/geometry/Point", |
| | | "esri/geometry/Extent", |
| | | "esri/tasks/FeatureSet", |
| | | "esri/renderers/HeatmapRenderer", |
| | | "esri/symbols/SimpleLineSymbol", |
| | | "esri/symbols/SimpleFillSymbol", |
| | | "esri/symbols/PictureMarkerSymbol", |
| | | "esri/symbols/SimpleMarkerSymbol", |
| | | "esri/SpatialReference", |
| | | "esri/tasks/GeometryService", |
| | | "esri/tasks/ProjectParameters", |
| | | "esri/layers/GraphicsLayer", |
| | | "esri/layers/LabelLayer", |
| | | "esri/symbols/TextSymbol", |
| | | "esri/renderers/SimpleRenderer", |
| | | "esri/renderers/ClassBreaksRenderer", |
| | | "esri/tasks/Geoprocessor", |
| | | "esri/tasks/DataFile", |
| | | "esri/geometry/webMercatorUtils", |
| | | "esri/symbols/Font", |
| | | "esri/geometry/ScreenPoint", |
| | | "esri/layers/ImageParameters", |
| | | "esri/geometry/geometryEngine", |
| | | "dojo/domReady!" |
| | | ], function ( |
| | | dojo, |
| | | declare, |
| | | lang, |
| | | BaseWidget, |
| | | template, |
| | | AppEvent, |
| | | ConfigData, |
| | | config, |
| | | dom, |
| | | domConstruct, |
| | | domAttr, |
| | | domStyle, |
| | | on, |
| | | ArcGISDynamicMapServiceLayer, |
| | | ArcGISTiledMapServiceLayer, |
| | | FeatureLayer, |
| | | TabControl, |
| | | SymbolStyler, |
| | | basic, |
| | | arrayUtils, |
| | | InfoTemplate, |
| | | Query, |
| | | QueryTask, |
| | | Color, |
| | | Graphic, |
| | | Point, |
| | | Extent, |
| | | FeatureSet, |
| | | HeatmapRenderer, |
| | | SimpleLineSymbol, |
| | | SimpleFillSymbol, |
| | | PictureMarkerSymbol, |
| | | SimpleMarkerSymbol, |
| | | SpatialReference, |
| | | GeometryService, |
| | | ProjectParameters, |
| | | GraphicsLayer, |
| | | LabelLayer, |
| | | TextSymbol, |
| | | SimpleRenderer, |
| | | ClassBreaksRenderer, |
| | | Geoprocessor, |
| | | DataFile, |
| | | webMercatorUtils, |
| | | Font, |
| | | ScreenPoint, |
| | | ImageParameters, |
| | | geometryEngine |
| | | "dojo", |
| | | "dojo/_base/declare", |
| | | "dojo/_base/lang", |
| | | "base/BaseWidget", |
| | | "dojo/text!widgets/analysisAndJudgment/template.html", |
| | | "base/AppEvent", |
| | | "base/ConfigData", |
| | | "widgets/analysisAndJudgment/config", |
| | | "dojo/dom", |
| | | "dojo/dom-construct", |
| | | "dojo/dom-attr", |
| | | "dojo/dom-style", |
| | | "dojo/on", |
| | | "esri/layers/ArcGISDynamicMapServiceLayer", |
| | | "esri/layers/ArcGISTiledMapServiceLayer", |
| | | "esri/layers/FeatureLayer", |
| | | "controls/tab/TabControl", |
| | | "esri/dijit/SymbolStyler", |
| | | "esri/styles/basic", |
| | | "dojo/_base/array", |
| | | "esri/InfoTemplate", |
| | | "esri/tasks/query", |
| | | "esri/tasks/QueryTask", |
| | | "esri/Color", |
| | | "esri/graphic", |
| | | "esri/geometry/Point", |
| | | "esri/geometry/Extent", |
| | | "esri/tasks/FeatureSet", |
| | | "esri/renderers/HeatmapRenderer", |
| | | "esri/symbols/SimpleLineSymbol", |
| | | "esri/symbols/SimpleFillSymbol", |
| | | "esri/symbols/PictureMarkerSymbol", |
| | | "esri/symbols/SimpleMarkerSymbol", |
| | | "esri/SpatialReference", |
| | | "esri/tasks/GeometryService", |
| | | "esri/tasks/ProjectParameters", |
| | | "esri/layers/GraphicsLayer", |
| | | "esri/layers/LabelLayer", |
| | | "esri/symbols/TextSymbol", |
| | | "esri/renderers/SimpleRenderer", |
| | | "esri/renderers/ClassBreaksRenderer", |
| | | "esri/tasks/Geoprocessor", |
| | | "esri/tasks/DataFile", |
| | | "esri/geometry/webMercatorUtils", |
| | | "esri/symbols/Font", |
| | | "esri/geometry/ScreenPoint", |
| | | "esri/layers/ImageParameters", |
| | | "esri/geometry/geometryEngine", |
| | | "dojo/domReady!" |
| | | ], function( |
| | | dojo, |
| | | declare, |
| | | lang, |
| | | BaseWidget, |
| | | template, |
| | | AppEvent, |
| | | ConfigData, |
| | | config, |
| | | dom, |
| | | domConstruct, |
| | | domAttr, |
| | | domStyle, |
| | | on, |
| | | ArcGISDynamicMapServiceLayer, |
| | | ArcGISTiledMapServiceLayer, |
| | | FeatureLayer, |
| | | TabControl, |
| | | SymbolStyler, |
| | | basic, |
| | | arrayUtils, |
| | | InfoTemplate, |
| | | Query, |
| | | QueryTask, |
| | | Color, |
| | | Graphic, |
| | | Point, |
| | | Extent, |
| | | FeatureSet, |
| | | HeatmapRenderer, |
| | | SimpleLineSymbol, |
| | | SimpleFillSymbol, |
| | | PictureMarkerSymbol, |
| | | SimpleMarkerSymbol, |
| | | SpatialReference, |
| | | GeometryService, |
| | | ProjectParameters, |
| | | GraphicsLayer, |
| | | LabelLayer, |
| | | TextSymbol, |
| | | SimpleRenderer, |
| | | ClassBreaksRenderer, |
| | | Geoprocessor, |
| | | DataFile, |
| | | webMercatorUtils, |
| | | Font, |
| | | ScreenPoint, |
| | | ImageParameters, |
| | | geometryEngine |
| | | ) { |
| | | var Widget = declare([BaseWidget], { |
| | | widgetName: "AnalysisAndJudgment", |
| | | label: "分析研判", |
| | | templateString: template, |
| | | _map: null, |
| | | objThis: null, |
| | | _siteLayer: new GraphicsLayer(), |
| | | layuiLayer: null, |
| | | layuiLadate: null, |
| | | heatmapfeatureLayer_1: null, |
| | | tabIndex: 0, |
| | | var Widget = declare([BaseWidget], { |
| | | widgetName: "AnalysisAndJudgment", |
| | | label: "分析研判", |
| | | templateString: template, |
| | | _map: null, |
| | | objThis: null, |
| | | _siteLayer: new GraphicsLayer(), |
| | | layuiLayer: null, |
| | | layuiLadate: null, |
| | | heatmapfeatureLayer_1: null, |
| | | tabIndex: 0, |
| | | |
| | | // 保留添加实体图层的变量 |
| | | analysisAddEntitys: null, |
| | | entitysData: [], |
| | | constructor: function (options, srcRefNode) { |
| | | this._map = options.map; |
| | | objThis = this; |
| | | // 保留添加实体图层的变量 |
| | | analysisAddEntitys: null, |
| | | entitysData: [], |
| | | constructor: function(options, srcRefNode) { |
| | | this._map = options.map; |
| | | objThis = this; |
| | | |
| | | |
| | | |
| | | |
| | | this.analysisAddEntitys = new GraphicsLayer({ id: 'analysisAddEntitys' }); |
| | | this.addOneEntitys = new GraphicsLayer({ id: 'addOneEntitys' }); |
| | | this.addTwoEntitys = new GraphicsLayer({ id: 'addTwoEntitys' }); |
| | | this.addThreeEntitys = new GraphicsLayer({ id: 'addThreeEntitys' }); |
| | | this.analysisAddEntitys = new GraphicsLayer({ id: 'analysisAddEntitys' }); |
| | | this.addOneEntitys = new GraphicsLayer({ id: 'addOneEntitys' }); |
| | | this.addTwoEntitys = new GraphicsLayer({ id: 'addTwoEntitys' }); |
| | | this.addThreeEntitys = new GraphicsLayer({ id: 'addThreeEntitys' }); |
| | | |
| | | this._map.addLayer(this.analysisAddEntitys); |
| | | this._map.addLayer(this.addOneEntitys); |
| | | }, |
| | | startup: function () { |
| | | objThis._map.addLayer(objThis._siteLayer); |
| | | var that = this; |
| | | // 顶部tab得切换事件 |
| | | $('.analysis-and-judgment-tab li').click(function () { |
| | | if (that.tabIndex == $(this).index()) return; |
| | | |
| | | |
| | | if (that.entitysData.length > 0) { |
| | | that.analysisAddEntitys.clear(); |
| | | that.entitysData = []; |
| | | } |
| | | |
| | | if (that.heatmapfeatureLayer_1.graphics.length > 0) { |
| | | that.heatmapfeatureLayer_1.clear(); |
| | | that.heatmapfeatureLayer_1.setRenderer(); |
| | | $('.analysis-category input').prop('checked', false); |
| | | } |
| | | |
| | | |
| | | $(this).addClass('on').siblings().removeClass('on'); |
| | | var ind = $(this).index(); |
| | | $($('.analysis-container > div')[ind]).stop().show().siblings().stop().hide(); |
| | | if (ind == 0) { |
| | | that.getPoliceTableAnalysis($($('.analysis-container > div')[ind]).find('.tbody tbody'), |
| | | $('#analysis_select_time_start').val() + ':00', |
| | | $('#analysis_select_time_end').val() + ':00', '') |
| | | } else if (ind == 1) { |
| | | that.getOwnerTable($($('.analysis-container > div')[ind]).find('.tbody tbody'), '', ''); |
| | | } else if (ind == 2) { |
| | | that.getEquipmentTable($($('.analysis-container > div')[ind]).find('.tbody tbody'), ''); |
| | | } |
| | | |
| | | that.tabIndex = $(this).index(); |
| | | }) |
| | | |
| | | // 时间查询 |
| | | $('#policeSelectTime').off('click').click(function () { |
| | | var times = $(this).prevAll(); |
| | | // 开始时间 |
| | | var startTime = $(times[1]).val(); |
| | | // 结束时间 |
| | | var endTime = $(times[0]).val(); |
| | | var text = $('#policeCategory div:eq(0)').text().trim(); |
| | | that.getPoliceTableAnalysis($('.analysis-container-police').find('.tbody tbody'), startTime, endTime, text == '全部' ? '' : text); |
| | | }) |
| | | |
| | | // 警情列表中的点击事件 |
| | | $('.analysis-container-police .analysis-table-content .tbody').off('click', 'tr').on('click', 'tr', function () { |
| | | var id = $(this).attr('term-list'); |
| | | var url = '/popup/html/police-details.html?obj=' + id; |
| | | layui.use('layer', function () { |
| | | that.layuiLayer = layui.layer; |
| | | that.layuiLayer.config({ |
| | | extend: 'myskin/police-details.css' |
| | | }); |
| | | that.layuiLayer.close(that.layuiLayer.index); |
| | | that.layuiLayer.open({ |
| | | title: '警情详情', |
| | | type: 2, |
| | | shadeClose: true, |
| | | shade: false, |
| | | maxmin: false, //开启最大化最小化按钮 |
| | | area: ['500px', '400px'], |
| | | offset: 'auto', |
| | | skin: 'police-details', |
| | | content: url, |
| | | closeBtn: 1, |
| | | }); |
| | | }) |
| | | }) |
| | | $('.analysis-container-police .analysis-table-content .tbody').off('click', '.location').on('click', '.location', function (event) { |
| | | event.stopPropagation(); |
| | | }) |
| | | $('.analysis-container-police .analysis-table-content .tbody').off('click', '.location input').on('click', '.location input', function (event) { |
| | | event.stopPropagation(); |
| | | var lgtd = Number($(this).attr('lgtd')); |
| | | var lttd = Number($(this).attr('lttd')); |
| | | var position = new esri.geometry.Point(lgtd, lttd, new esri.SpatialReference({ wkid: 4326 }));//根据输入坐标信息找地图上的点 |
| | | that._map.centerAndZoom(position, 18);//缩放,10是缩放级别,可以自定义,数值越大缩放越大 |
| | | }) |
| | | |
| | | // 业主列表中的点击事件 |
| | | $('.analysis-container-owner .analysis-table-content .tbody').off('click', 'tr').on('click', 'tr', function () { |
| | | var id = $(this).attr('term-list'); |
| | | var url = '/popup/html/owner-details.html?id=' + id; |
| | | layui.use('layer', function () { |
| | | that.layuiLayer = layui.layer; |
| | | that.layuiLayer.config({ |
| | | extend: 'myskin/owner-details.css' |
| | | }); |
| | | that.layuiLayer.close(that.layuiLayer.index); |
| | | that.layuiLayer.open({ |
| | | title: '业主详情', |
| | | type: 2, |
| | | shadeClose: true, |
| | | shade: false, |
| | | maxmin: false, //开启最大化最小化按钮 |
| | | area: ['500px', '340px'], |
| | | offset: 'auto', |
| | | skin: 'owner-details', |
| | | content: url, |
| | | closeBtn: 1, |
| | | }); |
| | | }) |
| | | }) |
| | | $('.analysis-container-owner .analysis-table-content .tbody').off('click', '.location').on('click', '.location', function (event) { |
| | | event.stopPropagation(); |
| | | }) |
| | | $('.analysis-container-owner .analysis-table-content .tbody').off('click', '.location input').on('click', '.location input', function (event) { |
| | | event.stopPropagation(); |
| | | var lgtd = Number($(this).attr('lgtd')); |
| | | var lttd = Number($(this).attr('lttd')); |
| | | var position = new esri.geometry.Point(lgtd, lttd, new esri.SpatialReference({ wkid: 4326 }));//根据输入坐标信息找地图上的点 |
| | | that._map.centerAndZoom(position, 18);//缩放,10是缩放级别,可以自定义,数值越大缩放越大 |
| | | }) |
| | | |
| | | // 设备列表中的点击事件 |
| | | $('.analysis-container-equipment .analysis-table-content .tbody').off('click', 'tr').on('click', 'tr', function () { |
| | | var id = $(this).attr('term-listid'); |
| | | var url = '/popup/html/equipment-details.html?obj=' + id; |
| | | layui.use('layer', function () { |
| | | that.layuiLayer = layui.layer; |
| | | that.layuiLayer.config({ |
| | | extend: 'myskin/equipment-details.css' |
| | | }); |
| | | that.layuiLayer.close(that.layuiLayer.index); |
| | | that.layuiLayer.open({ |
| | | title: '警情详情', |
| | | type: 2, |
| | | shadeClose: true, |
| | | shade: false, |
| | | maxmin: false, //开启最大化最小化按钮 |
| | | area: ['520px', '320px'], |
| | | offset: 'auto', |
| | | skin: 'equipment-details', |
| | | content: url, |
| | | closeBtn: 1, |
| | | }); |
| | | }) |
| | | }) |
| | | $('.analysis-container-equipment .analysis-table-content .tbody').off('click', '.location').on('click', '.location', function (event) { |
| | | event.stopPropagation(); |
| | | }) |
| | | $('.analysis-container-equipment .analysis-table-content .tbody').off('click', '.location input').on('click', '.location input', function (event) { |
| | | event.stopPropagation(); |
| | | var lgtd = Number($(this).attr('lgtd')); |
| | | var lttd = Number($(this).attr('lttd')); |
| | | var position = new esri.geometry.Point(lgtd, lttd, new esri.SpatialReference({ wkid: 4326 }));//根据输入坐标信息找地图上的点 |
| | | that._map.centerAndZoom(position, 18);//缩放,10是缩放级别,可以自定义,数值越大缩放越大 |
| | | }) |
| | | |
| | | // 警情列表中得热力图是否选中事件 |
| | | $('#policeHeatMap').click(function () { |
| | | that.checkBoxSelect(this); |
| | | }) |
| | | // 业主信息列表中得热力图是否选中事件 |
| | | $('#ownerHeatMap').click(function () { |
| | | that.checkBoxSelect(this); |
| | | }) |
| | | // 设备信息列表的热力图是否选中事件 |
| | | $('#equipmentHeatMap').click(function () { |
| | | that.checkBoxSelect(this); |
| | | }) |
| | | // 警情信息中类别移入事件 |
| | | $('#policeCategory').mouseenter(function () { |
| | | if ($('#policeCategory .select-list').is(':hidden')) { |
| | | $('#policeCategory .select-list').stop().slideDown(0); |
| | | } |
| | | }) |
| | | // 警情信息中得类别移出事件 |
| | | $('#policeCategory').mouseleave(function () { |
| | | if (!$('#policeCategory .select-list').is(':hidden')) { |
| | | $('#policeCategory .select-list').stop().slideUp(0); |
| | | } |
| | | }) |
| | | // 业主信息中类别移入事件 |
| | | $('#ownerCategory').mouseenter(function () { |
| | | if ($('#ownerCategory .select-list').is(':hidden')) { |
| | | $('#ownerCategory .select-list').stop().slideDown(0); |
| | | } |
| | | }) |
| | | // 业主信息中得类别移出事件 |
| | | $('#ownerCategory').mouseleave(function () { |
| | | if (!$('#ownerCategory .select-list').is(':hidden')) { |
| | | $('#ownerCategory .select-list').stop().slideUp(0); |
| | | } |
| | | }) |
| | | // 业主信息中的等级移入事件 |
| | | $('#ownerLevel').mouseenter(function () { |
| | | if ($('#ownerLevel .select-list').is(':hidden')) { |
| | | $('#ownerLevel .select-list').stop().slideDown(0); |
| | | } |
| | | }) |
| | | // 业主信息中的等级移出事件 |
| | | $('#ownerLevel').mouseleave(function () { |
| | | if (!$('#ownerLevel .select-list').is(':hidden')) { |
| | | $('#ownerLevel .select-list').stop().slideUp(0); |
| | | } |
| | | }) |
| | | // 设备信息中类别移入事件 |
| | | $('#equipmentCategory').mouseenter(function () { |
| | | if ($('#equipmentCategory .select-list').is(':hidden')) { |
| | | $('#equipmentCategory .select-list').stop().slideDown(0); |
| | | } |
| | | }) |
| | | // 设备信息中得类别移出事件 |
| | | $('#equipmentCategory').mouseleave(function () { |
| | | if (!$('#equipmentCategory .select-list').is(':hidden')) { |
| | | $('#equipmentCategory .select-list').stop().slideUp(0); |
| | | } |
| | | }) |
| | | // 警情信息类,业主信息类,设备信息类别,具体项的点击事件 |
| | | $('.analysis-container > div .select-list').off('click', 'li').on('click', 'li', function (event) { |
| | | |
| | | var text = $(this).text(); |
| | | $(this).parent().parent().prev().html(text + '<i></i>'); |
| | | $(this).parent().parent().stop().slideUp(0); |
| | | |
| | | if (text == '全部') text = ''; |
| | | |
| | | |
| | | if (that.tabIndex == 0) { |
| | | that.getPoliceTableAnalysis($('.analysis-container-police').find('.tbody tbody'), $('#analysis_select_time_start').val(), $('#analysis_select_time_end').val(), text); |
| | | } else if (that.tabIndex == 1) { |
| | | var parentId = $(this).parent().parent().parent().attr('id'); |
| | | if (parentId == 'ownerCategory') { |
| | | var levelText = $('#ownerLevel > div:eq(0)').text().trim() == '全部' ? '' : $('#ownerLevel > div:eq(0)').text().trim(); |
| | | that.getOwnerTable($('.analysis-container-owner').find('.tbody tbody'), text, levelText); |
| | | } else { |
| | | var categoryText = $('#ownerCategory > div:eq(0)').text().trim() == '全部' ? '' : $('#ownerCategory > div:eq(0)').text().trim(); |
| | | that.getOwnerTable($('.analysis-container-owner').find('.tbody tbody'), categoryText, text); |
| | | } |
| | | |
| | | |
| | | |
| | | } else if (that.tabIndex == 2) { |
| | | that.getEquipmentTable($('.analysis-container-equipment').find('.tbody tbody'), text); |
| | | } |
| | | |
| | | }) |
| | | }, |
| | | open: function () { |
| | | var time = this.getTime(); |
| | | var that = this; |
| | | |
| | | that.tabIndex = 0; |
| | | $('.analysis-and-judgment-tab li:eq(0)').addClass('on').siblings().removeClass('on'); |
| | | $($('.analysis-container > div')[0]).stop().show().siblings().stop().hide(); |
| | | |
| | | that.heatmapfeatureLayer_1 = that.heatmFeaLayers(); |
| | | |
| | | that._map.addLayer(that.heatmapfeatureLayer_1); |
| | | $('#analysis_select_time_start').val(time.tomorrow); |
| | | $('#analysis_select_time_end').val(time.current); |
| | | |
| | | layui.use('laydate', function () { |
| | | that.layuiLadate = layui.laydate; |
| | | //执行一个laydate实例 开始 |
| | | that.layuiLadate.render({ |
| | | elem: '#analysis_select_time_start', //指定元素 |
| | | type: "datetime", |
| | | format: 'yyyy-MM-dd HH:mm', |
| | | trigger: 'click' |
| | | }); |
| | | // 结束 |
| | | that.layuiLadate.render({ |
| | | elem: '#analysis_select_time_end', //指定元素 |
| | | type: "datetime", |
| | | format: 'yyyy-MM-dd HH:mm', |
| | | trigger: 'click' |
| | | }); |
| | | }); |
| | | |
| | | that.getPoliceTableAnalysis($('.analysis-container-police').find('.tbody tbody'), time.tomorrow, time.current, ''); |
| | | that.clickHand(); |
| | | // 日期时间选择,做的一些限制,最大最小范围 |
| | | function gerCurrentTime() { |
| | | var timestamp = Date.parse(new Date()); |
| | | // 当前时间 |
| | | var currentTime = new Date(timestamp); |
| | | // 年 |
| | | var currentY = currentTime.getFullYear(); |
| | | // 月 |
| | | var currentM = currentTime.getMonth(); |
| | | // 日 |
| | | var currentD = currentTime.getDate(); |
| | | // 时 |
| | | var currentH = currentTime.getHours(); |
| | | // 分 |
| | | var currentDd = currentTime.getMinutes(); |
| | | var currentS = currentTime.getSeconds(); |
| | | return { |
| | | date: currentD, |
| | | hours: currentH, |
| | | minutes: currentDd, |
| | | month: currentM, |
| | | seconds: currentS, |
| | | year: currentY |
| | | } |
| | | } |
| | | |
| | | function getNowFormatDate() { |
| | | var date = new Date(); |
| | | var seperator1 = "-"; |
| | | var seperator2 = ":"; |
| | | var month = date.getMonth() + 1; |
| | | var strDate = date.getDate(); |
| | | if (month >= 1 && month <= 9) { |
| | | month = "0" + month; |
| | | } |
| | | if (strDate >= 0 && strDate <= 9) { |
| | | strDate = "0" + strDate; |
| | | } |
| | | var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate |
| | | + " " + date.getHours() + seperator2 + date.getMinutes() |
| | | + seperator2 + date.getSeconds(); |
| | | return currentdate; |
| | | } |
| | | |
| | | function gerStarrtClickTime() { |
| | | var time = $('#analysis_select_time_start').val(); |
| | | // 年 |
| | | var currentY = Number(time.substr(0, 4)); |
| | | // 月 |
| | | var currentM = Number(time.substr(5, 2)) - 1; |
| | | // 日 |
| | | var currentD = Number(time.substr(8, 2)); |
| | | // 时 |
| | | var currentH = Number(time.substr(11, 2)); |
| | | // 分 |
| | | var currentDd = Number(time.substr(14, 2)); |
| | | var currentS = Number(time.substr(17, 2)); |
| | | return { |
| | | date: currentD, |
| | | hours: currentH, |
| | | minutes: currentDd, |
| | | month: currentM, |
| | | seconds: currentS, |
| | | year: currentY |
| | | } |
| | | } |
| | | |
| | | function getStartTime() { |
| | | var time = $('#analysis_select_time_start').val(); |
| | | return time |
| | | } |
| | | |
| | | |
| | | |
| | | }, |
| | | close: function () { |
| | | this.entitysData = []; |
| | | this.analysisAddEntitys.clear(); |
| | | |
| | | }, |
| | | // 鼠标点击事件 |
| | | clickHand: function () { |
| | | var self = this; |
| | | |
| | | self._map.onClick = mapClick; |
| | | |
| | | |
| | | function mapClick (evt) { |
| | | if (evt.graphic) { |
| | | var result = evt.graphic.geometry.entityData; |
| | | var liText = evt.graphic.symbol.name; |
| | | if (liText == '警情信息') { |
| | | self.policeDetails(result.id); |
| | | } else if (liText == '业主信息') { |
| | | self.ownerDetails(result.id); |
| | | } else if (liText == '设备信息') { |
| | | self.equipmentDetails(result.id); |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | // 警情详情弹框 |
| | | /** |
| | | * |
| | | * @param {number} id 警情ID |
| | | */ |
| | | policeDetails: function (id) { |
| | | var that = this; |
| | | var url = '/popup/html/police-details.html?obj=' + id; |
| | | layui.use('layer', function () { |
| | | that.layuiLayer = layui.layer; |
| | | that.layuiLayer.config({ |
| | | extend: 'myskin/police-details.css' |
| | | }); |
| | | that.layuiLayer.close(that.layuiLayer.index); |
| | | that.layuiLayer.open({ |
| | | title: '警情详情', |
| | | type: 2, |
| | | shadeClose: true, |
| | | shade: false, |
| | | maxmin: false, //开启最大化最小化按钮 |
| | | area: ['500px', '400px'], |
| | | offset: 'auto', |
| | | skin: 'police-details', |
| | | content: url, |
| | | closeBtn: 1, |
| | | }); |
| | | }) |
| | | }, |
| | | // 业主详情弹框 |
| | | /** |
| | | * |
| | | * @param {number} id 警情ID |
| | | */ |
| | | ownerDetails: function (id) { |
| | | var that = this; |
| | | var url = '/popup/html/owner-details.html?id=' + id; |
| | | layui.use('layer', function () { |
| | | that.layuiLayer = layui.layer; |
| | | that.layuiLayer.config({ |
| | | extend: 'myskin/owner-details.css' |
| | | }); |
| | | that.layuiLayer.close(that.layuiLayer.index); |
| | | that.layuiLayer.open({ |
| | | title: '业主详情', |
| | | type: 2, |
| | | shadeClose: true, |
| | | shade: false, |
| | | maxmin: false, //开启最大化最小化按钮 |
| | | area: ['500px', '340px'], |
| | | offset: 'auto', |
| | | skin: 'owner-details', |
| | | content: url, |
| | | closeBtn: 1, |
| | | }); |
| | | }) |
| | | }, |
| | | // 设备详情弹框 |
| | | /** |
| | | * |
| | | * @param {number} id 设备ID |
| | | */ |
| | | equipmentDetails: function (id) { |
| | | var that = this; |
| | | var url = '/popup/html/equipment-details.html?obj=' + id; |
| | | layui.use('layer', function () { |
| | | that.layuiLayer = layui.layer; |
| | | that.layuiLayer.config({ |
| | | extend: 'myskin/equipment-details.css' |
| | | }); |
| | | that.layuiLayer.close(that.layuiLayer.index); |
| | | that.layuiLayer.open({ |
| | | title: '警情详情', |
| | | type: 2, |
| | | shadeClose: true, |
| | | shade: false, |
| | | maxmin: false, //开启最大化最小化按钮 |
| | | area: ['520px', '320px'], |
| | | offset: 'auto', |
| | | skin: 'equipment-details', |
| | | content: url, |
| | | closeBtn: 1, |
| | | }); |
| | | }) |
| | | }, |
| | | //热力图渲染器,加载热力图 |
| | | heatmFeaLayers: function () { |
| | | |
| | | var layerDefinition = { |
| | | "geometryType": "esriGeometryPoint", |
| | | "fields": [{ |
| | | "num": "num", |
| | | editable: true, |
| | | nullable: true, |
| | | "type": "esriFieldTypeInteger", |
| | | "alias": "数量" |
| | | }] |
| | | }; |
| | | var featureCollection = { |
| | | layerDefinition: layerDefinition, |
| | | featureSet: null |
| | | }; |
| | | //创建 FeatureLayer 图层 |
| | | var featureLayer = new esri.layers.FeatureLayer(featureCollection, { |
| | | mode: esri.layers.FeatureLayer.MODE_SNAPSHOT, |
| | | outFields: ["*"], |
| | | opacity: .8 |
| | | }); |
| | | //设置渲染方式 |
| | | |
| | | return featureLayer; |
| | | }, |
| | | // 获取当前时间,以及昨天现在的时间 |
| | | getTime: function getTime() { |
| | | var timestamp = Date.parse(new Date()); |
| | | |
| | | // 当前时间 |
| | | var currentTime = new Date(timestamp); |
| | | // 年 |
| | | var currentY = currentTime.getFullYear(); |
| | | // 月 |
| | | var currentM = currentTime.getMonth() + 1 < 10 ? '0' + (currentTime.getMonth() + 1) : currentTime.getMonth() + 1; |
| | | // 日 |
| | | var currentD = currentTime.getDate() < 10 ? '0' + currentTime.getDate() : currentTime.getDate(); |
| | | // 时 |
| | | var currentH = currentTime.getHours() < 10 ? '0' + currentTime.getHours() : currentTime.getHours(); |
| | | // 分 |
| | | var currentDd = currentTime.getMinutes() < 10 ? '0' + currentTime.getMinutes() : currentTime.getMinutes(); |
| | | // 明天 |
| | | var tomorrowTime = new Date(timestamp - 60 * 60 * 24 * 1000); |
| | | // 年 |
| | | var tomorrowY = tomorrowTime.getFullYear(); |
| | | // 月 |
| | | var tomorrowM = tomorrowTime.getMonth() + 1 < 10 ? '0' + (tomorrowTime.getMonth() + 1) : tomorrowTime.getMonth() + 1; |
| | | // 日 |
| | | var tomorrowD = tomorrowTime.getDate() < 10 ? '0' + tomorrowTime.getDate() : tomorrowTime.getDate(); |
| | | // 时 |
| | | var tomorrowH = tomorrowTime.getHours() < 10 ? '0' + tomorrowTime.getHours() : tomorrowTime.getHours(); |
| | | // 分 |
| | | var tomorrowDd = tomorrowTime.getMinutes() < 10 ? '0' + tomorrowTime.getMinutes() : tomorrowTime.getMinutes(); |
| | | return { |
| | | current: currentY + '-' + currentM + '-' + currentD + ' ' + currentH + ':' + currentDd, |
| | | tomorrow: tomorrowY + '-' + tomorrowM + '-' + tomorrowD + ' ' + tomorrowH + ':' + tomorrowDd, |
| | | month: currentM + currentD |
| | | }; |
| | | } |
| | | // 获取警情信息列表 |
| | | /** |
| | | * |
| | | * @param {object} dom jq对象 |
| | | * @param {string} beginTime 开始时间 |
| | | * @param {string} endTime 结束时间 |
| | | * @param {*} waringType 警情的类别 |
| | | */ |
| | | getPoliceTableAnalysis: function (dom, beginTime, endTime, waringType) { |
| | | dom.empty(); |
| | | var that = this; |
| | | $.ajax({ |
| | | url: 'http://web.byisf.com/api/blade-jfpts/jingdan/jingdan/selectList', |
| | | type: 'POST', |
| | | dataType: 'JSON', |
| | | data: { |
| | | beginTime: beginTime, |
| | | endTime: endTime, |
| | | waringType: waringType |
| | | this._map.addLayer(this.analysisAddEntitys); |
| | | this._map.addLayer(this.addOneEntitys); |
| | | }, |
| | | success: function (data) { |
| | | var result = data.data; |
| | | var str = ''; |
| | | var lgtdOrLttd = null; |
| | | that.entitysData = []; |
| | | that.analysisAddEntitys.clear(); |
| | | for (var a, time, t, e, y, h, 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/police-situation.png'); |
| | | startup: function() { |
| | | objThis._map.addLayer(objThis._siteLayer); |
| | | var that = this; |
| | | // 顶部tab得切换事件 |
| | | $('.analysis-and-judgment-tab li').click(function() { |
| | | if (that.tabIndex == $(this).index()) return; |
| | | |
| | | |
| | | t = result[i].handleTime.substr(0, 10); |
| | | e = result[i].handleTime.substr(11); |
| | | time = t + ' ' + e; |
| | | y = result[i].handleTime.substr(5, 5); |
| | | h = result[i].handleTime.substr(11, 5); |
| | | a = Number(i) + 1; |
| | | str += '<tr term-list=' + result[i].id + '>'; |
| | | str += '<td>' + a + '</td>'; |
| | | str += '<td title=' + result[i].waringType + '>' + result[i].waringType + '</td>'; |
| | | str += '<td title=' + result[i].addvnm + '>' + result[i].addvnm + '</td>'; |
| | | str += "<td><a href='javascript:;' title=" + time + ">" + y + ' ' + h + "</a></td>"; |
| | | str += "<td class='location'> <input type='button' value='定位'" + ' lgtd=' + result[i].jd + ' lttd=' + result[i].wd + "></td>"; |
| | | str += '</tr>'; |
| | | dom.append(str); |
| | | str = ''; |
| | | if (that.entitysData.length > 0) { |
| | | that.analysisAddEntitys.clear(); |
| | | that.entitysData = []; |
| | | } |
| | | |
| | | if (that.heatmapfeatureLayer_1.graphics.length > 0) { |
| | | that.heatmapfeatureLayer_1.clear(); |
| | | that.heatmapfeatureLayer_1.setRenderer(); |
| | | $('.analysis-category input').prop('checked', false); |
| | | } |
| | | |
| | | |
| | | $(this).addClass('on').siblings().removeClass('on'); |
| | | var ind = $(this).index(); |
| | | $($('.analysis-container > div')[ind]).stop().show().siblings().stop().hide(); |
| | | if (ind == 0) { |
| | | that.getPoliceTableAnalysis($($('.analysis-container > div')[ind]).find('.tbody tbody'), |
| | | $('#analysis_select_time_start').val() + ':00', |
| | | $('#analysis_select_time_end').val() + ':00', '') |
| | | } else if (ind == 1) { |
| | | that.getOwnerTable($($('.analysis-container > div')[ind]).find('.tbody tbody'), '', ''); |
| | | } else if (ind == 2) { |
| | | that.getEquipmentTable($($('.analysis-container > div')[ind]).find('.tbody tbody'), ''); |
| | | } |
| | | |
| | | that.tabIndex = $(this).index(); |
| | | }) |
| | | |
| | | // 时间查询 |
| | | $('#policeSelectTime').off('click').click(function() { |
| | | var times = $(this).prevAll(); |
| | | // 开始时间 |
| | | var startTime = $(times[1]).val(); |
| | | // 结束时间 |
| | | var endTime = $(times[0]).val(); |
| | | var text = $('#policeCategory div:eq(0)').text().trim(); |
| | | that.getPoliceTableAnalysis($('.analysis-container-police').find('.tbody tbody'), startTime, endTime, text == '全部' ? '' : text); |
| | | }) |
| | | |
| | | // 警情列表中的点击事件 |
| | | $('.analysis-container-police .analysis-table-content .tbody').off('click', 'tr').on('click', 'tr', function() { |
| | | var id = $(this).attr('term-list'); |
| | | var url = '/popup/html/police-details.html?obj=' + id; |
| | | layui.use('layer', function() { |
| | | that.layuiLayer = layui.layer; |
| | | that.layuiLayer.config({ |
| | | extend: 'myskin/police-details.css' |
| | | }); |
| | | that.layuiLayer.close(that.layuiLayer.index); |
| | | that.layuiLayer.open({ |
| | | title: '警情详情', |
| | | type: 2, |
| | | shadeClose: true, |
| | | shade: false, |
| | | maxmin: false, //开启最大化最小化按钮 |
| | | area: ['500px', '400px'], |
| | | offset: 'auto', |
| | | skin: 'police-details', |
| | | content: url, |
| | | closeBtn: 1, |
| | | }); |
| | | }) |
| | | }) |
| | | $('.analysis-container-police .analysis-table-content .tbody').off('click', '.location').on('click', '.location', function(event) { |
| | | event.stopPropagation(); |
| | | }) |
| | | $('.analysis-container-police .analysis-table-content .tbody').off('click', '.location input').on('click', '.location input', function(event) { |
| | | event.stopPropagation(); |
| | | var lgtd = Number($(this).attr('lgtd')); |
| | | var lttd = Number($(this).attr('lttd')); |
| | | var position = new esri.geometry.Point(lgtd, lttd, new esri.SpatialReference({ wkid: 4326 })); //根据输入坐标信息找地图上的点 |
| | | that._map.centerAndZoom(position, 18); //缩放,10是缩放级别,可以自定义,数值越大缩放越大 |
| | | }) |
| | | |
| | | // 业主列表中的点击事件 |
| | | $('.analysis-container-owner .analysis-table-content .tbody').off('click', 'tr').on('click', 'tr', function() { |
| | | var id = $(this).attr('term-list'); |
| | | var url = '/popup/html/owner-details.html?id=' + id; |
| | | layui.use('layer', function() { |
| | | that.layuiLayer = layui.layer; |
| | | that.layuiLayer.config({ |
| | | extend: 'myskin/owner-details.css' |
| | | }); |
| | | that.layuiLayer.close(that.layuiLayer.index); |
| | | that.layuiLayer.open({ |
| | | title: '业主详情', |
| | | type: 2, |
| | | shadeClose: true, |
| | | shade: false, |
| | | maxmin: false, //开启最大化最小化按钮 |
| | | area: ['500px', '340px'], |
| | | offset: 'auto', |
| | | skin: 'owner-details', |
| | | content: url, |
| | | closeBtn: 1, |
| | | }); |
| | | }) |
| | | }) |
| | | $('.analysis-container-owner .analysis-table-content .tbody').off('click', '.location').on('click', '.location', function(event) { |
| | | event.stopPropagation(); |
| | | }) |
| | | $('.analysis-container-owner .analysis-table-content .tbody').off('click', '.location input').on('click', '.location input', function(event) { |
| | | event.stopPropagation(); |
| | | var lgtd = Number($(this).attr('lgtd')); |
| | | var lttd = Number($(this).attr('lttd')); |
| | | var position = new esri.geometry.Point(lgtd, lttd, new esri.SpatialReference({ wkid: 4326 })); //根据输入坐标信息找地图上的点 |
| | | that._map.centerAndZoom(position, 18); //缩放,10是缩放级别,可以自定义,数值越大缩放越大 |
| | | }) |
| | | |
| | | // 设备列表中的点击事件 |
| | | $('.analysis-container-equipment .analysis-table-content .tbody').off('click', 'tr').on('click', 'tr', function() { |
| | | var id = $(this).attr('term-listid'); |
| | | var url = '/popup/html/equipment-details.html?obj=' + id; |
| | | layui.use('layer', function() { |
| | | that.layuiLayer = layui.layer; |
| | | that.layuiLayer.config({ |
| | | extend: 'myskin/equipment-details.css' |
| | | }); |
| | | that.layuiLayer.close(that.layuiLayer.index); |
| | | that.layuiLayer.open({ |
| | | title: '警情详情', |
| | | type: 2, |
| | | shadeClose: true, |
| | | shade: false, |
| | | maxmin: false, //开启最大化最小化按钮 |
| | | area: ['520px', '320px'], |
| | | offset: 'auto', |
| | | skin: 'equipment-details', |
| | | content: url, |
| | | closeBtn: 1, |
| | | }); |
| | | }) |
| | | }) |
| | | $('.analysis-container-equipment .analysis-table-content .tbody').off('click', '.location').on('click', '.location', function(event) { |
| | | event.stopPropagation(); |
| | | }) |
| | | $('.analysis-container-equipment .analysis-table-content .tbody').off('click', '.location input').on('click', '.location input', function(event) { |
| | | event.stopPropagation(); |
| | | var lgtd = Number($(this).attr('lgtd')); |
| | | var lttd = Number($(this).attr('lttd')); |
| | | var position = new esri.geometry.Point(lgtd, lttd, new esri.SpatialReference({ wkid: 4326 })); //根据输入坐标信息找地图上的点 |
| | | that._map.centerAndZoom(position, 18); //缩放,10是缩放级别,可以自定义,数值越大缩放越大 |
| | | }) |
| | | |
| | | // 警情列表中得热力图是否选中事件 |
| | | $('#policeHeatMap').click(function() { |
| | | that.checkBoxSelect(this); |
| | | }) |
| | | // 业主信息列表中得热力图是否选中事件 |
| | | $('#ownerHeatMap').click(function() { |
| | | that.checkBoxSelect(this); |
| | | }) |
| | | // 设备信息列表的热力图是否选中事件 |
| | | $('#equipmentHeatMap').click(function() { |
| | | that.checkBoxSelect(this); |
| | | }) |
| | | // 警情信息中类别移入事件 |
| | | $('#policeCategory').mouseenter(function() { |
| | | if ($('#policeCategory .select-list').is(':hidden')) { |
| | | $('#policeCategory .select-list').stop().slideDown(0); |
| | | } |
| | | }) |
| | | // 警情信息中得类别移出事件 |
| | | $('#policeCategory').mouseleave(function() { |
| | | if (!$('#policeCategory .select-list').is(':hidden')) { |
| | | $('#policeCategory .select-list').stop().slideUp(0); |
| | | } |
| | | }) |
| | | // 业主信息中类别移入事件 |
| | | $('#ownerCategory').mouseenter(function() { |
| | | if ($('#ownerCategory .select-list').is(':hidden')) { |
| | | $('#ownerCategory .select-list').stop().slideDown(0); |
| | | } |
| | | }) |
| | | // 业主信息中得类别移出事件 |
| | | $('#ownerCategory').mouseleave(function() { |
| | | if (!$('#ownerCategory .select-list').is(':hidden')) { |
| | | $('#ownerCategory .select-list').stop().slideUp(0); |
| | | } |
| | | }) |
| | | // 业主信息中的等级移入事件 |
| | | $('#ownerLevel').mouseenter(function() { |
| | | if ($('#ownerLevel .select-list').is(':hidden')) { |
| | | $('#ownerLevel .select-list').stop().slideDown(0); |
| | | } |
| | | }) |
| | | // 业主信息中的等级移出事件 |
| | | $('#ownerLevel').mouseleave(function() { |
| | | if (!$('#ownerLevel .select-list').is(':hidden')) { |
| | | $('#ownerLevel .select-list').stop().slideUp(0); |
| | | } |
| | | }) |
| | | // 设备信息中类别移入事件 |
| | | $('#equipmentCategory').mouseenter(function() { |
| | | if ($('#equipmentCategory .select-list').is(':hidden')) { |
| | | $('#equipmentCategory .select-list').stop().slideDown(0); |
| | | } |
| | | }) |
| | | // 设备信息中得类别移出事件 |
| | | $('#equipmentCategory').mouseleave(function() { |
| | | if (!$('#equipmentCategory .select-list').is(':hidden')) { |
| | | $('#equipmentCategory .select-list').stop().slideUp(0); |
| | | } |
| | | }) |
| | | // 警情信息类,业主信息类,设备信息类别,具体项的点击事件 |
| | | $('.analysis-container > div .select-list').off('click', 'li').on('click', 'li', function(event) { |
| | | |
| | | var text = $(this).text(); |
| | | $(this).parent().parent().prev().html(text + '<i></i>'); |
| | | $(this).parent().parent().stop().slideUp(0); |
| | | |
| | | if (text == '全部') text = ''; |
| | | |
| | | |
| | | if (that.tabIndex == 0) { |
| | | that.getPoliceTableAnalysis($('.analysis-container-police').find('.tbody tbody'), $('#analysis_select_time_start').val(), $('#analysis_select_time_end').val(), text); |
| | | } else if (that.tabIndex == 1) { |
| | | var parentId = $(this).parent().parent().parent().attr('id'); |
| | | if (parentId == 'ownerCategory') { |
| | | var levelText = $('#ownerLevel > div:eq(0)').text().trim() == '全部' ? '' : $('#ownerLevel > div:eq(0)').text().trim(); |
| | | that.getOwnerTable($('.analysis-container-owner').find('.tbody tbody'), text, levelText); |
| | | } else { |
| | | var categoryText = $('#ownerCategory > div:eq(0)').text().trim() == '全部' ? '' : $('#ownerCategory > div:eq(0)').text().trim(); |
| | | that.getOwnerTable($('.analysis-container-owner').find('.tbody tbody'), categoryText, text); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | } else if (that.tabIndex == 2) { |
| | | that.getEquipmentTable($('.analysis-container-equipment').find('.tbody tbody'), text); |
| | | } |
| | | |
| | | for (var i = 0; i < 1000; i++) { |
| | | var dd = Math.random(); |
| | | var cc = Math.random(); |
| | | } |
| | | }) |
| | | }, |
| | | open: function() { |
| | | var time = this.getTime(); |
| | | var that = this; |
| | | |
| | | that.tabIndex = 0; |
| | | $('.analysis-and-judgment-tab li:eq(0)').addClass('on').siblings().removeClass('on'); |
| | | $($('.analysis-container > div')[0]).stop().show().siblings().stop().hide(); |
| | | |
| | | that.heatmapfeatureLayer_1 = that.heatmFeaLayers(); |
| | | |
| | | that._map.addLayer(that.heatmapfeatureLayer_1); |
| | | $('#analysis_select_time_start').val(time.tomorrow); |
| | | $('#analysis_select_time_end').val(time.current); |
| | | |
| | | layui.use('laydate', function() { |
| | | that.layuiLadate = layui.laydate; |
| | | //执行一个laydate实例 开始 |
| | | that.layuiLadate.render({ |
| | | elem: '#analysis_select_time_start', //指定元素 |
| | | type: "datetime", |
| | | format: 'yyyy-MM-dd HH:mm', |
| | | trigger: 'click' |
| | | }); |
| | | // 结束 |
| | | that.layuiLadate.render({ |
| | | elem: '#analysis_select_time_end', //指定元素 |
| | | type: "datetime", |
| | | format: 'yyyy-MM-dd HH:mm', |
| | | trigger: 'click' |
| | | }); |
| | | }); |
| | | |
| | | that.getPoliceTableAnalysis($('.analysis-container-police').find('.tbody tbody'), time.tomorrow, time.current, ''); |
| | | that.clickHand(); |
| | | // 日期时间选择,做的一些限制,最大最小范围 |
| | | function gerCurrentTime() { |
| | | var timestamp = Date.parse(new Date()); |
| | | // 当前时间 |
| | | var currentTime = new Date(timestamp); |
| | | // 年 |
| | | var currentY = currentTime.getFullYear(); |
| | | // 月 |
| | | var currentM = currentTime.getMonth(); |
| | | // 日 |
| | | var currentD = currentTime.getDate(); |
| | | // 时 |
| | | var currentH = currentTime.getHours(); |
| | | // 分 |
| | | var currentDd = currentTime.getMinutes(); |
| | | var currentS = currentTime.getSeconds(); |
| | | return { |
| | | date: currentD, |
| | | hours: currentH, |
| | | minutes: currentDd, |
| | | month: currentM, |
| | | seconds: currentS, |
| | | year: currentY |
| | | } |
| | | } |
| | | |
| | | function getNowFormatDate() { |
| | | var date = new Date(); |
| | | var seperator1 = "-"; |
| | | var seperator2 = ":"; |
| | | var month = date.getMonth() + 1; |
| | | var strDate = date.getDate(); |
| | | if (month >= 1 && month <= 9) { |
| | | month = "0" + month; |
| | | } |
| | | if (strDate >= 0 && strDate <= 9) { |
| | | strDate = "0" + strDate; |
| | | } |
| | | var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate + |
| | | " " + date.getHours() + seperator2 + date.getMinutes() + |
| | | seperator2 + date.getSeconds(); |
| | | return currentdate; |
| | | } |
| | | |
| | | function gerStarrtClickTime() { |
| | | var time = $('#analysis_select_time_start').val(); |
| | | // 年 |
| | | var currentY = Number(time.substr(0, 4)); |
| | | // 月 |
| | | var currentM = Number(time.substr(5, 2)) - 1; |
| | | // 日 |
| | | var currentD = Number(time.substr(8, 2)); |
| | | // 时 |
| | | var currentH = Number(time.substr(11, 2)); |
| | | // 分 |
| | | var currentDd = Number(time.substr(14, 2)); |
| | | var currentS = Number(time.substr(17, 2)); |
| | | return { |
| | | date: currentD, |
| | | hours: currentH, |
| | | minutes: currentDd, |
| | | month: currentM, |
| | | seconds: currentS, |
| | | year: currentY |
| | | } |
| | | } |
| | | |
| | | function getStartTime() { |
| | | var time = $('#analysis_select_time_start').val(); |
| | | return time |
| | | } |
| | | |
| | | |
| | | |
| | | }, |
| | | close: function() { |
| | | this.entitysData = []; |
| | | this.analysisAddEntitys.clear(); |
| | | |
| | | }, |
| | | // 鼠标点击事件 |
| | | clickHand: function() { |
| | | var self = this; |
| | | |
| | | self._map.onClick = mapClick; |
| | | |
| | | |
| | | function mapClick(evt) { |
| | | if (evt.graphic) { |
| | | var result = evt.graphic.geometry.entityData; |
| | | var liText = evt.graphic.symbol.name; |
| | | if (liText == '警情信息') { |
| | | self.policeDetails(result.id); |
| | | } else if (liText == '业主信息') { |
| | | self.ownerDetails(result.id); |
| | | } else if (liText == '设备信息') { |
| | | self.equipmentDetails(result.id); |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | // 警情详情弹框 |
| | | /** |
| | | * |
| | | * @param {number} id 警情ID |
| | | */ |
| | | policeDetails: function(id) { |
| | | var that = this; |
| | | var url = '/popup/html/police-details.html?obj=' + id; |
| | | layui.use('layer', function() { |
| | | that.layuiLayer = layui.layer; |
| | | that.layuiLayer.config({ |
| | | extend: 'myskin/police-details.css' |
| | | }); |
| | | that.layuiLayer.close(that.layuiLayer.index); |
| | | that.layuiLayer.open({ |
| | | title: '警情详情', |
| | | type: 2, |
| | | shadeClose: true, |
| | | shade: false, |
| | | maxmin: false, //开启最大化最小化按钮 |
| | | area: ['500px', '400px'], |
| | | offset: 'auto', |
| | | skin: 'police-details', |
| | | content: url, |
| | | closeBtn: 1, |
| | | }); |
| | | }) |
| | | }, |
| | | // 业主详情弹框 |
| | | /** |
| | | * |
| | | * @param {number} id 警情ID |
| | | */ |
| | | ownerDetails: function(id) { |
| | | var that = this; |
| | | var url = '/popup/html/owner-details.html?id=' + id; |
| | | layui.use('layer', function() { |
| | | that.layuiLayer = layui.layer; |
| | | that.layuiLayer.config({ |
| | | extend: 'myskin/owner-details.css' |
| | | }); |
| | | that.layuiLayer.close(that.layuiLayer.index); |
| | | that.layuiLayer.open({ |
| | | title: '业主详情', |
| | | type: 2, |
| | | shadeClose: true, |
| | | shade: false, |
| | | maxmin: false, //开启最大化最小化按钮 |
| | | area: ['500px', '340px'], |
| | | offset: 'auto', |
| | | skin: 'owner-details', |
| | | content: url, |
| | | closeBtn: 1, |
| | | }); |
| | | }) |
| | | }, |
| | | // 设备详情弹框 |
| | | /** |
| | | * |
| | | * @param {number} id 设备ID |
| | | */ |
| | | equipmentDetails: function(id) { |
| | | var that = this; |
| | | var url = '/popup/html/equipment-details.html?obj=' + id; |
| | | layui.use('layer', function() { |
| | | that.layuiLayer = layui.layer; |
| | | that.layuiLayer.config({ |
| | | extend: 'myskin/equipment-details.css' |
| | | }); |
| | | that.layuiLayer.close(that.layuiLayer.index); |
| | | that.layuiLayer.open({ |
| | | title: '警情详情', |
| | | type: 2, |
| | | shadeClose: true, |
| | | shade: false, |
| | | maxmin: false, //开启最大化最小化按钮 |
| | | area: ['520px', '320px'], |
| | | offset: 'auto', |
| | | skin: 'equipment-details', |
| | | content: url, |
| | | closeBtn: 1, |
| | | }); |
| | | }) |
| | | }, |
| | | //热力图渲染器,加载热力图 |
| | | heatmFeaLayers: function() { |
| | | |
| | | var layerDefinition = { |
| | | "geometryType": "esriGeometryPoint", |
| | | "fields": [{ |
| | | "num": "num", |
| | | editable: true, |
| | | nullable: true, |
| | | "type": "esriFieldTypeInteger", |
| | | "alias": "数量" |
| | | }] |
| | | }; |
| | | var featureCollection = { |
| | | layerDefinition: layerDefinition, |
| | | featureSet: null |
| | | }; |
| | | //创建 FeatureLayer 图层 |
| | | var featureLayer = new esri.layers.FeatureLayer(featureCollection, { |
| | | mode: esri.layers.FeatureLayer.MODE_SNAPSHOT, |
| | | outFields: ["*"], |
| | | opacity: .8 |
| | | }); |
| | | //设置渲染方式 |
| | | |
| | | return featureLayer; |
| | | }, |
| | | // 获取当前时间,以及昨天现在的时间 |
| | | getTime: function getTime() { |
| | | var timestamp = Date.parse(new Date()); |
| | | |
| | | // 当前时间 |
| | | var currentTime = new Date(timestamp); |
| | | // 年 |
| | | var currentY = currentTime.getFullYear(); |
| | | // 月 |
| | | var currentM = currentTime.getMonth() + 1 < 10 ? '0' + (currentTime.getMonth() + 1) : currentTime.getMonth() + 1; |
| | | // 日 |
| | | var currentD = currentTime.getDate() < 10 ? '0' + currentTime.getDate() : currentTime.getDate(); |
| | | // 时 |
| | | var currentH = currentTime.getHours() < 10 ? '0' + currentTime.getHours() : currentTime.getHours(); |
| | | // 分 |
| | | var currentDd = currentTime.getMinutes() < 10 ? '0' + currentTime.getMinutes() : currentTime.getMinutes(); |
| | | // 明天 |
| | | var tomorrowTime = new Date(timestamp - 60 * 60 * 24 * 1000); |
| | | // 年 |
| | | var tomorrowY = tomorrowTime.getFullYear(); |
| | | // 月 |
| | | var tomorrowM = tomorrowTime.getMonth() + 1 < 10 ? '0' + (tomorrowTime.getMonth() + 1) : tomorrowTime.getMonth() + 1; |
| | | // 日 |
| | | var tomorrowD = tomorrowTime.getDate() < 10 ? '0' + tomorrowTime.getDate() : tomorrowTime.getDate(); |
| | | // 时 |
| | | var tomorrowH = tomorrowTime.getHours() < 10 ? '0' + tomorrowTime.getHours() : tomorrowTime.getHours(); |
| | | // 分 |
| | | var tomorrowDd = tomorrowTime.getMinutes() < 10 ? '0' + tomorrowTime.getMinutes() : tomorrowTime.getMinutes(); |
| | | return { |
| | | current: currentY + '-' + currentM + '-' + currentD + ' ' + currentH + ':' + currentDd, |
| | | tomorrow: tomorrowY + '-' + tomorrowM + '-' + tomorrowD + ' ' + tomorrowH + ':' + tomorrowDd, |
| | | month: currentM + currentD |
| | | }; |
| | | } |
| | | // 获取警情信息列表 |
| | | /** |
| | | * |
| | | * @param {object} dom jq对象 |
| | | * @param {string} beginTime 开始时间 |
| | | * @param {string} endTime 结束时间 |
| | | * @param {*} waringType 警情的类别 |
| | | */ |
| | | getPoliceTableAnalysis: function(dom, beginTime, endTime, waringType) { |
| | | dom.empty(); |
| | | var that = this; |
| | | $.ajax({ |
| | | url: 'http://web.byisf.com:18001/api/blade-jfpts/jingdan/jingdan/selectList', |
| | | type: 'POST', |
| | | dataType: 'JSON', |
| | | data: { |
| | | beginTime: beginTime, |
| | | endTime: endTime, |
| | | waringType: waringType |
| | | }, |
| | | success: function(data) { |
| | | var result = data.data; |
| | | var str = ''; |
| | | var lgtdOrLttd = null; |
| | | that.entitysData = []; |
| | | that.analysisAddEntitys.clear(); |
| | | for (var a, time, t, e, y, h, 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/police-situation.png'); |
| | | |
| | | |
| | | t = result[i].handleTime.substr(0, 10); |
| | | e = result[i].handleTime.substr(11); |
| | | time = t + ' ' + e; |
| | | y = result[i].handleTime.substr(5, 5); |
| | | h = result[i].handleTime.substr(11, 5); |
| | | a = Number(i) + 1; |
| | | str += '<tr term-list=' + result[i].id + '>'; |
| | | str += '<td>' + a + '</td>'; |
| | | str += '<td title=' + result[i].waringType + '>' + result[i].waringType + '</td>'; |
| | | str += '<td title=' + result[i].addvnm + '>' + result[i].addvnm + '</td>'; |
| | | str += "<td><a href='javascript:;' title=" + time + ">" + y + ' ' + h + "</a></td>"; |
| | | str += "<td class='location'> <input type='button' value='定位'" + ' lgtd=' + result[i].jd + ' lttd=' + result[i].wd + "></td>"; |
| | | str += '</tr>'; |
| | | dom.append(str); |
| | | str = ''; |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | for (var i = 0; i < 1000; i++) { |
| | | var dd = Math.random(); |
| | | var cc = Math.random(); |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | // 获取业主信息列表 |
| | | getOwnerTable: function(dom, type, dj) { |
| | | dom.empty(); |
| | | var that = this; |
| | | $.ajax({ |
| | | url: 'http://web.byisf.com:18001/api/blade-jfpts/suser/suser/selectList?type=' + type + '&dj=' + dj, |
| | | type: 'GET', |
| | | dataType: 'JSON', |
| | | success: function(data) { |
| | | var result = data.data; |
| | | var str = ''; |
| | | var lgtdOrLttd = null; |
| | | that.entitysData = []; |
| | | that.analysisAddEntitys.clear(); |
| | | for (var a, i = 0; i < result.length; i++) { |
| | | |
| | | lgtdOrLttd = result[i].coordinate.substring(6, result[i].coordinate.length - 1).split(' '); |
| | | that.createEntitysAnalysis(that.analysisAddEntitys, that.entitysData, '业主信息', { lgtd: lgtdOrLttd[0], lttd: lgtdOrLttd[1], id: result[i].id }, lgtdOrLttd[0], lgtdOrLttd[1], './images/owner.png'); |
| | | |
| | | a = Number(i) + 1; |
| | | str += "<tr term-list=" + result[i].id + ">"; |
| | | str += '<td>' + a + '</td>'; |
| | | str += '<td>' + result[i].type + '</td>'; |
| | | str += '<td>' + result[i].dj + '</td>'; |
| | | str += '<td>' + result[i].yname + '</td>'; |
| | | str += "<td class='location'> <input type='button' value='定位'" + ' lgtd=' + lgtdOrLttd[0] + ' lttd=' + lgtdOrLttd[1] + "></td>"; |
| | | str += '</tr>'; |
| | | dom.append(str); |
| | | str = ''; |
| | | } |
| | | |
| | | } |
| | | }) |
| | | }, |
| | | // 获取设备信息列表 |
| | | getEquipmentTable: function(dom, deviceType) { |
| | | dom.empty(); |
| | | var that = this; |
| | | $.ajax({ |
| | | url: 'http://web.byisf.com:18001/api/blade-jfpts/equipment/equipment/selectList?deviceType=' + deviceType, |
| | | type: 'GET', |
| | | dataType: 'JSON', |
| | | success: function(data) { |
| | | var result = data.data; |
| | | var str = ''; |
| | | var lgtdOrLttd = null; |
| | | that.entitysData = []; |
| | | that.analysisAddEntitys.clear(); |
| | | for (var a, i = 0; i < result.length; i++) { |
| | | |
| | | lgtdOrLttd = result[i].coordinate.substring(6, result[i].coordinate.length - 1).split(' '); |
| | | that.createEntitysAnalysis(that.analysisAddEntitys, that.entitysData, '设备信息', { lgtd: lgtdOrLttd[0], lttd: lgtdOrLttd[1], id: result[i].id }, lgtdOrLttd[0], lgtdOrLttd[1], './images/ceshi.png'); |
| | | |
| | | a = Number(i) + 1; |
| | | str += "<tr term-listid=" + result[i].id + ">"; |
| | | str += '<td>' + a + '</td>'; |
| | | str += '<td title=' + result[i].deviceName + '>' + result[i].deviceName + '</td>'; |
| | | str += '<td title=' + result[i].deviceType + '>' + result[i].deviceType + '</td>'; |
| | | str += '<td>' + result[i].deviceNumber + '</td>'; |
| | | str += "<td class='location'> <input type='button' value='定位'" + ' lgtd=' + lgtdOrLttd[0] + ' lttd=' + lgtdOrLttd[1] + "></td>"; |
| | | str += '</tr>'; |
| | | dom.append(str); |
| | | str = ''; |
| | | } |
| | | |
| | | |
| | | } |
| | | }) |
| | | }, |
| | | // 创建实体图层 |
| | | createEntitysAnalysis: function(entitys, entityContent, name, item, lgtd, lttd, outlineColors) { |
| | | |
| | | var symbol = new esri.symbol.PictureMarkerSymbol(outlineColors, 16, 16); |
| | | symbol.name = name; |
| | | var pt = new Point(lgtd, lttd, new SpatialReference({ wkid: 4326 })); |
| | | pt.entityData = item; |
| | | var graphic = new esri.Graphic(pt, symbol); |
| | | entitys.add(graphic); |
| | | |
| | | |
| | | entityContent.push(item); |
| | | }, |
| | | // 热力图选中执行函数 |
| | | checkBoxSelect: function(self) { |
| | | var heatmapRenderer = null; |
| | | // // return |
| | | // 选中 |
| | | if ($(self).prop('checked') == true) { |
| | | heatmapRenderer = new HeatmapRenderer({ |
| | | colorStops: [ |
| | | { ratio: 0.45, color: "rgba(000,000,255,0)" }, |
| | | { ratio: 0.55, color: "rgb(000,255,255)" }, |
| | | { ratio: 0.65, color: "rgb(000,255,000)" }, |
| | | { ratio: 0.75, color: "rgb(234,126,15)" }, |
| | | { ratio: 1.00, color: "rgb(255,000,000)" }, |
| | | ], |
| | | blurRadius: 48, |
| | | maxPixelIntensity: 184, |
| | | minPixelIntensity: 0 |
| | | }); |
| | | this.heatmapfeatureLayer_1.setRenderer(heatmapRenderer); |
| | | // 取消选中 |
| | | var point = null; |
| | | for (var i = 0; i < this.entitysData.length; i++) { |
| | | point = new esri.geometry.Point(this.entitysData[i].lgtd, this.entitysData[i].lttd, new esri.SpatialReference({ wkid: 4326 })); |
| | | this.heatmapfeatureLayer_1.add(new esri.Graphic(point)); |
| | | } |
| | | } else { |
| | | this.heatmapfeatureLayer_1.clear(); |
| | | this.heatmapfeatureLayer_1.setRenderer(); |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | // 获取业主信息列表 |
| | | getOwnerTable: function (dom, type, dj) { |
| | | dom.empty(); |
| | | var that = this; |
| | | $.ajax({ |
| | | url: 'http://web.byisf.com/api/blade-jfpts/suser/suser/selectList?type=' + type + '&dj=' + dj, |
| | | type: 'GET', |
| | | dataType: 'JSON', |
| | | success: function (data) { |
| | | var result = data.data; |
| | | var str = ''; |
| | | var lgtdOrLttd = null; |
| | | that.entitysData = []; |
| | | that.analysisAddEntitys.clear(); |
| | | for (var a, i = 0; i < result.length; i++) { |
| | | |
| | | lgtdOrLttd = result[i].coordinate.substring(6, result[i].coordinate.length - 1).split(' '); |
| | | that.createEntitysAnalysis(that.analysisAddEntitys, that.entitysData, '业主信息', { lgtd: lgtdOrLttd[0], lttd: lgtdOrLttd[1], id: result[i].id }, lgtdOrLttd[0], lgtdOrLttd[1], './images/owner.png'); |
| | | |
| | | a = Number(i) + 1; |
| | | str += "<tr term-list=" + result[i].id + ">"; |
| | | str += '<td>' + a + '</td>'; |
| | | str += '<td>' + result[i].type + '</td>'; |
| | | str += '<td>' + result[i].dj + '</td>'; |
| | | str += '<td>' + result[i].yname + '</td>'; |
| | | str += "<td class='location'> <input type='button' value='定位'" + ' lgtd=' + lgtdOrLttd[0] + ' lttd=' + lgtdOrLttd[1] + "></td>"; |
| | | str += '</tr>'; |
| | | dom.append(str); |
| | | str = ''; |
| | | } |
| | | |
| | | } |
| | | }) |
| | | }, |
| | | // 获取设备信息列表 |
| | | getEquipmentTable: function (dom, deviceType) { |
| | | dom.empty(); |
| | | var that = this; |
| | | $.ajax({ |
| | | url: 'http://web.byisf.com/api/blade-jfpts/equipment/equipment/selectList?deviceType=' + deviceType, |
| | | type: 'GET', |
| | | dataType: 'JSON', |
| | | success: function (data) { |
| | | var result = data.data; |
| | | var str = ''; |
| | | var lgtdOrLttd = null; |
| | | that.entitysData = []; |
| | | that.analysisAddEntitys.clear(); |
| | | for (var a, i = 0; i < result.length; i++) { |
| | | |
| | | lgtdOrLttd = result[i].coordinate.substring(6, result[i].coordinate.length - 1).split(' '); |
| | | that.createEntitysAnalysis(that.analysisAddEntitys, that.entitysData, '设备信息', { lgtd: lgtdOrLttd[0], lttd: lgtdOrLttd[1], id: result[i].id }, lgtdOrLttd[0], lgtdOrLttd[1], './images/ceshi.png'); |
| | | |
| | | a = Number(i) + 1; |
| | | str += "<tr term-listid=" + result[i].id + ">"; |
| | | str += '<td>' + a + '</td>'; |
| | | str += '<td title=' + result[i].deviceName + '>' + result[i].deviceName + '</td>'; |
| | | str += '<td title=' + result[i].deviceType + '>' + result[i].deviceType + '</td>'; |
| | | str += '<td>' + result[i].deviceNumber + '</td>'; |
| | | str += "<td class='location'> <input type='button' value='定位'" + ' lgtd=' + lgtdOrLttd[0] + ' lttd=' + lgtdOrLttd[1] + "></td>"; |
| | | str += '</tr>'; |
| | | dom.append(str); |
| | | str = ''; |
| | | } |
| | | |
| | | |
| | | } |
| | | }) |
| | | }, |
| | | // 创建实体图层 |
| | | createEntitysAnalysis: function (entitys, entityContent, name, item, lgtd, lttd, outlineColors) { |
| | | |
| | | var symbol = new esri.symbol.PictureMarkerSymbol(outlineColors, 16, 16); |
| | | symbol.name = name; |
| | | var pt = new Point(lgtd, lttd, new SpatialReference({ wkid: 4326 })); |
| | | pt.entityData = item; |
| | | var graphic = new esri.Graphic(pt, symbol); |
| | | entitys.add(graphic); |
| | | |
| | | |
| | | entityContent.push(item); |
| | | }, |
| | | // 热力图选中执行函数 |
| | | checkBoxSelect: function (self) { |
| | | var heatmapRenderer = null; |
| | | // // return |
| | | // 选中 |
| | | if ($(self).prop('checked') == true) { |
| | | heatmapRenderer = new HeatmapRenderer({ |
| | | colorStops: [ |
| | | { ratio: 0.45, color: "rgba(000,000,255,0)" }, |
| | | { ratio: 0.55, color: "rgb(000,255,255)" }, |
| | | { ratio: 0.65, color: "rgb(000,255,000)" }, |
| | | { ratio: 0.75, color: "rgb(234,126,15)" }, |
| | | { ratio: 1.00, color: "rgb(255,000,000)" }, |
| | | ], |
| | | blurRadius: 48, |
| | | maxPixelIntensity: 184, |
| | | minPixelIntensity: 0 |
| | | }); |
| | | this.heatmapfeatureLayer_1.setRenderer(heatmapRenderer); |
| | | // 取消选中 |
| | | var point = null; |
| | | for (var i = 0; i < this.entitysData.length; i++) { |
| | | point = new esri.geometry.Point(this.entitysData[i].lgtd, this.entitysData[i].lttd, new esri.SpatialReference({ wkid: 4326 })); |
| | | this.heatmapfeatureLayer_1.add(new esri.Graphic(point)); |
| | | } |
| | | } else { |
| | | this.heatmapfeatureLayer_1.clear(); |
| | | this.heatmapfeatureLayer_1.setRenderer(); |
| | | } |
| | | } |
| | | }); |
| | | return Widget; |
| | | }); |
| | | }); |
| | | return Widget; |
| | | }); |