feat(公司tab): 接线 生成记录——company_id 走 DataReadScope,空成员集一律空页

「tab 画出来了、请求真带了 company_id、后端读都不读」是撒谎窗口,比不接更坏:
页面标题写某公司、数据仍是全量。所以后半页必须同时落地读侧与前端。

- controller 收显式 company_id,菜单闸门仍在算范围之前;范围只在 DataReadScope
  一处出口(不再有第二个 if)。DELETE /history 与 clearAllHistory 一字未动:
  写操作不吃 company_id。
- service 的总数与行集共用同一个 filterOf,"同范围"由结构保证;空成员集在
  分页归一之后早退,绝不把 [] 交给 in()(渲染成 IN () 就是 500)。
- 前端从原始 params 读 companyId——normalizeHistoryParams 是白名单构造,从
  normalized 读会静默拿到 undefined,编译绿、请求里没有参数。

验证:ImageHistoryServiceTest 7/0,后端全量 3663 例 0 红;G1 缺口清单 7 页 →
6 页(admin_history 消失);前端 1726/1725/1(那条红是刻意留的接线缺口尺子)、
vue-tsc rc=0。变异 M-A(删 filter.in)与 M-B(早退改永假)各杀 2 支。
This commit is contained in:
2026-10-05 08:32:40 +08:00
parent bdd34356d6
commit 81818c0ccd
6 changed files with 186 additions and 9 deletions
@@ -33,6 +33,8 @@ export interface HistoryListParams {
userId?: number | null
timeStart?: string
timeEnd?: string
/** 公司 tab 的当前值;页面传入,不参与 normalizeHistoryParams 的归一(它是白名单构造)。 */
companyId?: number | null
}
export interface HistoryListQuery {
@@ -41,6 +43,7 @@ export interface HistoryListQuery {
user_id?: number
time_start?: string
time_end?: string
company_id?: number
}
function finiteInt(value: unknown): number | null {