|  |  |  | 
|---|
|  |  |  | ProTableV2, | 
|---|
|  |  |  | ProFormUpload, | 
|---|
|  |  |  | UploadUserFile, | 
|---|
|  |  |  | XLSXUtils, | 
|---|
|  |  |  | } from '@bole-core/components'; | 
|---|
|  |  |  | import * as insuranceOrderServices from '@/services/api/InsuranceOrder'; | 
|---|
|  |  |  | import * as insureBatchBillServices from '@/services/api/InsureBatchBill'; | 
|---|
|  |  |  | 
|---|
|  |  |  | url: response.path, | 
|---|
|  |  |  | insurePolicyId: id, | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | let checkRes = await insureBatchBillServices.importCheckBatchAddOrSubOrderData(params, { | 
|---|
|  |  |  | getResponse: true, | 
|---|
|  |  |  | responseType: 'blob', | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | if (checkRes?.data?.size) { | 
|---|
|  |  |  | let res = await insureBatchBillServices.importBatchAddOrSubOrderData(params); | 
|---|
|  |  |  | if (res?.error.length > 0) { | 
|---|
|  |  |  | Message.tipMessage('存在错误数据,是否导出?') | 
|---|
|  |  |  | .then(() => { | 
|---|
|  |  |  | downloadFile(checkRes.data, `错误人员名单`, 'xlsx'); | 
|---|
|  |  |  | XLSXUtils.exportToXLSX({ | 
|---|
|  |  |  | workbookDataList: res?.error, | 
|---|
|  |  |  | fileName: '错误人员名单', | 
|---|
|  |  |  | workbookHeaderMap: { | 
|---|
|  |  |  | changeFlag: '批改标志', | 
|---|
|  |  |  | insuranceScheme: '方案代码', | 
|---|
|  |  |  | name: '被保险人姓名', | 
|---|
|  |  |  | certType: '证件类型', | 
|---|
|  |  |  | idNumber: '证件号码', | 
|---|
|  |  |  | age: '年龄', | 
|---|
|  |  |  | phoneNumber: '手机号', | 
|---|
|  |  |  | workType: '职业/工种', | 
|---|
|  |  |  | gender: '性别', | 
|---|
|  |  |  | birthDay: '出生日期', | 
|---|
|  |  |  | remark: '备注', | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | .catch(() => { | 
|---|
|  |  |  | // getList(paginationState.pageIndex); | 
|---|
|  |  |  | state.staffList = _.uniqBy(res.addOrSub, 'idNumber'); | 
|---|
|  |  |  | getList(); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | let res = await insureBatchBillServices.importBatchAddOrSubOrderData(params); | 
|---|
|  |  |  | if (res?.addOrSub?.length) { | 
|---|
|  |  |  | state.staffList = res.addOrSub; | 
|---|
|  |  |  | getList(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | state.staffList = _.uniqBy(res.addOrSub, 'idNumber'); | 
|---|
|  |  |  | getList(); | 
|---|
|  |  |  | } catch (error) {} | 
|---|
|  |  |  | } | 
|---|
|  |  |  | async function handleUploadReplace(response: UploadUserFile) { | 
|---|
|  |  |  | 
|---|
|  |  |  | url: response.path, | 
|---|
|  |  |  | insurePolicyId: id, | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | let checkRes = await insureBatchBillServices.importCheckBatchUpdateOrderData(params, { | 
|---|
|  |  |  | getResponse: true, | 
|---|
|  |  |  | responseType: 'blob', | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | if (checkRes?.data?.size) { | 
|---|
|  |  |  | // let checkRes = await insureBatchBillServices.importCheckBatchUpdateOrderData(params, { | 
|---|
|  |  |  | //   getResponse: true, | 
|---|
|  |  |  | //   responseType: 'blob', | 
|---|
|  |  |  | // }); | 
|---|
|  |  |  | // if (checkRes?.data?.size) { | 
|---|
|  |  |  | //   Message.tipMessage('存在错误数据,是否导出?') | 
|---|
|  |  |  | //     .then(() => { | 
|---|
|  |  |  | //       downloadFile(checkRes.data, `错误人员名单`, 'xlsx'); | 
|---|
|  |  |  | //     }) | 
|---|
|  |  |  | //     .catch(() => { | 
|---|
|  |  |  | //       // getList(paginationState.pageIndex); | 
|---|
|  |  |  | //     }); | 
|---|
|  |  |  | // } else { | 
|---|
|  |  |  | //   let res = await insureBatchBillServices.importBatchUpdateOrderData(params); | 
|---|
|  |  |  | //   if (res?.update?.length) { | 
|---|
|  |  |  | //     state.staffList = res.update; | 
|---|
|  |  |  | //     getList(); | 
|---|
|  |  |  | //   } | 
|---|
|  |  |  | // } | 
|---|
|  |  |  | let res = await insureBatchBillServices.importBatchUpdateOrderData(params); | 
|---|
|  |  |  | if (res?.error.length > 0) { | 
|---|
|  |  |  | Message.tipMessage('存在错误数据,是否导出?') | 
|---|
|  |  |  | .then(() => { | 
|---|
|  |  |  | downloadFile(checkRes.data, `错误人员名单`, 'xlsx'); | 
|---|
|  |  |  | XLSXUtils.exportToXLSX({ | 
|---|
|  |  |  | workbookDataList: res?.error, | 
|---|
|  |  |  | fileName: '错误人员名单', | 
|---|
|  |  |  | workbookHeaderMap: { | 
|---|
|  |  |  | orginName: '原被保人姓名', | 
|---|
|  |  |  | orginIdNumber: '原被保人证件号码', | 
|---|
|  |  |  | name: '被保险人姓名', | 
|---|
|  |  |  | certType: '证件类型', | 
|---|
|  |  |  | idNumber: '证件号码', | 
|---|
|  |  |  | phoneNumber: '手机号', | 
|---|
|  |  |  | workType: '职业/工种', | 
|---|
|  |  |  | gender: '性别', | 
|---|
|  |  |  | age: '年龄', | 
|---|
|  |  |  | birthDay: '出生日期', | 
|---|
|  |  |  | remark: '备注', | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | .catch(() => { | 
|---|
|  |  |  | // getList(paginationState.pageIndex); | 
|---|
|  |  |  | state.staffList = _.uniqBy(_.uniqBy(res.update, 'idNumber'), 'orginIdNumber'); | 
|---|
|  |  |  | getList(); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | let res = await insureBatchBillServices.importBatchUpdateOrderData(params); | 
|---|
|  |  |  | if (res?.update?.length) { | 
|---|
|  |  |  | state.staffList = res.update; | 
|---|
|  |  |  | getList(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | state.staffList = _.uniqBy(_.uniqBy(res.update, 'idNumber'), 'orginIdNumber'); | 
|---|
|  |  |  | getList(); | 
|---|
|  |  |  | } catch (error) {} | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|