From ee56d420df75e3284a1fe4756363fa3c924b9190 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期一, 03 十一月 2025 15:34:52 +0800
Subject: [PATCH] 能耗管理-添加导出功能
---
 src/views/energyManagement/energyTrends/index.vue |   23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)
diff --git a/src/views/energyManagement/energyTrends/index.vue b/src/views/energyManagement/energyTrends/index.vue
index 0e7bcbf..7f67be7 100644
--- a/src/views/energyManagement/energyTrends/index.vue
+++ b/src/views/energyManagement/energyTrends/index.vue
@@ -14,6 +14,7 @@
 				<el-button type="primary" @click="handleQuery" style="margin-left: 10px"
 				>鎼滅储</el-button
 				>
+				<el-button @click="handleOut" style="margin-left: 10px">瀵煎嚭</el-button>
 			</div>
 		</div>
 		<div class="table_list">
@@ -34,8 +35,11 @@
 
 <script setup>
 import {Search} from "@element-plus/icons-vue";
-import {onMounted, ref} from "vue";
+import {onMounted, ref, getCurrentInstance} from "vue";
 import {listPageByTrend} from "@/api/energyManagement/index.js";
+import { ElMessageBox } from "element-plus";
+
+const { proxy } = getCurrentInstance();
 
 const data = reactive({
 	searchForm: {
@@ -76,6 +80,7 @@
 	},
 ]);
 const tableData = ref([]);
+const selectedRows = ref([]);
 const tableLoading = ref(false);
 const page = reactive({
 	current: 1,
@@ -106,6 +111,22 @@
 		page.total = res.data.total;
 	});
 };
+
+// 瀵煎嚭
+const handleOut = () => {
+	ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
+		confirmButtonText: "纭",
+		cancelButtonText: "鍙栨秷",
+		type: "warning",
+	})
+		.then(() => {
+			proxy.download("/equipmentEnergyConsumption/exportTwo", {}, "鑳芥簮瓒嬪娍.xlsx");
+		})
+		.catch(() => {
+			proxy.$modal.msg("宸插彇娑�");
+		});
+};
+
 onMounted(() => {
 	getList();
 });
--
Gitblit v1.9.3