From 4df0471b7dff0494625ff09969b1a13b5359a26e Mon Sep 17 00:00:00 2001 From: XingChuan <m17600301067@163.com> Date: 星期一, 31 五月 2021 22:41:47 +0800 Subject: [PATCH] 统计表弹框UI优化;增加点击企业名称缩放至企业;二级表展示功能优化。 --- src/components/panel/LegendPanel.vue | 352 +++++++++++++++++++--------------------------------------- 1 files changed, 117 insertions(+), 235 deletions(-) diff --git a/src/components/panel/LegendPanel.vue b/src/components/panel/LegendPanel.vue index a70ef75..87c4fce 100644 --- a/src/components/panel/LegendPanel.vue +++ b/src/components/panel/LegendPanel.vue @@ -1,220 +1,70 @@ <template> <div class="legend-panel"> - <div class="legend-icon unactive" @click="legendChange()"> - <i class="el-icon-more-outline"></i> - <span>鍥句緥</span> - </div> <transition name="fade"> - <div class="legend-content" v-show="legendControl"> - <div class="legend-content-box" v-for="(item,index) in legendContents" :key="index"> - <p>{{ item.title }}</p> + <div :class="'legend-content map-background'" v-show="isShow"> + <div class="legend-content-box" v-for="(item,index) in serviceLayers" :key="index"> + <p><span>{{ item.name }}</span></p> + <div class="map-under-line"></div> <ul> - <div v-for="(ite,inde) in item.items" :key="inde"> - <li> - <img :src='ite.legendImage' alt=''> - <span>{{ ite.legendContent }}</span> - </li> - </div> + <li v-for="(ite,idx) in item.layers" :key="idx"> + <img :src="ite.legendImage===undefined?'../.././assets/images/map-pages/setting.png':ite.legendImage" alt=''> + <span>{{ ite.name }}</span> + </li> </ul> - <div :class="index === 5 ? '':'under-line'"></div> </div> </div> </transition> + <el-tooltip :popper-class="'map-tooltip'" effect="dark" content="鍥句緥" placement="left"> + <div :class="this.isShow?'legend-btn map-btn-active':'legend-btn map-btn-unactive'" + @click="legendChange()"> + <i class="el-icon-more-outline"></i> + </div> + </el-tooltip> </div> </template> - <script> +import { LayerWasteWater } from '../../conf/layers/LayerWasteWater' +import { LayerWasteGas } from '../../conf/layers/LayerWasteGas' +import { LayerWasteSolid } from '../../conf/layers/LayerWasteSolid' +import { LayerAirQuality } from '../../conf/layers/LayerAirQuality' +import { LayerEnvRisk } from '../../conf/layers/LayerEnvRisk' +import { LayerSoilGroundWater } from '../../conf/layers/LayerSoilGroundWater' +import { LayerPipeLines } from '../../conf/layers/LayerPipeLines' +import { LayerPk } from '../../conf/layers/LayerPk' +import { LayerArea } from '../../conf/layers/LayerArea' +import bus from '@/eventBus' export default { name: 'LegendPanel', data () { return { // 鎺у埗鍥句緥 鍐呭鐨� 鏄剧ず/闅愯棌 - legendControl: false, - // 鍥鹃噷瀛樺偍鏁版嵁 - legendContents: [ - { - title: '棰勮', - items: [ - { - legendImage: '../.././assets/images/map-pages/setting.png', - legendContent: '鏆撮洦绾㈣壊棰勮' - }, - { - legendImage: '../.././assets/images/map-pages/setting.png', - legendContent: '鏆撮洦姗欒壊棰勮' - }, - { - legendImage: '../.././assets/images/map-pages/setting.png', - legendContent: '鏆撮洦榛勮壊棰勮' - }, - { - legendImage: '../.././assets/images/map-pages/setting.png', - legendContent: '鏆撮洦钃濊壊棰勮' - }, - { - legendImage: '../.././assets/images/map-pages/setting.png', - legendContent: '鏆撮绾㈣壊棰勮' - }, - { - legendImage: '../.././assets/images/map-pages/setting.png', - legendContent: '鏆撮绾㈣壊棰勮' - }, - { - legendImage: '../.././assets/images/map-pages/setting.png', - legendContent: '鏆撮绾㈣壊棰勮' - }, - { - legendImage: '../.././assets/images/map-pages/setting.png', - legendContent: '鏆撮绾㈣壊棰勮' - }, - { - legendImage: '../.././assets/images/map-pages/setting.png', - legendContent: '鏆撮绾㈣壊棰勮' - }, - { - legendImage: '../.././assets/images/map-pages/setting.png', - legendContent: '鏆撮绾㈣壊棰勮' - }, - { - legendImage: '../.././assets/images/map-pages/setting.png', - legendContent: '鏆撮绾㈣壊棰勮' - }, - { - legendImage: '../.././assets/images/map-pages/setting.png', - legendContent: '鏆撮绾㈣壊棰勮' - }, - { - legendImage: '../.././assets/images/map-pages/setting.png', - legendContent: '鏆撮绾㈣壊棰勮' - }, - { - legendImage: '../.././assets/images/map-pages/setting.png', - legendContent: '鏆撮绾㈣壊棰勮' - }, - { - legendImage: '../.././assets/images/map-pages/setting.png', - legendContent: '鏆撮绾㈣壊棰勮' - }, - { - legendImage: '../.././assets/images/map-pages/setting.png', - legendContent: '鏆撮绾㈣壊棰勮' - } - ] - }, - { - title: '浼佷笟', - items: [ - { - legendImage: '../.././assets/images/map-pages/setting.png', - legendContent: '涓浗鐭冲寲' - }, - { - legendImage: '../.././assets/images/map-pages/setting.png', - legendContent: '娌圭敯浼佷笟 ' - }, - { - legendImage: '../.././assets/images/map-pages/setting.png', - legendContent: '鐐煎寲浼佷笟' - }, - { - legendImage: '../.././assets/images/map-pages/setting.png', - legendContent: '閿�鍞紒涓�' - } - ] - }, - { - title: '姘存儏', - items: [ - { - legendImage: '../.././assets/images/map-pages/setting.png', - legendContent: '姘存枃绔�' - } - ] - }, - { - title: '绠$嚎', - items: [ - { - legendImage: '../.././assets/images/map-pages/setting.png', - legendContent: '澶╃劧姘旂绾�' - }, - { - legendImage: '../.././assets/images/map-pages/setting.png', - legendContent: '澶╃劧姘斿満绔�' - }, - { - legendImage: '../.././assets/images/map-pages/setting.png', - legendContent: '鎴愬搧娌圭绾�' - }, - { - legendImage: '../.././assets/images/map-pages/setting.png', - legendContent: '鎴愬搧娌瑰満绔�' - } - ] - }, - { - title: '鍙伴', - items: [ - { - legendImage: '../.././assets/images/map-pages/setting.png', - legendContent: '鍙伴瀹炴祴涓績' - }, - { - legendImage: '../.././assets/images/map-pages/setting.png', - legendContent: '鍙伴瀹炴祴璺緞' - }, - { - legendImage: '../.././assets/images/map-pages/setting.png', - legendContent: '鍙伴棰勬祴涓績' - }, - { - legendImage: '../.././assets/images/map-pages/setting.png', - legendContent: '鍙伴棰勬祴璺緞' - }, - { - legendImage: '../.././assets/images/map-pages/setting.png', - legendContent: '鍙伴褰撳墠涓績' - } - ] - }, - { - title: '闄嶆按绛夌骇(鍗曚綅锛歮m)', - items: [ - { - legendImage: '../.././assets/images/map-pages/setting.png', - legendContent: '灏忛洦0-5' - }, - { - legendImage: '../.././assets/images/map-pages/setting.png', - legendContent: '涓洦5-10' - }, - { - legendImage: '../.././assets/images/map-pages/setting.png', - legendContent: '澶ч洦10-20' - }, - { - legendImage: '../.././assets/images/map-pages/setting.png', - legendContent: '鏆撮洦20-50' - }, - { - legendImage: '../.././assets/images/map-pages/setting.png', - legendContent: '澶ф毚闆�50-100' - } - ] - } - ] + isShow: false, + serviceLayers: [LayerSoilGroundWater, LayerEnvRisk, LayerAirQuality, LayerWasteSolid, LayerWasteGas, LayerWasteWater, LayerArea, LayerPk, LayerPipeLines] } + }, + mounted () { + const that = this + bus.$on('changeState', function (state) { + if (state.num !== 4 && state.type) { + that.isShow = false + } + }) }, methods: { // 鍥炬爣 鎺у埗鍐呭鐨勫睍绀轰笌闅愯棌 legendChange () { - this.legendControl = !this.legendControl + this.isShow = !this.isShow + const state = { + type: this.isShow, + num: 4 + } + bus.$emit('changeState', state) } } } </script> -<style lang="less" scoped> +<style lang="less"> .legend-panel { position: absolute; z-index: 502; @@ -225,14 +75,35 @@ flex-direction: column; -webkit-box-align: end; -ms-flex-align: end; - align-items: flex-end; + //align-items: flex-end; + transition: all .5s; - .legend-icon { - width: 3.4rem; - height: 1.6rem; - border-radius: 0.3rem; - background: white; + .legend-btn { + width: .2rem; + height: .2rem; + //font-size: .08333rem; + border: .00521rem solid @background-color-light; + border-radius: @border-radius; text-align: center; + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -ms-flex-direction: column; + flex-direction: column; + -webkit-box-align: center; + -ms-flex-align: center; + align-items: center; + -webkit-box-pack: center; + -ms-flex-pack: center; + justify-content: center; + background: @background-color; + margin-top: .04167rem; + cursor: pointer; + //color: @color; + margin-left: auto; + font-size: 0.08333rem; } @keyframes bounce-in { @@ -248,72 +119,83 @@ .fade-enter-active { transform-origin: right bottom; - animation: bounce-in .5s; + animation: bounce-in .2s; } .fade-leave-active { transform-origin: right bottom; - animation: bounce-in .5s reverse; + animation: bounce-in .2s reverse; } .legend-content { - position: absolute; - right: 0.3rem; - bottom: 3rem; - width: 30rem; - border-radius: 1rem; - background: #3c7699; + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: reverse; + -ms-flex-direction: row-reverse; + flex-direction: row-reverse; + + width: -webkit-max-content; + width: -moz-max-content; + width: max-content; + + overflow: hidden; + min-height: 1.28646rem; .legend-content-box { + font-size: 0.07292rem; + padding: .10417rem; + border-left: .00521rem solid @background-color-split; + p { text-align: center; - color: #ffffff; - font-size: 14px; + margin: 0 !important; + //padding: 0; + //color: @color-title; + -webkit-margin-before: 0.3rem; margin-block-start: 0.3rem; + -webkit-margin-after: 0.2rem; margin-block-end: 0.2rem; + margin-bottom: 0.05208rem !important; + + span { + color: @color-title; + font-size: .08333rem; + font-weight: 600; + } } ul { list-style: none; - display: flex; flex-wrap: wrap; - padding: 0; + margin: 0 !important; + padding: 0 !important;; padding-inline: 0; + font-size: .08333rem; - div { - width: 25%; + li { + list-style: none; display: flex; - justify-content: center; - margin: 0.1rem 0; + -webkit-box-align: center; + align-items: center; + margin: 0.05208rem 0; - li { - width: 100%; - display: flex; - justify-content: space-around; - margin-left: 15px; - margin-right: 15px; + img { + // width: .08333rem; + // height: .08333rem; + width: 0.1rem; + height: 0.1rem; + margin-right: .01042rem; + } - img { - height: 18px; - width: 18px; - } - - span { - width: 80px; - font-size: 12px; - color: white; - } + span { + color: @color; } } } } - .under-line { - height: 2px; - background: #7bc5ef; - margin-block-start: 0; - margin-block-end: 0; - } } } </style> -- Gitblit v1.8.0