import dayjs from 'dayjs';
|
import { UploadUserFile } from '@bole-core/components';
|
import { InsuranceClaimAttachmentBusinessTypeEnum } from '@/constants';
|
import { convertApi2FormUrl } from '@/utils';
|
|
export function convertFormToattAchments(
|
files: UploadUserFile[],
|
businessType: InsuranceClaimAttachmentBusinessTypeEnum
|
) {
|
return files.map((x) => ({
|
fileName: x.name,
|
url: x.path,
|
businessType: businessType,
|
}));
|
}
|
|
export function convertAttAchmentsToForm(
|
attachments: API.InsuranceClaimAttachmentOutput[],
|
businessType: InsuranceClaimAttachmentBusinessTypeEnum
|
) {
|
const filterAttachments = attachments.filter((x) => x.businessType === businessType);
|
return filterAttachments.length > 0
|
? filterAttachments.map((x) => convertApi2FormUrl(x.url))
|
: [];
|
}
|