feat(admin): 为支持单删的管理列表补齐批量删除

This commit is contained in:
2026-11-20 12:08:28 +08:00
parent 132c19d51f
commit 51c41b238a
43 changed files with 2806 additions and 1948 deletions
@@ -68,6 +68,24 @@ async function mountDialog(editable = true): Promise<VueWrapper<Element>> {
return wrapper
}
it('批量删除分类:全选当前页、确认只移除分类、刷新一次;只读模式无入口', async () => {
jdApi.fetchJdProductGroups.mockResolvedValue([group(7, '裙装', 3), group(8, '裤装', 1)])
jdApi.deleteJdProductGroup.mockResolvedValue(undefined)
const wrapper = await mountDialog()
await wrapper.get('.option-head input[type="checkbox"]').setValue(true)
await wrapper.get('.batch-delete-actions .btn-danger').trigger('click')
await flushPromises()
expect(confirmMock).toHaveBeenCalledWith(expect.objectContaining({ message: expect.stringContaining('商品本身不会被删除') }))
expect(jdApi.deleteJdProductGroup.mock.calls).toEqual([[7], [8]])
expect(jdApi.fetchJdProductGroups).toHaveBeenCalledTimes(2)
expect(wrapper.emitted('changed')).toHaveLength(1)
expect(wrapper.get('.batch-delete-actions .btn-danger').text()).toBe('批量删除(0)')
await wrapper.setProps({ editable: false })
expect(wrapper.find('.batch-delete-actions').exists()).toBe(false)
expect(wrapper.find('.batch-delete-checkbox').exists()).toBe(false)
wrapper.unmount()
})
describe('京东分类管理对话框(V204 独立页 2026-11-17 并入京东数据库页)', () => {
it('打开即按当前分组取分类(ownerGroupId 必带);标题不带分组名(2026-11-17 用户口径「不要显示周丽娥」)', async () => {
jdApi.fetchJdProductGroups.mockResolvedValue([group(7, '裙装', 3)])