feat(多公司): 两端接上公司身份 —— 后台公司目录页、建号必选公司、顶栏显示所属公司
- 新后台新增「公司管理」页(列/新建/改名/启停,不提供删除),路由 menuKey 与 columns 表的 admin_companies 逐字一致,由用例钉住;操作指引补该菜单一条。 - 建号弹窗对超管必须显式选一家(后端对"不传"仍落操作者自己公司,是给旧后台兜底); admin 只能落自己公司,越权直接 403。账号列表显示 company_name,可按公司筛。 - 客户端登录后把 companyId/companyName 落到 localStorage 并在顶栏显示; 两个登出出口(handleKicked 与切号/登出)连公司名一起清 —— 残留会把上一个账号 的归属显示给下一个账号。 - 契约分层:列表端点用 snake_case(company_id/company_name),current-user 与登录 回包用 camelCase;解析器读到另一套写法必须忽略,防止前后端各猜一套。 admin-frontend-vue 1678/1678、frontend-vue 672/672,两边 build(含 vue-tsc --noEmit)干净。
This commit is contained in:
@@ -13,11 +13,18 @@ export function pageTitleOf(title: string | null | undefined): string {
|
||||
export interface TopbarUserViewModel {
|
||||
username: string
|
||||
role: string
|
||||
/** 所属公司名(V143);后端没带就是空串,模板据此整段不显示,不能渲染出 undefined。 */
|
||||
company: string
|
||||
hasUser: boolean
|
||||
}
|
||||
|
||||
/** 顶部栏用户模型:用户信息或未登录空态统一为可渲染视图模型。 */
|
||||
export function topbarUserOf(user: AdminUser | null | undefined): TopbarUserViewModel {
|
||||
if (!user) return { username: '当前用户', role: '', hasUser: false }
|
||||
return { username: user.username || '当前用户', role: roleLabel(user.role) || user.role || '', hasUser: true }
|
||||
if (!user) return { username: '当前用户', role: '', company: '', hasUser: false }
|
||||
return {
|
||||
username: user.username || '当前用户',
|
||||
role: roleLabel(user.role) || user.role || '',
|
||||
company: (user.companyName || '').trim(),
|
||||
hasUser: true,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user