From a6f64303f88508d1c4d6ce53ff46be6b745cfb93 Mon Sep 17 00:00:00 2001
From: chenyc <501753378@qq.com>
Date: 星期二, 14 十月 2025 15:21:59 +0800
Subject: [PATCH] 完成营养师管理

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

diff --git a/src/views/tongji/index.vue b/src/views/tongji/index.vue
index b660912..79a3a4b 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}">
@@ -27,7 +30,7 @@
 				</tr>
 				<tr>
 					<td colspan="10">服务单位:{{clientName}}</td>
-					<td colspan="22">服务期({{state.formInline.date[0]}}到{{state.formInline.date[2]}})</td>
+					<td colspan="22">服务期({{state.formInline.date[0]}}到{{state.formInline.date[1]}})</td>
 				</tr>
 				<tr>
 					<th rowspan="2">序号</th>
@@ -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