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 @@