From 645386bef783a5a1f2ae32f0173a6aba713703e0 Mon Sep 17 00:00:00 2001 From: wangqi <magical1908@outlook.com> Date: 星期一, 29 三月 2021 09:55:55 +0800 Subject: [PATCH] 废气点加载 --- public/static/airQuality.json | 117 +++++++++++ src/api/request.js | 21 ++ src/components/flueGas/green_airquality_2.png | 0 src/components/flueGas/green_airquality_3.png | 0 src/components/flueGas/GasComponents/GasECharts.vue | 107 ++++++++++ src/components/flueGas/flueGas.js | 176 +++++++++++++++++ src/main.js | 1 src/components/flueGas/GasComponents/GasVideo.vue | 24 ++ src/components/flueGas/popup-gas.vue | 54 +++++ src/views/MapTemplate.vue | 28 ++ src/components/flueGas/GasComponents/GasTable.vue | 46 ++++ 11 files changed, 567 insertions(+), 7 deletions(-) diff --git a/public/static/airQuality.json b/public/static/airQuality.json new file mode 100644 index 0000000..2040078 --- /dev/null +++ b/public/static/airQuality.json @@ -0,0 +1,117 @@ +{ + "Result": { + "IsSuccess": 1, + "code": 1, + "ErrorMsg": "", + "DataInfo": [ + { + "StoragePlaceId": 124.0, + "StoragePlaceName": "鑱氶啔閮ㄥ簾姘旀帓鏀剧偣", + "HazaWasteStorageDate": "0001-01-01T00:00:00", + "HazaWasteCatgrName": null, + "SurplusQuantityWarning": 0, + "LongDayWarning": 0, + "DesignFloorArea": 95.0, + "HazaWasteName": null, + "EstimateFloorArea": 0.0, + "HazaWasteDeptName": null, + "SurplusFloorArea": 95.0, + "HazaWasteStorageDays": 0.0, + "StorageQty": 0.0, + "HazaWasteStorageQty": 0.0, + "positionX": 32.214483532361875, + "positionY":118.80441341164345 + }, + { + "StoragePlaceId": 123.0, + "StoragePlaceName": "鍖栧伐閮ㄥ簾姘旀帓鏀剧偣", + "HazaWasteStorageDate": "0001-01-01T00:00:00", + "HazaWasteCatgrName": null, + "SurplusQuantityWarning": 0, + "LongDayWarning": 0, + "DesignFloorArea": 260.0, + "HazaWasteName": null, + "EstimateFloorArea": 0.0, + "HazaWasteDeptName": null, + "SurplusFloorArea": 260.0, + "HazaWasteStorageDays": 0.0, + "StorageQty": 0.0, + "HazaWasteStorageQty": 0.0, + "positionX": 32.22122596740723, + "positionY": 118.7843091583252 + }, + { + "StoragePlaceId": 127.0, + "StoragePlaceName": "鐐兼补閮ㄥ簾姘旀帓鏀剧偣", + "HazaWasteStorageDate": "0001-01-01T00:00:00", + "HazaWasteCatgrName": null, + "SurplusQuantityWarning": 0, + "LongDayWarning": 0, + "DesignFloorArea": 351.0, + "HazaWasteName": null, + "EstimateFloorArea": 0.0, + "HazaWasteDeptName": null, + "SurplusFloorArea": 351.0, + "HazaWasteStorageDays": 0.0, + "StorageQty": 0.0, + "HazaWasteStorageQty": 0.0, + "positionX": 32.232299575805664, + "positionY": 118.78950408935547 + }, + { + "StoragePlaceId": 126.0, + "StoragePlaceName": "鐑儍閮ㄥ簾姘旀帓鏀剧偣", + "HazaWasteStorageDate": "0001-01-01T00:00:00", + "HazaWasteCatgrName": null, + "SurplusQuantityWarning": 0, + "LongDayWarning": 1.0, + "DesignFloorArea": 54.0, + "HazaWasteName": null, + "EstimateFloorArea": 0.0, + "HazaWasteDeptName": null, + "SurplusFloorArea": 54.0, + "HazaWasteStorageDays": 0.0, + "StorageQty": 1.0, + "HazaWasteStorageQty": 0.0, + "positionX": 32.24092555999756, + "positionY": 118.75035759735107 + }, + { + "StoragePlaceId": 127.0, + "StoragePlaceName": "鐑數绔欏簾姘旀帓鏀剧偣", + "HazaWasteStorageDate": "0001-01-01T00:00:00", + "HazaWasteCatgrName": null, + "SurplusQuantityWarning": 0, + "LongDayWarning": 0, + "DesignFloorArea": 351.0, + "HazaWasteName": null, + "EstimateFloorArea": 0.0, + "HazaWasteDeptName": null, + "SurplusFloorArea": 351.0, + "HazaWasteStorageDays": 0.0, + "StorageQty": 0.0, + "HazaWasteStorageQty": 0.0, + "positionX": 32.21459850282962, + "positionY": 118.75664928244586 + }, + { + "StoragePlaceId": 126.0, + "StoragePlaceName": "瀹夌幆绔欏簾姘旀帓鏀剧偣", + "HazaWasteStorageDate": "0001-01-01T00:00:00", + "HazaWasteCatgrName": null, + "SurplusQuantityWarning": 0, + "LongDayWarning": 1.0, + "DesignFloorArea": 54.0, + "HazaWasteName": null, + "EstimateFloorArea": 0.0, + "HazaWasteDeptName": null, + "SurplusFloorArea": 54.0, + "HazaWasteStorageDays": 0.0, + "StorageQty": 1.0, + "HazaWasteStorageQty": 0.0, + "positionX": 32.22176451502621, + "positionY": 118.75520774508638 + } + ] + } +} diff --git a/src/api/request.js b/src/api/request.js index d623ca2..52c549f 100644 --- a/src/api/request.js +++ b/src/api/request.js @@ -1,5 +1,5 @@ import $http from '@utils/axios' - +// import axios from 'axios' // // 鍥哄簾鎺ュ彛 // export const requestSolidWaste = (url, data = {}) => { // return $http.post('./static/SolidWaste.json', data) @@ -7,3 +7,22 @@ export const requestSolidWaste = (url) => { return $http.get('./static/SolidWaste.json') } +export const FlueGas = (url) => { + return $http.get('./static/airQuality.json') +} +// export function FlueGas () { +// return axios.post('http://10.246.162.140:8080/EPInterface/DataService/EPMapService.asmx/ObtainningConInfo', { +// companyId: 3900100145, +// id: '', +// monType: 2, +// userCode: 'wenchun.deng', +// monDuration: '', +// epName: '', +// secdDeptId: '', +// contrLevel: '', +// dataStatus: '', +// dataFlag: '', +// runStatus: '', +// emissTypeId: '' +// }) +// } diff --git a/src/components/flueGas/GasComponents/GasECharts.vue b/src/components/flueGas/GasComponents/GasECharts.vue new file mode 100644 index 0000000..d6e3909 --- /dev/null +++ b/src/components/flueGas/GasComponents/GasECharts.vue @@ -0,0 +1,107 @@ +<template> + <div id="echarts" style="width:300px;height:222px" ref="main"></div> +</template> + +<script> +export default { + name: 'GasECharts', + methods: { + drawChart: function () { + const myChart = this.$echarts.init(this.$refs.main) + const option = { + title: { + text: '鎶樼嚎鍥惧爢鍙�' + }, + // color: '#fff', + tooltip: { + trigger: 'axis' + }, + legend: { + data: ['閭欢钀ラ攢', '鑱旂洘骞垮憡', '瑙嗛骞垮憡', '鐩存帴璁块棶', '鎼滅储寮曟搸'] + }, + grid: { + left: '3%', + right: '4%', + bottom: '3%', + containLabel: true + }, + toolbox: { + feature: { + saveAsImage: {} + } + }, + xAxis: { + type: 'category', + boundaryGap: false, + data: ['鍛ㄤ竴', '鍛ㄤ簩', '鍛ㄤ笁', '鍛ㄥ洓', '鍛ㄤ簲', '鍛ㄥ叚', '鍛ㄦ棩'], + axisLabel: { + textStyle: { + color: '#7edae8' // 鍧愭爣鐨勫瓧浣撻鑹� + } + }, + axisLine: { + show: false, // 闅愯棌鍧愭爣杞� + lineStyle: { + color: '#00eeff' // 鍧愭爣杞寸殑棰滆壊 + } + } + }, + yAxis: [{ + type: 'value', + axisLabel: { + textStyle: { + color: '#7edae8' // 鍧愭爣鐨勫瓧浣撻鑹� + } + }, + axisLine: { + show: false, // 闅愯棌鍧愭爣杞� + lineStyle: { + color: '#00eeff' // 鍧愭爣杞寸殑棰滆壊 + } + } + }], + series: [ + { + name: '閭欢钀ラ攢', + type: 'line', + stack: '鎬婚噺', + data: [120, 132, 101, 134, 90, 230, 210] + }, + { + name: '鑱旂洘骞垮憡', + type: 'line', + stack: '鎬婚噺', + data: [220, 182, 191, 234, 290, 330, 310] + }, + { + name: '瑙嗛骞垮憡', + type: 'line', + stack: '鎬婚噺', + data: [150, 232, 201, 154, 190, 330, 410] + }, + { + name: '鐩存帴璁块棶', + type: 'line', + stack: '鎬婚噺', + data: [320, 332, 301, 334, 390, 330, 320] + }, + { + name: '鎼滅储寮曟搸', + type: 'line', + stack: '鎬婚噺', + data: [820, 932, 901, 934, 1290, 1330, 1320] + } + ] + } + myChart.setOption(option) + } + }, + mounted () { + this.drawChart() + } +} +</script> + +<style scoped lang="less"> + +</style> diff --git a/src/components/flueGas/GasComponents/GasTable.vue b/src/components/flueGas/GasComponents/GasTable.vue new file mode 100644 index 0000000..d4f11da --- /dev/null +++ b/src/components/flueGas/GasComponents/GasTable.vue @@ -0,0 +1,46 @@ +<template> + <el-row> + <el-row> + <el-col :span="8">鐩戞祴鐐瑰悕绉�:{{name}}</el-col> + <el-col :span="8">鐢熶骇鍗曚綅:{{ DeptSname }}</el-col> + <el-col :span="8">鎺掓斁绫诲瀷鍔犺浇:{{EmissTypeName}}</el-col> + </el-row> + <el-row> + <el-col :span="8">鎺掓斁鍘诲悜:{{EmissTypeDirectName}}</el-col> + <el-col :span="8">鎺у埗绾у埆鍚嶇О:{{ContrLevelShowName}}</el-col> + <el-col :span="8">鍐�/澶栨帓鍙�:{{OrOutPortName}}</el-col> + </el-row> + </el-row> +</template> + +<script> +export default { + name: 'GasTable', + props: ['displayContent'], + data () { + return { + name: '鑱氶叝鐑獟鐐�03鐑熸皵鎺掓斁鍙�', + DeptSname: '澶ц姵鐑冭缃�', + EmissTypeName: '搴熸皵', + EmissTypeDirectName: '澶ф皵', + ContrLevelShowName: '甯傛帶', + OrOutPortName: '澶栨帓' + } + } +} +</script> + +<style scoped lang="less"> +.el-row { + color: #00d0f9; + .el-col{ + width: 240px; + height: 28px; + background-color: #243a55; + border-radius: 0.05rem; + margin: 5px; + text-align: center; + line-height: 28px; + } +} +</style> diff --git a/src/components/flueGas/GasComponents/GasVideo.vue b/src/components/flueGas/GasComponents/GasVideo.vue new file mode 100644 index 0000000..b317b1c --- /dev/null +++ b/src/components/flueGas/GasComponents/GasVideo.vue @@ -0,0 +1,24 @@ +<template> +<div> +<!-- <video>--> + <video width="100%" height="100%" controls> + <source src="movie.mp4" type="video/mp4"> + <source src="movie.ogg" type="video/ogg"> +<!-- 鎮ㄧ殑娴忚鍣ㄤ笉鏀寔 HTML5 video 鏍囩銆�--> + </video> +<!-- <span class="ico ico-sound" :class="{ active: isMute }" v-on:click="closeSoundClick()"></span>--> +<!-- <span class="ico ico-skip"></span>--> +<!-- <span class="ico ico-video" :class="{ hide: isPlay }" v-on:click="playClick()"></span>--> +<!-- </video>--> +</div> +</template> + +<script> +export default { + name: 'GasVideo' +} +</script> + +<style scoped> + +</style> diff --git a/src/components/flueGas/flueGas.js b/src/components/flueGas/flueGas.js new file mode 100644 index 0000000..ab62d6a --- /dev/null +++ b/src/components/flueGas/flueGas.js @@ -0,0 +1,176 @@ +import { FlueGas } from '@/api/request' +import defaultImg from '@components/flueGas/green_airquality_2.png' +import Setting from '@components/flueGas/green_airquality_3.png' +// 鍥剧墖 + +class AddGasHelper { + constructor (options) { + this.map = options.map + this.L = window.L + this.FlueGasLayerGroup = this.L.layerGroup().addTo(this.map) + this.FlueGasPopup = null + this.L.sgis = this.L.sgis || this.L + this.FlueGasMarkersLabels = [] + this.pulseHeighLightMarker = null + } + + // 鑾峰彇鏁版嵁 + requestData () { + FlueGas().then(res => { + console.log(res) + this.DrawFlueGasContent(res.Result.DataInfo) + }).catch(err => { + console.log(err) + }) + } + + // 鏍规嵁鑾峰彇鏁版嵁 鐢诲嚭 鍐呭 + DrawFlueGasContent (data) { + // 鍥炬爣鏍峰紡鎵╁睍 + var FlueGasIcon = this.PlueGasIcon() + + // //鍔犺浇鏁版嵁鍓嶅鏋滃瓨鍦ㄥ浘灞傜粍 閭d箞娓呴櫎鎺� + if (this.FlueGasLayerGroup) { + this.FlueGasLayerGroup.clearLayers() + } + for (let i = 0; i < data.length; i++) { + // 缁忕含搴� 浣嶇疆 + const positionX = data[i].positionX + const positionY = data[i].positionY + + // 鍒ゆ柇 缁忕含搴︿綅缃俊鎭槸鍚﹀瓨鍦� + // if (positionX != null && positionY != null) { + // 鐢ㄤ簬 鍒ゆ柇 => 鍒ゆ柇鏄惁灞曠ず鑴夊啿鏁堟灉 => temp(涓存椂) + const determineValueOne = data[i].LongDayWarning + var determineValueTwo = data[i].StorageQty + const positionArea = [positionX, positionY] + + // 鍥炬爣灞曠ず + var iconUrl = this.PlueGasIconUrl(determineValueOne, determineValueTwo, positionArea) + var Icon = new FlueGasIcon({ iconUrl: iconUrl }) + // var url = Icon.options.iconUrl + + const marker = this.L.marker([positionX, positionY], { icon: Icon }) + // const latlngs = positionArea[2] + // // 绾� + // var polyline = this.L.polyline(latlngs, { color: 'red' }).addTo(this.map) + // console.log(polyline) + marker.bindPopup(() => { + return this.FlueGasPopup.$el + }, { + className: 's-map-popup', + minWidth: 1548, + closeButton: true, + autoClose: false + }) + // 鍒掕繃鍑虹幇 灞曠ず鏁版嵁 + marker.bindTooltip(data[i].StoragePlaceName, { + permanent: true, + offset: [0, -16], + direction: 'top', + className: '' + }) + // 鐐瑰嚮 浜嬩欢 + marker.on('click', (e) => { + try { + // console.log(e) + this.EffectOfPulse(e.target.getLatLng()) + this.FlueGasPopup.setDate(data[i]) + } catch (error) { + console.log(error) + } + }) + // 璁剧疆鍐呭娣诲姞鍒板浘灞� + this.FlueGasLayerGroup.addLayer(marker) + // } + } + } + + // 鐐瑰嚮杩涜鐨� 鍐呭鐨勮缃� + SetPlueGasContent (config, containerPopup) { + this.FlueGasPopup = containerPopup + } + + // 鍥炬爣鏍峰紡鎵╁睍 => 鍏夊湀 鍥炬爣鑴夊啿 + PlueGasIcon () { + return this.L.Icon.extend({ + options: { + iconSize: [50, 50], + iconAnchor: [25, 25] + } + }) + } + + // 鏍规嵁绫诲瀷杩斿洖鍥剧墖鍔犺浇url + PlueGasIconUrl (determineValueOne, determineValueTwo, position) { + var EffectOfChange + if (determineValueOne === 1 || determineValueTwo === 1) { + EffectOfChange = defaultImg + this.EffectOfPulse(position, this.FlueGasMarkersLabels, this.pulseHeighLightMarker) + } else { + EffectOfChange = Setting + } + return EffectOfChange + } + + // 鑴夊啿鏁堟灉璁剧疆瀹炵幇 + EffectOfPulse (position, markers, layerGroup) { + // // 鍖哄垎鐩存帴鎵ц 鍜屽垽鏂墽琛岀殑涓嶅悓鍖哄埆 + var differentColor = '' + if (markers) { + differentColor = '#ff0000' + } else { + differentColor = '#98FB98' + } + // 鍧愭爣鏁版嵁锛氭姤璀︿紶杩涙潵鐨勬槸鏁扮粍 / 鐐瑰嚮浼犺繘鏉ョ殑鏄痮bject + var FinalPosition = position instanceof Array ? { + lat: position[0], + lng: position[1] + } : position + // 鎻掍欢 鏁堟灉瀹炵幇 + var pulsingIcon = this.L.icon.pulse({ + iconSize: [20, 20], + color: differentColor, + fillColor: '' + }) + if (markers) { + // markers.push(this.L.marker(FinalPosition, { icon: pulsingIcon })) + // this.L.layerGroup(markers).addLayer(layerGroup) + } else { + var picGroupMarker = new this.L.FeatureGroup() + this.L.marker(FinalPosition, { icon: pulsingIcon }).addTo(picGroupMarker) + this.pulseHeighLightMarker = picGroupMarker.addTo(this.FlueGasLayerGroup) + this.PulseCountSetting() + } + } + + PulseCountSetting () { + var HeightLightTime = 5 + var PulseNumber = 5 + const pulseinterver = setInterval(() => { + if (PulseNumber > 0) { + PulseNumber-- + } else { + this.pulseClear(pulseinterver) + PulseNumber = HeightLightTime + } + }, 1000) + } + + // 娓呴櫎 鍥惧眰 + pulseClear (pulseinterver) { + clearInterval(pulseinterver) + pulseinterver = null + + if (this.PlueGasLayerGroup) { + // this.PlueGasLayerGroup.clearLayers() + } else { + this.PlueGasLayerGroup = this.L.layerGroup().addTo(this.map) + } + if ((this.pulseHeighLightMarker)) { + this.pulseHeighLightMarker.remove() + } + } +} + +export default AddGasHelper diff --git a/src/components/flueGas/green_airquality_2.png b/src/components/flueGas/green_airquality_2.png new file mode 100644 index 0000000..ca7b11b --- /dev/null +++ b/src/components/flueGas/green_airquality_2.png Binary files differ diff --git a/src/components/flueGas/green_airquality_3.png b/src/components/flueGas/green_airquality_3.png new file mode 100644 index 0000000..d5f6a73 --- /dev/null +++ b/src/components/flueGas/green_airquality_3.png Binary files differ diff --git a/src/components/flueGas/popup-gas.vue b/src/components/flueGas/popup-gas.vue new file mode 100644 index 0000000..a883d48 --- /dev/null +++ b/src/components/flueGas/popup-gas.vue @@ -0,0 +1,54 @@ +<template> + <div v-if="!isShow" class="popupGas"> + <el-row> + <el-col :span="12"> + <el-row> + <gas-table :displayContent="displayContent"></gas-table> + </el-row> + <el-row> + <gas-e-charts></gas-e-charts> + </el-row> + </el-col> + <el-col :span="12"> + <gas-video></gas-video> + </el-col> + </el-row> + </div> +</template> + +<script> +import GasTable from '@components/flueGas/GasComponents/GasTable' +import GasECharts from '@components/flueGas/GasComponents/GasECharts' +import GasVideo from '@components/flueGas/GasComponents/GasVideo' + +export default { + name: 'popup-gas', + components: { + GasTable, + GasECharts, + GasVideo + }, + data: function () { + return { + isShow: false, + displayContent: [] + } + }, + methods: { + setDate (data) { + console.log(data) + this.displayContent = data + } + } +} +</script> + +<style scoped lang="less"> +/deep/ .popupGas { + color: #fff; + + .leaflet-popup-content-wrapper { + width: 100% !important; + } +} +</style> diff --git a/src/main.js b/src/main.js index f174d4a..e4615a1 100644 --- a/src/main.js +++ b/src/main.js @@ -21,6 +21,7 @@ Vue.use(ElementUI) Vue.prototype.$cancels = [] Vue.prototype.L = L +Vue.prototype.$echarts = echarts // 鎸傝浇echarts // 娉ㄥ唽鎸囦护7 // registerDirectives(Vue) diff --git a/src/views/MapTemplate.vue b/src/views/MapTemplate.vue index 698833c..eb3437c 100644 --- a/src/views/MapTemplate.vue +++ b/src/views/MapTemplate.vue @@ -18,6 +18,8 @@ <!-- <el-button id="map-btn" el-icon-c-scale-to-original icon="el-icon-c-scale-to-original" circle @click="isShowHidden"></el-button>--> <el-button type="primary" @click="ChangeState" class="solid-waste">鍥哄簾</el-button> <SolidContent ref="SolidWastePopup"></SolidContent> + <el-button type="primary" @click="AddGasHelper" class="flue-gas">搴熸皵</el-button> + <popup-gas ref="FlueGas"></popup-gas> </div> </template> @@ -39,7 +41,9 @@ import SolidContent from '@components/BaseNav/SolidContent' // 搴曞浘涓氬姟js閫昏緫 import AddSolidWasteHelper from '@components/BaseNav/SolidWaste' - +// 搴熸皵 +import AddGasHelper from '@components/flueGas/flueGas' +import PopupGas from '@/components/flueGas/popup-gas' export default { name: 'MapTemplate', components: { @@ -54,7 +58,8 @@ LcServiceLayer, Popup, summarySheets, - SolidContent + SolidContent, + PopupGas }, data () { return { @@ -71,19 +76,24 @@ return this.$store.state.map.config } }, + // created () { + // this.FlueGas() + // }, beforeMount () { this.$nextTick(() => { this.init() }) }, methods: { + AddGasHelper () { + const AddGas = new AddGasHelper({ map: this.map }) + AddGas.requestData() + AddGas.SetPlueGasContent(this.config, this.$refs.FlueGas) + }, ChangeState () { const AddSolidWaste = new AddSolidWasteHelper({ map: this.map }) AddSolidWaste.requestData() AddSolidWaste.SetSolidWasteContent(this.config, this.$refs.SolidWastePopup) - }, - isShowHidden () { - this.isShowBtn = !this.isShowBtn }, saveMapStatus () { window.serviceLayerHelper = this.serviceLayerHelper @@ -110,6 +120,7 @@ this.vectorLayerHelper.initVectorLayers(this.config) // this.ChangeState() + // this.AddGasHelper() this.saveMapStatus() // this.setMapObj(this.mapObj) @@ -158,7 +169,12 @@ </script> <style lang="less"> - +.flue-gas { + position:fixed; + top: 88px; + left: 180px; + z-index: 500; +} .solid-waste { position: absolute; top: 88px; -- Gitblit v1.8.0