From 64334ba4e3d0267df6fc84cfb24bf9dd3c41a973 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wei=5F=E4=BD=B3?= Date: Thu, 27 Nov 2025 15:49:18 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E4=BC=B0=E5=80=BC?= =?UTF-8?q?=E6=8A=A5=E5=91=8A=E8=8E=B7=E5=8F=96=E4=B8=8E=E5=B1=95=E7=A4=BA?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=EF=BC=8C=E5=B9=B6=E5=9C=A8=E5=AE=A1=E8=AE=A1?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E9=A1=B5=E6=B7=BB=E5=8A=A0=E8=AE=A1=E7=AE=97?= =?UTF-8?q?=E6=B5=81=E7=A8=8Btab=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/api/index.js | 1 + web/src/utils/http/interceptors.js | 5 ++- .../audit/components/AuditDetail.vue | 33 ++++++++++++++++--- 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/web/src/api/index.js b/web/src/api/index.js index 1b92614..ec1734d 100644 --- a/web/src/api/index.js +++ b/web/src/api/index.js @@ -68,5 +68,6 @@ export default { request.post(`/valuations/${data.valuation_id || data.id}/reject`, { admin_notes: data.admin_notes }), updateValuationNotes: (data = {}) => request.put(`/valuations/${data.valuation_id || data.id}/admin-notes`, { admin_notes: data.admin_notes }), + getValuationReport: (params = {}) => request.get(`/valuations/${params.valuation_id || params.id}/report`, { isRaw: true }), sendSmsReport: (data = {}) => request.post('/sms/send-report', data), } diff --git a/web/src/utils/http/interceptors.js b/web/src/utils/http/interceptors.js index e782eba..aa2ab19 100644 --- a/web/src/utils/http/interceptors.js +++ b/web/src/utils/http/interceptors.js @@ -21,7 +21,10 @@ export function reqReject(error) { } export function resResolve(response) { - const { data, status, statusText } = response + const { data, status, statusText, config } = response + if (config?.isRaw) { + return Promise.resolve(data) + } if (data?.code !== 200) { const code = data?.code ?? status /** 根据code处理对应的操作,并返回处理后的message */ diff --git a/web/src/views/valuation/audit/components/AuditDetail.vue b/web/src/views/valuation/audit/components/AuditDetail.vue index fec3c02..61887f6 100644 --- a/web/src/views/valuation/audit/components/AuditDetail.vue +++ b/web/src/views/valuation/audit/components/AuditDetail.vue @@ -42,6 +42,8 @@ const emit = defineEmits(['back', 'approve', 'reject']) const $message = useMessage() const activeDetailTab = ref('audit') +const reportLoading = ref(false) +const reportContent = ref('') const pickFilledValue = (...values) => values.find((val) => val !== undefined && val !== null && val !== '') const formatEnumField = (key, ...values) => formatEnumByKey(pickFilledValue(...values), key) @@ -55,9 +57,34 @@ watch( () => props.detailData?.id, () => { activeDetailTab.value = 'audit' + reportContent.value = '' } ) +// 监听 tab 切换,当切换到计算流程时加载报告 +watch(activeDetailTab, async (newTab) => { + if (newTab === 'flow' && props.detailData?.id && !reportContent.value) { + await fetchReport() + } +}) + +// 获取报告内容 +const fetchReport = async () => { + if (!props.detailData?.id) return + + reportLoading.value = true + try { + const response = await api.getValuationReport({ valuation_id: props.detailData.id }) + reportContent.value = response.data || response || '' + } catch (error) { + console.error('获取报告失败:', error) + $message.error('获取报告失败') + reportContent.value = '# 获取报告失败\n\n请稍后重试' + } finally { + reportLoading.value = false + } +} + const detailSections = computed(() => { const detail = props.detailData if (!detail) return [] @@ -232,10 +259,8 @@ const calcFlow = computed(() => props.detailData?.calculation_result?.flow || [] -const mockFlowHtml = ref(mockReportMarkdown) - const renderedFlowHtml = computed(() => { - return marked.parse(mockFlowHtml.value) + return marked.parse(reportContent.value || mockReportMarkdown) }) @@ -351,7 +376,7 @@ const handleCertificateConfirm = async (data) => { - +