diff --git a/src/pages/deviceInfo/components/TestInfo.vue b/src/pages/deviceInfo/components/TestInfo.vue index cc7015a..e7cd1b0 100644 --- a/src/pages/deviceInfo/components/TestInfo.vue +++ b/src/pages/deviceInfo/components/TestInfo.vue @@ -73,7 +73,11 @@ import { updateTestSheetStatus, } from '@/api/module/eam/device/template' import { isResError, useMessage } from '@/hooks/useMessage' -import { getDeviceTestSheet, type IDevice } from '@/api/module/eam/device' +import { + getDeviceReportPDF, + getDeviceTestSheet, + type IDevice, +} from '@/api/module/eam/device' import { useRoute } from 'vue-router' import testSheetInfoDlg from './testSheetInfoDlg.vue' const route = useRoute() @@ -126,11 +130,24 @@ const isShowDetail = ref(false) const sheetDetail = ref([]) const curSheetDetailName = ref() async function loadSheetDetail(row: any) { - const res = await getSheetDetail(row.id) + // const res = await getSheetDetail(row.id) + // if (isResError(res)) return + // sheetDetail.value = res.data + // isShowDetail.value = true + // curSheetDetailName.value = row.name + onPrintReport() +} + +async function onPrintReport() { + // setLoadingPrint() + const res = await getDeviceReportPDF(props.deviceId) + // closeLoadingPrint() if (isResError(res)) return - sheetDetail.value = res.data - isShowDetail.value = true - curSheetDetailName.value = row.name + const pdfURL = URL.createObjectURL(res.data) + const printWindow = window.open(pdfURL) as any + // printWindow.onload = () => { + // printWindow.print() + // } } watch(