feat(web): AI 工作台会话与文档卡片渲染增强
- aiConversationHtmlRenderer 识别单据记录类表格并渲染为卡片列表,新增删除申请单详情的禁用占位链接 - aiWorkbenchConversationStore 增加草稿删除后会话链接失效处理,避免点击已删除单据跳转 - aiApplicationPreviewActions 调整提交/草稿调用路径,PersonalWorkbenchAiMode 接入新的会话存储与渲染 - ConfirmDialog/TravelRequestDeleteDialog/useAppShell/AppShellRouteView 配套适配,同步更新相关前端测试
This commit is contained in:
@@ -47,17 +47,49 @@ test('AI conversation renderer supports tables and escapes unsafe HTML', () => {
|
||||
|
||||
test('AI conversation renderer renders application detail action links as buttons', () => {
|
||||
const rendered = renderAiConversationHtml([
|
||||
'| 单据编号 | 操作 |',
|
||||
'| --- | --- |',
|
||||
'| AP-OVERLAP | [查看](#ai-open-application-detail:AP-OVERLAP) |'
|
||||
'| 单据类型 | 单据编号 | 单据状态 | 当前节点 | 操作 |',
|
||||
'| --- | --- | --- | --- | --- |',
|
||||
'| 出差申请 | AP-OVERLAP | 草稿 | 待提交 | [查看](#ai-open-application-detail:AP-OVERLAP) |'
|
||||
].join('\n'))
|
||||
|
||||
assert.match(rendered, /<div class="ai-html-record-list" role="list">/)
|
||||
assert.match(rendered, /<article class="ai-html-record-item" role="listitem">/)
|
||||
assert.match(rendered, /<strong class="ai-html-record-id">AP-OVERLAP<\/strong>/)
|
||||
assert.match(rendered, /class="ai-html-action-link ai-html-action-link-application"/)
|
||||
assert.match(rendered, /data-ai-action="open-application-detail"/)
|
||||
assert.match(rendered, /href="#ai-open-application-detail:AP-OVERLAP"/)
|
||||
assert.doesNotMatch(rendered, /<table>/)
|
||||
assert.doesNotMatch(rendered, /target="_blank"[\s\S]{0,120}#ai-open-application-detail/)
|
||||
})
|
||||
|
||||
test('AI conversation renderer renders deleted application detail actions as disabled buttons', () => {
|
||||
const rendered = renderAiConversationHtml([
|
||||
'| 单据类型 | 单据编号 | 单据状态 | 当前节点 | 操作 |',
|
||||
'| --- | --- | --- | --- | --- |',
|
||||
'| 出差申请 | AP-20260620-DRAFT | 已删除 | 已删除 | [草稿已删除](#ai-deleted-application-detail:claim-draft-1) |'
|
||||
].join('\n'))
|
||||
|
||||
assert.match(rendered, /class="ai-html-action-link ai-html-action-link-application is-disabled"/)
|
||||
assert.match(rendered, /aria-disabled="true"/)
|
||||
assert.match(rendered, /data-ai-action="deleted-application-detail"/)
|
||||
assert.doesNotMatch(rendered, /href="#ai-deleted-application-detail/)
|
||||
})
|
||||
|
||||
test('AI conversation renderer turns application conflict tables into record lists', () => {
|
||||
const rendered = renderAiConversationHtml([
|
||||
'| 单据编号 | 申请时间 | 状态 | 事由 | 操作 |',
|
||||
'| --- | --- | --- | --- | --- |',
|
||||
'| AP-20260620063557-4JU2MWEF | 2026-02-20 至 2026-02-23 | 审批中 | 辅助国网仿生产服务器部署 | [查看](#ai-open-application-detail:AP-20260620063557-4JU2MWEF) |'
|
||||
].join('\n'))
|
||||
|
||||
assert.match(rendered, /<div class="ai-html-record-list" role="list">/)
|
||||
assert.match(rendered, /申请时间/)
|
||||
assert.match(rendered, /2026-02-20 至 2026-02-23/)
|
||||
assert.match(rendered, /辅助国网仿生产服务器部署/)
|
||||
assert.match(rendered, /<div class="ai-html-record-action">/)
|
||||
assert.doesNotMatch(rendered, /<table>/)
|
||||
})
|
||||
|
||||
test('AI conversation renderer renders document detail action links as buttons', () => {
|
||||
const rendered = renderAiConversationHtml('[查看单据](#ai-open-document-detail:CL-20260221001)')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user