修改图表

master
夜笙歌 2 years 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({ return request({
// baseURL:'/monitoring-api', // baseURL:'/monitoring-api',
url: '/business/monitorPlatform/selectDevicesByMonitorUnitId/'+query+'/'+data, 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({ return request({
// baseURL:'/monitoring-api', // baseURL:'/monitoring-api',
url: '/business/monitorPlatform/selectLatestDataByDeviceMode', url: '/business/monitorPlatform/selectLatestDataByDeviceMode',

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

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

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

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

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

Loading…
Cancel
Save