This commit is contained in:
bb_pan 2025-09-30 16:54:14 +08:00
parent ad5c346c61
commit 9283f29cd9
8 changed files with 23599 additions and 413 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 283 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 439 B

View File

@ -0,0 +1,413 @@
<template>
<div class="middle-warp">
<div class="top-btns">
<div class="btn" :class="{ active: btnIndex == 1 }" @click="handleBtn(1)">总价值数</div>
<div class="btn" :class="{ active: btnIndex == 2 }" @click="handleBtn(2)">在库装备数</div>
<div class="btn" :class="{ active: btnIndex == 3 }" @click="handleBtn(3)">机械化率</div>
</div>
<!-- 外层容器用于加阴影 -->
<div class="map-wrapper">
<!-- 倾斜层实现 3D 倾斜效果 -->
<div class="map-tilt">
<div ref="mapChart" class="map-container"></div>
</div>
</div>
<!-- 点击城市显示详情 -->
<div
v-if="selectedCity && btnIndex == 1"x'x'x'x
class="city-tooltip"
:style="{ left: tooltipPos.x + 25 + 'px', top: tooltipPos.y + 25 + 'px' }"
>
<div class="city-name">{{ selectedCity.cityName }}</div>
<div
>装备价值 <span class="num">{{ (selectedCity.totalValue / 100000000).toFixed(4) }}</span
><span class="unit"> 亿元</span></div
>
<div
>装备数量 <span class="num">{{ selectedCity.totalEquipmentQuantity }}</span
><span class="unit"> </span></div
>
<div
>配置率 <span class="num">{{ selectedCity.configRate || 0 }}</span
><span class="unit"> %</span></div
>
<div
>线路数量 <span class="num">{{ selectedCity.lineNum }}</span
><span class="unit"> </span></div
>
<div
>变电数量 <span class="num">{{ selectedCity.substationNum }}</span
><span class="unit"> </span></div
>
<div
>电缆数量 <span class="num">{{ selectedCity.cableNum }}</span
><span class="unit"> </span></div
>
</div>
</div>
</template>
<script>
import 'echarts-gl'
import * as echarts from 'echarts'
import anhuiMapJson from '../anhui.json'
import labelBg from '../../img/value-bg.png'
import { getUnitEquipmentConfigurationApi, getEquipmentNumberApi, getMechanizationRateApi } from '@/api/wsScreen'
export default {
data() {
return {
btnIndex: 1,
myChart: null,
selectedCity: null,
tooltipPos: { x: 0, y: 0 },
cityData: [
//
// {
// cityName: '',
// deptName: '',
// value: [117.227239, 31.820586, 100],
// totalValue: 100,
// totalEquipmentQuantity: 100,
// configRate: 100,
// lineNum: 100,
// substationNum: 100,
// cableNum: 100,
// },
// {
// cityName: '',
// deptName: '',
// value: [118.62807, 31.68005, 100],
// totalValue: 100,
// totalEquipmentQuantity: 100,
// configRate: 100,
// lineNum: 100,
// substationNum: 100,
// cableNum: 100,
// },
],
}
},
created() {
this.getInfo()
// setTimeout(() => {
// console.log('🚀 ~ ~ this.cityData:', this.cityData)
// this.initMap()
// }, 300)
},
methods: {
handleBtn(index) {
this.btnIndex = index
this.cityData = []
this.getInfo()
},
async getInfo() {
try {
let res = null
if (this.btnIndex == 1) {
res = await getUnitEquipmentConfigurationApi()
if (!res.data) return
this.cityData = res.data.map((item) => {
let value = item.location.split(',')
value.push(item.totalValue)
// console.log('🚀 ~ getInfo ~ value:', value)
return {
...item,
value,
}
})
} else if (this.btnIndex == 2) {
res = await getEquipmentNumberApi()
this.cityData = res.data.map((item) => {
let value = item.location.split(',')
value.push(item.num)
// console.log('🚀 ~ getInfo ~ value:', value)
return {
...item,
value,
deptName: item.name,
}
})
} else if (this.btnIndex == 3) {
// res = await getMechanizationRateApi()
}
setTimeout(() => {
console.log('🚀 ~ 地图数据 ~ this.cityData:', this.cityData)
this.initMap()
}, 300)
console.log('🚀 ~ 地图数据 ~ res:', res)
} catch (error) {
console.log('🚀 ~ 地图数据 ~ error:', error)
// this.initMap()
}
},
initMap() {
echarts.registerMap('anhui', anhuiMapJson)
this.myChart = echarts.init(this.$refs.mapChart)
const seriesData = this.cityData
const option = {
backgroundColor: 'transparent',
geo3D: {
map: 'anhui',
roam: false, // 👈
regionHeight: 7, // 👈
shading: 'lambert', // realistic / lambert / color
realisticMaterial: {
roughness: 0.6,
metalness: 0.1,
texture: '#3A5EB1',
},
itemStyle: {
color: '#3A5EB1', // 👈
borderColor: '#ECFEFF', // 👈
borderWidth: 2,
opacity: 1,
},
label: {
show: false,
},
light: {
main: {
intensity: 1.2,
shadow: true,
shadowQuality: 'high',
alpha: 40, //
beta: 20,
},
ambient: {
intensity: 0.6,
},
},
viewControl: {
distance: 168, //
alpha: 52, //
beta: -16,
rotateSensitivity: 0, //
zoomSensitivity: 0, //
panSensitivity: 0, //
center: [12, -30, 0],
// scale: [1.5, 1, 1]
},
},
series: [
{
type: 'scatter3D',
coordinateSystem: 'geo3D',
data: seriesData,
symbol: 'circle',
symbolSize: 18,
itemStyle: {
color: '#f90', // 👈
opacity: 1, //
},
label: {
show: true,
position: 'top', // 'top'
offset: [0, -10], // 10pxx 0y -10
triggerEvent: true,
formatter: (params) => {
const val = params.data.value || []
let unit = ''
if (this.btnIndex === 1) unit = '亿'
else if (this.btnIndex === 2) unit = '台'
else if (this.btnIndex === 3) unit = '%'
return val.length
? `{val|${this.btnIndex === 1 ? (val[2] / 100000000).toFixed(4) : val[2]} ${unit}}\n{name|${
params.data.deptName
}}`
: `{name|${params.data.deptName}}`
},
rich: {
val: {
backgroundColor: { image: labelBg },
height: 28,
minWidth: 70,
lineHeight: 28,
padding: [0, 10],
align: 'center',
verticalAlign: 'middle',
color: '#fff',
fontSize: 18,
},
name: {
color: '#fff',
fontFamily: 'DS-TITLE',
fontSize: 16,
padding: [6, 0, 0, 0],
},
},
},
},
],
}
this.myChart.setOption(option)
//
this.myChart.on('click', (params) => {
console.log('🚀 ~ click ~ params:', params)
// params.name
let city =
params.data.deptName == '安徽送变电工程有限公司' ? '安徽送变电' : params.data.cityName.replace(/市$/, '')
// if (params.seriesType === 'scatter' && params.data) {
// city =
// params.data.deptName == '' ? '' : params.data.cityName.replace(/$/, '')
// } else {
// city = params.name.replace(/$/, '')
// }
this.$router.push({
path: '/screen/cityScreen',
query: {
cityName: city,
},
})
})
//
this.myChart.on('mouseover', (params) => {
console.log('🚀 ~ mouseover ~ params:', params)
let city = params.data
// if (params.seriesType === 'scatter' && params.data) {
// // console.log('🚀 ~ ~ params.data:', params.data)
// console.log('🚀 ~ mouseover ~ city:', city)
// } else {
// this.selectedCity = null
// city = this.cityData.find((c) => c.cityName === params.name)
// }
this.selectedCity = city || null
if (params.event) {
this.tooltipPos = {
x: params.event.offsetX,
y: params.event.offsetY,
}
}
})
//
this.myChart.on('mouseout', () => {
this.selectedCity = null
})
window.addEventListener('resize', () => {
this.myChart.resize()
})
},
},
beforeDestroy() {
if (this.myChart) {
this.myChart.dispose()
this.myChart = null
}
},
}
</script>
<style lang="scss" scoped>
.middle-warp {
margin-top: 80px;
position: relative;
padding-top: 20px;
border-radius: 8px;
overflow: hidden;
}
.top-btns {
margin-left: -80px;
display: flex;
justify-content: center;
.btn:not(:last-child) {
margin-right: 80px;
}
.btn {
font-size: 18px;
text-align: center;
padding: 6px 15px;
font-family: DS-TITLE;
color: #ccc;
background-image: url('../../img/btn.png');
background-size: 100% 100%;
cursor: pointer;
}
.active {
background-image: url('../../img/btn-active.png');
background-size: 100% 100%;
}
}
//
.map-wrapper {
/* margin-top: -180px; */
position: relative;
filter: drop-shadow(0 20px 20px rgba(0, 0, 0, 0.3)); // 20px
transform: translateZ(0); //
}
// 15 3D
.map-tilt {
transform: rotateX(15deg);
transform-origin: bottom center;
perspective: 1200px; // 👈
transition: transform 0.3s ease;
pointer-events: none;
height: 900px;
display: flex;
justify-content: center;
}
//
.middle-warp:hover .map-tilt {
transform: rotateX(12deg);
}
//
.map-container {
width: 160%;
height: 900px;
background: transparent;
pointer-events: auto; //
display: flex;
align-items: center;
justify-content: center;
}
.city-tooltip {
position: absolute;
top: 20px;
right: 80px;
width: 288px;
height: 288px;
color: #fdfdfd;
padding: 12px;
border-radius: 6px;
font-size: 17px;
background-image: url('../../img/dialog.png');
background-size: 100% 100%;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
z-index: 10;
.city-name {
font-size: 25px;
font-family: DS-TITLE;
margin: -5px 0 10px;
}
div {
padding-bottom: 5px;
}
//
div:not(:first-child):not(:last-child) {
margin-bottom: 10px;
border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}
.num {
font-weight: 900;
}
.unit {
font-size: 12px;
color: #ccc;
}
}
</style>

View File

@ -1,413 +1,473 @@
<template>
<div class="middle-warp">
<div class="top-btns">
<div class="btn" :class="{ active: btnIndex == 1 }" @click="handleBtn(1)">总价值数</div>
<div class="btn" :class="{ active: btnIndex == 2 }" @click="handleBtn(2)">在库装备数</div>
<div class="btn" :class="{ active: btnIndex == 3 }" @click="handleBtn(3)">机械化率</div>
</div>
<!-- 外层容器用于加阴影 -->
<div class="map-wrapper">
<!-- 倾斜层实现 3D 倾斜效果 -->
<div class="map-tilt">
<div ref="mapChart" class="map-container"></div>
</div>
</div>
<!-- 点击城市显示详情 -->
<div
v-if="selectedCity && btnIndex == 1"
class="city-tooltip"
:style="{ left: tooltipPos.x + 25 + 'px', top: tooltipPos.y + 25 + 'px' }"
>
<div class="city-name">{{ selectedCity.cityName }}</div>
<div
>装备价值 <span class="num">{{ (selectedCity.totalValue / 100000000).toFixed(4) }}</span
><span class="unit"> 亿元</span></div
>
<div
>装备数量 <span class="num">{{ selectedCity.totalEquipmentQuantity }}</span
><span class="unit"> </span></div
>
<div
>配置率 <span class="num">{{ selectedCity.configRate || 0 }}</span
><span class="unit"> %</span></div
>
<div
>线路数量 <span class="num">{{ selectedCity.lineNum }}</span
><span class="unit"> </span></div
>
<div
>变电数量 <span class="num">{{ selectedCity.substationNum }}</span
><span class="unit"> </span></div
>
<div
>电缆数量 <span class="num">{{ selectedCity.cableNum }}</span
><span class="unit"> </span></div
>
</div>
</div>
</template>
<script>
import 'echarts-gl'
import * as echarts from 'echarts'
import anhuiMapJson from '../anhui.json'
import labelBg from '../../img/value-bg.png'
import { getUnitEquipmentConfigurationApi, getEquipmentNumberApi, getMechanizationRateApi } from '@/api/wsScreen'
export default {
data() {
return {
btnIndex: 1,
myChart: null,
selectedCity: null,
tooltipPos: { x: 0, y: 0 },
cityData: [
//
// {
// cityName: '',
// deptName: '',
// value: [117.227239, 31.820586, 100],
// totalValue: 100,
// totalEquipmentQuantity: 100,
// configRate: 100,
// lineNum: 100,
// substationNum: 100,
// cableNum: 100,
// },
// {
// cityName: '',
// deptName: '',
// value: [118.62807, 31.68005, 100],
// totalValue: 100,
// totalEquipmentQuantity: 100,
// configRate: 100,
// lineNum: 100,
// substationNum: 100,
// cableNum: 100,
// },
],
}
},
created() {
this.getInfo()
// setTimeout(() => {
// console.log('🚀 ~ ~ this.cityData:', this.cityData)
// this.initMap()
// }, 300)
},
methods: {
handleBtn(index) {
this.btnIndex = index
this.cityData = []
this.getInfo()
},
async getInfo() {
try {
let res = null
if (this.btnIndex == 1) {
res = await getUnitEquipmentConfigurationApi()
if (!res.data) return
this.cityData = res.data.map((item) => {
let value = item.location.split(',')
value.push(item.totalValue)
// console.log('🚀 ~ getInfo ~ value:', value)
return {
...item,
value,
}
})
} else if (this.btnIndex == 2) {
res = await getEquipmentNumberApi()
this.cityData = res.data.map((item) => {
let value = item.location.split(',')
value.push(item.num)
// console.log('🚀 ~ getInfo ~ value:', value)
return {
...item,
value,
deptName: item.name,
}
})
} else if (this.btnIndex == 3) {
// res = await getMechanizationRateApi()
}
setTimeout(() => {
console.log('🚀 ~ 地图数据 ~ this.cityData:', this.cityData)
this.initMap()
}, 300)
console.log('🚀 ~ 地图数据 ~ res:', res)
} catch (error) {
console.log('🚀 ~ 地图数据 ~ error:', error)
// this.initMap()
}
},
initMap() {
echarts.registerMap('anhui', anhuiMapJson)
this.myChart = echarts.init(this.$refs.mapChart)
const seriesData = this.cityData
const option = {
backgroundColor: 'transparent',
geo3D: {
map: 'anhui',
roam: false, // 👈
regionHeight: 7, // 👈
shading: 'lambert', // realistic / lambert / color
realisticMaterial: {
roughness: 0.6,
metalness: 0.1,
texture: '#3A5EB1',
},
itemStyle: {
color: '#3A5EB1', // 👈
borderColor: '#ECFEFF', // 👈
borderWidth: 2,
opacity: 1,
},
label: {
show: false,
},
light: {
main: {
intensity: 1.2,
shadow: true,
shadowQuality: 'high',
alpha: 40, //
beta: 20,
},
ambient: {
intensity: 0.6,
},
},
viewControl: {
distance: 168, //
alpha: 52, //
beta: -16,
rotateSensitivity: 0, //
zoomSensitivity: 0, //
panSensitivity: 0, //
center: [12, -30, 0],
// scale: [1.5, 1, 1]
},
},
series: [
{
type: 'scatter3D',
coordinateSystem: 'geo3D',
data: seriesData,
symbol: 'circle',
symbolSize: 18,
itemStyle: {
color: '#f90', // 👈
opacity: 1, //
},
label: {
show: true,
position: 'top', // 'top'
offset: [0, -10], // 10pxx 0y -10
triggerEvent: true,
formatter: (params) => {
const val = params.data.value || []
let unit = ''
if (this.btnIndex === 1) unit = '亿'
else if (this.btnIndex === 2) unit = '台'
else if (this.btnIndex === 3) unit = '%'
return val.length
? `{val|${this.btnIndex === 1 ? (val[2] / 100000000).toFixed(4) : val[2]} ${unit}}\n{name|${
params.data.deptName
}}`
: `{name|${params.data.deptName}}`
},
rich: {
val: {
backgroundColor: { image: labelBg },
height: 28,
minWidth: 70,
lineHeight: 28,
padding: [0, 10],
align: 'center',
verticalAlign: 'middle',
color: '#fff',
fontSize: 18,
},
name: {
color: '#fff',
fontFamily: 'DS-TITLE',
fontSize: 16,
padding: [6, 0, 0, 0],
},
},
},
},
],
}
this.myChart.setOption(option)
//
this.myChart.on('click', (params) => {
console.log('🚀 ~ click ~ params:', params)
// params.name
let city =
params.data.deptName == '安徽送变电工程有限公司' ? '安徽送变电' : params.data.cityName.replace(/市$/, '')
// if (params.seriesType === 'scatter' && params.data) {
// city =
// params.data.deptName == '' ? '' : params.data.cityName.replace(/$/, '')
// } else {
// city = params.name.replace(/$/, '')
// }
this.$router.push({
path: '/screen/cityScreen',
query: {
cityName: city,
},
})
})
//
this.myChart.on('mouseover', (params) => {
console.log('🚀 ~ mouseover ~ params:', params)
let city = params.data
// if (params.seriesType === 'scatter' && params.data) {
// // console.log('🚀 ~ ~ params.data:', params.data)
// console.log('🚀 ~ mouseover ~ city:', city)
// } else {
// this.selectedCity = null
// city = this.cityData.find((c) => c.cityName === params.name)
// }
this.selectedCity = city || null
if (params.event) {
this.tooltipPos = {
x: params.event.offsetX,
y: params.event.offsetY,
}
}
})
//
this.myChart.on('mouseout', () => {
this.selectedCity = null
})
window.addEventListener('resize', () => {
this.myChart.resize()
})
},
},
beforeDestroy() {
if (this.myChart) {
this.myChart.dispose()
this.myChart = null
}
},
}
</script>
<style lang="scss" scoped>
.middle-warp {
margin-top: 80px;
position: relative;
padding-top: 20px;
border-radius: 8px;
overflow: hidden;
}
.top-btns {
margin-left: -80px;
display: flex;
justify-content: center;
.btn:not(:last-child) {
margin-right: 80px;
}
.btn {
font-size: 18px;
text-align: center;
padding: 6px 15px;
font-family: DS-TITLE;
color: #ccc;
background-image: url('../../img/btn.png');
background-size: 100% 100%;
cursor: pointer;
}
.active {
background-image: url('../../img/btn-active.png');
background-size: 100% 100%;
}
}
//
.map-wrapper {
/* margin-top: -180px; */
position: relative;
filter: drop-shadow(0 20px 20px rgba(0, 0, 0, 0.3)); // 20px
transform: translateZ(0); //
}
// 15 3D
.map-tilt {
transform: rotateX(15deg);
transform-origin: bottom center;
perspective: 1200px; // 👈
transition: transform 0.3s ease;
pointer-events: none;
height: 900px;
display: flex;
justify-content: center;
}
//
.middle-warp:hover .map-tilt {
transform: rotateX(12deg);
}
//
.map-container {
width: 160%;
height: 900px;
background: transparent;
pointer-events: auto; //
display: flex;
align-items: center;
justify-content: center;
}
.city-tooltip {
position: absolute;
top: 20px;
right: 80px;
width: 288px;
height: 288px;
color: #fdfdfd;
padding: 12px;
border-radius: 6px;
font-size: 17px;
background-image: url('../../img/dialog.png');
background-size: 100% 100%;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
z-index: 10;
.city-name {
font-size: 25px;
font-family: DS-TITLE;
margin: -5px 0 10px;
}
div {
padding-bottom: 5px;
}
//
div:not(:first-child):not(:last-child) {
margin-bottom: 10px;
border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}
.num {
font-weight: 900;
}
.unit {
font-size: 12px;
color: #ccc;
}
}
</style>
<template>
<div style="height: 100%; position: relative">
<!-- 中国地图 -->
<div class="top-btns">
<div class="btn" :class="{ active: btnIndex == 1 }" @click="handleBtn(1)">总价值数</div>
<div class="btn" :class="{ active: btnIndex == 2 }" @click="handleBtn(2)">在库装备数</div>
<div class="btn" :class="{ active: btnIndex == 3 }" @click="handleBtn(3)">机械化率</div>
</div>
<div class="echarts" id="mapChart"></div>
</div>
</template>
<script>
import * as echarts from 'echarts'
let mapJson = require('./sx.json')
// let mapBg = require('./assets/home/map-bg.jpg')
let tjf = require('./assets/home/tianjifeng.png')
let twoIcon = require('./assets/home/yd-icon.png')
import labelBg from '../../img/value-bg.png'
import { getUnitEquipmentConfigurationApi, getEquipmentNumberApi, getMechanizationRateApi } from '@/api/wsScreen'
console.log(twoIcon)
import 'echarts-gl'
export default {
props: {
isZoom: {
type: Boolean,
default: false,
},
},
data() {
return {
btnIndex: 1,
cityDate: [
// {
// cityName: '',
// deptName: '',
// value: [117.227239, 31.820586, 100],
// totalValue: 100,
// totalEquipmentQuantity: 100,
// configRate: 100,
// lineNum: 100,
// substationNum: 100,
// cableNum: 100,
// },
// {
// cityName: '',
// deptName: '',
// value: [117.330324, 33.107951, 100],
// totalValue: 100,
// totalEquipmentQuantity: 100,
// configRate: 100,
// lineNum: 100,
// substationNum: 100,
// cableNum: 100,
// },
],
}
},
mounted() {
this.initChart()
this.getInfo()
},
methods: {
handleBtn(index) {
this.btnIndex = index
this.cityData = []
this.getInfo()
},
async getInfo() {
try {
let res = null
if (this.btnIndex == 1) {
res = await getUnitEquipmentConfigurationApi()
if (!res.data) return
this.cityData = res.data.map((item) => {
let value = item.location.split(',')
value.push(item.totalValue)
// console.log('🚀 ~ getInfo ~ value:', value)
return {
...item,
value,
}
})
} else if (this.btnIndex == 2) {
res = await getEquipmentNumberApi()
this.cityData = res.data.map((item) => {
let value = item.location.split(',')
value.push(item.num)
// console.log('🚀 ~ getInfo ~ value:', value)
return {
...item,
value,
deptName: item.name,
}
})
} else if (this.btnIndex == 3) {
res = await getMechanizationRateApi()
}
setTimeout(() => {
console.log('🚀 ~ 地图数据 ~ this.cityData:', this.cityData)
this.initMap()
}, 300)
console.log('🚀 ~ 地图数据 ~ res:', res)
} catch (error) {
console.log('🚀 ~ 地图数据 ~ error:', error)
// this.initMap()
}
},
initChart(jsonData = mapJson) {
//
let arr = this.cityDate.map((item) => {
return {
...item,
name: item.cityName,
}
})
echarts.registerMap('ah', jsonData)
const charEle = document.getElementById('mapChart')
const myChart = echarts.init(charEle)
// let tooltip = gzjhTooltip(arr)
const option = {
tooltip: {
show: true,
backgroundColor: 'transparent',
borderWidth: 0,
formatter: function (e) {
let n = e.name
let res = ''
arr.forEach((data) => {
console.log('🚀 ~ 提示数据 ~ data:', data)
if (data.cityName === n) {
res =
"<div style='width: 330px;height: 285px; background: url(" +
require('../../img/dialog.png') +
") no-repeat;background-size:100% 100%;'>" +
"<div style='width: 300px;height: 34px;display: flex;align-items: center;text-shadow:0px 3px 6px #001441; padding-left: 30px;font-family: DS-TITLE;color:#FFF;font-size:22px;padding-top: 10px;'>" +
n +
'</div>' +
"<div style='margin-top:10px;margin-bottom:5px;width: 300px;height: 30px;line-height:30px;display: flex;align-items:center; padding-left: 30px;font-family:Source Han Sans CN;font-size: 16px;color: #ffffff;background: url(" +
require('./assets/home/map-item-row.png') +
") no-repeat;background-size:100%;margin-left:20px'>" +
"<div style='width:8px;height:8px;border-radius:50%;background:#FFF;margin-right:8px;'></div>" +
'<div>装备价值:' +
'</div>' +
"<div style='font-family: YouSheBiaoTiHei;margin-left: 10px;color:rgba(247, 196, 30, 1);'>" +
(data.totalValue / 100000000).toFixed(4) +
" <span style='color:#FFF;font-size:14px'> 亿元</span>" +
'</div>' +
'</div>' +
"<div style='width: 300px;margin-top:10px;height: 30px;line-height:30px;display: flex;align-items:center; padding-left: 30px;font-family:Source Han Sans CN;font-size: 16px;color: #ffffff;background: url(" +
require('./assets/home/map-item-row.png') +
") no-repeat;background-size:100%;margin-left:20px'>" +
"<div style='width:8px;height:8px;border-radius:50%;background:#FFF;margin-right:8px;'></div>" +
'<div>装备数量:' +
'</div>' +
"<div style='font-family: YouSheBiaoTiHei;margin-left: 10px;color:rgba(247, 196, 30, 1)'>" +
data.totalEquipmentQuantity +
"<span style='color:#FFF;font-size:14px'> 台</span>" +
'</div>' +
'</div>' +
"<div style='width: 300px;margin-top:10px;height: 30px;line-height:30px;display: flex;align-items:center; padding-left: 30px;font-family:Source Han Sans CN;font-size: 16px;color: #ffffff;background: url(" +
require('./assets/home/map-item-row.png') +
") no-repeat;background-size:100%;margin-left:20px'>" +
"<div style='width:8px;height:8px;border-radius:50%;background:#FFF;margin-right:8px;'></div>" +
'<div>配置率:' +
'</div>' +
"<div style='font-family: YouSheBiaoTiHei;margin-left: 10px;color:rgba(247, 196, 30, 1)'>" +
data.configRate +
"<span style='color:#FFF;font-size:14px'> %</span>" +
'</div>' +
'</div>' +
"<div style='width: 300px;margin-top:10px;height: 30px;line-height:30px;display: flex;align-items:center; padding-left: 30px;font-family:Source Han Sans CN;font-size: 16px;color: #ffffff;background: url(" +
require('./assets/home/map-item-row.png') +
") no-repeat;background-size:100%;margin-left:20px'>" +
"<div style='width:8px;height:8px;border-radius:50%;background:#FFF;margin-right:8px;'></div>" +
'<div>线路数量:' +
'</div>' +
"<div style='font-family: YouSheBiaoTiHei;margin-left: 10px;color:rgba(247, 196, 30, 1)'>" +
data.lineNum +
"<span style='color:#FFF;font-size:14px'> 台</span>" +
'</div>' +
'</div>' +
"<div style='width: 300px;margin-top:10px;height: 30px;line-height:30px;display: flex;align-items:center; padding-left: 30px;font-family:Source Han Sans CN;font-size: 16px;color: #ffffff;background: url(" +
require('./assets/home/map-item-row.png') +
") no-repeat;background-size:100%;margin-left:20px'>" +
"<div style='width:8px;height:8px;border-radius:50%;background:#FFF;margin-right:8px;'></div>" +
'<div>变电数量:' +
'</div>' +
"<div style='font-family: YouSheBiaoTiHei;margin-left: 10px;color:rgba(247, 196, 30, 1)'>" +
data.substationNum +
"<span style='color:#FFF;font-size:14px'> 台</span>" +
'</div>' +
'</div>' +
"<div style='width: 300px;margin-top:10px;height: 30px;line-height:30px;display: flex;align-items:center; padding-left: 30px;font-family:Source Han Sans CN;font-size: 16px;color: #ffffff;background: url(" +
require('./assets/home/map-item-row.png') +
") no-repeat;background-size:100%;margin-left:20px'>" +
"<div style='width:8px;height:8px;border-radius:50%;background:#FFF;margin-right:8px;'></div>" +
'<div>电缆数量:' +
'</div>' +
"<div style='font-family: YouSheBiaoTiHei;margin-left: 10px;color:rgba(247, 196, 30, 1)'>" +
data.cableNum +
"<span style='color:#FFF;font-size:14px'> 台</span>" +
'</div>' +
'</div>' +
'</div>'
}
})
return res
},
},
geo3D: {
map: 'ah',
zoom: 1,
roam: false,
label: { show: false },
itemStyle: {
opacity: 0, //.01 // important!
},
emphasis: {
label: { show: false },
itemStyle: { opacity: 0 },
},
regionHeight: 0,
shading: 'lambert',
// lambertMaterial: {
// detailTexture: mapBg
// },
viewControl: {
zoomSensitivity: false,
rotateSensitivity: 0,
projection: 'orthographic',
autoRotate: false,
autoRotateAfterStill: 1,
orthographicSize: 100,
minAlpha: 20, // alpha [ default: 5 ]
maxAlpha: 90, // alpha [ default: 90 ]
minBeta: -360, // beta [ default: -80 ]
maxBeta: 360, // beta [ default: 80 ]
animation: false, // [ default: true ]
animationDurationUpdate: 1000, // [ default: 1000 ]
animationEasingUpdate: 'cubicInOut', // [ default: cubicInOut ]
},
light: {
//
main: {
color: '#02fce7', //
intensity: 0.5, //
shadow: true, //
shadowQuality: 'ultra', // ultra //
alpha: 30,
beta: 90,
},
ambient: {
color: '#fff',
intensity: 1,
},
},
zlevel: -8,
},
//
series: [
{
left: 2,
top: 8,
bottom: 20,
type: 'map3D',
map: 'ah',
roam: false,
data: arr,
itemStyle: {
// color: "#4b6f52",
color: 'transparent',
borderWidth: 2,
borderColor: '#b8cad1',
opacity: 1,
},
emphasis: {
disabled: true, //
label: {
//
show: true,
color: '#FFF', //
},
itemStyle: {
// color: "#4b6f52",
color: 'rgba(3,240,247,0.3)',
},
},
regionHeight: 0,
shading: 'lambert',
// lambertMaterial: {
// detailTexture: mapBg,
// textureTiling: 1,
// // textureOffset:20
// },
viewControl: {
zoomSensitivity: false,
rotateSensitivity: 0,
projection: 'orthographic',
autoRotate: false,
autoRotateAfterStill: 1,
orthographicSize: 94,
minAlpha: 20, // alpha [ default: 5 ]
maxAlpha: 90, // alpha [ default: 90 ]
minBeta: -360, // beta [ default: -80 ]
maxBeta: 360, // beta [ default: 80 ]
animation: false, // [ default: true ]
animationDurationUpdate: 1000, // [ default: 1000 ]
animationEasingUpdate: 'cubicInOut', // [ default: cubicInOut ]
},
label: {
show: true,
color: '#FFF',
position: 'top',
},
light: {
//
main: {
color: 'rgb(14,70,82)', //
intensity: 0.1, //
shadow: true, //
shadowQuality: 'ultra', // ultra //
alpha: 30,
beta: 90,
},
ambient: {
color: '#fff',
intensity: 1,
},
},
zlevel: 1,
zoom: 1,
scaleLimit: {
//
min: 1, //
max: 1, //
},
},
{
type: 'scatter3D',
data: arr,
symbol: 'circle',
symbolSize: 18,
coordinateSystem: 'geo3D',
label: {
show: true,
position: 'top', // 'top'
offset: [0, -10], // 10pxx 0y -10
// triggerEvent: true,
formatter: (params) => {
// console.log('🚀 ~ initChart ~ params:', params)
const val = params.data.value || []
let unit = ''
if (this.btnIndex === 1) unit = '亿'
else if (this.btnIndex === 2) unit = '台'
else if (this.btnIndex === 3) unit = '%'
return val.length
? `{val|${this.btnIndex === 1 ? (val[2] / 100000000).toFixed(4) : val[2]} ${unit}}\n{name|${
params.data.deptName
}}`
: `{name|${params.data.deptName}}`
},
rich: {
val: {
backgroundColor: { image: labelBg },
height: 28,
minWidth: 70,
lineHeight: 28,
padding: [0, 10],
align: 'center',
verticalAlign: 'middle',
color: '#fff',
fontSize: 22,
},
name: {
color: '#fff',
fontFamily: 'DS-TITLE',
fontSize: 20,
padding: [6, 0, 0, 0],
},
},
},
itemStyle: {
color: 'rgba(217, 94, 0, 1)',
},
zlevel: 1,
},
],
graphic: {
elements: [
{
type: 'image',
style: {
image: tjf, // URL
width: 991, //
height: 950, //
//
x: 0,
y: 0,
},
left: 'center',
top: 'center',
},
],
},
}
myChart.setOption(option)
//
myChart.on('click', (params) => {
console.log('🚀 ~ 点击 ~ params-->:', params)
console.log('🚀 ~ initChart ~ params.data-->>:', params.data)
if (params.seriesType === 'map3D' && params.data) {
let city =
params.data.deptName == '安徽送变电工程有限公司' ? '安徽送变电' : params.data.name.replace(/市$/, '')
console.log('🚀 ~ initChart ~ this.$router:', this.$router)
this.$router.push({
path: '/screen/cityScreen',
query: {
cityName: city,
},
})
}
})
myChart.on('mouseover', (params) => {
// console.log('🚀 ~ ~ params:', params)
})
myChart.on('mouseout', () => {
// this.selectedCity = null
})
return myChart
},
},
}
</script>
<style lang="scss" scoped>
.echarts {
width: 1100px;
height: 869px;
margin: 20px auto 0;
transform: scale(1.1, 0.85);
transform-origin: 50% 30%;
}
.top-btns {
margin-top: 100px;
margin-left: -180px;
display: flex;
justify-content: center;
.btn:not(:last-child) {
margin-right: 80px;
}
.btn {
font-size: 18px;
text-align: center;
padding: 6px 15px;
font-family: DS-TITLE;
color: #ccc;
background-image: url('../../img/btn.png');
background-size: 100% 100%;
cursor: pointer;
}
.active {
background-image: url('../../img/btn-active.png');
background-size: 100% 100%;
}
}
</style>

File diff suppressed because it is too large Load Diff