|
@@ -19,6 +19,7 @@ const Clients: React.FC = () => {
|
|
|
const [modalVisible, setModalVisible] = useState(false);
|
|
const [modalVisible, setModalVisible] = useState(false);
|
|
|
const [editingKey, setEditingKey] = useState<string | null>(null);
|
|
const [editingKey, setEditingKey] = useState<string | null>(null);
|
|
|
const [searchText, setSearchText] = useState('');
|
|
const [searchText, setSearchText] = useState('');
|
|
|
|
|
+ const [auditStatusFilter, setAuditStatusFilter] = useState<number | undefined>(undefined);
|
|
|
const [areas, setAreas] = useState<AreaItem[]>([]);
|
|
const [areas, setAreas] = useState<AreaItem[]>([]);
|
|
|
const queryClient = useQueryClient();
|
|
const queryClient = useQueryClient();
|
|
|
|
|
|
|
@@ -224,6 +225,24 @@ const Clients: React.FC = () => {
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+ // 审核客户
|
|
|
|
|
+ const auditClient = useMutation({
|
|
|
|
|
+ mutationFn: async ({ id, auditStatus }: { id: number; auditStatus: number }) => {
|
|
|
|
|
+ const res = await clientClient[':id'].$put({
|
|
|
|
|
+ param: { id },
|
|
|
|
|
+ json: { auditStatus } as any,
|
|
|
|
|
+ });
|
|
|
|
|
+ if (!res.ok) {
|
|
|
|
|
+ throw new Error('审核操作失败');
|
|
|
|
|
+ }
|
|
|
|
|
+ return res.json();
|
|
|
|
|
+ },
|
|
|
|
|
+ onSuccess: () => {
|
|
|
|
|
+ message.success('审核操作成功');
|
|
|
|
|
+ queryClient.invalidateQueries({ queryKey: ['clients'] });
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
const handleDelete = async (id: number) => {
|
|
const handleDelete = async (id: number) => {
|
|
|
try {
|
|
try {
|
|
|
await deleteClient.mutateAsync(id);
|
|
await deleteClient.mutateAsync(id);
|