From 400328d5fa128986417b8ea650f991c9eb9a08fd Mon Sep 17 00:00:00 2001 From: caozehui <2427765068@qq.com> Date: Tue, 21 Jan 2025 14:52:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=95=E5=85=A5=E5=AF=BC=E5=87=BA=E5=8E=9F?= =?UTF-8?q?=E5=A7=8B=E6=95=B0=E6=8D=AE=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/api/check/test/index.ts | 11 +++++++-- .../home/components/dataCheckRawDataTable.vue | 12 +++++----- .../dataCheckSingleChannelSingleTestPopup.vue | 23 +++++++++++++++---- 3 files changed, 33 insertions(+), 13 deletions(-) diff --git a/frontend/src/api/check/test/index.ts b/frontend/src/api/check/test/index.ts index aa1037f..a7a4de2 100644 --- a/frontend/src/api/check/test/index.ts +++ b/frontend/src/api/check/test/index.ts @@ -47,6 +47,13 @@ export const getTableData = (params: { return http.post("/result/resultData/", params, {loading: false}); } -export const exportRawData= () => { - return http.download("/result/exportRawData", {loading: false}); +export const exportRawData = (params: { + scriptType: string | null, + scriptId: string, + devId: string, + devNum: string, + code: number, + index: number, +}) => { + return http.download("/result/exportRawData", params, {loading: false}); } \ No newline at end of file diff --git a/frontend/src/views/home/components/dataCheckRawDataTable.vue b/frontend/src/views/home/components/dataCheckRawDataTable.vue index 67ffe43..b6d3095 100644 --- a/frontend/src/views/home/components/dataCheckRawDataTable.vue +++ b/frontend/src/views/home/components/dataCheckRawDataTable.vue @@ -21,15 +21,15 @@ diff --git a/frontend/src/views/home/components/dataCheckSingleChannelSingleTestPopup.vue b/frontend/src/views/home/components/dataCheckSingleChannelSingleTestPopup.vue index a78de70..8d85886 100644 --- a/frontend/src/views/home/components/dataCheckSingleChannelSingleTestPopup.vue +++ b/frontend/src/views/home/components/dataCheckSingleChannelSingleTestPopup.vue @@ -99,6 +99,8 @@ import {CheckData} from "@/api/check/interface"; import {useDictStore} from "@/stores/modules/dict"; import {useCheckStore} from "@/stores/modules/check"; import {getFormData, getTreeData, getTableData} from "@/api/check/test"; +import {useDownload} from "@/hooks/useDownload"; +import {exportRawData} from "@/api/check/test" const {appendToBody} = withDefaults(defineProps<{ appendToBody: boolean @@ -197,7 +199,7 @@ const handleNodeClick = async (data: any) => { }; watch(() => formContent.chnNum, async (newVal, oldVal) => { - // console.log("通道号", newVal); + // console.log("通道号", newVal); if (newVal) { // 发起请求,查询该测试项的检测结果 @@ -239,7 +241,7 @@ watch(() => formContent.chnNum, async (newVal, oldVal) => { watch(currentCheckItem, (newVal, oldVal) => { - // console.log("当前检测项", newVal); + // console.log("当前检测项", newVal); if (newVal) { doCurrentCheckItemUpdate(newVal) } @@ -274,9 +276,9 @@ const defaultOperate = () => { } const updateTableData = async () => { - // console.log("左侧树被选中的叶子节点checkIndex", checkIndex.value); + // console.log("左侧树被选中的叶子节点checkIndex", checkIndex.value); if (checkIndex.value) { - // console.log("更新表格数据"); + // console.log("更新表格数据"); // 发起请求,查询该测试项的检测结果 const {data} = await getTableData({ scriptType, @@ -503,8 +505,19 @@ const setCheckResultData = (data: CheckData.ResCheckResult | null) => { Object.assign(checkResultData, result) } +const exportRawDataHandler = () => { + useDownload(exportRawData, '原始数据.xlsx', { + scriptType, + scriptId: checkStore.scriptId, + devId: deviceId, + devNum: formContent.chnNum + '', + code: parseInt(checkStore.planCode), + index: parseInt(checkIndex.value), + }, false, '.xlsx') +} + const formatHarmNum = (num: string) => { - // debugger + // debugger if (num.includes('.5')) { return num } else {