feat: 添加编码查询日志导出
This commit is contained in:
parent
2a93ad5b87
commit
9cf28df363
@ -39,6 +39,8 @@ buttons:Linked: Linked
|
||||
buttons:More: More
|
||||
buttons:Deselect: Deselect
|
||||
buttons:DeleteInBatches: Delete In Batches
|
||||
buttons:ExportInBatches: Export In Batches
|
||||
buttons:ExportAll: Export All
|
||||
buttons:UploadAvatar: Upload Avatar
|
||||
buttons:ResetPassword: Reset Password
|
||||
buttons:RoleAllocation: Role Allocation
|
||||
|
@ -39,6 +39,8 @@ buttons:Linked: 联动
|
||||
buttons:More: 更多
|
||||
buttons:Deselect: 取消选择
|
||||
buttons:DeleteInBatches: 批量删除
|
||||
buttons:ExportInBatches: 批量导出
|
||||
buttons:ExportAll: 全部导出
|
||||
buttons:UploadAvatar: 上传头像
|
||||
buttons:ResetPassword: 重置密码
|
||||
buttons:RoleAllocation: 角色分配
|
||||
|
@ -128,3 +128,17 @@ export const getCodeLogListAPI = (params: {
|
||||
export const getCodeLogInfoAPI = (id: string) => {
|
||||
return http.request<QueryCodeLogInfo>("get", `/api/code/logInfo/${id}`);
|
||||
};
|
||||
|
||||
/**获取所有查询编码列表 */
|
||||
export const getCodeLogListAllAPI = (params: {
|
||||
startTime?: string;
|
||||
endTime?: string;
|
||||
}) => {
|
||||
return http.request<QueryListResult<QueryCodeLogInfo>>(
|
||||
"get",
|
||||
`/api/code/logList/all`,
|
||||
{
|
||||
params: filterEmptyObject(params)
|
||||
}
|
||||
);
|
||||
};
|
||||
|
@ -32,7 +32,7 @@
|
||||
</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
:icon="useRenderIcon(AddFill)"
|
||||
:icon="useRenderIcon(UploadIcon)"
|
||||
@click="showUploadArea = !showUploadArea"
|
||||
>
|
||||
{{ showUploadArea ? t("buttons:Hide") : t("buttons:Import") }}
|
||||
@ -45,6 +45,7 @@
|
||||
ref="uploadRef"
|
||||
v-model:file-list="fileList"
|
||||
drag
|
||||
:limit="1"
|
||||
action="#"
|
||||
class="w-full"
|
||||
:auto-upload="false"
|
||||
@ -98,8 +99,12 @@
|
||||
</el-card>
|
||||
<PureTableBar title="查询结果" :columns="columns" @refresh="onSearch">
|
||||
<template #buttons>
|
||||
<el-button type="primary" :icon="useRenderIcon(AddFill)">
|
||||
{{ t("buttons:Export") }}
|
||||
<el-button
|
||||
type="primary"
|
||||
:icon="useRenderIcon(Export)"
|
||||
@click="exportToExcel([queryResult], '查询结果')"
|
||||
>
|
||||
{{ t("buttons:ExportAll") }}
|
||||
</el-button>
|
||||
</template>
|
||||
<template v-slot="{ size, dynamicColumns }">
|
||||
@ -119,10 +124,10 @@
|
||||
{{ t("buttons:Deselect") }}
|
||||
</el-button>
|
||||
</div>
|
||||
<el-popconfirm title="是否确认删除?">
|
||||
<el-popconfirm title="是否确认导出?" @confirm="onbatchExport">
|
||||
<template #reference>
|
||||
<el-button type="danger" text class="mr-1">
|
||||
{{ t("buttons:DeleteInBatches") }}
|
||||
<el-button type="primary" text class="mr-1">
|
||||
{{ t("buttons:ExportInBatches") }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-popconfirm>
|
||||
@ -210,11 +215,10 @@ import { useIndex } from "./utils/hook";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { PureTableBar } from "@/components/RePureTableBar";
|
||||
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
|
||||
import Delete from "@iconify-icons/ep/delete";
|
||||
import EditPen from "@iconify-icons/ep/edit-pen";
|
||||
import Refresh from "@iconify-icons/ep/refresh";
|
||||
import AddFill from "@iconify-icons/ri/add-circle-line";
|
||||
import UploadIcon from "@iconify-icons/ri/upload-2-line";
|
||||
import Export from "@iconify-icons/ri/download-2-line";
|
||||
const { t } = useI18n();
|
||||
/**
|
||||
* 表格Ref
|
||||
@ -244,7 +248,9 @@ const {
|
||||
handleSelectionChange,
|
||||
onSelectionCancel,
|
||||
onDownloadTemplate,
|
||||
handleDetail
|
||||
handleDetail,
|
||||
exportToExcel,
|
||||
onbatchExport
|
||||
} = useIndex(tableRef);
|
||||
</script>
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { message } from "@/utils/message";
|
||||
import { type Ref, ref, reactive } from "vue";
|
||||
import * as XLSX from "xlsx";
|
||||
import type { PaginationProps } from "@pureadmin/table";
|
||||
import type { QueryCodeResult, QueryResult, QueryResultItem } from "types/code";
|
||||
import {
|
||||
@ -13,6 +14,7 @@ import {
|
||||
postCodeInfoAPI
|
||||
} from "@/api/code";
|
||||
import { deleteFileAPI, postUploadFileAPI } from "@/api/file";
|
||||
import { getKeyList, cloneDeep } from "@pureadmin/utils";
|
||||
|
||||
export const useIndex = (tableRef: Ref) => {
|
||||
/**
|
||||
@ -253,6 +255,102 @@ export const useIndex = (tableRef: Ref) => {
|
||||
drawerStatus.value = true;
|
||||
Object.assign(rowInfo, row);
|
||||
};
|
||||
/**导出为excel */
|
||||
const exportToExcel = (dataList: QueryCodeResult[], filename: string) => {
|
||||
if (dataList.length) {
|
||||
const headers = [
|
||||
"序号",
|
||||
"查询批次ID",
|
||||
"查询文本(总)",
|
||||
"查询统计",
|
||||
"结果统计",
|
||||
"查询状态",
|
||||
"耗时(毫秒)",
|
||||
"操作时间",
|
||||
"待查询文本ID",
|
||||
"待查询文本",
|
||||
"查询结果状态"
|
||||
];
|
||||
for (let i = 1; i <= 5; i++) {
|
||||
headers.push(
|
||||
`匹配结果ID${i}`,
|
||||
`匹配编码${i}`,
|
||||
`匹配结果${i}`,
|
||||
`匹配率(百分比)${i}`
|
||||
);
|
||||
}
|
||||
const data = [];
|
||||
let index = 1;
|
||||
for (const jsonData of dataList) {
|
||||
const batchId = jsonData.id;
|
||||
const queryText = jsonData.query;
|
||||
const queryCount = jsonData.query_count;
|
||||
const resultCount = jsonData.result_count;
|
||||
const status = jsonData.status === 1 ? "成功" : "失败";
|
||||
const costTime = jsonData.cost_time;
|
||||
const operationTime = jsonData.operation_time;
|
||||
|
||||
jsonData.response_result.forEach(response => {
|
||||
const queryId = response.id;
|
||||
const queryTextDetail = response.query_text;
|
||||
const queryStatus = response.status === 1 ? "成功" : "失败";
|
||||
|
||||
const row = [
|
||||
index++,
|
||||
batchId,
|
||||
queryText,
|
||||
queryCount,
|
||||
resultCount,
|
||||
status,
|
||||
costTime,
|
||||
operationTime,
|
||||
queryId,
|
||||
queryTextDetail,
|
||||
queryStatus
|
||||
];
|
||||
|
||||
for (let i = 0; i < 5; i++) {
|
||||
if (i < response.result_text.length) {
|
||||
const match = response.result_text[i];
|
||||
row.push(
|
||||
match.id,
|
||||
match.code,
|
||||
match.description,
|
||||
match.match_rate
|
||||
);
|
||||
} else {
|
||||
row.push("", "", "", "");
|
||||
}
|
||||
}
|
||||
data.push(row);
|
||||
});
|
||||
}
|
||||
const worksheet = XLSX.utils.aoa_to_sheet([headers, ...data]);
|
||||
const workbook = XLSX.utils.book_new();
|
||||
XLSX.utils.book_append_sheet(workbook, worksheet, "Query Results");
|
||||
XLSX.writeFile(workbook, `${filename}.xlsx`);
|
||||
message("导出成功!", { type: "success" });
|
||||
}
|
||||
};
|
||||
/**批量导出 */
|
||||
const onbatchExport = async () => {
|
||||
// 获取当前选中的行
|
||||
const curSelected = tableRef.value.getTableRef().getSelectionRows();
|
||||
let dataJson = cloneDeep(queryResult.value); // 深拷贝,避免修改原数据
|
||||
|
||||
const ids = getKeyList(curSelected, "id");
|
||||
|
||||
let dataList = dataJson.response_result; // 拷贝的数据
|
||||
|
||||
let selecteList = dataList.filter((item: QueryResult) =>
|
||||
ids.includes(item.id)
|
||||
); // 筛选出选中的数据
|
||||
|
||||
// 仅赋值导出的数据,不修改原始数据
|
||||
let exportData = { ...dataJson, response_result: selecteList };
|
||||
|
||||
exportToExcel([exportData], "查询结果");
|
||||
};
|
||||
return {
|
||||
form,
|
||||
dataList,
|
||||
@ -276,6 +374,8 @@ export const useIndex = (tableRef: Ref) => {
|
||||
handleSelectionChange,
|
||||
onSelectionCancel,
|
||||
onDownloadTemplate,
|
||||
handleDetail
|
||||
handleDetail,
|
||||
exportToExcel,
|
||||
onbatchExport
|
||||
};
|
||||
};
|
||||
|
@ -18,8 +18,12 @@
|
||||
</el-card>
|
||||
<PureTableBar title="查询结果" :columns="columns">
|
||||
<template #buttons>
|
||||
<el-button type="primary" :icon="useRenderIcon(AddFill)">
|
||||
{{ t("buttons:Export") }}
|
||||
<el-button
|
||||
type="primary"
|
||||
:icon="useRenderIcon(Export)"
|
||||
@click="exportToExcel([queryInfo], '查询结果')"
|
||||
>
|
||||
{{ t("buttons:ExportAll") }}
|
||||
</el-button>
|
||||
</template>
|
||||
<template v-slot="{ size, dynamicColumns }">
|
||||
@ -39,10 +43,10 @@
|
||||
{{ t("buttons:Deselect") }}
|
||||
</el-button>
|
||||
</div>
|
||||
<el-popconfirm title="是否确认删除?">
|
||||
<el-popconfirm title="是否确认导出?" @confirm="onbatchExport">
|
||||
<template #reference>
|
||||
<el-button type="danger" text class="mr-1">
|
||||
{{ t("buttons:DeleteInBatches") }}
|
||||
<el-button type="primary" text class="mr-1">
|
||||
{{ t("buttons:ExportInBatches") }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-popconfirm>
|
||||
@ -127,14 +131,12 @@ import { ref, reactive, onMounted, h } from "vue";
|
||||
import { useRouter, useRoute } from "vue-router";
|
||||
import dayjs from "dayjs";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { isEmpty, isString } from "@pureadmin/utils";
|
||||
import * as XLSX from "xlsx";
|
||||
import { cloneDeep, getKeyList, isEmpty, isString } from "@pureadmin/utils";
|
||||
import { PureTableBar } from "@/components/RePureTableBar";
|
||||
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
|
||||
// import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
|
||||
import EditPen from "@iconify-icons/ep/edit-pen";
|
||||
import Refresh from "@iconify-icons/ep/refresh";
|
||||
import AddFill from "@iconify-icons/ri/add-circle-line";
|
||||
// import { $t } from "@/plugins/i18n";
|
||||
import Export from "@iconify-icons/ri/download-2-line";
|
||||
import type {
|
||||
QueryCodeLogInfo,
|
||||
QueryResult,
|
||||
@ -142,6 +144,7 @@ import type {
|
||||
} from "types/code";
|
||||
import { getCodeLogInfoAPI } from "@/api/code";
|
||||
import { PaginationProps } from "@pureadmin/table";
|
||||
import { message } from "@/utils/message";
|
||||
const { t } = useI18n();
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
@ -252,6 +255,115 @@ const onSelectionCancel = async () => {
|
||||
// 用于多选表格,清空用户的选择
|
||||
tableRef.value.getTableRef().clearSelection();
|
||||
};
|
||||
/**导出为excel */
|
||||
const exportToExcel = (dataList: QueryCodeLogInfo[], filename: string) => {
|
||||
if (dataList.length) {
|
||||
const headers = [
|
||||
"序号",
|
||||
"查询批次ID",
|
||||
"查询人ID",
|
||||
"查询人账号",
|
||||
"查询人昵称",
|
||||
"查询人部门ID",
|
||||
"查询人部门",
|
||||
"查询文本(总)",
|
||||
"查询统计",
|
||||
"结果统计",
|
||||
"查询状态",
|
||||
"耗时(毫秒)",
|
||||
"操作时间",
|
||||
"待查询文本ID",
|
||||
"待查询文本",
|
||||
"查询结果状态"
|
||||
];
|
||||
for (let i = 1; i <= 5; i++) {
|
||||
headers.push(
|
||||
`匹配结果ID${i}`,
|
||||
`匹配编码${i}`,
|
||||
`匹配结果${i}`,
|
||||
`匹配率(百分比)${i}`
|
||||
);
|
||||
}
|
||||
const data = [];
|
||||
let index = 1;
|
||||
for (const jsonData of dataList) {
|
||||
const batchId = jsonData.id;
|
||||
const opeartion_id = jsonData.operator_id;
|
||||
const opeartion_name = jsonData.operator_name;
|
||||
const opeartion_nickname = jsonData.operator_nickname;
|
||||
const department_id = jsonData.department_id;
|
||||
const department_name = jsonData.department_name;
|
||||
const queryText = jsonData.request_params;
|
||||
const queryCount = jsonData.query_count;
|
||||
const resultCount = jsonData.result_count;
|
||||
const status = jsonData.status === 1 ? "成功" : "失败";
|
||||
const costTime = jsonData.cost_time;
|
||||
const operationTime = jsonData.operation_time;
|
||||
jsonData.response_result = JSON.parse(
|
||||
jsonData.response_result.replace(/'/g, '"').replace(/None/g, "null")
|
||||
);
|
||||
// @ts-ignore
|
||||
jsonData.response_result.forEach(response => {
|
||||
const queryId = response.id;
|
||||
const queryTextDetail = response.query_text;
|
||||
const queryStatus = response.status === 1 ? "成功" : "失败";
|
||||
|
||||
const row = [
|
||||
index++,
|
||||
batchId,
|
||||
opeartion_id,
|
||||
opeartion_name,
|
||||
opeartion_nickname,
|
||||
department_id,
|
||||
department_name,
|
||||
queryText,
|
||||
queryCount,
|
||||
resultCount,
|
||||
status,
|
||||
costTime,
|
||||
operationTime,
|
||||
queryId,
|
||||
queryTextDetail,
|
||||
queryStatus
|
||||
];
|
||||
|
||||
for (let i = 0; i < 5; i++) {
|
||||
if (i < response.result_text.length) {
|
||||
const match = response.result_text[i];
|
||||
row.push(match.id, match.code, match.description, match.match_rate);
|
||||
} else {
|
||||
row.push("", "", "", "");
|
||||
}
|
||||
}
|
||||
data.push(row);
|
||||
});
|
||||
}
|
||||
const worksheet = XLSX.utils.aoa_to_sheet([headers, ...data]);
|
||||
const workbook = XLSX.utils.book_new();
|
||||
XLSX.utils.book_append_sheet(workbook, worksheet, "Query Results");
|
||||
XLSX.writeFile(workbook, `${filename}.xlsx`);
|
||||
message("导出成功!", { type: "success" });
|
||||
}
|
||||
};
|
||||
/**批量导出 */
|
||||
const onbatchExport = async () => {
|
||||
// 获取当前选中的行
|
||||
const curSelected = tableRef.value.getTableRef().getSelectionRows();
|
||||
let dataJson = cloneDeep(queryInfo.value); // 深拷贝,避免修改原数据
|
||||
|
||||
const ids = getKeyList(curSelected, "id");
|
||||
|
||||
let dataList = dataJson.response_result; // 拷贝的数据
|
||||
|
||||
let selecteList = dataList.filter((item: QueryResult) =>
|
||||
ids.includes(item.id)
|
||||
); // 筛选出选中的数据
|
||||
|
||||
// 仅赋值导出的数据,不修改原始数据
|
||||
let exportData = { ...dataJson, response_result: selecteList };
|
||||
|
||||
exportToExcel([exportData], "查询结果");
|
||||
};
|
||||
onMounted(async () => {
|
||||
await getQueryInfo();
|
||||
});
|
||||
|
@ -35,13 +35,16 @@
|
||||
|
||||
<PureTableBar title="操作日志" :columns="columns" @refresh="onSearch">
|
||||
<template #buttons>
|
||||
<!-- <el-popconfirm title="确定要删除所有日志数据吗?" @confirm="clearAll">
|
||||
<el-popconfirm
|
||||
title="确定要导出所有日志数据吗?"
|
||||
@confirm="onExportQueryAll"
|
||||
>
|
||||
<template #reference>
|
||||
<el-button type="danger" :icon="useRenderIcon(Delete)">
|
||||
清空日志
|
||||
<el-button type="primary" :icon="useRenderIcon(Export)">
|
||||
{{ t("buttons:ExportAll") }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-popconfirm> -->
|
||||
</el-popconfirm>
|
||||
</template>
|
||||
<template v-slot="{ size, dynamicColumns }">
|
||||
<div
|
||||
@ -60,10 +63,13 @@
|
||||
{{ t("buttons:Deselect") }}
|
||||
</el-button>
|
||||
</div>
|
||||
<el-popconfirm title="是否确认删除?">
|
||||
<el-popconfirm
|
||||
title="是否确认批量导出日志数据?"
|
||||
@confirm="onbatchExport"
|
||||
>
|
||||
<template #reference>
|
||||
<el-button type="danger" text class="mr-1">
|
||||
{{ t("buttons:DeleteInBatches") }}
|
||||
<el-button type="primary" text class="mr-1">
|
||||
{{ t("buttons:ExportInBatches") }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-popconfirm>
|
||||
@ -110,11 +116,10 @@
|
||||
defineOptions({
|
||||
name: "CodeQueryLog"
|
||||
});
|
||||
// import dayjs from "dayjs";
|
||||
import { ref } from "vue";
|
||||
import View from "@iconify-icons/ep/view";
|
||||
// import Delete from "@iconify-icons/ep/delete";
|
||||
import Refresh from "@iconify-icons/ep/refresh";
|
||||
import Export from "@iconify-icons/ri/download-2-line";
|
||||
import { PureTableBar } from "@/components/RePureTableBar";
|
||||
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
|
||||
import { isString } from "@pureadmin/utils";
|
||||
@ -141,7 +146,9 @@ const {
|
||||
handleSelectionChange,
|
||||
handleSizeChange,
|
||||
onSelectionCancel,
|
||||
getPickerShortcuts
|
||||
getPickerShortcuts,
|
||||
onExportQueryAll,
|
||||
onbatchExport
|
||||
} = useQueryLog(tableRef);
|
||||
/**处理详情 */
|
||||
const onClickDetails = (row: QueryCodeLogInfo) => {
|
||||
|
@ -8,7 +8,10 @@ import { usePublicHooks } from "@/views/system/hooks";
|
||||
import type { PaginationProps } from "@pureadmin/table";
|
||||
import { type Ref, reactive, ref, onMounted } from "vue";
|
||||
import type { QueryCodeLogInfo } from "types/code";
|
||||
import { getCodeLogListAPI } from "@/api/code";
|
||||
import * as XLSX from "xlsx";
|
||||
import { getCodeLogListAllAPI, getCodeLogListAPI } from "@/api/code";
|
||||
import { message } from "@/utils/message";
|
||||
import { cloneDeep, getKeyList } from "@pureadmin/utils";
|
||||
|
||||
export const useQueryLog = (tableRef: Ref) => {
|
||||
/**查询表单 */
|
||||
@ -294,7 +297,126 @@ export const useQueryLog = (tableRef: Ref) => {
|
||||
}
|
||||
];
|
||||
};
|
||||
/**导出为excel */
|
||||
const exportToExcel = (dataList: QueryCodeLogInfo[], filename: string) => {
|
||||
if (dataList.length) {
|
||||
const headers = [
|
||||
"序号",
|
||||
"查询批次ID",
|
||||
"查询人ID",
|
||||
"查询人账号",
|
||||
"查询人昵称",
|
||||
"查询人部门ID",
|
||||
"查询人部门",
|
||||
"查询文本(总)",
|
||||
"查询统计",
|
||||
"结果统计",
|
||||
"查询状态",
|
||||
"耗时(毫秒)",
|
||||
"操作时间",
|
||||
"待查询文本ID",
|
||||
"待查询文本",
|
||||
"查询结果状态"
|
||||
];
|
||||
for (let i = 1; i <= 5; i++) {
|
||||
headers.push(
|
||||
`匹配结果ID${i}`,
|
||||
`匹配编码${i}`,
|
||||
`匹配结果${i}`,
|
||||
`匹配率(百分比)${i}`
|
||||
);
|
||||
}
|
||||
const data = [];
|
||||
let index = 1;
|
||||
for (const jsonData of dataList) {
|
||||
const batchId = jsonData.id;
|
||||
const opeartion_id = jsonData.operator_id;
|
||||
const opeartion_name = jsonData.operator_name;
|
||||
const opeartion_nickname = jsonData.operator_nickname;
|
||||
const department_id = jsonData.department_id;
|
||||
const department_name = jsonData.department_name;
|
||||
const queryText = jsonData.request_params;
|
||||
const queryCount = jsonData.query_count;
|
||||
const resultCount = jsonData.result_count;
|
||||
const status = jsonData.status === 1 ? "成功" : "失败";
|
||||
const costTime = jsonData.cost_time;
|
||||
const operationTime = jsonData.operation_time;
|
||||
jsonData.response_result = JSON.parse(
|
||||
jsonData.response_result.replace(/'/g, '"').replace(/None/g, "null")
|
||||
);
|
||||
// @ts-ignore
|
||||
jsonData.response_result.forEach(response => {
|
||||
const queryId = response.id;
|
||||
const queryTextDetail = response.query_text;
|
||||
const queryStatus = response.status === 1 ? "成功" : "失败";
|
||||
|
||||
const row = [
|
||||
index++,
|
||||
batchId,
|
||||
opeartion_id,
|
||||
opeartion_name,
|
||||
opeartion_nickname,
|
||||
department_id,
|
||||
department_name,
|
||||
queryText,
|
||||
queryCount,
|
||||
resultCount,
|
||||
status,
|
||||
costTime,
|
||||
operationTime,
|
||||
queryId,
|
||||
queryTextDetail,
|
||||
queryStatus
|
||||
];
|
||||
|
||||
for (let i = 0; i < 5; i++) {
|
||||
if (i < response.result_text.length) {
|
||||
const match = response.result_text[i];
|
||||
row.push(
|
||||
match.id,
|
||||
match.code,
|
||||
match.description,
|
||||
match.match_rate
|
||||
);
|
||||
} else {
|
||||
row.push("", "", "", "");
|
||||
}
|
||||
}
|
||||
data.push(row);
|
||||
});
|
||||
}
|
||||
const worksheet = XLSX.utils.aoa_to_sheet([headers, ...data]);
|
||||
const workbook = XLSX.utils.book_new();
|
||||
XLSX.utils.book_append_sheet(workbook, worksheet, "Query Results");
|
||||
XLSX.writeFile(workbook, `${filename}.xlsx`);
|
||||
message("导出成功!", { type: "success" });
|
||||
}
|
||||
};
|
||||
/**导出所有查询结果 */
|
||||
const onExportQueryAll = async () => {
|
||||
const res = await getCodeLogListAllAPI({
|
||||
startTime: form.timeRange[0] ? form.timeRange[0] : null,
|
||||
endTime: form.timeRange[1] ? form.timeRange[1] : null
|
||||
});
|
||||
if (res.success) {
|
||||
exportToExcel(res.data.result, "全部查询结果");
|
||||
}
|
||||
};
|
||||
/**批量导出 */
|
||||
const onbatchExport = async () => {
|
||||
// 获取当前选中的行
|
||||
const curSelected = tableRef.value.getTableRef().getSelectionRows();
|
||||
|
||||
const ids = getKeyList(curSelected, "id");
|
||||
|
||||
let data = cloneDeep(dataList.value); // 拷贝的数据
|
||||
|
||||
let selecteList = data.filter((item: QueryCodeLogInfo) =>
|
||||
ids.includes(item.id)
|
||||
); // 筛选出选中的数据
|
||||
|
||||
exportToExcel(selecteList, "查询结果");
|
||||
};
|
||||
onMounted(async () => {
|
||||
await onSearch();
|
||||
});
|
||||
@ -311,6 +433,8 @@ export const useQueryLog = (tableRef: Ref) => {
|
||||
handleCurrentChange,
|
||||
handleSizeChange,
|
||||
handleSelectionChange,
|
||||
onSelectionCancel
|
||||
onSelectionCancel,
|
||||
onExportQueryAll,
|
||||
onbatchExport
|
||||
};
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user