20260922172938

This commit is contained in:
oneao committed 2026-09-22 17:29:39 +08:00
1 parent 583984c24f
commit c8dad8d4a6
46 files changed
+3366 -1246

No files matched your search

@@ -1,11 +1,11 @@
/**
* 回归用例:往来单位分类树(b_othercompany_category)的新增 / 修改 / 删除 / 拖拽排序。
* 回归用例:合作伙伴分类树(b_othercompany_category)的新增 / 修改 / 删除 / 拖拽排序。
*
* 1) b_path 为 not null 且无默认值(b_depth / b_xh / b_canuse 才有默认值),新增分类时
* 必须按父级派生 b_depth / b_path 一起写入,否则插入直接失败;
* 且两个派生字段与 b_parent_id 必须同批落库,否则会留下「路径按新父级、父级列还是旧值」。
*
* 2) 删除分类有两条守卫:还有子分类、分类下还挂着往来单位。两条都必须拦在发请求之前。
* 2) 删除分类有两条守卫:还有子分类、分类下还挂着合作伙伴。两条都必须拦在发请求之前。
*
* 3) 分类编码 b_id 是主键,修改时只提交名称与排序号,不能改编码。
*/
@@ -102,7 +102,7 @@ async function mountOthercompany() {
return wrapper
}
describe('往来单位:新增分类写派生树字段', () => {
describe('合作伙伴:新增分类写派生树字段', () => {
it('新增顶级分类写入 b_parent_id=null 与根路径', async () => {
const wrapper = await mountOthercompany()
@@ -140,7 +140,7 @@ describe('往来单位:新增分类写派生树字段', () => {
})
})
describe('往来单位:修改分类', () => {
describe('合作伙伴:修改分类', () => {
it('只提交名称与排序号,分类编码保持为主键值', async () => {
const wrapper = await mountOthercompany()
@@ -155,7 +155,7 @@ describe('往来单位:修改分类', () => {
})
})
describe('往来单位:删除分类的两条守卫', () => {
describe('合作伙伴:删除分类的两条守卫', () => {
it('还有子分类时直接拦下,不发任何请求', async () => {
const wrapper = await mountOthercompany()
@@ -185,13 +185,13 @@ describe('往来单位:删除分类的两条守卫', () => {
expect(Message.error).not.toHaveBeenCalled()
})
it('分类下还有往来单位时拦下,不发删除请求', async () => {
it('分类下还有合作伙伴时拦下,不发删除请求', async () => {
const wrapper = await mountOthercompany()
pageDataApi.mockResolvedValueOnce({ data: { rows: [{ b_id: 'OC001' }], total: 1 } })
await wrapper.vm.onCategoryDelete({ b_id: 'child1' })
expect(Message.warning).toHaveBeenCalledWith('该分类下还有往来单位数据,不能删除')
expect(Message.warning).toHaveBeenCalledWith('该分类下还有合作伙伴数据,不能删除')
expect(modalConfirm).not.toHaveBeenCalled()
expect(saveObjectApi).not.toHaveBeenCalled()
})
@@ -213,7 +213,7 @@ describe('往来单位:删除分类的两条守卫', () => {
})
})
describe('往来单位:拖拽分类', () => {
describe('合作伙伴:拖拽分类', () => {
it('跨级拖入时同批落库 b_parent_id 与重建后的 b_depth / b_path', async () => {
const wrapper = await mountOthercompany()
@@ -247,7 +247,7 @@ describe('往来单位:拖拽分类', () => {
})
})
describe('往来单位分类树:搜索', () => {
describe('合作伙伴分类树:搜索', () => {
it('按名称与编码过滤,并把命中的层级展开', async () => {
const wrapper = await mountOthercompany()