引入导出原始数据接口
This commit is contained in:
@@ -47,6 +47,13 @@ export const getTableData = (params: {
|
|||||||
return http.post("/result/resultData/", params, {loading: false});
|
return http.post("/result/resultData/", params, {loading: false});
|
||||||
}
|
}
|
||||||
|
|
||||||
export const exportRawData= () => {
|
export const exportRawData = (params: {
|
||||||
return http.download("/result/exportRawData", {loading: false});
|
scriptType: string | null,
|
||||||
|
scriptId: string,
|
||||||
|
devId: string,
|
||||||
|
devNum: string,
|
||||||
|
code: number,
|
||||||
|
index: number,
|
||||||
|
}) => {
|
||||||
|
return http.download("/result/exportRawData", params, {loading: false});
|
||||||
}
|
}
|
||||||
@@ -22,14 +22,14 @@
|
|||||||
<script lang="tsx" setup>
|
<script lang="tsx" setup>
|
||||||
import {CheckData} from "@/api/check/interface";
|
import {CheckData} from "@/api/check/interface";
|
||||||
import {computed} from "vue";
|
import {computed} from "vue";
|
||||||
import {useDownload} from "@/hooks/useDownload";
|
|
||||||
import {exportRawData} from "@/api/check/test"
|
|
||||||
|
|
||||||
const {tableData, currentScriptTypeName} = defineProps<{
|
const {tableData, currentScriptTypeName} = defineProps<{
|
||||||
tableData: CheckData.RawDataItem[]
|
tableData: CheckData.RawDataItem[]
|
||||||
currentScriptTypeName: string
|
currentScriptTypeName: string
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
|
const emit = defineEmits(['exportRawDataHandler'])
|
||||||
|
|
||||||
const unit = computed(() => {
|
const unit = computed(() => {
|
||||||
return tableData.length > 0 ? tableData[0].unit : '';
|
return tableData.length > 0 ? tableData[0].unit : '';
|
||||||
})
|
})
|
||||||
@@ -47,7 +47,7 @@ const tableHeader = computed(() => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const exportData = () => {
|
const exportData = () => {
|
||||||
useDownload(exportRawData, '原始数据.xlsx', {}, false, '.xlsx')
|
emit('exportRawDataHandler')
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -99,6 +99,8 @@ import {CheckData} from "@/api/check/interface";
|
|||||||
import {useDictStore} from "@/stores/modules/dict";
|
import {useDictStore} from "@/stores/modules/dict";
|
||||||
import {useCheckStore} from "@/stores/modules/check";
|
import {useCheckStore} from "@/stores/modules/check";
|
||||||
import {getFormData, getTreeData, getTableData} from "@/api/check/test";
|
import {getFormData, getTreeData, getTableData} from "@/api/check/test";
|
||||||
|
import {useDownload} from "@/hooks/useDownload";
|
||||||
|
import {exportRawData} from "@/api/check/test"
|
||||||
|
|
||||||
const {appendToBody} = withDefaults(defineProps<{
|
const {appendToBody} = withDefaults(defineProps<{
|
||||||
appendToBody: boolean
|
appendToBody: boolean
|
||||||
@@ -503,6 +505,17 @@ const setCheckResultData = (data: CheckData.ResCheckResult | null) => {
|
|||||||
Object.assign(checkResultData, result)
|
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) => {
|
const formatHarmNum = (num: string) => {
|
||||||
// debugger
|
// debugger
|
||||||
if (num.includes('.5')) {
|
if (num.includes('.5')) {
|
||||||
|
|||||||
Reference in New Issue
Block a user