From 6af69269a2f8ae6bde3c01ac26a49df5f518950b Mon Sep 17 00:00:00 2001
From: Euni4U <958079825@qq.com>
Date: Mon, 21 Apr 2025 14:57:29 +0800
Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AF=BC=E5=87=BA=E6=8C=89?=
=?UTF-8?q?=E9=92=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Inspection-checklist.vue | 43 +++++++++++++++++++
1 file changed, 43 insertions(+)
diff --git a/src/views/Inspection-checklist/Inspection-checklist.vue b/src/views/Inspection-checklist/Inspection-checklist.vue
index 297b5fd..7f6ad60 100644
--- a/src/views/Inspection-checklist/Inspection-checklist.vue
+++ b/src/views/Inspection-checklist/Inspection-checklist.vue
@@ -86,6 +86,11 @@ v-loading.fullscreen.lock="fullscreenLoading"
@change="uploadFile"
/>
+
+
+ 导出Excel
+
+
@@ -197,12 +202,16 @@ import template from "@/views/summary/print/template";
import barcode from "@/views/summary/print/barcode";
import IDCardReader from '@/components/IDCardReader.vue';
import sdk from '@/components/IDCardReader/sdk';
+import download from '@/utils/download' // 添加下载工具导入
+import { ElMessageBox } from 'element-plus' // 添加 ElMessageBox 导入
+
defineOptions({ name: 'Department' })
const message = useMessage() // 消息弹窗
const loading = ref(true) // 列表的加载中
const importLoading = ref(false) // 导入Excel的加载状态
const fullscreenLoading = ref(false) // 全屏加载状态
+const exportLoading = ref(false) // 导出Excel的加载状态
const list = ref([]) // 用于展示的数据
const total = ref(0) // 列表的总页数
const queryParams = reactive({
@@ -701,4 +710,38 @@ const handleDateChange = (val: [string, string] | null) => {
queryParams.printTimeRange = undefined
}
}
+
+/** 导出按钮操作 */
+const handleExport = async () => {
+ try {
+ // 使用 ElMessageBox 实现确认对话框
+ await ElMessageBox.confirm(
+ `是否导出当前${total.value}条患者数据?`,
+ '导出确认',
+ {
+ confirmButtonText: '确定',
+ cancelButtonText: '取消',
+ type: 'warning',
+ dangerouslyUseHTMLString: true // 允许使用 HTML 标签
+ }
+ )
+ // 发起导出
+ exportLoading.value = true
+ const data = await PatientApi.exportPatient({
+ ...queryParams,
+ pName: queryParams.pname?.trim() || undefined,
+ isprint: queryParams.isprint || undefined,
+ printTimeRange: queryParams.printTimeRange
+ })
+ download.excel(data, '患者信息.xls')
+ } catch (error: any) {
+ // 只有当错误不是用户取消操作时才显示错误提示
+ if (error !== 'cancel') {
+ console.error('导出失败:', error)
+ message.error(`导出失败: ${error.message || '未知错误'}`)
+ }
+ } finally {
+ exportLoading.value = false
+ }
+}