feat(web): AI 工作台文件预览/附件关联任务与草稿分支

- 新增 WorkbenchAiFilePreviewDialog 附件预览对话框及 useWorkbenchAiFilePreview,附件支持点击预览
- 新增 attachmentAssociationJobs/linkedReimbursementDraftJobs 前端服务与对应 composable,接入后台任务轮询与状态展示
- 新增 travelReimbursementDraftBranchModel 草稿分支模型,报销关联门控支持跳过/选择草稿
- PersonalWorkbenchAiMode 及各 composable(expense/document/steward/application-preview/attachment-association)重构适配,WorkbenchAiComposer/FileStrip 样式与交互完善
- DocumentsCenter/ReceiptFolder/TravelReimbursementCreate 等视图及 scripts 重构,风险/差旅规划/审批等工具适配
- 新增/更新前端测试:application-result-card、reimbursement-list-preview-fetch、guided-flow、composer-components 等
This commit is contained in:
caoxiaozhu
2026-06-24 10:42:50 +08:00
parent 0264a4b5b4
commit ee730aa31c
73 changed files with 2528 additions and 379 deletions

View File

@@ -2,7 +2,10 @@ import {
fetchStewardPlan,
fetchStewardPlanStream
} from '../../services/steward.js'
import { fetchExpenseClaims } from '../../services/reimbursements.js'
import {
REIMBURSEMENT_LIST_PREVIEW_PARAMS,
fetchExpenseClaims
} from '../../services/reimbursements.js'
import {
buildStewardPlanMessageText,
buildStewardPlanRequest,
@@ -71,13 +74,13 @@ function buildAiRequiredApplicationGateAutoMessage(normalizedPlan, flow) {
if (flow?.flowId === 'travel_application') {
return [
contextText || baseText,
'这类操作需要手动确认。请点击下方 **确认发起出差申请**,我在当前对话里生成完整申请表,并把已识别的信息自动预填。'
'这类操作需要手动确认。请点击下方 **确认发起出差申请**,我在当前对话里生成完整申请表,并把已识别的信息自动预填。'
].filter(Boolean).join('\n\n')
}
if (flow?.flowId === 'travel_reimbursement') {
return [
contextText || baseText,
'这类操作需要手动确认。请点击下方 **确认关联已有申请单**,我继续查询并展示可关联单据。'
'这类操作需要手动确认。请点击下方 **确认关联已有申请单**,我继续查询并展示可关联单据。'
].filter(Boolean).join('\n\n')
}
return baseText
@@ -100,7 +103,7 @@ function buildAiRequiredApplicationGateSuggestedActions(flow, prompt = '') {
if (flow.flowId === 'travel_reimbursement') {
return [{
label: '确认关联已有申请单',
description: '确认后查询名下可关联的差旅申请单,并进入关联步骤。',
description: '确认后查询名下可关联的差旅申请单,并进入关联步骤。',
icon: 'mdi mdi-link-variant',
action_type: 'steward_confirm_flow',
payload: {
@@ -155,7 +158,7 @@ export function useWorkbenchAiStewardFlow({
}
try {
const claims = await fetchExpenseClaims()
const claims = await fetchExpenseClaims(REIMBURSEMENT_LIST_PREVIEW_PARAMS)
const candidates = filterRequiredApplicationCandidates(claims, 'travel', currentUser.value || {})
planRequest.context_json = {
...(planRequest.context_json || {}),
@@ -232,14 +235,14 @@ export function useWorkbenchAiStewardFlow({
},
{
idleTimeoutMs: 90000,
timeoutMessage: '小财管家仍在规划任务,已停止等待。可以稍后继续追问。'
timeoutMessage: '小财管家仍在规划任务,已停止等待。可以稍后继续追问。'
}
)
} catch (error) {
if (String(error?.message || '').includes('流式服务')) {
return fetchStewardPlan(payload, {
timeoutMs: 75000,
timeoutMessage: '小财管家仍在规划任务,已停止等待。可以稍后继续追问。'
timeoutMessage: '小财管家仍在规划任务,已停止等待。可以稍后继续追问。'
})
}
throw error
@@ -256,7 +259,7 @@ export function useWorkbenchAiStewardFlow({
{
eventId: 'init',
title: '小财管家正在接入业务流程',
content: '正在识别的意图、上下文和附件信息。',
content: '正在识别的意图、上下文和附件信息。',
status: 'running'
}
]