diff --git a/frontend/src/api/report.js b/frontend/src/api/report.js new file mode 100644 index 0000000..e4eefa2 --- /dev/null +++ b/frontend/src/api/report.js @@ -0,0 +1,43 @@ +import service, { requestWithRetry } from './index' + +/** + * 开始报告生成 + * @param {Object} data - { simulation_id, force_regenerate? } + */ +export const generateReport = (data) => { + return requestWithRetry(() => service.post('/api/report/generate', data), 3, 1000) +} + +/** + * 获取报告生成状态 + * @param {string} reportId + */ +export const getReportStatus = (reportId) => { + return service.get(`/api/report/generate/status`, { params: { report_id: reportId } }) +} + +/** + * 获取 Agent 日志(增量) + * @param {string} reportId + * @param {number} fromLine - 从第几行开始获取 + */ +export const getAgentLog = (reportId, fromLine = 0) => { + return service.get(`/api/report/${reportId}/agent-log`, { params: { from_line: fromLine } }) +} + +/** + * 获取控制台日志(增量) + * @param {string} reportId + * @param {number} fromLine - 从第几行开始获取 + */ +export const getConsoleLog = (reportId, fromLine = 0) => { + return service.get(`/api/report/${reportId}/console-log`, { params: { from_line: fromLine } }) +} + +/** + * 获取报告详情 + * @param {string} reportId + */ +export const getReport = (reportId) => { + return service.get(`/api/report/${reportId}`) +} diff --git a/frontend/src/components/Step3Simulation.vue b/frontend/src/components/Step3Simulation.vue index cbaeab6..a692442 100644 --- a/frontend/src/components/Step3Simulation.vue +++ b/frontend/src/components/Step3Simulation.vue @@ -93,10 +93,12 @@
@@ -285,12 +287,14 @@ + + diff --git a/frontend/src/router/index.js b/frontend/src/router/index.js index beabb64..7616224 100644 --- a/frontend/src/router/index.js +++ b/frontend/src/router/index.js @@ -3,6 +3,7 @@ import Home from '../views/Home.vue' import Process from '../views/MainView.vue' import SimulationView from '../views/SimulationView.vue' import SimulationRunView from '../views/SimulationRunView.vue' +import ReportView from '../views/ReportView.vue' const routes = [ { @@ -27,6 +28,12 @@ const routes = [ name: 'SimulationRun', component: SimulationRunView, props: true + }, + { + path: '/report/:reportId', + name: 'Report', + component: ReportView, + props: true } ] diff --git a/frontend/src/views/ReportView.vue b/frontend/src/views/ReportView.vue new file mode 100644 index 0000000..f16caf7 --- /dev/null +++ b/frontend/src/views/ReportView.vue @@ -0,0 +1,348 @@ + + + + + diff --git a/frontend/src/views/SimulationRunView.vue b/frontend/src/views/SimulationRunView.vue index a707220..c3c5610 100644 --- a/frontend/src/views/SimulationRunView.vue +++ b/frontend/src/views/SimulationRunView.vue @@ -193,9 +193,9 @@ const handleGoBack = async () => { } const handleNextStep = () => { + // Step3Simulation 组件会直接处理报告生成和路由跳转 + // 这个方法仅作为备用 addLog('进入 Step 4: 报告生成') - // TODO: 跳转到 Step 4 报告生成页面 - alert('Step 4: 报告生成 - Coming soon...') } // --- Data Logic ---