| | |
| | | <QueryFilterItem> |
| | | <FieldRadio |
| | | v-model="extraParamState.status" |
| | | :value-enum="[ |
| | | { value: 1, label: '待制版' }, |
| | | { value: 2, label: '已完成' }, |
| | | ]" |
| | | :value-enum="EnumContractTemplateStatusText" |
| | | buttonStyle |
| | | showAllBtn |
| | | @change="getList()" |
| | |
| | | </QueryFilterItem> |
| | | <QueryFilterItem tip-content="客户上传时间"> |
| | | <FieldDatePicker |
| | | v-model="extraParamState.beginDate" |
| | | v-model="extraParamState.createdTime" |
| | | type="daterange" |
| | | range-separator="~" |
| | | start-placeholder="开始日期" |
| | |
| | | </QueryFilterItem> |
| | | <QueryFilterItem tip-content="制版时间"> |
| | | <FieldDatePicker |
| | | v-model="extraParamState.beginDate" |
| | | v-model="extraParamState.completedTime" |
| | | type="daterange" |
| | | range-separator="~" |
| | | start-placeholder="开始日期" |
| | |
| | | </ProTableV2> |
| | | </AppContainer> |
| | | <AddOrEditTemplateDialog v-bind="dialogProps" /> |
| | | <OperateHistoryLogDialog v-bind="logDialogProps" /> |
| | | </LoadingLayout> |
| | | </template> |
| | | |
| | |
| | | } from '@bole-core/components'; |
| | | import { useAccess } from '@/hooks'; |
| | | import { ModelValueType } from 'element-plus'; |
| | | import * as enterpriseServices from '@/services/api/enterprise'; |
| | | import * as electronSignServices from '@/services/api/electronSign'; |
| | | import AddOrEditTemplateDialog from './components/AddOrEditTemplateDialog.vue'; |
| | | import { Message } from '@bole-core/core'; |
| | | import { downloadFileByUrl, Message } from '@bole-core/core'; |
| | | import { |
| | | convertApi2FormUrlOnlyOne, |
| | | convertPdfToImage, |
| | | format, |
| | | openLink, |
| | | setOSSLink, |
| | | } from '@/utils'; |
| | | import { EnumContractTemplateStatus, EnumContractTemplateStatusText } from '@/constants'; |
| | | |
| | | defineOptions({ |
| | | name: 'EditTemplate', |
| | | }); |
| | | |
| | | 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: { |
| | |
| | | }, |
| | | delBtn: { |
| | | emits: { onClick: (role) => handleDelete(role) }, |
| | | props: { type: 'danger' }, |
| | | extraProps: { |
| | | hide: (row) => false, |
| | | hide: (row: API.GetEnterpriseContractTemplatesQueryResultItem) => |
| | | row.status !== EnumContractTemplateStatus.Completed, |
| | | }, |
| | | }, |
| | | |
| | | logBtn: { |
| | | emits: { onClick: (role) => openLogDialog(role) }, |
| | | emits: { onClick: (role) => openLogDialog(role.id) }, |
| | | }, |
| | | }; |
| | | |
| | |
| | | operationBtnMap, |
| | | }); |
| | | |
| | | const router = useRouter(); |
| | | const route = useRoute(); |
| | | const enterpriseId = route.params?.id as string; |
| | | const BaseState = { |
| | | loading: true, |
| | | }; |
| | |
| | | } = useTable( |
| | | async ({ pageIndex, pageSize }, extraParamState) => { |
| | | try { |
| | | let params: API.GetEnterprisesQuery = { |
| | | let params: API.GetEnterpriseContractTemplatesQuery = { |
| | | pageModel: { |
| | | rows: pageSize, |
| | | page: pageIndex, |
| | | orderInput: extraParamState.orderInput, |
| | | }, |
| | | // searchKeys: extraParamState.keyword, |
| | | keywords: extraParamState.keyword, |
| | | status: extraParamState.status, |
| | | createdTimeBegin: format(extraParamState.createdTime?.[0] ?? '', 'YYYY-MM-DD 00:00:00'), |
| | | createdTimeEnd: format(extraParamState.createdTime?.[1] ?? '', 'YYYY-MM-DD 23:59:59'), |
| | | completedTimeBegin: format(extraParamState.completedTime?.[0] ?? '', 'YYYY-MM-DD 00:00:00'), |
| | | completedTimeEnd: format(extraParamState.completedTime?.[1] ?? '', 'YYYY-MM-DD 23:59:59'), |
| | | enterpriseId: enterpriseId, |
| | | }; |
| | | let res = await enterpriseServices.getEnterprises(params, { |
| | | let res = await electronSignServices.getEnterpriseContractTemplates(params, { |
| | | showLoading: !state.loading, |
| | | }); |
| | | return res; |
| | |
| | | { |
| | | defaultExtraParams: { |
| | | keyword: '', |
| | | status: '' as any as boolean, |
| | | beginDate: [] as unknown as ModelValueType, |
| | | endDate: [] as unknown as ModelValueType, |
| | | orderInput: [{ property: 'id', order: EnumPagedListOrder.Asc }], |
| | | status: '' as any as EnumContractTemplateStatus, |
| | | createdTime: [] as unknown as ModelValueType, |
| | | completedTime: [] as unknown as ModelValueType, |
| | | orderInput: [{ property: 'createdTime', order: EnumPagedListOrder.Desc }], |
| | | }, |
| | | columnsRenderProps: {}, |
| | | columnsRenderProps: { |
| | | createdTime: { type: 'date' }, |
| | | completedTime: { type: 'date' }, |
| | | status: { type: 'enum', valueEnum: EnumContractTemplateStatusText }, |
| | | access: { type: 'enum', valueEnum: EnumElectronSignAccessText }, |
| | | file: { |
| | | type: 'url', |
| | | showDownloadBtn: false, |
| | | formatter: (row: API.GetEnterpriseContractTemplatesQueryResultItem) => setOSSLink(row.file), |
| | | }, |
| | | }, |
| | | } |
| | | ); |
| | | |
| | |
| | | id: '', |
| | | templateId: '', |
| | | name: '', |
| | | bussinessCode: '', |
| | | templateFileUrl: [] as UploadUserFile[], |
| | | code: '', |
| | | file: [] as UploadUserFile[], |
| | | access: '' as any as EnumElectronSignAccess, |
| | | title: '新增模板', |
| | | }, |
| | | }); |
| | | |
| | | function openDialog(row?) { |
| | | function openDialog(row?: API.GetEnterpriseContractTemplatesQueryResultItem) { |
| | | if (row) { |
| | | handleEdit({ |
| | | id: '', |
| | | name: '', |
| | | bussinessCode: '', |
| | | templateId: '', |
| | | templateFileUrl: [] as UploadUserFile[], |
| | | id: row.id, |
| | | templateId: row.templateId, |
| | | name: row.name, |
| | | code: row.code, |
| | | file: convertApi2FormUrlOnlyOne(row.file), |
| | | access: row.access, |
| | | }); |
| | | } else { |
| | | handleAdd(); |
| | | } |
| | | } |
| | | |
| | | async function handleAddOrEdit() {} |
| | | |
| | | function handleDownload(row) {} |
| | | async function handleDelete(row) { |
| | | async function handleAddOrEdit() { |
| | | try { |
| | | await Message.deleteMessage(); |
| | | let isEdit = !!editForm.id; |
| | | let pdfToImage = await convertPdfToImage(editForm.file?.[0].url); |
| | | let params: API.SaveContractTemplateCommand = { |
| | | name: editForm.name, |
| | | file: editForm.file[0]?.path ?? '', |
| | | enterpriseId: enterpriseId, |
| | | code: editForm.code, |
| | | access: editForm.access, |
| | | templateId: editForm.templateId, |
| | | templateEditData: JSON.stringify( |
| | | pdfToImage.map( |
| | | (x) => |
| | | ({ |
| | | path: x.path, |
| | | width: x.width, |
| | | height: x.height, |
| | | } as TemplateEditDataItem) |
| | | ) |
| | | ), |
| | | }; |
| | | if (isEdit) { |
| | | params.id = editForm.id; |
| | | } |
| | | let res = await electronSignServices.saveContractTemplate(params); |
| | | if (res) { |
| | | Message.successMessage('操作成功'); |
| | | getList(); |
| | | } |
| | | } catch (error) {} |
| | | } |
| | | |
| | | function openLogDialog(row) {} |
| | | function handleDownload(row: API.GetEnterpriseContractTemplatesQueryResultItem) { |
| | | downloadFileByUrl(setOSSLink(row.file), '模板'); |
| | | } |
| | | async function handleDelete(row: API.GetEnterpriseContractTemplatesQueryResultItem) { |
| | | try { |
| | | await Message.deleteMessage(); |
| | | let res = await electronSignServices.setIsDisabledContractTemplate({ |
| | | ids: [row.id], |
| | | isDisabled: true, |
| | | }); |
| | | if (res) { |
| | | Message.successMessage('操作成功'); |
| | | getList(paginationState.pageIndex); |
| | | } |
| | | } 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 { |
| | | let params: API.GetEnterpriseContractTemplateLogsQuery = { |
| | | pageModel: { |
| | | rows: pageSize, |
| | | page: pageIndex, |
| | | orderInput: extraParamState.orderInput, |
| | | }, |
| | | id: extraParamState.id, |
| | | }; |
| | | let res = await electronSignServices.getEnterpriseContractTemplateLogs(params, { |
| | | showLoading: !state.loading, |
| | | }); |
| | | return res; |
| | | } catch (error) {} |
| | | }, |
| | | }); |
| | | </script> |