| | |
| | | v-model="orgId" |
| | | size="small" |
| | | placeholder="请选择" |
| | | disabled |
| | | @change="regionData" |
| | | > |
| | | <el-option |
| | |
| | | heatmap: null, |
| | | markerClusterer: null, |
| | | orgData: [], |
| | | orgId: 71, |
| | | orgId: null, |
| | | city: '苏州', |
| | | formInline: { |
| | | city: '海城市', |
| | | cityCode: '210381', |
| | | city: '', |
| | | cityCode: '', |
| | | dayType: 'hour', |
| | | starTime: '', |
| | | endTime: '', |
| | |
| | | speed: 2 |
| | | }, |
| | | polygon: null, |
| | | districtSearch: null, |
| | | dateTimes: [], |
| | | activeItem: {}, |
| | | markerList: [] |
| | |
| | | }, |
| | | 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) { |
| | |
| | | deep: true |
| | | } |
| | | }, |
| | | created () { |
| | | }, |
| | | mounted () { |
| | | let dataTime = dayjs().format('YYYY-MM-DD') |
| | | this.getOrganizationId() |
| | | this.getData(`${dataTime} 00`) |
| | | this.$nextTick(() => { |
| | | this.initMap() |
| | | this.createHeatMap() |
| | | }) |
| | | }, |
| | | |
| | | destroyed () { |
| | |
| | | initMap () { |
| | | var map = new AMap.Map('mapd', { |
| | | resizeEnable: true, |
| | | zooms: [10, 10], |
| | | zooms: [1, 10], |
| | | zoom: 10, |
| | | }) |
| | | this.map = map |
| | |
| | | init1 () { // 区域遮盖 |
| | | var that = this |
| | | this.map.setCity(this.formInline.city) |
| | | console.log('海城', 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 |
| | |
| | | } |
| | | this.heatMapData = [] |
| | | this.heatMapData = res.data |
| | | this.dataProcessing() |
| | | this.dataProcessing(this.heatMapData) |
| | | this.heatmap.setDataSet({ |
| | | data: this.heatMapData, |
| | | max: this.selectSensor.maxNumber |
| | |
| | | console.log(err) |
| | | }) |
| | | }, |
| | | dataProcessing () { |
| | | dataProcessing (heatMapData) { |
| | | // 获取最大值 |
| | | const max = this.heatMapData.reduce((prev, current) => (prev.count > current.count ? prev : current)).count |
| | | console.log('this.heatMapData', this.heatMapData) |
| | | const max = heatMapData.reduce((prev, current) => (prev.count > current.count ? prev : current)).count |
| | | |
| | | // so2 |
| | | if (this.selectSensor.code === 'a21026') { |
| | | if (max > 150 && max <= 475) { |
| | |
| | | }) |
| | | .then(res => { |
| | | this.orgData = res.data |
| | | let cityData = _.find(this.orgData, { id: this.orgId }) |
| | | if (this.orgId === 73) { |
| | | this.formInline.city = cityData.cityName |
| | | this.formInline.cityCode = String(cityData.cityCode) |
| | | } else { |
| | | this.formInline.city = cityData.areaName |
| | | this.formInline.cityCode = String(cityData.areaCode) |
| | | } |
| | | }) |
| | | .catch(err => { |
| | | console.log(err) |
| | |
| | | // this.map.clearMap() |
| | | this.getDayListData() |
| | | this.getData(this.formInline.starTime) |
| | | // this.init1() |
| | | this.$nextTick(() => { |
| | | if (this.map) { |
| | | this.map.destroy() |
| | | } |
| | | this.initMap() |
| | | this.createHeatMap() |
| | | }) |
| | | // this.map.setZoom(12) |
| | | } else { |
| | | this.$message({ |
| | |
| | | }, |
| | | regionData (id) { |
| | | let cityData = _.find(this.orgData, { id: id }) |
| | | this.formInline.city = cityData.areaName |
| | | this.formInline.cityCode = cityData.areaCode |
| | | if (id === 73) { |
| | | this.formInline.city = cityData.cityName |
| | | this.formInline.cityCode = String(cityData.cityCode) |
| | | } else { |
| | | this.formInline.city = cityData.areaName |
| | | this.formInline.cityCode = String(cityData.areaCode) |
| | | } |
| | | console.log('cityData', cityData) |
| | | }, |
| | | selectHourData (data) { |
| | | if (data) { |