fix(前端): 后台摘掉公司这一维度——列表列/筛选/建号选择/顶栏旁白全部去掉
用户定案:隔离该由数据和后端自己做,不该把"公司"摆到操作员眼前多一个选错的机会。 于是原计划里给品牌库/去重库两页加公司列(Task 9)反向执行,顺带把一期已上线的展示也收掉。 建号归属改为请求体不带 company_id,由后端 resolveTargetCompanyId 落操作者自己的公司。 这条前端删下拉的安全依据完全靠后端那两条分支撑着,所以用跨仓读 Java 源码的方式钉成可执行断言: 谁把那边改成"必填公司"或删掉任一分支,这边立刻红。 副作用要说清——超管建的号一律归公司 1,给第 2 家建号得用那家公司自己的管理员登录。 「公司管理」页的引导语原写"建号时选哪家公司",下拉没了就成了错的承诺; "停用后不能再用于新建账号"也不再成立(requireActive 两个调用点都要求显式传 company_id, 而页面现在一律不传)。文案改成真实口径,并断言这三句失效说法不得回流。 1683 例 / 0 红,vue-tsc 干净,变异 6/6 被杀。
This commit is contained in:
@@ -15,8 +15,6 @@ export interface UserListParams {
|
||||
adminId?: number | null
|
||||
/** 角色过滤(''=全部)。 */
|
||||
role?: string
|
||||
/** 按所属公司过滤(V143);仅超管用得到——公司内 admin 后端本来就只返回本公司账号。 */
|
||||
companyId?: number | null
|
||||
}
|
||||
|
||||
/** 序列化到 GET /api/admin/users 的查询参数(Java snake_case)。 */
|
||||
@@ -28,7 +26,6 @@ export interface UserListQuery {
|
||||
created_by_id?: number
|
||||
admin_id?: number
|
||||
role?: string
|
||||
company_id?: number
|
||||
}
|
||||
|
||||
/** 用户列表项即 AdminUser(与 Java AdminUserItemVo 字段对齐)。 */
|
||||
@@ -49,12 +46,6 @@ function finiteInt(value: unknown): number | null {
|
||||
return typeof value === 'number' && Number.isFinite(value) ? Math.floor(value) : null
|
||||
}
|
||||
|
||||
/** 公司 id 只认正整数:0/负数/NaN 一律当"没筛选",否则会下发一个必然查不到账号的过滤。 */
|
||||
function positiveId(value: unknown): number | null {
|
||||
const id = finiteInt(value)
|
||||
return id !== null && id > 0 ? id : null
|
||||
}
|
||||
|
||||
/** 归一化分页/筛选参数:页码下限 1、页大小 1..上限,空关键字视为无过滤。 */
|
||||
export function normalizeUserPageParams(raw: Partial<UserListParams>): UserListParams {
|
||||
const page = Math.max(finiteInt(raw.page) ?? USER_PAGE_MIN_PAGE, USER_PAGE_MIN_PAGE)
|
||||
@@ -70,7 +61,6 @@ export function normalizeUserPageParams(raw: Partial<UserListParams>): UserListP
|
||||
keyword,
|
||||
createdById: typeof raw.createdById === 'number' ? raw.createdById : null,
|
||||
adminId: typeof raw.adminId === 'number' ? raw.adminId : null,
|
||||
companyId: positiveId(raw.companyId),
|
||||
role: typeof raw.role === 'string' ? raw.role.trim() || undefined : undefined,
|
||||
}
|
||||
}
|
||||
@@ -82,8 +72,6 @@ export function toUserListQuery(params: UserListParams): UserListQuery {
|
||||
if (params.createdById != null) query.created_by_id = params.createdById
|
||||
if (params.adminId != null) query.admin_id = params.adminId
|
||||
if (params.role) query.role = params.role
|
||||
const companyId = positiveId(params.companyId)
|
||||
if (companyId !== null) query.company_id = companyId
|
||||
return query
|
||||
}
|
||||
|
||||
|
||||
@@ -27,12 +27,6 @@ export function toAdminUserItem(raw: unknown): AdminUser | null {
|
||||
if (updatedAt) item.updatedAt = updatedAt
|
||||
const creator = text(r.creator_username)
|
||||
if (creator) item.creatorUsername = creator
|
||||
// 公司维度只在后端带上时才写键:留 undefined 而不是 null,好让"这版后端没带公司"
|
||||
// 与"账号确实没归属公司"在页面上是两种可读的状态。
|
||||
const companyId = numberOrNull(r.company_id)
|
||||
if (companyId !== null) item.companyId = companyId
|
||||
const companyName = text(r.company_name).trim()
|
||||
if (companyName) item.companyName = companyName
|
||||
const abbr = text(r.pinyin_abbr)
|
||||
if (abbr) item.pinyinAbbr = abbr
|
||||
return item
|
||||
|
||||
Reference in New Issue
Block a user