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.

264 lines
6.7 KiB
Vue

2 years ago
<template>
<div class="container">
<div class="centerImg"></div>
2 years ago
<div class="leftMenu">
2 years ago
<div v-for="(i,k) in deviceList" class="item" @click="getRightData(i)" :key="k">
<span>{{ i.deviceModeName }}</span>
2 years ago
</div>
</div>
<div ref="right" class="right">
<div ref="search" class="search">
<el-form :inline="true" :model="form" class="demo-form-inline">
<el-form-item label="传感器编号">
<el-input v-model="form.data1" placeholder="传感器编号"></el-input>
</el-form-item>
<el-form-item label="传感器名称">
<el-input v-model="form.data2" placeholder="传感器名称"></el-input>
</el-form-item>
<el-form-item label="采集时间">
<el-date-picker
v-model="form.data3"
placeholder="选择日期时间"
type="datetime">
</el-date-picker>
</el-form-item>
<el-form-item>
2 years ago
<el-button type="primary" @click="()=>{}"></el-button>
<el-button @click="()=>{}"></el-button>
2 years ago
</el-form-item>
</el-form>
</div>
<div :style="{height:maxHeight+'px'}" class="table">
<el-table
2 years ago
v-loading="loading"
2 years ago
v-if='tableShow'
:cell-style="setStyle"
:data="tableData"
:header-cell-style="{ textAlign: 'center',backgroundColor:'#0a457d' }"
:max-height="maxHeight">
style="width: 100%">
<el-table-column v-for="i in deviceDataColumns" :label="i.columnName" :prop="i.columnKey">
2 years ago
</el-table-column>
<!-- <el-table-column-->
<!-- label="rssi"-->
<!-- prop="rssi">-->
<!-- </el-table-column>-->
<!-- <el-table-column-->
<!-- label="value1"-->
<!-- prop="value1">-->
<!-- </el-table-column>-->
<!-- <el-table-column-->
<!-- label="编号"-->
<!-- prop="devicecode">-->
<!-- </el-table-column>-->
<!-- <el-table-column-->
<!-- label="alias"-->
<!-- prop="alias">-->
<!-- </el-table-column>-->
<!-- <el-table-column-->
<!-- label="设备名称"-->
<!-- prop="devicename">-->
<!-- </el-table-column>-->
<!-- <el-table-column-->
<!-- label="ts"-->
<!-- prop="ts">-->
<!-- </el-table-column>-->
<!-- <el-table-column-->
<!-- label="voltage"-->
<!-- prop="voltage">-->
<!-- </el-table-column>-->
2 years ago
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
type="primary"
@click="toHistory"
2 years ago
>查看历史</el-button>
2 years ago
</template>
</el-table-column>
2 years ago
</el-table>
</div>
<div ref="pagination" style="margin-top: 12px;height: 36px;">
<el-pagination :current-page="offset" :total="total" background layout="prev, pager, next" style="display: inline-block;float:right;" :pageSize="10" @current-change="currentChange">
2 years ago
</el-pagination>
</div>
</div>
2 years ago
</div>
</template>
<script>
import {
selectLatestDataByDeviceMode,
getDeviceModesBySceneId,
} from '@/api/board/equipmentMonitoring'
2 years ago
export default {
components: {
},
data() {
return {
2 years ago
loading:false,
2 years ago
tableShow: false,
form: {
data1: '',
data2: '',
data3: null
},
maxHeight: 0,
tableData: [],
deviceList:[],
sceneId: 0,
offset:1,
2 years ago
limit:10,
total:0,
deviceDataColumns:[],
2 years ago
}
},
2 years ago
async mounted() {
2 years ago
this.maxHeight = this.$refs.right.clientHeight - this.$refs.search.clientHeight - this.$refs.pagination.clientHeight - 12
2 years ago
await this.getData()
2 years ago
},
methods: {
async currentChange(){
await this.getRightData()
},
2 years ago
async getRightData(e){
2 years ago
this.loading = true
2 years ago
await this.setSelectLatestDataByDeviceMode({
"sceneId": this.$store.getters.sceneId,
"deviceModeId": e.deviceModeId,
"startTime": 0,
"offset": this.offset-1,
2 years ago
"limit": 10
})
2 years ago
this.loading = false
this.tableShow = false
this.tableShow = true
},
async getData() {
await this.setDeviceModesBySceneId()
},
2 years ago
setStyle(e) {
if (e.rowIndex % 2 === 0) {
return {textAlign: 'center', backgroundColor: '#08406f', color: '#05aaba'}
} else {
return {textAlign: 'center', backgroundColor: '#063468', color: '#05aaba'}
}
},
2 years ago
async setSelectLatestDataByDeviceMode(e){
const {data} = await selectLatestDataByDeviceMode(e)
this.deviceDataColumns = data.deviceDataColumns
2 years ago
this.tableData = data.latestData || []
2 years ago
this.total=data.total
},
async setDeviceModesBySceneId(){
const {data} = await getDeviceModesBySceneId( {
2 years ago
"sceneId": this.$store.getters.sceneId,
})
this.deviceList = data
2 years ago
},
toHistory(){
this.$router.push({path: "/board/senso"});
2 years ago
}
2 years ago
}
};
</script>
2 years ago
<style lang="less" scoped>
2 years ago
.container {
2 years ago
background-image: url("~@/assets/board/equipmentMonitoring/bg.jpg");
2 years ago
background-repeat: no-repeat;
background-size: 100% 100%;
width: 100%;
height: calc(100vh);
position: relative;
}
2 years ago
.leftMenu::-webkit-scrollbar {
width: 0;
}
.leftMenu {
position: absolute;
width: 14%;
height: 84%;
top: 12%;
left: 2%;
padding: 1vw;
overflow: auto;
.item {
background-image: url("~@/assets/board/equipmentMonitoring/item.png");
background-repeat: no-repeat;
background-size: 100% 100%;
width: 12vw;
height: 5.1vw;
margin-bottom: 1vw;
}
span {
position: absolute;
left: 44%;
line-height: 5.1vw;
font-size: 1vw;
color: #f1f3f5;
white-space: nowrap;
}
}
.right {
position: absolute;
width: 78.5%;
height: 84%;
top: 12%;
left: 19%;
.search {
/deep/ .el-form-item__label {
color: #25bffc !important;
font-weight: normal;
}
/deep/ .el-input__inner {
background-color: #0000;
border-color: #25bffc;
}
/deep/ .el-button--default {
background-color: #0000;
color: #25bffc;
border-color: #25bffc;
}
}
.table {
/deep/ .el-table {
background-color: #0000;
}
/deep/ .el-table th.el-table__cell.is-leaf {
border-color: #0000;
}
/deep/ .el-table tr {
background-color: #0000;
}
/deep/ .el-table td.el-table__cell {
border-color: #0000;
}
/deep/ .el-table::before {
background-color: #0000;
}
/deep/ .el-table .el-table__header-wrapper th {
color: #05ecf3;
}
}
}
2 years ago
</style>