- 新增 aiDocumentDetailReference,统一解析 #ai-open-document-detail / #ai-open-application-detail 引用,兼容 A/R/D 短格式与 AP-/RE-/AD- 旧格式单号,提供 isBusinessDocumentReference 判定 - aiDocumentQueryModel 文档卡片接入详情引用,按申请单/报销单生成对应 href,HTML 渲染器识别单据记录表格并生成卡片链接 - PersonalWorkbenchAiMode 处理文档详情点击跳转,卡片样式重构为结构化布局并更新背景资源 - expenseApplicationPreview 补充事由字段,同步新增/更新 ai-document-detail-reference、document-query-model、html-renderer、workbench-ai-mode 等测试 - 更新公司通信费报销规则表
75 lines
3.6 KiB
JavaScript
75 lines
3.6 KiB
JavaScript
import assert from 'node:assert/strict'
|
|
import { readFileSync } from 'node:fs'
|
|
import test from 'node:test'
|
|
import { fileURLToPath } from 'node:url'
|
|
|
|
const appShell = readFileSync(
|
|
fileURLToPath(new URL('../src/views/AppShellRouteView.vue', import.meta.url)),
|
|
'utf8'
|
|
)
|
|
const appShellComposable = readFileSync(
|
|
fileURLToPath(new URL('../src/composables/useAppShell.js', import.meta.url)),
|
|
'utf8'
|
|
)
|
|
const workbench = readFileSync(
|
|
fileURLToPath(new URL('../src/components/business/PersonalWorkbench.vue', import.meta.url)),
|
|
'utf8'
|
|
)
|
|
const aiMode = readFileSync(
|
|
fileURLToPath(new URL('../src/components/business/PersonalWorkbenchAiMode.vue', import.meta.url)),
|
|
'utf8'
|
|
)
|
|
const aiDetailReference = readFileSync(
|
|
fileURLToPath(new URL('../src/utils/aiDocumentDetailReference.js', import.meta.url)),
|
|
'utf8'
|
|
)
|
|
|
|
test('workbench document detail keeps workbench as the return target', () => {
|
|
assert.match(workbench, /source:\s*'workbench'/)
|
|
assert.match(workbench, /returnTo:\s*'workbench'/)
|
|
assert.match(appShell, /:back-label="detailBackLabel"/)
|
|
assert.match(appShell, /String\(payload\.returnTo \|\| ''\)\.trim\(\) === 'workbench'/)
|
|
assert.match(appShell, /String\(payload\.source \|\| ''\)\.trim\(\) === 'workbench'/)
|
|
assert.match(appShell, /const detailPayload = request \|\| \{[\s\S]*detailLookupOnly:\s*true[\s\S]*\}/)
|
|
assert.match(appShell, /openRequestDetail\(detailPayload,\s*\{ returnTo \}\)/)
|
|
assert.match(appShellComposable, /const detailReturnTarget = computed/)
|
|
assert.match(appShellComposable, /detailReturnTarget\.value === 'workbench' \? '返回首页' : '返回单据中心'/)
|
|
assert.match(appShellComposable, /nextQuery\.returnTo = 'workbench'/)
|
|
assert.match(appShellComposable, /router\.push\(\{ name: 'app-workbench' \}\)/)
|
|
assert.match(appShellComposable, /router\.push\(\{ name: 'app-documents', query: buildDocumentReturnQuery\(\) \}\)/)
|
|
})
|
|
|
|
test('AI detail links resolve real claim identity before opening document detail', () => {
|
|
assert.match(aiMode, /buildAiDocumentDetailRequest/)
|
|
assert.match(aiMode, /parseAiApplicationDetailHref/)
|
|
assert.match(aiMode, /parseAiDocumentDetailHref/)
|
|
assert.match(aiDetailReference, /detailLookupOnly:\s*true/)
|
|
assert.match(aiDetailReference, /params\.get\('claim_id'\)/)
|
|
assert.match(aiDetailReference, /params\.get\('claim_no'\)/)
|
|
assert.match(aiDetailReference, /isBusinessDocumentReference/)
|
|
assert.match(aiDetailReference, /const claimId = explicitClaimId \|\| \(!referenceIsBusinessNo \? reference : ''\)/)
|
|
assert.match(aiDetailReference, /const claimNo = explicitClaimNo \|\| \(referenceIsBusinessNo \? reference : ''\)/)
|
|
assert.match(
|
|
appShell,
|
|
/v-else-if="activeView === 'documents' && detailMode && !selectedRequest"[\s\S]*正在加载完整单据详情/
|
|
)
|
|
assert.match(
|
|
appShell,
|
|
/const detailPayload = request \|\| \{[\s\S]*detailLookupOnly:\s*true[\s\S]*\}/
|
|
)
|
|
assert.match(appShell, /isBusinessDocumentReference/)
|
|
assert.match(appShell, /const requestCandidates = Array\.isArray\(workbenchRequests\.value\)/)
|
|
assert.match(appShell, /claimId:\s*fallbackClaimId/)
|
|
assert.match(appShell, /claimNo:\s*fallbackClaimNo/)
|
|
assert.match(
|
|
appShellComposable,
|
|
/const isDetailLookupOnlyRequest = isDetailLookupOnlyPayload\(request\)[\s\S]*selectedRequestSnapshot\.value = isDetailLookupOnlyRequest \? null : request \|\| null/
|
|
)
|
|
assert.match(appShellComposable, /const workbenchRequests = computed/)
|
|
assert.match(appShellComposable, /workbenchRequests\.value\.find\(\(item\) => isSameRequestIdentity\(item, requestId\)\)/)
|
|
assert.match(
|
|
appShellComposable,
|
|
/void refreshSelectedRequestDetail\(isDetailLookupOnlyRequest \? requestId : request\)/
|
|
)
|
|
})
|