From 8a4c97660ea09d838af36fd4ed99b6a2b70f0f74 Mon Sep 17 00:00:00 2001 From: zhangshuaibao <15731629597@163.com> Date: 星期四, 25 三月 2021 15:22:53 +0800 Subject: [PATCH] Merge branch 'develop' of http://xearth.cn:6600/r/wuyushui/SewerAndRainNetwork into develop --- src/components/BaseNav/style.css | 4 src/api/request.js | 9 src/components/BaseNav/Pulse.css | 34 + src/components/BaseNav/SolidWasteExtend.js | 363 +++++++++++++++++++ public/static/SolidWaste.json | 81 ++++ src/components/BaseNav/Pulse.js | 77 ++++ src/views/MapTemplate.vue | 30 + src/components/BaseNav/voc.png | 0 src/Sgis.js | 23 src/components/BaseNav/magicMarker.png | 0 src/components/BaseNav/directive.js | 132 ++++++ src/utils/axios.js | 23 src/components/BaseNav/SolidWaste.js | 175 +++++++++ src/assets/airQuality.json | 10 src/components/BaseNav/SolidContent.vue | 53 ++ src/components/BaseNav/SolidWasteTable.vue | 69 +++ 16 files changed, 1,061 insertions(+), 22 deletions(-) diff --git a/public/static/SolidWaste.json b/public/static/SolidWaste.json new file mode 100644 index 0000000..3a16382 --- /dev/null +++ b/public/static/SolidWaste.json @@ -0,0 +1,81 @@ +{ + "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.22118377685547, + "positionY": 118.78057479858398 + }, + { + "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.23122596740723, + "positionY": 118.7743091583252 + }, + { + "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.222299575805664, + "positionY": 118.74950408935547 + }, + { + "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.23092555999756, + "positionY": 118.75735759735107 + } + ] + } +} diff --git a/src/Sgis.js b/src/Sgis.js index cbc3d10..f908709 100644 --- a/src/Sgis.js +++ b/src/Sgis.js @@ -1,22 +1,28 @@ import BasemapHelper from '@components/helpers/BasemapHelper' import VectorLayerHelper from '@components/helpers/VectorLayerHelper' +// 鍒濆鍖栨樉绀� import ServiceLayerHelper from '@components/helpers/ServiceLayerHelper' + import '@components/plugin/PathDrag' -// import MagicMarker from '@components/plugin/MagicMarker' -// import WmtsSupport from '@components/plugin/wmts_plugins' import MapConfig from '@/conf/MapConfig' import '@components/plugin/PathDashFlow' // 娴佸姩绾垮浘 -// import CanvasMarkers from '@components/plugin/CanvasMarkers' -// import FullScreen from '@components/plugin/FullScreen' import DownLoad from '@components/plugin/DownLoad' // 娴嬮噺 import '@components/plugin/leaflet-measure-path/leaflet-measure-path' import 'leaflet.markercluster' -// import 'leaflet-canvas-markers' import './components/plugin/Leaflet.GridLayer.FadeOut' // 鐡︾墖鍥惧眰鍒囨崲娣″叆娣″嚭 import './components/plugin/leaflet-canvas-markers' // 鐢诲竷marker import './components/plugin/Editable' // 鏍囩粯鎿嶄綔 +import './components/plugin/MagicMarker' // 鍔ㄧ敾Marker +import './assets/css/map/magic.min.css' // 鍔ㄧ敾Marker css +import './components/BaseNav/Pulse' +import './components/BaseNav/Pulse.css' + +// import WmtsSupport from '@components/plugin/wmts_plugins' +// import CanvasMarkers from '@components/plugin/CanvasMarkers' +// import FullScreen from '@components/plugin/FullScreen' +// import 'leaflet-canvas-markers' let map = null const L = window.L @@ -35,8 +41,8 @@ // 鍏ㄥ睆 // FullScreen.init(L) // 涓嬭浇 - DownLoad.init(L) // LeafletMeasurePath.init(L) + DownLoad.init(L) map = L.map(div, MapConfig.mapOptions) @@ -46,7 +52,11 @@ window.map = map window.L = L + + // L.sgis = L.sgis || L + initTileLayersHelper(map) + return map } @@ -68,7 +78,6 @@ var serviceLayerHelper = new ServiceLayerHelper({ map }) return serviceLayerHelper } - /** * 鐭㈤噺鍦板浘鍒濆鍖� * @param map diff --git a/src/api/request.js b/src/api/request.js new file mode 100644 index 0000000..d623ca2 --- /dev/null +++ b/src/api/request.js @@ -0,0 +1,9 @@ +import $http from '@utils/axios' + +// // 鍥哄簾鎺ュ彛 +// export const requestSolidWaste = (url, data = {}) => { +// return $http.post('./static/SolidWaste.json', data) +// } +export const requestSolidWaste = (url) => { + return $http.get('./static/SolidWaste.json') +} diff --git a/src/assets/airQuality.json b/src/assets/airQuality.json new file mode 100644 index 0000000..3029b49 --- /dev/null +++ b/src/assets/airQuality.json @@ -0,0 +1,10 @@ +{"type":"FeatureCollection", "features": [ + {"type":"Feature","geometry":{"type":"Point","coordinates":["38.8381779195697","117.410229850655"]},"properties":{"name":"姘村姟绔�","ID":2,"cameraIds":"12010254001310000010","online":"8ae64ac4638cbf3e016439d4a6ad0006","addr":"浣嶄簬鍏徃瑗垮寳鍘傜晫姘村姟閮ㄥ寲宸ュ巶闄㈠唴","desc":"","dept":"姘村姟閮�"}}, + {"type":"Feature","geometry":{"type":"Point","coordinates":["38.82248319987435","117.43366062641144"]},"properties":{"name":"鐑儍鍖楃珯","ID":3,"cameraIds":"12010254001310000015","online":"8ae64ac4638cbf3e016439dc12490009","addr":"浣嶄簬鐑儍閮ㄥ寳鍘傜晫","desc":"","dept":"鐑儍閮�"}}, + {"type":"Feature","geometry":{"type":"Point","coordinates":["38.84116530418396","117.42481470108032"]},"properties":{"name":"鐗╄绔�","ID":4,"cameraIds":"12010254001310000012","online":"8ae64ac4638cbf3e016439d45f5a0005","addr":"浣嶄簬鍏徃涓滃寳鍘傜晫鐗╄閮ㄦ闂ㄥ","desc":"","dept":"鐗╄閮�"}}, + {"type":"Feature","geometry":{"type":"Point","coordinates":["38.80886547541369","117.42767179031944"]},"properties":{"name":"鐑儍鍗楃珯","ID":5,"cameraIds":"12010254001310000011","online":"8ae64ac4638cbf3e016439d560ea0008","addr":"浣嶄簬鐑儍閮ㄥ崡鍘傜晫","desc":"","dept":"鐑儍閮�"}}, + {"type":"Feature","geometry":{"type":"Point","coordinates":["38.8332098722457","117.447918949615"]},"properties":{"name":"鐢熸椿鍖虹珯","ID":6,"cameraIds":"12010254001310000013","online":"8ae64ac4638cbf3e016439dd4963000a","addr":"浣嶄簬鍏徃鍩硅涓績闄㈠唴","desc":"","dept":"鐢熸椿鍖�"}}, + {"type":"Feature","geometry":{"type":"Point","coordinates":["38.8314127922058","117.427905955039"]},"properties":{"name":"瀹夌幆绔�","ID":7,"cameraIds":"12010254001310000014","online":"8ae64ac4638cbf3e016439de9875000c","addr":"浣嶄簬鍏徃涓滃巶鐣屽師鍩硅涓績闄㈠唴","desc":"","dept":"瀹夊叏鐜繚閮�"}}, + {"type":"Feature","geometry":{"type":"Point","coordinates":["38.82397315436005","117.39679098129272"]},"properties":{"name":"鐐兼补绔�","ID":8,"cameraIds":"12010254001310000009","online":"8ae64ac4638cbf3e016439de2af2000b","addr":"浣嶄簬鍏徃瑗垮崡鍘傜晫鐐兼补閮ㄨタ鍗椾晶","desc":"","dept":"鐐兼补閮�"}}, + {"type":"Feature","geometry":{"type":"Point","coordinates":["38.82355982342607","117.421976923697"]},"properties":{"name":"鐑數绔�","ID":9,"cameraIds":"12010254001310000016","online":"8ae64ac4638cbf3e016439d4f1080007","addr":"浣嶄簬鍏徃涓滃崡鍘傜晫鐑數閮ㄥ寳闂�","desc":"","dept":"鐑數閮�"}} +]} diff --git a/src/components/BaseNav/Pulse.css b/src/components/BaseNav/Pulse.css new file mode 100644 index 0000000..aed198f --- /dev/null +++ b/src/components/BaseNav/Pulse.css @@ -0,0 +1,34 @@ +.leaflet-pulsing-icon { + border-radius: 100%; + box-shadow: 1px 1px 8px 0 rgba(0,0,0,0.75); +} + +.leaflet-pulsing-icon:after { + content: ""; + border-radius: 100%; + height: 300%; + width: 300%; + position: absolute; + margin: -100% 0 0 -100%; + +} + +@keyframes pulsate { + 0% { + transform: scale(0.1, 0.1); + opacity: 0; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; + filter: alpha(opacity=0); + } + 50% { + opacity: 1; + -ms-filter: none; + filter: none; + } + 100% { + transform: scale(1.2, 1.2); + opacity: 0; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; + filter: alpha(opacity=0); + } +} diff --git a/src/components/BaseNav/Pulse.js b/src/components/BaseNav/Pulse.js new file mode 100644 index 0000000..57ef679 --- /dev/null +++ b/src/components/BaseNav/Pulse.js @@ -0,0 +1,77 @@ +/* eslint-disable */ +(function (window) { + + L.Icon.Pulse = L.DivIcon.extend({ + + options: { + className: '', + iconSize: [12, 12], + fillColor: 'red', + color: 'red', + animate: true, + heartbeat: 1, + }, + + initialize: function (options) { + L.setOptions(this, options) + + // css + + var uniqueClassName = 'lpi-' + new Date().getTime() + '-' + Math.round(Math.random() * 100000) + + var before = ['background-color: ' + this.options.fillColor] + var after = [ + + 'box-shadow: 0 0 6px 2px ' + this.options.color, + + 'animation: pulsate ' + this.options.heartbeat + 's ease-out', + 'animation-iteration-count: infinite', + 'animation-delay: ' + (this.options.heartbeat + .1) + 's', + ] + + if (!this.options.animate) { + after.push('animation: none') + after.push('box-shadow:none') + } + + var css = [ + '.' + uniqueClassName + '{' + before.join(';') + ';}', + '.' + uniqueClassName + ':after{' + after.join(';') + ';}', + ].join('') + + var el = document.createElement('style') + if (el.styleSheet) { + el.styleSheet.cssText = css + } else { + el.appendChild(document.createTextNode(css)) + } + + document.getElementsByTagName('head')[0].appendChild(el) + + // apply css class + + this.options.className = this.options.className + ' leaflet-pulsing-icon ' + uniqueClassName + + // initialize icon + + L.DivIcon.prototype.initialize.call(this, options) + + } + }) + + L.icon.pulse = function (options) { + return new L.Icon.Pulse(options) + } + + L.Marker.Pulse = L.Marker.extend({ + initialize: function (latlng, options) { + options.icon = L.icon.pulse(options) + L.Marker.prototype.initialize.call(this, latlng, options) + } + }) + + L.marker.pulse = function (latlng, options) { + return new L.Marker.Pulse(latlng, options) + } + +})(window) diff --git a/src/components/BaseNav/SolidContent.vue b/src/components/BaseNav/SolidContent.vue new file mode 100644 index 0000000..ab6fbf0 --- /dev/null +++ b/src/components/BaseNav/SolidContent.vue @@ -0,0 +1,53 @@ +<template> + <div class="solid-content"> + <div class="content-left"> + <span>{{ displayContent.StoragePlaceName }}</span> + </div> + <div class="content-right"> + <SolidWasteTable :displayContent="displayContent"></SolidWasteTable> + </div> + </div> +</template> + +<script> + +import SolidWasteTable from '@components/BaseNav/SolidWasteTable' + +export default { + name: 'SolidContent', + components: { SolidWasteTable }, + data () { + return { + displayContent: [] + } + }, + methods: { + setDate (data) { + // console.log(data) + this.displayContent = data + } + } +} +</script> + +<style lang="less" scoped> +span { + font-size: 22px; + color: red; +} + +.solid-content { + width: 100%; + display: flex; + align-items: center; + justify-content: space-around; + + .content-left { + width: 35%; + } + + .content-right { + width: 60%; + } +} +</style> diff --git a/src/components/BaseNav/SolidWaste.js b/src/components/BaseNav/SolidWaste.js new file mode 100644 index 0000000..a32b0bb --- /dev/null +++ b/src/components/BaseNav/SolidWaste.js @@ -0,0 +1,175 @@ +import { requestSolidWaste } from '@/api/request' +// 灞曠ず鍥剧墖 +import defaultImg from '@components/BaseNav/magicMarker.png' +import Setting from '@components/BaseNav/voc.png' + +// 搴曞浘涓氬姟灞曠ず鐐� +class AddSolidWasteHelper { + constructor (options) { + this.map = options.map + this.L = window.L + this.SolidWasteLayerGroup = this.L.layerGroup().addTo(this.map) + this.SolidWastePopup = null + this.L.sgis = this.L.sgis || this.L + this.solidWasteMarkersLabels = [] + this.pulseHeighLightMarker = null + } + + // 璇锋眰鏁版嵁 data 涓哄弬鏁帮紝 璇锋眰鍚庡彴鏁版嵁鏃� 鎼哄甫data鍙傛暟 + requestData () { + requestSolidWaste().then(res => { + // console.log(res) + this.DrawTheSolidWasteContent(res.Result.DataInfo) + }).catch(err => { + console.log(err) + }) + } + + // 鏍规嵁鑾峰彇鏁版嵁 鐢诲嚭 鍐呭 + DrawTheSolidWasteContent (data) { + // 鍥炬爣鏍峰紡鎵╁睍 + var SolidWasteIcon = this.SolidWasteIcon() + + // //鍔犺浇鏁版嵁鍓嶅鏋滃瓨鍦ㄥ浘灞傜粍 閭d箞娓呴櫎鎺� + if (this.SolidWasteLayerGroup) { + this.SolidWasteLayerGroup.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.SolidWasteIconUrl(determineValueOne, determineValueTwo, positionArea) + var Icon = new SolidWasteIcon({ iconUrl: iconUrl }) + // var url = Icon.options.iconUrl + + const marker = this.L.marker([positionX, positionY], { icon: Icon }) + + marker.bindPopup(() => { + return this.SolidWastePopup.$el + }, { + className: 's-map-popup', + minWidth: 600, + 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.SolidWastePopup.setDate(data[i]) + } catch (error) { + console.log(error) + } + }) + // 璁剧疆鍐呭娣诲姞鍒板浘灞� + this.SolidWasteLayerGroup.addLayer(marker) + // } + } + } + + // 鍥哄簾鐐瑰嚮杩涜鐨� 鍐呭鐨勮缃� + SetSolidWasteContent (config, containerPopup) { + this.SolidWastePopup = containerPopup + } + + // 鍥炬爣鏍峰紡鎵╁睍 => 鍏夊湀 鍥炬爣鑴夊啿 + SolidWasteIcon () { + return this.L.Icon.extend({ + options: { + iconSize: [50, 50], + iconAnchor: [25, 25] + } + }) + } + + // 鏍规嵁绫诲瀷杩斿洖鍥剧墖鍔犺浇url + SolidWasteIconUrl (determineValueOne, determineValueTwo, position) { + var EffectOfChange + if (determineValueOne === 1 || determineValueTwo === 1) { + EffectOfChange = defaultImg + this.EffectOfPulse(position, this.solidWasteMarkersLabels, this.SolidWasteLayerGroup) + } 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.SolidWasteLayerGroup) + this.PulseCountSetting() + } + } + + // 瀵瑰浘鏍囪剦鍐� 杩涜set璁剧疆 // 楂樹寒鍥惧眰 + 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.SolidWasteLayerGroup) { + // this.SolidWasteLayerGroup.clearLayers() + } else { + this.SolidWasteLayerGroup = this.L.layerGroup().addTo(this.map) + } + if ((this.pulseHeighLightMarker)) { + this.pulseHeighLightMarker.remove() + } + } +} + +export default AddSolidWasteHelper diff --git a/src/components/BaseNav/SolidWasteExtend.js b/src/components/BaseNav/SolidWasteExtend.js new file mode 100644 index 0000000..b778c47 --- /dev/null +++ b/src/components/BaseNav/SolidWasteExtend.js @@ -0,0 +1,363 @@ +// /* -------------------------------------------------------------------------------------------------------------------------- */ +// import { requestSolidWaste } from '@/api/request' +// +// /* -------------------------------------------------------------------------------------------------------------------------- */ +// import '@components/BaseNav/style.css' +// +// /* -------------------------------------------------------------------------------------------------------------------------- */ +// // 灞曠ず鍥剧墖 +// import defaultImg from '@components/BaseNav/magicMarker.png' +// import Setting from '@components/BaseNav/voc.png' +// +// /* -------------------------------------------------------------------------------------------------------------------------- */ +// +// // 搴曞浘涓氬姟灞曠ず鐐� +// class AddSolidWasteHelper { +// /* -------------------------------------------------------------------------------------------------------------------------- */ +// constructor (options) { +// this.map = options.map +// this.L = window.L +// this.SolidWasteLayerGroup = this.L.layerGroup().addTo(this.map) +// this.SolidWastePopup = null +// this.L.sgis = this.L.sgis || this.L +// this.solidWasteMarkersLabels = [] +// this.pulseHeighLightMarker = null +// } +// +// /* -------------------------------------------------------------------------------------------------------------------------- */ +// +// // 璇锋眰鏁版嵁 data 涓哄弬鏁帮紝 璇锋眰鍚庡彴鏁版嵁鏃� 鎼哄甫data鍙傛暟 +// requestData () { +// requestSolidWaste().then(res => { +// // console.log(res) +// this.DrawTheSolidWasteContent(res.Result.DataInfo) +// }).catch(err => { +// console.log(err) +// }) +// } +// +// /* -------------------------------------------------------------------------------------------------------------------------- */ +// +// // 鏍规嵁鑾峰彇鏁版嵁 鐢诲嚭 鍐呭 +// DrawTheSolidWasteContent (data) { +// // 鍥炬爣鏍峰紡鎵╁睍 +// var SolidWasteIcon = this.SolidWasteIcon() +// +// // //鍔犺浇鏁版嵁鍓嶅鏋滃瓨鍦ㄥ浘灞傜粍 閭d箞娓呴櫎鎺� +// if (this.SolidWasteLayerGroup) { +// this.SolidWasteLayerGroup.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.SolidWasteIconUrl(determineValueOne, determineValueTwo, positionArea) +// var Icon = new SolidWasteIcon({ iconUrl: iconUrl }) +// // var url = Icon.options.iconUrl +// +// // 寮瑰嚭妗哾iv鍐呭 +// // var storevoinfo=null,storevodelinfo=[]; +// // for(var j=0;j<storevo.length;j++){ +// // if(itm.StoragePlaceId==storevo[j].StoragePlaceId){ +// // storevoinfo=storevo[j]; +// // } +// // } +// // for(var k=0;k<storedel.length;k++){ +// // if(itm.StoragePlaceId==storedel[k].StoragePlaceId){ +// // storevodelinfo.push(storedel[k]); +// // } +// // } +// const content = this.solidWastePpopupContent(data[i], 'c', 'z') +// // console.log(content) +// +// const marker = this.L.marker([positionX, positionY], { icon: Icon }) +// +// marker.bindPopup(content, () => { +// return this.SolidWastePopup.$el +// }, { +// className: 's-map-popup', +// minWidth: 200, +// 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.SolidWastePopup.SetDisplayContent(content) +// this.EffectOfPulse(e.target.getLatLng()) +// } catch (error) { +// console.log(error) +// } +// }) +// marker.on('popupopen', (e) => { +// try { +// this.solidWastePpopupContent(content) +// } catch (e) { +// console.log(e) +// } +// }) +// // 璁剧疆鍐呭娣诲姞鍒板浘灞� +// // this.solidWasteMarkersLabels.push(marker) +// this.SolidWasteLayerGroup.addLayer(marker) +// } +// } +// } +// +// /* -------------------------------------------------------------------------------------------------------------------------- */ +// +// // 鍥哄簾鐐瑰嚮杩涜鐨� 鍐呭鐨勮缃� +// SetSolidWasteContent (config, containerPopup) { +// this.SolidWastePopup = containerPopup +// } +// +// /* -------------------------------------------------------------------------------------------------------------------------- */ +// +// // 鍥炬爣鏍峰紡鎵╁睍 => 鍏夊湀 鍥炬爣鑴夊啿 +// SolidWasteIcon () { +// return this.L.Icon.extend({ +// options: { +// iconSize: [40, 40], +// iconAnchor: [20, 20] +// } +// }) +// } +// +// /* -------------------------------------------------------------------------------------------------------------------------- */ +// +// // 鏍规嵁绫诲瀷杩斿洖鍥剧墖鍔犺浇url +// SolidWasteIconUrl (determineValueOne, determineValueTwo, position) { +// var EffectOfChange +// if (determineValueOne === 1 || determineValueTwo === 1) { +// EffectOfChange = defaultImg +// this.EffectOfPulse(position, 'SolidWaste', this.solidWasteMarkersLabels, this.SolidWasteLayerGroup) +// } else { +// EffectOfChange = Setting +// } +// return EffectOfChange +// } +// +// /* -------------------------------------------------------------------------------------------------------------------------- */ +// +// // 鑴夊啿鏁堟灉璁剧疆瀹炵幇 +// EffectOfPulse (position, name, 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: [25, 25], +// 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.SolidWasteLayerGroup) +// this.PulseCountSetting() +// } +// } +// +// /* -------------------------------------------------------------------------------------------------------------------------- */ +// +// // 瀵瑰浘鏍囪剦鍐� 杩涜set璁剧疆 // 楂樹寒鍥惧眰 +// PulseCountSetting () { +// var HeightLightTime = 1 +// 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.SolidWasteLayerGroup) { +// // this.SolidWasteLayerGroup.clearLayers() +// } else { +// this.SolidWasteLayerGroup = this.L.layerGroup().addTo(this.map) +// } +// if ((this.pulseHeighLightMarker)) { +// this.pulseHeighLightMarker.remove() +// } +// } +// +// /* -------------------------------------------------------------------------------------------------------------------------- */ +// +// // 鐐瑰嚮涓氬姟鍐呭 寮瑰嚭鏁版嵁鐨勬暟鎹繘琛屼慨鏀� +// solidWastePpopupContent (data) { +// console.log(data) +// const html = data.StoragePlaceName +// return html +// } +// +// /* -------------------------------------------------------------------------------------------------------------------------- */ +// } +// +// export default AddSolidWasteHelper + +// <template> +// <div class="full-screen"> +// <div id="map" ref="rootmap"></div> +// <el-button type="primary" @click="ChangeState">鍥哄簾</el-button> +// <SolidContent ref="SolidWastePopup" @callPopup="callPopup"></SolidContent> +// </div> +// </template> +// +// <script> +// import 'leaflet/dist/leaflet.css' +// import Sgis from '@/Sgis' +// +// // 搴曞浘涓氬姟js閫昏緫 +// import AddSolidWasteHelper from '@components/BaseNav/SolidWaste' +// +// // 搴曞浘缁戝畾 鐐瑰嚮 寮瑰嚭鐨勬暟鎹� +// import SolidContent from '@components/BaseNav/SolidContent' +// +// export default { +// name: 'HomePage', +// components: { +// SolidContent +// }, +// data () { +// return { +// map: null, +// lcServiceLayerVisible: false, +// basemapHelper: {}, +// serviceLayerHelper: {}, +// vectorLayerHelper: {} +// } +// }, +// computed: { +// config () { +// return this.$store.state.map.config +// }, +// SolidWasteConfig () { +// return this.$store.state.map.SolidWasteConfig +// } +// }, +// beforeMount () { +// this.$nextTick(() => { +// this.init() +// }) +// }, +// methods: { +// init () { +// const mapcontainer = this.$refs.rootmap +// this.map = Sgis.initMap(mapcontainer) +// +// this.basemapHelper = Sgis.initBasemapsHelper(this.map) // 鍒濆鍖栧熀纭�搴曞浘鍔╂墜 +// this.basemapHelper.initBasemap(this.config, false) // 绗簩涓弬鏁帮紝琛ㄧず鏄惁鍐呯綉搴曞浘 +// +// this.ChangeState() +// }, +// ChangeState () { +// // 璇锋眰鏁版嵁 鎼哄甫鍙傛暟 data +// // const data = { +// // // companyId: 3900100145, +// // // companyCode: 31800000, +// // // monDuration: 4 +// // } +// // 寮曞叆涓氬姟閫昏緫 js +// const AddSolidWaste = new AddSolidWasteHelper({ map: this.map }) +// // 涓氬姟閫昏緫js 鐨勮姹傛暟鎹� // 骞朵笖浼犻�掑浘鐗� 鐢ㄤ簬鍒涘缓鐐圭殑 icon +// AddSolidWaste.requestData() +// // // 鐐瑰嚮 璁剧疆 寮瑰嚭鍐呭浜嬩欢 de 璁剧疆 console.log(this.$refs.popup.$el) +// // AddSolidWaste.SetSolidWasteContent(this.SolidWasteConfig, this.$refs.SolidWastePopup) +// }, +// callPopup (val) { +// console.log(val) +// }, +// displayDefault () { +// // this.serviceLayerHelper = Sgis.initTileLayersHelper(this.map) // 鍒濆鍖栦笟鍔″簳鍥惧姪鎵� +// // this.serviceLayerHelper.initServiceLayers(this.config, this.$refs.popup) +// +// // this.vectorLayerHelper = Sgis.initVectorLayersHelper(this.map) // 鍒濆鍖栧姩鎬佽绱犲浘灞傚姪鎵� +// // this.vectorLayerHelper.initVectorLayers(this.config) +// } +// } +// } +// </script> +// +// <style lang="less"> +// +// .leaflet-div-icon { +// background: none; +// border: none; +// } +// +// .full-screen { +// width: 100%; +// height: 100%; +// margin: 0; +// padding: 0; +// position: absolute; +// +// button { +// position: absolute; +// top: 88px; +// left: 88px; +// z-index: 999; +// } +// +// #map { +// height: 100%; +// width: 100%; +// } +// +// .barline { +// //width: 100%; +// //height: 1px; +// //background-color: #0661AE; +// border-top: 1px solid #0661AE; +// } +// +// #map-btn { +// position: fixed; +// top: 20px; +// left: 100px; +// z-index: 9999; +// } +// +// .leaflet-custom-icon { +// background: white; +// } +// } +// </style> diff --git a/src/components/BaseNav/SolidWasteTable.vue b/src/components/BaseNav/SolidWasteTable.vue new file mode 100644 index 0000000..a4ecb37 --- /dev/null +++ b/src/components/BaseNav/SolidWasteTable.vue @@ -0,0 +1,69 @@ +<template> + <el-tabs> + <el-tab-pane :label="displayContent.StoragePlaceName" name=""> + <el-table + :data="tableData" :fit="true"> + <el-table-column + type="index" + label="搴忓彿"> + </el-table-column> + <el-table-column + type="index" + label="搴忓彿"> + </el-table-column> + <el-table-column + type="index" + label="搴忓彿"> + </el-table-column> + <el-table-column label="鍥哄簾(t)"> + <el-table-column + prop="province" + label="绱浜х敓閲�"> + </el-table-column> + <el-table-column + prop="city" + label="褰撴湀浜х敓閲�"> + </el-table-column> + </el-table-column> + </el-table> + </el-tab-pane> + </el-tabs> + +</template> + +<script> +export default { + name: 'SolidWasteTable', + props: ['displayContent'], + data () { + return { + tableData: [{ + date: '闆嗗洟鍏徃', + name: '35', + province: '23', + city: '11', + address: 235, + zip: 23 + }, { + date: '澶╂触鐭冲寲', + name: 32, + province: 33, + city: 44, + address: 53, + zip: 200333 + }, { + date: '娴庡崡鐐煎寲', + name: 35, + province: 13, + city: 33, + address: 44, + zip: 200333 + }] + } + } +} +</script> + +<style lang="less" scoped> + +</style> diff --git a/src/components/BaseNav/directive.js b/src/components/BaseNav/directive.js new file mode 100644 index 0000000..adc9450 --- /dev/null +++ b/src/components/BaseNav/directive.js @@ -0,0 +1,132 @@ +import Vue from 'vue' + +// 鑷畾涔夊厓绱犲疄鐜板脊妗嗘嫋鎷絒閲嶇偣] +Vue.directive('draw', { + inserted: function (el, binding, vNode) { + el.setAttribute('style', 'position: fixed; z-index: 9999') + }, + bind: function (el, bindding, vNode) { + el.setAttribute('draggable', true) + let left, top, width, height + el._dragstart = function (event) { + event.stopPropagation() + left = event.clientX - el.offsetLeft + top = event.clientY - el.offsetTop + width = el.offsetWidth + height = el.offsetHeight + } + el._checkPosition = function () { // 闃叉琚嫋鍑鸿竟鐣� + const width = el.offsetWidth + const height = el.offsetHeight + let left = Math.min(el.offsetLeft, document.body.clientWidth - width) + left = Math.max(0, left) + let top = Math.min(el.offsetTop, document.body.clientHeight - height) + top = Math.max(0, top) + el.style.left = left + 'px' + el.style.top = top + 'px' + el.style.width = width + 'px' + el.style.height = height + 'px' + } + el._dragEnd = function (event) { + event.stopPropagation() + left = event.clientX - left + top = event.clientY - top + el.style.left = left + 'px' + el.style.top = top + 'px' + el.style.width = width + 'px' + el.style.height = height + 'px' + el._checkPosition() + } + el._documentAllowDraop = function (event) { + event.preventDefault() + } + document.body.addEventListener('dragover', el._documentAllowDraop) + el.addEventListener('dragstart', el._dragstart) + el.addEventListener('dragend', el._dragEnd) + window.addEventListener('resize', el._checkPosition) + }, + + unbind: function (el, bindding, vNode) { + document.body.removeEventListener('dragover', el._documentAllowDraop) + el.removeEventListener('dragstart', el._dragstart) + el.removeEventListener('dragend', el._dragEnd) + window.removeEventListener('resize', el._checkPosition) + delete el._documentAllowDraop + delete el._dragstart + delete el._dragEnd + delete el._checkPosition + } +}) + +// v-dialogDrag: 寮圭獥鎷栨嫿 +Vue.directive('dialogDrag', { + bind (el, binding, vnode, oldVnode) { + const dialogHeaderEl = el.querySelector('.el-dialog__header') + const dragDom = el.querySelector('.el-dialog') + dialogHeaderEl.style.cursor = 'move' + + // 鑾峰彇鍘熸湁灞炴�� ie dom鍏冪礌.currentStyle 鐏嫄璋锋瓕 window.getComputedStyle(dom鍏冪礌, null); + const sty = dragDom.currentStyle || window.getComputedStyle(dragDom, null) + + dialogHeaderEl.onmousedown = (e) => { + // 榧犳爣鎸変笅锛岃绠楀綋鍓嶅厓绱犺窛绂诲彲瑙嗗尯鐨勮窛绂� + const disX = e.clientX - dialogHeaderEl.offsetLeft + const disY = e.clientY - dialogHeaderEl.offsetTop + + // 鑾峰彇鍒扮殑鍊煎甫px 姝e垯鍖归厤鏇挎崲 + let styL, styT + + // 娉ㄦ剰鍦╥e涓� 绗竴娆¤幏鍙栧埌鐨勫�间负缁勪欢鑷甫50% 绉诲姩涔嬪悗璧嬪�间负px + if (sty.left.includes('%')) { + styL = +document.body.clientWidth * (+sty.left.replace(/%/g, '') / 100) + styT = +document.body.clientHeight * (+sty.top.replace(/%/g, '') / 100) + } else { + styL = +sty.left.replace(/px/g, '') + styT = +sty.top.replace(/px/g, '') + } + + document.onmousemove = function (e) { + // 閫氳繃浜嬩欢濮旀墭锛岃绠楃Щ鍔ㄧ殑璺濈 + const l = e.clientX - disX + const t = e.clientY - disY + + // 绉诲姩褰撳墠鍏冪礌 + dragDom.style.left = `${l + styL}px` + dragDom.style.top = `${t + styT}px` + + // 灏嗘鏃剁殑浣嶇疆浼犲嚭鍘� + // binding.value({x:e.pageX,y:e.pageY}) + } + + document.onmouseup = function (e) { + document.onmousemove = null + document.onmouseup = null + } + } + } +}) + +// v-dialogDragWidth: 寮圭獥瀹藉害鎷栧ぇ 鎷栧皬 +Vue.directive('dialogDragWidth', { + bind (el, binding, vnode, oldVnode) { + const dragDom = binding.value.$el.querySelector('.el-dialog') + + el.onmousedown = (e) => { + // 榧犳爣鎸変笅锛岃绠楀綋鍓嶅厓绱犺窛绂诲彲瑙嗗尯鐨勮窛绂� + const disX = e.clientX - el.offsetLeft + + document.onmousemove = function (e) { + e.preventDefault() // 绉诲姩鏃剁鐢ㄩ粯璁や簨浠� + + // 閫氳繃浜嬩欢濮旀墭锛岃绠楃Щ鍔ㄧ殑璺濈 + const l = e.clientX - disX + dragDom.style.width = `${l}px` + } + + document.onmouseup = function (e) { + document.onmousemove = null + document.onmouseup = null + } + } + } +}) diff --git a/src/components/BaseNav/magicMarker.png b/src/components/BaseNav/magicMarker.png new file mode 100644 index 0000000..144c0ce --- /dev/null +++ b/src/components/BaseNav/magicMarker.png Binary files differ diff --git a/src/components/BaseNav/style.css b/src/components/BaseNav/style.css new file mode 100644 index 0000000..dd710a6 --- /dev/null +++ b/src/components/BaseNav/style.css @@ -0,0 +1,4 @@ +.s-map-popup { + background: red; + height: 100px; +} diff --git a/src/components/BaseNav/voc.png b/src/components/BaseNav/voc.png new file mode 100644 index 0000000..3ccaad5 --- /dev/null +++ b/src/components/BaseNav/voc.png Binary files differ diff --git a/src/utils/axios.js b/src/utils/axios.js index a5bb1ab..20047e2 100644 --- a/src/utils/axios.js +++ b/src/utils/axios.js @@ -117,10 +117,10 @@ // request鎷︽埅鍣� Service.interceptors.request.use( config => { - // 涓存椂杩藉姞 - // if ($store.state.user.account) { - // config.headers.account = $store.state.user.account - // } + // 涓存椂杩藉姞 + // if ($store.state.user.account) { + // config.headers.account = $store.state.user.account + // } const copyConfig = Object.assign({}, config) // copyConfig = filterOauthData(copyConfig) // showDebugInfo(copyConfig) @@ -139,13 +139,14 @@ // respone鎷︽埅鍣� Service.interceptors.response.use( response => { - const res = response.data - if (Number(res.code) !== 200 && Number(res.code) !== 0) { - $T.warning(res.message) - return Promise.reject(res.message) - } else { - return res - } + // const res = response.data + // if (Number(res.code) !== 200 && Number(res.code) !== 0) { + // $T.warning(res.message) + // return Promise.reject(res.message) + // } else { + // return res + // } + return response.data }, error => { if (error.message && error.message.includes('timeout')) { diff --git a/src/views/MapTemplate.vue b/src/views/MapTemplate.vue index be0702d..698833c 100644 --- a/src/views/MapTemplate.vue +++ b/src/views/MapTemplate.vue @@ -11,11 +11,13 @@ <monitor-panel></monitor-panel> <!-- <top-enterprise-panel></top-enterprise-panel>--> <tool-box-panel ref="toolBox"></tool-box-panel> -<!-- <menu-special></menu-special>--> + <!-- <menu-special></menu-special>--> <legend-panel></legend-panel> <summary-sheets></summary-sheets> <enterprise></enterprise> -<!-- <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 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> </div> </template> @@ -34,6 +36,9 @@ // import MenuSpecial from '@components/panel/MenuTopic' import LegendPanel from '@components/panel/LegendPanel' import Enterprise from '../components/table/enterprise' +import SolidContent from '@components/BaseNav/SolidContent' +// 搴曞浘涓氬姟js閫昏緫 +import AddSolidWasteHelper from '@components/BaseNav/SolidWaste' export default { name: 'MapTemplate', @@ -48,7 +53,8 @@ LcBasemap, LcServiceLayer, Popup, - summarySheets + summarySheets, + SolidContent }, data () { return { @@ -71,6 +77,11 @@ }) }, methods: { + ChangeState () { + const AddSolidWaste = new AddSolidWasteHelper({ map: this.map }) + AddSolidWaste.requestData() + AddSolidWaste.SetSolidWasteContent(this.config, this.$refs.SolidWastePopup) + }, isShowHidden () { this.isShowBtn = !this.isShowBtn }, @@ -97,6 +108,8 @@ this.vectorLayerHelper = Sgis.initVectorLayersHelper(this.map) // 鍒濆鍖栧姩鎬佽绱犲浘灞傚姪鎵� this.vectorLayerHelper.initVectorLayers(this.config) + + // this.ChangeState() this.saveMapStatus() // this.setMapObj(this.mapObj) @@ -146,6 +159,13 @@ <style lang="less"> +.solid-waste { + position: absolute; + top: 88px; + left: 88px; + z-index: 999; +} + .full-screen { width: 100%; height: 100%; @@ -164,13 +184,15 @@ //background-color: #0661AE; border-top: 1px solid #0661AE; } + #map-btn { position: fixed; top: 20px; left: 100px; z-index: 9999; } - .leaflet-custom-icon{ + + .leaflet-custom-icon { background: white; } } -- Gitblit v1.8.0