Files
huangzd1997 b7acfc0eef feat(菜单权限): 每家公司一套菜单树(V149)+ 公司 tab 只在注册表页渲染
本批两件事,加上随本批一起入仓的并行会话在制品:

一、菜单权限按公司隔离(批次 6)
- V149 给 columns 加 company_id:先可空加列(末位、ALGORITHM=INSTANT)→ 回填公司 1 →
  MODIFY 收紧 NOT NULL;三段式缺一即撞 1048。同时建 (company_id, column_key) 复合键、
  把公司 2 的 16 笔授权按 column_key 改指向它自己的副本,三类 menu_type 全复制,
  admin_companies 作为角色内生闸门行不复制(D3)。
- 第三道归属门 PermissionMenuService.resolveScopeCompanyId:站点超管可带 company_id
  读写任意公司,非超管锁本公司、越界 403。它注册进 CompanyIdParamGoesThroughReadScopeTest
  的 SCOPE_DOORS,四条判据与 readScope / readCompanyIdOrOwn 共用——护栏在代码出口,不靠清单。
- 旁路种子 PermissionMenuSchemaInitializer 只种公司 1:31 段种子逐条钉公司,
  按 column_key 点查的 14 段全部带 company_id,否则摘了 DEFAULT 就是跨公司串写。
- CompanyService.create 同一次写入里给新公司复制模板树(D4)。

二、公司 tab 收口(批次 b)
tab 条挂在壳层,对 22 页全画;改为按正列表 companyTabAppliesTo(menuKey) 判定,
只有注册表页渲染。护栏钉在用户看见的那个出口。

三、并行会话在制品(控制方「全部提交」,未单独拆分——见下)
- V150 店铺密钥 biz_shop_key 按公司(readCompanyIdOrOwn + writeCompanyId 两道门)
- V151 品牌库/商品类目推翻为全平台共享:只退唯一键、company_id DEFAULT 保留为
  NOT NULL 承重约束(摘了每条 1364);删掉 ProductCategoryControllerCompanyScopeTest
  那支"按公司隔离"的旧护栏,readCompanyId 方法一并移除
- invalidasin 字段与外观专利合批的连带改动

为什么不拆笔:后端 3891 例 / 0 红、前端 1731 例 / 0 红这两个读数是"合起来的树"的读数,
拆成多笔会让每一笔落到从未一起验过的组合上,而这一版要直接上两台。

回滚脚本在 backend-java/docs/rollback-V149/V150/V151-*.sql,不放进 Flyway 扫描路径。
设计记录:docs/ops/menu-company-tree-design-2026-10-06.md
2026-10-06 17:17:14 +08:00

45 lines
2.2 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { expect, test, type Page } from '@playwright/test'
// 后台管理列表「创建时间 + 更新时间」两列验收(2026-09-19 需求):
// 8 个实体管理列表统一展示创建/更新时间,数据取自各列表 VO。
// mock 夹具统一给 createdAt=2026-03-01 09:15:00、updatedAt=2026-09-18 16:42:30,
// 页面统一经 formatDateTime 归一为「YYYY-MM-DD HH:mm:ss」。
const CREATED = '2026-03-01 09:15:00'
const UPDATED = '2026-09-18 16:42:30'
const PAGES: Array<{ title: string; path: string; heading: string }> = [
{ title: '用户管理', path: '/admin-vue/account/users', heading: '用户列表' },
{ title: '菜单管理', path: '/admin-vue/account/menus', heading: '菜单' },
{ title: '密钥管理', path: '/admin-vue/account/user-secrets', heading: '用户密钥列表' },
{ title: '品牌数据库', path: '/admin-vue/asin-center/invalid', heading: '品牌数据列表' },
{ title: '数据去重总数据', path: '/admin-vue/asin-center/registry', heading: '数据去重总数据' },
{ title: '查询ASIN', path: '/admin-vue/asin-center/query', heading: '查询' },
{ title: '最低价ASIN', path: '/admin-vue/asin-center/skip-price', heading: '最低价' },
{ title: '商品类目', path: '/admin-vue/asin-center/categories', heading: '商品类目' },
]
async function openPage(page: Page, path: string) {
await page.goto(path)
await expect(page.locator('.panel-box table tbody tr').first()).toBeVisible({ timeout: 15000 })
}
for (const spec of PAGES) {
test(`${spec.title}:表格展示创建时间与更新时间`, async ({ page }) => {
const errors: string[] = []
page.on('pageerror', (error) => errors.push(error.message))
await openPage(page, spec.path)
const table = page.locator('.panel-box table').first()
// 表头出现两列
await expect(table.locator('thead')).toContainText('创建时间')
await expect(table.locator('thead')).toContainText('更新时间')
// 数据行渲染出真实时间值(非空、非占位符)
await expect(table.locator('tbody')).toContainText(CREATED)
await expect(table.locator('tbody')).toContainText(UPDATED)
expect(errors).toEqual([])
})
}