修改图表

dev
夜笙歌 1 year ago
parent fa73d199ca
commit 5bfd3c8810

@ -66,7 +66,6 @@ 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"}); await this.$router.replace({path: "/board/index"});
@ -96,6 +95,7 @@ export default {
this.selectSecnesList = data this.selectSecnesList = data
if (!this.$store.getters.sceneId) { if (!this.$store.getters.sceneId) {
this.sceneId = data.find(e => e.defaultFlag === '1').sceneId this.sceneId = data.find(e => e.defaultFlag === '1').sceneId
this.name = data.find(e => e.defaultFlag === '1').sceneName
} }
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

@ -275,6 +275,7 @@ export default {
}, },
async setAlarmInfos() { async setAlarmInfos() {
const {rows: data} = await getAlarmInfos() const {rows: data} = await getAlarmInfos()
console.log(data)
this.table1Data = data.map((e, i) => { this.table1Data = data.map((e, i) => {
return { return {
value1: i, value1: i,

@ -148,7 +148,7 @@ export default {
this.monitorUnitId = e.id this.monitorUnitId = e.id
this.getDevice(e.id) this.getDevice(e.id)
this.getRightDevice(e.id) this.getRightDevice(e.id)
this.setMonitorById() this.setMonitorById(e)
this.show = true this.show = true
if(!getDeviceInterval){ if(!getDeviceInterval){
var getDeviceInterval = setInterval(this.getDevice, 30 * 1000) var getDeviceInterval = setInterval(this.getDevice, 30 * 1000)
@ -158,11 +158,9 @@ export default {
} }
}, },
async getDevice(e) { async getDevice(e) {
console.log('getDevice')
const {data} = await selectDeviceByDeviceModeByMonitorUnitId(this.$store.getters.sceneId, e) const {data} = await selectDeviceByDeviceModeByMonitorUnitId(this.$store.getters.sceneId, e)
this.controlList = data.control this.controlList = data.control
this.acquisitionList = data.acquisition this.acquisitionList = data.acquisition
console.log(data)
}, },
async getRightDevice(e) { async getRightDevice(e) {
const data = await selectDeviceModeFunctionByFunctionType({ const data = await selectDeviceModeFunctionByFunctionType({
@ -172,8 +170,8 @@ export default {
"limit": 1 "limit": 1
}) })
}, },
async setMonitorById() { async setMonitorById(e) {
const {data} = await getMonitorById(this.$store.getters.sceneId) const {data} = await getMonitorById(e.id)
this.MonitorInfo = data this.MonitorInfo = data
}, },
toHistory() { toHistory() {

@ -138,7 +138,6 @@ export default {
"limit": 10 "limit": 10
}) })
this.tableData = data.latestData || [] this.tableData = data.latestData || []
console.log(this.tableData)
}, },
async setDeviceModesBySceneId(){ async setDeviceModesBySceneId(){
const {data} = await getDeviceModesBySceneId( { const {data} = await getDeviceModesBySceneId( {

@ -1,7 +1,7 @@
<template> <template>
<div class="container"> <div class="container">
<div class="centerImg"></div> <div class="centerImg"></div>
<BoardTopNav nowMenu="1"></BoardTopNav> <BoardTopNav nowMenu="1" @sceneIdChange="sceneIdChange"></BoardTopNav>
<Chart ref="chart1" class="chart1"></Chart> <Chart ref="chart1" class="chart1"></Chart>
<div class="chart1Right"> <div class="chart1Right">
<p v-for="(i,k) in chart1Data.slice(0,4)" :key="k" :style="'color:'+ chart1Color[k]">{{ i.name }}</p> <p v-for="(i,k) in chart1Data.slice(0,4)" :key="k" :style="'color:'+ chart1Color[k]">{{ i.name }}</p>
@ -292,6 +292,13 @@ 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 = {
@ -362,10 +369,16 @@ export default {
}) })
}, },
async setDeviceOperations() { async setDeviceOperations() {
const {data: data} = await getDeviceOperations() let {data: data} = await getDeviceOperations()
console.log(data) let sortArr = Object.keys(data)
let x = Object.keys(data) sortArr = sortArr.sort((a,b)=>{
let y = Object.values(data) return new Date(a).getTime() - new Date(b).getTime()
})
console.log(sortArr)
let x = sortArr
let y = sortArr.map(e=>{
return data[e]
})
this.inTransitNum = y.reduce((a, b) => { this.inTransitNum = y.reduce((a, b) => {
return a + b return a + b
}, 0) }, 0)

@ -35,11 +35,20 @@ module.exports = {
proxy: { proxy: {
// detail: https://cli.vuejs.org/config/#devserver-proxy // detail: https://cli.vuejs.org/config/#devserver-proxy
[process.env.VUE_APP_BASE_API]: { [process.env.VUE_APP_BASE_API]: {
target: `http://localhost:8080`, target: `http://10.11.40.120:8080`,
// target: `http://10.11.43.111:8080`,
changeOrigin: true, changeOrigin: true,
pathRewrite: { pathRewrite: {
['^' + process.env.VUE_APP_BASE_API]: '' ['^' + process.env.VUE_APP_BASE_API]: ''
} }
},
['/monitoring-api']: {
target: `http://10.11.40.120:9601`,
// target: `http://10.11.43.111:9601`,
changeOrigin: true,
pathRewrite: {
['^/monitoring-api']: ''
}
} }
}, },
disableHostCheck: true disableHostCheck: true

Loading…
Cancel
Save