2025-09-28 14:38:41 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<el-row>
|
|
|
|
|
|
<el-col :span="4">
|
2026-03-26 10:41:27 +08:00
|
|
|
|
<!-- <div style="padding: 10px;">
|
2025-09-30 10:01:16 +08:00
|
|
|
|
<el-select v-model="energyType" placeholder="请选择能源类型" @change="refresh">
|
|
|
|
|
|
<el-option v-for="item in energyTypeList" :key="item.energyTypeId" :label="item.name" :value="item.energyTypeId" />
|
|
|
|
|
|
</el-select>
|
2026-03-26 10:41:27 +08:00
|
|
|
|
</div> -->
|
2025-09-30 10:01:16 +08:00
|
|
|
|
|
2025-09-28 14:38:41 +08:00
|
|
|
|
|
|
|
|
|
|
<!-- 区域选择,默认展开,最高高度为60%的屏幕尺寸 -->
|
|
|
|
|
|
<el-tree @node-click="handleNodeClick" :data="locationList" :props="defaultProps" :default-expand-all="true" :style="{ height: 'calc(50vh - 50px)' }"></el-tree>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 设备列表 -->
|
2025-09-30 20:52:52 +08:00
|
|
|
|
<!-- <ul v-if="locationId">
|
2025-09-28 14:38:41 +08:00
|
|
|
|
<li></li>
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
<div v-else>
|
|
|
|
|
|
<el-empty description="请选择区域"></el-empty>
|
2025-09-30 20:52:52 +08:00
|
|
|
|
</div> -->
|
2025-09-28 14:38:41 +08:00
|
|
|
|
</el-col>
|
|
|
|
|
|
|
2025-09-30 10:01:16 +08:00
|
|
|
|
<el-col :span="20" v-if="showRight">
|
2026-03-26 10:41:27 +08:00
|
|
|
|
<!-- <el-tabs v-model="activeTab" type="card">
|
2025-09-30 10:01:16 +08:00
|
|
|
|
<el-tab-pane label="环比概况" name="1"></el-tab-pane>
|
2025-09-28 14:38:41 +08:00
|
|
|
|
<el-tab-pane label="近期趋势" name="2"></el-tab-pane>
|
|
|
|
|
|
<el-tab-pane label="同比分析" name="3"></el-tab-pane>
|
|
|
|
|
|
<el-tab-pane label="环比分析" name="4"></el-tab-pane>
|
2026-03-26 10:41:27 +08:00
|
|
|
|
</el-tabs> -->
|
|
|
|
|
|
<el-tabs v-model="energyType" type="card">
|
|
|
|
|
|
<el-tab-pane v-for="item in energyTypeList" :key="item.energyTypeId" :label="item.name" :name="item.energyTypeId"></el-tab-pane>
|
2025-09-28 14:38:41 +08:00
|
|
|
|
</el-tabs>
|
|
|
|
|
|
|
2026-03-26 10:41:27 +08:00
|
|
|
|
<Overview ref="overview" :unit="energyUnit" :energyName="energyName" :energyType="energyType" :locationId="locationId" :deviceId="deviceId" />
|
|
|
|
|
|
<RecentTrend ref="recentTrend" :unit="energyUnit" :energyName="energyName" :energyType="energyType" :locationId="locationId" :deviceId="deviceId" />
|
|
|
|
|
|
<YearToYear ref="yearToYear" :unit="energyUnit" :energyName="energyName" :energyType="energyType" :locationId="locationId" :deviceId="deviceId" />
|
|
|
|
|
|
<MonthToMonth ref="monthToMonth" :unit="energyUnit" :energyName="energyName" :energyType="energyType" :locationId="locationId" :deviceId="deviceId" />
|
2025-09-30 10:01:16 +08:00
|
|
|
|
</el-col>
|
|
|
|
|
|
<el-col :span="20" v-else>
|
|
|
|
|
|
<el-empty description="请选择能源类型和区域"></el-empty>
|
2025-09-28 14:38:41 +08:00
|
|
|
|
</el-col>
|
|
|
|
|
|
</el-row>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
import { listEnergyType } from "@/api/ems/energyType";
|
|
|
|
|
|
import { listLocation } from "@/api/ems/location";
|
|
|
|
|
|
|
|
|
|
|
|
import Overview from "./panels/Overview.vue";
|
2025-09-30 10:01:16 +08:00
|
|
|
|
import RecentTrend from "./panels/RecentTrends.vue";
|
|
|
|
|
|
import YearToYear from "./panels/YearOnYear.vue";
|
2025-09-28 14:38:41 +08:00
|
|
|
|
import MonthToMonth from "./panels/MonthToMonth.vue";
|
|
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
|
name: "Dashboard",
|
|
|
|
|
|
components: {
|
|
|
|
|
|
Overview,
|
|
|
|
|
|
RecentTrend,
|
|
|
|
|
|
YearToYear,
|
|
|
|
|
|
MonthToMonth
|
|
|
|
|
|
},
|
|
|
|
|
|
data() {
|
|
|
|
|
|
return {
|
|
|
|
|
|
energyTypeList: [],
|
|
|
|
|
|
energyType: '',
|
|
|
|
|
|
locationId: '',
|
2025-09-30 10:01:16 +08:00
|
|
|
|
deviceId: '',
|
2025-09-28 14:38:41 +08:00
|
|
|
|
locationList: [
|
|
|
|
|
|
],
|
|
|
|
|
|
defaultProps: {
|
|
|
|
|
|
children: 'children',
|
|
|
|
|
|
label: 'name'
|
|
|
|
|
|
},
|
|
|
|
|
|
activeTab: '1'
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
created() {
|
|
|
|
|
|
this.getEnergyTypeList();
|
|
|
|
|
|
this.getLocationList();
|
|
|
|
|
|
},
|
2025-09-30 10:01:16 +08:00
|
|
|
|
computed: {
|
|
|
|
|
|
showRight() {
|
|
|
|
|
|
return this.energyType && (this.deviceId || this.locationId);
|
2025-09-28 14:38:41 +08:00
|
|
|
|
},
|
2025-09-30 10:01:16 +08:00
|
|
|
|
energyUnit() {
|
|
|
|
|
|
return this.energyTypeList.find(item => item.energyTypeId === this.energyType)?.unit;
|
|
|
|
|
|
},
|
|
|
|
|
|
energyName() {
|
|
|
|
|
|
return this.energyTypeList.find(item => item.energyTypeId === this.energyType)?.name;
|
|
|
|
|
|
}
|
2025-09-28 14:38:41 +08:00
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
getEnergyTypeList() {
|
|
|
|
|
|
listEnergyType({ pageNum: 1, pageSize: 9999 }).then(response => {
|
|
|
|
|
|
this.energyTypeList = response.rows;
|
2026-03-26 10:41:27 +08:00
|
|
|
|
this.energyType = this.energyTypeList[0]?.energyTypeId;
|
2025-09-28 14:38:41 +08:00
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
getLocationList() {
|
|
|
|
|
|
listLocation().then(response => {
|
2025-09-30 10:01:16 +08:00
|
|
|
|
this.locationList = this.handleTree(response.data, "locationId", "parentId");
|
2025-09-28 14:38:41 +08:00
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
handleNodeClick(data) {
|
|
|
|
|
|
this.locationId = data.locationId;
|
2025-09-30 10:01:16 +08:00
|
|
|
|
this.deviceId = undefined;
|
|
|
|
|
|
this.refresh();
|
|
|
|
|
|
},
|
|
|
|
|
|
refresh() {
|
|
|
|
|
|
if (this.$refs.overview) {
|
|
|
|
|
|
this.$refs.overview.refresh();
|
|
|
|
|
|
}
|
|
|
|
|
|
if (this.$refs.recentTrend) {
|
|
|
|
|
|
this.$refs.recentTrend.refresh();
|
|
|
|
|
|
}
|
|
|
|
|
|
if (this.$refs.yearToYear) {
|
|
|
|
|
|
this.$refs.yearToYear.refresh();
|
|
|
|
|
|
}
|
|
|
|
|
|
if (this.$refs.monthToMonth) {
|
|
|
|
|
|
this.$refs.monthToMonth.refresh();
|
|
|
|
|
|
}
|
2025-09-28 14:38:41 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|