You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1304 lines
38 KiB
Vue

2 years ago
<template>
<div class="container">
1 year ago
<div class="centerImg" v-if="!isMap"
:style="`background-image: url(${picUrl ? picUrl : containerPic})`"></div>
2 years ago
<div class="title">监控单元统计</div>
2 years ago
<Chart ref="chart1" class="chart1"></Chart>
<div class="chart1Right">
2 years ago
<p v-for="(i,k) in chart1Data.slice(0,4)" :key="k" :style="'margin:0.6vw;color:'+ chart1Color[k]">{{ i.name }}</p>
2 years ago
</div>
<div class="chart1Table">
<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>
<vue-seamless-scroll
:class-option="chart1TableOption"
:data="chart1Data"
class="case-item"
style="height: 84%;overflow: hidden;"
>
<div
v-for="(item, index) in chart1Data"
:key="index"
>
<div :style='"background-color:" + ((index % 2 === 0)? "#053460":"#032d57") '>
<div
class="scrollTable">
{{ item.name }}
</div>
<div
class="scrollTable">
{{ item.value }}
2 years ago
</div>
<div
class="scrollTable">
{{ item.value2 }}
2 years ago
</div>
</div>
</div>
</vue-seamless-scroll>
</div>
<Chart ref="chart2" class="chart2"></Chart>
<div class="chart2Table">
<div style="background-color: #094170">
<div class="scrollTable" style="font-weight: bold;width: 50%">
名称
</div>
<div class="scrollTable" style="font-weight: bold;width: 50%">
数量
</div>
</div>
<vue-seamless-scroll
:class-option="chart1TableOption"
:data="chart2Data"
class="case-item"
style="height: 84%;overflow: hidden;"
>
<div
v-for="(item, index) in chart2Data"
:key="index"
>
<div :style='"background-color:" + ((index % 2 === 0)? "#053460":"#032d57") '>
<div class="scrollTable" style="width: 50%">
{{ item.name }}
</div>
<div class="scrollTable" style="width: 50%">
{{ item.value }}
</div>
</div>
</div>
</vue-seamless-scroll>
</div>
<div>
<div class="centerInfo">传感器数量</div>
<div class="centerInfo" style="font-weight:bold;top:19.3%;left: 42.5%;font-size: 2vw;">{{
centerNum.sum
}}
</div>
2 years ago
<div class="centerInfo" style="left: 56%">监控单元数量</div>
<div class="centerInfo" style="font-weight:bold;top:19.3%;left: 66%;font-size: 2vw;">{{ centerNum.subSum }}</div>
2 years ago
</div>
<div class="inTransit">在运 <span style="color: #00f6ff">{{ inTransitNum }}</span></div>
<Chart ref="chart3" class="chart3"></Chart>
<div class="table1">
<div style="background-color: #094170">
<div class="scrollTable" style="font-weight: bold;width: 25%">
告警编号
</div>
<div class="scrollTable" style="font-weight: bold;width: 25%">
告警类型
</div>
<div class="scrollTable" style="font-weight: bold;width: 25%">
告警位置
</div>
<div class="scrollTable" style="font-weight: bold;width: 25%">
操作
</div>
</div>
<vue-seamless-scroll
:class-option="{...chart1TableOption,limitMoveNum:10}"
2 years ago
:data="table1Data"
class="case-item"
style="height: calc(100% - 33px);overflow: hidden;"
>
<div
v-for="(item, index) in table1Data"
:key="index"
>
<div :style='"background-color:" + ((index % 2 === 0)? "#053460":"#032d57") '>
<div class="scrollTable" style="width: 25%">
{{ item.no }}
</div>
<div class="scrollTable" style="width: 25%">
{{ item.type }}
</div>
<div class="scrollTable" style="width: 25%">
{{ item.location }}
</div>
<div class="scrollTable" style="width: 25%">
2 years ago
<el-button v-if="item.status === '0'" size="mini" type="primary" @click="dispose(item)"></el-button>
2 years ago
<span v-else></span>
2 years ago
</div>
</div>
</div>
</vue-seamless-scroll>
</div>
1 year ago
1 year ago
<div class="exTable">
<el-date-picker
style="width: calc(100% - 140px)"
v-model="exTableTime"
type="datetimerange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期">
</el-date-picker>
<el-button type="primary" @click="exTable" style="margin-left: 8px">导出告警信息</el-button>
</div>
1 year ago
<div v-if="isMap">
<Chart ref="mapChart" class="mapChart"></Chart>
1 year ago
<div type="primary" class="backButton" @click="goBack">
<svg t="1719391363434" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"
p-id="2674" width="200" height="200">
<path
d="M927.2 610.5c0 143-116.3 259.4-259.3 259.4H196.1c-12.9 0-23.4-10.4-23.4-23.4 0-12.9 10.4-23.4 23.4-23.4h471.7c117.2 0 212.6-95.4 212.6-212.6S785 397.8 667.8 397.8h-458l199.6 199.6c9.1 9.1 9.1 23.9 0 33-4.6 4.6-10.5 6.8-16.5 6.8s-11.9-2.3-16.5-6.8L137 391.1c-9.1-9.1-9.1-23.9 0-33l239.6-239.5c9.1-9.1 23.9-9.1 33 0s9.1 23.9 0 33L210 351.2h457.9c143 0 259.3 116.3 259.3 259.3z"
p-id="2675" fill="#ffffff"></path>
</svg>
<span>返回</span>
</div>
<div type="primary" class="realMapButton" @click="toRealMap">
<svg t="1719391119148" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"
p-id="1489" width="200" height="200">
<path
d="M512 800.182857a18.651429 18.651429 0 0 1-12.8-5.485714c-10.971429-10.971429-261.485714-265.508571-261.485714-428.982857A271.725714 271.725714 0 0 1 512 91.428571a271.725714 271.725714 0 0 1 274.285714 274.285715c0 163.474286-250.514286 418.011429-261.485714 428.982857a18.651429 18.651429 0 0 1-12.8 5.485714zM512 128A235.154286 235.154286 0 0 0 274.285714 365.714286c0 128.731429 186.148571 334.994286 237.714286 389.485714 51.565714-54.491429 237.714286-260.754286 237.714286-389.485714A235.154286 235.154286 0 0 0 512 128z"
fill="#ffffff" p-id="1490"></path>
<path
d="M512 457.142857a91.428571 91.428571 0 1 1 91.428571-91.428571 91.428571 91.428571 0 0 1-91.428571 91.428571z m0-146.285714a54.857143 54.857143 0 1 0 54.857143 54.857143A54.857143 54.857143 0 0 0 512 310.857143zM512 932.571429c-208.822857 0-420.571429-43.885714-420.571429-128 0-65.097143 123.977143-96.914286 197.851429-109.714286a18.651429 18.651429 0 0 1 21.211429 14.994286 18.285714 18.285714 0 0 1-14.628572 21.211428c-123.245714 21.942857-167.862857 55.954286-167.862857 73.142857 0 36.571429 149.577143 91.428571 384 91.428572S896 841.142857 896 804.571429c0-17.92-44.617143-51.931429-167.862857-73.142858a18.285714 18.285714 0 0 1-14.628572-21.211428 18.651429 18.651429 0 0 1 21.211429-14.994286c73.142857 13.165714 197.851429 44.982857 197.851429 109.714286 0 83.748571-211.748571 127.634286-420.571429 127.634286z"
fill="#ffffff" p-id="1491"></path>
</svg>
<span>打开地图</span>
</div>
<!-- <el-button type="primary" style="position:absolute;bottom: 4%;left: 49%;transform: translateX(-100%)"-->
<!-- @click="goBack">返回-->
<!-- </el-button>-->
<!-- <el-button type="primary" style="position:absolute;bottom: 4%;left: 51%;transform: translateX(0%)"-->
<!-- @click="toRealMap">打开地图-->
<!-- </el-button>-->
1 year ago
</div>
1 year ago
<el-dialog :visible.sync="realMap" width="80%" @close="monitorUnitId = null">
1 year ago
<el-form :inline="true" :model="formInline" class="demo-form-inline">
<el-form-item label="名称">
1 year ago
<el-select
v-model="value"
multiple
filterable
remote
reserve-keyword
placeholder="请输入关键词"
@change="setMarker2"
:remote-method="searchMap1"
:loading="loading">
<el-option
v-for="item in options"
:key="item.value.deviceId"
:label="item.label"
:value="item.value.deviceId">
</el-option>
</el-select>
1 year ago
<!-- <el-input v-model="formInline.name" placeholder="名称"></el-input>-->
1 year ago
</el-form-item>
1 year ago
<!-- <el-form-item>-->
<!-- <el-button type="primary" @click="searchMap"></el-button>-->
<!-- </el-form-item>-->
1 year ago
</el-form>
1 year ago
<el-switch
v-model="isRail"
@change="RailChange"
active-text="显示点位"
inactive-text="隐藏点位">
</el-switch>
1 year ago
<div id="map" class="map"></div>
</el-dialog>
<el-dialog
:visible.sync="isDispose"
width="30%">
1 year ago
1 year ago
<el-descriptions class="margin-top" :column="3" border>
1 year ago
<el-descriptions-item>
<template slot="label">
报警信息
</template>
{{ warInfo.alarmLevelName }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
报警位置
</template>
{{ warInfo.location }}
</el-descriptions-item>
</el-descriptions>
1 year ago
<span>备注</span>
<el-input
style="margin-top: 12px;margin-bottom:12px"
type="textarea"
:rows="2"
placeholder="请输入内容"
v-model="textarea">
</el-input>
<span slot="footer" class="dialog-footer">
<el-button @click="isDispose = false"> </el-button>
<el-button type="primary" @click="disposeThis"></el-button>
<el-button type="primary" @click="disposeAll"></el-button>
</span>
</el-dialog>
1 year ago
<el-dialog title="设备信息" :visible.sync="equipmentInfoDialog">
1 year ago
<el-descriptions class="margin-top" :column="3" border>
1 year ago
<el-descriptions-item>
<template slot="label">
经度
</template>
{{ equipmentInfo.longitude }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
纬度
</template>
{{ equipmentInfo.latitude }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
名称
</template>
{{ equipmentInfo.deviceName }}
</el-descriptions-item>
</el-descriptions>
<div slot="footer" class="dialog-footer">
<el-button @click="equipmentInfoDialog = false"> </el-button>
<el-button type="primary" @click="getDeviceInfo" :disabled="!monitorUnitId">设备信息</el-button>
<!-- <el-button type="primary" @click="equipmentInfoDialog = true">打开内层 Dialog</el-button>-->
</div>
</el-dialog>
2 years ago
</div>
</template>
<script>
1 year ago
import containerPic from "@/assets/board/index/container.png";
2 years ago
import Chart from "@/components/Charts/Chart";
import vueSeamlessScroll from "vue-seamless-scroll";
import * as echarts from 'echarts';
2 years ago
import {
monitorUnitPercentage,
monitorPercentage,
allNums,
getAlarmInfos,
2 years ago
getDeviceOperations,
1 year ago
handleAlarmInfo,
getDeviceByAreaId,
getTenantData,
selectMonitorElectronic,
1 year ago
selectDeviceByName,
exTableData
2 years ago
} from '@/api/board/index'
1 year ago
import ChinaMapData from '@/utils/ChinaMapData.json'
import gsByMap from '@/utils/map/gs_by.json'
import axios from "axios";
2 years ago
1 year ago
let map = null
let markers = []
let markerIds = []
let polygons = []
let circles = []
const vw = (document.documentElement.clientWidth || document.body.clientWidth) / 100
2 years ago
export default {
components: {
vueSeamlessScroll,
2 years ago
Chart,
2 years ago
},
data() {
return {
1 year ago
containerPic,
1 year ago
isTown:false,
value: [],
loading: false,
options: [],
1 year ago
isRail: true,
monitorUnitId: null,
equipmentInfoDialog: false,
exTableTime: [new Date(new Date().getTime() - 1000 * 60 * 60 * 24), new Date()],
equipmentInfo: {},
warInfo: {},
formInline: {},
1 year ago
textarea: '',
disposeNo: null,
isDispose: false,
realMap: false,
centerGeo: [],
picUrl: null,
code: 620000,
cityJson: null,
isMap: true,
centerNum: {},
2 years ago
chart1Option: {
2 years ago
tooltip: {
1 year ago
valueFormatter: (e) => {
return e + '%'
},
2 years ago
},
2 years ago
angleAxis: {
max: 100,
clockwise: true,
show: false,
},
radiusAxis: {
type: "category",
show: true,
axisLabel: {
show: false,
},
axisLine: {
show: false,
},
axisTick: {
show: false,
},
},
polar: {
2 years ago
center: ["30%", "50%"],
2 years ago
radius: "100%", //图形大小
},
},
chart1Color: ['#2ff', '#f22', '#f2f', '#1f1'],
2 years ago
chart1Data: [],
2 years ago
chart1TableOption: {
step: 0.5, // 数值越大速度滚动越快
limitMoveNum: 3, // 开始无缝滚动的数据量 this.dataList.length
hoverStop: true, // 是否开启鼠标悬停stop
direction: 1, // 0向下 1向上 2向左 3向右
openWatch: true, // 开启数据实时监控刷新dom
singleHeight: 0, // 单步运动停止的高度(默认值0是无缝不停止的滚动) direction => 0/1
singleWidth: 0, // 单步运动停止的宽度(默认值0是无缝不停止的滚动) direction => 2/3
waitTime: 0,
},
chart2Data: [],
2 years ago
chart2Option: {
color: ["#22acfd", "#22fe97", "#f9e728", "#ff922b", "#ed1814"],
legend: {
1 year ago
type: 'scroll',
2 years ago
orient: "vertical",
x: "right",
y: "center",
1 year ago
width: '100px',
2 years ago
textStyle: {
color: '#fff'
}
},
tooltip: {
trigger: "item",
formatter: "{b} : ({d}%)",
},
series: [
{
type: "pie",
radius: ["45%", "76%"],
center: ["35%", "50%"],
encode: {
itemName: "group",
value: "占比",
},
labelLine: {
show: false,
},
label: {
show: false,
},
itemStyle: {
opacity: '0.8'
}
},
{
type: "pie",
radius: ["75%", "90%"],
center: ["35%", "50%"],
encode: {
itemName: "group",
value: "占比",
},
labelLine: {
show: false,
},
label: {
show: false,
},
},
],
},
inTransitNum: 0,
2 years ago
chart3Option: {
tooltip: {
trigger: "axis",
},
grid: {
top: "middle",
left: "3%",
right: "4%",
bottom: "3%",
height: "80%",
containLabel: true,
},
yAxis: {
type: "value",
splitLine: {
lineStyle: {
type: "dashed",
color: "#ccc3",
},
},
axisLine: {
show: false,
lineStyle: {
color: "#ccc",
},
},
nameTextStyle: {
color: "#999",
},
splitArea: {
show: false,
},
},
},
table1Data: []
2 years ago
}
},
1 year ago
async mounted() {
getTenantData(this.$store.getters.tenantId).then(e => {
1 year ago
this.isMap = e.data.tenantField === '2';
1 year ago
this.picUrl = e.data.tenantBoardPic
1 year ago
this.code = parseFloat(e.data.tenantMapCode) || 620000
1 year ago
})
2 years ago
this.setChart1()
2 years ago
this.setChart2()
this.setAllNums()
this.setTable3()
this.setDeviceOperations()
1 year ago
let data = await axios.get(`https://geo.datav.aliyun.com/areas_v3/bound/${this.code}_full.json`)
let mapData = this.code === 100000 ? ChinaMapData : data.data
await this.getMap(mapData)
this.chartClick()
2 years ago
},
2 years ago
methods: {
2 years ago
async setChart1() {
const {rows: data} = await monitorPercentage()
1 year ago
let data1 = data.slice(0, 4)
2 years ago
data1.reverse()
2 years ago
let option1 = {
...this.chart1Option,
series: [
{
type: "bar",
2 years ago
data: data1.map((e, i) => {
2 years ago
return {
value: parseFloat(e.percentage),
name: e.sceneName,
2 years ago
itemStyle: {
2 years ago
color: this.chart1Color[i]
2 years ago
}
}
}),
showBackground: true,
coordinateSystem: "polar",
roundCap: true,
barWidth: 8,
},
]
}
this.$refs.chart1.setData(option1)
this.chart1Data = data.map(e => {
return {
value: e.sum || 0,
value2: e.err || 0,
name: e.sceneName || '',
2 years ago
}
})
},
async setChart2() {
const {rows: data} = await monitorUnitPercentage()
2 years ago
let chart2Num = eval(data.map(e => e.sum).join("+"));
let option2 = {
...this.chart2Option,
dataset: {
source: [
["group", "占比"],
2 years ago
...data.slice(0, 7).map(e => [e.deviceModeName, parseFloat(e.percentage)])
2 years ago
],
}
}
this.$refs.chart2.setData(option2)
this.chart2Data = data.map(e => {
return {
value: e.sum,
name: e.deviceModeName,
}
})
2 years ago
},
async setAllNums() {
const data = await allNums()
this.centerNum = data
},
2 years ago
async setTable3() {
const {rows: data} = await getAlarmInfos()
this.table1Data = data.map((e, i) => {
return {
1 year ago
...e,
no: e.alarmInfoId,
type: e.alarmTypeName,
location: e.monitorUnitName,
1 year ago
status: e.handleStatus
}
})
},
2 years ago
async setDeviceOperations() {
2 years ago
let {data: data} = await getDeviceOperations()
let onlineDevicesTrend = data["onlineDevicesTrend"];
let sortArr = Object.keys(onlineDevicesTrend)
1 year ago
sortArr = sortArr.sort((a, b) => {
2 years ago
return new Date(a).getTime() - new Date(b).getTime()
})
let x = sortArr
1 year ago
let y = sortArr.map(e => {
return onlineDevicesTrend[e]
2 years ago
})
// this.inTransitNum = y.reduce((a, b) => {
// return a + b
// }, 0)
this.inTransitNum = data["onlineDevicesCount"];
let option3 = {
...this.chart3Option,
xAxis: {
boundaryGap: false,
type: "category",
data: x,
splitLine: {
show: true,
lineStyle: {
type: "dashed",
color: "#ccc3",
},
},
axisLine: {
lineStyle: {
color: "#999",
},
},
},
series: [
{
name: "",
type: "line",
data: y,
color: "#00dae0",
areaStyle: {
normal: {
color: new echarts.graphic.LinearGradient(
0,
0,
0,
1,
[
{
offset: 0,
color: "#00dae033",
},
{
offset: 1,
color: "rgba(0,202,149,0)",
},
],
false
),
shadowColor: "rgba(0,202,149, 0.9)",
shadowBlur: 20,
},
},
},
],
}
this.$refs.chart3.setData(option3)
},
2 years ago
dispose(e) {
1 year ago
this.warInfo = e
1 year ago
this.textarea = ''
1 year ago
this.isDispose = true
this.disposeNo = e.no
},
disposeThis() {
handleAlarmInfo({
alarmInfoId: this.disposeNo,
alarmInfoField: this.textarea,
ifDisposalAll: 0,
}).then(e => {
if (e.code === 200) {
this.$message({
type: 'success',
message: '已处理!'
});
this.setTable3()
} else {
this.$message({
type: 'info',
message: '网络错误'
});
}
this.isDispose = false
})
},
disposeAll() {
handleAlarmInfo({
alarmInfoId: this.disposeNo,
alarmInfoField: this.textarea,
ifDisposalAll: 1,
}).then(e => {
if (e.code === 200) {
this.$message({
type: 'success',
message: '已处理!'
});
this.setTable3()
} else {
this.$message({
type: 'info',
message: '网络错误'
});
}
this.isDispose = false
})
},
async getMap(geoJson) {
this.cityJson = geoJson.features
echarts.registerMap('map', geoJson);
this.centerGeo = geoJson.features[0].properties.center || geoJson.features[0].properties.geo_wkt.split('(')[1].split(')')[0].split(' ').map(e => parseFloat(e))
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)},
]
Point = []
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: true,
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",
1 year ago
// roam: 'scale',
1 year ago
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.mapChart.setData(option);
},
chartClick() {
this.$refs.mapChart.chart.on('click', async (params) => {
1 year ago
this.isTown = (this.cityJson[params.dataIndex].properties.adcode || gsByMap.features[params.dataIndex].properties.unique_id).toString().length === 9
1 year ago
this.code = this.cityJson[params.dataIndex].properties.adcode || this.code || gsByMap.features[params.dataIndex].properties.unique_id
let mapData
if (this.code !== 620400 && this.code.toString().startsWith('6204')) {
mapData = {features: gsByMap.features.filter(e => e.properties.pid === this.code.toString())}
1 year ago
if (this.isTown) {
mapData = {features: mapData.features.filter(v => v.properties.name === params.name)}
}
1 year ago
} else {
let data = await axios.get(`https://geo.datav.aliyun.com/areas_v3/bound/${this.code}_full.json`)
mapData = this.cityJson[params.dataIndex].properties.adcode === 100000 ? ChinaMapData : data.data
}
this.getMap(mapData)
})
this.$refs.mapChart.$el.addEventListener('dblclick', () => {
this.chartDblClick(this.code)
});
},
1 year ago
goBack() {
1 year ago
if(this.isTown){
this.getMap({features: gsByMap.features.filter(e => e.properties.pid === this.code.toString())})
this.isTown = false
}else{
this.chartDblClick(this.code)
}
1 year ago
},
1 year ago
async chartDblClick(val) {
let a = val.toString().substr(0, 2)
let b = val.toString().substr(2, 2)
let c = val.toString().substr(4, 2)
let d = val.toString().substr(6, 9)
d = null
if (d && d !== '000') {
this.code = Number(a + b + c)
} else if (c !== '00') {
this.code = Number(a + b + '00')
} else if (b !== '00') {
this.code = Number(a + '0000')
} else if (a !== '10') {
this.code = 100000
}
let mapData
if (this.code !== 620400 && this.code.toString().startsWith('6204')) {
mapData = gsByMap
} else {
let data = await axios.get(`https://geo.datav.aliyun.com/areas_v3/bound/${this.code}_full.json`)
mapData = this.code === 100000 ? ChinaMapData : data.data
}
this.getMap(mapData)
},
async toRealMap() {
this.realMap = true
markerIds = []
this.$nextTick(async () => {
this.createMap()
const data = await getDeviceByAreaId(this.$store.getters.tenantId)
data.data.map(e => e.devicesList).flat(1).forEach(e => {
this.setMarker(e)
})
})
},
setMarker(e) {
1 year ago
if (!this.isRail) {
return
}
1 year ago
let marker = new AMap.Marker({
position: [e.longitude, e.latitude],
title: `信息\n经度${e.longitude}\n纬度${e.latitude}\n名称${e.deviceName}\n`,
offset: new AMap.Pixel(-15, -30),
content: `<div> <svg t="1718261114618" class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" p-id="4305" style="width: 30px;height: 30px;">
1 year ago
<path d="M512 64.5c-180.5 0-326.9 146.4-326.9 326.9 0 63.3 18 122.3 49.2 172.4 1.1 2 2.1 4 3.2 5.9 34.9 58.2 113.9 128.8 165.5 194.5 66.3 84.4 93.2 158 93.2 158 1.6 1.4 13.1 35.6 15.1 35.8 2.5 0.2 12.6-34 14.5-35.8 0 0 22-69.2 83.7-146.6 56-70.1 142.8-145.7 177-206 0.9-1.6 1.8-3.3 2.6-5 31.5-50.2 49.7-109.6 49.7-173.3 0.1-180.5-146.3-326.8-326.8-326.8z" fill="${(e.ifAlarm === '1') ? '#3D93FD' : '#ff0000'}" p-id="4306">
</path></svg></div>`
1 year ago
});
marker.on('click', async () => {
if (markerIds.includes(e.deviceId)) {
return
} else {
markerIds.push(e.deviceId)
}
const {data} = await selectMonitorElectronic(e.deviceId)
data.map(e => e.hwFenceAreaList).flat(1).forEach(e => {
if (e.areaShapeFlag === '1') {
this.setPolygon(e.areaRange.split('_').map(e => e.split(',').map(v => parseFloat(v))))
}
if (e.areaShapeFlag === '2') {
let arr = e.areaRange.split(',')
this.setCircle([arr[0], arr[1]], arr[2])
2 years ago
}
})
1 year ago
})
marker.on('dblclick', () => {
1 year ago
this.equipmentInfoDialog = true
this.equipmentInfo = e
this.monitorUnitId = e.monitorUnitId
// this.$router.push({path: '/board/equipment', query: {monitorUnitId: e.monitorUnitId}})
2 years ago
});
1 year ago
map.add(marker);
markers.push(marker)
},
1 year ago
setMarker1(e) {
let marker = new AMap.Marker({
position: [e.longitude, e.latitude],
title: `信息\n经度${e.longitude}\n纬度${e.latitude}\n名称${e.deviceName}\n`,
offset: new AMap.Pixel(-15, -30),
content: `<div> <svg t="1718261114618" class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" p-id="4305" style="width: 30px;height: 30px;">
<path style="animation: ${(e.ifAlarm === '1') ? 'an1' : 'an2'} 2s ease-in-out infinite;" d="M512 64.5c-180.5 0-326.9 146.4-326.9 326.9 0 63.3 18 122.3 49.2 172.4 1.1 2 2.1 4 3.2 5.9 34.9 58.2 113.9 128.8 165.5 194.5 66.3 84.4 93.2 158 93.2 158 1.6 1.4 13.1 35.6 15.1 35.8 2.5 0.2 12.6-34 14.5-35.8 0 0 22-69.2 83.7-146.6 56-70.1 142.8-145.7 177-206 0.9-1.6 1.8-3.3 2.6-5 31.5-50.2 49.7-109.6 49.7-173.3 0.1-180.5-146.3-326.8-326.8-326.8z" p-id="4306">
</path></svg></div>`
});
marker.on('click', async () => {
if (markerIds.includes(e.deviceId)) {
return
} else {
markerIds.push(e.deviceId)
}
const {data} = await selectMonitorElectronic(e.deviceId)
data.map(e => e.hwFenceAreaList).flat(1).forEach(e => {
if (e.areaShapeFlag === '1') {
this.setPolygon(e.areaRange.split('_').map(e => e.split(',').map(v => parseFloat(v))))
}
if (e.areaShapeFlag === '2') {
let arr = e.areaRange.split(',')
this.setCircle([arr[0], arr[1]], arr[2])
}
})
})
marker.on('dblclick', () => {
this.equipmentInfoDialog = true
this.equipmentInfo = e
this.monitorUnitId = e.monitorUnitId
// this.$router.push({path: '/board/equipment', query: {monitorUnitId: e.monitorUnitId}})
});
map.add(marker);
markers.push(marker)
},
setMarker2(e) {
map.remove(markers)
map.remove(polygons)
map.remove(circles)
markers = []
1 year ago
e.forEach(v => {
let arr = this.options.filter(r => r.value.deviceId === v) || []
if (arr.length > 0) {
1 year ago
this.setMarker(arr[0].value)
}
})
map.setFitView(markers)
},
1 year ago
getDeviceInfo() {
this.$router.push({path: '/board/equipment', query: {monitorUnitId: this.monitorUnitId}})
},
1 year ago
setPolygon(e, val) {
// let e = position.map(val => {
// return [val.longitude, val.latitude]
// })
let thisPolygon = new AMap.Polygon({
path: e,
fillColor: '#1791fc',
// fillColor: val > 0 ? '#ff0000' : '#1791fc',
});
map.add(thisPolygon)
map.setFitView(thisPolygon)
polygons.push(thisPolygon)
},
setCircle(center, radius, e) {
let circle = new AMap.Circle({
center,
radius,
borderWeight: 3,
strokeColor: "#FF33FF",
// strokeColor: e ? '#ff0000' : "#FF33FF",
strokeWeight: 6,
strokeOpacity: 0.2,
fillOpacity: 0.4,
strokeDasharray: [10, 10],
fillColor: '#1791fc',
// fillColor: e > 0 ? '#ff0000' : '#1791fc',
})
map.add(circle);
map.setFitView(circle)
circles.push(circle)
},
createMap() {
map = new AMap.Map('map', {
zoom: 11,
center: this.centerGeo,
});
},
1 year ago
async searchMap() {
1 year ago
const {data} = await selectDeviceByName(this.formInline)
1 year ago
map.remove(markers)
map.remove(polygons)
map.remove(circles)
1 year ago
markers = []
data.forEach(e => {
if (e.latitude && e.longitude) {
1 year ago
this.setMarker1(e)
1 year ago
}
1 year ago
})
1 year ago
map.setFitView(markers)
1 year ago
},
1 year ago
async searchMap1(name) {
this.value = []
map.remove(markers)
map.remove(polygons)
map.remove(circles)
markers = []
this.loading = true;
1 year ago
const {data} = await selectDeviceByName({name: name})
1 year ago
this.loading = false;
let option = []
data.forEach(e => {
if (e.latitude && e.longitude) {
option.push({
1 year ago
label: e.deviceName,
value: e
1 year ago
})
}
})
this.options = option
},
1 year ago
exTable() {
let query = {}
query.startTime = this.parseTime(this.exTableTime?.[0]?.getTime())
query.endTime = this.parseTime(this.exTableTime?.[1]?.getTime())
exTableData(query, '告警信息')
},
async RailChange() {
if (this.isRail) {
const data = await getDeviceByAreaId(this.$store.getters.tenantId)
data.data.map(e => e.devicesList).flat(1).forEach(e => {
this.setMarker(e)
})
} else {
map.remove(markers)
}
2 years ago
}
2 years ago
}
2 years ago
}
;
2 years ago
</script>
1 year ago
<style scoped lang="less">
1 year ago
.title {
2 years ago
position: absolute;
top: 12%;
left: 13.6%;
font-size: 1vw;
color: #00f8ff;
transform: translateX(-50%);
}
1 year ago
2 years ago
.container {
background-image: url("~@/assets/board/index/bg.jpg");
background-repeat: no-repeat;
background-size: 100% 100%;
width: 100%;
height: calc(100vh);
position: relative;
}
.centerImg {
background-repeat: no-repeat;
background-size: 100% 100%;
position: absolute;
width: 45vw;
height: 20vw;
top: 60%;
left: 50%;
transform: translate(-50%, -50%);
}
.scrollTable {
color: rgb(185, 186, 192);
margin: auto 0px;
padding: 4px 0;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
text-align: center;
display: inline-block;
width: 33%;
}
.chart1 {
position: absolute;
width: 20%;
height: 21%;
top: 16%;
left: 3%;
}
.chart1Right {
background-image: url("~@/assets/board/common/bg1.png");
background-repeat: no-repeat;
background-size: 100% 100%;
padding: 0 12px;
position: absolute;
top: 17%;
2 years ago
left: 15%;
2 years ago
}
.chart1Table {
position: absolute;
top: 38%;
left: 2.8%;
width: 21%;
height: 14%;
overflow: hidden;
}
.chart2 {
position: absolute;
width: 20%;
height: 21%;
top: 58.5%;
left: 3%;
}
.chart2Table {
position: absolute;
top: 81%;
left: 2.8%;
width: 21%;
height: 15%;
overflow: hidden;
}
.centerInfo {
position: absolute;
width: 7%;
top: 17.5%;
left: 32.7%;
font-size: 1.4vw;
text-align: center;
transform: translateX(-50%);
color: #01c7fd;
letter-spacing: 4px;
}
.inTransit {
position: absolute;
top: 16%;
left: 87%;
transform: translateX(-50%);
font-size: 1.2vw;
color: rgb(30, 158, 223);
}
.chart3 {
position: absolute;
width: 21%;
height: 22%;
top: 21.5%;
left: 76.1%;
}
.table1 {
position: absolute;
width: 21%;
1 year ago
height: 45%;
top: 50.5%;
2 years ago
left: 76.3%;
}
1 year ago
.mapChart {
position: absolute;
width: 50%;
height: 60%;
top: 30%;
left: 25%;
}
.map {
width: 100%;
height: 80vh;
}
1 year ago
.exTable {
1 year ago
position: absolute;
1 year ago
top: 46%;
left: 76.3%;
width: 21%;
/*transform: translateX(-50%);*/
1 year ago
}
1 year ago
.backButton {
position: absolute;
bottom: 2%;
left: 32%;
/*transform: translateX(-100%);*/
background-image: url("~@/assets/board/index/leftButtonBg.png");
background-repeat: no-repeat;
background-size: 100% 100%;
width: 18vw;
height: 4.865vw;
line-height: 4.865vw;
text-align: center;
}
.realMapButton {
position: absolute;
bottom: 2%;
1 year ago
left: 53%;
1 year ago
/*transform: translateX(-100%);*/
background-image: url("~@/assets/board/index/rightButtonBg.png");
background-repeat: no-repeat;
background-size: 100% 100%;
width: 18vw;
height: 4.865vw;
line-height: 4.865vw;
text-align: center;
}
.backButton, .realMapButton {
span {
position: absolute;
top: 60%;
left: 45%;
transform: translateY(-50%);
color: #fff;
font-size: 1.1vw;
font-weight: 600;
}
svg {
position: absolute;
top: 60%;
left: 30%;
transform: translateY(-50%);
color: #fff;
width: 1.5vw;
height: 1.5vw;
}
}
2 years ago
</style>
1 year ago
<style>
@keyframes an1 {
0% {
1 year ago
fill: #3D93FD;
1 year ago
}
50% {
1 year ago
fill: #ffffff;
1 year ago
}
100% {
1 year ago
fill: #3D93FD;
1 year ago
}
}
1 year ago
1 year ago
@keyframes an2 {
0% {
1 year ago
fill: #ff0000;
1 year ago
}
50% {
1 year ago
fill: #ffffff;
1 year ago
}
100% {
1 year ago
fill: #ff0000;
1 year ago
}
}
</style>