fix(admin-vue): 密钥管理/用量统计两菜单扩京东侧+两页按平台 tab 隔离取数(2026-11-22 用户口径「后台京东tab下也要加密钥管理和密钥统计量 数据不要弄过来」)

- platform-scope.ts BOTH_PLATFORM_MENU_KEYS 加 admin_user_secrets/admin_user_secret_usage(与后端 AdminMenuPlatformScope.BOTH_MENU_KEYS 逐字同源;侧栏分组/授权树/AdminLayout 切 tab 自动跟随)
- user-secrets.ts/user-secret-usage.ts 查询加 platform 入参(同 companyId 形状:白名单构造不收,只认原始入参)
- 两页 fetch 带 platform: platformTab.active+watch(platformTab.active) 重置关键字/页码并重取(UsersPage 同形)
- company-tab-wiring PLATFORM_WIRING_PINS 钉 api/fetch/watch 三形状(含正负判据自证);platform-menu-filter/menu-manage-platform/admin-layout-platform-lock 三测试期望同步(node 21 绿+mount 6 绿+vue-tsc rc=0)

随下一 admin-vue 窗上线;与后端 4819b243 必须同窗发布(单发一侧=侧栏分组与权限门错位)
This commit is contained in:
2026-11-22 21:51:33 +08:00
parent 4819b243d6
commit 988cc633a0
9 changed files with 112 additions and 17 deletions
@@ -1043,3 +1043,48 @@ test('公司维度不得回流:品牌库/商品类目/京东数据库已定案
`${file} 重新引回了公司 tab store,而它对应的 tab 条已经摘掉`)
}
})
// ── 平台 tab 接线(2026-11-22 密钥两页进京东侧)─────────────────────────────────
// 与 company_id 复评 I-2 同一课:tab 画了、请求发了、参数没有 = 静默失效。两页的
// platform 值必须现取页面 platformTab store;api 侧只认本函数自己的 params.platform
//(白名单构造不收中间对象——取自归一化中间对象是 TS 绿、运行时恒 undefined 的洞)。
const PLATFORM_WIRING_PINS = [
{
menuKey: 'admin_user_secrets',
apiFile: 'src/api/user-secrets.ts',
apiShape: /query\.platform\s*=\s*params\.platform\b/,
pageFile: 'src/pages/account/UserSecretsPage.vue',
fetchShape: /platform:\s*platformTab\.active/,
watchShape: /watch\(\(\)\s*=>\s*platformTab\.active/,
},
{
menuKey: 'admin_user_secret_usage',
apiFile: 'src/api/user-secret-usage.ts',
apiShape: /query\.platform\s*=\s*params\.platform\b/,
pageFile: 'src/pages/account/UserSecretUsagePage.vue',
fetchShape: /platform:\s*platformTab\.active/,
watchShape: /watch\(\(\)\s*=>\s*platformTab\.active/,
},
] as const
test('平台 tab 接线(2026-11-22):密钥两页的 platform 必须现取 platformTab.active,切 tab 必须 watch 重取', () => {
// 判据自证(全局约束 15:反向钉不许独自成立)——正样本匹配、取错根不匹配。
assert.ok(PLATFORM_WIRING_PINS[0].apiShape.test('if (params.platform) query.platform = params.platform'),
'api 判据连正样本都匹配不出 ⇒ 恒绿')
assert.equal(PLATFORM_WIRING_PINS[0].apiShape.test('if (params.platform) query.platform = normalized.platform'), false,
'api 判据对「取自归一化中间对象」也放行 ⇒ 取值口失守(复评 I-2 的洞)')
assert.ok(PLATFORM_WIRING_PINS[0].watchShape.test('watch(() => platformTab.active, () => { void load() })'),
'watch 判据连正样本都匹配不出 ⇒ 恒绿')
for (const pin of PLATFORM_WIRING_PINS) {
const api = stripComments(read(pin.apiFile))
assert.ok(pin.apiShape.test(api),
`${pin.apiFile} 的 platform 右半边不是本函数自己的 params.platform(${pin.menuKey})——tab 画了、参数没有或取错根`)
const page = stripComments(read(pin.pageFile))
assert.ok(pin.fetchShape.test(page),
`${pin.pageFile} 的列表请求没带 platform: platformTab.active(${pin.menuKey})——切平台 tab 数据不换`)
assert.ok(pin.watchShape.test(page),
`${pin.pageFile} 没有 watch(platformTab.active) 重取数(${pin.menuKey})——tab 在那页上是假的`)
}
})