修改图表

dev
夜笙歌 1 year ago
parent 5bfd3c8810
commit 3816bcbcd4

@ -9,7 +9,7 @@ export function treeList(query=0) {
})
}
// 中下
export function selectDeviceByDeviceModeByMonitorUnitId(query=0,data=0) {
export function selectDevicesByMonitorUnitId(query=0,data=0) {
return request({
// baseURL:'/monitoring-api',
url: '/business/monitorPlatform/selectDevicesByMonitorUnitId/'+query+'/'+data,
@ -18,7 +18,7 @@ export function selectDeviceByDeviceModeByMonitorUnitId(query=0,data=0) {
})
}
// 右
export function selectDeviceModeFunctionByFunctionType(query) {
export function selectLatestDataByDeviceMode(query) {
return request({
// baseURL:'/monitoring-api',
url: '/business/monitorPlatform/selectLatestDataByDeviceMode',

@ -99,6 +99,7 @@ export default {
}
if (this.$route.query.name) {
this.sceneId = data.find(e => e.sceneName === this.$route.query.name).sceneId
this.name = data.find(e => e.sceneName === this.$route.query.name).sceneName
}
this.$emit('sceneIdChange', this.sceneId);
await this.$store.dispatch('app/setSceneId', this.sceneId)
@ -109,10 +110,10 @@ export default {
toLink(e) {
this.$router.replace({path: "/board/" + e});
},
dropdownLink(e) {
async dropdownLink(e) {
await this.$store.dispatch('app/setSceneId', e.sceneId)
this.$emit('sceneIdChange', e.sceneId);
this.name = e.name
this.$store.dispatch('app/setSceneId', e.sceneId)
this.$router.replace({path: "/board/" + (e.router || 'smartScene'), query: {name: e.name}});
},
toIndex() {

@ -83,13 +83,14 @@
<script>
import {
treeList,
selectDeviceByDeviceModeByMonitorUnitId,
selectDeviceModeFunctionByFunctionType,
selectDevicesByMonitorUnitId,
selectLatestDataByDeviceMode,
getMonitorById
} from '@/api/board/equipment'
import BoardTopNav from '@/components/BoardTopNav'
let getDeviceInterval = null
export default {
components: {
BoardTopNav
@ -107,6 +108,7 @@ export default {
acquisitionList: [],
MonitorInfo: {},
sceneId: 0,
deviceId: ''
}
},
async mounted() {
@ -150,20 +152,22 @@ export default {
this.getRightDevice(e.id)
this.setMonitorById(e)
this.show = true
if(!getDeviceInterval){
var getDeviceInterval = setInterval(this.getDevice, 30 * 1000)
if (typeof getDeviceInterval === 'number') {
clearInterval(getDeviceInterval)
getDeviceInterval = setInterval(this.getDevice, 30 * 1000)
}
getDeviceInterval = setInterval(() => {
this.getDevice(this.deviceId)
}, 30 * 1000)
}
},
async getDevice(e) {
const {data} = await selectDeviceByDeviceModeByMonitorUnitId(this.$store.getters.sceneId, e)
const {data} = await selectDevicesByMonitorUnitId(this.$store.getters.sceneId, e)
this.deviceId = e
this.controlList = data.control
this.acquisitionList = data.acquisition
},
async getRightDevice(e) {
const data = await selectDeviceModeFunctionByFunctionType({
const data = await selectLatestDataByDeviceMode({
"sceneId": this.$store.getters.sceneId,
"deviceModeId": 1,
"offset": 0,
@ -177,6 +181,9 @@ export default {
toHistory() {
this.$router.push({path: "/board/senso"});
}
},
beforeDestroy() {
clearInterval(getDeviceInterval)
}
};
</script>

@ -292,13 +292,6 @@ export default {
this.setDeviceOperations()
},
methods: {
sceneIdChange(){
this.setChart1()
this.setChart2()
this.setAllNums()
this.setTable3()
this.setDeviceOperations()
},
async setChart1() {
const {rows: data} = await monitorPercentage()
let option1 = {

@ -147,7 +147,7 @@ export default {
},
async setHistoryData() {
const {data} = await getHistoryData({
"sceneId": this.sceneId,
"sceneId":this.$store.getters.sceneId,
"deviceId": 2,
"offset": 0,
"limit": 5,

@ -130,21 +130,21 @@ export default {
methods: {
sceneIdChange(e){
this.sceneId = e
this.getData()
this.getData(e)
},
async getData() {
await this.setAllNum()
await this.setLimitSubMonitorUnit()
await this.setAlarmCountGroupAlarmType()
async getData(e) {
await this.setAllNum(e)
await this.setLimitSubMonitorUnit(e)
await this.setAlarmCountGroupAlarmType(e)
await this.setAlarmInfos()
},
async setAllNum() {
const {subSum, sum} = await sceneAllNums(this.$store.getters.sceneId)
async setAllNum(e) {
const {subSum, sum} = await sceneAllNums(e)
this.num1 = subSum
this.num2 = sum
},
async setLimitSubMonitorUnit() {
const data = await getLimitSubMonitorUnit(this.$store.getters.sceneId)
async setLimitSubMonitorUnit(e) {
const data = await getLimitSubMonitorUnit(e)
this.LimitSubMonitorUnitList = data.rows
this.tableData = data.rows.slice(0, 4)
this.total = data.total
@ -152,8 +152,8 @@ export default {
currentChange(e) {
this.tableData = this.LimitSubMonitorUnitList.slice(4 * (e - 1), 4 * (e - 1) + 4)
},
async setAlarmCountGroupAlarmType() {
let {data: data} = await getAlarmCountGroupAlarmType(this.$store.getters.sceneId)
async setAlarmCountGroupAlarmType(e) {
let {data: data} = await getAlarmCountGroupAlarmType(e)
data.sort((a, b) => {
return b.alarmCount - a.alarmCount
})

Loading…
Cancel
Save