| | |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-select |
| | | <!-- <el-select |
| | | v-model="orgId" |
| | | size="small" |
| | | placeholder="请选择" |
| | |
| | | :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 |
| | |
| | | class="buttomColorLine" |
| | | /> |
| | | <Main |
| | | v-if="dateTimes.length > 0&&formInline.city!==''" |
| | | v-if="dateTimes.length > 0" |
| | | :options="options" |
| | | :date-times="dateTimes" |
| | | :date-type="formInline.dayType" |
| | |
| | | </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' |
| | |
| | | heatmap: null, |
| | | markerClusterer: null, |
| | | orgData: [], |
| | | orgId: null, |
| | | props: { checkStrictly: true, label: 'name', value: 'id', children: 'children' }, |
| | | orgId: [], |
| | | city: '苏州', |
| | | formInline: { |
| | | city: '', |
| | |
| | | // }, |
| | | 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 () { |
| | | let dataTime = dayjs().format('YYYY-MM-DD') |
| | | // let dataTime = dayjs().format('YYYY-MM-DD') |
| | | this.getOrganizationId() |
| | | this.getData(`${dataTime} 00`) |
| | | // this.getData(`${dataTime} 00`) |
| | | }, |
| | | |
| | | destroyed () { |
| | |
| | | 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 }) |
| | |
| | | }, |
| | | // 初始化地图 |
| | | initMap () { |
| | | let zoom = 10 |
| | | if (this.formInline.cityCode === '320900') { |
| | | zoom = this.formInline.areName === 'dafengqu' ? 15 : 13 |
| | | } |
| | | var map = new AMap.Map('mapd', { |
| | | resizeEnable: true, |
| | | zooms: [1, 10], |
| | | zoom: 10, |
| | | zoomEnable: false, |
| | | zoom: zoom |
| | | }) |
| | | 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) |
| | | if (that.polygon) { |
| | | that.map.remove(that.polygon) |
| | | that.map.remove(that.districtSearch) |
| | |
| | | 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 ycPoints = { |
| | | areas: [{ // 围栏1 |
| | | rejectTexture: true, // 是否屏蔽自定义地图的纹理 |
| | | path: [[ |
| | | [120.06316306, 33.41753995999999], |
| | | [120.2617243421, 33.41753995999999], |
| | | [120.2617243421, 33.308387182], |
| | | [120.06316306, 33.308387182], |
| | | [120.06316306, 33.41753995999999] |
| | | ]] |
| | | }] |
| | | } |
| | | |
| | | var holes = result.districtList[0].boundaries |
| | | console.log('that.formInline', that.formInline) |
| | | if (that.formInline.cityCode === '320900') { |
| | | // 盐城 |
| | | |
| | | that.map.setCenter([120.16, 33.36]) |
| | | if (that.formInline.areName === 'dafengqu') { |
| | | that.map.setCenter([120.435345, 33.203704]) |
| | | ycPoints = { |
| | | areas: [{ // 围栏1 |
| | | rejectTexture: true, // 是否屏蔽自定义地图的纹理 |
| | | path: [[ [120.41615942, 33.215693], |
| | | [120.45416756599998, 33.215693], |
| | | [120.45416756599998, 33.192137742599996], |
| | | [120.41615942000003, 33.19213774259998], |
| | | [120.41615942, 33.215693] ]] |
| | | }] |
| | | } |
| | | } |
| | | pathArray.push.apply(pathArray, ycPoints.areas[0].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', // 城市边界颜色 |
| | |
| | | url: '/heatMap/query', |
| | | method: 'get', |
| | | params: { |
| | | id: this.orgId, |
| | | id: this.orgId[0], |
| | | startTime: newVal, |
| | | type: this.selectSensor.code, |
| | | form: this.formInline.dayType |
| | |
| | | if (this.heatmap === null) { |
| | | this.createHeatMap() |
| | | } |
| | | this.heatMapData = [] |
| | | this.heatMapData = res.data |
| | | this.dataProcessing(this.heatMapData) |
| | | this.heatmap.setDataSet({ |
| | | data: this.heatMapData, |
| | | max: this.selectSensor.maxNumber |
| | | }) |
| | | console.log('000', this.selectSensor.maxNumber) |
| | | console.log('1111', this.heatmap.getDataSet()) |
| | | } else { |
| | | this.map.remove(this.heatmap) |
| | | this.heatmap = null |
| | | } |
| | | }) |
| | |
| | | method: 'get' |
| | | }) |
| | | .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) |
| | | } |
| | | this.orgData = res.data.map(item => { |
| | | if (item.id === 73) { |
| | | item.children = [{ |
| | | id: 'shiqu', |
| | | name: '市区' |
| | | }, { |
| | | id: 'dafengqu', |
| | | name: '大丰区' |
| | | }] |
| | | } |
| | | return item |
| | | }) |
| | | }) |
| | | .catch(err => { |
| | | console.log(err) |
| | |
| | | }, |
| | | createHeatMap () { |
| | | let that = this |
| | | let radius = this.formInline.areName === 'shiqu' ? 100 : 100 |
| | | console.log('radius', radius) |
| | | this.map.plugin(['AMap.Heatmap'], function () { |
| | | // 初始化heatmap对象 |
| | | that.heatmap = new AMap.Heatmap(that.map, { |
| | | radius: 100, // 给定半径 |
| | | radius: radius, // 给定半径 |
| | | opacity: [0.5, 1], |
| | | gradient: that.selectSensor.gradient |
| | | }) |
| | |
| | | onSubmit () { |
| | | if (!!this.formInline.city && !!this.formInline.starTime && !!this.formInline.endTime) { |
| | | // this.map.clearMap() |
| | | |
| | | this.getDayListData() |
| | | |
| | | if (this.map) { |
| | | this.map.destroy() |
| | | } |
| | | this.initMap() |
| | | this.createHeatMap() |
| | | this.getData(this.formInline.starTime) |
| | | 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 }) |
| | | if (id === 73) { |
| | | console.log('id', id) |
| | | let cityData = _.find(this.orgData, { id: id[0] }) |
| | | if (id[0] === 73) { |
| | | if (id[1]) { |
| | | this.formInline.areName = id[1] |
| | | } |
| | | 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) { |
| | | console.log('ccccc', this.formInline) |
| | | if (data) { |
| | | this.formInline.starTime = data[0] |
| | | this.formInline.endTime = data[1] |
| | | this.getDayListData() |
| | | if (this.formInline.city) { |
| | | this.getDayListData() |
| | | } |
| | | } else { |
| | | this.formInline.starTime = '' |
| | | this.formInline.endTime = '' |