| | |
| | | import * as electronSignServices from '@/services/api/electronSign'; |
| | | import AddOrEditTemplateDialog from './components/AddOrEditTemplateDialog.vue'; |
| | | import { downloadFileByUrl, Message } from '@bole-core/core'; |
| | | import { convertApi2FormUrlOnlyOne, format, setOSSLink } from '@/utils'; |
| | | import { |
| | | convertApi2FormUrlOnlyOne, |
| | | convertPdfToImage, |
| | | format, |
| | | openLink, |
| | | setOSSLink, |
| | | } from '@/utils'; |
| | | import { EnumContractTemplateStatus, EnumContractTemplateStatusText } from '@/constants'; |
| | | |
| | | defineOptions({ |
| | |
| | | }); |
| | | |
| | | const operationBtnMap: Record<string, OperationBtnType> = { |
| | | editBtn: { emits: { onClick: (role) => openDialog(role) } }, |
| | | editTemplateBtn: { |
| | | editBtn: { |
| | | emits: { onClick: (role) => openDialog(role) }, |
| | | extraProps: { |
| | | hide: (row) => false, |
| | | hide: (row: API.GetEnterpriseContractTemplatesQueryResultItem) => |
| | | row.status !== EnumContractTemplateStatus.Completed, |
| | | }, |
| | | }, |
| | | editTemplateBtn: { |
| | | emits: { onClick: (role) => goEditTemplate(role) }, |
| | | extraProps: { |
| | | hide: (row: API.GetEnterpriseContractTemplatesQueryResultItem) => |
| | | row.status !== EnumContractTemplateStatus.Wait, |
| | | }, |
| | | }, |
| | | downloadBtn: { |
| | |
| | | emits: { onClick: (role) => handleDelete(role) }, |
| | | props: { type: 'danger' }, |
| | | extraProps: { |
| | | hide: (row) => false, |
| | | hide: (row: API.GetEnterpriseContractTemplatesQueryResultItem) => |
| | | row.status !== EnumContractTemplateStatus.Completed, |
| | | }, |
| | | }, |
| | | |
| | |
| | | async function handleAddOrEdit() { |
| | | try { |
| | | let isEdit = !!editForm.id; |
| | | let pdfToImage = await convertPdfToImage(editForm.file?.[0].url); |
| | | let params: API.SaveContractTemplateCommand = { |
| | | name: editForm.name, |
| | | file: editForm.file[0]?.path ?? '', |
| | |
| | | code: editForm.code, |
| | | access: editForm.access, |
| | | templateId: editForm.templateId, |
| | | // values: [ |
| | | // { |
| | | // id: '3fa85f64-5717-4562-b3fc-2c963f66afa6', |
| | | // type: 10, |
| | | // recorder: 10, |
| | | // userType: 10, |
| | | // label: 'string', |
| | | // name: 'string', |
| | | // required: true, |
| | | // }, |
| | | // ], |
| | | templateEditData: JSON.stringify( |
| | | pdfToImage.map( |
| | | (x) => |
| | | ({ |
| | | path: x.path, |
| | | width: x.width, |
| | | height: x.height, |
| | | } as TemplateEditDataItem) |
| | | ) |
| | | ), |
| | | }; |
| | | if (isEdit) { |
| | | params.id = editForm.id; |
| | |
| | | } catch (error) {} |
| | | } |
| | | |
| | | const router = useRouter(); |
| | | |
| | | function goEditTemplate(row: API.GetEnterpriseContractTemplatesQueryResultItem) { |
| | | openLink( |
| | | router.resolve({ |
| | | name: 'TemplateKeyEdit', |
| | | params: { |
| | | id: row.id ?? '', |
| | | }, |
| | | }).fullPath |
| | | ); |
| | | } |
| | | |
| | | const { openLogDialog, logDialogProps } = useOpenLogDialog({ |
| | | service: async ({ pageIndex, pageSize }, extraParamState) => { |
| | | try { |