引入导出原始数据接口

This commit is contained in:
caozehui
2025-01-21 14:52:44 +08:00
parent cce3e6861a
commit 400328d5fa
3 changed files with 33 additions and 13 deletions

View File

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