From 07a0b054953d628a1e4b34c88b974166927ea62d Mon Sep 17 00:00:00 2001 From: chenzeping <ChenZeping02609@163.com> Date: 星期二, 30 三月 2021 11:37:46 +0800 Subject: [PATCH] 弹框修改 --- src/components/BaseNav/SolidWaste/SolidWaste.js | 27 ++++++-- src/api/request.js | 2 src/components/BaseNav/SolidWaste/directive.js | 73 ------------------------ src/components/BaseNav/PublicBounced/GasComponents/PublicTable.vue | 53 +++++++++++++++++ src/components/BaseNav/PublicBounced/GasComponents/GasTab.vue | 0 src/components/BaseNav/PublicBounced/PublicBounced.vue | 16 +++-- 6 files changed, 84 insertions(+), 87 deletions(-) diff --git a/src/api/request.js b/src/api/request.js index 38364ca..9f9091d 100644 --- a/src/api/request.js +++ b/src/api/request.js @@ -21,4 +21,4 @@ 'Content-Type': 'application/json' } }) -} +} \ No newline at end of file diff --git a/src/components/BaseNav/PublicBounced/GasComponents/GasTable.vue b/src/components/BaseNav/PublicBounced/GasComponents/GasTab.vue similarity index 100% rename from src/components/BaseNav/PublicBounced/GasComponents/GasTable.vue rename to src/components/BaseNav/PublicBounced/GasComponents/GasTab.vue diff --git a/src/components/BaseNav/PublicBounced/GasComponents/PublicTable.vue b/src/components/BaseNav/PublicBounced/GasComponents/PublicTable.vue new file mode 100644 index 0000000..12f1a91 --- /dev/null +++ b/src/components/BaseNav/PublicBounced/GasComponents/PublicTable.vue @@ -0,0 +1,53 @@ +<template> + <div class="public-table"> + <el-table + :data="tableData" + style="width: 100%"> + <el-table-column + prop="date" + label="鏃ユ湡" + width="180"> + </el-table-column> + <el-table-column + prop="name" + label="濮撳悕" + width="180"> + </el-table-column> + <el-table-column + prop="address" + label="鍦板潃"> + </el-table-column> + </el-table> + </div> +</template> + +<script> +export default { + name: 'PublicTable', + data () { + return { + tableData: [{ + date: '2016-05-02', + name: '鐜嬪皬铏�', + address: '涓婃捣甯傛櫘闄�鍖洪噾娌欐睙璺� 1518 寮�' + }, { + date: '2016-05-04', + name: '鐜嬪皬铏�', + address: '涓婃捣甯傛櫘闄�鍖洪噾娌欐睙璺� 1517 寮�' + }, { + date: '2016-05-01', + name: '鐜嬪皬铏�', + address: '涓婃捣甯傛櫘闄�鍖洪噾娌欐睙璺� 1519 寮�' + }, { + date: '2016-05-03', + name: '鐜嬪皬铏�', + address: '涓婃捣甯傛櫘闄�鍖洪噾娌欐睙璺� 1516 寮�' + }] + } + } +} +</script> + +<style lang="less" scoped> + +</style> diff --git a/src/components/BaseNav/PublicBounced/PublicBounced.vue b/src/components/BaseNav/PublicBounced/PublicBounced.vue index eddeb78..61286b1 100644 --- a/src/components/BaseNav/PublicBounced/PublicBounced.vue +++ b/src/components/BaseNav/PublicBounced/PublicBounced.vue @@ -6,8 +6,9 @@ </div> <div class="public-bounced-content"> <div class="public-bounced-content-left"> - <GasTable :displayContent="displayContent"></GasTable> - <GasECharts></GasECharts> + <GasTab :displayContent="displayContent"></GasTab> + <PublicTable v-if="value === 'gufei'"></PublicTable> + <GasECharts v-else></GasECharts> </div> <div class="public-bounced-content-right"> <GasVideo></GasVideo> @@ -19,14 +20,16 @@ <script> import '@/components/BaseNav/SolidWaste/directive' -import GasTable from '@components/BaseNav/PublicBounced/GasComponents/GasTable' +import GasTab from '@components/BaseNav/PublicBounced/GasComponents/GasTab' +import PublicTable from '@components/BaseNav/PublicBounced/GasComponents/PublicTable' import GasECharts from '@components/BaseNav/PublicBounced/GasComponents/GasECharts' import GasVideo from '@components/BaseNav/PublicBounced/GasComponents/GasVideo' export default { name: 'PublicBounced', components: { - GasTable, + GasTab, + PublicTable, GasECharts, GasVideo }, @@ -37,9 +40,10 @@ } }, methods: { - setData (data) { + setData (data, value) { this.displayContent = data this.flag = true + this.value = value }, closePopup () { this.flag = false @@ -51,7 +55,7 @@ <style lang="less" scoped> .public-bounced { z-index: 999; - position: fixed; + position: absolute; top: 50%; left: 50%; background-color: #002432; diff --git a/src/components/BaseNav/SolidWaste/SolidWaste.js b/src/components/BaseNav/SolidWaste/SolidWaste.js index 54107a5..6df5e3e 100644 --- a/src/components/BaseNav/SolidWaste/SolidWaste.js +++ b/src/components/BaseNav/SolidWaste/SolidWaste.js @@ -52,20 +52,24 @@ // var url = Icon.options.iconUrl const marker = this.L.marker([positionX, positionY], { icon: Icon }) - // 鍒掕繃鍑虹幇 灞曠ず鏁版嵁 marker.bindTooltip(data[i].Name, { permanent: true, - offset: [0, 16], - direction: 'bottom', + offset: [0, -16], + direction: 'top', className: '' }) // 鐐瑰嚮 浜嬩欢 marker.on('click', (e) => { try { - console.log(e) + // console.log(e) + // console.log(this.map.getCenter()) + // console.log(this.map.setCenter([e.target.getLatLng().lat, e.target.getLatLng().lng])) + // this.map.flyTo([e.target.getLatLng().lat, e.target.getLatLng().lng]) + // this.map.panTo([e.target.getLatLng().lat, e.target.getLatLng().lng], 100) + this.setPanTo(e.target.getLatLng(), 30) this.EffectOfPulse(e.target.getLatLng()) - this.SolidWastePopup.setData(data[i]) + this.SolidWastePopup.setData(data[i], 'gufei') return this.SolidWastePopup.$el } catch (error) { console.log(error) @@ -75,6 +79,16 @@ this.SolidWasteLayerGroup.addLayer(marker) } } + } + + // panTo + setPanTo (pos, value) { + var position = pos + position = this.map.latLngToLayerPoint(position) + position.y += value + position = this.map.layerPointToLatLng(position) + this.map.setView(position) + // this.map.flyTo(position) } // 鍥哄簾鐐瑰嚮杩涜鐨� 鍐呭鐨勮缃� @@ -106,7 +120,7 @@ // 鑴夊啿鏁堟灉璁剧疆瀹炵幇 EffectOfPulse (position, markers, layerGroup) { - // // 鍖哄垎鐩存帴鎵ц 鍜屽垽鏂墽琛岀殑涓嶅悓鍖哄埆 + // 鍖哄垎鐩存帴鎵ц 鍜屽垽鏂墽琛岀殑涓嶅悓鍖哄埆 var differentColor = '' if (markers) { differentColor = '#ff0000' @@ -140,7 +154,6 @@ var HeightLightTime = 5 var PulseNumber = 5 const pulseinterver = setInterval((e) => { - console.log(e) if (PulseNumber > 0) { PulseNumber-- } else { diff --git a/src/components/BaseNav/SolidWaste/directive.js b/src/components/BaseNav/SolidWaste/directive.js index 773a4a8..d51b377 100644 --- a/src/components/BaseNav/SolidWaste/directive.js +++ b/src/components/BaseNav/SolidWaste/directive.js @@ -57,76 +57,3 @@ 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 - } - } - } -}) -- Gitblit v1.8.0