| | |
| | | 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); |
| | |
| | | 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); |
| | | }; |
| | |
| | | </button> |
| | | ) : null} |
| | | {canEdit && mode === 'all' ? ( |
| | | <button type="button" onClick={() => openEditModal(record.id)}> |
| | | <button type="button" onClick={() => openEditModal(record)}> |
| | | 编辑 |
| | | </button> |
| | | ) : null} |
| | |
| | | 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 }} |
| | | /> |
| | |
| | | form={editForm} |
| | | clinics={clinics} |
| | | detail={currentDetail} |
| | | userType={currentEditType} |
| | | onCancel={() => setEditOpen(false)} |
| | | onSubmit={handleEditSubmit} |
| | | /> |