This commit is contained in:
bb_pan 2026-01-22 18:32:51 +08:00
parent b3964d3580
commit fa72d97015
9 changed files with 23154 additions and 11 deletions

View File

@ -1,5 +1,5 @@
<template>
<div class="content-warp">
<div class="app-container">
<div class="top">
<div class="top-1">
<Top1 />
@ -66,11 +66,8 @@ export default {
</script>
<style lang="scss" scoped>
.content-warp {
width: 100%;
height: 100%;
.app-container {
background: #e1ebf7;
padding: 24px;
}
.top {
margin-bottom: 16px;

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

View File

@ -1,19 +1,436 @@
<template>
<div>
地图
<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-box">
<div class="echarts" id="mapChart"></div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
import { getUnitEquipmentConfigurationApi, getEquipmentNumberApi, getMechanizationRateApi } from '@/api/wsScreen'
import * as echarts from 'echarts'
import 'echarts-gl'
let mapImg = require('./Map/assets/img/anhui.png')
import labelBg from './Map/assets/img/value-bg.png'
let mapJson = require('./Map/ah.json')
export default {
data() {
return {
btnIndex: 1,
cityData: [],
}
},
created() {
this.getInfo()
},
methods: {
handleBtn(index) {
if (this.btnIndex == index) return
this.btnIndex = index
this.cityData = []
this.getInfo()
},
async getInfo() {
try {
let res = null
if (this.btnIndex == 1) {
res = await getUnitEquipmentConfigurationApi()
if (!res.data) return
res.data = res.data.filter((item) => item.location)
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()
if (!res.data) return
res.data = res.data.filter((item) => item.location)
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()
}
this.$nextTick(() => {
console.log('🚀 ~ 地图数据 ~ this.cityData:', this.cityData)
this.initChart()
})
console.log('🚀 ~ 地图数据 ~ res:', res)
} catch (error) {
console.log('🚀 ~ 地图数据 ~ error:', error)
// this.initChart()
}
},
}
initChart(jsonData = mapJson) {
//
let arr = this.cityData.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('./Map/assets/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;'>" +
data.deptAbbreviation +
'</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('./Map/assets/img/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 +
" <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('./Map/assets/img/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('./Map/assets/img/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('./Map/assets/img/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('./Map/assets/img/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('./Map/assets/img/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: {
disabled: true,
},
regionHeight: 0,
shading: 'lambert',
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: 0,
top: 6,
bottom: 22,
type: 'map3D',
map: 'ah',
roam: false,
data: arr,
itemStyle: {
// color: "#4b6f52",
color: 'transparent',
borderWidth: 2,
borderColor: '#b8cad1',
opacity: 1,
},
emphasis: {
disabled: false, // 👈
label: {
show: false,
color: '#fff',
},
itemStyle: {
color: 'rgba(44, 186, 178, 0.45)', // 👈 绿
borderColor: '#2cbab2', // 👈
borderWidth: 2,
},
},
regionHeight: 0,
shading: 'lambert',
viewControl: {
zoomSensitivity: false,
rotateSensitivity: 0,
projection: 'orthographic',
autoRotate: false,
autoRotateAfterStill: 1,
orthographicSize: 92,
animation: false, // [ default: true ]
animationDurationUpdate: 1000, // [ default: 1000 ]
animationEasingUpdate: 'cubicInOut', // [ default: cubicInOut ]
},
label: {
show: true,
color: '#FFF',
position: 'top',
fontSize: 12,
},
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: 11,
coordinateSystem: 'geo3D',
label: {
show: false,
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|${val[2]} ${unit}}\n{name|${params.data.deptAbbreviation}}`
: `{name|${params.data.deptAbbreviation}}`
},
rich: {
val: {
backgroundColor: { image: labelBg },
height: 28,
minWidth: 70,
lineHeight: 28,
padding: [0, 10],
align: 'center',
verticalAlign: 'middle',
color: '#fff',
fontSize: 23,
},
name: {
color: '#fff',
fontFamily: 'DS-TITLE',
fontSize: 21,
padding: [6, 0, 0, 0],
},
},
},
itemStyle: {
color: 'rgba(217, 94, 0, 1)',
},
zlevel: 1,
},
],
graphic: {
elements: [
{
type: 'image',
style: {
image: mapImg, // URL
width: 456, //
height: 440, //
//
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.data) return
this.$router.push({
path: '/equipment/equipment-ledger',
query: {
parentId: params.data.parentId,
deptId: params.data.deptId,
},
})
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,
// },
// })
// window.open(`${window.location.origin}/screen/cityScreen?cityName=${city}`, '_blank')
}
})
myChart.on('mouseover', (params) => {
// console.log('🚀 ~ ~ params:', params)
})
myChart.on('mouseout', () => {
// this.selectedCity = null
})
return myChart
},
},
}
</script>
<style lang="scss" scoped>
.top-btns {
display: flex;
align-items: center;
</style>
.btn {
margin-right: 24px;
height: 30px;
font-family: Microsoft YaHei, Microsoft YaHei;
font-weight: bold;
font-size: 16px;
cursor: pointer;
}
.active {
color: #2cbab2;
border-bottom: 2px solid #2cbab2;
}
}
.map-box {
width: 100%;
height: 440px;
}
.echarts {
width: 100%;
height: 100%;
}
</style>

View File

@ -54,6 +54,7 @@
<script>
import TitleBox from '../TitleBox'
import Gauge from './Gauge'
import { getProjectEquipmentApi } from '@/api/wsScreen'
export default {
name: 'Top3',

View File

@ -28,6 +28,21 @@ export default {
</script>
<style lang="scss" scoped>
/* Chrome / Edge / Safari */
::-webkit-scrollbar {
width: 0px;
height: 0px;
}
/* Firefox */
* {
scrollbar-width: none; /* none | thin */
}
/* IE 10+ */
* {
-ms-overflow-style: none;
}
@font-face {
font-family: 'OPPOSans';
src: url('../../assets/font-family/OPPOSans.ttf');