hejianhao
2026-08-21 634b3da80c8305a7ebb67c315054c132101564ed
fix0806: 编辑用户、批量修改诊所需要排除诊所本身
2个文件已修改
37 ■■■■■ 已修改文件
tcm-training-admin/src/pages/member/user/list-page.tsx 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
tcm-training-admin/src/pages/member/user/modals.tsx 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
tcm-training-admin/src/pages/member/user/list-page.tsx
@@ -160,6 +160,7 @@
  const [pagination, setPagination] = useState({ page: 1, pageSize: 10, total: 0 });
  const [editOpen, setEditOpen] = useState(false);
  const [currentDetail, setCurrentDetail] = useState<UserDetail | null>(null);
  const [currentEditType, setCurrentEditType] = useState<number | undefined>(undefined);
  const [selectedUserIds, setSelectedUserIds] = useState<React.Key[]>([]);
  const [batchClinicOpen, setBatchClinicOpen] = useState(false);
  const [batchSubmitting, setBatchSubmitting] = useState(false);
@@ -218,10 +219,11 @@
    loadList(1, 10);
  }, [canView]);
  const openEditModal = async (id: number) => {
    const res = await getUserDetail(id);
  const openEditModal = async (record: UserItem) => {
    const res = await getUserDetail(record.id);
    const detail = res.data;
    setCurrentDetail(detail);
    setCurrentEditType(record.type);
    editForm.resetFields();
    setEditOpen(true);
  };
@@ -358,7 +360,7 @@
            </button>
          ) : null}
          {canEdit && mode === 'all' ? (
            <button type="button" onClick={() => openEditModal(record.id)}>
            <button type="button" onClick={() => openEditModal(record)}>
              编辑
            </button>
          ) : null}
@@ -470,7 +472,15 @@
            loading={loading}
            columns={columns}
            dataSource={list}
            rowSelection={mode === 'all' ? { selectedRowKeys: selectedUserIds, onChange: setSelectedUserIds } : undefined}
            rowSelection={
              mode === 'all'
                ? {
                    selectedRowKeys: selectedUserIds,
                    onChange: setSelectedUserIds,
                    getCheckboxProps: (record) => ({ disabled: record.type === 1 }),
                  }
                : undefined
            }
            pagination={false}
            scroll={{ x: mode === 'member' ? 920 : 1320 }}
          />
@@ -510,6 +520,7 @@
        form={editForm}
        clinics={clinics}
        detail={currentDetail}
        userType={currentEditType}
        onCancel={() => setEditOpen(false)}
        onSubmit={handleEditSubmit}
      />
tcm-training-admin/src/pages/member/user/modals.tsx
@@ -28,6 +28,7 @@
  form: any;
  clinics: ClinicOption[];
  detail?: UserDetail | null;
  userType?: number;
  onCancel: () => void;
  onSubmit: () => void;
};
@@ -55,6 +56,7 @@
  form,
  clinics,
  detail,
  userType,
  onCancel,
  onSubmit,
}) => {
@@ -174,13 +176,15 @@
        <Form.Item label="会员有效期" name="memberExpireAt">
          <DatePicker placeholder="年 / 月 / 日" className="member-user-edit-form__full" />
        </Form.Item>
        <Form.Item label="绑定诊所" name="clinicId">
          <Select
            allowClear
            placeholder="请选择"
            options={clinics.map((item) => ({ label: item.name, value: item.id }))}
          />
        </Form.Item>
        {userType === 1 ? null : (
          <Form.Item label="绑定诊所" name="clinicId">
            <Select
              allowClear
              placeholder="请选择"
              options={clinics.map((item) => ({ label: item.name, value: item.id }))}
            />
          </Form.Item>
        )}
        <div className="member-user-edit-form__footer">
          <Button onClick={onCancel}>取消</Button>
          <Button type="primary" loading={submitting} onClick={onSubmit}>