修改地图

dev
夜笙歌 5 months ago
parent 15a5c13d70
commit 5ad822126f

@ -159,14 +159,14 @@ export default {
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
handleAlarmInfo({ handleAlarmInfo({
alarmInfoId: e.no alarmInfoId: e.value1
}).then(e => { }).then(e => {
if (e.code === 200) { if (e.code === 200) {
this.$message({ this.$message({
type: 'success', type: 'success',
message: '已处理!' message: '已处理!'
}); });
this.setTable3() this.setAlarmInfos()
} else { } else {
this.$message({ this.$message({
type: 'info', type: 'info',

@ -3,7 +3,7 @@
<div class="centerImg"></div> <div class="centerImg"></div>
<div class="leftMenu"> <div class="leftMenu">
<div v-for="(i,k) in deviceList" :key="k" class="item" @click="getRightData(i)"> <div v-for="(i,k) in deviceList" :key="k" class="item" @click="getRightData(i)">
<span>{{ i.deviceModeName }}</span> <span class="longText">{{ i.deviceModeName }}</span>
</div> </div>
</div> </div>
<div ref="right" class="right"> <div ref="right" class="right">
@ -39,6 +39,11 @@
:header-cell-style="{ textAlign: 'center',backgroundColor:'#0a457d' }" :header-cell-style="{ textAlign: 'center',backgroundColor:'#0a457d' }"
:max-height="maxHeight"> :max-height="maxHeight">
style="width: 100%"> style="width: 100%">
<el-table-column
type="index"
label="序号"
width="50">
</el-table-column>
<el-table-column v-for="i in deviceDataColumns" :label="i.columnName" :prop="i.columnKey"> <el-table-column v-for="i in deviceDataColumns" :label="i.columnName" :prop="i.columnKey">
<template slot-scope="scope"> <template slot-scope="scope">
<img v-if="tableData[scope.$index][i.columnKey].toString().includes('http')" <img v-if="tableData[scope.$index][i.columnKey].toString().includes('http')"
@ -227,15 +232,17 @@ export default {
width: 12vw; width: 12vw;
height: 5.1vw; height: 5.1vw;
margin-bottom: 1vw; margin-bottom: 1vw;
position: relative;
} }
span { span {
position: absolute; position: absolute;
left: 44%; left: 44%;
line-height: 5.1vw; top: 50%;
transform: translateY(-50%);
font-size: 1vw; font-size: 1vw;
color: #f1f3f5; color: #f1f3f5;
white-space: nowrap; //text-align: center;
} }
} }
@ -298,4 +305,8 @@ export default {
} }
} }
} }
.longText{
width: 6.5vw;
overflow: hidden;
}
</style> </style>

@ -16,11 +16,11 @@
<div class="info1">设备编号:</div> <div class="info1">设备编号:</div>
<div class="info2"> {{ topData.deviceCode }}</div> <div class="info2"> {{ topData.deviceCode }}</div>
</div> </div>
<div class="info" > <div class="info">
<div class="info1">设备名称:</div> <div class="info1">设备名称:</div>
<div class="info2">{{ topData.deviceName }}</div> <div class="info2">{{ topData.deviceName }}</div>
</div> </div>
<div class="info" > <div class="info">
<div class="info1">设备位置:</div> <div class="info1">设备位置:</div>
<div class="info2">{{ topData.deviceLocation }}</div> <div class="info2">{{ topData.deviceLocation }}</div>
</div> </div>
@ -38,15 +38,25 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<div style="position: absolute; right: 30px;"> <div style="position: absolute; right: 30px;">
<span style="color: #fff;"> 开始时间</span> <span style="color: #fff;"> 起止时间</span>
<div style="display: inline-block;width: 220px;margin-right: 12px;"> <div style="display: inline-block;margin-right: 12px;">
<el-date-picker <el-date-picker
v-model="date" v-model="date"
format="yyyy-MM-dd" end-placeholder="结束日期"
placeholder="选择日期" format="yyyy-MM-dd hh:ss:mm"
type="date" range-separator="至"
start-placeholder="开始日期"
type="datetimerange"
value-format="timestamp"> value-format="timestamp">
</el-date-picker> </el-date-picker>
<!-- - -->
<!-- <el-date-picker-->
<!-- v-model="date1"-->
<!-- format="yyyy-MM-dd"-->
<!-- placeholder="选择日期"-->
<!-- type="date"-->
<!-- value-format="timestamp">-->
<!-- </el-date-picker>-->
</div> </div>
<el-button type="primary" @click="search"></el-button> <el-button type="primary" @click="search"></el-button>
<el-button @click="reset"></el-button> <el-button @click="reset"></el-button>
@ -57,15 +67,16 @@
<el-table v-if="show" :cell-style="setStyle" <el-table v-if="show" :cell-style="setStyle"
:data="tableData" :header-cell-style="{ textAlign: 'center',backgroundColor:'#0a457d' }" :data="tableData" :header-cell-style="{ textAlign: 'center',backgroundColor:'#0a457d' }"
style="width: 100%;margin-top: 12px;"> style="width: 100%;margin-top: 12px;">
<el-table-column v-for="i in deviceDataColumns" :label="i.columnName" :prop="i.columnKey"> <el-table-column v-for="i in deviceDataColumns" :key="i.columnName" :label="i.columnName"
:prop="i.columnKey">
<template slot-scope="scope"> <template slot-scope="scope">
<el-image <el-image
v-if="scope.row[i.columnKey].toString().includes('http')" v-if="scope.row[i.columnKey].toString().includes('http')"
style="width: 100px; height: 100px" :preview-src-list="[scope.row[i.columnKey]]"
:src="scope.row[i.columnKey]" :src="scope.row[i.columnKey]"
:preview-src-list="[scope.row[i.columnKey]]"> style="width: 100px; height: 100px">
</el-image> </el-image>
<span v-else>{{scope.row[i.columnKey]}}</span> <span v-else>{{ scope.row[i.columnKey] }}</span>
</template> </template>
</el-table-column> </el-table-column>
@ -78,7 +89,6 @@
</el-collapse-item> </el-collapse-item>
</el-collapse> </el-collapse>
</div> </div>
<div v-show="isMap" id="map" class="map"></div> <div v-show="isMap" id="map" class="map"></div>
<div v-for="i in bottomData"> <div v-for="i in bottomData">
<div class="itemBg"> <div class="itemBg">
@ -100,6 +110,46 @@
</div> </div>
</div> </div>
</div> </div>
<el-table
v-show="isMap"
:data="mapData"
:max-height="40*vh"
highlight-current-row
style="width: 100%"
@current-change="mapTableChange">
<el-table-column
type="index"
width="50">
</el-table-column>
<el-table-column
label="日期"
property="date"
width="120">
<template slot-scope="scope">
{{
parseTime(scope.row.ts, '{y}-{m}-{d}')
}}
</template>
</el-table-column>
<el-table-column
label="时间"
property="time"
width="120">
<template slot-scope="scope">
{{
parseTime(scope.row.ts, '{h}:{i}:{s}')
}}
</template>
</el-table-column>
<el-table-column
label="经度"
property="longitude">
</el-table-column>
<el-table-column
label="纬度"
property="latitude">
</el-table-column>
</el-table>
</div> </div>
</div> </div>
</template> </template>
@ -115,12 +165,17 @@ import {
} from '@/utils/coordtransform' } from '@/utils/coordtransform'
let map = null let map = null
let maptext = null
let mapMarker = null
let flag = true
export default { export default {
components: {}, components: {},
data() { data() {
return { return {
vh: document.documentElement.offsetHeight / 100,
topData: {}, topData: {},
bottomData: [], bottomData: [],
mapData: [],
collapseNo: '1', collapseNo: '1',
radio: '日统计报表', radio: '日统计报表',
tableData: [], tableData: [],
@ -132,7 +187,7 @@ export default {
deviceDataColumns: [], deviceDataColumns: [],
show: false, show: false,
isMap: false, isMap: false,
date: new Date(new Date().toLocaleDateString()).getTime() date: [new Date(new Date().toLocaleDateString()).getTime(), new Date(new Date().toLocaleDateString()).getTime() + 1000 * 60 * 60 * 24],
} }
}, },
async mounted() { async mounted() {
@ -150,10 +205,11 @@ export default {
async search() { async search() {
this.currentPage = 1 this.currentPage = 1
await this.setHistoryData() await this.setHistoryData()
flag = true
}, },
async reset() { async reset() {
this.currentPage = 1 this.currentPage = 1
this.date = new Date(new Date().toLocaleDateString()).getTime() this.date = [new Date(new Date().toLocaleDateString()).getTime(), new Date(new Date().toLocaleDateString()).getTime() + 1000 * 60 * 60 * 24]
await this.setHistoryData() await this.setHistoryData()
}, },
setPolyline(e) { setPolyline(e) {
@ -162,20 +218,40 @@ export default {
borderWeight: 2, // 线 1 borderWeight: 2, // 线 1
}); });
map.add(polyline); map.add(polyline);
map.setFitView()
}, },
setMarker(e, i) { setMarker(e, i) {
let marker = new AMap.Marker({ let marker = new AMap.Marker({
position: e, // [116.39, 39.9] position: e, // [116.39, 39.9]
title: `信息\n经度${e[0]}\n纬度${e[1]}\n时间${i}`, title: `信息\n经度${e[0]}\n纬度${e[1]}\n时间${i}`,
offset:new AMap.Pixel(-2.5,-2.5), offset: new AMap.Pixel(-2.5, -2.5),
content:`<div style="width: 5px;height: 5px; border-radius: 50%;background-color: #1890ff"> </div>` content: `<div style="width: 5px;height: 5px; border-radius: 50%;background-color: #1890ff"> </div>`
}); });
map.add(marker); map.add(marker);
map.setFitView()
}, },
setMarkerSharding(e) {
let sum = e.length
let nowNum = 0
let fun = () => {
setTimeout(() => {
let arr = e.splice(nowNum * 20, (nowNum + 1) * 20)
arr.forEach(v => {
this.setMarker([v.longitude, v.latitude], v.ts)
})
this.setPolyline(arr.map(e => {
return [e.longitude, e.latitude]
}))
nowNum += 1
flag && map.setFitView()
if (nowNum * 20 <= sum) {
fun()
}
}, 1000 * 0.5)
}
fun()
},
async currentChange(e) { async currentChange(e) {
console.log(e)
this.currentPage = e this.currentPage = e
await this.setHistoryData() await this.setHistoryData()
}, },
@ -194,7 +270,7 @@ export default {
async setDeviceInfo() { async setDeviceInfo() {
const {data} = await getDeviceInfo(this.deviceId) const {data} = await getDeviceInfo(this.deviceId)
this.topData = data || {} this.topData = data || {}
if(this.topData.gpsFlag !== '1'){ if (this.topData.gpsFlag !== '1') {
this.date = null this.date = null
} }
}, },
@ -206,28 +282,24 @@ export default {
"sceneId": this.$store.getters.sceneId, "sceneId": this.$store.getters.sceneId,
"deviceId": this.deviceId, "deviceId": this.deviceId,
deviceModeId: this.deviceModeId, deviceModeId: this.deviceModeId,
"offset":this.topData.gpsFlag !== '1'? (this.currentPage - 1) : null, "offset": this.topData.gpsFlag !== '1' ? (this.currentPage - 1) : null,
"limit": this.topData.gpsFlag !== '1'?10:null, "limit": this.topData.gpsFlag !== '1' ? 10 : null,
startTime: this.date, startTime: this.date?.[0],
endTime: this.date ? this.date + (1000 * 60 * 60 * 24) : null endTime: this.date?.[1],
}) })
let dataList = data.historyData?.dataList || [] let dataList = data.historyData?.dataList || []
if (dataList.filter(e => (Object.keys(e).includes('longitude') || Object.keys(e).includes('longitude'))).length > 0) { if (dataList.filter(e => (Object.keys(e).includes('longitude') || Object.keys(e).includes('longitude'))).length > 0) {
this.isMap = true this.isMap = true
let mapData = dataList.filter(e => (Object.keys(e).includes('longitude') || Object.keys(e).includes('longitude'))).map(e=>{ let mapData = dataList.filter(e => (Object.keys(e).includes('longitude') || Object.keys(e).includes('longitude'))).map(e => {
let [lng,lat] = wgs84togcj02(e.longitude,e.latitude) let [lng, lat] = wgs84togcj02(e.longitude, e.latitude)
return { return {
...e, ...e,
longitude:lng, longitude: lng,
latitude:lat latitude: lat
} }
}) })
mapData.forEach(e => { this.mapData = JSON.parse(JSON.stringify(mapData))
this.setMarker([e.longitude, e.latitude], e.ts) this.setMarkerSharding(mapData)
})
this.setPolyline(mapData.map(e => {
return [e.longitude, e.latitude]
}))
// this.tableData = data.historyData?.dataList // this.tableData = data.historyData?.dataList
// this.total = data.historyData?.count // this.total = data.historyData?.count
// this.currentPage = 1 // this.currentPage = 1
@ -248,6 +320,27 @@ export default {
async setLinkDevices() { async setLinkDevices() {
const {data} = await getLinkDevices(this.deviceId) const {data} = await getLinkDevices(this.deviceId)
this.bottomData = data this.bottomData = data
},
mapTableChange(e) {
maptext && maptext.remove()
mapMarker && mapMarker.remove()
maptext = new AMap.Text({
text: `信息\n经度${e.longitude}\n纬度${e.latitude}\n时间${e.ts}`,
anchor: "bottom-center", //
cursor: "pointer", //
position: [e.longitude, e.latitude], //
});
mapMarker = new AMap.Marker({
position: [e.longitude, e.latitude], // [116.39, 39.9]
offset: new AMap.Pixel(-5, -5),
content: `<div style="width: 10px;height: 10px; border-radius: 50%;background-color: #1890ff"> </div>`
});
map.add(maptext);
map.add(mapMarker);
map.setFitView([maptext,mapMarker])
flag = false
console.log(e)
} }
} }
}; };
@ -313,6 +406,14 @@ export default {
/deep/ .el-table .el-table__header-wrapper th { /deep/ .el-table .el-table__header-wrapper th {
color: #05ecf3; color: #05ecf3;
} }
/deep/ .el-table .current-row {
color: #000;
}
/deep/ .el-table .el-table__row:hover {
color: #000;
}
} }
@ -398,7 +499,8 @@ export default {
width: 100%; width: 100%;
height: 50vh; height: 50vh;
} }
.infoDiv{
.infoDiv {
position: absolute; position: absolute;
left: 60vh; left: 60vh;
height: 100%; height: 100%;

Loading…
Cancel
Save