修改图表

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

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

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

@ -148,7 +148,7 @@ export default {
this.monitorUnitId = e.id
this.getDevice(e.id)
this.getRightDevice(e.id)
this.setMonitorById()
this.setMonitorById(e)
this.show = true
if(!getDeviceInterval){
var getDeviceInterval = setInterval(this.getDevice, 30 * 1000)
@ -158,11 +158,9 @@ export default {
}
},
async getDevice(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({
@ -172,8 +170,8 @@ export default {
"limit": 1
})
},
async setMonitorById() {
const {data} = await getMonitorById(this.$store.getters.sceneId)
async setMonitorById(e) {
const {data} = await getMonitorById(e.id)
this.MonitorInfo = data
},
toHistory() {

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

@ -1,7 +1,7 @@
<template>
<div class="container">
<div class="centerImg"></div>
<BoardTopNav nowMenu="1"></BoardTopNav>
<BoardTopNav nowMenu="1" @sceneIdChange="sceneIdChange"></BoardTopNav>
<Chart ref="chart1" class="chart1"></Chart>
<div class="chart1Right">
<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()
},
methods: {
sceneIdChange(){
this.setChart1()
this.setChart2()
this.setAllNums()
this.setTable3()
this.setDeviceOperations()
},
async setChart1() {
const {rows: data} = await monitorPercentage()
let option1 = {
@ -362,10 +369,16 @@ export default {
})
},
async setDeviceOperations() {
const {data: data} = await getDeviceOperations()
console.log(data)
let x = Object.keys(data)
let y = Object.values(data)
let {data: data} = await getDeviceOperations()
let sortArr = Object.keys(data)
sortArr = sortArr.sort((a,b)=>{
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) => {
return a + b
}, 0)

@ -35,11 +35,20 @@ module.exports = {
proxy: {
// detail: https://cli.vuejs.org/config/#devserver-proxy
[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,
pathRewrite: {
['^' + 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
@ -47,7 +56,7 @@ module.exports = {
css: {
loaderOptions: {
sass: {
sassOptions: { outputStyle: "expanded" }
sassOptions: {outputStyle: "expanded"}
}
}
},
@ -91,44 +100,44 @@ module.exports = {
.end()
config.when(process.env.NODE_ENV !== 'development', config => {
config
.plugin('ScriptExtHtmlWebpackPlugin')
.after('html')
.use('script-ext-html-webpack-plugin', [{
// `runtime` must same as runtimeChunk name. default is `runtime`
inline: /runtime\..*\.js$/
}])
.end()
config.optimization.splitChunks({
chunks: 'all',
cacheGroups: {
libs: {
name: 'chunk-libs',
test: /[\\/]node_modules[\\/]/,
priority: 10,
chunks: 'initial' // only package third parties that are initially dependent
},
elementUI: {
name: 'chunk-elementUI', // split elementUI into a single package
test: /[\\/]node_modules[\\/]_?element-ui(.*)/, // in order to adapt to cnpm
priority: 20 // the weight needs to be larger than libs and app or it will be packaged into libs or app
},
commons: {
name: 'chunk-commons',
test: resolve('src/components'), // can customize your rules
minChunks: 3, // minimum common number
priority: 5,
reuseExistingChunk: true
}
}
})
config
.plugin('ScriptExtHtmlWebpackPlugin')
.after('html')
.use('script-ext-html-webpack-plugin', [{
// `runtime` must same as runtimeChunk name. default is `runtime`
inline: /runtime\..*\.js$/
}])
.end()
config.optimization.runtimeChunk('single'),
{
from: path.resolve(__dirname, './public/robots.txt'), //防爬虫文件
to: './' //到根目录下
config.optimization.splitChunks({
chunks: 'all',
cacheGroups: {
libs: {
name: 'chunk-libs',
test: /[\\/]node_modules[\\/]/,
priority: 10,
chunks: 'initial' // only package third parties that are initially dependent
},
elementUI: {
name: 'chunk-elementUI', // split elementUI into a single package
test: /[\\/]node_modules[\\/]_?element-ui(.*)/, // in order to adapt to cnpm
priority: 20 // the weight needs to be larger than libs and app or it will be packaged into libs or app
},
commons: {
name: 'chunk-commons',
test: resolve('src/components'), // can customize your rules
minChunks: 3, // minimum common number
priority: 5,
reuseExistingChunk: true
}
}
})
config.optimization.runtimeChunk('single'),
{
from: path.resolve(__dirname, './public/robots.txt'), //防爬虫文件
to: './' //到根目录下
}
})
}
}

Loading…
Cancel
Save