修改场景判断

master
夜笙歌 2 years ago
parent 4f7facac64
commit 6c1f0f5c76

@ -72,7 +72,12 @@ export default {
async mounted() { async mounted() {
if (this.$route.name === 'SmartScene' || this.$route.name === 'GPS' || this.$route.name === 'index' || this.$store.getters.sceneId) { if (this.$route.name === 'SmartScene' || this.$route.name === 'GPS' || this.$route.name === 'index' || this.$store.getters.sceneId) {
} else { } else {
await this.$router.replace({path: "/board/index"}); if (this.$store.state.user.permissions.includes('business:monitor:index') || this.$store.state.user.permissions.includes('*:*:*')) {
await this.$router.replace({path: "/board/index"});
} else {
await this.$router.replace({path: "/board/smartScene"});
this.$router.push({path: '/board/smartScene'})
}
} }
await this.setSelectSecnes() await this.setSelectSecnes()
if (this.$route.name === 'SmartScene' || this.$route.name === 'GPS') { if (this.$route.name === 'SmartScene' || this.$route.name === 'GPS') {

@ -70,7 +70,7 @@
<div style="position: absolute;left: 24%;top: 0px;width: 55%;height: 100%;"> <div style="position: absolute;left: 24%;top: 0px;width: 55%;height: 100%;">
<div <div
v-for="val in Object.keys(i.deviceDataMap).slice(0,6).filter(e=> !(i.deviceDataMap[e].toString().includes('http')))" v-for="val in Object.keys(i.deviceDataMap).slice(0,6).filter(e=> !(i.deviceDataMap[e].toString().includes('http')))"
class="infoItem"> class="infoItem" :style="'height:'+(Object.keys(i.deviceDataMap).length<4 ? '100%':'50%')">
<div class="span">{{ val }}:</div> <div class="span">{{ val }}:</div>
<div class="spanBg"></div> <div class="spanBg"></div>
<div class="num">{{ i.deviceDataMap[val] }}</div> <div class="num">{{ i.deviceDataMap[val] }}</div>
@ -163,8 +163,10 @@ export default {
}); });
}, },
async getTree() { async getTree() {
const {data} = await treeList(this.$store.getters.sceneId) if(this.$store.getters.sceneId){
this.treeData = data const {data} = await treeList(this.$store.getters.sceneId)
this.treeData = data
}
}, },
treeClick(e) { treeClick(e) {
if (!e.children?.length > 0) { if (!e.children?.length > 0) {
@ -421,7 +423,7 @@ export default {
display: inline-block; display: inline-block;
position: relative; position: relative;
width: 6vw; width: 6vw;
height: 100%; height: 50%;
.spanBg { .spanBg {
//background-image: url("~@/assets/board/equipment/icon.png"); //background-image: url("~@/assets/board/equipment/icon.png");

@ -2,13 +2,13 @@
<div class="container"> <div class="container">
<div class="centerImg"></div> <div class="centerImg"></div>
<div class="leftMenu"> <div class="leftMenu">
<div v-for="(i,k) in deviceList" class="item" @click="getRightData(i)" :key="k"> <div v-for="(i,k) in deviceList" :key="k" class="item" @click="getRightData(i)">
<span>{{ i.deviceModeName }}</span> <span>{{ i.deviceModeName }}</span>
</div> </div>
</div> </div>
<div ref="right" class="right"> <div ref="right" class="right">
<div ref="search" class="search" style="min-height: 60px"> <div ref="search" class="search" style="min-height: 60px">
<el-form :inline="true" :model="form" class="demo-form-inline" v-show="tableShow"> <el-form v-show="tableShow" :inline="true" :model="form" class="demo-form-inline">
<el-form-item label="传感器编号"> <el-form-item label="传感器编号">
<el-input v-model="form.data1" placeholder="传感器编号"></el-input> <el-input v-model="form.data1" placeholder="传感器编号"></el-input>
</el-form-item> </el-form-item>
@ -18,10 +18,10 @@
<el-form-item label="采集时间"> <el-form-item label="采集时间">
<el-date-picker <el-date-picker
v-model="form.data3" v-model="form.data3"
type="datetimerange" end-placeholder="结束日期"
range-separator="至" range-separator="至"
start-placeholder="开始日期" start-placeholder="开始日期"
end-placeholder="结束日期"> type="datetimerange">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
@ -32,55 +32,64 @@
</div> </div>
<div :style="{height:maxHeight+'px'}" class="table"> <div :style="{height:maxHeight+'px'}" class="table">
<el-table <el-table
v-loading="loading"
v-if='tableShow' v-if='tableShow'
v-loading="loading"
:cell-style="setStyle" :cell-style="setStyle"
:data="tableData" :data="tableData"
: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 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">
<img v-if="tableData[scope.$index][i.columnKey].toString().includes('http')"
:src="tableData[scope.$index][i.columnKey]" alt="" height="100px"
width="100px">
<span v-else> {{ tableData[scope.$index][i.columnKey].toString() }}</span>
</template>
</el-table-column> </el-table-column>
<!-- <el-table-column--> <!-- <el-table-column-->
<!-- label="rssi"--> <!-- label="rssi"-->
<!-- prop="rssi">--> <!-- prop="rssi">-->
<!-- </el-table-column>--> <!-- </el-table-column>-->
<!-- <el-table-column--> <!-- <el-table-column-->
<!-- label="value1"--> <!-- label="value1"-->
<!-- prop="value1">--> <!-- prop="value1">-->
<!-- </el-table-column>--> <!-- </el-table-column>-->
<!-- <el-table-column--> <!-- <el-table-column-->
<!-- label="编号"--> <!-- label="编号"-->
<!-- prop="devicecode">--> <!-- prop="devicecode">-->
<!-- </el-table-column>--> <!-- </el-table-column>-->
<!-- <el-table-column--> <!-- <el-table-column-->
<!-- label="alias"--> <!-- label="alias"-->
<!-- prop="alias">--> <!-- prop="alias">-->
<!-- </el-table-column>--> <!-- </el-table-column>-->
<!-- <el-table-column--> <!-- <el-table-column-->
<!-- label="设备名称"--> <!-- label="设备名称"-->
<!-- prop="devicename">--> <!-- prop="devicename">-->
<!-- </el-table-column>--> <!-- </el-table-column>-->
<!-- <el-table-column--> <!-- <el-table-column-->
<!-- label="ts"--> <!-- label="ts"-->
<!-- prop="ts">--> <!-- prop="ts">-->
<!-- </el-table-column>--> <!-- </el-table-column>-->
<!-- <el-table-column--> <!-- <el-table-column-->
<!-- label="voltage"--> <!-- label="voltage"-->
<!-- prop="voltage">--> <!-- prop="voltage">-->
<!-- </el-table-column>--> <!-- </el-table-column>-->
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column align="center" class-name="small-padding fixed-width" label="操作">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
type="primary" type="primary"
@click="toHistory(scope.row.deviceid,scope.row.devicemodeid)" @click="toHistory(scope.row.deviceid,scope.row.devicemodeid)"
>查看历史</el-button> >查看历史
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</div> </div>
<div ref="pagination" style="margin-top: 12px;height: 36px;"> <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="limit" @current-change="currentChange"> <el-pagination :current-page="offset" :pageSize="limit" :total="total" background
layout="prev, pager, next" style="display: inline-block;float:right;"
@current-change="currentChange">
</el-pagination> </el-pagination>
</div> </div>
</div> </div>
@ -94,27 +103,26 @@ import {
} from '@/api/board/equipmentMonitoring' } from '@/api/board/equipmentMonitoring'
export default { export default {
components: { components: {},
},
data() { data() {
return { return {
loading:false, loading: false,
tableShow: false, tableShow: false,
form: { form: {
data1: '', data1: '',
data2: '', data2: '',
data3: null data3: null
}, },
deviceModeId:'', deviceModeId: '',
maxHeight: 0, maxHeight: 0,
tableData: [], tableData: [],
deviceList:[], deviceList: [],
sceneId: 0, sceneId: 0,
offset:1, offset: 1,
limit:10, limit: 10,
total:0, total: 0,
deviceDataColumns:[], deviceDataColumns: [],
tableDataRow:[] tableDataRow: []
} }
}, },
async mounted() { async mounted() {
@ -122,30 +130,33 @@ export default {
await this.getData() await this.getData()
}, },
methods: { methods: {
query(){ log(e) {
this.getRightData({deviceModeId:this.deviceModeId}) console.log(e)
}, },
reset(){ query() {
this.getRightData({deviceModeId: this.deviceModeId})
},
reset() {
this.form = { this.form = {
data1: '', data1: '',
data2: '', data2: '',
data3: null data3: null
} }
this.getRightData({deviceModeId:this.deviceModeId}) this.getRightData({deviceModeId: this.deviceModeId})
}, },
async currentChange(e){ async currentChange(e) {
this.tableData =this.tableDataRow.slice(this.limit*(e-1),this.limit*e) this.tableData = this.tableDataRow.slice(this.limit * (e - 1), this.limit * e)
}, },
async getRightData(e){ async getRightData(e) {
this.deviceModeId = e.deviceModeId this.deviceModeId = e.deviceModeId
this.loading = true this.loading = true
await this.setSelectLatestDataByDeviceMode({ await this.setSelectLatestDataByDeviceMode({
"sceneId": this.$store.getters.sceneId, "sceneId": this.$store.getters.sceneId,
"deviceModeId": e.deviceModeId, "deviceModeId": e.deviceModeId,
deviceCode:this.form.data1, deviceCode: this.form.data1,
deviceName:this.form.data2, deviceName: this.form.data2,
startTime:this.form?.data3?.length>1? new Date(this.form.data3[0]).getTime():'', startTime: this.form?.data3?.length > 1 ? new Date(this.form.data3[0]).getTime() : '',
endTime:this.form?.data3?.length>1? new Date(this.form.data3[1]).getTime():'', endTime: this.form?.data3?.length > 1 ? new Date(this.form.data3[1]).getTime() : '',
// "offset": this.offset-1, // "offset": this.offset-1,
// "limit": 10 // "limit": 10
}) })
@ -163,24 +174,24 @@ export default {
return {textAlign: 'center', backgroundColor: '#063468', color: '#05aaba'} return {textAlign: 'center', backgroundColor: '#063468', color: '#05aaba'}
} }
}, },
async setSelectLatestDataByDeviceMode(e){ async setSelectLatestDataByDeviceMode(e) {
const {data} = await selectLatestDataByDeviceMode(e) const {data} = await selectLatestDataByDeviceMode(e)
this.deviceDataColumns = data.deviceDataColumns this.deviceDataColumns = data.deviceDataColumns
this.tableDataRow =data.latestData || [] this.tableDataRow = data.latestData || []
this.tableData =( data.latestData || []).slice(0,this.limit) this.tableData = (data.latestData || []).slice(0, this.limit)
this.total=data.latestData.length || 0 this.total = data.latestData.length || 0
this.offset = 1 this.offset = 1
}, },
async setDeviceModesBySceneId(){ async setDeviceModesBySceneId() {
const {data} = await getDeviceModesBySceneId( { const {data} = await getDeviceModesBySceneId({
"sceneId": this.$store.getters.sceneId, "sceneId": this.$store.getters.sceneId,
}) })
this.deviceList = data this.deviceList = data
}, },
toHistory(e,i){ toHistory(e, i) {
console.log(e) console.log(e)
console.log(i) console.log(i)
this.$router.push({path: "/board/senso",query:{id:e,deviceModeId:i}}); this.$router.push({path: "/board/senso", query: {id: e, deviceModeId: i}});
} }
} }
}; };
@ -253,7 +264,8 @@ export default {
color: #25bffc; color: #25bffc;
border-color: #25bffc; border-color: #25bffc;
} }
/deep/.el-range-input{
/deep/ .el-range-input {
background-color: #0000; background-color: #0000;
} }
} }

@ -179,6 +179,9 @@ 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'){
this.date = null
}
}, },
async setHistoryData() { async setHistoryData() {
this.isMap = false this.isMap = false
@ -191,7 +194,7 @@ export default {
"offset": this.currentPage - 1, "offset": this.currentPage - 1,
"limit": 10, "limit": 10,
startTime: this.date, startTime: this.date,
endTime: this.date + (1000 * 60 * 60 * 24) endTime: this.date ? this.date + (1000 * 60 * 60 * 24) : null
}) })
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) {

@ -136,7 +136,9 @@ export default {
} }
}, },
async mounted() { async mounted() {
// await this.getData(this.$store.getters.sceneId) if(this.$store.getters.sceneId !== null){
await this.getData(this.$store.getters.sceneId)
}
}, },
methods: { methods: {
toMonitor(e){ toMonitor(e){

Loading…
Cancel
Save