From 02d6c44956782a809153ce71393f9022dba24ec5 Mon Sep 17 00:00:00 2001 From: yy <11@11.com> Date: Mon, 3 Jun 2024 10:38:33 +0800 Subject: [PATCH] =?UTF-8?q?=E7=97=85=E4=BA=BA=E4=BF=A1=E6=81=AF=E6=B2=A1?= =?UTF-8?q?=E7=94=A8=E5=AD=97=E6=AE=B5=E7=A7=BB=E9=99=A4=20=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/table-util.ts | 60 ++++++++-------- src/views/logs-manage/form/log-form.vue | 30 ++++---- src/views/logs-manage/logs-manage.vue | 5 +- .../patients-manage/form/patients-form.vue | 70 ++++++------------- src/views/patients-manage/surgery-info.vue | 2 +- src/views/remote-manage/remote-control.vue | 4 +- 6 files changed, 72 insertions(+), 99 deletions(-) diff --git a/src/utils/table-util.ts b/src/utils/table-util.ts index b784748..1ff1d6c 100644 --- a/src/utils/table-util.ts +++ b/src/utils/table-util.ts @@ -1,24 +1,24 @@ import * as XLSX from "xlsx" -import { ElMessage, ElMessageBox } from 'element-plus' -import { dateFormater } from '@/utils/date-util' +import {ElMessage, ElMessageBox} from 'element-plus' +import {dateFormater} from '@/utils/date-util' import {downBlobFile} from "@/utils/file-util"; export const tableRemoveRow = (params: any, callback: (res: boolean) => void) => { if (!params.data) params.data = [] if (Array.isArray(params.data)) { if (params.data.length < 1) { - ElMessageBox.alert('请至少选择一条数据进行删除', '系统提醒', { type: 'warning', draggable: true }) + ElMessageBox.alert('请至少选择一条数据进行删除', '系统提醒', {type: 'warning', draggable: true}) return callback(false) } ElMessageBox.confirm( - params.batchRemoveTip || '是否确认删除选中的' + params.data.length + '条数据?此操作将永久删除', - '系统提醒', - { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', - draggable: true - } + params.batchRemoveTip || '是否确认删除选中的' + params.data.length + '条数据?此操作将永久删除', + '系统提醒', + { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning', + draggable: true + } ).then(() => { callback(true) }).catch(() => { @@ -26,14 +26,14 @@ export const tableRemoveRow = (params: any, callback: (res: boolean) => void) => }) } else { ElMessageBox.confirm( - params.removeTip || '此操作将永久删除', - '系统提醒', - { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', - draggable: true - } + params.removeTip || '此操作将永久删除', + '系统提醒', + { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning', + draggable: true + } ).then(() => { callback(true) }).catch(() => { @@ -47,25 +47,23 @@ export const exportData = (fileName: string, data: Array) => { deptId: "", phone: "", username: "" - }, "users.xlsx") + }, "users.xlsx") } /** - * - * @param fileName - * @param data + * + * @param fileName + * @param data * @param sheetNameKey data中的键名 对应表页名称 * @param sheetDataKey data中的键名 对应表数据 */ -export const exportMultiData = (fileName: string, data: Array, sheetNameKey: string, sheetDataKey: string) => { - if(data.length < 1) return +export const exportMultiData = (fileName: string, data: Array) => { + if (data.length < 1) return const wb = XLSX.utils.book_new(); - data.forEach(item => { - XLSX.utils.book_append_sheet( + XLSX.utils.book_append_sheet( wb, - XLSX.utils.json_to_sheet(item[sheetDataKey]), - item[sheetNameKey] instanceof Date ? dateFormater('yyyy-MM-dd HH:mm:ss', item[sheetNameKey]) : item[sheetNameKey] - ) - }) + XLSX.utils.json_to_sheet(data), + "Sheet1" + ) XLSX.writeFile(wb, fileName + '.xls'); // 导出Excel } \ No newline at end of file diff --git a/src/views/logs-manage/form/log-form.vue b/src/views/logs-manage/form/log-form.vue index 926e7f3..6d5f2de 100644 --- a/src/views/logs-manage/form/log-form.vue +++ b/src/views/logs-manage/form/log-form.vue @@ -1,30 +1,30 @@