| | |
| | | import * as insuranceClaimServices from '@/services/api/InsuranceClaim'; |
| | | import * as insuranceOrderServices from '@/services/api/InsuranceOrder'; |
| | | import { downloadFileByUrl, setOSSLink } from '@/utils'; |
| | | import { useQuery, useQueryClient } from '@tanstack/vue-query'; |
| | | |
| | | type UseInsuranceOrderMaterialListOptions = { |
| | |
| | | isLoading, |
| | | }; |
| | | } |
| | | |
| | | export function useInsureActions() { |
| | | const router = useRouter(); |
| | | async function handleGoDownloadInvoice(id: string) { |
| | | try { |
| | | await insuranceOrderServices.getInvoiceId({ id: id }); |
| | | router.push({ |
| | | name: 'InsureDownloadInvoice', |
| | | params: { |
| | | id: id, |
| | | }, |
| | | }); |
| | | } catch (error) {} |
| | | } |
| | | |
| | | async function handleGoStampFiles(id: string) { |
| | | try { |
| | | router.push({ |
| | | name: 'InsurancePolicyStampFiles', |
| | | params: { |
| | | id: id, |
| | | }, |
| | | }); |
| | | } catch (error) {} |
| | | } |
| | | |
| | | return { |
| | | handleGoDownloadInvoice, |
| | | handleGoStampFiles, |
| | | }; |
| | | } |
| | | |
| | | export function useDownloadPolicyFileId() { |
| | | async function handleDownload(row: API.InsurancePolicyPayDto) { |
| | | try { |
| | | if (row.policyOssUrl) { |
| | | downloadFileByUrl(setOSSLink(row.policyOssUrl), `保单_${row.channelOrderNo}`); |
| | | } else { |
| | | let res = await insuranceOrderServices.downloadPolicyFileId({ id: row.id }); |
| | | if (res) { |
| | | window.open(res, '_blank'); |
| | | } |
| | | } |
| | | } catch (error) {} |
| | | } |
| | | |
| | | return { |
| | | handleDownload, |
| | | }; |
| | | } |