Commit b63ac3d24b2010aad46a8877f1bd67f19f164572

Authored by zichun
1 parent ead53645

refactor(user-detail): drop 部门 field — it's a tStaff property

部门 (sDepartment) lives on tStaff, not tUser. Showing/editing it on
the user form was misleading — it implied the value would be saved
against the user, but the backend has no such column on tUser. The
user list still surfaces 部门 via the LEFT JOIN on tStaff, which
remains correct for display.

Removes:
- 部门 form field on UserDetail
- DEPARTMENTS constant (now unused)
frontend/src/pages/usr/UserDetail.tsx
... ... @@ -25,7 +25,6 @@ import {
25 25 USER_TYPES,
26 26 LANGUAGE_OPTIONS,
27 27 PERMISSION_GROUPS,
28   - DEPARTMENTS,
29 28 SCOPE_ITEMS,
30 29 } from "@/utils/data";
31 30 import { useAppDispatch, useAppSelector } from "@/store";
... ... @@ -44,7 +43,6 @@ interface FormState {
44 43 sUserName: string;
45 44 iStaffId: number | null;
46 45 staffName: string;
47   - department: string;
48 46 sUserType: string;
49 47 sLanguage: string;
50 48 bCanModifyDocs: boolean;
... ... @@ -73,7 +71,6 @@ export default function UserDetail({ userId, mode: initialMode }: Props) {
73 71 sUserName: string;
74 72 iStaffId: number | null;
75 73 staffName: string | null;
76   - department: string | null;
77 74 sUserType: string;
78 75 sLanguage: string;
79 76 bCanModifyDocs?: boolean;
... ... @@ -89,7 +86,6 @@ export default function UserDetail({ userId, mode: initialMode }: Props) {
89 86 sUserName: "",
90 87 iStaffId: null,
91 88 staffName: "",
92   - department: "",
93 89 sUserType: "普通用户",
94 90 sLanguage: "zh",
95 91 bCanModifyDocs: false,
... ... @@ -99,7 +95,6 @@ export default function UserDetail({ userId, mode: initialMode }: Props) {
99 95 sUserName: snapshot.sUserName,
100 96 iStaffId: snapshot.iStaffId,
101 97 staffName: snapshot.staffName ?? "",
102   - department: snapshot.department ?? "",
103 98 sUserType: snapshot.sUserType,
104 99 sLanguage: snapshot.sLanguage,
105 100 bCanModifyDocs: !!snapshot.bCanModifyDocs,
... ... @@ -348,14 +343,6 @@ export default function UserDetail({ userId, mode: initialMode }: Props) {
348 343 />
349 344 </Field>
350 345  
351   - <Field label="部门">
352   - <PrimSelect
353   - value={form.department}
354   - onChange={(v) => set("department", v)}
355   - disabled={disabled}
356   - options={DEPARTMENTS}
357   - />
358   - </Field>
359 346 <Field label="语言" required>
360 347 <PrimSelect
361 348 value={form.sLanguage}
... ...
frontend/src/utils/data.ts
... ... @@ -55,25 +55,6 @@ export const PERMISSION_GROUPS = [
55 55 "仓库管理员",
56 56 ];
57 57  
58   -// Visual-only — 部门 dropdown options on UserDetail.
59   -export const DEPARTMENTS = [
60   - "工艺技术",
61   - "印刷车间",
62   - "机修",
63   - "机务部",
64   - "财务部",
65   - "装订车间",
66   - "总经办公室",
67   - "总务部",
68   - "供应链",
69   - "质量管理部",
70   - "模切车间",
71   - "计划组",
72   - "样品开发",
73   - "设计部",
74   - "仓库",
75   -];
76   -
77 58 // Visual-only — scope tabs in UserDetail (客户/供应商/人员/工序/司机).
78 59 export const SCOPE_ITEMS: Record<string, { label: string; items: string[] }> = {
79 60 customer: {
... ...