Commit ead536459b3c257d8b21329a4dce501f7d90792e

Authored by zichun
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.
frontend/src/components/StaffPicker.tsx
... ... @@ -4,7 +4,6 @@ import { searchStaff, type StaffSearchVO } from "@/api/staff";
4 4  
5 5 interface Props {
6 6 value: string;
7   - staffId: number | null;
8 7 onChange: (name: string, staffId: number | null) => void;
9 8 disabled?: boolean;
10 9 required?: boolean;
... ... @@ -27,7 +26,6 @@ const fieldControl: React.CSSProperties = {
27 26  
28 27 export default function StaffPicker({
29 28 value,
30   - staffId,
31 29 onChange,
32 30 disabled,
33 31 required,
... ... @@ -111,25 +109,6 @@ export default function StaffPicker({
111 109 >
112 110 <SearchOutlined />
113 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 112 {open && !disabled && (
134 113 <div
135 114 style={{
... ...
frontend/src/pages/usr/UserDetail.tsx
... ... @@ -304,9 +304,15 @@ export default function UserDetail({ userId, mode: initialMode }: Props) {
304 304 <Field label="员工名" required>
305 305 <StaffPicker
306 306 value={form.staffName}
307   - staffId={form.iStaffId}
308 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 317 disabled={disabled}
312 318 required
... ...