feat(web): AI 工作台会话与文档卡片渲染增强
- aiConversationHtmlRenderer 识别单据记录类表格并渲染为卡片列表,新增删除申请单详情的禁用占位链接 - aiWorkbenchConversationStore 增加草稿删除后会话链接失效处理,避免点击已删除单据跳转 - aiApplicationPreviewActions 调整提交/草稿调用路径,PersonalWorkbenchAiMode 接入新的会话存储与渲染 - ConfirmDialog/TravelRequestDeleteDialog/useAppShell/AppShellRouteView 配套适配,同步更新相关前端测试
This commit is contained in:
@@ -19,6 +19,10 @@ const confirmDialogComponent = readFileSync(
|
||||
fileURLToPath(new URL('../src/components/shared/ConfirmDialog.vue', import.meta.url)),
|
||||
'utf8'
|
||||
)
|
||||
const deleteDialogComponent = readFileSync(
|
||||
fileURLToPath(new URL('../src/components/travel/TravelRequestDeleteDialog.vue', import.meta.url)),
|
||||
'utf8'
|
||||
)
|
||||
|
||||
function extractFunction(source, name) {
|
||||
let signatureIndex = source.indexOf(`function ${name}(`)
|
||||
@@ -138,6 +142,17 @@ test('submit confirm dialog is constrained for laptop viewport height', () => {
|
||||
assert.match(confirmDialogComponent, /@media \(max-width: 720px\) \{[\s\S]*max-height: calc\(100dvh - 28px\)/)
|
||||
})
|
||||
|
||||
test('delete request dialog uses a compact destructive confirmation layout', () => {
|
||||
assert.match(deleteDialogComponent, /size="destructive"/)
|
||||
assert.match(deleteDialogComponent, /actions-align="end"/)
|
||||
assert.match(detailViewScript, /const deleteDialogTarget = computed\(\(\) => request\.value\.documentNo \|\| request\.value\.id \|\| '当前单据'\)/)
|
||||
assert.match(detailViewScript, /const deleteDialogTitle = computed\(\(\) => `确认\$\{deleteActionLabel\.value\}吗?`\)/)
|
||||
assert.doesNotMatch(detailViewScript, /const deleteDialogTitle = computed\(\(\) => `确认\$\{deleteActionLabel\.value\} \$\{request\.value\.id\} 吗?`\)/)
|
||||
assert.match(confirmDialogComponent, /\.shared-confirm-card--destructive \{[\s\S]*width: min\(420px, calc\(100vw - 40px\)\);/)
|
||||
assert.match(confirmDialogComponent, /\.shared-confirm-card--destructive h4 \{[\s\S]*font-size: 19px;/)
|
||||
assert.match(confirmDialogComponent, /\.shared-confirm-card--destructive \.shared-confirm-btn \{[\s\S]*min-width: 112px;[\s\S]*min-height: 38px;/)
|
||||
})
|
||||
|
||||
test('detail header and fallback progress use reimbursement wording', () => {
|
||||
assert.match(detailViewScript, /label:\s*'单据申请日期'/)
|
||||
assert.match(detailExpenseModelScript, /label:\s*'关联单据'/)
|
||||
@@ -145,15 +160,24 @@ test('detail header and fallback progress use reimbursement wording', () => {
|
||||
assert.doesNotMatch(detailViewScript, /label:\s*'保存草稿'/)
|
||||
})
|
||||
|
||||
test('detail delete action is gated by admin-only permission', () => {
|
||||
assert.match(detailViewScript, /const canDeleteRequest = computed\(\(\) => isPlatformAdminUser\(currentUser\.value\)\)/)
|
||||
test('detail delete action allows admins or the applicant while the request is editable', () => {
|
||||
assert.match(detailViewScript, /const canDeleteRequest = computed\(\(\) => \{/)
|
||||
assert.match(detailViewScript, /if \(isPlatformAdminUser\(currentUser\.value\)\) \{[\s\S]*return true/)
|
||||
assert.match(detailViewScript, /return isApplicantDeletableRequest\.value/)
|
||||
assert.match(detailViewScript, /const isApplicantDeletableRequest = computed\(\(\) => \{/)
|
||||
assert.match(detailViewScript, /isCurrentApplicant\.value/)
|
||||
assert.match(detailViewScript, /\['draft', 'supplement', 'returned'\]\.includes\(status\)/)
|
||||
assert.match(detailViewTemplate, /v-else-if="canReturnRequest \|\| canApproveRequest \|\| canPayRequest \|\| canDeleteRequest"/)
|
||||
assert.doesNotMatch(detailViewTemplate, /v-if="canManageCurrentClaim"/)
|
||||
})
|
||||
|
||||
test('detail delete action does not allow applicant or claim manager fallback', () => {
|
||||
assert.doesNotMatch(detailViewScript, /const canDeleteRequest = computed\(\(\) => \{[\s\S]*isCurrentApplicant[\s\S]*\}\)/)
|
||||
assert.doesNotMatch(detailViewScript, /const canDeleteRequest = computed\(\(\) => \{[\s\S]*canManageCurrentClaim[\s\S]*\}\)/)
|
||||
test('detail delete action does not allow in-progress applicant or claim manager fallback', () => {
|
||||
const canDeleteStart = detailViewScript.indexOf('const canDeleteRequest = computed')
|
||||
const canDeleteEnd = detailViewScript.indexOf('\n const isDirectManagerApprovalStage', canDeleteStart)
|
||||
assert.ok(canDeleteStart >= 0)
|
||||
assert.ok(canDeleteEnd > canDeleteStart)
|
||||
const canDeleteBlock = detailViewScript.slice(canDeleteStart, canDeleteEnd)
|
||||
assert.doesNotMatch(canDeleteBlock, /canManageCurrentClaim/)
|
||||
assert.match(detailViewScript, /if \(isApplicationDocument\.value\) {\s*return '删除申请'\s*}/)
|
||||
assert.match(detailViewScript, /当前申请单已进入审批流程,只有退回后申请人本人或系统管理员可以删除。/)
|
||||
assert.match(detailViewScript, /当前申请单已进入审批流程,只有草稿、待补充或退回待提交阶段的申请人本人或系统管理员可以删除。/)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user