feat: 完成原型04-10全链路功能开发,包括AI助手、PDF导出等
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
<text v-if="loading" class="body-text">正在读取已保存报告…</text>
|
||||
<view v-if="error.length > 0" class="panel"><text class="section-title">报告暂不可读取</text><text class="body-text">{{ error }}</text><button v-if="routeError.length == 0" class="secondary" @click="loadReport">重新加载报告</button><text class="action" @click="history">前往融资档案</text></view>
|
||||
<template v-if="report != null">
|
||||
<ReportExport :assessmentId="assessmentId" @authrequired="login" @sessionchanged="loadReport" />
|
||||
<text class="report-note">生成于 {{ report!.generatedAt }} · 用户自填资料分析</text>
|
||||
<view v-if="report!.version == 1" class="legacy"><text class="report-note">这是一份旧版自填报告,当时未采集融资需求、未计算完整度与准备状态,也未执行产品匹配。历史内容保持原样。</text></view>
|
||||
<template v-if="tab == 'overview'">
|
||||
@@ -49,6 +50,8 @@
|
||||
<template v-else><view v-for="group in adviceGroups" :key="group.id" class="panel"><text class="section-title">{{ group.label }}</text><text class="report-note">仅展示本组前3项产品的已有依据,可进入完整列表查看更多。</text><text v-if="group.loading" class="body-text">正在读取产品依据…</text><template v-if="group.error.length > 0"><text class="body-text">{{ group.error }}</text><button class="secondary" @click="loadAdvice(group.id)">重试{{ group.label }}</button></template><text v-if="!group.loading && group.error.length == 0 && group.items.length == 0" class="report-note">本组暂无产品依据。</text><view v-for="item in group.items" :key="item.id" class="advice-product"><text class="product-name" @click="openProduct(item.id)">{{ item.product.name }} ›</text><text class="source-note">{{ item.stateLabel }} · 评估时版本 v{{ item.product.version }}</text><view v-for="reason in adviceReasons(item)" :key="reason.id"><text class="body-text">{{ reason.text }}</text><text v-for="line in reason.evidence" :key="line" class="evidence">{{ line }}</text></view><text v-if="item.availability != 'available'" class="availability">{{ item.availabilityLabel }}</text></view><text class="action" @click="allMatches(group.id)">查看全部{{ group.label }} ›</text></view></template>
|
||||
</template>
|
||||
<text class="disclaimer">{{ report!.disclaimer }}</text>
|
||||
<button class="primary" @click="nextStep">下一步行动</button>
|
||||
<button class="secondary" @click="consult">对报告有疑问,咨询AI</button>
|
||||
<view class="bottom-actions"><button class="secondary" @click="start">重新评估</button><button class="secondary" @click="history">查看历史评估</button></view>
|
||||
</template>
|
||||
</view>
|
||||
@@ -57,8 +60,10 @@
|
||||
</template>
|
||||
<script setup lang="uts">
|
||||
import AppHeader from '@/components/AppHeader.uvue'
|
||||
import ReportExport from '@/packages/finance/components/ReportExport.uvue'
|
||||
import { usePageLayout } from '@/services/layout.uts'
|
||||
import { getSession } from '@/services/api.uts'
|
||||
import { assistantRoute } from '@/packages/finance/services/assistant.uts'
|
||||
import { clearAssessmentFlow } from '@/services/assessment-flow.uts'
|
||||
import { AnalysisReport, AssessmentField, fetchAnalysisReport } from '@/packages/finance/services/records.uts'
|
||||
import { MatchPage, MatchView, MatchReason, fetchMatchPage, validRecordId } from '@/packages/finance/services/matches.uts'
|
||||
@@ -71,6 +76,7 @@
|
||||
const candidates = ref<MatchView[]>([]); const candidateLoading = ref(false); const candidateError = ref('')
|
||||
const adviceGroups = ref<AdviceGroup[]>([])
|
||||
let generation = 0; let visible = false
|
||||
const login = () => { uni.redirectTo({ url: '/packages/account/login/login?resumeReport=1&assessmentId=' + assessmentId.value + '&tab=' + tab.value }) }
|
||||
const missingItems = computed((): AssessmentField[] => report.value == null ? [] : report.value!.completenessItems.filter((item: AssessmentField): boolean => ['待补充','需核实'].includes(item.value)))
|
||||
const adviceReasons = (item: MatchView): MatchReason[] => item.state == 'ineligible' ? item.blocking.concat(item.cautions) : item.cautions
|
||||
const reset = () => { report.value = null; candidates.value = []; adviceGroups.value = []; candidateLoading.value = false; candidateError.value = ''; factsOpen.value = false; completenessOpen.value = false }
|
||||
@@ -79,7 +85,7 @@
|
||||
if (!visible || request != generation) return true
|
||||
if (getSession()?.getString('token') == token) return false
|
||||
generation++; reset(); loading.value = false
|
||||
if (getSession() == null) uni.redirectTo({ url: '/packages/account/login/login' })
|
||||
if (getSession() == null) login()
|
||||
else error.value = '账户已切换,请重新加载本人报告。'
|
||||
return true
|
||||
}
|
||||
@@ -114,7 +120,7 @@
|
||||
const request = ++generation; reset(); error.value = ''; loading.value = false
|
||||
if (routeError.value.length > 0) { error.value = routeError.value; return }
|
||||
const session = getSession()
|
||||
if (session == null) { uni.redirectTo({ url: '/packages/account/login/login' }); return }
|
||||
if (session == null) { login(); return }
|
||||
const token = session.getString('token') ?? ''; loading.value = true
|
||||
try {
|
||||
const result = await fetchAnalysisReport(assessmentId.value)
|
||||
@@ -131,6 +137,8 @@
|
||||
// 切栏替换当前路由,刷新恢复所选栏目;只读取已保存快照,不提交评估或触发模型。
|
||||
const switchTab = (value: string) => { if (value != tab.value && routeError.value.length == 0) uni.redirectTo({ url: '/packages/finance/report/report?assessmentId=' + assessmentId.value + '&tab=' + value }) }
|
||||
const history = () => { uni.navigateTo({ url: '/packages/finance/archive/archive' }) }
|
||||
const consult = () => { uni.navigateTo({ url: assistantRoute(assessmentId.value, [], 'report') }) }
|
||||
const nextStep = () => { if (report.value != null) uni.navigateTo({ url: '/packages/finance/next-step/next-step?assessmentId=' + assessmentId.value + '§ion=actions' }) }
|
||||
const back = () => { if (getCurrentPages().length > 1) uni.navigateBack(); else uni.redirectTo({ url: '/packages/finance/archive/archive' }) }
|
||||
const allMatches = (group: string) => { uni.navigateTo({ url: '/packages/finance/matches/matches?assessmentId=' + assessmentId.value + '&group=' + group }) }
|
||||
const openProduct = (id: string) => { uni.navigateTo({ url: '/packages/finance/product/product?assessmentId=' + assessmentId.value + '&productId=' + id + '&tab=explanation&from=report' }) }
|
||||
|
||||
Reference in New Issue
Block a user