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.

399 lines
12 KiB
Vue

2 years ago
<template>
<div class="container">
<div class="centerImg"></div>
<div class="collapse">
<div style="margin-bottom: 24px">
<el-collapse v-model="collapseNo" accordion>
<el-collapse-item name="1">
<template slot="title">
<div class="itemBg">
<div class="icon"></div>
<div class="icon1"></div>
<div :style="'background-image: url('+(topData&&topData.devicePic)+')'" class="icon2"></div>
<div class="title"> {{ topData.monitorUnitName }}</div>
2 years ago
<div class="infoDiv">
<div class="info">
<div class="info1">设备编号:</div>
<div class="info2"> {{ topData.deviceCode }}</div>
</div>
<div class="info" >
<div class="info1">设备名称:</div>
<div class="info2">{{ topData.deviceName }}</div>
</div>
<div class="info" >
<div class="info1">设备位置:</div>
<div class="info2">{{ topData.deviceLocation }}</div>
</div>
</div>
2 years ago
</div>
</template>
2 years ago
<div>
<div>
2 years ago
<el-row :gutter="24" style="height: 30px;">
<el-col :span="12">
<!-- <el-radio-group v-model="radio">-->
<!-- <el-radio-button label="日统计报表"></el-radio-button>-->
<!-- <el-radio-button label="月统计报表"></el-radio-button>-->
<!-- </el-radio-group>-->
</el-col>
<el-col :span="12">
<div style="position: absolute; right: 30px;">
<span style="color: #fff;"> 开始时间</span>
<div style="display: inline-block;width: 220px;margin-right: 12px;">
<el-date-picker
v-model="date"
format="yyyy-MM-dd"
placeholder="选择日期"
type="date"
value-format="timestamp">
</el-date-picker>
</div>
<el-button type="primary" @click="search"></el-button>
<el-button @click="reset"></el-button>
<!-- <el-button>导出</el-button>-->
</div>
</el-col>
</el-row>
2 years ago
<el-table v-if="show" :cell-style="setStyle"
:data="tableData" :header-cell-style="{ textAlign: 'center',backgroundColor:'#0a457d' }"
style="width: 100%;margin-top: 12px;">
<el-table-column v-for="i in deviceDataColumns" :label="i.columnName" :prop="i.columnKey">
<template slot-scope="scope">
<el-image
v-if="scope.row[i.columnKey].toString().includes('http')"
style="width: 100px; height: 100px"
:src="scope.row[i.columnKey]"
:preview-src-list="[scope.row[i.columnKey]]">
</el-image>
<span v-else>{{scope.row[i.columnKey]}}</span>
</template>
</el-table-column>
</el-table>
2 years ago
<el-pagination v-show="!isMap" :currentPage="currentPage" :pageSize="10" :total="total" background
2 years ago
layout="prev, pager, next" @current-change="currentChange">
</el-pagination>
2 years ago
</div>
</div>
</el-collapse-item>
</el-collapse>
</div>
2 years ago
2 years ago
<div v-show="isMap" id="map" class="map"></div>
<div v-for="i in bottomData">
<div class="itemBg">
<div class="icon"></div>
<div class="icon1"></div>
<div :style="'background-image: url('+(i&&i.devicePic)+')'" class="icon2"></div>
<div class="title"> {{ i.deviceName }}</div>
<div class="info">
<div class="info1">设备编号:</div>
<div class="info2"> {{ i.deviceCode }}</div>
</div>
<div class="info" style="left: 70vh;">
<div class="info1">设备名称:</div>
<div class="info2">{{ i.deviceName }}</div>
</div>
<div class="info" style="left: 80vh;">
<div class="info1">设备位置:</div>
<div class="info2">{{ i.deviceLocation }}</div>
</div>
2 years ago
</div>
2 years ago
</div>
2 years ago
</div>
</div>
</template>
<script>
import {
getDeviceInfo,
getHistoryData,
getLinkDevices
} from '@/api/board/senso'
2 years ago
2 years ago
let map = null
2 years ago
export default {
2 years ago
components: {},
2 years ago
data() {
return {
topData: {},
bottomData: [],
2 years ago
collapseNo: '1',
2 years ago
radio: '日统计报表',
tableData: [],
2 years ago
sceneId: 0,
deviceId: 0,
deviceModeId: 0,
total: 0,
currentPage: 1,
deviceDataColumns: [],
show: false,
2 years ago
isMap: false,
date: new Date(new Date().toLocaleDateString()).getTime()
2 years ago
}
},
2 years ago
async mounted() {
2 years ago
map = new AMap.Map('map', {
zoom: 11,
center: [113.4, 23.35],
});
if (this.$route.query.id) {
this.deviceId = this.$route.query.id
this.deviceModeId = this.$route.query.deviceModeId
}
2 years ago
await this.getData()
2 years ago
},
2 years ago
methods: {
2 years ago
async search() {
this.currentPage = 1
await this.setHistoryData()
},
async reset() {
this.currentPage = 1
this.date = new Date(new Date().toLocaleDateString()).getTime()
2 years ago
await this.setHistoryData()
},
2 years ago
setPolyline(e) {
let polyline = new AMap.Polyline({
path: e,
borderWeight: 2, // 线条宽度,默认为 1
});
map.add(polyline);
map.setFitView()
},
setMarker(e, i) {
let marker = new AMap.Marker({
position: e, // 经纬度对象,也可以是经纬度构成的一维数组[116.39, 39.9]
2 years ago
title: `
经度${e[0]}
纬度:${e[1]}
2 years ago
时间${i}`,
offset:new AMap.Pixel(-2.5,-2.5),
content:`<div style="width: 5px;height: 5px; border-radius: 50%;background-color: #1890ff"> </div>`
2 years ago
});
map.add(marker);
map.setFitView()
},
async currentChange(e) {
2 years ago
console.log(e)
this.currentPage = e
2 years ago
await this.setHistoryData()
},
async getData() {
await this.setDeviceInfo()
await this.setLinkDevices()
await this.setHistoryData()
},
2 years ago
setStyle(e) {
if (e.rowIndex % 2 === 0) {
return {textAlign: 'center', backgroundColor: '#08406f', color: '#05aaba'}
} else {
2 years ago
return {textAlign: 'center', backgroundColor: '#063468', color: '#05aaba'}
}
},
async setDeviceInfo() {
const {data} = await getDeviceInfo(this.deviceId)
this.topData = data || {}
if(this.topData.gpsFlag !== '1'){
this.date = null
}
},
async setHistoryData() {
2 years ago
this.isMap = false
map.clearMap()
this.show = false
const {data} = await getHistoryData({
2 years ago
"sceneId": this.$store.getters.sceneId,
"deviceId": this.deviceId,
2 years ago
deviceModeId: this.deviceModeId,
2 years ago
"offset":this.topData.gpsFlag !== '1'? (this.currentPage - 1) : null,
"limit": this.topData.gpsFlag !== '1'?10:null,
2 years ago
startTime: this.date,
endTime: this.date ? this.date + (1000 * 60 * 60 * 24) : null
})
2 years ago
let dataList = data.historyData?.dataList || []
2 years ago
if (dataList.filter(e => (Object.keys(e).includes('longitude') || Object.keys(e).includes('longitude'))).length > 0) {
this.isMap = true
dataList.filter(e => (Object.keys(e).includes('longitude') || Object.keys(e).includes('longitude'))).forEach(e => {
this.setMarker([e.longitude, e.latitude], e.ts)
})
this.setPolyline(dataList.filter(e => (Object.keys(e).includes('longitude') || Object.keys(e).includes('longitude'))).map(e => {
return [e.longitude, e.latitude]
}))
2 years ago
// this.tableData = data.historyData?.dataList
// this.total = data.historyData?.count
// this.currentPage = 1
// this.deviceDataColumns = data.deviceDataColumns
// this.$nextTick(() => {
// this.show = true
// })
2 years ago
} else {
2 years ago
this.tableData = data.historyData?.dataList
this.total = data.historyData?.count
2 years ago
// this.currentPage = 1
2 years ago
this.deviceDataColumns = data.deviceDataColumns
this.$nextTick(() => {
this.show = true
})
}
},
async setLinkDevices() {
const {data} = await getLinkDevices(this.deviceId)
this.bottomData = data
2 years ago
}
}
2 years ago
};
</script>
2 years ago
<style lang="less" scoped>
2 years ago
.container {
background-image: url("~@/assets/board/senso/bg.jpg");
background-repeat: no-repeat;
background-size: 100% 100%;
width: 100%;
height: calc(100vh);
position: relative;
}
.collapse {
position: absolute;
top: 9%;
left: 2%;
width: 96%;
height: 87%;
2 years ago
overflow: auto;
2 years ago
/deep/ .el-collapse-item__wrap {
2 years ago
background-color: #0000;
border-color: #0000;
}
/deep/ .el-table {
2 years ago
background-color: #FFF0 !important;
color: #fff;
}
/deep/ .el-table tr {
2 years ago
background-color: #FFF0 !important;
}
/deep/ .el-table th.el-table__cell.is-leaf, {
2 years ago
border-color: #0000;
}
/deep/ .el-table::before, .el-table--group::after, .el-table--border::after {
2 years ago
background-color: #0000;
}
/deep/ .el-table .el-table__header-wrapper th, .el-table .el-table__fixed-header-wrapper th {
2 years ago
background-color: #0000;
}
/deep/ .el-collapse-item__header {
2 years ago
background-color: #0000;
border-color: #0000;
height: auto;
}
/deep/ .el-collapse {
2 years ago
border-color: #0000;
}
/deep/ .el-table td.el-table__cell {
2 years ago
border-color: #0000;
}
2 years ago
2 years ago
/deep/ .el-table .el-table__header-wrapper th {
color: #05ecf3;
}
2 years ago
}
.itemBg {
background-image: url("~@/assets/board/senso/itemBg.png");
background-repeat: no-repeat;
background-size: 100% 100%;
width: 100%;
height: 17vh;
position: relative;
.icon {
background-image: url("~@/assets/board/senso/iconBg.png");
background-repeat: no-repeat;
background-size: 100% 100%;
position: absolute;
top: 2vh;
left: 5vh;
width: 13vh;
height: 13vh;
}
.icon1 {
background-image: url("~@/assets/board/senso/iconBottom.png");
background-repeat: no-repeat;
background-size: 100% 100%;
position: absolute;
top: 2vh;
left: 5vh;
width: 13vh;
height: 13vh;
}
.icon2 {
background-image: url("~@/assets/board/senso/icon.png");
background-repeat: no-repeat;
background-size: 100% 100%;
position: absolute;
top: 50%;
left: 6.2vh;
width: 10.6vh;
height: 10.3vh;
2 years ago
transform: translateY(-50%);
}
.title {
position: absolute;
left: 25vh;
color: #1fabf3;
line-height: 17vh;
font-size: 2.5vh;
}
.info {
2 years ago
position: relative;
2 years ago
color: #1fabf3;
font-size: 1.5vh;
height: 100%;
white-space: nowrap;
2 years ago
display: inline-block;
height: 100%;
margin-right: 12px;
vertical-align: top;
2 years ago
.info1 {
2 years ago
position: relative;
line-height: 8.5vh;
color: #fffc;
font-size: 15px;
font-weight: 600;
letter-spacing: 2px;
2 years ago
}
.info2 {
2 years ago
position: relative;
line-height: 8.5vh;
2 years ago
color: #fff
}
}
}
2 years ago
.map {
width: 100%;
height: 50vh;
}
2 years ago
.infoDiv{
position: absolute;
left: 60vh;
height: 100%;
}
2 years ago
</style>