From d7ea471fbb4a834b69715cac684bab7d2731688b Mon Sep 17 00:00:00 2001
From: yyb <995253665@qq.com>
Date: 星期二, 17 三月 2026 16:32:50 +0800
Subject: [PATCH] 能耗成本核算注释假数据获取方法
---
src/views/reportAnalysis/solidWasteConsumption/index1.vue | 623 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 623 insertions(+), 0 deletions(-)
diff --git a/src/views/reportAnalysis/solidWasteConsumption/index1.vue b/src/views/reportAnalysis/solidWasteConsumption/index1.vue
new file mode 100644
index 0000000..6af1d80
--- /dev/null
+++ b/src/views/reportAnalysis/solidWasteConsumption/index1.vue
@@ -0,0 +1,623 @@
+<template>
+ <div class="dashboard-container">
+ <div class="data-dashboard">
+ <!-- 绛涢�夊尯鍩� -->
+ <div class="filter-area">
+ <div class="filter-section">
+ <span class="filter-label">鏃堕棿缁村害锛�</span>
+ <el-radio-group v-model="dateType"
+ @change="handleDateTypeChange"
+ class="radio-group">
+ <el-radio-button label="month">鏈堝害</el-radio-button>
+ <el-radio-button label="year">骞村害</el-radio-button>
+ </el-radio-group>
+ </div>
+ </div>
+ <!-- 涓昏鍐呭鍖哄煙 -->
+ <div class="dashboard-content">
+ <!-- 绗竴琛岋細鏍稿績鎸囨爣 -->
+ <div class="row row-1">
+ <div class="panel-card card-1">
+ <div class="panel-title">鏍稿績鎸囨爣</div>
+ <div class="stats-grid">
+ <div class="stat-item">
+ <div class="stat-label">鍚堣閲�</div>
+ <div class="stat-value">{{ totalSolidWaste }}</div>
+ <div class="stat-unit">鍚�</div>
+ </div>
+ <div class="stat-item">
+ <div class="stat-label">2022骞磋嚦浠婄疮璁℃秷绾抽噺</div>
+ <div class="stat-value">{{ totalSolidWasteSince2022 }}</div>
+ <div class="stat-unit">鍚�</div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <!-- 绗簩琛岋細鍥哄簾娑堢撼瓒嬪娍 -->
+ <div class="row row-2">
+ <div class="panel-card card-2">
+ <div class="panel-title">鍥哄簾娑堢撼瓒嬪娍</div>
+ <div class="chart-container">
+ <div ref="trendChart"
+ style="width: 100%; height: 100%"></div>
+ </div>
+ </div>
+ </div>
+ <!-- 绗笁琛岋細鍥哄簾绫诲瀷鍒嗗竷 -->
+ <div class="row row-3">
+ <div class="panel-card card-3">
+ <div class="panel-title">鍥哄簾绫诲瀷鍒嗗竷</div>
+ <div class="chart-container">
+ <div ref="distributionChart"
+ style="width: 100%; height: 100%"></div>
+ </div>
+ </div>
+ </div>
+ <!-- 绗洓琛岋細娑堢撼閲忔槑缁� -->
+ <div class="row row-4">
+ <div class="panel-card card-4">
+ <div class="panel-title">娑堢撼閲忔槑缁�</div>
+ <div class="table-container">
+ <el-table :data="wasteTableData"
+ style="width: 100%">
+ <el-table-column prop="time"
+ label="鏃堕棿"
+ width="120" />
+ <el-table-column prop="type"
+ label="鍥哄簾绫诲瀷"
+ width="120"
+ align="center">
+ <template #default="scope">
+ <el-tag :type="getWasteTypeType(scope.row.type)">
+ {{ scope.row.type }}
+ </el-tag>
+ </template>
+ </el-table-column>
+ <el-table-column prop="quantity"
+ label="娑堢撼閲�"
+ align="right">
+ <template #default="scope">
+ <span class="data-value">{{ scope.row.quantity }}</span>
+ </template>
+ </el-table-column>
+ <el-table-column prop="unit"
+ label="鍗曚綅"
+ width="80" />
+ <el-table-column prop="source"
+ label="鏉ユ簮" />
+ </el-table>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+</template>
+
+<script setup>
+ import { ref, computed, onMounted, onBeforeUnmount, nextTick } from "vue";
+ import * as echarts from "echarts";
+
+ // 绛涢�夋潯浠�
+ const dateType = ref("month"); // month 鎴� year
+
+ // 鍥捐〃寮曠敤
+ const trendChart = ref(null);
+ const distributionChart = ref(null);
+
+ // 鍥捐〃瀹炰緥
+ let trendChartInstance = null;
+ let distributionChartInstance = null;
+
+ // 妯℃嫙鏁版嵁
+ const solidWasteData = ref({
+ month: [
+ { name: "1鏈�", 绮夌叅鐏�: 200, 鐭宠啅: 150, 鐭崇伆: 100 },
+ { name: "2鏈�", 绮夌叅鐏�: 220, 鐭宠啅: 160, 鐭崇伆: 110 },
+ { name: "3鏈�", 绮夌叅鐏�: 190, 鐭宠啅: 140, 鐭崇伆: 95 },
+ { name: "4鏈�", 绮夌叅鐏�: 230, 鐭宠啅: 170, 鐭崇伆: 115 },
+ { name: "5鏈�", 绮夌叅鐏�: 240, 鐭宠啅: 180, 鐭崇伆: 120 },
+ { name: "6鏈�", 绮夌叅鐏�: 225, 鐭宠啅: 165, 鐭崇伆: 112 },
+ ],
+ year: [
+ { name: "2022", 绮夌叅鐏�: 2300, 鐭宠啅: 1700, 鐭崇伆: 1100 },
+ { name: "2023", 绮夌叅鐏�: 2500, 鐭宠啅: 1800, 鐭崇伆: 1200 },
+ { name: "2024", 绮夌叅鐏�: 2700, 鐭宠啅: 1950, 鐭崇伆: 1300 },
+ { name: "2025", 绮夌叅鐏�: 2900, 鐭宠啅: 2100, 鐭崇伆: 1400 },
+ ],
+ });
+
+ // 璁$畻灞炴��
+ const totalSolidWaste = computed(() => {
+ const data = solidWasteData.value[dateType.value];
+ if (dateType.value === "month") {
+ return data.reduce(
+ (sum, item) => sum + item.绮夌叅鐏� + item.鐭宠啅 + item.鐭崇伆,
+ 0
+ );
+ } else {
+ const lastItem = data[data.length - 1];
+ return lastItem.绮夌叅鐏� + lastItem.鐭宠啅 + lastItem.鐭崇伆;
+ }
+ });
+
+ const totalSolidWasteSince2022 = computed(() => {
+ const data = solidWasteData.value.year;
+ return data.reduce(
+ (sum, item) => sum + item.绮夌叅鐏� + item.鐭宠啅 + item.鐭崇伆,
+ 0
+ );
+ });
+
+ const wasteTableData = computed(() => {
+ const data = solidWasteData.value[dateType.value];
+ const result = [];
+
+ data.forEach(item => {
+ result.push({
+ time: item.name,
+ type: "绮夌叅鐏�",
+ quantity: item.绮夌叅鐏�,
+ unit: "鍚�",
+ source: "鐢熶骇杩囩▼",
+ });
+ result.push({
+ time: item.name,
+ type: "鐭宠啅",
+ quantity: item.鐭宠啅,
+ unit: "鍚�",
+ source: "鐢熶骇杩囩▼",
+ });
+ result.push({
+ time: item.name,
+ type: "鐭崇伆",
+ quantity: item.鐭崇伆,
+ unit: "鍚�",
+ source: "鐢熶骇杩囩▼",
+ });
+ });
+
+ return result;
+ });
+
+ // 鍥捐〃閰嶇疆
+ const trendChartOption = computed(() => {
+ const data = solidWasteData.value[dateType.value];
+ return {
+ tooltip: {
+ trigger: "axis",
+ axisPointer: {
+ type: "shadow",
+ },
+ },
+ legend: {
+ data: ["绮夌叅鐏�", "鐭宠啅", "鐭崇伆"],
+ textStyle: {
+ color: "#333",
+ },
+ },
+ grid: {
+ left: "3%",
+ right: "4%",
+ bottom: "3%",
+ containLabel: true,
+ },
+ xAxis: {
+ type: "category",
+ data: data.map(item => item.name),
+ axisLabel: {
+ color: "#333",
+ },
+ },
+ yAxis: {
+ type: "value",
+ name: "娑堢撼閲� (鍚�)",
+ axisLabel: {
+ color: "#333",
+ },
+ },
+ series: [
+ {
+ name: "绮夌叅鐏�",
+ type: "bar",
+ data: data.map(item => item.绮夌叅鐏�),
+ itemStyle: {
+ color: "#909399",
+ },
+ },
+ {
+ name: "鐭宠啅",
+ type: "bar",
+ data: data.map(item => item.鐭宠啅),
+ itemStyle: {
+ color: "#E6A23C",
+ },
+ },
+ {
+ name: "鐭崇伆",
+ type: "bar",
+ data: data.map(item => item.鐭崇伆),
+ itemStyle: {
+ color: "#F56C6C",
+ },
+ },
+ ],
+ };
+ });
+
+ const distributionChartOption = computed(() => {
+ const data = solidWasteData.value[dateType.value];
+ const lastItem = data[data.length - 1];
+
+ return {
+ tooltip: {
+ trigger: "item",
+ formatter: "{a} <br/>{b}: {c} ({d}%)",
+ },
+ legend: {
+ orient: "vertical",
+ left: "left",
+ textStyle: {
+ color: "#333",
+ },
+ },
+ series: [
+ {
+ name: "鍥哄簾绫诲瀷",
+ type: "pie",
+ radius: "60%",
+ center: ["50%", "50%"],
+ data: [
+ { value: lastItem.绮夌叅鐏�, name: "绮夌叅鐏�" },
+ { value: lastItem.鐭宠啅, name: "鐭宠啅" },
+ { value: lastItem.鐭崇伆, name: "鐭崇伆" },
+ ],
+ emphasis: {
+ itemStyle: {
+ shadowBlur: 10,
+ shadowOffsetX: 0,
+ shadowColor: "rgba(0, 0, 0, 0.5)",
+ },
+ },
+ itemStyle: {
+ color: function (params) {
+ const colors = ["#909399", "#E6A23C", "#F56C6C"];
+ return colors[params.dataIndex];
+ },
+ },
+ },
+ ],
+ };
+ });
+
+ // 浜嬩欢澶勭悊
+ const handleDateTypeChange = () => {
+ updateCharts();
+ };
+
+ // 鍒濆鍖栧浘琛�
+ const initCharts = () => {
+ if (trendChart.value) {
+ trendChartInstance = echarts.init(trendChart.value);
+ trendChartInstance.setOption(trendChartOption.value);
+ }
+
+ if (distributionChart.value) {
+ distributionChartInstance = echarts.init(distributionChart.value);
+ distributionChartInstance.setOption(distributionChartOption.value);
+ }
+ };
+
+ // 鏇存柊鍥捐〃
+ const updateCharts = () => {
+ if (trendChartInstance) {
+ trendChartInstance.setOption(trendChartOption.value);
+ }
+
+ if (distributionChartInstance) {
+ distributionChartInstance.setOption(distributionChartOption.value);
+ }
+ };
+
+ // 璋冩暣鍥捐〃澶у皬
+ const resizeCharts = () => {
+ trendChartInstance?.resize();
+ distributionChartInstance?.resize();
+ };
+
+ // 绐楀彛澶у皬鍙樺寲澶勭悊
+ const handleResize = () => {
+ // 寤惰繜鎵ц锛岀‘淇滵OM鏇存柊瀹屾垚
+ setTimeout(() => {
+ resizeCharts();
+ }, 100);
+ };
+
+ // 鑾峰彇鍥哄簾绫诲瀷鏍囩绫诲瀷
+ const getWasteTypeType = type => {
+ const typeMap = {
+ 绮夌叅鐏�: "info",
+ 鐭宠啅: "warning",
+ 鐭崇伆: "danger",
+ };
+ return typeMap[type] || "info";
+ };
+
+ // 鐢熷懡鍛ㄦ湡閽╁瓙
+ onMounted(() => {
+ // 浣跨敤nextTick纭繚DOM瀹屽叏娓叉煋鍚庡啀鍒濆鍖�
+ nextTick(() => {
+ // 鍒濆鍖栧浘琛�
+ initCharts();
+ });
+
+ window.addEventListener("resize", handleResize);
+ });
+
+ onBeforeUnmount(() => {
+ window.removeEventListener("resize", handleResize);
+
+ // 閿�姣佸浘琛ㄥ疄渚�
+ trendChartInstance?.dispose();
+ distributionChartInstance?.dispose();
+ });
+</script>
+
+<style scoped>
+ /* 澶栭儴瀹瑰櫒 - 鍗犳嵁鏁翠釜瑙嗗彛 */
+ .dashboard-container {
+ position: relative;
+ width: 100%;
+ /* 椤甸潰鍦ㄥ父瑙勫竷灞�涓嬶紙鏈夐《鏍忥級榛樿鍑忓幓 84px锛岄伩鍏嶅唴瀹硅瑁佸垏 */
+ min-height: calc(100vh - 84px);
+ background-color: #f5f7fa;
+ overflow: hidden;
+ }
+
+ /* 鍐呴儴鍐呭鍖哄煙 - 鑷�傚簲瀹藉害 */
+ .data-dashboard {
+ position: relative;
+ width: 100%;
+ min-height: 100%;
+ background-color: #ffffff;
+ box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
+ }
+
+ .filter-area {
+ padding: 20px;
+ background-color: #ffffff;
+ border-bottom: 1px solid #e4e7ed;
+ display: flex;
+ gap: 40px;
+ align-items: center;
+ flex-wrap: wrap;
+ }
+
+ .filter-section {
+ display: flex;
+ align-items: center;
+ gap: 10px;
+ }
+
+ .filter-label {
+ font-size: 14px;
+ font-weight: 500;
+ color: #303133;
+ white-space: nowrap;
+ }
+
+ .radio-group {
+ display: flex;
+ align-items: center;
+ }
+
+ /* 鎸夐挳鏍峰紡 */
+ :deep(.el-radio-button__inner) {
+ border-radius: 4px;
+ padding: 8px 20px;
+ font-size: 14px;
+ transition: all 0.3s ease;
+ }
+
+ :deep(.el-radio-button__orig-radio:checked + .el-radio-button__inner) {
+ background-color: #409eff;
+ border-color: #409eff;
+ color: #ffffff;
+ box-shadow: 0 2px 4px rgba(64, 158, 255, 0.3);
+ }
+
+ :deep(.el-radio-button__inner:hover) {
+ color: #409eff;
+ border-color: #c6e2ff;
+ }
+
+ :deep(.el-radio-button:first-child .el-radio-button__inner) {
+ border-radius: 4px 0 0 4px;
+ }
+
+ :deep(.el-radio-button:last-child .el-radio-button__inner) {
+ border-radius: 0 4px 4px 0;
+ }
+
+ .dashboard-content {
+ position: relative;
+ z-index: 1;
+ display: flex;
+ flex-direction: column;
+ gap: 20px;
+ padding: 20px;
+ min-height: 800px;
+ overflow: hidden;
+ }
+
+ /* 琛屽竷灞� */
+ .row {
+ display: flex;
+ gap: 20px;
+ align-items: stretch;
+ }
+
+ /* 绗竴琛岋細鏍稿績鎸囨爣 */
+ .row-1 {
+ height: 250px;
+ }
+
+ /* 绗簩琛岋細鍥哄簾娑堢撼瓒嬪娍 */
+ .row-2 {
+ height: 300px;
+ }
+
+ /* 绗笁琛岋細鍥哄簾绫诲瀷鍒嗗竷 */
+ .row-3 {
+ height: 300px;
+ }
+
+ /* 绗洓琛岋細娑堢撼閲忔槑缁� */
+ .row-4 {
+ min-height: 250px;
+ }
+
+ /* 鍗$墖鏍峰紡 */
+ .panel-card {
+ background-color: #ffffff;
+ border-radius: 8px;
+ border: 1px solid #e4e7ed;
+ overflow: hidden;
+ display: flex;
+ flex-direction: column;
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
+ transition: all 0.3s ease;
+ }
+
+ .panel-card:hover {
+ box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
+ transform: translateY(-2px);
+ }
+
+ /* 鍗$墖甯冨眬 */
+ .card-1 {
+ flex: 1;
+ }
+
+ .card-2 {
+ flex: 1;
+ }
+
+ .card-3 {
+ flex: 1;
+ }
+
+ .card-4 {
+ flex: 1;
+ }
+
+ .panel-title {
+ padding: 15px 20px;
+ font-size: 16px;
+ font-weight: 500;
+ color: #303133;
+ border-bottom: 1px solid #e4e7ed;
+ background-color: #fafafa;
+ }
+
+ .card-1 .panel-title {
+ border-left: 4px solid #409eff;
+ }
+
+ .card-2 .panel-title {
+ border-left: 4px solid #f56c6c;
+ }
+
+ .card-3 .panel-title {
+ border-left: 4px solid #e6a23c;
+ }
+
+ .card-4 .panel-title {
+ border-left: 4px solid #67c23a;
+ }
+
+ .chart-container {
+ flex: 1;
+ padding: 20px;
+ }
+
+ .table-container {
+ flex: 1;
+ padding: 20px;
+ overflow: auto;
+ }
+
+ .stats-grid {
+ flex: 1;
+ padding: 15px;
+ display: grid;
+ grid-template-columns: repeat(2, 1fr);
+ gap: 15px;
+ }
+
+ .stat-item {
+ background-color: #ffffff;
+ border-radius: 12px;
+ padding: 25px;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ border: 2px solid #e4e7ed;
+ min-height: 120px;
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
+ transition: all 0.3s ease;
+ }
+
+ .stat-item:hover {
+ box-shadow: 0 8px 24px rgba(64, 158, 255, 0.2);
+ border-color: #409eff;
+ transform: translateY(-4px);
+ }
+
+ .stat-label {
+ font-size: 14px;
+ font-weight: 500;
+ color: #303133;
+ margin-bottom: 10px;
+ }
+
+ .stat-value {
+ font-size: 32px;
+ font-weight: 700;
+ color: #409eff;
+ margin-bottom: 5px;
+ text-shadow: 0 2px 4px rgba(64, 158, 255, 0.3);
+ transition: all 0.3s ease;
+ }
+
+ .stat-value:hover {
+ transform: scale(1.05);
+ }
+
+ .stat-unit {
+ font-size: 12px;
+ font-weight: 500;
+ color: #606266;
+ }
+
+ /* 琛ㄦ牸鏍峰紡 */
+ :deep(.el-table) {
+ border-radius: 8px;
+ overflow: hidden;
+ }
+
+ :deep(.el-table th) {
+ background-color: #fafafa;
+ font-weight: 500;
+ }
+
+ :deep(.el-table tr:hover > td) {
+ background-color: #ecf5ff;
+ }
+
+ .data-value {
+ font-weight: bold;
+ color: #409eff;
+ }
+</style>
\ No newline at end of file
--
Gitblit v1.9.3