报告生成

This commit is contained in:
caozehui
2025-01-13 09:59:05 +08:00
parent ae1507e775
commit 4bb4eb80d9

View File

@@ -260,6 +260,8 @@ import {CheckData} from '@/api/check/interface'
import socketClient from '@/utils/webSocketClient'; import socketClient from '@/utils/webSocketClient';
import auth from "@/directives/modules/auth"; import auth from "@/directives/modules/auth";
import { useAuthStore } from "@/stores/modules/auth"; import { useAuthStore } from "@/stores/modules/auth";
import { useDownload } from '@/hooks/useDownload'
import {downloadDevData} from '@/api/plan/plan.ts'
const dictStore = useDictStore() const dictStore = useDictStore()
const checkStore = useCheckStore() const checkStore = useCheckStore()
@@ -1000,7 +1002,8 @@ const openDrawer = (title: string, row: any) => {
if(title === '生成') if(title === '生成')
{ {
reportDialogVisible.value = true; //reportDialogVisible.value = true;
useDownload(downloadDevData,'调试报告'+formatDate(new Date()), {planId:checkStore.planId,devId:row.id}, false,'.docx')
} }
if(title === '检测数据查询') if(title === '检测数据查询')
@@ -1027,6 +1030,17 @@ const openDrawer = (title: string, row: any) => {
} }
} }
function formatDate(date : Date) {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始需要加1
const day = String(date.getDate()).padStart(2, '0');
const hours = String(date.getHours()).padStart(2, '0');
const minutes = String(date.getMinutes()).padStart(2, '0');
const seconds = String(date.getSeconds()).padStart(2, '0');
return `${year}${month}${day}${hours}${minutes}${seconds}`;
}
// 监听 props.id 的变化 // 监听 props.id 的变化
watch( watch(
() => props.id, () => props.id,