Files
dvcp_v2_webapp/packages/bigscreen/dv/components/DvMap.vue

379 lines
10 KiB
Vue
Raw Normal View History

2023-04-23 17:50:29 +08:00
<template>
2023-04-26 17:32:51 +08:00
<div class="AiDvMap">
2023-04-23 17:50:29 +08:00
<div class="chart-map" :class="v" style="width: 100%; height: 100%"></div>
2023-04-25 17:25:29 +08:00
<transition name="fade">
<div class="info" v-if="isShowInfo">
2023-04-27 16:58:44 +08:00
<div class="info-mask" @click="isShowInfo = false"></div>
2023-04-25 17:25:29 +08:00
<div class="info-content">
<div class="info-title">
2023-04-26 14:14:29 +08:00
<h2>{{ title }}</h2>
2023-04-25 17:25:29 +08:00
</div>
<img src="https://cdn.cunwuyun.cn/dvcp/dv/qxn/close.png" @click="isShowInfo = false" />
<div class="info-wrapper">
<div class="info-wrapper__item">
<label>下属单位</label>
2023-04-26 17:32:51 +08:00
<span>{{ info['派出所数量'] }}个派出所</span>
2023-04-25 17:25:29 +08:00
</div>
<div class="info-wrapper__item">
<label>居民群</label>
2023-04-26 14:14:29 +08:00
<span>{{ info['群数量'] }}</span>
2023-04-25 17:25:29 +08:00
</div>
<div class="info-wrapper__item">
<label>成员人数</label>
2023-04-26 14:14:29 +08:00
<span>{{ info['成员总数'] }}</span>
2023-04-25 17:25:29 +08:00
</div>
<div class="info-wrapper__item">
<label>群人数</label>
2023-04-26 14:14:29 +08:00
<span>{{ info['群成员数量'] }}</span>
2023-04-25 17:25:29 +08:00
</div>
<div class="info-wrapper__item">
<label>激活比例</label>
2023-04-26 14:14:29 +08:00
<span>{{ rate }}</span>
2023-04-25 17:25:29 +08:00
</div>
<div class="info-wrapper__item">
<label>好友人数</label>
2023-04-26 17:32:51 +08:00
<span>{{ info['外部联系人数量'] }}</span>
2023-04-25 17:25:29 +08:00
</div>
<div class="info-wrapper__item">
<label>群主人数</label>
2023-04-26 14:14:29 +08:00
<span>{{ info['群主人数'] }}</span>
2023-04-25 17:25:29 +08:00
</div>
</div>
</div>
</div>
</transition>
2023-04-23 17:50:29 +08:00
</div>
</template>
<script>
2023-04-26 17:32:51 +08:00
import * as echarts from 'echarts'
2023-04-23 17:50:29 +08:00
2023-04-26 17:32:51 +08:00
export default {
name: 'AiDvMap',
2023-04-26 14:14:29 +08:00
2023-04-26 17:32:51 +08:00
props: {
instance: Function
},
2023-04-23 17:50:29 +08:00
2023-04-26 17:32:51 +08:00
data() {
return {
info: {},
timer: null,
title: '',
v: `AiDvMap-${new Date().getTime()}`,
chart: null,
isShowInfo: false,
geoJSON: require('./geoJSon/qxnGeoJSON.json')
2023-04-23 17:50:29 +08:00
}
2023-04-26 17:32:51 +08:00
},
2023-04-26 14:14:29 +08:00
2023-04-26 17:32:51 +08:00
computed: {
rate () {
if (!this.info['已激活']) {
return '0%'
}
2023-04-26 14:14:29 +08:00
2023-04-26 17:32:51 +08:00
return (this.info['已激活'] / this.info['成员总数']).toFixed(2) * 100 + '%'
}
},
mounted() {
this.$nextTick(() => {
this.initChart()
})
},
2023-04-23 17:50:29 +08:00
2023-04-26 17:32:51 +08:00
methods: {
initChart() {
this.chart = echarts.init(document.querySelector(`.${this.v}`))
echarts.registerMap('黔西南', this.geoJSON)
2023-04-23 17:50:29 +08:00
2023-04-26 17:32:51 +08:00
let option = {
geo: [
{
map: "黔西南",
aspectScale: 1,
zoom: 0.65,
layoutCenter: ["50%", "50%"],
layoutSize: "180%",
2023-04-26 14:14:29 +08:00
show: true,
2023-04-26 17:32:51 +08:00
roam: false,
emphasis: {
show: true,
label: {
textStyle: {
color: "#FFFFFF"
},
2023-04-23 17:50:29 +08:00
},
2023-04-26 17:32:51 +08:00
itemStyle: {
// areaColor: '#fff'
}
},
label: {
normal: {
show: true,
color: '#fff',
fontSize: '14'
}
2023-04-23 17:50:29 +08:00
},
2023-04-26 14:14:29 +08:00
itemStyle: {
2023-04-26 17:32:51 +08:00
normal: {
borderColor: "rgba(2, 254, 255, 0.7)",
borderWidth: 2,
shadowColor: "rgba(2, 254, 255, 0.1)",
shadowOffsetY: 10,
shadowBlur: 120,
areaColor: "#0f7295",
},
2023-04-26 14:14:29 +08:00
}
},
2023-04-26 17:32:51 +08:00
// 重影
{
type: "map",
map: "黔西南",
zlevel: -1,
aspectScale: 1,
zoom: 0.65,
layoutCenter: ["50%", "51%"],
layoutSize: "180%",
roam: false,
silent: true,
itemStyle: {
normal: {
borderWidth: 1,
// borderColor:"rgba(17, 149, 216,0.6)",
borderColor: "rgba(2, 254, 255, 0.3)",
shadowColor: "rgba(2, 254, 255, 0.3)",
shadowOffsetY: 5,
shadowBlur: 15,
areaColor: "rgba(5,21,35,0.1)",
},
2023-04-23 17:50:29 +08:00
},
2023-04-26 14:14:29 +08:00
},
2023-04-26 17:32:51 +08:00
{
type: "map",
map: "黔西南",
zlevel: -2,
aspectScale: 1,
zoom: 0.65,
layoutCenter: ["50%", "52%"],
layoutSize: "180%",
roam: false,
silent: true,
itemStyle: {
normal: {
borderWidth: 1,
// borderColor: "rgba(57, 132, 188,0.4)",
borderColor: "rgba(2, 254, 255, 0.2)",
shadowColor: "rgba(2, 254, 255, 0.24)",
shadowOffsetY: 5,
shadowBlur: 15,
areaColor: "transpercent",
},
2023-04-26 14:14:29 +08:00
},
},
2023-04-26 17:32:51 +08:00
{
type: "map",
map: "黔西南",
zlevel: -3,
aspectScale: 1,
zoom: 0.65,
layoutCenter: ["50%", "53%"],
layoutSize: "180%",
roam: false,
silent: true,
itemStyle: {
normal: {
borderWidth: 1,
// borderColor: "rgba(11, 43, 97,0.8)",
borderColor: "rgba(2, 254, 255, 0.1)",
shadowColor: "rgba(2, 254, 255, 0.1)",
shadowOffsetY: 15,
shadowBlur: 10,
areaColor: "transpercent",
},
2023-04-26 14:14:29 +08:00
},
2023-04-26 17:32:51 +08:00
}
],
series: [
{
type: 'scatter',
map: "黔西南",
coordinateSystem: 'geo',
z: 3,
zlevel: 3,
// symbol: 'none',
symbolSize: 16,
rippleEffect: {
period: 2,
scale: 4,
brushType: 'fill'
2023-04-26 14:14:29 +08:00
},
2023-04-26 17:32:51 +08:00
label: {
show: false
},
roam: false,
itemStyle: {
normal: {
areaColor: '#000',
borderColor: '#a18a3a',
borderWidth: 1
},
emphasis: {
show: false,
areaColor: null
}
},
// label: {
// show: true,
// formatter: e => {
// const name = e.data[3]
// const value = e.data[2]
// return `{a|${name}}\n{b|${value}}`
// },
// fontSize: 16,
// rich: {
// a: {
// width: '100%',
// color: '#fff',
// lineHeight: 20,
// fontSize: 16
// },
// b: {
// backgroundColor: {
// // image: require('@/assets/images/point.png')
// },
// color: '#fff',
// height: 56,
// align: 'center',
// width: 50,
// fontSize: 16
// }
// }
// },
data: []
}
]
2023-04-26 14:14:29 +08:00
}
2023-04-26 17:32:51 +08:00
this.chart.setOption(option)
this.chart.on('click', e => {
this.getInfo(e.name)
})
},
2023-04-23 17:50:29 +08:00
2023-04-26 17:32:51 +08:00
getInfo (name) {
this.title = `${name}公安局`
2023-04-27 16:19:09 +08:00
this.instance.post(`/api/wxgridinfo/comprehensiveOverviewMap`, null, {
2023-04-26 17:32:51 +08:00
params: {
gridName: `${name}公安局`,
corpId: 'wpytYEDgAA5zwi8Ak2mwFh3PwBKwwlWA'
}
}).then(res => {
if (res.code === 0) {
this.info = res.data
this.isShowInfo = true
}
})
2023-04-23 17:50:29 +08:00
}
}
}
</script>
<style lang="scss" scoped>
2023-04-25 17:25:29 +08:00
.AiDvMap {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
.info {
position: fixed;
left: 0;
top: 0;
z-index: 111;
width: 100%;
height: 100%;
overflow: hidden;
.info-mask {
position: absolute;
left: 0;
top: 0;
z-index: 1;
width: 100%;
height: 100%;
2023-04-26 09:15:35 +08:00
background: rgba($color: #000000, $alpha: 0.1);
2023-04-25 17:25:29 +08:00
}
.info-content {
position: absolute;
top: 50%;
left: 50%;
z-index: 11;
width: 378px;
height: 254px;
padding: 15px 22px 0;
background: url(https://cdn.cunwuyun.cn/dvcp/dv/qxn/info-bg.png);
background-size: 100% 100%;
transform: translate(-50%, -50%);
.info-wrapper {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
margin-top: 40px;
.info-wrapper__item {
display: flex;
2023-04-26 17:32:51 +08:00
align-items: center;
2023-04-25 17:25:29 +08:00
width: 50%;
2023-04-26 17:32:51 +08:00
line-height: 1;
2023-04-25 17:25:29 +08:00
margin-bottom: 20px;
label {
width: 70px;
margin-right: 20px;
color: #fff;
text-align: right;
font-size: 14px;
font-weight: 500;
}
span {
flex: 1;
font-size: 14px;
color: #FF8533;
}
}
}
img {
position: absolute;
top: 30px;
right: 18px;
z-index: 1;
width: 24px;
height: 24px;
cursor: pointer;
transition: all ease 300;
&:hover {
opacity: 0.6;
}
}
.info-title {
display: flex;
align-items: center;
h2 {
font-size: 16px;
color: #fff;
}
}
}
}
}
2023-04-23 17:50:29 +08:00
</style>