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,7 +25,6 @@ import {
25 USER_TYPES, 25 USER_TYPES,
26 LANGUAGE_OPTIONS, 26 LANGUAGE_OPTIONS,
27 PERMISSION_GROUPS, 27 PERMISSION_GROUPS,
28 - DEPARTMENTS,  
29 SCOPE_ITEMS, 28 SCOPE_ITEMS,
30 } from "@/utils/data"; 29 } from "@/utils/data";
31 import { useAppDispatch, useAppSelector } from "@/store"; 30 import { useAppDispatch, useAppSelector } from "@/store";
@@ -44,7 +43,6 @@ interface FormState { @@ -44,7 +43,6 @@ interface FormState {
44 sUserName: string; 43 sUserName: string;
45 iStaffId: number | null; 44 iStaffId: number | null;
46 staffName: string; 45 staffName: string;
47 - department: string;  
48 sUserType: string; 46 sUserType: string;
49 sLanguage: string; 47 sLanguage: string;
50 bCanModifyDocs: boolean; 48 bCanModifyDocs: boolean;
@@ -73,7 +71,6 @@ export default function UserDetail({ userId, mode: initialMode }: Props) { @@ -73,7 +71,6 @@ export default function UserDetail({ userId, mode: initialMode }: Props) {
73 sUserName: string; 71 sUserName: string;
74 iStaffId: number | null; 72 iStaffId: number | null;
75 staffName: string | null; 73 staffName: string | null;
76 - department: string | null;  
77 sUserType: string; 74 sUserType: string;
78 sLanguage: string; 75 sLanguage: string;
79 bCanModifyDocs?: boolean; 76 bCanModifyDocs?: boolean;
@@ -89,7 +86,6 @@ export default function UserDetail({ userId, mode: initialMode }: Props) { @@ -89,7 +86,6 @@ export default function UserDetail({ userId, mode: initialMode }: Props) {
89 sUserName: "", 86 sUserName: "",
90 iStaffId: null, 87 iStaffId: null,
91 staffName: "", 88 staffName: "",
92 - department: "",  
93 sUserType: "普通用户", 89 sUserType: "普通用户",
94 sLanguage: "zh", 90 sLanguage: "zh",
95 bCanModifyDocs: false, 91 bCanModifyDocs: false,
@@ -99,7 +95,6 @@ export default function UserDetail({ userId, mode: initialMode }: Props) { @@ -99,7 +95,6 @@ export default function UserDetail({ userId, mode: initialMode }: Props) {
99 sUserName: snapshot.sUserName, 95 sUserName: snapshot.sUserName,
100 iStaffId: snapshot.iStaffId, 96 iStaffId: snapshot.iStaffId,
101 staffName: snapshot.staffName ?? "", 97 staffName: snapshot.staffName ?? "",
102 - department: snapshot.department ?? "",  
103 sUserType: snapshot.sUserType, 98 sUserType: snapshot.sUserType,
104 sLanguage: snapshot.sLanguage, 99 sLanguage: snapshot.sLanguage,
105 bCanModifyDocs: !!snapshot.bCanModifyDocs, 100 bCanModifyDocs: !!snapshot.bCanModifyDocs,
@@ -348,14 +343,6 @@ export default function UserDetail({ userId, mode: initialMode }: Props) { @@ -348,14 +343,6 @@ export default function UserDetail({ userId, mode: initialMode }: Props) {
348 /> 343 />
349 </Field> 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 <Field label="语言" required> 346 <Field label="语言" required>
360 <PrimSelect 347 <PrimSelect
361 value={form.sLanguage} 348 value={form.sLanguage}
frontend/src/utils/data.ts
@@ -55,25 +55,6 @@ export const PERMISSION_GROUPS = [ @@ -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 // Visual-only — scope tabs in UserDetail (客户/供应商/人员/工序/司机). 58 // Visual-only — scope tabs in UserDetail (客户/供应商/人员/工序/司机).
78 export const SCOPE_ITEMS: Record<string, { label: string; items: string[] }> = { 59 export const SCOPE_ITEMS: Record<string, { label: string; items: string[] }> = {
79 customer: { 60 customer: {