cmvr-wms/ruoyi-ui-vue3/tests/runtime/archive-review.spec.js
lixiaolong f8f286d2a1 feat(assistant): 新增用户核对功能并优化对话流程
- 新增 user.check 功能用于核对人员是否已有系统账号
- 在 assistant-table-layout.js 中为用户表格添加 checkedIdentity 和 matchResult 字段
- 优化 AssistantConversationService 中的任务记忆和澄清流程
- 支持对草稿特定行进行修改,无需重新填写整张表
- 限制 user.check 操作最大查询数量为 100 条记录
- 实现中断任务恢复机制,保持原始请求上下文
- 添加针对多行数据选择性修改的目标行标识支持
2026-10-27 09:04:41 +08:00

30 lines
2.4 KiB
JavaScript

import { expect, it } from 'vitest'
import { mount, flushPromises } from '@vue/test-utils'
import ElementPlus from 'element-plus'
import Review from '@/views/archive/ArchiveReview.vue'
it('review renders version differences, zero cost values, and opens only explicit item keys', async () => {
const wrapper = mount(Review, { props: { canReturn: true, items: [{ item_key: 'technical', title: '技术方案' }, { item_key: 'costAnalysis', title: '项目成本分析表' }], review: { baselineAvailable: true, baselineAt: '2026-10-20 09:00:00', submittedAt: '2026-10-23 09:00:00', documents: [{ kind: 'NEW_VERSION', itemKey: 'technical', itemTitle: '技术方案', beforeName: '图纸.pdf', afterName: '图纸.pdf', beforeRevision: 1, afterRevision: 1, currentRevision: 2 }], costChanges: [{ label: '项目收入', before: 10, after: 0 }], itemChanges: [] } }, global: { plugins: [ElementPlus] } })
await flushPromises()
expect(wrapper.text()).toContain('与上次提交相比,改了什么')
expect(wrapper.text()).toContain('新上传了第 2 版,当前仍使用第 1 版')
expect(wrapper.find('.cost-after').text()).toBe('0.00 元');expect(wrapper.text()).toContain('减少 10.00 元')
await wrapper.findAll('button').find(button => button.text() === '要求补充').trigger('click')
expect(wrapper.emitted('return')).toEqual([['technical']])
await wrapper.findAll('button').find(button => button.text() === '查看成本明细').trigger('click')
expect(wrapper.emitted('open')).toEqual([['costAnalysis']])
wrapper.unmount()
})
it('missing history is clearly identified and all current items remain accessible', async () => {
const wrapper = mount(Review, { props: { review: { baselineAvailable: false, costChanges: [{ label: '备注', after: '<script>不执行</script>' }] }, items: [{ item_key: 'technical', title: '技术方案', documents: [] }] }, global: { plugins: [ElementPlus] } })
await flushPromises()
expect(wrapper.text()).toContain('暂无可对比的上次提交记录')
expect(wrapper.find('.review-all button').text()).toContain('技术方案')
expect(wrapper.find('.cost-after').text()).toContain('<script>不执行</script>')
expect(wrapper.find('script').exists()).toBe(false)
expect(wrapper.findAll('button').some(button => button.text() === '要求补充')).toBe(false)
await wrapper.find('.review-all button').trigger('click')
expect(wrapper.emitted('open')).toEqual([['technical']])
wrapper.unmount()
})