| | |
| | | |
| | | type UseEnterpriseDetailOptions = { |
| | | id: MaybeRef<string>; |
| | | supplierEnterpriseId?: MaybeRef<string>; |
| | | }; |
| | | |
| | | export function useEnterpriseDetail({ id }: UseEnterpriseDetailOptions) { |
| | | export function useEnterpriseDetail({ id, supplierEnterpriseId }: UseEnterpriseDetailOptions) { |
| | | const { data, refetch, isLoading, isError } = useQuery({ |
| | | queryKey: ['taskServices/getTaskEnterprise', id], |
| | | queryKey: ['taskServices/getTaskEnterprise', id, supplierEnterpriseId], |
| | | queryFn: async () => { |
| | | return await taskServices.getTaskEnterprise( |
| | | { id: unref(id) }, |
| | | { |
| | | showLoading: false, |
| | | } |
| | | ); |
| | | let params: API.APIgetTaskEnterpriseParams = { |
| | | id: unref(id), |
| | | }; |
| | | if (unref(supplierEnterpriseId)) { |
| | | params.supplierEnterpriseId = unref(supplierEnterpriseId); |
| | | } |
| | | console.log('params: ', params); |
| | | return await taskServices.getTaskEnterprise(params, { |
| | | showLoading: false, |
| | | }); |
| | | }, |
| | | placeholderData: () => ({} as API.GetTaskEnterpriseQueryResult), |
| | | }); |