| | |
| | | </QueryFilterItem> |
| | | <QueryFilterItem> |
| | | <FieldRadio |
| | | v-model="extraParamState.onJobFlag" |
| | | :value-enum="OnJobFlagEnumText" |
| | | buttonStyle |
| | | showAllBtn |
| | | @change="getList()" |
| | | /> |
| | | </QueryFilterItem> |
| | | <QueryFilterItem> |
| | | <FieldRadio |
| | | v-model="extraParamState.insuranceType" |
| | | v-model="extraParamState.insurancePeriod" |
| | | :value-enum="insuranceTypeText" |
| | | buttonStyle |
| | | showAllBtn |
| | |
| | | /> |
| | | </QueryFilterItem> |
| | | <QueryFilterItem> |
| | | <FieldRadio |
| | | v-model="extraParamState.status" |
| | | :value-enum="InsurancePolicyStatusEnumText" |
| | | buttonStyle |
| | | showAllBtn |
| | | @change="getList()" |
| | | /> |
| | | </QueryFilterItem> |
| | | <QueryFilterItem> |
| | | <SearchInput |
| | | v-model="extraParamState.keyword" |
| | | v-model="extraParamState.condition" |
| | | style="width: 260px" |
| | | placeholder="单位/保单号/参保机构" |
| | | @on-click-search="getList" |
| | |
| | | >导入</el-button |
| | | > |
| | | |
| | | <el-button @click="downloadInsureOrder()" type="primary" link>导出保单列表</el-button> |
| | | <el-button @click="downloadInsurePerson()" type="primary" link>导出在保人员</el-button> |
| | | <el-button @click="getInsurancePageExport()" type="primary" link>导出保单列表</el-button> |
| | | <el-button @click="getInsuranceStaffPageExport()" type="primary" link |
| | | >导出在保人员</el-button |
| | | > |
| | | </template> |
| | | </ProTableQueryFilterBar> |
| | | <ProTableV2 |
| | |
| | | UploadUserFile, |
| | | SearchInput, |
| | | FieldRadio, |
| | | XLSXUtils, |
| | | } from '@bole-core/components'; |
| | | import * as insuranceOrderServices from '@/services/api/InsuranceOrder'; |
| | | import { Message, OrderInputType, downloadFileByUrl } from '@bole-core/core'; |
| | | import { columns } from './constants'; |
| | | import UploadInsurePersonDialog from './components/UploadInsurePersonDialog.vue'; |
| | | import UploadStampFileDialog from './components/UploadStampFileDialog.vue'; |
| | | import { format, downloadFile, setOSSLink } from '@/utils'; |
| | | import { format, downloadFile, setOSSLink, toThousand, convertApi2FormUrl } from '@/utils'; |
| | | import { ModelValueType } from 'element-plus'; |
| | | import { InsuranceOrderTempPath, OnJobFlagEnumText, insuranceTypeText } from '@/constants'; |
| | | import { |
| | | InsuranceOrderTempPath, |
| | | insuranceTypeText, |
| | | InsurancePolicyStatusEnumText, |
| | | InsurancePolicyStatusEnum, |
| | | } from '@/constants'; |
| | | import dayjs from 'dayjs'; |
| | | import _ from 'lodash'; |
| | | |
| | |
| | | emits: { |
| | | onClick: (role) => handleBatch(role), |
| | | }, |
| | | // extraProps: { |
| | | // hide: (row: API.InsuranceOrderListOutput) => !row.orderBillFile, |
| | | // }, |
| | | extraProps: { |
| | | hide: (row: API.GetInsurancePageOutput) => row.status !== InsurancePolicyStatusEnum.Effecting, |
| | | }, |
| | | }, |
| | | { |
| | | data: { |
| | |
| | | emits: { |
| | | onClick: (role) => handleUploadStampFile(role), |
| | | }, |
| | | // extraProps: { |
| | | // hide: (row: API.InsuranceOrderListOutput) => !row.orderBillFile, |
| | | // }, |
| | | extraProps: { |
| | | hide: (row: API.GetInsurancePageOutput) => |
| | | row.status !== InsurancePolicyStatusEnum.WaitEffect, |
| | | }, |
| | | }, |
| | | { |
| | | data: { |
| | |
| | | name: '保单下载', |
| | | }, |
| | | emits: { |
| | | onClick: (role) => handleDownloadOrderNo(role), |
| | | onClick: (role) => handleDownloadInsureFile(role), |
| | | }, |
| | | extraProps: { |
| | | hide: (row: API.InsuranceOrderListOutput) => !row.orderBillFile, |
| | | hide: (row: API.GetInsurancePageOutput) => |
| | | row.status === InsurancePolicyStatusEnum.WaitEffect, |
| | | }, |
| | | }, |
| | | ]).filter(Boolean); |
| | |
| | | async ({ pageIndex, pageSize }, extraParamState) => { |
| | | try { |
| | | let params = createParams(pageIndex, pageSize); |
| | | let res = await insuranceOrderServices.getInsuranceOrderPage(params, { |
| | | let res = await insuranceOrderServices.getInsurancePage(params, { |
| | | showLoading: !state.loading, |
| | | }); |
| | | return res; |
| | |
| | | }, |
| | | { |
| | | defaultExtraParams: { |
| | | orderInput: [{ property: 'createTime', order: OrderInputType.Desc }], |
| | | orderInput: [{ property: 'id', order: OrderInputType.Desc }], |
| | | creationDate: [] as unknown as ModelValueType, |
| | | keyword: '', |
| | | onJobFlag: '', |
| | | insuranceType: '', |
| | | condition: '', |
| | | status: '' as any as InsurancePolicyStatusEnum, |
| | | insurancePeriod: '', |
| | | }, |
| | | columnsRenderProps: { |
| | | createTime: { |
| | | type: 'date', |
| | | format: 'YYYY/MM/DD', |
| | | status: { type: 'enum', valueEnum: InsurancePolicyStatusEnumText }, |
| | | insurancePeriod: { type: 'enum', valueEnum: insuranceTypeText }, |
| | | creationTime: { type: 'date', format: 'YYYY-MM-DD' }, |
| | | effectStartTime: { type: 'date', format: 'YYYY-MM-DD' }, |
| | | effectEndTime: { type: 'date', format: 'YYYY-MM-DD' }, |
| | | sumInsured: { |
| | | type: 'money', |
| | | formatter: (row: API.GetInsurancePageOutput) => |
| | | row.sumInsured == null ? '' : toThousand(row.sumInsured), |
| | | }, |
| | | insuranceBeginTime: { |
| | | type: 'date', |
| | | format: 'YYYY/MM/DD', |
| | | }, |
| | | insuranceEndTime: { |
| | | type: 'date', |
| | | format: 'YYYY/MM/DD', |
| | | amount: { |
| | | type: 'money', |
| | | formatter: (row: API.GetInsurancePageOutput) => |
| | | row.amount == null ? '' : toThousand(row.amount), |
| | | }, |
| | | }, |
| | | } |
| | | ); |
| | | |
| | | function createParams(pageIndex: number, pageSize: number) { |
| | | let params: API.QueryInsuranceOrderPageInput = { |
| | | let params: API.GetInsurancePageInput = { |
| | | pageModel: { |
| | | rows: pageSize, |
| | | page: pageIndex, |
| | | orderInput: extraParamState.orderInput, |
| | | }, |
| | | beginCreationTime: format(extraParamState.creationDate?.[0] ?? '', 'YYYY-MM-DD 00:00:00'), |
| | | endCreationTime: format(extraParamState.creationDate?.[1] ?? '', 'YYYY-MM-DD 23:59:59'), |
| | | condition: extraParamState.keyword, |
| | | onJobFlag: extraParamState.onJobFlag, |
| | | insuranceType: extraParamState.insuranceType, |
| | | importStartDateTime: format(extraParamState.creationDate?.[0] ?? '', 'YYYY-MM-DD 00:00:00'), |
| | | importEndDateTime: format(extraParamState.creationDate?.[1] ?? '', 'YYYY-MM-DD 23:59:59'), |
| | | condition: extraParamState.condition, |
| | | insurancePeriod: extraParamState.insurancePeriod, |
| | | status: extraParamState.status, |
| | | }; |
| | | return params; |
| | | } |
| | | |
| | | const { dialogProps, handleAdd, editForm } = useFormDialog({ |
| | | onConfirm: uploadInsurePerson, |
| | | const { dialogProps, handleAdd, editForm, dialogState } = useFormDialog({ |
| | | onConfirm: checkInrancesSerialNumStatus, |
| | | defaultFormParams: { |
| | | orderNo: '', |
| | | serialNum: '', |
| | | url: [] as UploadUserFile[], |
| | | }, |
| | | closeAfterConfirm: false, |
| | | }); |
| | | |
| | | async function checkInrancesSerialNumStatus() { |
| | | try { |
| | | let params: API.APIimportInsStaffToListParams = { |
| | | serialNum: editForm.serialNum, |
| | | url: editForm.url?.[0]?.path, |
| | | }; |
| | | let res = await insuranceOrderServices.checkInrancesSerialNumStatus(params); |
| | | if (res === InsurancePolicyStatusEnum.Effecting) { |
| | | await Message.tipMessage('该批次保单已生效,请修改批次号后重新导入'); |
| | | } else if (res === InsurancePolicyStatusEnum.OutTimeEffect) { |
| | | await Message.tipMessage('该批次保单已失效,请修改批次号后重新导入'); |
| | | } else if (res === InsurancePolicyStatusEnum.WaitEffect) { |
| | | await Message.tipMessage('存在相同的批次号,是否覆盖?'); |
| | | importInsStaffToList(); |
| | | } else { |
| | | importInsStaffToList(); |
| | | } |
| | | } catch (error) {} |
| | | } |
| | | |
| | | async function importInsStaffToList() { |
| | | try { |
| | | let params: API.APIimportInsStaffToListParams = { |
| | | serialNum: editForm.serialNum, |
| | | url: editForm.url?.[0]?.path, |
| | | }; |
| | | let res = await insuranceOrderServices.importInsStaffToList(params); |
| | | if (res.length > 0) { |
| | | await Message.tipMessage('存在错误数据,是否导出?'); |
| | | XLSXUtils.exportToXLSX({ |
| | | workbookDataList: res, |
| | | fileName: '错误人员名单', |
| | | workbookHeaderMap: { |
| | | name: '雇员姓名', |
| | | sex: '性别', |
| | | certType: '证件类型', |
| | | certNo: '证件号码', |
| | | jobName: '雇员工种', |
| | | useEmploer: '用工单位', |
| | | address: '用工地点', |
| | | note: '备注', |
| | | }, |
| | | }); |
| | | } |
| | | dialogState.dialogVisible = false; |
| | | getList(paginationState.pageIndex); |
| | | } catch (error) {} |
| | | } |
| | | |
| | | function handleUpload() { |
| | | handleAdd({ |
| | | orderNo: '', |
| | | serialNum: `${dayjs().format('YYYYMMDD')}${_.random(0, 9999).toString().padStart(4, '0')}`, |
| | | url: [] as UploadUserFile[], |
| | | }); |
| | | } |
| | | |
| | | async function uploadInsurePerson() { |
| | | try { |
| | | let params = { |
| | | orderNo: editForm.orderNo, |
| | | url: editForm.url?.[0]?.path, |
| | | }; |
| | | // let res = await insuranceOrderServices.uploadStampFile(params); |
| | | // if (res) { |
| | | // Message.successMessage('上传成功'); |
| | | // getList(paginationState.pageIndex); |
| | | // } |
| | | } catch (error) {} |
| | | } |
| | | |
| | | const router = useRouter(); |
| | | |
| | | async function handleExport() { |
| | | async function getInsurancePageExport() { |
| | | try { |
| | | if (paginationState.total === 0) { |
| | | Message.warnMessage('没有数据可以导出哦~'); |
| | | return; |
| | | } |
| | | let params = createParams(paginationState.pageIndex, paginationState.pageSize); |
| | | let res = await insuranceOrderServices.exportInsuranceOrderList(params, { |
| | | let res = await insuranceOrderServices.getInsurancePageExport(params, { |
| | | responseType: 'blob', |
| | | getResponse: true, |
| | | }); |
| | |
| | | } catch (error) {} |
| | | } |
| | | |
| | | async function getInsuranceStaffPageExport() { |
| | | try { |
| | | if (paginationState.total === 0) { |
| | | Message.warnMessage('没有数据可以导出哦~'); |
| | | return; |
| | | } |
| | | let params = createParams(paginationState.pageIndex, paginationState.pageSize); |
| | | let res = await insuranceOrderServices.getInsuranceStaffPageExport(params, { |
| | | responseType: 'blob', |
| | | getResponse: true, |
| | | }); |
| | | if (res) { |
| | | downloadFile(res.data, `在保人员导出`, 'xlsx'); |
| | | } |
| | | } catch (error) {} |
| | | } |
| | | |
| | | function handleDownload() { |
| | | downloadFileByUrl(InsuranceOrderTempPath, '保单导入模板'); |
| | | } |
| | | |
| | | function handleRowStyle(data: { row: API.InsuranceOrderListOutput }) { |
| | | function handleRowStyle(data: { row: API.GetInsurancePageOutput }) { |
| | | if ( |
| | | dayjs(dayjs(data.row?.insuranceEndTime).format('YYYY-MM-DD')).diff(dayjs(), 'day') >= 0 && |
| | | dayjs(dayjs(data.row?.insuranceEndTime).format('YYYY-MM-DD')).diff(dayjs(), 'day') < 6 |
| | | dayjs(dayjs(data.row?.effectEndTime).format('YYYY-MM-DD')).diff(dayjs(), 'day') >= 0 && |
| | | dayjs(dayjs(data.row?.effectEndTime).format('YYYY-MM-DD')).diff(dayjs(), 'day') < 6 |
| | | ) { |
| | | return { |
| | | color: '#ff0000', |
| | |
| | | handleEdit: handleStampFileEdit, |
| | | editForm: stampFileForm, |
| | | } = useFormDialog({ |
| | | onConfirm: uploadStampFile, |
| | | onConfirm: uploadInsuranceStampFiles, |
| | | defaultFormParams: { |
| | | id: '', |
| | | url: [] as UploadUserFile[], |
| | | }, |
| | | }); |
| | | |
| | | function handleUploadStampFile(row: API.InsuranceOrderListOutput) { |
| | | handleStampFileEdit({ |
| | | id: row.id, |
| | | url: [] as UploadUserFile[], |
| | | }); |
| | | } |
| | | |
| | | async function uploadStampFile() { |
| | | async function handleUploadStampFile(row: API.GetInsurancePageOutput) { |
| | | try { |
| | | let params = { |
| | | id: stampFileForm.id, |
| | | url: stampFileForm.url?.[0]?.path, |
| | | }; |
| | | // let res = await insuranceOrderServices.uploadStampFile(params); |
| | | // if (res) { |
| | | // Message.successMessage('上传成功'); |
| | | // getList(paginationState.pageIndex); |
| | | // } |
| | | const url = await getInsurancePolicyStampFiles(row.id); |
| | | handleStampFileEdit({ |
| | | id: row.id, |
| | | url: url.map((x) => convertApi2FormUrl(x)) ?? [], |
| | | }); |
| | | } catch (error) {} |
| | | } |
| | | |
| | | function handleDownloadOrderNo(row: API.InsuranceOrderListOutput) { |
| | | downloadFileByUrl(setOSSLink(row.orderBillFile)); |
| | | async function uploadInsuranceStampFiles() { |
| | | try { |
| | | let params: API.UploadInsuranceStampFilesInput = { |
| | | insurancePolicyId: stampFileForm.id, |
| | | listFiles: stampFileForm.url?.map((x) => x.path) ?? [], |
| | | }; |
| | | let res = await insuranceOrderServices.uploadInsuranceStampFiles(params); |
| | | if (res) { |
| | | Message.successMessage('上传成功'); |
| | | getList(paginationState.pageIndex); |
| | | } |
| | | } catch (error) {} |
| | | } |
| | | |
| | | function handleDetail(row: API.InsuranceOrderListOutput) { |
| | | async function getInsurancePolicyStampFiles(id: string) { |
| | | try { |
| | | return await insuranceOrderServices.getInsurancePolicyStampFiles({ id: id }); |
| | | } catch (error) {} |
| | | } |
| | | |
| | | function handleDownloadInsureFile(row: API.GetInsurancePageOutput) { |
| | | downloadFileByUrl(setOSSLink(row.insureBillUrl)); |
| | | } |
| | | |
| | | function handleDetail(row: API.GetInsurancePageOutput) { |
| | | router.push({ |
| | | name: 'InsuranceOrderDetail', |
| | | params: { |
| | |
| | | }, |
| | | }); |
| | | } |
| | | function handleBatch(row: API.InsuranceOrderListOutput) { |
| | | function handleBatch(row: API.GetInsurancePageOutput) { |
| | | if ( |
| | | dayjs(row.effectEndTime).isAfter(dayjs()) || |
| | | dayjs(row.effectEndTime).isBefore(dayjs(), 'day') |
| | | ) { |
| | | Message.errorMessage('保险今天到期,无法批改'); |
| | | return; |
| | | } |
| | | router.push({ |
| | | name: 'BatchChange', |
| | | params: { |
| | | id: row.id, |
| | | }, |
| | | query: { |
| | | insurerName: row.insurerName ?? '', |
| | | insureBillNo: row.insureBillNo ?? '', |
| | | effectEndTime: row.effectEndTime ?? '', |
| | | }, |
| | | }); |
| | | } |
| | | function downloadInsureOrder() {} |
| | | function downloadInsurePerson() {} |
| | | </script> |