修改地图

dev
夜笙歌 6 months ago
parent 25054ef36d
commit e239834c9e

@ -7,6 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<link rel="icon" href="<%= BASE_URL %>favicon.ico"> <link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= webpackConfig.name %></title> <title><%= webpackConfig.name %></title>
<script src="http://api.tianditu.gov.cn/api?v=4.0&tk=e0c4dfdc0b3c99c4b39eaaecf06eebee" type="text/javascript"></script>
<!--[if lt IE 11]><script>window.location.href='/html/ie.html';</script><![endif]--> <!--[if lt IE 11]><script>window.location.href='/html/ie.html';</script><![endif]-->
<style> <style>
html, html,

@ -0,0 +1,18 @@
<template>
<div>
<router-view> </router-view>
</div>
</template>
<script>
import {AppMain} from './components'
import BoardTopNav from "@/components/BoardTopNav";
export default {
name: 'BoardIndex',
components: {
AppMain,
BoardTopNav
},
}
</script>

@ -5,6 +5,7 @@ Vue.use(Router)
/* Layout */ /* Layout */
import Layout from '@/layout' import Layout from '@/layout'
import BoardIndex from '@/layout/boardIndex1.vue'
/** /**
* Note: 路由配置项 * Note: 路由配置项
@ -30,6 +31,17 @@ import Layout from '@/layout'
// 公共路由 // 公共路由
export const constantRoutes = [ export const constantRoutes = [
{
path: '/map',
component: BoardIndex,
hidden: true,
children: [
{
path: '/',
component: () => import('@/views/board/map/index.vue')
}
]
},
{ {
path: '/redirect', path: '/redirect',
component: Layout, component: Layout,

File diff suppressed because it is too large Load Diff

@ -1,7 +1,53 @@
<template> <template>
<div class="container"> <div class="container">
<div class="centerImg"></div> <div class="centerImg"></div>
<Chart ref="chart1" class="chart1"></Chart> <div class="table2">
<div style="background-color: #094170">
<div class="scrollTable" style="font-weight: bold;">
设备名称
</div>
<div class="scrollTable" style="font-weight: bold;">
经度
</div>
<div class="scrollTable" style="font-weight: bold;">
纬度
</div>
<div class="scrollTable" style="font-weight: bold;">
操作
</div>
</div>
<vue-seamless-scroll
:class-option="{...chart1TableOption,limitMoveNum:10}"
:data="table2Data"
class="case-item"
style="height: 84%;overflow: hidden;"
>
<div
v-for="(item, index) in table2Data"
:key="index"
>
<div :style='"background-color:" + ((index % 2 === 0)? "#053460":"#032d57") '>
<div
class="scrollTable">
{{ item.value1 }}
</div>
<div
class="scrollTable">
{{ item.value2 }}
</div>
<div
class="scrollTable">
{{ item.value3 }}
</div>
<div class="scrollTable" style="width: 25%">
<el-button size="mini" type="primary" @click="dispose(item)"></el-button>
<el-button size="mini" type="primary" @click="dispose(item)"></el-button>
</div>
</div>
</div>
</vue-seamless-scroll>
</div>
<div class="table1"> <div class="table1">
<div style="background-color: #094170"> <div style="background-color: #094170">
<div class="scrollTable" style="font-weight: bold;"> <div class="scrollTable" style="font-weight: bold;">
@ -50,7 +96,7 @@
</vue-seamless-scroll> </vue-seamless-scroll>
</div> </div>
<div> <div>
<div class="title1">监控单元报警统计</div> <div class="title1">信标设备列表</div>
<div class="title2">告警信息</div> <div class="title2">告警信息</div>
<div class="info1">监控单元数量</div> <div class="info1">监控单元数量</div>
<div class="info2">设备数量</div> <div class="info2">设备数量</div>
@ -60,6 +106,14 @@
<div class="num3">{{ num3 }}</div> <div class="num3">{{ num3 }}</div>
</div> </div>
<div id="map" class="map"></div> <div id="map" class="map"></div>
<div class="isRail">
<el-switch
v-model="isRail"
@change="RailChange"
active-text="显示电子围栏"
inactive-text="隐藏电子围栏">
</el-switch>
</div>
</div> </div>
</template> </template>
@ -79,6 +133,9 @@ import {handleAlarmInfo} from "@/api/board/index";
let map = null let map = null
let polyEditor = null let polyEditor = null
let texts = []
let polygons = []
let circles = []
export default { export default {
components: { components: {
Chart, Chart,
@ -137,7 +194,9 @@ export default {
}, },
}, },
table1Data: [], table1Data: [],
table2Data: [],
sceneId: 0, sceneId: 0,
isRail: true,
} }
}, },
async mounted() { async mounted() {
@ -211,6 +270,7 @@ export default {
'font-size': '1vw' 'font-size': '1vw'
}) })
map.add(text) map.add(text)
texts.push(text)
}, },
setPolygon(position, val) { setPolygon(position, val) {
let e = position.map(val => { let e = position.map(val => {
@ -222,6 +282,7 @@ export default {
}); });
map.add(thisPolygon) map.add(thisPolygon)
map.setFitView() map.setFitView()
polygons.push(thisPolygon)
}, },
setCircle(center, radius, e) { setCircle(center, radius, e) {
let circle = new AMap.Circle({ let circle = new AMap.Circle({
@ -237,55 +298,11 @@ export default {
}) })
map.add(circle); map.add(circle);
map.setFitView() map.setFitView()
circles.push(circle)
}, },
async getAlarmStats() { async getAlarmStats() {
if (this.$store.getters.sceneId === null) return if (this.$store.getters.sceneId === null) return
const {data} = await alarmStats(this.$store.getters.sceneId) const {data} = await alarmStats(this.$store.getters.sceneId)
let option1 = {
...this.chart1Option,
yAxis: {
axisLine: {
show: true,
lineStyle: {
color: "#fffa",
},
},
splitLine: {
show: true,
lineStyle: {
color: "#fff4",
type: 'dashed'
},
},
type: "category",
data: data.map(e => e.monitorUnitName),
},
series: [
{
name: "数量",
type: "bar",
yAxisIndex: 0,
data: data.map(e => e.sum),
barWidth: '60%',
itemStyle: {
normal: {
show: true,
color: new echarts.graphic.LinearGradient(1, 0, 0, 0, [
{
offset: 0,
color: "#00faff",
},
{
offset: 1,
color: "#1eadf1",
},
]),
},
},
},
],
}
this.$refs.chart1.setData(option1)
}, },
async getAubDevice() { async getAubDevice() {
let data = await subDevice(this.$store.getters.sceneId) let data = await subDevice(this.$store.getters.sceneId)
@ -303,6 +320,7 @@ export default {
status: e.handleStatus status: e.handleStatus
} }
}) })
this.table2Data = this.table1Data
}, },
async setElectronicNumVo() { async setElectronicNumVo() {
const {data} = await ElectronicNumVo(this.$store.getters.sceneId) const {data} = await ElectronicNumVo(this.$store.getters.sceneId)
@ -315,11 +333,20 @@ export default {
} }
this.setText(e) this.setText(e)
}) })
},
RailChange(e){
if(e){
this.setElectronicNumVo()
}else{
map.remove(texts)
map.remove(polygons)
map.remove(circles)
}
} }
} }
}; };
</script> </script>
<style scoped> <style scoped lang="less">
.container { .container {
background-image: url("~@/assets/board/GPS/bg.jpg"); background-image: url("~@/assets/board/GPS/bg.jpg");
background-repeat: no-repeat; background-repeat: no-repeat;
@ -329,7 +356,7 @@ export default {
position: relative; position: relative;
} }
.chart1 { .table2 {
position: absolute; position: absolute;
width: 25%; width: 25%;
height: 21%; height: 21%;
@ -437,4 +464,20 @@ export default {
width: 67%; width: 67%;
height: 69%; height: 69%;
} }
.isRail {
position: absolute;
top: 25%;
left: 31%;
/*transform: translate(-50%,-50%);*/
/deep/ .el-switch__label {
color: #fff;
}
/deep/ .el-switch__label.is-active {
color: #1890ff;
}
}
</style> </style>

@ -0,0 +1,221 @@
<template>
<div class="container">
<Chart ref="chart" class="chart"></Chart>
</div>
</template>
<script>
import Chart from "../../../components/Charts/Chart";
import * as echarts from 'echarts';
import ChinaMapData from '@/utils/ChinaMapData.json'
import axios from "axios";
const vw = (document.documentElement.clientWidth || document.body.clientWidth) / 100
export default {
components: {Chart},
data() {
return {
code: 100000,
cityJson: null
}
},
async mounted() {
let mapData = this.code === 100000 ? ChinaMapData : (await axios.get(`https://geo.datav.aliyun.com/areas_v3/bound/${this.code}_full.json`)).data
this.getMap(mapData)
this.chartClick()
},
methods: {
getMap(geoJson) {
this.cityJson = geoJson.features
echarts.registerMap('map', geoJson);
const random = (val = 1) => {
return Math.ceil(Math.random() * val)
}
let Point = [
{value: [120.3, 36.0], index: random(5), type: random(5), state: random(5)},
{value: [104.065735, 30.659462], index: random(5), type: random(5), state: random(5)},
{value: [123.1238, 42.1216], index: random(5), type: random(5), state: random(5)},
{value: [114.4995, 38.1006], index: random(5), type: random(5), state: random(5)},
{value: [109.1162, 34.2004], index: random(5), type: random(5), state: random(5)},
{value: [106.3586, 38.1775], index: random(5), type: random(5), state: random(5)},
{value: [101.4038, 36.8207], index: random(5), type: random(5), state: random(5)},
{value: [113.0823, 28.2568], index: random(5), type: random(5), state: random(5)},
{value: [102.9199, 25.46639], index: random(5), type: random(5), state: random(5)},
]
let option = {
grid: {
top: '0%',
left: '0%',
right: '0%',
bottom: '0%',
},
geo: {
map: "map",
show: false,
aspectScale: 0.75, //
zoom: 1.1,
label: {
show: true
},
roam: false,
layoutCenter: ["50%", "50%"], // position
layoutSize: 25 * vw,
itemStyle: {
normal: {
areaColor: {
type: "radial",
x: 0.5,
y: 0.5,
r: 0.8,
colorStops: [
{
offset: 0,
color: "#013B8F", // 0%
},
{
offset: 1,
color: "#013B8F", // 100%
},
],
globalCoord: true, // false
},
shadowColor: "#013B8F",
shadowOffsetX: 0,
shadowOffsetY: 8,
},
emphasis: {
areaColor: "#2AB8FF",
borderWidth: 0,
color: "green",
label: {
show: false,
},
},
},
},
series: [
{
type: "map",
roam: false,
label: {
normal: {
show: true,
textStyle: {
color: "#1DE9B6",
},
},
},
itemStyle: {
normal: {
borderColor: "rgb(147, 235, 248,0.5)",
borderWidth: 1,
areaColor: {
type: "radial",
x: 0.5,
y: 0.5,
r: 0.8,
colorStops: [
{
offset: 0,
color: "#013B8F", // 0%
},
{
offset: 1,
color: "#013B8F", // 100%
},
],
globalCoord: true, // false
},
},
},
zoom: 1.1,
map: 'map', //使
aspectScale: 0.75, //
},
{
type: "effectScatter",
coordinateSystem: "geo",
showEffectOn: 'emphasis',
zlevel: 1,
rippleEffect: {
period: 15,
scale: 1,
brushType: "fill",
},
hoverAnimation: true,
itemStyle: {
normal: {
color: "#1DE9B6",
shadowBlur: 10,
shadowColor: "#333",
},
},
symbolSize: [0.5 * vw, 0.5 * vw],
data: Point,
label: {
padding: [-16, 0, 0, 5],
show: true,
position: 'bottom',
formatter: function (val) {
return [`{a|}{b|'点位${val.data.index}}`]
},
rich: {
a: {
width: 0.34 * vw,
height: 0.34 * vw,
borderColor: '#0FF32E',
borderWidth: 0.34 * vw,
borderRadius: 0.17 * vw,
shadowBlur: 20,
shadowColor: "#0FF32E",
},
b: {
padding: [0, 0, 0, 5],
color: '#0FF32E',
height: 40,
fontSize: 0.75 * vw,
},
}
}
},
],
};
this.$refs.chart.setData(option);
},
chartClick() {
this.$refs.chart.chart.on('click', async (params) => {
this.code = this.cityJson[params.dataIndex].properties.adcode
let mapData = this.cityJson[params.dataIndex].properties.adcode === 100000 ? ChinaMapData : (await axios.get(`https://geo.datav.aliyun.com/areas_v3/bound/${this.cityJson[params.dataIndex].properties.adcode}_full.json`)).data
this.getMap(mapData)
})
this.$refs.chart.$el.addEventListener('dblclick', ()=> {
this.chartDblClick(this.code)
});
},
async chartDblClick(val) {
let a = val.toString().substr(0, 2)
let b = val.toString().substr(2, 2)
let c = val.toString().substr(4, 2)
if (c !== '00') {
// this.code = Number(a + b + '00')
this.code = Number(a + '0000')
} else if (b !== '00') {
this.code = Number(a + '0000')
} else if (a !== '10') {
this.code = 100000
}
let mapData = this.code === 100000 ? ChinaMapData : (await axios.get(`https://geo.datav.aliyun.com/areas_v3/bound/${this.code}_full.json`)).data
this.getMap(mapData)
}
}
}
;
</script>
<style lang="less" scoped>
.chart {
width: 100%;
height: 90vh;
}
</style>

@ -512,8 +512,8 @@ import {
import {getToken} from "@/utils/auth"; import {getToken} from "@/utils/auth";
import Treeselect from "@riophae/vue-treeselect"; import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css"; import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import toggleMenuLeftImg from '@/assets/images/togglemenu-left.png' // import toggleMenuLeftImg from '@/assets/images/togglemenu-left.png'
import toggleMenuRightImg from '@/assets/images/togglemenu-right.png' // import toggleMenuRightImg from '@/assets/images/togglemenu-right.png'
export default { export default {
components: {Treeselect}, components: {Treeselect},

@ -0,0 +1,4 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
Loading…
Cancel
Save