import React from 'react'; import { useQuery } from '@tanstack/react-query'; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@d8d/shared-ui-components/components/ui/select'; import { userClientManager } from '../api/userClient'; interface UserSelectorProps { value?: number; onChange?: (value: number) => void; placeholder?: string; disabled?: boolean; testId?: string; } export const UserSelector: React.FC = ({ value, onChange, placeholder = "选择用户", disabled, testId }) => { const { data: users, isLoading } = useQuery({ queryKey: ['users'], queryFn: async () => { const userClient = userClientManager.get(); const res = await userClient.$get({ query: { page: 1, pageSize: 100 } }); if (res.status !== 200) throw new Error('获取用户列表失败'); const result = await res.json(); return result.data; } }); return ( ); };