引入导出原始数据接口
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});
|
||||||
}
|
}
|
||||||
@@ -21,15 +21,15 @@
|
|||||||
|
|
||||||
<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 : '';
|
||||||
})
|
})
|
||||||
@@ -39,7 +39,7 @@ const phaseT = computed(() => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const tableHeader = computed(() => {
|
const tableHeader = computed(() => {
|
||||||
if (phaseT.value === 1){
|
if (phaseT.value === 1) {
|
||||||
let index = currentScriptTypeName.indexOf('=');
|
let index = currentScriptTypeName.indexOf('=');
|
||||||
return currentScriptTypeName.substring(0, index);
|
return currentScriptTypeName.substring(0, index);
|
||||||
}
|
}
|
||||||
@@ -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
|
||||||
@@ -197,7 +199,7 @@ const handleNodeClick = async (data: any) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
watch(() => formContent.chnNum, async (newVal, oldVal) => {
|
watch(() => formContent.chnNum, async (newVal, oldVal) => {
|
||||||
// console.log("通道号", newVal);
|
// console.log("通道号", newVal);
|
||||||
|
|
||||||
if (newVal) {
|
if (newVal) {
|
||||||
// 发起请求,查询该测试项的检测结果
|
// 发起请求,查询该测试项的检测结果
|
||||||
@@ -239,7 +241,7 @@ watch(() => formContent.chnNum, async (newVal, oldVal) => {
|
|||||||
|
|
||||||
|
|
||||||
watch(currentCheckItem, (newVal, oldVal) => {
|
watch(currentCheckItem, (newVal, oldVal) => {
|
||||||
// console.log("当前检测项", newVal);
|
// console.log("当前检测项", newVal);
|
||||||
if (newVal) {
|
if (newVal) {
|
||||||
doCurrentCheckItemUpdate(newVal)
|
doCurrentCheckItemUpdate(newVal)
|
||||||
}
|
}
|
||||||
@@ -274,9 +276,9 @@ const defaultOperate = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const updateTableData = async () => {
|
const updateTableData = async () => {
|
||||||
// console.log("左侧树被选中的叶子节点checkIndex", checkIndex.value);
|
// console.log("左侧树被选中的叶子节点checkIndex", checkIndex.value);
|
||||||
if (checkIndex.value) {
|
if (checkIndex.value) {
|
||||||
// console.log("更新表格数据");
|
// console.log("更新表格数据");
|
||||||
// 发起请求,查询该测试项的检测结果
|
// 发起请求,查询该测试项的检测结果
|
||||||
const {data} = await getTableData({
|
const {data} = await getTableData({
|
||||||
scriptType,
|
scriptType,
|
||||||
@@ -503,8 +505,19 @@ 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')) {
|
||||||
return num
|
return num
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user