修改存储

dev
夜笙歌 1 year ago
parent 8f986b4855
commit fa73d199ca

@ -55,7 +55,7 @@ export default {
selectSecnesList: [],
name: '智慧场景',
isIndex: true,
sceneId: 0,
sceneId: this.$store.getters.sceneId,
}
},
props: {
@ -66,6 +66,11 @@ export default {
},
async mounted() {
if (this.$route.name === 'SmartScene' || this.$route.name === 'GPS' || this.$route.name === 'index' || this.$store.getters.sceneId) {
}else{
await this.$router.replace({path: "/board/index"});
}
await this.setSelectSecnes()
if (this.$route.name === 'SmartScene' || this.$route.name === 'GPS') {
if (this.$route.query?.name) {
@ -83,31 +88,35 @@ export default {
} else {
this.isIndex = false
}
},
methods: {
async setSelectSecnes() {
const {data} = await selectSecnes()
this.selectSecnesList = data
if (!this.$route.query.name) {
if (!this.$store.getters.sceneId) {
this.sceneId = data.find(e => e.defaultFlag === '1').sceneId
}else{
}
if (this.$route.query.name) {
this.sceneId = data.find(e => e.sceneName === this.$route.query.name).sceneId
}
this.$emit('sceneIdChange', this.sceneId);
await this.$store.dispatch('app/setSceneId', this.sceneId)
},
// sceneIdChange(){
//
// },
toLink(e) {
this.$router.push({path: "/board/" + e});
this.$router.replace({path: "/board/" + e});
},
dropdownLink(e) {
this.name = e.name
this.$emit('sceneIdChange', e.sceneId);
this.$router.push({path: "/board/" + (e.router || 'smartScene'), query: {name: e.name}});
this.name = e.name
this.$store.dispatch('app/setSceneId', e.sceneId)
this.$router.replace({path: "/board/" + (e.router || 'smartScene'), query: {name: e.name}});
},
toIndex() {
this.$router.push({path: "/index"});
this.$router.replace({path: "/index"});
}
}
};

@ -16,5 +16,6 @@ const getters = {
defaultRoutes:state => state.permission.defaultRoutes,
sidebarRouters:state => state.permission.sidebarRouters,
language: state => state.app.language,
sceneId: state => state.app.sceneId,
}
export default getters

@ -8,7 +8,8 @@ const state = {
},
device: 'desktop',
size: Cookies.get('size') || 'medium',
language: Cookies.get('language') || 'en_US'
language: Cookies.get('language') || 'en_US',
sceneId:0
}
const mutations = {
@ -42,6 +43,9 @@ const mutations = {
SET_LANGUAGE: (state, language) => {
state.language = language
Cookies.set('language', language)
},
SET_SCENEID:(state,sceneId) =>{
state.sceneId = sceneId
}
}
@ -64,6 +68,10 @@ const actions = {
},
setLanguage({ commit }, language) {
commit('SET_LANGUAGE', language)
},
setSceneId({ commit }, sceneId) {
commit('SET_SCENEID', sceneId)
}
}

@ -220,7 +220,7 @@ export default {
map.setFitView()
},
async getAlarmStats() {
const {data} = await alarmStats(this.sceneId)
const {data} = await alarmStats(this.$store.getters.sceneId)
let option1 = {
...this.chart1Option,
yAxis: {
@ -268,7 +268,7 @@ export default {
this.$refs.chart1.setData(option1)
},
async getAubDevice() {
let data = await subDevice(this.sceneId)
let data = await subDevice(this.$store.getters.sceneId)
this.num1 = data.deviceNum
this.num2 = data.subSum
this.num3 = data.onlineDeviceNum
@ -285,7 +285,7 @@ export default {
})
},
async setElectronicNumVo() {
const {data} = await ElectronicNumVo(this.sceneId)
const {data} = await ElectronicNumVo(this.$store.getters.sceneId)
data.forEach(e => {
if (e.areaPoints?.length > 0) {
this.setPolygon(e.areaPoints)

@ -1,7 +1,7 @@
<template>
<div class="container">
<div class="centerImg"></div>
<BoardTopNav nowMenu="3" @sceneIdChange="sceneIdChange"></BoardTopNav>
<BoardTopNav ref="boardTopNav" nowMenu="3" @sceneIdChange="sceneIdChange"></BoardTopNav>
<div class="title">物联网平台</div>
<div class="tree">
@ -33,7 +33,7 @@
<span style="color: #d9dee3">{{ MonitorInfo.monitorUnitTypeId }}</span>
</p>
</div>
<div class="img" v-if="show"></div>
<div v-if="show" class="img"></div>
<div class="terminal">
<el-form :model="form" class="demo-form-inline">
<el-form-item label="传感器名称:">
@ -110,7 +110,8 @@ export default {
}
},
async mounted() {
setInterval(this.getDevice, 30 * 1000)
this.sceneId = this.$store.getters.sceneId
},
methods: {
sceneIdChange(e) {
@ -139,33 +140,40 @@ export default {
});
},
async getTree() {
const {data} = await treeList(this.sceneId)
const {data} = await treeList(this.$store.getters.sceneId)
this.treeData = data
},
treeClick(e) {
if (e.child.length === 0) {
this.monitorUnitId = e.monitorUnitId
this.getDevice(e.monitorUnitId)
this.getRightDevice(e.monitorUnitId)
if (!e.children?.length > 0) {
this.monitorUnitId = e.id
this.getDevice(e.id)
this.getRightDevice(e.id)
this.setMonitorById()
this.show = true
if(!getDeviceInterval){
var getDeviceInterval = setInterval(this.getDevice, 30 * 1000)
clearInterval(getDeviceInterval)
getDeviceInterval = setInterval(this.getDevice, 30 * 1000)
}
}
},
async getDevice(e) {
const {data} = await selectDeviceByDeviceModeByMonitorUnitId(this.sceneId, e)
console.log('getDevice')
const {data} = await selectDeviceByDeviceModeByMonitorUnitId(this.$store.getters.sceneId, e)
this.controlList = data.control
this.acquisitionList = data.acquisition
console.log(data)
},
async getRightDevice(e) {
const data = await selectDeviceModeFunctionByFunctionType({
"sceneId": this.sceneId,
"sceneId": this.$store.getters.sceneId,
"deviceModeId": 1,
"offset": 0,
"limit": 1
})
},
async setMonitorById() {
const {data} = await getMonitorById(this.sceneId)
const {data} = await getMonitorById(this.$store.getters.sceneId)
this.MonitorInfo = data
},
toHistory() {

@ -69,9 +69,8 @@
<template slot-scope="scope">
<el-button
type="primary"
icon="el-icon-edit"
@click="toHistory"
>修改</el-button>
>查看历史</el-button>
</template>
</el-table-column>
</el-table>
@ -132,18 +131,18 @@ export default {
},
async setSelectLatestDataByDeviceMode(){
const {data} = await selectLatestDataByDeviceMode({
"sceneId": this.sceneId,
"sceneId": this.$store.getters.sceneId,
"deviceModeId": 1,
"startTime": 1222222222222,
"offset": 0,
"limit": 10
})
this.tableData = data.latestData?.rows || []
this.tableData = data.latestData || []
console.log(this.tableData)
},
async setDeviceModesBySceneId(){
const {data} = await getDeviceModesBySceneId( {
"sceneId": this.sceneId,
"sceneId": this.$store.getters.sceneId,
})
this.deviceList = data
},

@ -142,7 +142,7 @@ export default {
}
},
async setDeviceInfo() {
const {data} = await getDeviceInfo(this.sceneId)
const {data} = await getDeviceInfo(this.$store.getters.sceneId)
this.topData = data || {}
},
async setHistoryData() {
@ -161,7 +161,7 @@ export default {
})
},
async setLinkDevices() {
const {data} = await getLinkDevices(this.sceneId)
const {data} = await getLinkDevices(this.$store.getters.sceneId)
this.bottomData = data
}
}

@ -72,7 +72,7 @@
<div class="titleBg"></div>
<div class="title">
<span style="margin-right: 28px;"> {{ i.monitorUnitName }} </span>
<el-tag :type="i.alarmStatus === 1 ?'success' : 'danger'">{{ i.alarmStatus === 1 ? '正常' : '异常' }}</el-tag>
<!-- <el-tag :type="i.alarmStatus === 1 ?'success' : 'danger'">{{ i.alarmStatus === 1 ? '正常' : '异常' }}</el-tag>-->
</div>
<div class="img"></div>
</div>
@ -139,12 +139,12 @@ export default {
await this.setAlarmInfos()
},
async setAllNum() {
const {subSum, sum} = await sceneAllNums(this.sceneId)
const {subSum, sum} = await sceneAllNums(this.$store.getters.sceneId)
this.num1 = subSum
this.num2 = sum
},
async setLimitSubMonitorUnit() {
const data = await getLimitSubMonitorUnit(this.sceneId)
const data = await getLimitSubMonitorUnit(this.$store.getters.sceneId)
this.LimitSubMonitorUnitList = data.rows
this.tableData = data.rows.slice(0, 4)
this.total = data.total
@ -153,7 +153,7 @@ export default {
this.tableData = this.LimitSubMonitorUnitList.slice(4 * (e - 1), 4 * (e - 1) + 4)
},
async setAlarmCountGroupAlarmType() {
let {data: data} = await getAlarmCountGroupAlarmType(this.sceneId)
let {data: data} = await getAlarmCountGroupAlarmType(this.$store.getters.sceneId)
data.sort((a, b) => {
return b.alarmCount - a.alarmCount
})
@ -162,9 +162,7 @@ export default {
},
async setAlarmInfos() {
const {rows: data} = await getAlarmInfos()
console.log(data)
this.table1Data = data.map((e,i)=>{
console.log(e)
return {
data1: i+1,
data2: e.alarmLevelName,

Loading…
Cancel
Save