feat: 新增估值报告获取与展示功能,并在审计详情页添加计算流程tab。
This commit is contained in:
parent
99f411b31a
commit
64334ba4e3
@ -68,5 +68,6 @@ export default {
|
|||||||
request.post(`/valuations/${data.valuation_id || data.id}/reject`, { admin_notes: data.admin_notes }),
|
request.post(`/valuations/${data.valuation_id || data.id}/reject`, { admin_notes: data.admin_notes }),
|
||||||
updateValuationNotes: (data = {}) =>
|
updateValuationNotes: (data = {}) =>
|
||||||
request.put(`/valuations/${data.valuation_id || data.id}/admin-notes`, { admin_notes: data.admin_notes }),
|
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),
|
sendSmsReport: (data = {}) => request.post('/sms/send-report', data),
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,7 +21,10 @@ export function reqReject(error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function resResolve(response) {
|
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) {
|
if (data?.code !== 200) {
|
||||||
const code = data?.code ?? status
|
const code = data?.code ?? status
|
||||||
/** 根据code处理对应的操作,并返回处理后的message */
|
/** 根据code处理对应的操作,并返回处理后的message */
|
||||||
|
|||||||
@ -42,6 +42,8 @@ const emit = defineEmits(['back', 'approve', 'reject'])
|
|||||||
const $message = useMessage()
|
const $message = useMessage()
|
||||||
|
|
||||||
const activeDetailTab = ref('audit')
|
const activeDetailTab = ref('audit')
|
||||||
|
const reportLoading = ref(false)
|
||||||
|
const reportContent = ref('')
|
||||||
|
|
||||||
const pickFilledValue = (...values) => values.find((val) => val !== undefined && val !== null && val !== '')
|
const pickFilledValue = (...values) => values.find((val) => val !== undefined && val !== null && val !== '')
|
||||||
const formatEnumField = (key, ...values) => formatEnumByKey(pickFilledValue(...values), key)
|
const formatEnumField = (key, ...values) => formatEnumByKey(pickFilledValue(...values), key)
|
||||||
@ -55,9 +57,34 @@ watch(
|
|||||||
() => props.detailData?.id,
|
() => props.detailData?.id,
|
||||||
() => {
|
() => {
|
||||||
activeDetailTab.value = 'audit'
|
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 detailSections = computed(() => {
|
||||||
const detail = props.detailData
|
const detail = props.detailData
|
||||||
if (!detail) return []
|
if (!detail) return []
|
||||||
@ -232,10 +259,8 @@ const calcFlow = computed(() => props.detailData?.calculation_result?.flow || []
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
const mockFlowHtml = ref(mockReportMarkdown)
|
|
||||||
|
|
||||||
const renderedFlowHtml = computed(() => {
|
const renderedFlowHtml = computed(() => {
|
||||||
return marked.parse(mockFlowHtml.value)
|
return marked.parse(reportContent.value || mockReportMarkdown)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -351,7 +376,7 @@ const handleCertificateConfirm = async (data) => {
|
|||||||
</NSpin>
|
</NSpin>
|
||||||
</NTabPane>
|
</NTabPane>
|
||||||
<NTabPane name="flow" tab="计算流程">
|
<NTabPane name="flow" tab="计算流程">
|
||||||
<NSpin :show="loading">
|
<NSpin :show="reportLoading">
|
||||||
<div class="markdown-body" v-html="renderedFlowHtml"></div>
|
<div class="markdown-body" v-html="renderedFlowHtml"></div>
|
||||||
</NSpin>
|
</NSpin>
|
||||||
</NTabPane>
|
</NTabPane>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user