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:
@@ -268,7 +268,7 @@ test('assistant scope guard blocks unsupported non-financial intent', () => {
|
||||
Array.from({ length: 4 }, () => ASSISTANT_SCOPE_ACTION_SWITCH)
|
||||
)
|
||||
assert.match(greetingGuard.text, /小财管家暂时不处理「你好」/)
|
||||
assert.match(greetingGuard.text, /你可以直接点下面的场景继续/)
|
||||
assert.match(greetingGuard.text, /您可以直接点下面的场景继续/)
|
||||
assert.equal(guard.suggestedActions.length, 4)
|
||||
assert.equal(guard.blocked, true)
|
||||
assert.equal(guard.targetSessionType, '')
|
||||
@@ -466,6 +466,28 @@ test('application preview parses same-month shorthand date range', () => {
|
||||
assert.doesNotMatch(preview.fields.reason, /小财管家继续执行/)
|
||||
})
|
||||
|
||||
test('application preview splits compact destination and business purpose', () => {
|
||||
const preview = buildLocalApplicationPreview(
|
||||
'2026-02-20 至 2026-02-23,去上海辅助国网仿生产服务器部署,火车',
|
||||
{
|
||||
name: '曹笑竹',
|
||||
departmentName: '技术部',
|
||||
position: '财务智能化产品经理',
|
||||
managerName: '向万红',
|
||||
grade: 'P5'
|
||||
},
|
||||
{ today: '2026-06-09' }
|
||||
)
|
||||
|
||||
assert.equal(preview.fields.time, '2026-02-20 至 2026-02-23')
|
||||
assert.equal(preview.fields.days, '4天')
|
||||
assert.equal(preview.fields.location, '上海')
|
||||
assert.equal(preview.fields.reason, '辅助国网仿生产服务器部署')
|
||||
assert.equal(preview.fields.transportMode, '火车')
|
||||
assert.equal(preview.readyToSubmit, true)
|
||||
assert.deepEqual(preview.validationIssues, [])
|
||||
})
|
||||
|
||||
test('application preview blocks submit when date range conflicts with explicit days', () => {
|
||||
const preview = buildLocalApplicationPreview(
|
||||
'申请2月20-23日去上海出差3天,辅助国网仿生产服务器部署,火车',
|
||||
@@ -569,6 +591,40 @@ test('application preview trusts model-refined fields over noisy source candidat
|
||||
assert.deepEqual(preview.validationIssues, [])
|
||||
})
|
||||
|
||||
test('application preview normalizes model-refined location mixed with business content', () => {
|
||||
const rawText = '申请2月20日-23日火车出差,事由:辅助国网仿生产服务器部署'
|
||||
const preview = buildModelRefinedApplicationPreview(
|
||||
buildLocalApplicationPreview(rawText, { name: '曹笑竹', grade: 'P5' }, { today: '2026-06-09' }),
|
||||
{
|
||||
parse_strategy: 'llm_primary',
|
||||
entities: [
|
||||
{ type: 'expense_type', value: '差旅费', normalized_value: 'travel' },
|
||||
{ type: 'location', value: '上海辅助国网仿生产服务器', normalized_value: '上海辅助国网仿生产服务器' },
|
||||
{ type: 'reason', value: '辅助国网仿生产服务器部署', normalized_value: '辅助国网仿生产服务器部署' },
|
||||
{ type: 'transport_mode', value: '火车', normalized_value: '火车' },
|
||||
{ type: 'policy_total_amount', value: '2120元', normalized_value: '2120' }
|
||||
],
|
||||
time_range: {
|
||||
start_date: '2026-02-20',
|
||||
end_date: '2026-02-23'
|
||||
},
|
||||
missing_slots: []
|
||||
},
|
||||
rawText,
|
||||
{ name: '曹笑竹', grade: 'P5' }
|
||||
)
|
||||
const estimateRequest = buildApplicationPolicyEstimateRequest(preview, { grade: 'P5', location: '武汉' })
|
||||
const footer = buildApplicationPreviewFooterMessage(preview)
|
||||
|
||||
assert.equal(preview.fields.location, '上海')
|
||||
assert.equal(preview.fields.reason, '辅助国网仿生产服务器部署')
|
||||
assert.equal(preview.readyToSubmit, true)
|
||||
assert.deepEqual(preview.validationIssues, [])
|
||||
assert.match(footer, /#application-submit/)
|
||||
assert.equal(estimateRequest.canCalculate, true)
|
||||
assert.equal(estimateRequest.payload.location, '上海')
|
||||
})
|
||||
|
||||
test('application preview blocks submit when transport candidates conflict', () => {
|
||||
const preview = buildLocalApplicationPreview(
|
||||
'申请2月20-23日去上海出差4天,辅助国网仿生产服务器部署,出行方式:飞机,坐火车',
|
||||
@@ -1054,7 +1110,7 @@ test('steward application missing transport blocks preview table', () => {
|
||||
assert.match(submitComposerScript, /applicationPreview:\s*pauseForMissingFields \? null : applicationPreview/)
|
||||
assert.match(submitComposerScript, /我已经识别出这一步要先处理申请单,但现在还不能生成可提交的申请核对表/)
|
||||
assert.match(submitComposerScript, /applicationPreview:\s*normalized/)
|
||||
assert.doesNotMatch(submitComposerScript, /请先告诉我你打算怎么出行:\*\*火车、飞机或轮船\*\*/)
|
||||
assert.doesNotMatch(submitComposerScript, /请先告诉我您打算怎么出行:\*\*火车、飞机或轮船\*\*/)
|
||||
|
||||
assert.match(suggestedActionsScript, /payload\.applicationPreview/)
|
||||
assert.match(suggestedActionsScript, /function continueStewardApplicationFieldCompletion/)
|
||||
|
||||
Reference in New Issue
Block a user