From f752f50a484f63fc3786ab1c7ad563f3b17cce77 Mon Sep 17 00:00:00 2001
From: quanyawei <401863037@qq.com>
Date: Fri, 15 Nov 2024 15:58:32 +0800
Subject: [PATCH] fix: 国控站
---
src/views/hotMap/index.vue | 755 +++++++++++++++++++++++++++++++++++++++++----------------
1 files changed, 544 insertions(+), 211 deletions(-)
diff --git a/src/views/hotMap/index.vue b/src/views/hotMap/index.vue
index ebbd572..da40f41 100644
--- a/src/views/hotMap/index.vue
+++ b/src/views/hotMap/index.vue
@@ -22,11 +22,10 @@
</el-radio-group>
</el-form-item>
<el-form-item>
- <el-select
+ <!-- <el-select
v-model="orgId"
size="small"
placeholder="���������"
- disabled
@change="regionData"
>
<el-option
@@ -35,7 +34,15 @@
:label="item.name"
:value="item.id"
/>
- </el-select>
+ </el-select> -->
+ <el-cascader
+ v-model="orgId"
+ size="small"
+ :options="orgData"
+ :props="props"
+ clearable
+ @change="regionData"
+ />
</el-form-item>
<el-form-item>
<el-radio-group
@@ -68,6 +75,13 @@
>
������
</el-button>
+ <!-- <el-button
+ class="btn"
+ style="margin-bottom: 5px"
+ @click="drawRectangle"
+ >
+ ������������
+ </el-button> -->
</el-form-item>
</el-form>
</div>
@@ -78,7 +92,7 @@
class="buttomColorLine"
/>
<Main
- v-if="dateTimes.length > 0&&formInline.city!==''"
+ v-if="dateTimes.length > 0"
:options="options"
:date-times="dateTimes"
:date-type="formInline.dayType"
@@ -89,7 +103,7 @@
</template>
<script>
-import dayjs from 'dayjs'
+// import dayjs from 'dayjs'
import _ from 'lodash'
import selectHour from './components/selectHour.vue'
import Main from './components/timeLinePlay.vue'
@@ -102,11 +116,179 @@
heatmap: null,
markerClusterer: null,
orgData: [],
- orgId: 71,
+ props: { checkStrictly: true, label: 'name', value: 'id', children: 'children' },
+ orgId: [],
city: '������',
+ selectYcLocationInfor: {},
+ ycPoints: [
+ {
+ id: 117,
+ name: '������������',
+ radius: 50,
+ centerPoint: [120.162594, 33.335508],
+ zoom: 15,
+ path: [[
+ [
+ 120.14212385147812,
+ 33.3501711960911
+ ],
+ [
+ 120.18375173538925,
+ 33.3501711960911
+ ],
+ [
+ 120.18375173538925,
+ 33.32428486558254
+ ],
+ [
+ 120.14212385147812,
+ 33.32428486558254
+ ],
+ [
+ 120.14212385147812,
+ 33.3501711960911
+ ],
+ ]]
+ },
+ {
+ id: 118,
+ name: '������������',
+ radius: 100,
+ centerPoint: [120.159189, 33.362052],
+ zoom: 15,
+ path: [[
+ [
+ 120.14180812194945,
+ 33.376155594175906
+ ],
+ [
+ 120.1767841275036,
+ 33.376155594175906
+ ],
+ [
+ 120.1767841275036,
+ 33.349560021621436
+ ],
+ [
+ 120.14180812194945,
+ 33.349560021621436
+ ],
+ [
+ 120.14180812194945,
+ 33.376155594175906
+ ]
+ ]]
+ },
+ {
+ id: 119,
+ name: '������������������',
+ zoom: 16,
+ radius: 100,
+ centerPoint: [120.216872, 33.378334],
+ path: [
+ [
+ [
+ 120.20549907401204,
+ 33.38532153338434
+ ],
+ [
+ 120.22927417472005,
+ 33.38532153338434
+ ],
+ [
+ 120.22927417472005,
+ 33.37125561579751
+ ],
+ [
+ 120.20549907401204,
+ 33.37125561579751
+ ],
+ [
+ 120.20549907401204,
+ 33.38532153338434
+ ]
+ ]
+ ]
+ },
+ {
+ id: 120,
+ name: '������������',
+ zoom: 15,
+ radius: 60,
+ centerPoint: [120.123716, 33.400926],
+ path: [[
+ [
+ 120.10800871968269,
+ 33.411207878716695
+ ],
+ [
+ 120.13839278340339,
+ 33.411207878716695
+ ],
+ [
+ 120.13839278340339,
+ 33.39053545526069
+ ],
+ [
+ 120.10800871968269,
+ 33.39053545526069
+ ]
+ ]]
+ },
+ {
+ id: 121,
+ name: '������������',
+ zoom: 16,
+ radius: 60,
+ centerPoint: [120.159868, 33.392545],
+ path: [[
+ [
+ 120.1529805980623,
+ 33.39872613771991
+ ],
+ [
+ 120.16664913520219,
+ 33.39872613771991
+ ],
+ [
+ 120.16664913520219,
+ 33.38616740820813
+ ],
+ [
+ 120.1529805980623,
+ 33.38616740820813
+ ]
+ ]]
+ },
+ {
+ id: 122,
+ name: '������������������',
+ zoom: 16,
+ radius: 100,
+ centerPoint: [120.433178, 33.203129],
+ path: [[
+ [
+ 120.42407972171901,
+ 33.21116367463085
+ ],
+ [
+ 120.4417823012173,
+ 33.21116367463085
+ ],
+ [
+ 120.4417823012173,
+ 33.196926006173
+ ],
+ [
+ 120.42407972171901,
+ 33.196926006173
+ ]
+ ]]
+ },
+ ],
formInline: {
- city: '���������',
- cityCode: '210300',
+ city: '',
+ cityCode: '',
dayType: 'hour',
starTime: '',
endTime: '',
@@ -115,109 +297,211 @@
},
selectSensor: {code: 'a34002',
name: 'PM10',
- maxNumber: 500,
src: require('@/assets/images/tl_PM10.png'),
+ colorList: [{
+ maxNumber: 50,
+ color: '#12a112'
+ }, {
+ maxNumber: 150,
+ color: '#feff01'
+ }, {
+ maxNumber: 250,
+ color: '#fd8200'
+ }, {
+ maxNumber: 350,
+ color: '#fd0001'
+ }, {
+ maxNumber: 420,
+ color: '#95014b'
+ }, {
+ maxNumber: 500,
+ color: '#7e0226'
+ }],
gradient: {
- '0': '#12a112',
- '0.1': '#12a112',
- '0.3': '#feff01',
- '0.5': '#fd8200',
- '0.7': '#fd0001',
- '0.84': '#95014b',
- '1': '#7e0226'
+ 0: '#12a112',
+ 0.1: '#12a112',
+ 0.3: '#feff01',
+ 0.5: '#fd8200',
+ 0.7: '#fd0001',
+ 0.84: '#95014b',
+ 1: '#7e0226'
}},
sensorArr: [
{ code: 'a34002',
name: 'PM10',
- maxNumber: 500,
src: require('@/assets/images/tl_PM10.png'),
+ colorList: [{
+ maxNumber: 50,
+ color: '#12a112'
+ }, {
+ maxNumber: 150,
+ color: '#feff01'
+ }, {
+ maxNumber: 250,
+ color: '#fd8200'
+ }, {
+ maxNumber: 350,
+ color: '#fd0001'
+ }, {
+ maxNumber: 420,
+ color: '#95014b'
+ }, {
+ maxNumber: 500,
+ color: '#7e0226'
+ }],
gradient: {
- '0': '#12a112',
- '0.1': '#12a112',
- '0.3': '#feff01',
- '0.5': '#fd8200',
- '0.7': '#fd0001',
- '0.84': '#95014b',
- '1': '#7e0226'
+ 0: '#12a112',
+ 0.1: '#12a112',
+ 0.3: '#feff01',
+ 0.5: '#fd8200',
+ 0.7: '#fd0001',
+ 0.84: '#95014b',
+ 1: '#7e0226'
}},
{ code: 'a34004',
name: 'PM2.5',
- maxNumber: 350,
+ colorList: [{
+ maxNumber: 35,
+ color: '#12a112'
+ }, {
+ maxNumber: 75,
+ color: '#feff01'
+ }, {
+ maxNumber: 115,
+ color: '#fd8200'
+ }, {
+ maxNumber: 150,
+ color: '#fd0001'
+ }, {
+ maxNumber: 250,
+ color: '#95014b'
+ }, {
+ maxNumber: 350,
+ color: '#7e0226'
+ }],
src: require('@/assets/images/tl_PM2.5.png'),
- gradient: {
- '0': '#12a112',
- '0.1': '#12a112',
- '0.21': '#feff01',
- '0.32': '#fd8200',
- '0.42': '#fd0001',
- '0.71': '#95014b',
- '1': '#7e0226'
- } },
+ gradient: {}
+ },
{ code: 'a21026',
name: 'SO2',
- maxNumber: 2100,
src: require('@/assets/images/tl_SO2.png'),
- gradient: {
- '0': '#12a112',
- '0.02': '#12a112',
- '0.07': '#feff01',
- '0.22': '#fd8200',
- '0.38': '#fd0001',
- '0.76': '#95014b',
- '1': '#7e0226'
- } },
+ colorList: [{
+ maxNumber: 50,
+ color: '#12a112'
+ }, {
+ maxNumber: 150,
+ color: '#feff01'
+ }, {
+ maxNumber: 475,
+ color: '#fd8200'
+ }, {
+ maxNumber: 800,
+ color: '#fd0001'
+ }, {
+ maxNumber: 1600,
+ color: '#95014b'
+ }, {
+ maxNumber: 2100,
+ color: '#7e0226'
+ }],
+ gradient: {}
+ },
{ code: 'a21004',
name: 'NO2',
- maxNumber: 750,
src: require('@/assets/images/tl_NO2.png'),
- gradient: {
- '0': '#12a112',
- '0.05': '#12a112',
- '0.1': '#feff01',
- '0.24': '#fd8200',
- '0.37': '#fd0001',
- '0.75': '#95014b',
- '1': '#7e0226'
- }},
+ colorList: [{
+ maxNumber: 40,
+ color: '#12a112'
+ }, {
+ maxNumber: 80,
+ color: '#feff01'
+ }, {
+ maxNumber: 180,
+ color: '#fd8200'
+ }, {
+ maxNumber: 280,
+ color: '#fd0001'
+ }, {
+ maxNumber: 565,
+ color: '#95014b'
+ }, {
+ maxNumber: 750,
+ color: '#7e0226'
+ }],
+ gradient: {}
+ },
{ code: 'a21005',
name: 'CO',
- maxNumber: 48,
src: require('@/assets/images/tl_CO.png'),
- gradient: {
- '0': '#12a112',
- '0.04': '#12a112',
- '0.083': '#feff01',
- '0.29': '#fd8200',
- '0.5': '#fd0001',
- '0.75': '#95014b',
- '1': '#7e0226'
- }},
+ colorList: [{
+ maxNumber: 2,
+ color: '#12a112'
+ }, {
+ maxNumber: 4,
+ color: '#feff01'
+ }, {
+ maxNumber: 14,
+ color: '#fd8200'
+ }, {
+ maxNumber: 24,
+ color: '#fd0001'
+ }, {
+ maxNumber: 36,
+ color: '#95014b'
+ }, {
+ maxNumber: 48,
+ color: '#7e0226'
+ }],
+ gradient: {}
+ },
{ code: 'a05024',
name: 'O3',
- maxNumber: 1000,
src: require('@/assets/images/tl_O3.png'),
- gradient: {
- '0': '#12a112',
- '0.16': '#12a112',
- '0.2': '#feff01',
- '0.3': '#fd8200',
- '0.4': '#fd0001',
- '0.8': '#95014b',
- '1': '#7e0226'
- } },
+ colorList: [{
+ maxNumber: 160,
+ color: '#12a112'
+ }, {
+ maxNumber: 200,
+ color: '#feff01'
+ }, {
+ maxNumber: 300,
+ color: '#fd8200'
+ }, {
+ maxNumber: 400,
+ color: '#fd0001'
+ }, {
+ maxNumber: 800,
+ color: '#95014b'
+ }, {
+ maxNumber: 1000,
+ color: '#7e0226'
+ }],
+ gradient: {}
+ },
{ code: 'a99054',
name: 'TVOC',
- maxNumber: 4,
src: require('@/assets/images/tl_TVOCNew.png'),
- gradient: {
- '0': '#12a112',
- '0.12': '#12a112',
- '0.25': '#feff01',
- '0.375': '#fd8200',
- '0.5': '#fd0001',
- '0.75': '#95014b',
- '1': '#7e0226'
- }}
+ colorList: [{
+ maxNumber: 0.5,
+ color: '#12a112'
+ }, {
+ maxNumber: 1,
+ color: '#feff01'
+ }, {
+ maxNumber: 1.5,
+ color: '#fd8200'
+ }, {
+ maxNumber: 2,
+ color: '#fd0001'
+ }, {
+ maxNumber: 3,
+ color: '#95014b'
+ }, {
+ maxNumber: 4,
+ color: '#7e0226'
+ }],
+ gradient: {}
+ }
],
heatMapData: [],
dataType: 'datetimerange',
@@ -225,6 +509,7 @@
speed: 2
},
polygon: null,
+ districtSearch: null,
dateTimes: [],
activeItem: {},
markerList: []
@@ -249,36 +534,31 @@
},
deep: true
},
- 'formInline.city': {
- handler: function (newVal, oldVal) {
- console.log('newVal', newVal === '')
- if (newVal !== '') {
- this.init1()
- if (!!this.formInline.starTime && !!this.formInline.endTime) {
- this.onSubmit()
- }
- }
- },
- deep: true
- },
+ // 'formInline.city': {
+ // handler: function (newVal, oldVal) {
+ // console.log('newVal', newVal === '')
+ // if (newVal !== '') {
+ // this.init1()
+ // if (!!this.formInline.starTime && !!this.formInline.endTime) {
+ // this.onSubmit()
+ // }
+ // }
+ // },
+ // deep: true
+ // },
activeItem: {
handler (newVal, oldVal) {
- if (this.markerList.length > 0) {
- console.log('2222', this.map.getAllOverlays('marker'))
- this.map.remove(this.markerList)
- this.markerList = []
- // this.markerClusterer = null
- }
- this.getData(newVal.name)
+
},
deep: true
}
},
+ created () {
+ },
mounted () {
- this.$nextTick(() => {
- this.initMap()
- this.createHeatMap()
- })
+ // let dataTime = dayjs().format('YYYY-MM-DD')
+ this.getOrganizationId()
+ // this.getData(`${dataTime} 00`)
},
destroyed () {
@@ -287,6 +567,29 @@
}
},
methods: {
+ drawRectangle () {
+ AMap.plugin('AMap.MouseTool', () => {
+ let mouseTool = new AMap.MouseTool(this.map)
+ mouseTool.rectangle({
+ strokeColor: 'red',
+ strokeOpacity: 0.5,
+ strokeWeight: 6,
+ fillColor: 'blue',
+ fillOpacity: 0.5,
+ // strokeStyle��������� solid
+ strokeStyle: 'solid',
+ // strokeDasharray: [30,10],
+ })
+ mouseTool.on('draw', function (event) {
+ // event.obj ���������������������������������
+ let data = event.obj.getPath()
+ let allpoint = []
+ data.forEach(item => {
+ allpoint.push([item.R, item.Q])
+ })
+ })
+ })
+ },
download () {
const ref = this.$refs.content // ������������
html2canvas(ref, {
@@ -302,50 +605,65 @@
})
},
getDateFun (item) {
- console.log(item)
this.activeItem = item
+ if (this.orgId.length > 0) {
+ this.getData(item.name)
+ }
},
getPollutant (data) {
this.selectSensor = _.find(this.sensorArr, { name: data })
+ this.dateTimes = []
if (this.heatmap) {
this.map.remove(this.heatmap)
this.heatmap = null
}
- console.log('this.heatmap', this.heatmap)
},
// ���������������
initMap () {
var map = new AMap.Map('mapd', {
resizeEnable: true,
- zooms: [10, 10],
- zoom: 10,
+ zoomEnable: false,
+ zoom: this.formInline.cityCode === '320900' ? this.selectYcLocationInfor.zoom : 10
})
this.map = map
+ map.on('click', function (e) {
+ console.log('e.lnglat.getLng() + ', ' + e.lnglat.getLat()', e.lnglat.getLng() + ',' + e.lnglat.getLat())
+ })
this.init1()
// let that = this
},
init1 () { // ������������
var that = this
- this.map.setCity(this.formInline.city)
- console.log('this.formInline.city', this.formInline.cityCode)
+
if (that.polygon) {
that.map.remove(that.polygon)
+ that.map.remove(that.districtSearch)
+ that.polygon = null
+ that.districtSearch = null
}
- console.log('that.polygon', that.polygon)
- AMap.plugin('AMap.DistrictSearch', function () {
+ this.districtSearch = AMap.plugin('AMap.DistrictSearch', function () {
new AMap.DistrictSearch({
extensions: 'all',
subdistrict: 0
- }).search(that.formInline.city, function (status, result) { // ���������������������������������������������������
- var outer = [
+ }).search(that.formInline.cityCode, function (status, result) { // ���������������������������������������������������
+ let outer = [
new AMap.LngLat(-360, 90, true),
new AMap.LngLat(-360, -90, true),
new AMap.LngLat(360, -90, true),
new AMap.LngLat(360, 90, true)
]
- var holes = result.districtList[0].boundaries
- var pathArray = [outer]
- pathArray.push.apply(pathArray, holes)
+ let pathArray = [outer]
+ let holes = result.districtList[0].boundaries
+ if (that.formInline.cityCode === '320900') {
+ // ������
+ let locationInfor = _.find(that.ycPoints, { id: that.formInline.areName })
+ that.map.setCenter(locationInfor.centerPoint)
+ pathArray.push.apply(pathArray, locationInfor.path)
+ } else {
+ pathArray.push.apply(pathArray, holes)
+ that.map.setCity(that.formInline.city)
+ }
+ // pathArray.push.apply(pathArray, holes)
that.polygon = new AMap.Polygon({
pathL: pathArray,
strokeColor: 'red', // ������������������
@@ -363,8 +681,9 @@
url: '/heatMap/query',
method: 'get',
params: {
- id: this.orgId,
+ id: this.orgId[0],
startTime: newVal,
+ monitorId: this.formInline.areName,
type: this.selectSensor.code,
form: this.formInline.dayType
}
@@ -374,15 +693,11 @@
if (this.heatmap === null) {
this.createHeatMap()
}
- this.heatMapData = []
this.heatMapData = res.data
- this.heatmap.setDataSet({
- data: this.heatMapData,
- max: this.selectSensor.maxNumber
- })
- console.log('000', this.map.getZoom())
- console.log('1111', this.heatmap.getDataSet())
+
+ this.dataProcessing(this.heatMapData)
} else {
+ this.map.remove(this.heatmap)
this.heatmap = null
}
})
@@ -390,79 +705,78 @@
console.log(err)
})
},
+ findMaxNumberForValue (value, colorList) {
+ let matchedMaxItem = null
+ for (let item of colorList) {
+ if (value <= item.maxNumber) {
+ matchedMaxItem = item
+ break // ���������������������
+ }
+ }
+ return matchedMaxItem
+ },
+ getGradientOption (matchedMaxItem) {
+ let gradient = {}
+ this.selectSensor.colorList.forEach(item => {
+ if (item.maxNumber <= matchedMaxItem.maxNumber) {
+ console.log('item', item)
+ let key = (item.maxNumber / matchedMaxItem.maxNumber).toFixed(1)
+ gradient[key] = item.color
+ }
+ }
+ )
+
+ let keysArray = Object.keys(gradient)
+ let valuesArray = Object.values(gradient)
+ console.log('keysArray', keysArray, valuesArray)
+ let obj = {}
+ keysArray.forEach((item, index) => {
+ console.log(item, index, parseInt(item))
+ if (Number(item) !== 1) {
+ obj[Number(item)] = valuesArray[index]
+ if (Number(item) + 0.1 < keysArray[index + 1]) {
+ obj[Number(item) + 0.1] = valuesArray[index + 1]
+ }
+ } else {
+ obj[Number(item)] = valuesArray[index]
+ }
+ })
+ obj[0] = '#12a112'
+ return obj
+ },
+ dataProcessing (heatMapData) {
+ // ���������������
+ const max = heatMapData.reduce((prev, current) => (prev.count > current.count ? prev : current)).count
+ let matchedMaxItem = this.findMaxNumberForValue(max, this.selectSensor.colorList)
+ let gradient = this.getGradientOption(matchedMaxItem)
+ this.heatmap.setDataSet({
+ data: this.heatMapData,
+ max: matchedMaxItem.maxNumber
+ })
+ this.heatmap.setOptions({
+ gradient: gradient
+ })
+ },
// ���������
setMarkers (curData) {
- curData.forEach((item, index) => {
- let div = document.createElement('div')
- let bgColor = 'hsla(180, 100%, 50%, 0.7)'
- let fontColor = '#000'
- let borderColor = 'hsl(180, 100%, 40%)'
- let shadowColor = 'hsl(180, 100%, 50%)'
- div.id = 'pint' + index
- div.style.backgroundColor = bgColor
- let size = 40
- div.style.width = div.style.height = size + 'px'
- div.style.border = 'solid 1px ' + borderColor
- div.style.borderRadius = size / 2 + 'px'
- div.style.boxShadow = '0 0 1px ' + shadowColor
- div.innerHTML = Math.floor(Number(item.count))
- div.style.lineHeight = size + 'px'
- div.style.color = fontColor
- div.style.fontSize = '14px'
- div.style.textAlign = 'center'
- let marker = new AMap.Marker({
- position: [item.lng, item.lat],
- title: item.name,
- extData: Math.floor(Number(item.count)),
- anchor: 'center',
- // ��� html ������ content
- content: div,
- // ��� icon ��� [center bottom] ���������
- offset: new AMap.Pixel(3, 10)
+ let markerList = []
+ curData.forEach(item => {
+ // let marker = new AMap.Marker({
+ // position: new AMap.LngLat(item.lng, item.lat), // ������������������������������������������������������������[116.39, 39.9]
+ // title: item.name,
+ // })
+ let marker = new AMap.Text({
+ text: item.name, // ���������������������������
+ anchor: 'center', // ������������������������������
+ draggable: false, // ���������������
+ cursor: 'pointer', // ���������������������������������������
+ angle: 10, // ������������������������
+
+ position: [item.lng, item.lat], // ������������������������������������
})
- this.markerList.push(marker)
+ markerList.push(marker)
})
- this.map.add(this.markerList)
- var count = this.markerList.length
- // eslint-disable-next-line no-new
- if (this.markerClusterer) {
- this.markerClusterer.clearMarkers()
- }
- let that = this
- AMap.plugin('AMap.MarkerClusterer', function () {
- that.markerClusterer = new AMap.MarkerClusterer(that.map, that.markerList, {
- gridSize: 100,
- renderClusterMarker: function (context) {
- let contNumber = 0
- context.markers.forEach((item, index) => {
- console.log('indexitem', index, item.getExtData())
- contNumber += item.getExtData()
- })
- console.log('contNumber', contNumber)
- let factor = Math.pow(context.count / count, 1 / 18)
- let div = document.createElement('div')
- let Hue = 180 - factor * 180
- let bgColor = 'hsla(' + Hue + ',100%,50%,0.7)'
- let fontColor = 'hsla(' + Hue + ',100%,20%,1)'
- let borderColor = 'hsla(' + Hue + ',100%,40%,1)'
- let shadowColor = 'hsla(' + Hue + ',100%,50%,1)'
- div.style.backgroundColor = bgColor
- let size = Math.round(30 + Math.pow(context.count / count, 1 / 5) * 20)
- div.style.width = div.style.height = size + 'px'
- div.style.border = 'solid 1px ' + borderColor
- div.style.borderRadius = size / 2 + 'px'
- div.style.boxShadow = '0 0 1px ' + shadowColor
- div.innerHTML = contNumber
- div.style.lineHeight = size + 'px'
- div.style.color = fontColor
- div.style.fontSize = '14px'
- div.style.textAlign = 'center'
- context.marker.setOffset(new AMap.Pixel(-size / 2, -size / 2))
- context.marker.setContent(div)
- console.log('context.marker----------------', context.marker)
- }
- })
- })
+ this.map.add(markerList)
},
getDayListData () {
this.$request({
@@ -487,7 +801,12 @@
method: 'get'
})
.then(res => {
- this.orgData = res.data
+ this.orgData = res.data.map(item => {
+ if (item.id === 73) {
+ item.children = this.ycPoints
+ }
+ return item
+ })
})
.catch(err => {
console.log(err)
@@ -495,22 +814,28 @@
},
createHeatMap () {
let that = this
+ // let radius = this.formInline.cityCode === '320900' ? this.selectYcLocationInfor.radius : 100
this.map.plugin(['AMap.Heatmap'], function () {
// ���������heatmap������
that.heatmap = new AMap.Heatmap(that.map, {
- radius: 100, // ������������
- opacity: [0.5, 1],
- gradient: that.selectSensor.gradient
+ radius: 100, // ���������
+ opacity: [0.5, 0.5]
})
})
},
onSubmit () {
if (!!this.formInline.city && !!this.formInline.starTime && !!this.formInline.endTime) {
- this.map.clearMap()
+ // this.map.clearMap()
+
this.getDayListData()
+
+ if (this.map) {
+ this.map.destroy()
+ }
+ this.initMap()
+ this.createHeatMap()
this.getData(this.formInline.starTime)
- this.init1()
// this.map.setZoom(12)
} else {
this.$message({
@@ -522,19 +847,27 @@
}
},
regionData (id) {
- let cityData = _.find(this.orgData, { id: id })
- this.formInline.city = cityData.cityName
- this.formInline.cityCode = cityData.cityCode
+ let cityData = _.find(this.orgData, { id: id[0] })
+ if (id[0] === 73) {
+ if (id[1]) {
+ this.formInline.areName = id[1]
+ }
+ this.selectYcLocationInfor = _.find(this.ycPoints, { id: id[1] })
+ this.formInline.city = cityData.cityName
+ this.formInline.cityCode = String(cityData.cityCode)
+ } else {
+ this.formInline.areName = ''
+ this.formInline.city = cityData.areaName
+ this.formInline.cityCode = String(cityData.areaCode)
+ }
},
selectHourData (data) {
if (data) {
this.formInline.starTime = data[0]
this.formInline.endTime = data[1]
- console.log('selectHourData', data)
- let dataTime = dayjs().format('YYYY-MM-DD')
- this.getOrganizationId()
- this.getDayListData()
- this.getData(`${dataTime} 00`)
+ if (this.formInline.city) {
+ this.getDayListData()
+ }
} else {
this.formInline.starTime = ''
this.formInline.endTime = ''
--
Gitblit v1.8.0