This commit is contained in:
zmj 2023-12-04 18:22:08 +08:00
parent 7a0a7c63b0
commit 9c7ea2527d
7 changed files with 198 additions and 180 deletions

View File

@ -44,74 +44,96 @@ import { ref, onMounted } from "vue"
import axios from "axios"; import axios from "axios";
import * as echarts from 'echarts'; import * as echarts from 'echarts';
import "echarts-gl" import "echarts-gl"
// import geoJson from "/static/jsonData/xuantan.js" import iconbg from '/static/index/mapicon.png'
import geoJson from "/static/jsonData/xuantan.js"
const u = 'https:\/\/ceshi-worker-task.lihaink.cn\/uploads\/images\/20231129\/202311291816106120a4034.png'
const icon = "https:\/\/ceshi-worker-task.lihaink.cn\/uploads\/images\/20231204\/202312041608529c9e21252.png"
const pointerFn = () => {
// console.log()
let list = []
geoJson.center.forEach((item, index) => {
list.push({
coord: item,
symbol: ('image://' + icon),//
symbolSize: [100, 30], //
symbolOffset: ['50%', '-50%'],
value: geoJson.features[index].properties.name,
animation: true,
label: {
show: true,
color: 'white',
fontSize: 14,
},
},)
})
return list
}
// pointerFn()
onMounted(() => { onMounted(() => {
const u = 'https:\/\/ceshi-worker-task.lihaink.cn\/uploads\/images\/20231129\/202311291816106120a4034.png'
axios.get('https://geo.datav.aliyun.com/areas_v3/bound/510500_full.json')
axios.get('https://geo.datav.aliyun.com/areas_v3/bound/510000_full.json')
.then(function (response) {
let geoJson = response.data
const dot = document.getElementById('img')
var mapName = 'lz'; var mapName = 'lz';
let data = [
]
const myChart = document.getElementById("chart2") const myChart = document.getElementById("chart2")
/*获取地图数据*/ /*获取地图数据*/
let option = { let option = {
geo: [ geo: [
{ {
layoutSize: '100%',// type: "map",
map: mapName,
aspectScale: 1,
zoom: 1.2,
layoutCenter: ["50%", "51%"],
layoutSize: "100%",
roam: false,
label:{
emphasis:{
show:false
}
},
show: true, show: true,
map: mapName, map: mapName,
roam: false,
zoom: 1.2, zoom: 1.2,
layoutCenter: ["50%", "50%"],
aspectScale: 1, aspectScale: 1,
label: { roam: false,
itemStyle: {
normal: { normal: {
show: false, areaColor: 'transparent',
textStyle: {
color: '#fff'
}
}, },
emphasis: {
areaColor: {
type: 'radial', // linear 线 radial
x: 0.5, // 0.5
y: 0.5, // 0.5
r: 1,
colorStops: [
{
offset: 0, color: '#A46759' // 0%
},
{
offset: 0.1, color: '#A46759' // 0%
},
{
offset: 1, color: '#FFB821' // 100%
}],
}
// borderWidth: 0
}
}, },
itemStyle: {
areaColor: {
type: "linear",
x: 0,
y: 0,
x2: 0,
y2: 0,
colorStops: [{
offset: 0,
color: "rgba(3,27,78,0.75)", // 0%
}, {
offset: 1,
color: "rgba(58,149,253,0.75)", // 50%
},],
global: true, // false
},
borderColor: "#D2F2FC",
borderWidth: 2,
shadowColor: "#8cd3ef",
shadowOffsetY: 10,
shadowBlur: 120,
},
}, },
@ -125,20 +147,7 @@ onMounted(() => {
layoutSize: "100%", layoutSize: "100%",
roam: false, roam: false,
silent: true, silent: true,
regions: [
{
name: "南海诸岛",
itemStyle: {
//
normal: {
opacity: 0, // 0
}
},
label: {
show: false //
}
}
],
itemStyle: { itemStyle: {
normal: { normal: {
borderWidth: 1, borderWidth: 1,
@ -153,8 +162,6 @@ onMounted(() => {
}, },
{ {
type: "map", type: "map",
map: mapName, map: mapName,
@ -178,13 +185,15 @@ onMounted(() => {
}, },
}, },
}, },
{ {
type: "map", type: "map",
map: mapName, map: mapName,
zlevel: -2, zlevel: -2,
aspectScale: 1, aspectScale: 1,
zoom: 1.2, zoom: 1.2,
layoutCenter: ["50%", "52%"], layoutCenter: ["50%", "53%"],
layoutSize: "100%", layoutSize: "100%",
roam: false, roam: false,
silent: true, silent: true,
@ -202,66 +211,17 @@ onMounted(() => {
}, },
}, },
// {
// type: "map",
// map: mapName,
// zlevel: -3,
// aspectScale: 1,
// zoom: 1.2,
// layoutCenter: ["50%", "53%"],
// layoutSize: "101%",
// roam: false,
// silent: true,
// regions: [
// {
// name: "",
// itemStyle: {
// //
// normal: {
// opacity: 0, // 0
// }
// },
// label: {
// show: false //
// }
// }
// ],
// itemStyle: {
// normal: {
// borderWidth: 1,
// // borderColor: "rgba(11, 43, 97,0.8)",
// borderColor: "rgba(58,149,253,0.4)",
// shadowColor: "rgba(58,149,253,1)",
// shadowOffsetY: 15,
// shadowBlur: 10,
// areaColor: "transpercent",
// },
// },
// },
{ {
type: "map", type: "map",
map: mapName, map: mapName,
zlevel: -4, zlevel: -4,
aspectScale: 1, aspectScale: 1,
zoom: 1.2, zoom: 1.2,
layoutCenter: ["50%", "53%"], layoutCenter: ["50%", "54%"],
layoutSize: "100%", layoutSize: "100%",
roam: false, roam: false,
silent: true, silent: true,
regions: [
{
name: "南海诸岛",
itemStyle: {
//
normal: {
opacity: 0, // 0
}
},
label: {
show: false //
}
}
],
itemStyle: { itemStyle: {
normal: { normal: {
borderWidth: 5, borderWidth: 5,
@ -280,63 +240,54 @@ onMounted(() => {
], ],
series: [ series: [
{ {
type: 'map', name: '资产数',
map: mapName, type: 'effectScatter',
geoIndex: 0, coordinateSystem: 'geo',
aspectScale: 1, // rippleEffect: {
period: 4, //
showLegendSymbol: true, brushType: 'fill', // stroke, fill
roam: true, scale: 12, //
label: { number: 2,
show: true,
position: "top",
distance: -10,
formatter(params) {
return "2";
},
textStyle: {
// color: "transparent",
padding: [15, 20],
backgroundColor: {
image: '/static/index/aa.png',
},
// backgroundColor:""
},
},
animation: true,
markPoint: {
symbol: "none"
}, },
data: data,
//
symbolSize: function (val) {
return 4
// return val[2] / 10;
},
markPoint: {
data:pointerFn()
},
data: (() => {
let data = {
资产数: geoJson.center
}
let finalData = []
Object.keys(data).map((i, index) => {
let child = data[i].map((row) => ({
value: row,
itemStyle: {
color: '#FFB922',
},
}))
finalData = [...finalData, ...child]
})
return finalData
})(),
}, },
], ],
}; };
echarts.registerMap(mapName, geoJson) echarts.registerMap(mapName, geoJson)
const bg = echarts.init(myChart) const bg = echarts.init(myChart)
bg.setOption(option); bg.setOption(option);
}) })
})

View File

@ -282,7 +282,8 @@ const test = () => {
} }
onMounted(() => { onMounted(() => {
document.getElementById("online").removeAttribute('_echarts_instance_');
document.getElementById("offline").removeAttribute('_echarts_instance_');
initCharts('online', options.onLine) initCharts('online', options.onLine)
initCharts('offline', options.offLine) initCharts('offline', options.offLine)

View File

@ -10,7 +10,6 @@
<div class="cont"> <div class="cont">
<div style="display: flex;justify-content: space-between;align-items: center;margin-top: 3vh;"> <div style="display: flex;justify-content: space-between;align-items: center;margin-top: 3vh;">
<img src="/static/index/JYZ.png" style="width: 2.8vw; height: 4vw;" alt=""> <img src="/static/index/JYZ.png" style="width: 2.8vw; height: 4vw;" alt="">
<div class="circle"> <div class="circle">
<img src="/static/detail/bk.png" class="act-img" alt=""> <img src="/static/detail/bk.png" class="act-img" alt="">
<div style="width: 110px;height: 110px;" class="online" id="online"></div> <div style="width: 110px;height: 110px;" class="online" id="online"></div>
@ -21,7 +20,6 @@
</div> </div>
<img src="/static/index/JTY.png" style="width: 2.8vw; height: 4vw;" alt=""> <img src="/static/index/JTY.png" style="width: 2.8vw; height: 4vw;" alt="">
</div> </div>
<div class="eqNum"> <div class="eqNum">
<div> <div>
<img src="/static/index/Q.png" alt="" style="transform: translateY(2px);"> 在线设备统计<span <img src="/static/index/Q.png" alt="" style="transform: translateY(2px);"> 在线设备统计<span
@ -50,12 +48,8 @@
style="font-size: 18px;margin-left: 1vw; ">45454</span> </div> style="font-size: 18px;margin-left: 1vw; ">45454</span> </div>
</div> </div>
<div class="map"> <div class="map">
<areaMap></areaMap> <areaMap></areaMap>
</div> </div>
</div> </div>
<div class="bottom"> <div class="bottom">
<warnPop v-if="showWarnPop" ref="ChildsDom" @off="showWarnPop = false"></warnPop> <warnPop v-if="showWarnPop" ref="ChildsDom" @off="showWarnPop = false"></warnPop>
@ -70,12 +64,12 @@
<div <div
style="display: flex;flex-direction: column;justify-content: space-between;margin-left: 1vw;color: #CAD5E5;"> style="display: flex;flex-direction: column;justify-content: space-between;margin-left: 1vw;color: #CAD5E5;">
<div style="display: flex;align-items: center;"> <div style="display: flex;align-items: center;">
<img src="/static/index/MC.png" style="width:1.5vw;height: 1.5vw;margin-right: 5px; " <img src="/static/index/MC.png" style="width:1.7vw;height: 1.5vw;margin-right: 5px; "
alt=""> alt="">
张伟 张伟
</div> </div>
<div style="display: flex;align-items: center;"> <div style="display: flex;align-items: center;">
<img src="/static/index/MC.png" style="width:1.5vw;height: 1.5vw;margin-right: 5px; " <img src="/static/index/JS.png" style="width:1.7vw;height: 1.5vw;margin-right: 5px; "
alt=""> alt="">
这是一名后端开发 这是一名后端开发
</div> </div>
@ -173,7 +167,6 @@ const config3 = reactive({
] ]
}) })
// //
const initCharts = (tag, option) => { const initCharts = (tag, option) => {
var chartDom = document.getElementById(tag); var chartDom = document.getElementById(tag);
@ -181,9 +174,7 @@ const initCharts = (tag, option) => {
myChart.setOption(option); myChart.setOption(option);
} }
const ChildsDom = ref(null); const ChildsDom = ref(null);
const showWarnPop = ref(false) const showWarnPop = ref(false)
const hdClick = (e) => { const hdClick = (e) => {
// console.log(e) // console.log(e)
if (e.ceil) { if (e.ceil) {
@ -192,7 +183,6 @@ const hdClick = (e) => {
} }
} }
} }
const showWarnDeatil = ref(false) const showWarnDeatil = ref(false)
const hdClick3 = (e) => { const hdClick3 = (e) => {
if (e.ceil) { if (e.ceil) {
@ -203,7 +193,6 @@ const hdClick3 = (e) => {
} }
} }
const test = () => { const test = () => {
router.replace('/detail') router.replace('/detail')
} }
@ -221,7 +210,8 @@ const scrollTableFn = () => {
} }
onMounted(() => { onMounted(() => {
document.getElementById("online").removeAttribute('_echarts_instance_');
document.getElementById("offline").removeAttribute('_echarts_instance_');
scrollTableFn() scrollTableFn()
initCharts('online', options.onLine) initCharts('online', options.onLine)
initCharts('offline', options.offLine) initCharts('offline', options.offLine)

BIN
static/index/JS.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

File diff suppressed because one or more lines are too long