mirror of
https://gitee.com/js-yhsec/energy_storage.git
synced 2026-05-27 18:59:26 +08:00
解决冲突
This commit is contained in:
@@ -15,6 +15,10 @@
|
||||
export default {
|
||||
name: '',
|
||||
props: {
|
||||
total:{
|
||||
type:Object,
|
||||
default:()=>{}
|
||||
},
|
||||
deviceInfo: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
@@ -25,32 +29,32 @@ export default {
|
||||
curList: [
|
||||
{
|
||||
name: '日光伏设备告警',
|
||||
key: 'key1',
|
||||
key: 'solar_num_err',
|
||||
lineColor: '#22E4FF',
|
||||
value: 0,
|
||||
value: 1111,
|
||||
d: ''
|
||||
},
|
||||
{
|
||||
name: '日储能设备告警',
|
||||
key: 'key2',
|
||||
key: 'storage_num_err',
|
||||
lineColor: '#0E68E4',
|
||||
value: 0,
|
||||
d: ''
|
||||
},
|
||||
{
|
||||
name: '日充电设备告警',
|
||||
key: 'key3',
|
||||
key: 'charge_num_err',
|
||||
lineColor: '#00BAAD',
|
||||
value: 0,
|
||||
d: ''
|
||||
},
|
||||
{
|
||||
name: '日负荷设备告警',
|
||||
key: 'key4',
|
||||
lineColor: '#FF8D1A',
|
||||
value: 0,
|
||||
d: ''
|
||||
}
|
||||
// {
|
||||
// name: '日负荷设备告警',
|
||||
// key: 'key4',
|
||||
// lineColor: '#FF8D1A',
|
||||
// value: 0,
|
||||
// d: ''
|
||||
// }
|
||||
],
|
||||
faultChart: null,
|
||||
lineChartData: {
|
||||
@@ -62,15 +66,32 @@ export default {
|
||||
watch: {
|
||||
deviceInfo: {
|
||||
handler(n) {
|
||||
let that=this
|
||||
this.$nextTick(() => {
|
||||
|
||||
this.drawLineChart()
|
||||
})
|
||||
}
|
||||
// immediate: true
|
||||
},
|
||||
total:{
|
||||
handler(n){
|
||||
if(n){
|
||||
|
||||
let that=this
|
||||
that.curList.forEach((item)=>{
|
||||
item.value=that.total[item.key]
|
||||
})
|
||||
}
|
||||
|
||||
},
|
||||
deep: true, // 深度监听
|
||||
immediate: true,
|
||||
|
||||
}
|
||||
},
|
||||
mounted() {},
|
||||
onBeforeUnmount() {
|
||||
beforeUnmount() {
|
||||
this.faultChart = null
|
||||
window.removeEventListener('resize', this.handleResize)
|
||||
},
|
||||
@@ -81,9 +102,9 @@ export default {
|
||||
},
|
||||
processData(data, keys) {
|
||||
data.sort((a, b) => {
|
||||
return new Date(a.date) - new Date(b.date)
|
||||
return new Date(a.dt) - new Date(b.dt)
|
||||
})
|
||||
const dates = data.map((item) => item.date)
|
||||
const dates = data.map((item) => item.dt)
|
||||
const values = []
|
||||
keys.forEach((item, index) => {
|
||||
values[index] = data.map((dataValue) => dataValue[keys[index]])
|
||||
@@ -160,13 +181,13 @@ export default {
|
||||
lineStyle: { type: 'dashed', color: '#435463' }
|
||||
},
|
||||
axisLabel: {
|
||||
interval: 4,
|
||||
color: '#fff'
|
||||
}
|
||||
},
|
||||
series: this.lineChartData.ydata
|
||||
}
|
||||
option && faultChart.setOption(option)
|
||||
console.log(this.lineChartData, 'this.lineChartData')
|
||||
window.addEventListener('resize', this.handleResize)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
<template>
|
||||
<div class="charge">
|
||||
<div class="text_Cur">
|
||||
<div v-for="item in curList" :key="item.key">
|
||||
<div v-for="item in curList" :key="item.key">
|
||||
<div>{{ item.name }}</div>
|
||||
<span class="mark">{{
|
||||
item.value?item.value: 0
|
||||
}}</span
|
||||
>
|
||||
<span class="d">{{ item.d }}</span>
|
||||
<span class="mark">{{ item.value ? item.value : 0 }}</span>
|
||||
<span class="d">{{ item.d }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div id="charge-chart"></div>
|
||||
@@ -18,6 +15,10 @@
|
||||
export default {
|
||||
name: '',
|
||||
props: {
|
||||
total: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
},
|
||||
deviceInfo: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
@@ -28,96 +29,110 @@ export default {
|
||||
curList: [
|
||||
{
|
||||
name: '日充电电量',
|
||||
key: 'key1',
|
||||
key: 'charge_elect',
|
||||
lineColor: '#00BBA3',
|
||||
colorStart: ' rgba(10, 250, 106, 0.15)',
|
||||
colorEnd: ' rgba(171, 255, 249, 0.3)',
|
||||
value:0,
|
||||
d:'kW·h'
|
||||
value: 0,
|
||||
d: 'kW·h'
|
||||
},
|
||||
{
|
||||
name: '日充电次数',
|
||||
key: 'key2',
|
||||
key: 'charge_num',
|
||||
lineColor: '#3F80F2',
|
||||
colorStart: ' rgba(99, 151, 235, 0.3)',
|
||||
colorEnd: ' rgba(24, 109, 245, 0.3)',
|
||||
value:0,
|
||||
d:''
|
||||
value: 0,
|
||||
d: ''
|
||||
}
|
||||
],
|
||||
curListEcharts: [
|
||||
{
|
||||
name: '日充电电量',
|
||||
key: 'key1',
|
||||
key: 'charge_elect',
|
||||
lineColor: '#00BBA3',
|
||||
colorStart: ' rgba(10, 250, 106, 0.15)',
|
||||
colorEnd: ' rgba(171, 255, 249, 0.3)',
|
||||
value:0,
|
||||
d:'kW·h'
|
||||
value: 0,
|
||||
d: 'kW·h'
|
||||
},
|
||||
{
|
||||
name: '日充电收益',
|
||||
key: 'key2',
|
||||
key: 'income_charge',
|
||||
lineColor: '#3F80F2',
|
||||
colorStart: ' rgba(99, 151, 235, 0.3)',
|
||||
colorEnd: ' rgba(24, 109, 245, 0.3)',
|
||||
value:0,
|
||||
d:''
|
||||
value: 0,
|
||||
d: ''
|
||||
}
|
||||
],
|
||||
chargeChart: null,
|
||||
lineChartData: {
|
||||
chargeChartData: {
|
||||
ydata: [],
|
||||
xdata: []
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
total: {
|
||||
handler(newVal,oldVal) {
|
||||
if (newVal!==oldVal) {
|
||||
this.curList.forEach((item) => {
|
||||
item.value = this.total[item.key]
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
},
|
||||
deviceInfo: {
|
||||
handler(n) {
|
||||
this.$nextTick(() => {
|
||||
this.drawLineChart()
|
||||
})
|
||||
}
|
||||
// immediate: true
|
||||
handler(newVal,oldVal) {
|
||||
if (JSON.stringify(newVal) !== JSON.stringify(oldVal)) {
|
||||
this.$nextTick(() => {
|
||||
this.drawLineChart()
|
||||
})
|
||||
}
|
||||
},
|
||||
deep: true // 确保深度比较
|
||||
}
|
||||
},
|
||||
mounted() {},
|
||||
onBeforeUnmount() {
|
||||
this.chargeChart = null
|
||||
beforeUnmount() {
|
||||
window.removeEventListener('resize', this.handleResize)
|
||||
if(this.chargeChart){
|
||||
this.chargeChart.dispose()
|
||||
this.chargeChart = null
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
handleResize() {
|
||||
this.chargeChart.resize()
|
||||
if(this.chargeChart){
|
||||
this.chargeChart.resize()
|
||||
}
|
||||
},
|
||||
processData(data, keys) {
|
||||
console.log(data, 'dddddddddddddddddddddddddddd')
|
||||
data.sort((a, b) => {
|
||||
return new Date(a.date) - new Date(b.date)
|
||||
return new Date(a.dt) - new Date(b.dt)
|
||||
})
|
||||
const dates = data.map((item) => item.date)
|
||||
const values=[]
|
||||
keys.forEach((item,index)=>{
|
||||
|
||||
values[index]= data.map((dataValue)=>dataValue[keys[index]])
|
||||
const dates = data.map((item) => item.dt)
|
||||
const values = []
|
||||
keys.forEach((item, index) => {
|
||||
values[index] = data.map((dataValue) => dataValue[keys[index]])
|
||||
})
|
||||
|
||||
|
||||
return {
|
||||
dates,
|
||||
values,
|
||||
values
|
||||
}
|
||||
},
|
||||
getChargeData() {
|
||||
const arr=this.curListEcharts
|
||||
const keyList=this.curListEcharts.map((item)=>item.key)
|
||||
const arr = this.curListEcharts
|
||||
const keyList = this.curListEcharts.map((item) => item.key)
|
||||
const result = this.processData(this.deviceInfo, keyList)
|
||||
|
||||
this.lineChartData.xdata = result.dates
|
||||
this.chargeChartData.xdata = result.dates
|
||||
arr.forEach((item, index) => {
|
||||
this.lineChartData.ydata[index] = {
|
||||
this.chargeChartData.ydata[index] = {
|
||||
name: item.name,
|
||||
smooth: true,
|
||||
type: 'line',
|
||||
@@ -139,21 +154,24 @@ export default {
|
||||
y2: 1,
|
||||
colorStops: [
|
||||
{ offset: 0, color: JSON.parse(JSON.stringify(item)).colorStart }, // 顶部颜色
|
||||
{ offset: 1, color: JSON.parse(JSON.stringify(item)).colorEnd }, // 底部颜色
|
||||
{ offset: 1, color: JSON.parse(JSON.stringify(item)).colorEnd } // 底部颜色
|
||||
]
|
||||
}
|
||||
},
|
||||
global: false,
|
||||
showSymbol: false,
|
||||
data:result.values[index]
|
||||
|
||||
data: result.values[index]
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
drawLineChart(activeKey) {
|
||||
this.getChargeData(activeKey)
|
||||
if(this.chargeChart){
|
||||
this.chargeChart.dispose()
|
||||
}
|
||||
const chartDom = document.getElementById('charge-chart')
|
||||
if (!chartDom) return;
|
||||
let chargeChart = this.$echarts.init(chartDom)
|
||||
this.chargeChart = chargeChart
|
||||
const option = {
|
||||
@@ -177,7 +195,7 @@ export default {
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: this.lineChartData.xdata,
|
||||
data: this.chargeChartData.xdata,
|
||||
axisLine: {
|
||||
lineStyle: { type: 'dashed', color: '#435463' }
|
||||
},
|
||||
@@ -191,13 +209,18 @@ export default {
|
||||
lineStyle: { type: 'dashed', color: '#435463' }
|
||||
},
|
||||
axisLabel: {
|
||||
interval: 4,
|
||||
color: '#fff'
|
||||
}
|
||||
},
|
||||
series: this.lineChartData.ydata
|
||||
series: this.chargeChartData.ydata
|
||||
}
|
||||
option && chargeChart.setOption(option)
|
||||
console.log(this.lineChartData, 'this.lineChartData')
|
||||
this.setupResizeListener()
|
||||
|
||||
},
|
||||
setupResizeListener(){
|
||||
window.removeEventListener('resize', this.handleResize);
|
||||
window.addEventListener('resize', this.handleResize)
|
||||
}
|
||||
}
|
||||
@@ -224,12 +247,12 @@ export default {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
& > div:last-child{
|
||||
& > div:last-child {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: end;
|
||||
}
|
||||
}
|
||||
.mark {
|
||||
font-size: 16px;
|
||||
margin-right: 2px;
|
||||
@@ -241,7 +264,7 @@ export default {
|
||||
rgba(61, 254, 250, 0.15) 49.2%,
|
||||
rgba(61, 254, 250, 0) 100%
|
||||
);
|
||||
.d{
|
||||
.d {
|
||||
margin-left: 1px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
@@ -17,6 +17,10 @@
|
||||
export default {
|
||||
name: '',
|
||||
props: {
|
||||
total: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
},
|
||||
deviceInfo: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
@@ -24,55 +28,75 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
uid:'1',
|
||||
curList: [
|
||||
{
|
||||
name: '日充电电量',
|
||||
key: 'key1',
|
||||
key: 'storage_elect_in',
|
||||
lineColor: '#22E4FF',
|
||||
value: 0,
|
||||
d: 'kW·h'
|
||||
},
|
||||
{
|
||||
name: '日放电电量',
|
||||
key: 'key2',
|
||||
key: 'storage_elect_out',
|
||||
lineColor: '#0E68E4',
|
||||
value: 0,
|
||||
d: 'kW·h'
|
||||
}
|
||||
],
|
||||
faultChart: null,
|
||||
lineChartData: {
|
||||
energyChart: null,
|
||||
energyChartData: {
|
||||
ydata: [],
|
||||
xdata: []
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
total: {
|
||||
handler(newVal,oldVal) {
|
||||
if (newVal!==oldVal) {
|
||||
let that = this
|
||||
that.curList.forEach((item) => {
|
||||
item.value = that.total[item.key]
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
},
|
||||
deviceInfo: {
|
||||
handler(n) {
|
||||
this.$nextTick(() => {
|
||||
this.drawLineChart()
|
||||
})
|
||||
}
|
||||
// immediate: true
|
||||
handler(newVal,oldVal) {
|
||||
if (JSON.stringify(newVal) !== JSON.stringify(oldVal)) {
|
||||
this.$nextTick(() => {
|
||||
this.drawLineChart()
|
||||
})
|
||||
}
|
||||
|
||||
},
|
||||
deep: true // 确保深度比较
|
||||
}
|
||||
},
|
||||
mounted() {},
|
||||
onBeforeUnmount() {
|
||||
this.faultChart = null
|
||||
beforeUnmount() {
|
||||
window.removeEventListener('resize', this.handleResize)
|
||||
if(this.energyChart){
|
||||
this.energyChart.dispose()
|
||||
this.energyChart = null
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
methods: {
|
||||
handleResize() {
|
||||
this.faultChart.resize()
|
||||
if(this.energyChart){
|
||||
this.energyChart.resize()
|
||||
}
|
||||
},
|
||||
processData(data, keys) {
|
||||
console.log(data, 'dddddddddddddddddddddddddddd')
|
||||
data.sort((a, b) => {
|
||||
return new Date(a.date) - new Date(b.date)
|
||||
return new Date(a.dt) - new Date(b.dt)
|
||||
})
|
||||
const dates = data.map((item) => item.date)
|
||||
const dates = data.map((item) => item.dt)
|
||||
const values = []
|
||||
keys.forEach((item, index) => {
|
||||
values[index] = data.map((dataValue) => dataValue[keys[index]])
|
||||
@@ -88,9 +112,9 @@ export default {
|
||||
const keyList = this.curList.map((item) => item.key)
|
||||
const result = this.processData(this.deviceInfo, keyList)
|
||||
|
||||
this.lineChartData.xdata = result.dates
|
||||
this.energyChartData.xdata = result.dates
|
||||
arr.forEach((item, index) => {
|
||||
this.lineChartData.ydata[index] = {
|
||||
this.energyChartData.ydata[index] = {
|
||||
name: item.name,
|
||||
smooth: true,
|
||||
type: 'bar',
|
||||
@@ -111,9 +135,13 @@ export default {
|
||||
|
||||
drawLineChart(activeKey) {
|
||||
this.getChargeData(activeKey)
|
||||
if(this.energyChart){
|
||||
this.energyChart.dispose()
|
||||
}
|
||||
const chartDom = document.getElementById('energy-chart')
|
||||
let faultChart = this.$echarts.init(chartDom)
|
||||
this.faultChart = faultChart
|
||||
if (!chartDom) return;
|
||||
let energyChart = this.$echarts.init(chartDom)
|
||||
this.energyChart = energyChart
|
||||
const option = {
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
@@ -130,12 +158,12 @@ export default {
|
||||
grid: {
|
||||
left: '3%',
|
||||
right: '4%',
|
||||
bottom: '5%',
|
||||
bottom: '3%',
|
||||
containLabel: true
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: this.lineChartData.xdata,
|
||||
data: this.energyChartData.xdata,
|
||||
axisLine: {
|
||||
lineStyle: { type: 'dashed', color: '#435463' }
|
||||
},
|
||||
@@ -149,13 +177,17 @@ export default {
|
||||
lineStyle: { type: 'dashed', color: '#435463' }
|
||||
},
|
||||
axisLabel: {
|
||||
interval: 4,
|
||||
color: '#fff'
|
||||
}
|
||||
},
|
||||
series: this.lineChartData.ydata
|
||||
series: this.energyChartData.ydata
|
||||
}
|
||||
option && faultChart.setOption(option)
|
||||
console.log(this.lineChartData, 'this.lineChartData')
|
||||
option && energyChart.setOption(option)
|
||||
this.setupResizeListener()
|
||||
},
|
||||
setupResizeListener(){
|
||||
window.removeEventListener('resize', this.handleResize);
|
||||
window.addEventListener('resize', this.handleResize)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="map">
|
||||
<div>
|
||||
<div class="icon1" @click="showModal()"></div>
|
||||
<div class="icon1" @click="showModal(testVal)"></div>
|
||||
<div class="icon"></div>
|
||||
</div>
|
||||
<div ref="mapContent"></div>
|
||||
@@ -42,16 +42,21 @@ export default {
|
||||
testVal: {
|
||||
name: '场站211',
|
||||
id: '124563'
|
||||
}
|
||||
},
|
||||
changeStationId:''
|
||||
}
|
||||
},
|
||||
mounted() {},
|
||||
methods: {
|
||||
async showModal(currentVal) {
|
||||
this.changeStationId=currentVal.id
|
||||
this.$emit('changeStation',this.changeStationId)
|
||||
console.log(currentVal, 'cccccccccccccccccccccc')
|
||||
this.showCtrModal = true
|
||||
try {
|
||||
const query = {}
|
||||
const query = {
|
||||
// station_id:this.changeStationId
|
||||
}
|
||||
const res = await postReq(query, '')
|
||||
if (res.code == 200) {
|
||||
this.modalInfo = res.data.records
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
<span class="linear-text">{{ item.title }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<component :is="item.componentId" :device-info="deviceInfo[item.infoKey]"></component>
|
||||
<component :is="item.componentId" :props-total="deviceInfo.allTotal" :props-info="deviceInfo[item.infoKey]" ></component>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -20,7 +21,7 @@
|
||||
<span class="linear-text">{{ item.title }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<component :is="item.componentId" :device-info="deviceInfo[item.infoKey]"></component>
|
||||
<component :is="item.componentId" :props-total="deviceInfo.allTotal" :props-info="deviceInfo[item.infoKey]" ></component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -33,16 +34,13 @@ import StatisticalInfo from '@/components/Home/Modal/StatisticalInfo.vue'
|
||||
import Revenue from '@/components/Home/Modal/Revenue.vue'
|
||||
import Utilization from '@/components/Home/Modal/Utilization.vue'
|
||||
import DisCharge from '@/components/Home/Modal/DisCharge.vue'
|
||||
import Operational from '@/components/Home/Operational.vue'
|
||||
import { getReq, postReq } from '@/request/api'
|
||||
|
||||
import Charge from '@/components/Home/Charge.vue'
|
||||
import Alarm from '@/components/Home/Alarm.vue'
|
||||
import Map from '@/components/Home/Map_tianditu.vue'
|
||||
import EnvInfo from './Modal/EnvInfo.vue'
|
||||
|
||||
export default {
|
||||
name: 'Home',
|
||||
components: {Map},
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
deviceInfo: {},
|
||||
@@ -105,222 +103,144 @@ export default {
|
||||
}
|
||||
},
|
||||
async mounted() {
|
||||
this.deviceInfo = {
|
||||
alarm: [
|
||||
{
|
||||
date: '2025-08-30',
|
||||
key1: 10,
|
||||
key2: 0,
|
||||
key3: 15,
|
||||
key4: 5
|
||||
},
|
||||
{
|
||||
date: '2025-08-29',
|
||||
key1: 8,
|
||||
key2: 5,
|
||||
key3: 5,
|
||||
key4: 7
|
||||
},
|
||||
{
|
||||
date: '2025-08-28',
|
||||
key1: 0,
|
||||
key2: 10,
|
||||
key3: 20,
|
||||
key4: 4
|
||||
},
|
||||
{
|
||||
date: '2025-08-27',
|
||||
key1: 10,
|
||||
key2: 0,
|
||||
key3: 15,
|
||||
key4: 5
|
||||
},
|
||||
{
|
||||
date: '2025-08-26',
|
||||
key1: 10,
|
||||
key2: 0,
|
||||
key3: 15,
|
||||
key4: 5
|
||||
},
|
||||
{
|
||||
date: '2025-08-25',
|
||||
key1: 10,
|
||||
key2: 0,
|
||||
key3: 15,
|
||||
key4: 5
|
||||
},
|
||||
{
|
||||
date: '2025-08-24',
|
||||
key1: 10,
|
||||
key2: 0,
|
||||
key3: 15,
|
||||
key4: 5
|
||||
},
|
||||
{
|
||||
date: '2025-08-23',
|
||||
key1: 10,
|
||||
key2: 0,
|
||||
key3: 15,
|
||||
key4: 5
|
||||
},
|
||||
{
|
||||
date: '2025-08-22',
|
||||
key1: 10,
|
||||
key2: 0,
|
||||
key3: 15,
|
||||
key4: 5
|
||||
},
|
||||
{
|
||||
date: '2025-08-21',
|
||||
key1: 10,
|
||||
key2: 0,
|
||||
key3: 15,
|
||||
key4: 5
|
||||
},
|
||||
{
|
||||
date: '2025-08-20',
|
||||
key1: 10,
|
||||
key2: 0,
|
||||
key3: 15,
|
||||
key4: 5
|
||||
},
|
||||
{
|
||||
date: '2025-08-19',
|
||||
key1: 10,
|
||||
key2: 0,
|
||||
key3: 15,
|
||||
key4: 5
|
||||
},
|
||||
{
|
||||
date: '2025-08-18',
|
||||
key1: 10,
|
||||
key2: 0,
|
||||
key3: 15,
|
||||
key4: 5
|
||||
},
|
||||
{
|
||||
date: '2025-08-17',
|
||||
key1: 10,
|
||||
key2: 0,
|
||||
key3: 15,
|
||||
key4: 5
|
||||
}
|
||||
],
|
||||
energy: [
|
||||
{
|
||||
date: '2025-08-30',
|
||||
key1: '2',
|
||||
key2: '2'
|
||||
},
|
||||
{
|
||||
date: '2025-08-29',
|
||||
key1: '2',
|
||||
key2: '2'
|
||||
},
|
||||
{
|
||||
date: '2025-08-28',
|
||||
key1: '2',
|
||||
key2: '2'
|
||||
},
|
||||
{
|
||||
date: '2025-08-27',
|
||||
key1: '2',
|
||||
key2: '2'
|
||||
},
|
||||
{
|
||||
date: '2025-08-26',
|
||||
key1: '2',
|
||||
key2: '2'
|
||||
},
|
||||
{
|
||||
date: '2025-08-25',
|
||||
key1: '2',
|
||||
key2: '2'
|
||||
},
|
||||
{
|
||||
date: '2025-08-24',
|
||||
key1: '2',
|
||||
key2: '2'
|
||||
}
|
||||
],
|
||||
charge: [
|
||||
{
|
||||
date: '2025-08-30',
|
||||
key1: '2',
|
||||
key2: '2'
|
||||
},
|
||||
{
|
||||
date: '2025-08-29',
|
||||
key1: '2',
|
||||
key2: '2'
|
||||
},
|
||||
{
|
||||
date: '2025-08-28',
|
||||
key1: '2',
|
||||
key2: '2'
|
||||
},
|
||||
{
|
||||
date: '2025-08-27',
|
||||
key1: '2',
|
||||
key2: '2'
|
||||
},
|
||||
{
|
||||
date: '2025-08-26',
|
||||
key1: '2',
|
||||
key2: '2'
|
||||
},
|
||||
{
|
||||
date: '2025-08-25',
|
||||
key1: '2',
|
||||
key2: '2'
|
||||
},
|
||||
{
|
||||
date: '2025-08-24',
|
||||
key1: '2',
|
||||
key2: '2'
|
||||
}
|
||||
],
|
||||
pv: [
|
||||
{
|
||||
date: '2025-08-30',
|
||||
key1: '2',
|
||||
key2: '2'
|
||||
},
|
||||
{
|
||||
date: '2025-08-29',
|
||||
key1: '2',
|
||||
key2: '2'
|
||||
},
|
||||
{
|
||||
date: '2025-08-28',
|
||||
key1: '2',
|
||||
key2: '2'
|
||||
},
|
||||
{
|
||||
date: '2025-08-27',
|
||||
key1: '2',
|
||||
key2: '2'
|
||||
},
|
||||
{
|
||||
date: '2025-08-26',
|
||||
key1: '2',
|
||||
key2: '2'
|
||||
},
|
||||
{
|
||||
date: '2025-08-25',
|
||||
key1: '2',
|
||||
key2: '2'
|
||||
},
|
||||
{
|
||||
date: '2025-08-24',
|
||||
key1: '2',
|
||||
key2: '2'
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
await Promise.all([
|
||||
this.getTotalList(),
|
||||
|
||||
methods: {}
|
||||
( this.deviceInfo = {
|
||||
alarm: [
|
||||
{
|
||||
dt: '2025-08-30',
|
||||
key1: 10,
|
||||
key2: 0,
|
||||
key3: 15,
|
||||
key4: 5
|
||||
},
|
||||
{
|
||||
dt: '2025-08-29',
|
||||
key1: 8,
|
||||
key2: 5,
|
||||
key3: 5,
|
||||
key4: 7
|
||||
},
|
||||
{
|
||||
dt: '2025-08-28',
|
||||
key1: 0,
|
||||
key2: 10,
|
||||
key3: 20,
|
||||
key4: 4
|
||||
},
|
||||
{
|
||||
dt: '2025-08-27',
|
||||
key1: 10,
|
||||
key2: 0,
|
||||
key3: 15,
|
||||
key4: 5
|
||||
},
|
||||
{
|
||||
dt: '2025-08-26',
|
||||
key1: 10,
|
||||
key2: 0,
|
||||
key3: 15,
|
||||
key4: 5
|
||||
},
|
||||
{
|
||||
dt: '2025-08-25',
|
||||
key1: 10,
|
||||
key2: 0,
|
||||
key3: 15,
|
||||
key4: 5
|
||||
},
|
||||
{
|
||||
dt: '2025-08-24',
|
||||
key1: 10,
|
||||
key2: 0,
|
||||
key3: 15,
|
||||
key4: 5
|
||||
},
|
||||
{
|
||||
dt: '2025-08-23',
|
||||
key1: 10,
|
||||
key2: 0,
|
||||
key3: 15,
|
||||
key4: 5
|
||||
},
|
||||
{
|
||||
dt: '2025-08-22',
|
||||
key1: 10,
|
||||
key2: 0,
|
||||
key3: 15,
|
||||
key4: 5
|
||||
},
|
||||
{
|
||||
dt: '2025-08-21',
|
||||
key1: 10,
|
||||
key2: 0,
|
||||
key3: 15,
|
||||
key4: 5
|
||||
},
|
||||
{
|
||||
dt: '2025-08-20',
|
||||
key1: 10,
|
||||
key2: 0,
|
||||
key3: 15,
|
||||
key4: 5
|
||||
},
|
||||
{
|
||||
dt: '2025-08-19',
|
||||
key1: 10,
|
||||
key2: 0,
|
||||
key3: 15,
|
||||
key4: 5
|
||||
},
|
||||
{
|
||||
dt: '2025-08-18',
|
||||
key1: 10,
|
||||
key2: 0,
|
||||
key3: 15,
|
||||
key4: 5
|
||||
},
|
||||
{
|
||||
dt: '2025-08-17',
|
||||
key1: 10,
|
||||
key2: 0,
|
||||
key3: 15,
|
||||
key4: 5
|
||||
}
|
||||
],
|
||||
|
||||
}),
|
||||
|
||||
|
||||
])
|
||||
},
|
||||
|
||||
|
||||
methods: {
|
||||
async getTotalList(){
|
||||
try {
|
||||
// token: 用户TOKEN
|
||||
const res = await getReq({}, '')
|
||||
if (res.code === 200) {
|
||||
this.deviceInfo.allTotal = res.data
|
||||
} else {
|
||||
throw res
|
||||
}
|
||||
} catch (error) {
|
||||
this.deviceInfo.allTotal = {
|
||||
tianshu:11,
|
||||
shouyi:12,
|
||||
shuliang:10,
|
||||
fadianliang:15,
|
||||
key2:11,
|
||||
key1:12,
|
||||
key3:10,
|
||||
key4:15,
|
||||
rongliang:15,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
export default {
|
||||
name: '',
|
||||
props: {
|
||||
deviceInfo: {
|
||||
propsInfo: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
}
|
||||
@@ -20,71 +20,75 @@ export default {
|
||||
name: '日充电电量',
|
||||
key: 'key1',
|
||||
lineColor: '#9BD801',
|
||||
value:0,
|
||||
d:'kW·h'
|
||||
value: 0,
|
||||
d: 'kW·h'
|
||||
},
|
||||
{
|
||||
name: '日放电电量',
|
||||
key: 'key2',
|
||||
lineColor: '#3DFEFA',
|
||||
value:0,
|
||||
d:'kW·h'
|
||||
},
|
||||
value: 0,
|
||||
d: 'kW·h'
|
||||
}
|
||||
],
|
||||
|
||||
|
||||
disChargeChart: null,
|
||||
lineChartData: {
|
||||
disChargeChartData: {
|
||||
ydata: [],
|
||||
xdata: []
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
deviceInfo: {
|
||||
handler(n) {
|
||||
this.$nextTick(() => {
|
||||
this.drawLineChart()
|
||||
})
|
||||
}
|
||||
// immediate: true
|
||||
propsInfo: {
|
||||
handler(newVal, oldVal) {
|
||||
if (JSON.stringify(newVal) !== JSON.stringify(oldVal)) {
|
||||
this.$nextTick(() => {
|
||||
this.drawLineChart()
|
||||
})
|
||||
}
|
||||
},
|
||||
deep: true // 确保深度比较
|
||||
}
|
||||
},
|
||||
mounted() {},
|
||||
onBeforeUnmount() {
|
||||
this.disChargeChart = null
|
||||
beforeUnmount() {
|
||||
window.removeEventListener('resize', this.handleResize)
|
||||
if (this.disChargeChart) {
|
||||
this.disChargeChart.dispose()
|
||||
this.disChargeChart = null
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
handleResize() {
|
||||
this.disChargeChart.resize()
|
||||
if (this.disChargeChart) {
|
||||
this.disChargeChart.resize()
|
||||
}
|
||||
},
|
||||
processData(data, keys) {
|
||||
console.log(data, 'dddddddddddddddddddddddddddd')
|
||||
data.sort((a, b) => {
|
||||
return new Date(a.date) - new Date(b.date)
|
||||
})
|
||||
const dates = data.map((item) => item.date)
|
||||
const values=[]
|
||||
keys.forEach((item,index)=>{
|
||||
|
||||
values[index]= data.map((dataValue)=>dataValue[keys[index]])
|
||||
const dates = data.map((item) => item.dt)
|
||||
const values = []
|
||||
keys.forEach((item, index) => {
|
||||
values[index] = data.map((dataValue) => dataValue[keys[index]])
|
||||
})
|
||||
|
||||
|
||||
return {
|
||||
dates,
|
||||
values,
|
||||
values
|
||||
}
|
||||
},
|
||||
getDisChargeData() {
|
||||
const arr=this.curList
|
||||
const keyList=this.curList.map((item)=>item.key)
|
||||
const result = this.processData(this.deviceInfo, keyList)
|
||||
const arr = this.curList
|
||||
const keyList = this.curList.map((item) => item.key)
|
||||
const result = this.processData(this.propsInfo, keyList)
|
||||
|
||||
this.lineChartData.xdata = result.dates
|
||||
this.disChargeChartData.xdata = result.dates
|
||||
arr.forEach((item, index) => {
|
||||
this.lineChartData.ydata[index] = {
|
||||
this.disChargeChartData.ydata[index] = {
|
||||
name: item.name,
|
||||
smooth: false,
|
||||
type: 'line',
|
||||
@@ -96,18 +100,21 @@ export default {
|
||||
emphasis: {
|
||||
focus: 'series'
|
||||
},
|
||||
|
||||
|
||||
global: false,
|
||||
showSymbol: false,
|
||||
data:result.values[index]
|
||||
|
||||
data: result.values[index]
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
drawLineChart(activeKey) {
|
||||
this.getDisChargeData(activeKey)
|
||||
if (this.disChargeChart) {
|
||||
this.disChargeChart.dispose()
|
||||
}
|
||||
const chartDom = document.getElementById('disCharge-chart')
|
||||
if (!chartDom) return
|
||||
let disChargeChart = this.$echarts.init(chartDom)
|
||||
this.disChargeChart = disChargeChart
|
||||
const option = {
|
||||
@@ -131,7 +138,7 @@ export default {
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: this.lineChartData.xdata,
|
||||
data: this.disChargeChartData.xdata,
|
||||
axisLine: {
|
||||
lineStyle: { type: 'dashed', color: '#435463' }
|
||||
},
|
||||
@@ -148,10 +155,13 @@ export default {
|
||||
color: '#fff'
|
||||
}
|
||||
},
|
||||
series: this.lineChartData.ydata
|
||||
series: this.disChargeChartData.ydata
|
||||
}
|
||||
option && disChargeChart.setOption(option)
|
||||
console.log(this.lineChartData, 'this.lineChartData')
|
||||
this.setupResizeListener()
|
||||
},
|
||||
setupResizeListener() {
|
||||
window.removeEventListener('resize', this.handleResize)
|
||||
window.addEventListener('resize', this.handleResize)
|
||||
}
|
||||
}
|
||||
@@ -160,8 +170,7 @@ export default {
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.disCharge {
|
||||
height:calc(100% - 45px);
|
||||
|
||||
height: calc(100% - 45px);
|
||||
|
||||
#disCharge-chart {
|
||||
height: 100%;
|
||||
@@ -179,12 +188,12 @@ export default {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
& > div:last-child{
|
||||
& > div:last-child {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: end;
|
||||
}
|
||||
}
|
||||
.mark {
|
||||
font-size: 16px;
|
||||
margin-right: 2px;
|
||||
@@ -196,7 +205,7 @@ export default {
|
||||
rgba(61, 254, 250, 0.15) 49.2%,
|
||||
rgba(61, 254, 250, 0) 100%
|
||||
);
|
||||
.d{
|
||||
.d {
|
||||
margin-left: 1px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
@@ -2,72 +2,71 @@
|
||||
<div class="onLine">
|
||||
<div class="content">
|
||||
<div v-for="item in list" :key="item.key" :class="`item ${item.class}`">
|
||||
<a-image :preview="false" :src="item.iconPath" :width="25" class="left"> </a-image>
|
||||
<i
|
||||
:class="`iconfont icon-${item.icon}`"
|
||||
:style="`font-size:25px; cursor: pointer; color: ${item.color};`"
|
||||
/>
|
||||
<div class="right">
|
||||
<span>{{ item.label }}</span>
|
||||
<span>{{ item.value }} {{ item.d }}</span
|
||||
>
|
||||
</div>
|
||||
|
||||
|
||||
<span>{{ item.label }}</span>
|
||||
<span>{{ item.value }} {{ item.d }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { legacyLogicalPropertiesTransformer } from 'ant-design-vue'
|
||||
|
||||
export default {
|
||||
name: '',
|
||||
props: {
|
||||
propsInfo: {
|
||||
propsTotal: {
|
||||
type: Object,
|
||||
default: ()=>({
|
||||
name: '场站111',
|
||||
statusName:'充电'
|
||||
})
|
||||
default: () => {}
|
||||
},
|
||||
propsInfo: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
list: [
|
||||
{
|
||||
key: 'tianshu',
|
||||
value: 26,
|
||||
d: 'Lux',
|
||||
label: '光照',
|
||||
key: 'key1',
|
||||
value: '制冷',
|
||||
d: '',
|
||||
label: '冷机',
|
||||
class: 'item-1',
|
||||
iconPath: require('@/assets/home/guangzhao.png')
|
||||
icon: 'lengji',
|
||||
color: '#F69B52'
|
||||
},
|
||||
{
|
||||
key: 'shouyi',
|
||||
value: 25,
|
||||
d: 'm/s',
|
||||
label: '风速',
|
||||
key: 'key2',
|
||||
value: '开机',
|
||||
d: '',
|
||||
label: '空调',
|
||||
class: 'item-2',
|
||||
iconPath: require('@/assets/home/fengsu.png')
|
||||
icon: 'kongdiaogongcheng',
|
||||
color: '#9BD801'
|
||||
},
|
||||
{
|
||||
key: 'shuliang',
|
||||
key: 'key3',
|
||||
value: 24,
|
||||
d: '℃',
|
||||
label: '环境温度',
|
||||
class: 'item-3',
|
||||
iconPath: require('@/assets/home/hj-wendu.png')
|
||||
icon: 'wenduji',
|
||||
color: '#3DFEFA'
|
||||
},
|
||||
{
|
||||
key: 'shuliang',
|
||||
key: 'key4',
|
||||
value: 26,
|
||||
d: '%',
|
||||
label: '环境湿度',
|
||||
class: 'item-4',
|
||||
iconPath: require('@/assets/home/hj-shidu.png')
|
||||
},
|
||||
|
||||
icon: 'shidu',
|
||||
color: '#D83D6C'
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
@@ -79,7 +78,17 @@ export default {
|
||||
return this.list.filter((_, index) => index % 2 !== 0).slice(0, 3) // 右列取前3个奇数索引
|
||||
}
|
||||
},
|
||||
watch: {},
|
||||
watch: {
|
||||
propsTotal: {
|
||||
handler(newVal, oldVal) {
|
||||
if (newVal !== oldVal) {
|
||||
this.list.forEach((item) => {
|
||||
item.value = this.propsTotal[item.key]
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {},
|
||||
methods: {}
|
||||
}
|
||||
@@ -91,13 +100,11 @@ export default {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width:95%;
|
||||
width: 95%;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.content{
|
||||
.content {
|
||||
flex-wrap: wrap;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
@@ -105,35 +112,30 @@ export default {
|
||||
justify-content: space-around;
|
||||
height: 100%;
|
||||
|
||||
.item{
|
||||
height:50%;
|
||||
width: 25%;
|
||||
// height: 47px;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
// justify-content: center;
|
||||
// text-align: center;
|
||||
.item {
|
||||
height: 50%;
|
||||
width: 25%;
|
||||
// height: 47px;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
// justify-content: center;
|
||||
// text-align: center;
|
||||
|
||||
& > span:nth-child(1) {
|
||||
font-size: 12px;
|
||||
margin-bottom: 10px;
|
||||
& > span:nth-child(1) {
|
||||
font-size: 12px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.d {
|
||||
margin-left: 1px;
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
.d {
|
||||
margin-left: 1px;
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.right {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-left: 20px;
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-left: 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
@@ -4,33 +4,27 @@
|
||||
<div v-for="item in list" :key="item.key" :class="`item ${item.class}`">
|
||||
<a-image :preview="false" :src="item.iconPath" :width="50" class="left"> </a-image>
|
||||
<div class="right">
|
||||
<span>{{ item.label }}</span>
|
||||
<span>{{ item.value }} {{ item.d }}</span
|
||||
>
|
||||
</div>
|
||||
|
||||
|
||||
<span>{{ item.label }}</span>
|
||||
<span>{{ item.value }} {{ item.d }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { legacyLogicalPropertiesTransformer } from 'ant-design-vue'
|
||||
|
||||
export default {
|
||||
name: '',
|
||||
props: {
|
||||
propsInfo: {
|
||||
propsTotal: {
|
||||
type: Object,
|
||||
default: ()=>({
|
||||
name: '场站111',
|
||||
statusName:'充电'
|
||||
})
|
||||
}
|
||||
default: () => {}
|
||||
},
|
||||
propsInfo: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -94,7 +88,18 @@ export default {
|
||||
return this.list.filter((_, index) => index % 2 !== 0).slice(0, 3) // 右列取前3个奇数索引
|
||||
}
|
||||
},
|
||||
watch: {},
|
||||
watch: {
|
||||
propsTotal: {
|
||||
handler(newVal, oldVal) {
|
||||
if (newVal !== oldVal) {
|
||||
this.list.forEach((item) => {
|
||||
item.value = this.propsTotal[item.key]
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
},
|
||||
mounted() {},
|
||||
methods: {}
|
||||
}
|
||||
@@ -106,14 +111,11 @@ export default {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width:95%;
|
||||
width: 95%;
|
||||
margin: auto;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
.content{
|
||||
.content {
|
||||
flex-wrap: wrap;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
@@ -121,35 +123,30 @@ export default {
|
||||
justify-content: space-around;
|
||||
height: 100%;
|
||||
|
||||
.item{
|
||||
height:50%;
|
||||
width: 30%;
|
||||
// height: 47px;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
// justify-content: center;
|
||||
// text-align: center;
|
||||
.item {
|
||||
height: 50%;
|
||||
width: 30%;
|
||||
// height: 47px;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
// justify-content: center;
|
||||
// text-align: center;
|
||||
|
||||
& > span:nth-child(1) {
|
||||
font-size: 12px;
|
||||
margin-bottom: 10px;
|
||||
& > span:nth-child(1) {
|
||||
font-size: 12px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.d {
|
||||
margin-left: 1px;
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
.d {
|
||||
margin-left: 1px;
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.right {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-left: 20px;
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-left: 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
@@ -3,21 +3,21 @@
|
||||
<div class="content-left">
|
||||
<div v-for="item in leftList" :key="item.key" :class="`item ${item.class}`">
|
||||
<div>
|
||||
<span>{{ item.value }}</span
|
||||
<span>{{ item.value ? item.value : 0 }}</span
|
||||
><span class="d">{{ item.d }}</span>
|
||||
</div>
|
||||
<span>{{ item.label }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div style="text-align: center;font-weight: 500;">
|
||||
<div style="text-align: center; font-weight: 500">
|
||||
<div class="online-icon"></div>
|
||||
<span>{{ propsInfo.statusName }}</span>
|
||||
<span>{{ curStatus }}</span>
|
||||
</div>
|
||||
|
||||
<div class="content-right">
|
||||
<div v-for="item in rightList" :key="item.key" :class="`item ${item.class}`">
|
||||
<div>
|
||||
<span>{{ item.value }}</span
|
||||
<span>{{ item.value ? item.value : 0 }}</span
|
||||
><span class="d">{{ item.d }}</span>
|
||||
</div>
|
||||
<span>{{ item.label }}</span>
|
||||
@@ -27,21 +27,21 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { legacyLogicalPropertiesTransformer } from 'ant-design-vue'
|
||||
|
||||
export default {
|
||||
name: '',
|
||||
props: {
|
||||
propsInfo: {
|
||||
propsTotal: {
|
||||
type: Object,
|
||||
default: () => ({
|
||||
name: '场站111',
|
||||
statusName: '充电'
|
||||
})
|
||||
default: () => {}
|
||||
},
|
||||
propsInfo: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
curStatus: '充电',
|
||||
list: [
|
||||
{
|
||||
key: 'tianshu',
|
||||
@@ -96,7 +96,17 @@ export default {
|
||||
return this.list.filter((_, index) => index % 2 !== 0).slice(0, 3) // 右列取前3个奇数索引
|
||||
}
|
||||
},
|
||||
watch: {},
|
||||
watch: {
|
||||
propsTotal: {
|
||||
handler(newVal, oldVal) {
|
||||
if (newVal !== oldVal) {
|
||||
this.list.forEach((item) => {
|
||||
item.value = this.propsTotal[item.key]
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {},
|
||||
methods: {}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
export default {
|
||||
name: '',
|
||||
props: {
|
||||
deviceInfo: {
|
||||
propsInfo: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
}
|
||||
@@ -29,7 +29,7 @@ export default {
|
||||
|
||||
],
|
||||
revenueChart: null,
|
||||
lineChartData: {
|
||||
RevenueChartData: {
|
||||
ydata: [],
|
||||
xdata: []
|
||||
},
|
||||
@@ -37,31 +37,38 @@ export default {
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
deviceInfo: {
|
||||
handler(n) {
|
||||
this.$nextTick(() => {
|
||||
this.drawLineChart()
|
||||
})
|
||||
}
|
||||
// immediate: true
|
||||
propsInfo: {
|
||||
handler(newVal, oldVal) {
|
||||
if (JSON.stringify(newVal) !== JSON.stringify(oldVal)) {
|
||||
this.$nextTick(() => {
|
||||
this.drawLineChart()
|
||||
})
|
||||
}
|
||||
},
|
||||
deep: true // 确保深度比较
|
||||
}
|
||||
},
|
||||
mounted() {},
|
||||
onBeforeUnmount() {
|
||||
this.revenueChart = null
|
||||
beforeUnmount() {
|
||||
window.removeEventListener('resize', this.handleResize)
|
||||
if (this.revenueChart) {
|
||||
this.revenueChart.dispose()
|
||||
this.revenueChart = null
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
handleResize() {
|
||||
this.revenueChart.resize()
|
||||
if (this.revenueChart) {
|
||||
|
||||
this.revenueChart.resize()
|
||||
}
|
||||
},
|
||||
processData(data, keys) {
|
||||
console.log(data, 'dddddddddddddddddddddddddddd')
|
||||
data.sort((a, b) => {
|
||||
return new Date(a.date) - new Date(b.date)
|
||||
})
|
||||
const dates = data.map((item) => item.date)
|
||||
const dates = data.map((item) => item.dt)
|
||||
const values=[]
|
||||
keys.forEach((item,index)=>{
|
||||
|
||||
@@ -76,11 +83,11 @@ export default {
|
||||
getRevenueData() {
|
||||
const arr=this.curList
|
||||
const keyList=this.curList.map((item)=>item.key)
|
||||
const result = this.processData(this.deviceInfo, keyList)
|
||||
const result = this.processData(this.propsInfo, keyList)
|
||||
|
||||
this.lineChartData.xdata = result.dates
|
||||
this.RevenueChartData.xdata = result.dates
|
||||
arr.forEach((item, index) => {
|
||||
this.lineChartData.ydata[index] = {
|
||||
this.RevenueChartData.ydata[index] = {
|
||||
name: item.name,
|
||||
smooth: true,
|
||||
type: 'line',
|
||||
@@ -116,7 +123,11 @@ export default {
|
||||
|
||||
drawLineChart(activeKey) {
|
||||
this.getRevenueData(activeKey)
|
||||
if (this.revenueChart) {
|
||||
this.revenueChart.dispose()
|
||||
}
|
||||
const chartDom = document.getElementById('revenue-chart')
|
||||
if (!chartDom) return
|
||||
let revenueChart = this.$echarts.init(chartDom)
|
||||
this.revenueChart = revenueChart
|
||||
const option = {
|
||||
@@ -140,7 +151,7 @@ export default {
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: this.lineChartData.xdata,
|
||||
data: this.RevenueChartData.xdata,
|
||||
axisLine: {
|
||||
lineStyle: { type: 'dashed', color: '#435463' }
|
||||
},
|
||||
@@ -157,10 +168,14 @@ export default {
|
||||
color: '#fff'
|
||||
}
|
||||
},
|
||||
series: this.lineChartData.ydata
|
||||
series: this.RevenueChartData.ydata
|
||||
}
|
||||
option && revenueChart.setOption(option)
|
||||
console.log(this.lineChartData, 'this.lineChartData')
|
||||
this.setupResizeListener()
|
||||
|
||||
},
|
||||
setupResizeListener() {
|
||||
window.removeEventListener('resize', this.handleResize)
|
||||
window.addEventListener('resize', this.handleResize)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<div class="onLine">
|
||||
<div class="content">
|
||||
<div v-for="item in list" :key="item.key" :class="`item ${item.class}`">
|
||||
<span>{{ item.value }} {{ item.d }}</span>
|
||||
<span>{{ item.value ? item.value : 0 }} {{ item.d }}</span>
|
||||
<span>{{ item.label }}</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -10,11 +10,13 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { legacyLogicalPropertiesTransformer } from 'ant-design-vue'
|
||||
|
||||
export default {
|
||||
name: '',
|
||||
props: {
|
||||
propsTotal: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
},
|
||||
propsInfo: {
|
||||
type: Object,
|
||||
default: () => ({
|
||||
@@ -77,7 +79,17 @@ export default {
|
||||
return this.list.filter((_, index) => index % 2 !== 0).slice(0, 3) // 右列取前3个奇数索引
|
||||
}
|
||||
},
|
||||
watch: {},
|
||||
watch: {
|
||||
propsTotal: {
|
||||
handler(newVal, oldVal) {
|
||||
if (newVal !== oldVal) {
|
||||
this.list.forEach((item) => {
|
||||
item.value = this.propsTotal[item.key]
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {},
|
||||
methods: {}
|
||||
}
|
||||
@@ -89,7 +101,7 @@ export default {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width:95%;
|
||||
width: 95%;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
export default {
|
||||
name: '',
|
||||
props: {
|
||||
deviceInfo: {
|
||||
propsInfo: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
}
|
||||
@@ -20,65 +20,69 @@ export default {
|
||||
name: '日设备利用率',
|
||||
key: 'key1',
|
||||
lineColor: '#F69B52',
|
||||
|
||||
value:0,
|
||||
d:'kW·h'
|
||||
},
|
||||
|
||||
value: 0,
|
||||
d: 'kW·h'
|
||||
}
|
||||
],
|
||||
|
||||
|
||||
utilizationChart: null,
|
||||
lineChartData: {
|
||||
utilizationChartData: {
|
||||
ydata: [],
|
||||
xdata: []
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
deviceInfo: {
|
||||
handler(n) {
|
||||
this.$nextTick(() => {
|
||||
this.drawLineChart()
|
||||
})
|
||||
}
|
||||
// immediate: true
|
||||
propsInfo: {
|
||||
handler(newVal, oldVal) {
|
||||
if (JSON.stringify(newVal) !== JSON.stringify(oldVal)) {
|
||||
this.$nextTick(() => {
|
||||
this.drawLineChart()
|
||||
})
|
||||
}
|
||||
},
|
||||
deep: true // 确保深度比较
|
||||
}
|
||||
},
|
||||
mounted() {},
|
||||
onBeforeUnmount() {
|
||||
this.utilizationChart = null
|
||||
beforeUnmount() {
|
||||
window.removeEventListener('resize', this.handleResize)
|
||||
if (this.utilizationChart) {
|
||||
this.utilizationChart.dispose()
|
||||
this.utilizationChart = null
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
handleResize() {
|
||||
this.utilizationChart.resize()
|
||||
if (this.utilizationChart) {
|
||||
this.utilizationChart.resize()
|
||||
}
|
||||
},
|
||||
processData(data, keys) {
|
||||
console.log(data, 'dddddddddddddddddddddddddddd')
|
||||
data.sort((a, b) => {
|
||||
return new Date(a.date) - new Date(b.date)
|
||||
})
|
||||
const dates = data.map((item) => item.date)
|
||||
const values=[]
|
||||
keys.forEach((item,index)=>{
|
||||
|
||||
values[index]= data.map((dataValue)=>dataValue[keys[index]])
|
||||
const dates = data.map((item) => item.dt)
|
||||
const values = []
|
||||
keys.forEach((item, index) => {
|
||||
values[index] = data.map((dataValue) => dataValue[keys[index]])
|
||||
})
|
||||
|
||||
|
||||
return {
|
||||
dates,
|
||||
values,
|
||||
values
|
||||
}
|
||||
},
|
||||
getUtilizationData() {
|
||||
const arr=this.curList
|
||||
const keyList=this.curList.map((item)=>item.key)
|
||||
const result = this.processData(this.deviceInfo, keyList)
|
||||
const arr = this.curList
|
||||
const keyList = this.curList.map((item) => item.key)
|
||||
const result = this.processData(this.propsInfo, keyList)
|
||||
|
||||
this.lineChartData.xdata = result.dates
|
||||
this.utilizationChartData.xdata = result.dates
|
||||
arr.forEach((item, index) => {
|
||||
this.lineChartData.ydata[index] = {
|
||||
this.utilizationChartData.ydata[index] = {
|
||||
name: item.name,
|
||||
smooth: false,
|
||||
type: 'line',
|
||||
@@ -90,18 +94,21 @@ export default {
|
||||
emphasis: {
|
||||
focus: 'series'
|
||||
},
|
||||
|
||||
|
||||
global: false,
|
||||
showSymbol: false,
|
||||
data:result.values[index]
|
||||
|
||||
data: result.values[index]
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
drawLineChart(activeKey) {
|
||||
this.getUtilizationData(activeKey)
|
||||
if (this.utilizationChart) {
|
||||
this.utilizationChart.dispose()
|
||||
}
|
||||
const chartDom = document.getElementById('utilization-chart')
|
||||
if (!chartDom) return
|
||||
let utilizationChart = this.$echarts.init(chartDom)
|
||||
this.utilizationChart = utilizationChart
|
||||
const option = {
|
||||
@@ -125,7 +132,7 @@ export default {
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: this.lineChartData.xdata,
|
||||
data: this.utilizationChartData.xdata,
|
||||
axisLine: {
|
||||
lineStyle: { type: 'dashed', color: '#435463' }
|
||||
},
|
||||
@@ -142,10 +149,13 @@ export default {
|
||||
color: '#fff'
|
||||
}
|
||||
},
|
||||
series: this.lineChartData.ydata
|
||||
series: this.utilizationChartData.ydata
|
||||
}
|
||||
option && utilizationChart.setOption(option)
|
||||
console.log(this.lineChartData, 'this.lineChartData')
|
||||
this.setupResizeListener()
|
||||
},
|
||||
setupResizeListener() {
|
||||
window.removeEventListener('resize', this.handleResize)
|
||||
window.addEventListener('resize', this.handleResize)
|
||||
}
|
||||
}
|
||||
@@ -154,10 +164,10 @@ export default {
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.utilization {
|
||||
height:calc(100% - 45px);
|
||||
height: calc(100% - 45px);
|
||||
|
||||
#utilization-chart {
|
||||
height:100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,12 +182,12 @@ export default {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
& > div:last-child{
|
||||
& > div:last-child {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: end;
|
||||
}
|
||||
}
|
||||
.mark {
|
||||
font-size: 16px;
|
||||
margin-right: 2px;
|
||||
@@ -189,7 +199,7 @@ export default {
|
||||
rgba(61, 254, 250, 0.15) 49.2%,
|
||||
rgba(61, 254, 250, 0) 100%
|
||||
);
|
||||
.d{
|
||||
.d {
|
||||
margin-left: 1px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
<div class="Operational">
|
||||
<div class="oper-bg">{{ currentHoverNumber }}%</div>
|
||||
<div class="oper-right">
|
||||
<div v-for="item in list" :key="item.key" class="oper-item" @mouseover="changeNumber(item)">
|
||||
<div v-for="item in curList" :key="item.key" class="oper-item" @mouseover="changeNumber(item)">
|
||||
<div style="display: flex">
|
||||
<div :style="`background:${item.lineColor}`" class="item-icon"></div>
|
||||
<span class="item-name">{{ item.name }}</span>
|
||||
</div>
|
||||
<span class="item-value">{{ item.value }}</span>
|
||||
<span class="item-value">{{ item.value?item.value:0 }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -17,6 +17,10 @@
|
||||
export default {
|
||||
name: '',
|
||||
props: {
|
||||
total:{
|
||||
type:Object,
|
||||
default:()=>{}
|
||||
},
|
||||
deviceInfo: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
@@ -25,17 +29,17 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
currentHoverNumber: 58,
|
||||
list: [
|
||||
curList: [
|
||||
{
|
||||
name: '收益',
|
||||
key: 'connector_online',
|
||||
key: 'incomeTotal',
|
||||
percentKey: 'connector_online_percent',
|
||||
lineColor: 'linear-gradient(90deg, rgba(13, 87, 144, 1) 0%, rgba(21, 153, 253, 1) 100%);',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name: '利用率',
|
||||
key: 'connector_off',
|
||||
key: 'usage_rate',
|
||||
percentKey: 'connector_off_percent',
|
||||
lineColor:
|
||||
'linear-gradient(90deg, rgba(53, 120, 124, 1) 0%, rgba(102, 225, 223, 1) 100%);',
|
||||
@@ -44,7 +48,21 @@ export default {
|
||||
]
|
||||
}
|
||||
},
|
||||
watch: {},
|
||||
watch: {
|
||||
total:{
|
||||
handler(newVal,oldVal) {
|
||||
if (newVal!==oldVal) {
|
||||
let that=this
|
||||
that.curList.forEach((item)=>{
|
||||
item.value=that.total[item.key]
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
mounted() {},
|
||||
|
||||
methods: {
|
||||
|
||||
@@ -17,6 +17,10 @@
|
||||
export default {
|
||||
name: '',
|
||||
props: {
|
||||
total: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
},
|
||||
deviceInfo: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
@@ -27,21 +31,21 @@ export default {
|
||||
curList: [
|
||||
{
|
||||
name: '日发电量',
|
||||
key: 'key1',
|
||||
key: 'solar_elect_gen',
|
||||
lineColor: '#22E4FF',
|
||||
value: 0,
|
||||
d: 'kW·h'
|
||||
},
|
||||
{
|
||||
name: '日入网电量',
|
||||
key: 'key2',
|
||||
key: 'solar_elect_grid',
|
||||
lineColor: '#0E68E4',
|
||||
value: 0,
|
||||
d: 'kW·h'
|
||||
}
|
||||
],
|
||||
faultChart: null,
|
||||
lineChartData: {
|
||||
pvChart: null,
|
||||
pvChartData: {
|
||||
ydata: [],
|
||||
xdata: []
|
||||
},
|
||||
@@ -53,31 +57,47 @@ export default {
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
deviceInfo: {
|
||||
handler(n) {
|
||||
this.$nextTick(() => {
|
||||
this.drawLineChart()
|
||||
})
|
||||
total: {
|
||||
handler(newVal, oldVal) {
|
||||
if (newVal !== oldVal) {
|
||||
let that = this
|
||||
that.curList.forEach((item) => {
|
||||
item.value = that.total[item.key]
|
||||
})
|
||||
}
|
||||
}
|
||||
// immediate: true
|
||||
},
|
||||
deviceInfo: {
|
||||
handler(newVal, oldVal) {
|
||||
if (JSON.stringify(newVal) !== JSON.stringify(oldVal)) {
|
||||
this.$nextTick(() => {
|
||||
this.drawLineChart()
|
||||
})
|
||||
}
|
||||
},
|
||||
deep: true // 确保深度比较
|
||||
}
|
||||
},
|
||||
mounted() {},
|
||||
onBeforeUnmount() {
|
||||
this.faultChart = null
|
||||
beforeUnmount() {
|
||||
window.removeEventListener('resize', this.handleResize)
|
||||
if (this.pvChart) {
|
||||
this.pvChart.dispose()
|
||||
this.pvChart = null
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
handleResize() {
|
||||
this.faultChart.resize()
|
||||
if (this.pvChart) {
|
||||
this.pvChart.resize()
|
||||
}
|
||||
},
|
||||
processData(data, keys) {
|
||||
console.log(data, 'dddddddddddddddddddddddddddd')
|
||||
data.sort((a, b) => {
|
||||
return new Date(a.date) - new Date(b.date)
|
||||
return new Date(a.dt) - new Date(b.dt)
|
||||
})
|
||||
const dates = data.map((item) => item.date)
|
||||
const dates = data.map((item) => item.dt)
|
||||
const values = []
|
||||
keys.forEach((item, index) => {
|
||||
values[index] = data.map((dataValue) => dataValue[keys[index]])
|
||||
@@ -93,9 +113,9 @@ export default {
|
||||
const keyList = this.curList.map((item) => item.key)
|
||||
const result = this.processData(this.deviceInfo, keyList)
|
||||
|
||||
this.lineChartData.xdata = result.dates
|
||||
this.pvChartData.xdata = result.dates
|
||||
arr.forEach((item, index) => {
|
||||
this.lineChartData.ydata[index] = {
|
||||
this.pvChartData.ydata[index] = {
|
||||
name: item.name,
|
||||
smooth: true,
|
||||
type: 'bar',
|
||||
@@ -116,9 +136,13 @@ export default {
|
||||
|
||||
drawLineChart(activeKey) {
|
||||
this.getChargeData(activeKey)
|
||||
if (this.pvChart) {
|
||||
this.pvChart.dispose()
|
||||
}
|
||||
const chartDom = document.getElementById('pv-chart')
|
||||
let faultChart = this.$echarts.init(chartDom)
|
||||
this.faultChart = faultChart
|
||||
if (!chartDom) return
|
||||
let pvChart = this.$echarts.init(chartDom)
|
||||
this.pvChart = pvChart
|
||||
const option = {
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
@@ -140,7 +164,7 @@ export default {
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: this.lineChartData.xdata,
|
||||
data: this.pvChartData.xdata,
|
||||
axisLine: {
|
||||
lineStyle: { type: 'dashed', color: '#435463' }
|
||||
},
|
||||
@@ -154,13 +178,17 @@ export default {
|
||||
lineStyle: { type: 'dashed', color: '#435463' }
|
||||
},
|
||||
axisLabel: {
|
||||
interval: 4,
|
||||
color: '#fff'
|
||||
}
|
||||
},
|
||||
series: this.lineChartData.ydata
|
||||
series: this.pvChartData.ydata
|
||||
}
|
||||
option && faultChart.setOption(option)
|
||||
console.log(this.lineChartData, 'this.lineChartData')
|
||||
option && pvChart.setOption(option)
|
||||
this.setupResizeListener()
|
||||
},
|
||||
setupResizeListener() {
|
||||
window.removeEventListener('resize', this.handleResize)
|
||||
window.addEventListener('resize', this.handleResize)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,14 +3,20 @@
|
||||
<div class="content-left">
|
||||
<div v-for="item in leftList" :key="item.key" :class="`item ${item.class}`">
|
||||
<span>{{ item.label }}</span>
|
||||
<div> <span>{{ item.value }}</span><span class="d">{{ item.d }}</span></div>
|
||||
<div>
|
||||
<span>{{ item.value ? item.value : 0 }}</span
|
||||
><span class="d">{{ item.d }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="online-icon"></div>
|
||||
<div class="content-right">
|
||||
<div v-for="item in rightList" :key="item.key" :class="`item ${item.class}`">
|
||||
<span>{{ item.label }}</span>
|
||||
<div> <span>{{ item.value }}</span><span class="d">{{ item.d }}</span></div>
|
||||
<div>
|
||||
<span>{{ item.value ? item.value : 0 }}</span
|
||||
><span class="d">{{ item.d }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -20,6 +26,14 @@
|
||||
export default {
|
||||
name: '',
|
||||
props: {
|
||||
infoKey: {
|
||||
type: String,
|
||||
default:''
|
||||
},
|
||||
total: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
},
|
||||
deviceInfo: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
@@ -27,44 +41,44 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
list: [
|
||||
curList: [
|
||||
{
|
||||
key: 'tianshu',
|
||||
key: 'runDays', //根据launch_date字段计算得出
|
||||
value: 20,
|
||||
d: '天',
|
||||
label: '系统运行天数',
|
||||
class: 'item-1'
|
||||
},
|
||||
{
|
||||
key: 'shouyi',
|
||||
key: 'income_total',
|
||||
value: 10,
|
||||
d: '万元',
|
||||
d: '元',
|
||||
label: '累计收益',
|
||||
class: 'item-2'
|
||||
},
|
||||
{
|
||||
key: 'shuliang',
|
||||
key: 'solar_device_num',
|
||||
value: 20,
|
||||
d: '',
|
||||
label: '光伏设备数量',
|
||||
class: 'item-3'
|
||||
},
|
||||
{
|
||||
key: 'shuliang',
|
||||
key: 'storage_device_num',
|
||||
value: 20,
|
||||
d: '',
|
||||
label: '储能预制舱数量',
|
||||
class: 'item-4'
|
||||
},
|
||||
{
|
||||
key: 'fadianliang',
|
||||
key: 'solar_elect_gen',
|
||||
value: 20,
|
||||
d: '',
|
||||
label: '光伏设备累计发电量',
|
||||
class: 'item-5'
|
||||
},
|
||||
{
|
||||
key: 'rongliang',
|
||||
key: 'capacity_total',
|
||||
value: 20,
|
||||
d: '',
|
||||
label: '储能总容量',
|
||||
@@ -75,14 +89,29 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
leftList() {
|
||||
return this.list.filter((_, index) => index % 2 === 0).slice(0, 3) // 左列取前3个偶数索引
|
||||
return this.curList.filter((_, index) => index % 2 === 0).slice(0, 3) // 左列取前3个偶数索引
|
||||
},
|
||||
rightList() {
|
||||
return this.list.filter((_, index) => index % 2 !== 0).slice(0, 3) // 右列取前3个奇数索引
|
||||
return this.curList.filter((_, index) => index % 2 !== 0).slice(0, 3) // 右列取前3个奇数索引
|
||||
}
|
||||
},
|
||||
watch: {},
|
||||
mounted() {},
|
||||
|
||||
watch: {
|
||||
total: {
|
||||
handler(newVal,oldVal) {
|
||||
if (newVal&&newVal!==oldVal) {
|
||||
this.curList.forEach((item) => {
|
||||
item.value = newVal[item.key] || 0;
|
||||
});
|
||||
}
|
||||
},
|
||||
immediate: true,
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
console.log(this.total,'total')
|
||||
},
|
||||
methods: {}
|
||||
}
|
||||
</script>
|
||||
@@ -111,12 +140,10 @@ export default {
|
||||
font-size: 12px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.d{
|
||||
.d {
|
||||
margin-left: 1px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
.content-left,
|
||||
|
||||
@@ -49,23 +49,23 @@ export default {
|
||||
type: Object,
|
||||
default: () => ({}), // 默认空对象
|
||||
required: false // 非必须
|
||||
},
|
||||
tableData: {
|
||||
type: Array,
|
||||
default: () => ([]), // 默认空对象
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
paramsDate: {},
|
||||
tableData: [],
|
||||
tableOption: {
|
||||
scroll: {
|
||||
x: 1500
|
||||
}
|
||||
},
|
||||
select: false,
|
||||
},
|
||||
tableH: 0,
|
||||
pageOption: {
|
||||
current: 1,
|
||||
pageSize: 15,
|
||||
total: 1
|
||||
},
|
||||
|
||||
// chartOptions: [
|
||||
// {
|
||||
// title: '充放电分析',
|
||||
@@ -233,50 +233,27 @@ export default {
|
||||
chartInstances: [] // 存储 ECharts 实例
|
||||
}
|
||||
},
|
||||
watch:{
|
||||
chartData: {
|
||||
handler(n) {
|
||||
this.$nextTick(() => {
|
||||
this.initCharts()
|
||||
window.addEventListener('resize', this.handleResize)
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$nextTick(() => {
|
||||
// 确保 DOM 完全渲染
|
||||
this.initCharts()
|
||||
window.addEventListener('resize', this.handleResize)
|
||||
})
|
||||
|
||||
},
|
||||
beforeUnmount() {
|
||||
window.removeEventListener('resize', this.handleResize)
|
||||
this.chartInstances.forEach((chart) => chart && chart.dispose())
|
||||
},
|
||||
methods: {
|
||||
async getList() {
|
||||
let that = this
|
||||
this.$refs.comTable.loading = true
|
||||
const query = {
|
||||
...this.paramsDate,
|
||||
pageSize: this.pageOption.pageSize,
|
||||
pageNumber: this.pageOption.current
|
||||
}
|
||||
try {
|
||||
const res = await postReq(query, this.tableInfo.getUrl)
|
||||
if (res.code === 200) {
|
||||
this.$refs.comTable.loading = false
|
||||
this.tableData = res.data.records
|
||||
this.pageOption = {
|
||||
current: res.data.pageNumber,
|
||||
pageSize: res.data.pageSize,
|
||||
total: res.data.totalRow
|
||||
}
|
||||
this.getScrollDateFail = false
|
||||
} else {
|
||||
throw res
|
||||
}
|
||||
} catch (error) {
|
||||
that.tableData = []
|
||||
that.$refs.comTable.loading = false
|
||||
}
|
||||
},
|
||||
initCharts() {
|
||||
this.chartOptions.forEach((option, index) => {
|
||||
// Vue 2 的 $refs 在 v-for 中是数组,需要取 [0]
|
||||
const dom = this.$refs[`chartContainer${index}`][0]
|
||||
console.log(dom, 'ddddddddddddddd')
|
||||
if (!dom) return
|
||||
|
||||
const chart = this.$echarts.init(dom)
|
||||
@@ -363,17 +340,15 @@ export default {
|
||||
},
|
||||
processData(keysList, dataKey, data) {
|
||||
const keys = keysList.map((item) => item.key)
|
||||
console.log(keys, dataKey, data, 'dddddddddddddddddddddddddddd')
|
||||
data.sort((a, b) => {
|
||||
return new Date(a.date) - new Date(b.date)
|
||||
return new Date(a.dt) - new Date(b.dt)
|
||||
})
|
||||
const dates = data.map((item) => item.date)
|
||||
const dates = data.map((item) => item.dt)
|
||||
const values = []
|
||||
|
||||
keys.forEach((item, index) => {
|
||||
values[index] = data.map((dataValue) => dataValue[keys[index]])
|
||||
})
|
||||
console.log(dates, values, 'dates')
|
||||
return {
|
||||
dates,
|
||||
values
|
||||
@@ -384,9 +359,10 @@ export default {
|
||||
},
|
||||
|
||||
handlePagesizeChange(pageOption) {
|
||||
this.pageOption.pageSize = pageOption.pageSize
|
||||
this.pageOption.current = pageOption.current
|
||||
this.getList()
|
||||
this.$emit('pagesizeChange_energy',pageOption)
|
||||
// this.pageOption.pageSize = pageOption.pageSize
|
||||
// this.pageOption.current = pageOption.current
|
||||
// this.getList()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -394,7 +370,7 @@ export default {
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.content {
|
||||
height: calc(100% - 38px);
|
||||
height: calc(100% - 10px);
|
||||
overflow: scroll;
|
||||
}
|
||||
.content-echarts {
|
||||
|
||||
Reference in New Issue
Block a user