引入导出原始数据接口

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

@@ -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});
}

View File

@@ -22,14 +22,14 @@
<script lang="tsx" setup>
import {CheckData} from "@/api/check/interface";
import {computed} from "vue";
import {useDownload} from "@/hooks/useDownload";
import {exportRawData} from "@/api/check/test"
const {tableData, currentScriptTypeName} = defineProps<{
tableData: CheckData.RawDataItem[]
currentScriptTypeName: string
}>()
const emit = defineEmits(['exportRawDataHandler'])
const unit = computed(() => {
return tableData.length > 0 ? tableData[0].unit : '';
})
@@ -47,7 +47,7 @@ const tableHeader = computed(() => {
})
const exportData = () => {
useDownload(exportRawData, '原始数据.xlsx', {}, false, '.xlsx')
emit('exportRawDataHandler')
}
</script>

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
@@ -503,6 +505,17 @@ 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
if (num.includes('.5')) {