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/waterManagement/index.vue | 39 ++++++++++++++++++++++++++++-----------
1 files changed, 28 insertions(+), 11 deletions(-)
diff --git a/src/views/energyManagement/waterManagement/index.vue b/src/views/energyManagement/waterManagement/index.vue
index 848a945..4ada029 100644
--- a/src/views/energyManagement/waterManagement/index.vue
+++ b/src/views/energyManagement/waterManagement/index.vue
@@ -4,7 +4,7 @@
<div>
<span class="search_title">璁惧鍚嶇О锛�</span>
<el-input
- v-model="searchForm.name"
+ v-model="searchForm.deviceName"
style="width: 240px"
placeholder="璇疯緭鍏�"
@change="handleQuery"
@@ -18,6 +18,7 @@
<div>
<el-button type="primary" @click="openForm('add')">鏂板</el-button>
<el-button type="info" plain icon="Upload" @click="handleImport">瀵煎叆</el-button>
+ <el-button @click="handleOut">瀵煎嚭</el-button>
<el-button type="danger" plain @click="handleDelete">鍒犻櫎</el-button>
</div>
</div>
@@ -83,7 +84,7 @@
<script setup>
import {Search} from "@element-plus/icons-vue";
-import {onMounted, ref, reactive, nextTick} from "vue";
+import {onMounted, ref, reactive, nextTick, getCurrentInstance} from "vue";
import FormDia from "@/views/energyManagement/waterManagement/components/formDia.vue";
import {ElMessageBox} from "element-plus";
import {getToken} from "@/utils/auth.js";
@@ -101,35 +102,35 @@
const tableColumn = ref([
{
label: "璁惧鍚嶇О",
- prop: "name",
+ prop: "deviceName",
width: 200,
},
{
label: "瑙勬牸鍨嬪彿",
- prop: "code",
+ prop: "deviceModel",
width: 200,
},
{
label: "棰濆畾娴侀噺",
- prop: "flowRating",
+ prop: "ratedRate",
},
{
label: "瀹為檯娴侀噺",
- prop: "flowActual",
+ prop: "actualTraffic",
},
{
label: "杩愯鏃堕棿",
- prop: "runDate",
+ prop: "runTime",
width:150
},
{
label: "褰撴棩鐢ㄦ按閲�",
- prop: "dayNum",
+ prop: "waterDay",
width: 150,
},
{
label: "姣忔棩闄愬埗姘撮噺",
- prop: "everyNum",
+ prop: "waterDayLimit",
width:220
},
{
@@ -175,7 +176,7 @@
// 璁剧疆涓婁紶鐨勮姹傚ご閮�
headers: { Authorization: "Bearer " + getToken() },
// 涓婁紶鐨勫湴鍧�
- url: import.meta.env.VITE_APP_BASE_API + "/waterEquipmentConsumption/importData",
+ url: import.meta.env.VITE_APP_BASE_API + "/waterRecord/importData",
// 鏂囦欢涓婁紶鍓嶇殑鍥炶皟
beforeUpload: (file) => {
console.log('鏂囦欢鍗冲皢涓婁紶', file);
@@ -257,7 +258,7 @@
}
function importTemplate() {
proxy.download(
- "/waterEquipmentConsumption/export",
+ "/waterRecord/export",
{},
'鐢ㄦ按璁惧瀵煎叆妯$増.xlsx'
);
@@ -302,6 +303,22 @@
proxy.$modal.msg("宸插彇娑�");
});
};
+
+// 瀵煎嚭
+const handleOut = () => {
+ ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(() => {
+ proxy.download("/waterRecord/export", {}, "鐢ㄦ按绠$悊.xlsx");
+ })
+ .catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
+ });
+};
+
onMounted(() => {
getList();
});
--
Gitblit v1.9.3