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:
@@ -4,6 +4,10 @@ import test from 'node:test'
|
||||
import { buildInlineApplicationPreview } from '../src/composables/workbenchAiMode/workbenchAiApplicationPreviewModel.js'
|
||||
import { buildStewardSuggestedActions } from '../src/views/scripts/stewardPlanModel.js'
|
||||
import { useWorkbenchAiActionRouter } from '../src/composables/workbenchAiMode/useWorkbenchAiActionRouter.js'
|
||||
import {
|
||||
CONTINUE_REIMBURSEMENT_DRAFT_ACTION,
|
||||
CREATE_STANDALONE_REIMBURSEMENT_DRAFT_ACTION
|
||||
} from '../src/views/scripts/travelReimbursementAssociationGateModel.js'
|
||||
|
||||
test('workbench steward application confirmation opens inline application preview directly', () => {
|
||||
const [action] = buildStewardSuggestedActions({
|
||||
@@ -136,3 +140,108 @@ test('workbench reimbursement skip link action opens new reimbursement flow', ()
|
||||
label: '不关联,单独新建报销单'
|
||||
})
|
||||
})
|
||||
|
||||
test('workbench draft continuation action asks for attachments or description', () => {
|
||||
let continuationPayload = null
|
||||
let fallbackConversationStarted = false
|
||||
const router = useWorkbenchAiActionRouter({
|
||||
aiExpenseDraft: { value: null },
|
||||
applicationFlow: {
|
||||
isInlineSuggestedActionDisabled: () => false,
|
||||
executeInlineApplicationPreviewAction: () => {}
|
||||
},
|
||||
assistantDraft: { value: '' },
|
||||
attachmentFlow: {
|
||||
confirmAiAttachmentAssociation: () => {}
|
||||
},
|
||||
emit: () => {},
|
||||
expenseFlow: {
|
||||
linkAiExpenseApplication: () => {},
|
||||
promptAiReimbursementDraftContinuation: (payload) => {
|
||||
continuationPayload = payload
|
||||
},
|
||||
promptStandaloneReimbursementDraftCreation: () => {},
|
||||
pushInlineExpenseSceneSelectionPrompt: () => {},
|
||||
startAiApplicationPreviewFromAction: () => {},
|
||||
startAiExpenseDraft: () => {},
|
||||
startAiReimbursementAssociationGate: () => {}
|
||||
},
|
||||
focusAiModeInput: () => {},
|
||||
hasInlineAttachmentOcrDetails: () => false,
|
||||
resolveLatestInlineUserPrompt: () => '',
|
||||
selectedFiles: { value: [] },
|
||||
startInlineConversation: () => {
|
||||
fallbackConversationStarted = true
|
||||
},
|
||||
toast: () => {},
|
||||
toggleInlineAttachmentOcrDetails: () => {}
|
||||
})
|
||||
|
||||
router.handleInlineSuggestedAction({
|
||||
label: '继续关联草稿 RE-202606-010',
|
||||
action_type: CONTINUE_REIMBURSEMENT_DRAFT_ACTION,
|
||||
payload: {
|
||||
claim_id: 'draft-travel-1',
|
||||
claim_no: 'RE-202606-010',
|
||||
original_message: '我要报销'
|
||||
}
|
||||
})
|
||||
|
||||
assert.equal(fallbackConversationStarted, false)
|
||||
assert.deepEqual(continuationPayload, {
|
||||
claim_id: 'draft-travel-1',
|
||||
claim_no: 'RE-202606-010',
|
||||
original_message: '我要报销'
|
||||
})
|
||||
})
|
||||
|
||||
test('workbench standalone draft action asks before creating a new reimbursement draft', () => {
|
||||
let standalonePrompt = null
|
||||
let fallbackConversationStarted = false
|
||||
const router = useWorkbenchAiActionRouter({
|
||||
aiExpenseDraft: { value: null },
|
||||
applicationFlow: {
|
||||
isInlineSuggestedActionDisabled: () => false,
|
||||
executeInlineApplicationPreviewAction: () => {}
|
||||
},
|
||||
assistantDraft: { value: '' },
|
||||
attachmentFlow: {
|
||||
confirmAiAttachmentAssociation: () => {}
|
||||
},
|
||||
emit: () => {},
|
||||
expenseFlow: {
|
||||
linkAiExpenseApplication: () => {},
|
||||
promptAiReimbursementDraftContinuation: () => {},
|
||||
promptStandaloneReimbursementDraftCreation: (sourceText, label) => {
|
||||
standalonePrompt = { sourceText, label }
|
||||
},
|
||||
pushInlineExpenseSceneSelectionPrompt: () => {},
|
||||
startAiApplicationPreviewFromAction: () => {},
|
||||
startAiExpenseDraft: () => {},
|
||||
startAiReimbursementAssociationGate: () => {}
|
||||
},
|
||||
focusAiModeInput: () => {},
|
||||
hasInlineAttachmentOcrDetails: () => false,
|
||||
resolveLatestInlineUserPrompt: () => '',
|
||||
selectedFiles: { value: [] },
|
||||
startInlineConversation: () => {
|
||||
fallbackConversationStarted = true
|
||||
},
|
||||
toast: () => {},
|
||||
toggleInlineAttachmentOcrDetails: () => {}
|
||||
})
|
||||
|
||||
router.handleInlineSuggestedAction({
|
||||
label: '独立新建报销单',
|
||||
action_type: CREATE_STANDALONE_REIMBURSEMENT_DRAFT_ACTION,
|
||||
payload: {
|
||||
original_message: '我要报销'
|
||||
}
|
||||
})
|
||||
|
||||
assert.equal(fallbackConversationStarted, false)
|
||||
assert.deepEqual(standalonePrompt, {
|
||||
sourceText: '我要报销',
|
||||
label: '独立新建报销单'
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user