|  |  |  | 
|---|
|  |  |  | <QueryFilterItem tip-content="制版状态"> | 
|---|
|  |  |  | <FieldRadio | 
|---|
|  |  |  | v-model="extraParamState.status" | 
|---|
|  |  |  | :value-enum="[ | 
|---|
|  |  |  | { label: '已完成', value: 1 }, | 
|---|
|  |  |  | { label: '待制版', value: 0 }, | 
|---|
|  |  |  | ]" | 
|---|
|  |  |  | :value-enum="EnumContractTemplateStatusText" | 
|---|
|  |  |  | buttonStyle | 
|---|
|  |  |  | showAllBtn | 
|---|
|  |  |  | @change="getList()" | 
|---|
|  |  |  | 
|---|
|  |  |  | </QueryFilterItem> | 
|---|
|  |  |  | <QueryFilterItem> | 
|---|
|  |  |  | <FieldDatePicker | 
|---|
|  |  |  | v-model="extraParamState.time" | 
|---|
|  |  |  | v-model="extraParamState.createdTime" | 
|---|
|  |  |  | type="daterange" | 
|---|
|  |  |  | range-separator="~" | 
|---|
|  |  |  | start-placeholder="起始时间" | 
|---|
|  |  |  | 
|---|
|  |  |  | :columns="AgreementbManageColumns" | 
|---|
|  |  |  | :operationBtns="operationBtns" | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <template #code="{ row }"> | 
|---|
|  |  |  | <el-button | 
|---|
|  |  |  | v-if="row.status === EnumContractTemplateStatus.Completed && !!row.wxmpQrCode" | 
|---|
|  |  |  | link | 
|---|
|  |  |  | type="primary" | 
|---|
|  |  |  | @click="handlePreviewQrcode(row)" | 
|---|
|  |  |  | >查看</el-button | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <span v-else></span> | 
|---|
|  |  |  | </template> | 
|---|
|  |  |  | </ProTableV2> | 
|---|
|  |  |  | </AppContainer> | 
|---|
|  |  |  | <TemplateAddDialog v-bind="dialogProps"></TemplateAddDialog> | 
|---|
|  |  |  | <QrcodeDialog v-bind="dialogQrcodeProps" :useQrcode="false"></QrcodeDialog> | 
|---|
|  |  |  | </LoadingLayout> | 
|---|
|  |  |  | </template> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | bolePreview, | 
|---|
|  |  |  | } from '@bole-core/components'; | 
|---|
|  |  |  | import { AgreementbManageColumns } from './constants'; | 
|---|
|  |  |  | import { EnumUserGender } from '@/constants'; | 
|---|
|  |  |  | import { downloadFileByUrl } from '@/utils'; | 
|---|
|  |  |  | import { EnumContractTemplateStatus, EnumContractTemplateStatusText } from '@/constants'; | 
|---|
|  |  |  | import { convertPdfToImage, downloadFileByUrl, format, setOSSLink } from '@/utils'; | 
|---|
|  |  |  | import { ModelValueType } from 'element-plus'; | 
|---|
|  |  |  | import * as taskServices from '@/services/api/task'; | 
|---|
|  |  |  | import * as electronSignServices from '@/services/api/electronSign'; | 
|---|
|  |  |  | import TemplateAddDialog from './components/TemplateAddDialog.vue'; | 
|---|
|  |  |  | import QrcodeDialog from './components/QrcodeDialog.vue'; | 
|---|
|  |  |  | import { Message } from '@bole-core/core'; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | defineOptions({ | 
|---|
|  |  |  | name: 'AgreementManageList', | 
|---|
|  |  |  | 
|---|
|  |  |  | emits: { | 
|---|
|  |  |  | onClick: (role) => handleCheck(role), | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | extraProps: { | 
|---|
|  |  |  | hide: (row) => row.status !== EnumContractTemplateStatus.Completed, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | data: { | 
|---|
|  |  |  | 
|---|
|  |  |  | emits: { | 
|---|
|  |  |  | onClick: (role) => handleDownload(role), | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | extraProps: { | 
|---|
|  |  |  | hide: (row) => row.status !== EnumContractTemplateStatus.Completed, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | data: { | 
|---|
|  |  |  | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | emits: { | 
|---|
|  |  |  | onClick: (role) => handleDelete(role), | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | props: { type: 'danger' }, | 
|---|
|  |  |  | extraProps: { | 
|---|
|  |  |  | hide: (row) => row.status !== EnumContractTemplateStatus.Completed, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | ]); | 
|---|
|  |  |  | 
|---|
|  |  |  | } = useTable( | 
|---|
|  |  |  | async ({ pageIndex, pageSize }, extraParamState) => { | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | let params: API.GetTaskInfosQuery = { | 
|---|
|  |  |  | let params: API.GetEnterpriseContractTemplatesQuery = { | 
|---|
|  |  |  | pageModel: { | 
|---|
|  |  |  | rows: pageSize, | 
|---|
|  |  |  | page: pageIndex, | 
|---|
|  |  |  | orderInput: extraParamState.orderInput, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | keywords: extraParamState.keywords, | 
|---|
|  |  |  | 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'), | 
|---|
|  |  |  | }; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | let res = await taskServices.getTaskInfos(params, { | 
|---|
|  |  |  | let res = await electronSignServices.getEnterpriseContractTemplates(params, { | 
|---|
|  |  |  | showLoading: !state.loading, | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | return res; | 
|---|
|  |  |  | 
|---|
|  |  |  | { | 
|---|
|  |  |  | defaultExtraParams: { | 
|---|
|  |  |  | keywords: '', | 
|---|
|  |  |  | status: '' as any as EnumUserGender, | 
|---|
|  |  |  | time: [] as unknown as ModelValueType, | 
|---|
|  |  |  | orderInput: [{ property: 'id', order: EnumPagedListOrder.Desc }], | 
|---|
|  |  |  | status: '' as any as EnumContractTemplateStatus, | 
|---|
|  |  |  | createdTime: [] as unknown as ModelValueType, | 
|---|
|  |  |  | orderInput: [{ property: 'createdTime', order: EnumPagedListOrder.Desc }], | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | queryKey: ['flexEnterpriseServices/getFlexEnterpriseList'], | 
|---|
|  |  |  | columnsRenderProps: {}, | 
|---|
|  |  |  | queryKey: ['electronSignServices/getEnterpriseContractTemplates'], | 
|---|
|  |  |  | columnsRenderProps: { | 
|---|
|  |  |  | createdTime: { type: 'date' }, | 
|---|
|  |  |  | completedTime: { type: 'date' }, | 
|---|
|  |  |  | status: { type: 'enum', valueEnum: EnumContractTemplateStatusText }, | 
|---|
|  |  |  | isAutoSign: { | 
|---|
|  |  |  | formatter: (row: API.GetEnterpriseContractTemplatesQueryResultItem) => | 
|---|
|  |  |  | row.isAutoSign ? '是' : '否', | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | } | 
|---|
|  |  |  | ); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | async function handleAddOrEdit() {} | 
|---|
|  |  |  |  | 
|---|
|  |  |  | function handleDelete(row) { | 
|---|
|  |  |  | console.log('row: ', row); | 
|---|
|  |  |  | async function handleAddOrEdit() { | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | let pdfToImage = await convertPdfToImage(editForm.url?.[0].url); | 
|---|
|  |  |  | let params: API.SaveContractTemplateCommand = { | 
|---|
|  |  |  | name: editForm.name, | 
|---|
|  |  |  | file: editForm.url[0]?.path ?? '', | 
|---|
|  |  |  | templateEditData: JSON.stringify( | 
|---|
|  |  |  | pdfToImage.map( | 
|---|
|  |  |  | (x) => | 
|---|
|  |  |  | ({ | 
|---|
|  |  |  | path: x.path, | 
|---|
|  |  |  | width: x.width, | 
|---|
|  |  |  | height: x.height, | 
|---|
|  |  |  | } as TemplateEditDataItem) | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | ), | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | let res = await electronSignServices.saveContractTemplate(params); | 
|---|
|  |  |  | if (res) { | 
|---|
|  |  |  | Message.successMessage('保存成功'); | 
|---|
|  |  |  | getList(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } catch (error) {} | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | function handleDownload(row) { | 
|---|
|  |  |  | downloadFileByUrl('', '模板'); | 
|---|
|  |  |  | 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) {} | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | function handleCheck(row) { | 
|---|
|  |  |  | function handleDownload(row: API.GetEnterpriseContractTemplatesQueryResultItem) { | 
|---|
|  |  |  | downloadFileByUrl(setOSSLink(row.file), '模板'); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | function handleCheck(row: API.GetEnterpriseContractTemplatesQueryResultItem) { | 
|---|
|  |  |  | bolePreview({ | 
|---|
|  |  |  | fileUrl: '', | 
|---|
|  |  |  | fileUrl: setOSSLink(row.file), | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const { dialogProps: dialogQrcodeProps, handleEdit } = useFormDialog({ | 
|---|
|  |  |  | defaultFormParams: { | 
|---|
|  |  |  | qrcodeUrl: '', | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | function handlePreviewQrcode(row: API.GetEnterpriseContractTemplatesQueryResultItem) { | 
|---|
|  |  |  | handleEdit({ | 
|---|
|  |  |  | // qrcodeUrl: setOSSLink(row.file), | 
|---|
|  |  |  | qrcodeUrl: setOSSLink(row.wxmpQrCode), | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | </script> | 
|---|