From 509acf8dac4d27c82f00695ef12948ec6f3c6634 Mon Sep 17 00:00:00 2001
From: chenyc <501753378@qq.com>
Date: 星期四, 06 三月 2025 12:03:37 +0800
Subject: [PATCH] gx

---
 src/views/tongji/index.vue |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/src/views/tongji/index.vue b/src/views/tongji/index.vue
index b660912..5aedd47 100644
--- a/src/views/tongji/index.vue
+++ b/src/views/tongji/index.vue
@@ -17,6 +17,9 @@
 			<el-form-item>
 				<el-button type="primary" @click="onSubmit">查询</el-button>
 			</el-form-item>
+			<el-form-item>
+				<el-button type="success" @click="daochuExcel">导出</el-button>
+			</el-form-item>
 		</el-form>
 
 		<div class="scrollable-table" :style="{maxHeight:tableHe}">
@@ -130,6 +133,7 @@
 import {nutritionalSummary} from '/@/api/Patients'
 import {editUserInfo} from '/@/api/login'
 import { ElLoading } from 'element-plus';
+import * as XLSX from 'xlsx';
 import {formatDate} from '/@/utils/formatTime'
 const stores = useUserInfo();
 const { userInfos } = storeToRefs(stores);
@@ -289,6 +293,15 @@
     },
     dialogTableVisible:false
 })
+const daochuExcel=()=>{
+	let table = document.getElementById('tabledome');
+      if (table) {
+		const wb = XLSX.utils.table_to_book(table, { sheet: "Sheet1" });
+      	XLSX.writeFile(wb, "患者健康服务统计.xlsx"); // 文件名和扩展名可以根据需要更改
+      } else {
+        console.error("找不到指定的表格");
+      }
+}
 const onSubmit=()=>{
 	const pasm={
 		startTime:state.formInline.date[0]+ ' 00:00:00',
@@ -297,9 +310,16 @@
 		queryValue:''
 	}
 	console.log(pasm)
+	const loading = ElLoading.service({
+		lock: true,
+		text: 'Loading',
+		background: 'rgba(0, 0, 0, 0.7)',
+	})
 	nutritionalSummary(pasm).then(re=>{
 		console.log(re.data)
 		state.tableData=re.data
+	}).finally(()=>{
+		loading.close()
 	})
 
 }

--
Gitblit v1.8.0