Commit ead536459b3c257d8b21329a4dce501f7d90792e
1 parent
3beaa61a
refactor(staff-picker): drop 已绑定 badge, auto-fill 用户号/用户名
- Remove the green '已绑定' badge from StaffPicker; the prototype doesn't show one and it's confusing in create mode (nothing has been saved yet). - On staff selection, auto-fill 用户号 (sUserNo) and 用户名 (sUserName) with the staff's Chinese name to match prototype behavior; user can still override either field after selection.
Showing
2 changed files
with
8 additions
and
23 deletions
frontend/src/components/StaffPicker.tsx
| @@ -4,7 +4,6 @@ import { searchStaff, type StaffSearchVO } from "@/api/staff"; | @@ -4,7 +4,6 @@ import { searchStaff, type StaffSearchVO } from "@/api/staff"; | ||
| 4 | 4 | ||
| 5 | interface Props { | 5 | interface Props { |
| 6 | value: string; | 6 | value: string; |
| 7 | - staffId: number | null; | ||
| 8 | onChange: (name: string, staffId: number | null) => void; | 7 | onChange: (name: string, staffId: number | null) => void; |
| 9 | disabled?: boolean; | 8 | disabled?: boolean; |
| 10 | required?: boolean; | 9 | required?: boolean; |
| @@ -27,7 +26,6 @@ const fieldControl: React.CSSProperties = { | @@ -27,7 +26,6 @@ const fieldControl: React.CSSProperties = { | ||
| 27 | 26 | ||
| 28 | export default function StaffPicker({ | 27 | export default function StaffPicker({ |
| 29 | value, | 28 | value, |
| 30 | - staffId, | ||
| 31 | onChange, | 29 | onChange, |
| 32 | disabled, | 30 | disabled, |
| 33 | required, | 31 | required, |
| @@ -111,25 +109,6 @@ export default function StaffPicker({ | @@ -111,25 +109,6 @@ export default function StaffPicker({ | ||
| 111 | > | 109 | > |
| 112 | <SearchOutlined /> | 110 | <SearchOutlined /> |
| 113 | </span> | 111 | </span> |
| 114 | - {staffId != null && !disabled && ( | ||
| 115 | - <span | ||
| 116 | - style={{ | ||
| 117 | - position: "absolute", | ||
| 118 | - right: 22, | ||
| 119 | - top: "50%", | ||
| 120 | - transform: "translateY(-50%)", | ||
| 121 | - fontSize: 9, | ||
| 122 | - color: "#fff", | ||
| 123 | - background: "var(--success)", | ||
| 124 | - padding: "1px 4px", | ||
| 125 | - borderRadius: 2, | ||
| 126 | - pointerEvents: "none", | ||
| 127 | - }} | ||
| 128 | - title={`已绑定职员 ID ${staffId}`} | ||
| 129 | - > | ||
| 130 | - 已绑定 | ||
| 131 | - </span> | ||
| 132 | - )} | ||
| 133 | {open && !disabled && ( | 112 | {open && !disabled && ( |
| 134 | <div | 113 | <div |
| 135 | style={{ | 114 | style={{ |
frontend/src/pages/usr/UserDetail.tsx
| @@ -304,9 +304,15 @@ export default function UserDetail({ userId, mode: initialMode }: Props) { | @@ -304,9 +304,15 @@ export default function UserDetail({ userId, mode: initialMode }: Props) { | ||
| 304 | <Field label="员工名" required> | 304 | <Field label="员工名" required> |
| 305 | <StaffPicker | 305 | <StaffPicker |
| 306 | value={form.staffName} | 306 | value={form.staffName} |
| 307 | - staffId={form.iStaffId} | ||
| 308 | onChange={(name, id) => | 307 | onChange={(name, id) => |
| 309 | - setForm((s) => ({ ...s, staffName: name, iStaffId: id })) | 308 | + setForm((s) => ({ |
| 309 | + ...s, | ||
| 310 | + staffName: name, | ||
| 311 | + iStaffId: id, | ||
| 312 | + // Auto-fill 用户号 / 用户名 to the staff name on selection | ||
| 313 | + // (matches prototype behavior — user can still override after). | ||
| 314 | + ...(id != null ? { sUserNo: name, sUserName: name } : {}), | ||
| 315 | + })) | ||
| 310 | } | 316 | } |
| 311 | disabled={disabled} | 317 | disabled={disabled} |
| 312 | required | 318 | required |