| | |
| | | let dataColor = posData.color; |
| | | let bgColor = posData.bgColor; |
| | | let yData = posData.yData; |
| | | let radius = (this.$refs.chart.clientHeight / 3 - 7) > 0 ? this.$refs.chart.clientHeight / 3 - 7 : 0; |
| | | let radius = (this.$refs.chart.clientHeight / 4 - 7) > 0 ? this.$refs.chart.clientHeight / 4 - 7 : 0; |
| | | let data = posData.data; |
| | | let max = posData[0]; |
| | | data.map(item => { |
| | |
| | | this.$options.chartData = sendData; |
| | | this.organizeData(sendData) |
| | | } else { |
| | | let userId = localStorage.getItem('userId'); |
| | | let params = { |
| | | userId: userId |
| | | } |
| | | batteryStatus(params).then((res) => { |
| | | if (res.data.code == 1) { |
| | | let optionData = { |
| | | yData: [], |
| | | color: ['#f58881', '#b4d465', '#ffcb29'], |
| | | bgColor: ['rgba(245,136,129,0.35)', 'rgba(255,255,255,0.35)', 'rgba(255,203,41,0.35)'], |
| | | data: [] |
| | | } |
| | | let resData = res.data.data; |
| | | for (let key in resData) { |
| | | optionData.yData.push(key); |
| | | optionData.data.push(resData[key]); |
| | | } |
| | | this.$options.chartData = optionData; |
| | | this.organizeData(optionData) |
| | | } |
| | | }).catch((err) => { |
| | | console.log(err) |
| | | }); |
| | | this.postData() |
| | | setInterval(() => { |
| | | this.postData() |
| | | }, 3000) |
| | | } |
| | | }, |
| | | postData() { |
| | | let userId = localStorage.getItem('userId'); |
| | | let params = { |
| | | userId: userId |
| | | } |
| | | batteryStatus(params).then((res) => { |
| | | if (res.data.code == 1) { |
| | | let optionData = { |
| | | yData: [], |
| | | color: ['#f58881', '#b4d465', '#ffcb29'], |
| | | bgColor: ['rgba(245,136,129,0.35)', 'rgba(255,255,255,0.35)', 'rgba(255,203,41,0.35)'], |
| | | data: [] |
| | | } |
| | | let resData = res.data.data; |
| | | for (let key in resData) { |
| | | optionData.yData.push(key); |
| | | optionData.data.push(resData[key]); |
| | | } |
| | | this.$options.chartData = optionData; |
| | | this.organizeData(optionData) |
| | | } |
| | | }).catch((err) => { |
| | | console.log(err) |
| | | }); |
| | | }, |
| | | resize() { |
| | | setTimeout(() => { |
| | |
| | | |
| | | .flexCon .con { |
| | | width: 100%; |
| | | height: 70%; |
| | | height: 80%; |
| | | } |
| | | </style> |
| | |
| | | this.$options.chartData = sendData; |
| | | this.organizeData(sendData) |
| | | } else { |
| | | let userId = localStorage.getItem('userId'); |
| | | let params = { |
| | | userId: userId |
| | | } |
| | | rectifier(params).then((res) => { |
| | | if (res.data.code == 1) { |
| | | let optionData = { |
| | | data: [] |
| | | } |
| | | let resData = res.data.data; |
| | | for (let key in resData) { |
| | | let obj = {}; |
| | | obj.name = key; |
| | | obj.value = resData[key]; |
| | | optionData.data.push(obj) |
| | | } |
| | | this.$options.chartData = optionData; |
| | | this.organizeData(optionData) |
| | | } |
| | | }).catch((err) => { |
| | | console.log(err) |
| | | }); |
| | | this.postData() |
| | | setInterval(() => { |
| | | this.postData() |
| | | }, 3000) |
| | | } |
| | | }, |
| | | postData() { |
| | | let userId = localStorage.getItem('userId'); |
| | | let params = { |
| | | userId: userId |
| | | } |
| | | rectifier(params).then((res) => { |
| | | if (res.data.code == 1) { |
| | | let optionData = { |
| | | data: [] |
| | | } |
| | | let resData = res.data.data; |
| | | for (let key in resData) { |
| | | let obj = {}; |
| | | obj.name = key; |
| | | obj.value = resData[key]; |
| | | optionData.data.push(obj) |
| | | } |
| | | this.$options.chartData = optionData; |
| | | this.organizeData(optionData) |
| | | } |
| | | }).catch((err) => { |
| | | console.log(err) |
| | | }); |
| | | }, |
| | | resize() { |
| | | setTimeout(() => { |
| | | this.$options.chart.resize(); |
| | |
| | | this.$options.chartData = sendData; |
| | | this.organizeData(sendData) |
| | | } else { |
| | | let userId = localStorage.getItem('userId'); |
| | | let params = { |
| | | userId: userId |
| | | } |
| | | chargeAnalysis(params).then((res) => { |
| | | if (res.data.code == 1) { |
| | | let optionData = { |
| | | xData: [], |
| | | series: [{ |
| | | name: '放电', |
| | | data: [], |
| | | color: '#90ec7d' |
| | | }, { |
| | | name: '充电', |
| | | data: [], |
| | | color: '#ff6b6b' |
| | | }] |
| | | } |
| | | let resData = res.data.data; |
| | | for (let key in resData.reCharge) { |
| | | if (typeof resData.reCharge[key] == 'string') { |
| | | optionData.series[0].data.push(Number(resData.reCharge[key].split('%')[0])) |
| | | } else { |
| | | optionData.series[0].data.push(resData.reCharge[key]) |
| | | } |
| | | } |
| | | for (let key in resData.disCharge) { |
| | | optionData.xData.push(key) |
| | | if (typeof resData.disCharge[key] == 'string') { |
| | | optionData.series[1].data.push(Number(resData.disCharge[key].split('%')[0])) |
| | | } else { |
| | | optionData.series[1].data.push(resData.disCharge[key]) |
| | | } |
| | | } |
| | | this.$options.chartData = optionData; |
| | | this.organizeData(optionData) |
| | | } |
| | | }).catch((err) => { |
| | | console.log(err) |
| | | }); |
| | | this.postData() |
| | | setInterval(() => { |
| | | this.postData() |
| | | }, 3000) |
| | | } |
| | | }, |
| | | postData() { |
| | | let userId = localStorage.getItem('userId'); |
| | | let params = { |
| | | userId: userId |
| | | } |
| | | chargeAnalysis(params).then((res) => { |
| | | if (res.data.code == 1) { |
| | | let optionData = { |
| | | xData: [], |
| | | series: [{ |
| | | name: '放电', |
| | | data: [], |
| | | color: '#90ec7d' |
| | | }, { |
| | | name: '充电', |
| | | data: [], |
| | | color: '#ff6b6b' |
| | | }] |
| | | } |
| | | let resData = res.data.data; |
| | | for (let key in resData.reCharge) { |
| | | if (typeof resData.reCharge[key] == 'string') { |
| | | optionData.series[0].data.push(Number(resData.reCharge[key].split('%')[0])) |
| | | } else { |
| | | optionData.series[0].data.push(resData.reCharge[key]) |
| | | } |
| | | } |
| | | for (let key in resData.disCharge) { |
| | | optionData.xData.push(key) |
| | | if (typeof resData.disCharge[key] == 'string') { |
| | | optionData.series[1].data.push(Number(resData.disCharge[key].split('%')[0])) |
| | | } else { |
| | | optionData.series[1].data.push(resData.disCharge[key]) |
| | | } |
| | | } |
| | | this.$options.chartData = optionData; |
| | | this.organizeData(optionData) |
| | | } |
| | | }).catch((err) => { |
| | | console.log(err) |
| | | }); |
| | | }, |
| | | resize() { |
| | | setTimeout(() => { |
| | | this.$options.chart.resize(); |
| | |
| | | chart.resize(); |
| | | }) |
| | | } else { |
| | | let userId = localStorage.getItem('userId'); |
| | | let params = { |
| | | userId: userId |
| | | } |
| | | powerAlarmStatus(params).then((res) => { |
| | | if (res.data.code == 1) { |
| | | let optionData = [{ |
| | | title: '', |
| | | data: 0, |
| | | unit: '', |
| | | color: '#37a9b3', |
| | | }, { |
| | | title: '', |
| | | data: 0, |
| | | unit: '', |
| | | color: '#f3535f' |
| | | }, { |
| | | title: '', |
| | | data: 0, |
| | | unit: '', |
| | | color: '#ff8b00' |
| | | }, { |
| | | title: '', |
| | | data: 0, |
| | | unit: '', |
| | | color: '#757ffb' |
| | | }, { |
| | | title: '', |
| | | data: 0, |
| | | unit: '', |
| | | color: '#4ba0d9' |
| | | }, { |
| | | title: '', |
| | | data: 0, |
| | | unit: '', |
| | | color: '#7fc57c' |
| | | }] |
| | | let index = 0; |
| | | let resData = res.data.data; |
| | | for (let key in resData) { |
| | | optionData[index].title = key; |
| | | if (typeof resData[key] == 'string') { |
| | | optionData[index].data = Number(resData[key].split('%')[0]); |
| | | optionData[index].unit = '%'; |
| | | } else { |
| | | optionData[index].data = resData[key]; |
| | | } |
| | | index++; |
| | | } |
| | | optionData.map((item, i) => { |
| | | let chart = this.$refs[`prossPieChart${i}`]; |
| | | chart.setData(item); |
| | | chart.resize(); |
| | | }) |
| | | } |
| | | }).catch((err) => { |
| | | console.log(err) |
| | | }); |
| | | this.postData() |
| | | setInterval(() => { |
| | | this.postData() |
| | | }, 3000) |
| | | } |
| | | |
| | | }) |
| | | }, |
| | | postData() { |
| | | let userId = localStorage.getItem('userId'); |
| | | let params = { |
| | | userId: userId |
| | | } |
| | | powerAlarmStatus(params).then((res) => { |
| | | if (res.data.code == 1) { |
| | | let optionData = [{ |
| | | title: '', |
| | | data: 0, |
| | | unit: '', |
| | | color: '#37a9b3', |
| | | }, { |
| | | title: '', |
| | | data: 0, |
| | | unit: '', |
| | | color: '#f3535f' |
| | | }, { |
| | | title: '', |
| | | data: 0, |
| | | unit: '', |
| | | color: '#ff8b00' |
| | | }, { |
| | | title: '', |
| | | data: 0, |
| | | unit: '', |
| | | color: '#757ffb' |
| | | }, { |
| | | title: '', |
| | | data: 0, |
| | | unit: '', |
| | | color: '#4ba0d9' |
| | | }, { |
| | | title: '', |
| | | data: 0, |
| | | unit: '', |
| | | color: '#7fc57c' |
| | | }] |
| | | let index = 0; |
| | | let resData = res.data.data; |
| | | for (let key in resData) { |
| | | optionData[index].title = key; |
| | | if (typeof resData[key] == 'string') { |
| | | optionData[index].data = Number(resData[key].split('%')[0]); |
| | | optionData[index].unit = '%'; |
| | | } else { |
| | | optionData[index].data = resData[key]; |
| | | } |
| | | index++; |
| | | } |
| | | optionData.map((item, i) => { |
| | | let chart = this.$refs[`prossPieChart${i}`]; |
| | | chart.setData(item); |
| | | chart.resize(); |
| | | }) |
| | | } |
| | | }).catch((err) => { |
| | | console.log(err) |
| | | }); |
| | | }, |
| | | resize() { |
| | | this.$refs.prossPieChart0.resize(); |
| | | this.$refs.prossPieChart1.resize(); |
| | |
| | | this.$options.chartData = sendData; |
| | | this.organizeData(sendData) |
| | | } else { |
| | | let userId = localStorage.getItem('userId'); |
| | | let params = { |
| | | userId: userId |
| | | } |
| | | batteryGroup(params).then((res) => { |
| | | if (res.data.code == 1) { |
| | | let optionData = { |
| | | xData: [], |
| | | data: [] |
| | | } |
| | | let resData = res.data.data; |
| | | for (let key in resData) { |
| | | optionData.xData.push(key); |
| | | optionData.data.push(resData[key]); |
| | | } |
| | | this.$options.chartData = optionData; |
| | | this.organizeData(optionData) |
| | | } |
| | | }).catch((err) => { |
| | | console.log(err) |
| | | }); |
| | | this.postData() |
| | | setInterval(() => { |
| | | this.postData() |
| | | }, 3000) |
| | | } |
| | | }, |
| | | postData() { |
| | | let userId = localStorage.getItem('userId'); |
| | | let params = { |
| | | userId: userId |
| | | } |
| | | batteryGroup(params).then((res) => { |
| | | if (res.data.code == 1) { |
| | | let optionData = { |
| | | xData: [], |
| | | data: [] |
| | | } |
| | | let resData = res.data.data; |
| | | for (let key in resData) { |
| | | optionData.xData.push(key); |
| | | optionData.data.push(resData[key]); |
| | | } |
| | | this.$options.chartData = optionData; |
| | | this.organizeData(optionData) |
| | | } |
| | | }).catch((err) => { |
| | | console.log(err) |
| | | }); |
| | | }, |
| | | resize() { |
| | | setTimeout(() => { |
| | | this.$options.chart.resize(); |
| | |
| | | }) |
| | | }, |
| | | methods: { |
| | | |
| | | // 加载布局数据 |
| | | loadLayout() { |
| | | let sendData = { |