diff --git a/admin-frontend-vue/src/config/platform-scope.ts b/admin-frontend-vue/src/config/platform-scope.ts
index 81fd46985..ced9802c2 100644
--- a/admin-frontend-vue/src/config/platform-scope.ts
+++ b/admin-frontend-vue/src/config/platform-scope.ts
@@ -16,13 +16,12 @@ export const PLATFORM_TABS: readonly PlatformTabDef[] = [
]
/** 京东侧独占菜单的 menuKey 唯一清单(与 routes.ts 的 menuKey 逐字一致,用例钉住)。
- * 2026-11-17 加京东分类管理(用户口径「这边分组是京东的分组管理的而不是亚马逊的」——
- * 分类管理子菜单归京东侧,不与亚马逊侧混排)。
+ * 2026-11-17 晚:分类管理子菜单(admin_jd_category_manage,V204)随「京东分类管理并到
+ * 京东数据库分类编辑里」用户口径整体下线(页/路由/菜单行 V208 删),key 从清单摘除。
* 后续京东新页面上线把 key 加进这里即可,清单外的 key(含店铺管理/生成记录等
* 存量页)一律归亚马逊或双侧清单。 */
export const JD_MENU_KEYS: readonly string[] = [
'admin_jd_database',
- 'admin_jd_category_manage',
]
/** 双侧共用菜单(2026-11-17 用户口径「这些亚马逊这边也要有」):三个账号域页面在两个
diff --git a/admin-frontend-vue/src/layout/operation-guides.ts b/admin-frontend-vue/src/layout/operation-guides.ts
index 938075810..afe419340 100644
--- a/admin-frontend-vue/src/layout/operation-guides.ts
+++ b/admin-frontend-vue/src/layout/operation-guides.ts
@@ -122,12 +122,10 @@ export const OPERATION_GUIDES: Record = {
steps: ['筛选记录', '核对结论明细', '到任务中心下载原表'],
},
admin_jd_database: {
- text: '本页只读:客户端采集的京东店铺商品自动同步到这里(同店铺同商品只保留最新一次),按分公司隔离分页展示;点行查看全部属性与图片,可用自定义分组归档商品。',
- steps: ['筛选商品记录', '查看属性与图片明细', '按分组归档管理'],
- },
- admin_jd_category_manage: {
- text: '本页维护京东自定义分类:分类按数据权限分组隔离,当前组只组长/超管可新建、改名、删除(删除不删商品,只解挂归属);给商品归类请到「京东数据库」页勾选后「批量编辑分类」。',
- steps: ['切换分组', '新建或改名分类', '到京东数据库页归类商品'],
+ // 2026-11-17 分类管理子菜单并入本页(用户口径「京东分类管理并到京东数据库分类编辑里」,
+ // 原 admin_jd_category_manage 条目随之摘除):分类建/改名/删在工具栏「分类管理」。
+ text: '本页只读:客户端采集的京东店铺商品自动同步到这里(同店铺同商品只保留最新一次),按分公司隔离分页展示;点行查看全部属性与图片;分类的新建/改名/删除在工具栏「分类管理」,给商品归类先勾选再「批量编辑分类」。',
+ steps: ['筛选商品记录', '查看属性与图片明细', '用「分类管理」维护分类并批量归类'],
},
}
diff --git a/admin-frontend-vue/src/pages/jd/JdBatchAssignDialog.vue b/admin-frontend-vue/src/pages/jd/JdBatchAssignDialog.vue
index 75654e8f9..885c0ea12 100644
--- a/admin-frontend-vue/src/pages/jd/JdBatchAssignDialog.vue
+++ b/admin-frontend-vue/src/pages/jd/JdBatchAssignDialog.vue
@@ -3,7 +3,7 @@
* 京东数据库页勾选商品(翻页累计,由页面持有勾选集)→ 本对话框选目标分类或移出分类 →
* 一次批量归类。归属写「本组」的归属行(biz_jd_product_group_assign,V203 一组一商品一行),
* 归类不置人工编辑锁(采集照常更新价格/库存)。本组无分类时只有提示不给提交
- * (移出对未分类行是无谓操作),引导去「京东分类管理」新建。 */
+ * (移出对未分类行是无谓操作),引导去工具栏「分类管理」新建(2026-11-17 独立页并回本页)。 */
import { computed, ref, watch } from 'vue'
import { batchAssignJdProductGroup, type JdProductGroup } from './jd-product-api.ts'
import { requestErrorMessage } from '../../api/envelope.ts'
@@ -78,7 +78,7 @@ async function submit(): Promise {
{{ errorText }}
- 本组暂无分类,先去「京东分类管理」新建一个
+ 本组暂无分类,先用工具栏「分类管理」新建一个
-
+/** 分类管理对话框(2026-11-17 用户口径「京东分类管理并到京东数据库分类编辑里,
+ * 做一个搜索和添加 删除 编辑 分类名称即可」):原 V204 独立子菜单页(JdCategoryManagerPage)
+ * 整体并入本对话框,从京东数据库页工具栏「分类管理」打开。
+ * 职责不变:当前数据权限分组的分类建/改名/删除+新增的名称搜索;商品归类不在这里
+ * (去「批量编辑分类」)。列表状态自管理(写操作后自刷新并 emit changed 让父页刷筛选下拉)。
+ * 权限口径(V203)不变:本组管理员/公司超管/平台超管可写(editable);同组普通号
+ * 只读可看(无新建行,改名/删除按钮逐行不渲染),后端同口径 403 兜底。 */
+import { computed, ref, watch } from 'vue'
+import {
+ createJdProductGroup,
+ deleteJdProductGroup,
+ fetchJdProductGroups,
+ updateJdProductGroup,
+ type JdProductGroup,
+} from './jd-product-api.ts'
+import { openAdminConfirm } from '@/components/admin-confirm'
+import { showAdminFeedback } from '@/components/admin-feedback-ui'
+import { loadFailureMessage } from '@/components/load-failure-model'
+import LoadFailureBar from '@/components/LoadFailureBar.vue'
+import { requestErrorMessage } from '../../api/envelope.ts'
+
+const props = defineProps<{
+ visible: boolean
+ /** 当前数据权限分组(分类的作用域;<=0=不属于任何分组,只留空态)。 */
+ ownerGroupId: number
+ ownerGroupName: string
+ /** 当前分组可写(scope 的 editable):建/改名/删除控件全挂它。 */
+ editable: boolean
+}>()
+
+const emit = defineEmits<{ (event: 'close'): void; (event: 'changed'): void }>()
+
+const loading = ref(false)
+/** 首屏取数失败(可见红条+重试);写操作失败走 errorText 红条(无重试语义)。 */
+const loadFailure = ref('')
+const errorText = ref('')
+const groups = ref([])
+/** 搜索:按分类名称包含过滤(本地过滤,不另发请求)。 */
+const keyword = ref('')
+/** 新建:只收名称(排序输入 2026-11-15 客户口径下线,sortOrder 恒 0,后端契约不变)。 */
+const createName = ref('')
+const creating = ref(false)
+/** 改名:正在编辑的分类 id 与草稿名。 */
+const editingId = ref(0)
+const editingName = ref('')
+const saving = ref(false)
+
+const canCreate = computed(() => props.editable && createName.value.trim().length > 0 && !creating.value && !saving.value)
+/** 搜索命中(名称包含,大小写不敏感;空关键字=全量)。 */
+const filteredGroups = computed(() => {
+ const kw = keyword.value.trim().toLowerCase()
+ if (!kw) return groups.value
+ return groups.value.filter((group) => group.name.toLowerCase().includes(kw))
+})
+/** 空表文案分四种:不属于任何组 / 本组没分类(可管理)/ 本组没分类(只读)/ 搜索无命中。 */
+const emptyListText = computed(() => {
+ if (props.ownerGroupId <= 0) return '你还不属于任何数据权限分组'
+ if (!groups.value.length) {
+ return props.editable ? '本组暂无分类,先新建一个' : '本组暂无分类'
+ }
+ return '没有匹配的分类'
+})
+
+async function loadGroups(): Promise {
+ if (props.ownerGroupId <= 0) {
+ groups.value = []
+ loading.value = false
+ loadFailure.value = ''
+ errorText.value = ''
+ return
+ }
+ loading.value = true
+ loadFailure.value = ''
+ try {
+ groups.value = await fetchJdProductGroups(props.ownerGroupId)
+ } catch (error) {
+ loadFailure.value = loadFailureMessage(error, '分类列表加载失败')
+ groups.value = []
+ } finally {
+ loading.value = false
+ }
+}
+
+async function submitCreate(): Promise {
+ const name = createName.value.trim()
+ if (!name || creating.value || !props.editable) return
+ creating.value = true
+ errorText.value = ''
+ try {
+ await createJdProductGroup({ name, sortOrder: 0, ownerGroupId: props.ownerGroupId })
+ createName.value = ''
+ keyword.value = ''
+ showAdminFeedback(`已新建分类「${name}」`, 'success')
+ emit('changed')
+ await loadGroups()
+ } catch (error) {
+ errorText.value = requestErrorMessage(error) || '新建分类失败'
+ } finally {
+ creating.value = false
+ }
+}
+
+function startRename(group: JdProductGroup): void {
+ editingId.value = group.id
+ editingName.value = group.name
+ errorText.value = ''
+}
+
+function cancelRename(): void {
+ editingId.value = 0
+ editingName.value = ''
+}
+
+async function submitRename(group: JdProductGroup): Promise {
+ const name = editingName.value.trim()
+ if (!name || saving.value) return
+ saving.value = true
+ errorText.value = ''
+ try {
+ await updateJdProductGroup(group.id, { name, sortOrder: group.sortOrder })
+ groups.value = groups.value.map((item) => (item.id === group.id ? { ...item, name } : item))
+ cancelRename()
+ showAdminFeedback(`已把分类改名为「${name}」`, 'success')
+ emit('changed')
+ } catch (error) {
+ errorText.value = requestErrorMessage(error) || '改名失败'
+ } finally {
+ saving.value = false
+ }
+}
+
+/** 删除分类不删商品:只解挂本组归属行(商品回到未分类),后端 JdProductGroupService.delete。 */
+async function removeGroup(group: JdProductGroup): Promise {
+ const ok = await openAdminConfirm({ title: '删除分类', message: `确定删除分类「${group.name}」吗?删除后该分类下 ${group.productCount} 个商品回到未分类。`, confirmText: '确认删除', danger: true })
+ if (!ok || saving.value) return
+ saving.value = true
+ errorText.value = ''
+ try {
+ await deleteJdProductGroup(group.id)
+ showAdminFeedback(`已删除分类「${group.name}」`, 'success')
+ emit('changed')
+ await loadGroups()
+ } catch (error) {
+ errorText.value = requestErrorMessage(error) || '删除分类失败'
+ } finally {
+ saving.value = false
+ }
+}
+
+watch(
+ () => props.visible,
+ (visible) => {
+ if (visible) {
+ keyword.value = ''
+ errorText.value = ''
+ loadFailure.value = ''
+ cancelRename()
+ createName.value = ''
+ void loadGroups()
+ }
+ },
+ // immediate:对话框可能以 visible=true 直接挂载(测试/复用场景),这时也要首取。
+ { immediate: true },
+)
+
+
+
+
+
+
+
分类管理· {{ ownerGroupName }}
+
+
+
+ 分类按「数据权限分组」隔离,当前组{{ editable ? '只组长/超管可维护' : '由组长/超管维护' }};
+ 给商品归类:关掉本框,勾选商品后点「批量编辑分类」。
+
+
+
+
+
+
{{ errorText }}
+
+
+
+
+
+
+
+
+
diff --git a/admin-frontend-vue/src/pages/jd/JdCategoryManagerPage.vue b/admin-frontend-vue/src/pages/jd/JdCategoryManagerPage.vue
deleted file mode 100644
index 0d008bb05..000000000
--- a/admin-frontend-vue/src/pages/jd/JdCategoryManagerPage.vue
+++ /dev/null
@@ -1,486 +0,0 @@
-
-
-
-
-
-
-
京东分类管理
-
-
- 分类按「数据权限分组」隔离(京东侧的分组,不同组看不到彼此的分类):当前组只组长/超管可维护;
- 商品归类去「京东数据库」页勾选商品后「批量编辑分类」,删除分类不删商品(只解挂归属)。
-
-
-
-
-
-
- {{ currentGroupName }}
- 你还不属于任何数据权限分组
-
-
-
-
-
-
-
-
- {{ errorText }}
-
-
-
-
-
-
-
diff --git a/admin-frontend-vue/src/pages/jd/JdDatabasePage.vue b/admin-frontend-vue/src/pages/jd/JdDatabasePage.vue
index 762635d0d..a4856dbf0 100644
--- a/admin-frontend-vue/src/pages/jd/JdDatabasePage.vue
+++ b/admin-frontend-vue/src/pages/jd/JdDatabasePage.vue
@@ -2,8 +2,10 @@
/** 京东公共商品库:支持分类和京麦类目组合筛选。
* V203(2026-11-16 用户口径):分类按「数据权限分组」隔离——不同组看不到彼此的分类,
* 能看多组的人用筛选行「分组」下拉切换当前组(只有一组时锁定显示)。
- * 2026-11-17 用户口径:店铺分类弹窗下线(建/改名/删分类挪「京东分类管理」子菜单页);
- * 本页工具栏改「批量编辑分类」——勾选商品(翻页累计记忆)后选目标分类归入或移出。 */
+ * 2026-11-17 用户口径:店铺分类弹窗下线,本页工具栏改「批量编辑分类」——勾选商品
+ * (翻页累计记忆)后选目标分类归入或移出;同日第二刀「京东分类管理并到京东数据库分类
+ * 编辑里」:V204 独立子菜单页(JdCategoryManagerPage)下线,建/改名/删分类收进工具栏
+ * 「分类管理」对话框(JdCategoryManageDialog,带名称搜索)。 */
import { computed, onMounted, reactive, ref } from 'vue'
import {
deleteJdProducts,
@@ -22,6 +24,7 @@ import JdProductDetailDrawer from './JdProductDetailDrawer.vue'
import JdProductEditDrawer from './JdProductEditDrawer.vue'
import JdCategoryCascader from './JdCategoryCascader.vue'
import JdBatchAssignDialog from './JdBatchAssignDialog.vue'
+import JdCategoryManageDialog from './JdCategoryManageDialog.vue'
import OldPagination from '@/components/OldPagination.vue'
import { showAdminFeedback } from '@/components/admin-feedback-ui'
import { openAdminConfirm } from '@/components/admin-confirm'
@@ -55,6 +58,8 @@ const detailItem = ref(null)
const detailVisible = ref(false)
/** 批量编辑分类对话框(2026-11-17 替代下线的店铺分类弹窗)。 */
const batchEditVisible = ref(false)
+/** 分类管理对话框(2026-11-17 第二刀:独立子菜单页并进来,建/改名/删+搜索)。 */
+const manageVisible = ref(false)
/** 行级编辑抽屉(2026-11-15 用户口径「每一条数据后面 需要编辑或者删除;编辑的话
* 这里面都是可以编辑的」):删除走下面的 removeOne(同一条删除链),编辑走独立抽屉。 */
const editItem = ref(null)
@@ -151,6 +156,17 @@ async function openBatchEdit(): Promise {
batchEditVisible.value = true
}
+/** 打开分类管理(对话框自取列表);入口对所有人渲染——同组普通号只读可看(V203),
+ * 写控件由对话框按 editable 分档。 */
+function openManage(): void {
+ manageVisible.value = true
+}
+
+/** 分类管理里有写操作(建/改/删):刷一遍筛选下拉与商品数徽标。 */
+async function onManaged(): Promise {
+ await loadGroupOptions()
+}
+
/** 批量归类完成(对话框已关):清勾选+重取列表(行集 groupName 变了)。
* 移出分类 targetName 为 null;updated 是后端实际写入/解挂的归属行数。 */
async function onBatchAssigned(updated: number, targetName: string | null): Promise {
@@ -181,8 +197,8 @@ async function load(): Promise {
total.value = result.total
if (result.page >= 1) page.value = result.page
// 勾选跨页记忆(2026-11-17 用户口径「支持勾选翻页也要记住」):翻页/重取/改筛选都
- // 不清勾选集——批量编辑分类与批量删除都按累计 id 提交,操作前的确认弹窗点名数量,
- // 工具栏「清除勾选」给显式的反悔出口。
+ // 不清勾选集——批量编辑分类与批量删除都按累计 id 提交,操作前的确认弹窗点名数量;
+ // 「清除勾选」按钮同日用户口径删除,勾选只在批量操作成功后自动清。
} catch (error) {
loadFailure.value = loadFailureMessage(error, '京东商品列表加载失败')
showAdminFeedback(loadFailure.value, 'error')
@@ -246,7 +262,8 @@ async function copyText(text: string): Promise {
// ---------------- 删除(先删桶、全成功才删库行,语义在后端 JdProductDeleteService) ----------------
/** 勾选集(按商品 id,跨页累计记忆,2026-11-17 用户口径)。翻页/重取不清;显式出口
- * 是工具栏「清除勾选」,批量删除/批量归类成功后自动清。 */
+ * 曾是工具栏「清除勾选」,同日用户口径「清除勾选这个按钮删除」后只剩批量删除/
+ * 批量归类成功后自动清。 */
const selectedIds = ref>(new Set())
const deleting = ref(false)
@@ -270,11 +287,6 @@ function toggleSelectAll(checked: boolean): void {
selectedIds.value = next
}
-/** 显式清空勾选(跨页累计后用户需要一个看得见的反悔口)。 */
-function clearSelection(): void {
- selectedIds.value = new Set()
-}
-
/** 单行删除入口(行内按钮):确认弹窗点名商品编码与「桶内图片一并删除」。 */
async function removeOne(row: JdProductItem): Promise {
await removeMany([row.id], `确定删除商品「${row.productCode || row.title}」吗?`)
@@ -386,19 +398,20 @@ onMounted(async () => {
@click="openBatchEdit"
>批量编辑分类
- 只读:编辑/删除仅超级管理员可用;分类由本组管理员在「京东分类管理」维护
+ 非超管看到只读提示,分类维护入口=工具栏「分类管理」(只读可看,写控件按 editable 分档)。 -->
+ 只读:编辑/删除仅超级管理员可用;分类在本页「分类管理」查看与维护
-
+
+ @click="openManage"
+ >分类管理
@@ -488,6 +501,14 @@ onMounted(async () => {
@close="batchEditVisible = false"
@done="onBatchAssigned"
/>
+
import('@/pages/asin/SkipPricePage.vue') },
{ path: 'patent-center/clean-items', menuKey: 'admin_appearance_patent_clean_items', title: '外观专利数据库', companyScoped: true, load: () => import('@/pages/patent/AppearancePatentCleanItemsPage.vue') },
// 京东数据库 2026-11-16 退出公司 tab(参考品牌数据库先例):数据全平台公共,不按公司取数。
+ // 2026-11-17 第二刀:V204 独立「京东分类管理」子菜单页(jd-center/categories)整体并入
+ // 本页工具栏「分类管理」对话框(JdCategoryManageDialog),路由与菜单行(V208 删 V204 行)
+ // 一并下线——用户口径「京东分类管理并到京东数据库分类编辑里」。
{ path: 'jd-center/database', menuKey: 'admin_jd_database', title: '京东数据库', companyScoped: false, load: () => import('@/pages/jd/JdDatabasePage.vue') },
- // 京东分类管理 2026-11-17(用户口径「店铺分类弹窗下线,加个京东分类管理的子菜单维护 CRUD」):
- // 分类建/改名/删除独立成页(V204 菜单行同 key),归类在京东数据库页「批量编辑分类」。
- { path: 'jd-center/categories', menuKey: 'admin_jd_category_manage', title: '京东分类管理', companyScoped: false, load: () => import('@/pages/jd/JdCategoryManagerPage.vue') },
]
export function routeOf(page: AdminPageDef): RouteRecordRaw {
diff --git a/admin-frontend-vue/tests/company-menu-route.test.ts b/admin-frontend-vue/tests/company-menu-route.test.ts
index edd9aa16c..f6c381836 100644
--- a/admin-frontend-vue/tests/company-menu-route.test.ts
+++ b/admin-frontend-vue/tests/company-menu-route.test.ts
@@ -17,8 +17,10 @@ const KEYWORD_USAGE_MIGRATION = join(process.cwd(), '..', 'backend-java', 'src',
'V175__move_gating_and_add_keyword_usage_menu.sql')
const JD_DATABASE_MIGRATION = join(process.cwd(), '..', 'backend-java', 'src', 'main', 'resources', 'db',
'V196__jd_database_menu.sql')
-const JD_CATEGORY_MANAGE_MIGRATION = join(process.cwd(), '..', 'backend-java', 'src', 'main', 'resources', 'db',
- 'V204__jd_category_manage_menu.sql')
+/** V204 插入的「京东分类管理」菜单行已随 2026-11-17 用户口径「京东分类管理并到京东数据库
+ * 分类编辑里」由 V208 删除(页面并入 JdDatabasePage 工具栏「分类管理」对话框)。 */
+const JD_CATEGORY_MANAGE_DROP_MIGRATION = join(process.cwd(), '..', 'backend-java', 'src', 'main', 'resources', 'db',
+ 'V208__drop_jd_category_manage_menu.sql')
interface MigrationMenu {
name: string
@@ -124,23 +126,15 @@ test('V196 新增的京东数据库菜单 key 必须在路由注册表登记', (
assert.ok(!sql.includes('user_column_permission'), 'V196 不得预插授权行(默认仅超管可见)')
})
-test('V204 新增的京东分类管理菜单 key 必须在路由注册表登记(2026-11-17 弹窗下线、CRUD 挪子菜单页)', () => {
- const sql = readFileSync(JD_CATEGORY_MANAGE_MIGRATION, 'utf8')
- const menus = menusInsertedBy(sql)
- const insertCount = (sql.match(/INSERT INTO `columns`/g) || []).length
- assert.ok(menus.length > 0, 'V204 应当插入后台菜单,一条都没解析出来说明正则失效')
- assert.equal(menus.length, insertCount, `解析到 ${menus.length} 条,但迁移有 ${insertCount} 条 INSERT INTO columns`)
+test('V208 删掉 V204 的京东分类管理菜单行,且注册表不再认这个 key(2026-11-17 分类管理并入京东数据库页)', () => {
+ // V204 本体已应用不可回改(铁律 10,文件原样保留作历史取证);下线动作由 V208 出 DELETE,
+ // 页面并入京东数据库页工具栏「分类管理」对话框。
+ const sql = readFileSync(JD_CATEGORY_MANAGE_DROP_MIGRATION, 'utf8')
+ assert.ok(sql.includes("DELETE FROM `columns` WHERE `column_key` = 'admin_jd_category_manage'"),
+ 'V208 必须 DELETE admin_jd_category_manage 菜单行(授权行随外键 CASCADE)')
- const menu = menus.find((item) => item.columnKey === 'admin_jd_category_manage')
- assert.ok(menu, 'V204 必须插入 admin_jd_category_manage 菜单')
- const page = adminPages.find((item) => item.menuKey === 'admin_jd_category_manage')
- assert.ok(page, 'routes.ts 必须有 admin_jd_category_manage 页面,否则菜单点进去 404')
- assert.equal(page.path, menu.routePath, '库里的 route_path 应与注册表路径一致')
- assert.equal(page.title, menu.name, '页面标题应与菜单名一致')
- assert.equal(page.companyScoped, false, '分类按数据权限分组隔离(V203),不按公司 tab 取数')
-
- // 每公司一套树,挂数据管理组、排序 69(V196 京东数据库占 68)。
- assert.ok(sql.includes("grp.`column_key` = 'admin_group_data'"), 'V204 必须把京东分类管理挂到数据管理组')
- assert.ok(/'京东分类管理', 'admin_jd_category_manage', 'admin', 'jd-center\/categories', 69/.test(sql), '京东分类管理排序应为 69')
- assert.ok(!sql.includes('user_column_permission'), 'V204 不得预插授权行(默认仅超管可见)')
+ const registered = adminPages.find((item) => item.menuKey === 'admin_jd_category_manage')
+ assert.ok(!registered, 'routes.ts 不得再登记 admin_jd_category_manage(页面已并入京东数据库页,残留=404 入口)')
+ const jdRouteGone = !adminPages.some((item) => item.path === 'jd-center/categories')
+ assert.ok(jdRouteGone, 'jd-center/categories 路由必须下线')
})
diff --git a/admin-frontend-vue/tests/jd-database-page.test.ts b/admin-frontend-vue/tests/jd-database-page.test.ts
index 221690f7e..c40e7c2f8 100644
--- a/admin-frontend-vue/tests/jd-database-page.test.ts
+++ b/admin-frontend-vue/tests/jd-database-page.test.ts
@@ -32,14 +32,13 @@ test('routes 注册表出现京东数据库页面且退出公司 tab(2026-11-1
assert.equal(page.companyScoped, false, '京东数据库全平台公共,不画公司 tab(AC-6 已被 11-15/11-16 口径推翻)')
})
-/** 2026-11-17 用户口径「店铺分类弹窗删了,加个京东分类管理的子菜单维护 CRUD」(V204):
- * 分类建/改名/删除独立成页,与京东数据库页同在京东平台侧(platform-scope 用例另钉)。 */
-test('routes 注册表出现京东分类管理页面(V204 子菜单),与京东数据库并排退出公司 tab', () => {
- const page = adminPages.find((item) => item.menuKey === 'admin_jd_category_manage')
- assert.ok(page, 'routes.ts 缺 menuKey=admin_jd_category_manage 的注册行')
- assert.equal(page.path, 'jd-center/categories', 'route_path 必须与 V204 菜单一侧一致')
- assert.equal(page.title, '京东分类管理', '菜单标题以「京东分类管理」为准')
- assert.equal(page.companyScoped, false, '分类按数据权限分组隔离(V203),不画公司 tab')
+/** 2026-11-17 用户口径「京东分类管理并到京东数据库分类编辑里」:V204 独立子菜单页下线
+ * (分类建/改名/删收进京东数据库页工具栏「分类管理」对话框),路由注册表不得再登记该 key。 */
+test('routes 注册表不再登记京东分类管理独立页(V204 页并入京东数据库页,残留=404 入口)', () => {
+ assert.ok(!adminPages.some((item) => item.menuKey === 'admin_jd_category_manage'),
+ 'admin_jd_category_manage 注册行必须已删(页面并入京东数据库页)')
+ assert.ok(!adminPages.some((item) => item.path === 'jd-center/categories'),
+ 'jd-center/categories 路由必须下线')
})
/** 详情面的 SKU 矩阵解析(V198):后端下发 camelCase,snake 容错;坏行不炸整块。 */
diff --git a/admin-frontend-vue/tests/mount/jd-category-manage-dialog.mount.test.ts b/admin-frontend-vue/tests/mount/jd-category-manage-dialog.mount.test.ts
new file mode 100644
index 000000000..3ac2d88ff
--- /dev/null
+++ b/admin-frontend-vue/tests/mount/jd-category-manage-dialog.mount.test.ts
@@ -0,0 +1,214 @@
+/**
+ * 京东分类管理对话框(JdCategoryManageDialog)的挂载契约。
+ *
+ * 2026-11-17 用户口径「京东分类管理并到京东数据库分类编辑里,做一个搜索和添加 删除
+ * 编辑 分类名称即可」:V204 独立子菜单页(JdCategoryManagerPage,已删)整体并入本对话框,
+ * 从京东数据库页工具栏「分类管理」打开。原页面契约逐条承接:当前数据权限分组的
+ * 分类建/改名/删除;新增名称搜索(本地过滤)。商品归类不在这里(去「批量编辑分类」)。
+ * 权限口径(V203)不变:editable 才渲染写控件;同组普通号只读可看。
+ *
+ * 跑法:`npx vitest run tests/mount/jd-category-manage-dialog.mount.test.ts`
+ */
+import { beforeEach, describe, expect, it, vi } from 'vitest'
+import { flushPromises, mount, type VueWrapper } from '@vue/test-utils'
+import { createPinia, setActivePinia, type Pinia } from 'pinia'
+
+import JdCategoryManageDialog from '@/pages/jd/JdCategoryManageDialog.vue'
+
+const jdApi = vi.hoisted(() => ({
+ fetchJdProductGroups: vi.fn(),
+ createJdProductGroup: vi.fn(),
+ updateJdProductGroup: vi.fn(),
+ deleteJdProductGroup: vi.fn(),
+}))
+
+const confirmMock = vi.hoisted(() => vi.fn())
+
+vi.mock('@/pages/jd/jd-product-api.ts', () => jdApi)
+vi.mock('@/components/admin-confirm', () => ({ openAdminConfirm: confirmMock }))
+
+/** 分组 id 常量:默认作用域就这一个可见且可写的组(组长档形状)。 */
+const GROUP_A = 11
+
+function group(id: number, name: string, productCount = 0, sortOrder = 0) {
+ return { id, name, ownerGroupId: GROUP_A, sortOrder, productCount }
+}
+
+let pinia: Pinia
+
+beforeEach(() => {
+ vi.clearAllMocks()
+ pinia = createPinia()
+ setActivePinia(pinia)
+ jdApi.fetchJdProductGroups.mockResolvedValue([])
+ confirmMock.mockResolvedValue(true)
+})
+
+async function mountDialog(editable = true): Promise> {
+ const wrapper = mount(JdCategoryManageDialog, {
+ global: { plugins: [pinia] },
+ props: {
+ visible: true,
+ ownerGroupId: GROUP_A,
+ ownerGroupName: '甲组',
+ editable,
+ },
+ })
+ await flushPromises()
+ await flushPromises()
+ return wrapper
+}
+
+describe('京东分类管理对话框(V204 独立页 2026-11-17 并入京东数据库页)', () => {
+ it('打开即按当前分组取分类(ownerGroupId 必带);标题带当前分组名', async () => {
+ jdApi.fetchJdProductGroups.mockResolvedValue([group(7, '裙装', 3)])
+ const wrapper = await mountDialog()
+ expect(jdApi.fetchJdProductGroups).toHaveBeenCalledWith(GROUP_A)
+ expect(wrapper.get('.manage-modal').text()).toContain('分类管理')
+ expect(wrapper.get('.manage-modal').text()).toContain('甲组', '标题/上下文带当前分组名')
+ expect(wrapper.findAll('.option-row')).toHaveLength(1)
+ wrapper.unmount()
+ })
+
+ it('新建分类:落当前分组归属(ownerGroupId 必带),成功后清输入重取并通知父页刷新', async () => {
+ jdApi.fetchJdProductGroups.mockResolvedValue([group(7, '裙装', 3)])
+ const wrapper = await mountDialog()
+ await wrapper.get('.group-create input').setValue('上新区')
+ await wrapper.findAll('button').find((b) => b.text() === '新建')!.trigger('click')
+ await flushPromises()
+ expect(jdApi.createJdProductGroup).toHaveBeenCalledWith({ name: '上新区', sortOrder: 0, ownerGroupId: GROUP_A })
+ expect((wrapper.get('.group-create input').element as HTMLInputElement).value).toBe('')
+ expect(jdApi.fetchJdProductGroups).toHaveBeenCalledTimes(2, '成功后重取分类列表')
+ expect(wrapper.emitted('changed'), '写成功必须 emit changed 让父页刷筛选下拉').toBeTruthy()
+ wrapper.unmount()
+ })
+
+ it('搜索:按名称包含本地过滤(不发额外请求),命中后新建会清关键字', async () => {
+ jdApi.fetchJdProductGroups.mockResolvedValue([group(7, '裙装', 3), group(8, '裤装', 1), group(9, '配饰', 0)])
+ const wrapper = await mountDialog()
+ const callsBefore = jdApi.fetchJdProductGroups.mock.calls.length
+ await wrapper.get('.search-input').setValue('裙')
+ await flushPromises()
+ expect(wrapper.findAll('.option-row')).toHaveLength(1, '「裙」只命中裙装')
+ expect(wrapper.findAll('.option-row')[0].text()).toContain('裙装')
+ expect(jdApi.fetchJdProductGroups.mock.calls.length).toBe(callsBefore, '搜索是本地过滤,不另发请求')
+ expect(wrapper.text()).not.toContain('裤装', '不匹配项不出现')
+
+ await wrapper.get('.group-create input').setValue('上新区')
+ await wrapper.findAll('button').find((b) => b.text() === '新建')!.trigger('click')
+ await flushPromises()
+ expect((wrapper.get('.search-input').element as HTMLInputElement).value).toBe('',
+ '新建成功清关键字(新分类不被旧搜索藏住)')
+ wrapper.unmount()
+ })
+
+ it('搜索无命中给显式空态文案(不是空列表静默)', async () => {
+ jdApi.fetchJdProductGroups.mockResolvedValue([group(7, '裙装', 3)])
+ const wrapper = await mountDialog()
+ await wrapper.get('.search-input').setValue('不存在的分类')
+ expect(wrapper.get('.manage-empty').text()).toBe('没有匹配的分类')
+ wrapper.unmount()
+ })
+
+ it('改名:行内编辑后按 (id, {name, sortOrder}) 提交并 emit changed', async () => {
+ jdApi.fetchJdProductGroups.mockResolvedValue([group(7, '裙装', 3)])
+ const wrapper = await mountDialog()
+ await wrapper.findAll('button').find((b) => b.text() === '改名')!.trigger('click')
+ await wrapper.get('.rename-input').setValue('长裙')
+ await wrapper.findAll('button').find((b) => b.text() === '保存')!.trigger('click')
+ await flushPromises()
+ expect(jdApi.updateJdProductGroup).toHaveBeenCalledWith(7, { name: '长裙', sortOrder: 0 })
+ expect(wrapper.emitted('changed')).toBeTruthy()
+ wrapper.unmount()
+ })
+
+ it('删除:二次确认文案点名商品数(删除不删商品,只解挂归属),确认后调端点重取', async () => {
+ jdApi.fetchJdProductGroups.mockResolvedValue([group(7, '裙装', 3)])
+ const wrapper = await mountDialog()
+ await wrapper.findAll('button').find((b) => b.text() === '删除')!.trigger('click')
+ await flushPromises()
+ expect(confirmMock).toHaveBeenCalledTimes(1)
+ const options = confirmMock.mock.calls[0][0]
+ expect(options.title).toBe('删除分类')
+ expect(options.message).toContain('确定删除分类「裙装」吗')
+ expect(options.message).toContain('3 个商品回到未分类', '文案点名该分类下的商品数')
+ expect(options.danger).toBe(true)
+ expect(jdApi.deleteJdProductGroup).toHaveBeenCalledWith(7)
+ expect(jdApi.fetchJdProductGroups).toHaveBeenCalledTimes(2, '删除成功后重取列表')
+ expect(wrapper.emitted('changed')).toBeTruthy()
+ wrapper.unmount()
+ })
+
+ it('删除确认点取消就不发请求(防误删第一道闸)', async () => {
+ confirmMock.mockResolvedValue(false)
+ jdApi.fetchJdProductGroups.mockResolvedValue([group(7, '裙装', 3)])
+ const wrapper = await mountDialog()
+ await wrapper.findAll('button').find((b) => b.text() === '删除')!.trigger('click')
+ await flushPromises()
+ expect(confirmMock).toHaveBeenCalledTimes(1)
+ expect(jdApi.deleteJdProductGroup).not.toHaveBeenCalled()
+ wrapper.unmount()
+ })
+
+ it('只读档(editable=false):无新建行、无搜索仍可用、无改名/删除按钮', async () => {
+ const wrapper = await mountDialog(false)
+ expect(wrapper.find('.group-create').exists()).toBe(false, '只读账号不渲染新建行')
+ expect(wrapper.findAll('button').some((b) => b.text() === '改名')).toBe(false)
+ expect(wrapper.findAll('button').some((b) => b.text() === '删除')).toBe(false)
+ expect(wrapper.get('.search-input').exists()).toBe(true, '搜索是读面,只读档保留')
+ wrapper.unmount()
+ })
+
+ it('不属于任何数据权限分组(ownerGroupId<=0):不发取数请求,空态直说', async () => {
+ const wrapper = mount(JdCategoryManageDialog, {
+ global: { plugins: [pinia] },
+ props: { visible: true, ownerGroupId: 0, ownerGroupName: '', editable: false },
+ })
+ await flushPromises()
+ await flushPromises()
+ expect(jdApi.fetchJdProductGroups).not.toHaveBeenCalled()
+ expect(wrapper.get('.manage-empty').text()).toBe('你还不属于任何数据权限分组')
+ expect(wrapper.find('.group-create').exists()).toBe(false)
+ wrapper.unmount()
+ })
+
+ it('本组暂无分类:可写档文案引导新建,只读档直说', async () => {
+ const writable = await mountDialog(true)
+ expect(writable.get('.manage-empty').text()).toBe('本组暂无分类,先新建一个')
+ writable.unmount()
+
+ const readonly = await mountDialog(false)
+ expect(readonly.get('.manage-empty').text()).toBe('本组暂无分类')
+ readonly.unmount()
+ })
+
+ it('加载失败:红条可见且重试真能重跑(取数页硬规矩)', async () => {
+ jdApi.fetchJdProductGroups.mockRejectedValueOnce(new Error('上游 502'))
+ const wrapper = mount(JdCategoryManageDialog, {
+ global: { plugins: [pinia] },
+ props: { visible: true, ownerGroupId: GROUP_A, ownerGroupName: '甲组', editable: true },
+ })
+ await flushPromises()
+ await flushPromises()
+ const bar = wrapper.find('.load-failure-bar')
+ expect(bar.exists()).toBe(true, '失败态必须可见(不是一闪而过的 toast)')
+ expect(bar.text()).toContain('分类列表加载失败')
+ expect(bar.text()).toContain('上游 502', '后端/网络原因要进文案')
+ jdApi.fetchJdProductGroups.mockResolvedValue([group(7, '裙装', 3)])
+ await bar.find('button').trigger('click')
+ await flushPromises()
+ await flushPromises()
+ expect(wrapper.find('.load-failure-bar').exists()).toBe(false, '重试成功后红条消失')
+ expect(wrapper.text()).toContain('裙装')
+ wrapper.unmount()
+ })
+
+ it('页面职责边界(反向钉):归类不在本对话框——不出现批量归类/删除勾选入口', async () => {
+ jdApi.fetchJdProductGroups.mockResolvedValue([group(7, '裙装', 3)])
+ const wrapper = await mountDialog()
+ expect(wrapper.findAll('button').some((b) => b.text() === '批量编辑分类')).toBe(false, '归类入口在京东数据库页')
+ expect(wrapper.text()).toContain('批量编辑分类', '但提示要指路(关掉本框去勾选商品归类)')
+ expect(jdApi.deleteJdProductGroup).not.toHaveBeenCalled()
+ wrapper.unmount()
+ })
+})
diff --git a/admin-frontend-vue/tests/mount/jd-category-manager-page.mount.test.ts b/admin-frontend-vue/tests/mount/jd-category-manager-page.mount.test.ts
deleted file mode 100644
index 005f1798e..000000000
--- a/admin-frontend-vue/tests/mount/jd-category-manager-page.mount.test.ts
+++ /dev/null
@@ -1,172 +0,0 @@
-/**
- * 京东分类管理页(V204,2026-11-17 用户口径「店铺分类弹窗删了,加个京东分类管理的子菜单
- * 维护 CRUD」)的挂载契约:当前数据权限分组的分类建/改名/删除独立成页;分组作用域与
- * 京东数据库页同一套(京东侧分组,非亚马逊——platform-scope JD_MENU_KEYS);
- * 商品归类不在这里(去京东数据库页「批量编辑分类」)。
- *
- * 跑法:`npx vitest run tests/mount/jd-category-manager-page.mount.test.ts`
- */
-import { beforeEach, describe, expect, it, vi } from 'vitest'
-import { flushPromises, mount } from '@vue/test-utils'
-import { createPinia, setActivePinia, type Pinia } from 'pinia'
-
-import JdCategoryManagerPage from '@/pages/jd/JdCategoryManagerPage.vue'
-
-const jdApi = vi.hoisted(() => ({
- fetchJdCategoryScope: vi.fn(),
- fetchJdProductGroups: vi.fn(),
- createJdProductGroup: vi.fn(),
- updateJdProductGroup: vi.fn(),
- deleteJdProductGroup: vi.fn(),
-}))
-
-const confirmMock = vi.hoisted(() => vi.fn())
-
-vi.mock('@/pages/jd/jd-product-api.ts', () => jdApi)
-vi.mock('@/components/admin-confirm', () => ({ openAdminConfirm: confirmMock }))
-
-/** 分组 id 常量:默认作用域就这一个可见且可写的组(组长档形状)。 */
-const GROUP_A = 11
-
-function singleGroupScope(editable = true) {
- return {
- platformSuperAdmin: false,
- defaultGroupId: GROUP_A,
- groups: [{ id: GROUP_A, name: '甲组', label: '甲组', editable }],
- }
-}
-
-function group(id: number, name: string, productCount = 0, sortOrder = 0) {
- return { id, name, ownerGroupId: GROUP_A, sortOrder, productCount }
-}
-
-let pinia: Pinia
-
-beforeEach(() => {
- vi.clearAllMocks()
- pinia = createPinia()
- setActivePinia(pinia)
- jdApi.fetchJdCategoryScope.mockResolvedValue(singleGroupScope())
- jdApi.fetchJdProductGroups.mockResolvedValue([])
- confirmMock.mockResolvedValue(true)
-})
-
-async function mountPage(): Promise> {
- const wrapper = mount(JdCategoryManagerPage, { global: { plugins: [pinia] } })
- await flushPromises()
- await flushPromises()
- return wrapper
-}
-
-describe('京东分类管理(V204 子菜单页)', () => {
- it('首屏按默认组取分类;多组可见出「分组」下拉,切组重取', async () => {
- jdApi.fetchJdCategoryScope.mockResolvedValue({
- platformSuperAdmin: true,
- defaultGroupId: GROUP_A,
- groups: [
- { id: GROUP_A, name: 'A组', label: '甲公司 / A组', editable: true },
- { id: 12, name: 'B组', label: '甲公司 / B组', editable: false },
- ],
- })
- jdApi.fetchJdProductGroups.mockResolvedValue([group(7, '裙装', 3)])
- const wrapper = await mountPage()
- expect(jdApi.fetchJdProductGroups).toHaveBeenCalledWith(GROUP_A)
- const picker = wrapper.get('[aria-label="当前分组"]')
- expect((picker.element as HTMLSelectElement).closest('.form-group')?.querySelector('label')?.textContent).toBe('分组',
- '分组是带标签的表单控件(与京东数据库页筛选行同口径)')
- expect(picker.findAll('option').map((o) => o.text())).toEqual(['甲公司 / A组', '甲公司 / B组'])
-
- await picker.setValue('12')
- await flushPromises()
- // 切组后分类按新组重取(跨组不可见,V203)。
- expect(jdApi.fetchJdProductGroups).toHaveBeenLastCalledWith(12)
- wrapper.unmount()
- })
-
- it('新建分类:落当前分组归属(ownerGroupId 必带),成功后清输入并重取', async () => {
- jdApi.fetchJdProductGroups.mockResolvedValue([group(7, '裙装', 3)])
- const wrapper = await mountPage()
- await wrapper.get('.group-create input').setValue('上新区')
- await wrapper.findAll('button').find((b) => b.text() === '新建')!.trigger('click')
- await flushPromises()
- expect(jdApi.createJdProductGroup).toHaveBeenCalledWith({ name: '上新区', sortOrder: 0, ownerGroupId: GROUP_A })
- expect((wrapper.get('.group-create input').element as HTMLInputElement).value).toBe('')
- expect(jdApi.fetchJdProductGroups).toHaveBeenCalledTimes(2, '成功后重取分类列表')
- wrapper.unmount()
- })
-
- it('改名:行内编辑后按 (id, {name, sortOrder}) 提交', async () => {
- jdApi.fetchJdProductGroups.mockResolvedValue([group(7, '裙装', 3)])
- const wrapper = await mountPage()
- await wrapper.findAll('button').find((b) => b.text() === '改名')!.trigger('click')
- await wrapper.get('.rename-input').setValue('长裙')
- await wrapper.findAll('button').find((b) => b.text() === '保存')!.trigger('click')
- await flushPromises()
- expect(jdApi.updateJdProductGroup).toHaveBeenCalledWith(7, { name: '长裙', sortOrder: 0 })
- wrapper.unmount()
- })
-
- it('删除:二次确认文案点名商品数(删除不删商品,只解挂归属),确认后调端点重取', async () => {
- jdApi.fetchJdProductGroups.mockResolvedValue([group(7, '裙装', 3)])
- const wrapper = await mountPage()
- await wrapper.findAll('button').find((b) => b.text() === '删除')!.trigger('click')
- await flushPromises()
- expect(confirmMock).toHaveBeenCalledTimes(1)
- const options = confirmMock.mock.calls[0][0]
- expect(options.title).toBe('删除分类')
- expect(options.message).toContain('确定删除分类「裙装」吗')
- expect(options.message).toContain('3 个商品回到未分类', '文案点名该分类下的商品数')
- expect(options.danger).toBe(true)
- expect(jdApi.deleteJdProductGroup).toHaveBeenCalledWith(7)
- wrapper.unmount()
- })
-
- it('只读档(editable=false):无新建行、无改名/删除按钮,空表文案不带「先新建」', async () => {
- jdApi.fetchJdCategoryScope.mockResolvedValue(singleGroupScope(false))
- jdApi.fetchJdProductGroups.mockResolvedValue([])
- const wrapper = await mountPage()
- expect(wrapper.find('.group-create').exists()).toBe(false, '只读账号不渲染新建行')
- expect(wrapper.findAll('button').some((b) => b.text() === '改名')).toBe(false)
- expect(wrapper.findAll('button').some((b) => b.text() === '删除')).toBe(false)
- expect(wrapper.find('thead').text()).not.toContain('操作', '只读档连操作列表头都不渲染')
- expect(wrapper.find('.empty-tip').text()).toBe('本组暂无分类')
- wrapper.unmount()
- })
-
- it('不属于任何数据权限分组:锁定芯片直说空态,不出下拉与新建行', async () => {
- jdApi.fetchJdCategoryScope.mockResolvedValue({ platformSuperAdmin: false, defaultGroupId: null, groups: [] })
- const wrapper = await mountPage()
- expect(wrapper.find('[aria-label="当前分组"]').exists()).toBe(false)
- expect(wrapper.get('.group-locked').text()).toBe('你还不属于任何数据权限分组')
- expect(wrapper.find('.group-create').exists()).toBe(false)
- expect(wrapper.find('.empty-tip').text()).toBe('你还不属于任何数据权限分组')
- wrapper.unmount()
- })
-
- it('加载失败:红条可见且重试真能重跑(取数页硬规矩),切组后重取成功即清', async () => {
- jdApi.fetchJdProductGroups.mockRejectedValueOnce(new Error('上游 502'))
- const wrapper = mount(JdCategoryManagerPage, { global: { plugins: [pinia] } })
- await flushPromises()
- await flushPromises()
- const bar = wrapper.find('.load-failure-bar')
- expect(bar.exists()).toBe(true, '失败态必须可见(不是一闪而过的 toast)')
- expect(bar.text()).toContain('分类列表加载失败')
- expect(bar.text()).toContain('上游 502', '后端/网络原因要进文案')
- jdApi.fetchJdProductGroups.mockResolvedValue([group(7, '裙装', 3)])
- await bar.find('button').trigger('click')
- await flushPromises()
- await flushPromises()
- expect(wrapper.find('.load-failure-bar').exists()).toBe(false, '重试成功后红条消失')
- expect(wrapper.text()).toContain('裙装')
- wrapper.unmount()
- })
-
- it('页面职责边界(反向钉):归类不在本页——页面不出现批量归类/商品列表入口', async () => {
- jdApi.fetchJdProductGroups.mockResolvedValue([group(7, '裙装', 3)])
- const wrapper = await mountPage()
- expect(wrapper.findAll('button').some((b) => b.text() === '批量编辑分类')).toBe(false, '归类入口在京东数据库页')
- expect(wrapper.text()).toContain('京东数据库', '页内提示指路「京东数据库」页')
- expect(jdApi.deleteJdProductGroup).not.toHaveBeenCalled()
- wrapper.unmount()
- })
-})
diff --git a/admin-frontend-vue/tests/mount/jd-database-page.mount.test.ts b/admin-frontend-vue/tests/mount/jd-database-page.mount.test.ts
index 81835fb0c..ad0b3728d 100644
--- a/admin-frontend-vue/tests/mount/jd-database-page.mount.test.ts
+++ b/admin-frontend-vue/tests/mount/jd-database-page.mount.test.ts
@@ -4,8 +4,11 @@
* 形态:panel-box + 筛选行(商品编码/标题关键字/类目/分组/同步起止 date 对)+
* 查询/重置 + 自绘明细表(点行开详情抽屉)+ OldPagination;
* 分组下拉 2026-11-16 用户口径「做成分组」上移进筛选行=带标签的表单控件(不再是工具栏裸下拉);
- * 店铺分类弹窗 2026-11-17 用户口径下线:工具栏改「批量编辑分类」(勾选跨页累计+归入/移出),
- * 分类建/改名/删除挪「京东分类管理」子菜单页(V204,另见 jd-category-manager-page.mount.test.ts)。
+ * 店铺分类弹窗 2026-11-17 用户口径下线:工具栏改「批量编辑分类」(勾选跨页累计+归入/移出);
+ * 同日第二刀「京东分类管理并到京东数据库分类编辑里」:V204 独立子菜单页下线
+ * (jd-category-manager-page.mount.test.ts 随之删除),建/改名/删分类+搜索收进工具栏
+ * 「分类管理」对话框(另见 jd-category-manage-dialog.mount.test.ts);
+ * 「清除勾选」按钮同日用户口径删除(勾选只在批量操作成功后自动清)。
* 公司维度 2026-11-16 整页摘除(「删除掉公司 tab,参考品牌数据库」):页面不消费公司 tab
* store、列表/类目下拉不带 company_id(反向钉在 company-tab-wiring「公司维度不得回流」)。
* 商品状态筛选/列与导出按钮已随 2026-11-15 客户口径从前端下线(后端端点保留);
@@ -114,7 +117,7 @@ async function mountWith(payload: unknown): Promise> {
* 勾选跨页累计记忆(翻页/重取不清)→ 对话框选目标分类归入或移出 → 按 (ids, groupId,
* ownerGroupId) 提交;成功后清勾选并重取。旧弹窗的「勾选翻页即清」口径同日废止。 */
describe('批量编辑分类(店铺分类弹窗 2026-11-17 下线后的替代入口)', () => {
- it('勾选跨页记忆:第 1 页勾 1 行翻到第 2 页再勾 1 行,删除按累计 2 行提交,清除勾选可显式清零', async () => {
+ it('勾选跨页记忆:第 1 页勾 1 行翻到第 2 页再勾 1 行,删除按累计 2 行提交;「清除勾选」按钮已删(2026-11-17 用户口径)', async () => {
jdApi.fetchJdProductList
.mockImplementationOnce(() => Promise.resolve({ items: [item(1)], total: 40, page: 1, pageSize: 20 }))
.mockImplementation(() => Promise.resolve({ items: [item(2)], total: 40, page: 2, pageSize: 20 }))
@@ -122,7 +125,6 @@ describe('批量编辑分类(店铺分类弹窗 2026-11-17 下线后的替代
await flushPromises()
await flushPromises()
const deleteBtn = () => wrapper.get('.jd-delete-btn')
- const clearBtn = () => wrapper.findAll('button').find((b) => b.text() === '清除勾选')
await wrapper.findAll('tbody input[type="checkbox"]')[0].setValue(true)
expect(deleteBtn().text()).toContain('删除勾选(1)')
@@ -133,7 +135,8 @@ describe('批量编辑分类(店铺分类弹窗 2026-11-17 下线后的替代
expect(deleteBtn().text()).toContain('删除勾选(1)', '翻页后第 1 页的勾选仍在累计集里')
await wrapper.findAll('tbody input[type="checkbox"]')[0].setValue(true)
expect(deleteBtn().text()).toContain('删除勾选(2)', '第 2 页再勾 1 行,累计 2 行')
- expect(clearBtn(), '有勾选时「清除勾选」出现').toBeTruthy()
+ expect(wrapper.findAll('button').some((b) => b.text() === '清除勾选')).toBe(false,
+ '「清除勾选」按钮 2026-11-17 用户口径删除(显式反悔口没了,勾选只在批量操作成功后自动清)')
// 累计勾选直达删除:跨页的行一起删(确认弹窗点名总数)。
jdApi.deleteJdProducts.mockResolvedValueOnce({ deleted: 2, imagesDeleted: 0, objectsDeleted: 0, objectsKept: 0, objectsSkipped: 0 })
@@ -143,12 +146,7 @@ describe('批量编辑分类(店铺分类弹窗 2026-11-17 下线后的替代
expect(confirmMock.mock.calls.at(-1)![0].message).toContain('确定删除勾选的 2 个商品吗', '确认文案点名累计总数')
// 跨页累计的 id 一起提交。
expect(jdApi.deleteJdProducts).toHaveBeenLastCalledWith([1, 2])
-
- // 显式反悔口:清除勾选后按钮回置灰。
- await wrapper.findAll('tbody input[type="checkbox"]')[0].setValue(true)
- await clearBtn()!.trigger('click')
- expect(deleteBtn().text()).toContain('删除勾选(0)')
- expect(wrapper.findAll('button').some((b) => b.text() === '清除勾选')).toBe(false, '勾选 0 时清除按钮消失')
+ expect(deleteBtn().text()).toContain('删除勾选(0)', '批量删除成功后自动清勾选')
wrapper.unmount()
})
@@ -206,7 +204,7 @@ describe('批量编辑分类(店铺分类弹窗 2026-11-17 下线后的替代
wrapper.unmount()
})
- it('本组暂无分类:对话框只留提示不给提交(移出对未分类行是无谓操作),引导去分类管理页', async () => {
+ it('本组暂无分类:对话框只留提示不给提交(移出对未分类行是无谓操作),引导去工具栏「分类管理」新建', async () => {
jdApi.fetchJdProductGroups.mockResolvedValue([])
const wrapper = await mountWith({ items: [item(1)], total: 1, page: 1, pageSize: 20 })
await wrapper.findAll('tbody input[type="checkbox"]')[0].setValue(true)
@@ -214,7 +212,7 @@ describe('批量编辑分类(店铺分类弹窗 2026-11-17 下线后的替代
await flushPromises()
const modal = wrapper.get('.batch-modal')
expect(modal.text()).toContain('本组暂无分类')
- expect(modal.text()).toContain('京东分类管理', '空态把维护入口指向「京东分类管理」')
+ expect(modal.text()).toContain('分类管理', '空态把维护入口指向工具栏「分类管理」(独立页 2026-11-17 并入本页)')
expect(modal.findAll('button').some((b) => b.text() === '移出分类' && b.attributes('disabled') === undefined)).toBe(false,
'无分类时移出不可提交')
expect(jdApi.batchAssignJdProductGroup).not.toHaveBeenCalled()
@@ -231,6 +229,60 @@ describe('批量编辑分类(店铺分类弹窗 2026-11-17 下线后的替代
})
})
+/** 分类管理入口(2026-11-17 用户口径「京东分类管理并到京东数据库分类编辑里」):
+ * V204 独立子菜单页下线,工具栏「分类管理」打开 JdCategoryManageDialog(搜索+新建+
+ * 改名+删除);入口对所有人渲染(同组普通号只读可看),写控件由对话框按 editable 分档;
+ * 对话框 CRUD 成功 emit changed ⇒ 父页刷分类筛选下拉。 */
+describe('分类管理入口(V204 独立页并入京东数据库页)', () => {
+ it('工具栏「分类管理」入口常显(勾选 0 也可用),点开渲染对话框且按当前分组取分类', async () => {
+ jdApi.fetchJdProductGroups.mockResolvedValue([{ id: 7, name: '裙装', sortOrder: 0, productCount: 3 }])
+ const wrapper = await mountWith({ items: [item(1)], total: 1, page: 1, pageSize: 20 })
+ const manageBtn = () => wrapper.findAll('button').find((b) => b.text() === '分类管理')
+ expect(manageBtn(), '入口常显(不等勾选)').toBeTruthy()
+ expect(wrapper.find('.manage-modal').exists()).toBe(false, '未点开时不渲染对话框')
+
+ const callsBefore = jdApi.fetchJdProductGroups.mock.calls.length
+ await manageBtn()!.trigger('click')
+ await flushPromises()
+ const modal = wrapper.get('.manage-modal')
+ expect(modal.text()).toContain('分类管理')
+ expect(modal.text()).toContain('甲组', '标题带当前分组名')
+ expect(modal.get('.search-input').exists()).toBe(true, '搜索框是本对话框新能力')
+ expect(modal.text()).toContain('裙装')
+ expect(jdApi.fetchJdProductGroups.mock.calls.length).toBeGreaterThan(callsBefore,
+ '对话框打开时按当前分组自取列表')
+ wrapper.unmount()
+ })
+
+ it('对话框内删分类成功(emit changed)后父页重取分类下拉(筛选选项与商品数徽标同步刷新)', async () => {
+ // 取数按次序变形:页面首屏=裙装;对话框打开与 changed 后的重取=删后列表(只剩裤装)。
+ let groupFetchCount = 0
+ jdApi.fetchJdProductGroups.mockImplementation(() => {
+ groupFetchCount += 1
+ return groupFetchCount === 1
+ ? Promise.resolve([{ id: 7, name: '裙装', sortOrder: 0, productCount: 3 }])
+ : Promise.resolve([{ id: 8, name: '裤装', sortOrder: 1, productCount: 1 }])
+ })
+ const wrapper = await mountWith({ items: [item(1)], total: 1, page: 1, pageSize: 20 })
+ expect(wrapper.get('[aria-label="筛选店铺分类"]').text()).toContain('裙装', '首屏下拉含首取分类')
+
+ await wrapper.findAll('button').find((b) => b.text() === '分类管理')!.trigger('click')
+ await flushPromises()
+ const modal = wrapper.get('.manage-modal')
+ confirmMock.mockResolvedValue(true)
+ jdApi.deleteJdProductGroup.mockResolvedValueOnce(undefined)
+ await modal.findAll('button').find((b) => b.text() === '删除')!.trigger('click')
+ await flushPromises()
+ await flushPromises()
+ expect(jdApi.deleteJdProductGroup, '删除按钮属于当前列表行').toHaveBeenCalledWith(8)
+ // changed → 父页 loadGroupOptions:下拉按新列表重取(最后一次调用拿到删后列表)。
+ const select = wrapper.get('[aria-label="筛选店铺分类"]')
+ expect(select.text()).toContain('裤装', '下拉刷新出新一轮分类')
+ expect(select.text()).not.toContain('裙装', '删掉的分类不再出现在筛选下拉')
+ wrapper.unmount()
+ })
+})
+
describe('京东数据库页(v1.4 Phase 5)', () => {
it('挂载后按首屏分页参数取列表(pageSize 默认 20、不带公司维度),行数=本页条数', async () => {
const wrapper = await mountWith({ items: [item(1), item(2), item(3)], total: 42, page: 1, pageSize: 20 })
@@ -699,10 +751,10 @@ describe('京东数据库页(v1.4 Phase 5)', () => {
})
/** 写权限分档(2026-11-16 用户口径收窄商品行写;2026-11-17 弹窗下线后更新):
- * 商品行写(编辑/删除/勾选批量删)只对平台超管渲染;分类写(批量编辑分类)由 scope 的
- * 每组 editable 决定(本组管理员/公司超管/平台超管)——同组普通号在本页只读,
- * 只读查看入口在「京东分类管理」子菜单页(V204)。勾选列 2026-11-17 起对本组可写
- * 分类管理员开放(服务批量归类),商品行按钮仍只归平台超管。 */
+ * 商品行写(编辑/删除/勾选批量删)只对平台超管渲染;分类写(批量编辑分类、分类管理)由
+ * scope 的每组 editable 决定(本组管理员/公司超管/平台超管)——同组普通号在本页只读,
+ * 分类维护入口=工具栏「分类管理」对话框(V204 独立页 2026-11-17 并入,只读可看)。
+ * 勾选列 2026-11-17 起对本组可写分类管理员开放(服务批量归类),商品行按钮仍只归平台超管。 */
describe('京东数据库写权限分档(商品行写=平台超管;分类写=本组 editable)', () => {
it('非超管且本组不可写:无勾选列、无操作列、无删除勾选、无批量编辑分类;列表/筛选/详情照常', async () => {
useAdminSessionStore().user = { id: 2, username: 'ops', role: 'admin' }
@@ -717,9 +769,11 @@ describe('京东数据库写权限分档(商品行写=平台超管;分类
expect(wrapper.findAll('tbody input[type="checkbox"]')).toHaveLength(0, '不可写分类的普通号没有勾选列')
expect(wrapper.find('.jd-delete-btn').exists()).toBe(false, '批量删除按钮不渲染')
expect(wrapper.findAll('button').some((b) => b.text() === '批量编辑分类')).toBe(false, '分类写入口不渲染(本组不可写)')
+ expect(wrapper.findAll('button').some((b) => b.text() === '分类管理')).toBe(true,
+ '分类管理入口是读面,普通号也能打开看(写控件由对话框按 editable 分档)')
expect(wrapper.find('thead').text()).not.toContain('操作', '操作列(编辑/删除)不渲染')
expect(wrapper.text()).toContain('只读:编辑/删除仅超级管理员可用', '只读提示必须看得见并区分两类写权限')
- expect(wrapper.text()).toContain('京东分类管理', '提示把分类维护入口指向「京东分类管理」子菜单页')
+ expect(wrapper.text()).toContain('分类在本页「分类管理」查看与维护', '提示把分类维护入口指向本页「分类管理」(独立页已并入)')
// 读面不受影响:筛选下拉、列表行、点行开详情都还在。
expect(wrapper.get('[aria-label="筛选店铺分类"]').exists()).toBe(true, '分类筛选是读面,保留')
@@ -834,7 +888,7 @@ describe('京东数据库分类按数据权限分组隔离(V203)', () => {
wrapper.unmount()
})
- it('不属于任何数据权限分组:分类全空、不给切换也不给批量归类入口(空态兜底在「京东分类管理」页)', async () => {
+ it('不属于任何数据权限分组:分类全空、不给切换也不给批量归类入口', async () => {
jdApi.fetchJdCategoryScope.mockResolvedValue({ platformSuperAdmin: false, defaultGroupId: null, groups: [] })
const wrapper = await mountWith({ items: [item(1, { groupId: null, groupName: '' })], total: 1, page: 1, pageSize: 20 })
expect(wrapper.find('[aria-label="当前分组"]').exists()).toBe(false)
diff --git a/admin-frontend-vue/tests/ops-cell-must-wrap.test.ts b/admin-frontend-vue/tests/ops-cell-must-wrap.test.ts
index 935b8aff4..ccdb67fd7 100644
--- a/admin-frontend-vue/tests/ops-cell-must-wrap.test.ts
+++ b/admin-frontend-vue/tests/ops-cell-must-wrap.test.ts
@@ -36,8 +36,8 @@ const OPS_MIN_COL_PX: Record = {
'src/pages/asin/ProductCategoryPage.vue': 138,
'src/pages/asin/QueryAsinPage.vue': 138,
'src/pages/asin/SkipPricePage.vue': 138,
- // 京东分类管理(V204):改名/删除两颗 btn-sm(两字 53×2+gap+左右 padding 24)。
- 'src/pages/jd/JdCategoryManagerPage.vue': 138,
+ // 京东分类管理页(V204)2026-11-17 下线:CRUD 并入京东数据库页「分类管理」对话框
+ // (对话框无表格操作列,不进本表)。
'src/pages/records/DeviceLogsPage.vue': 138,
'src/pages/records/RecordsDigitalHumanVersionPage.vue': 287,
'src/pages/records/RecordsSoftwareVersionPage.vue': 77,
diff --git a/admin-frontend-vue/tests/platform-menu-filter.test.ts b/admin-frontend-vue/tests/platform-menu-filter.test.ts
index f545ee65e..f83ce6901 100644
--- a/admin-frontend-vue/tests/platform-menu-filter.test.ts
+++ b/admin-frontend-vue/tests/platform-menu-filter.test.ts
@@ -40,7 +40,6 @@ const TREE: AdminMenuNode[] = [
node('admin_query_asin', '查询ASIN', '/asin-center/query'),
node('admin_appearance_patent_clean_items', '外观专利数据库', '/patent-center/clean-items'),
node('admin_jd_database', '京东数据库', '/jd-center/database'),
- node('admin_jd_category_manage', '京东分类管理', '/jd-center/categories'),
node('admin_product_categories', '商品类目', '/asin-center/categories'),
]),
]
@@ -60,24 +59,20 @@ test('menuKey 平台归属:京东独占即 [jd],双侧清单即两侧,其
assert.deepEqual(platformsOfMenuKey(''), ['amazon'])
})
-test('京东 tab:账号与权限只余双侧三项,数据管理只余京东两页(数据库+分类管理);顺序与 route 原样透传', () => {
+test('京东 tab:账号与权限只余双侧三项,数据管理只余京东独占页(2026-11-17 分类管理并入京东数据库页后只剩数据库一页);顺序与 route 原样透传', () => {
const filtered = filterMenuTreeByPlatform(TREE, 'jd')
assert.deepEqual(filtered.map((item) => item.key), ['admin_group_account', 'admin_group_data'])
assert.deepEqual(groupChildKeys(filtered, 'admin_group_account'),
['admin_users', 'admin_group_manage', 'admin_companies'])
- // 2026-11-17 用户口径「这边分组是京东的分组管理的而不是亚马逊的」:分类管理子菜单
- // 归京东侧(JD_MENU_KEYS),亚马逊 tab 侧看不到它(亚马逊用例反向钉住)。
- assert.deepEqual(groupChildKeys(filtered, 'admin_group_data'),
- ['admin_jd_database', 'admin_jd_category_manage'])
+ // 2026-11-17 晚用户口径「京东分类管理并到京东数据库分类编辑里」:分类管理子菜单
+ // (V204)下线,京东侧数据管理组只剩京东数据库一页。
+ assert.deepEqual(groupChildKeys(filtered, 'admin_group_data'), ['admin_jd_database'])
const jd = filtered[1].children![0]
assert.equal(jd.route, '/jd-center/database')
assert.equal(jd.name, '京东数据库')
- const categoryManage = filtered[1].children![1]
- assert.equal(categoryManage.route, '/jd-center/categories', 'V204 菜单行的 route_path 与注册表一致')
- assert.equal(categoryManage.name, '京东分类管理')
})
-test('亚马逊 tab:除京东独占两页外全数保留(含 2026-11-17 回归的双侧账号域三页),分组结构不变', () => {
+test('亚马逊 tab:除京东独占页外全数保留(含 2026-11-17 回归的双侧账号域三页),分组结构不变', () => {
const filtered = filterMenuTreeByPlatform(TREE, 'amazon')
assert.deepEqual(groupChildKeys(filtered, 'admin_group_account'),
['admin_columns', 'admin_users', 'admin_group_manage', 'admin_user_secrets',
@@ -120,13 +115,13 @@ test('tab 显示依据:两侧都有可见页才画 tab 条,仅一侧授权
assert.deepEqual(visiblePlatformsFor(null), [])
})
-test('平台 tab 定义与两份菜单清单钉死(防清单漂移):京东独占两页、双侧共用账号域三页', () => {
+test('平台 tab 定义与两份菜单清单钉死(防清单漂移):京东独占仅数据库一页、双侧共用账号域三页', () => {
assert.deepEqual(PLATFORM_TABS, [
{ id: 'amazon', label: '亚马逊' },
{ id: 'jd', label: '京东' },
])
- assert.deepEqual([...JD_MENU_KEYS].sort(),
- ['admin_jd_category_manage', 'admin_jd_database'])
+ // 2026-11-17 晚分类管理(admin_jd_category_manage)并入京东数据库页后从清单摘除。
+ assert.deepEqual([...JD_MENU_KEYS], ['admin_jd_database'])
assert.deepEqual([...BOTH_PLATFORM_MENU_KEYS].sort(),
['admin_companies', 'admin_group_manage', 'admin_users'])
})
diff --git a/backend-java/src/main/resources/db/V208__drop_jd_category_manage_menu.sql b/backend-java/src/main/resources/db/V208__drop_jd_category_manage_menu.sql
new file mode 100644
index 000000000..4cbe7bd1c
--- /dev/null
+++ b/backend-java/src/main/resources/db/V208__drop_jd_category_manage_menu.sql
@@ -0,0 +1,34 @@
+-- 迁移 V208:下线后管菜单「京东分类管理」(2026-11-17 用户口径「京东分类管理并到
+-- 京东数据库分类编辑里,做一个搜索和添加 删除 编辑 分类名称即可」)
+-- =============================================================
+-- 1. 变更目的:V204 插入的独立子菜单行(jd-center/categories)整体下线——分类建/改名/删
+-- 收进京东数据库页工具栏「分类管理」对话框(前端 JdCategoryManageDialog,复用既有
+-- /api/admin/jd-product-groups 读写端点,鉴权锚 admin_jd_database 不变)。V204 本体
+-- 已应用不可回改(铁律 10),本迁移只出 DELETE;授权过的 user→column 行随 columns
+-- 外键 ON DELETE CASCADE 一并清(V204 头注释第 5 节口径)。
+--
+-- 2. 形状口径:按 column_key 全表删(该 key 每公司一行,V204 按公司逐家插入;key 是
+-- 稳定权限标识、不撞别的菜单)。不新增任何行。
+--
+-- 3. 影响表与数据量:columns 删 N 行(N=公司数),字典小表,毫秒级。
+--
+-- 4. 可重跑性:DELETE 按谓词幂等,重跑 no-op;自检闸门只读。
+--
+-- 5. 回滚:无需脚本——重放 V204 两段 INSERT(均带 NOT EXISTS 守卫,幂等)即可重建菜单行;
+-- 前端路由(jd-center/categories)已随本窗口下线,回滚菜单前须先回滚前端发布。
+-- =============================================================
+
+-- ---------- 1. 删除菜单行(授权行随外键 CASCADE) ----------
+DELETE FROM `columns` WHERE `column_key` = 'admin_jd_category_manage';
+
+-- ---------- 2. 自检闸门:残留不为 0 就抛 1048(列 must_be_zero NOT NULL) ----------
+CREATE TEMPORARY TABLE IF NOT EXISTS `_v208_gate` (`must_be_zero` INT NOT NULL);
+
+-- 闸门:按 key 与按 route_path 两个方向都不得有残留(防改 key 换壳残留路由)。
+INSERT INTO `_v208_gate`
+SELECT IF(COUNT(*) = 0, 0, NULL)
+FROM `columns`
+WHERE `column_key` = 'admin_jd_category_manage'
+ OR (`menu_type` = 'admin' AND `route_path` = 'jd-center/categories');
+
+DROP TEMPORARY TABLE `_v208_gate`;