You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

359 lines
13 KiB

import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { ModalForm, ProDescriptions, ProFormTextArea, ProTable, ProCard, FooterToolbar, } from '@ant-design/pro-components';
import { dateFormatter, getStorage, phoneEncryption, useRoutes, themeMessage, } from '@component/utils';
import { useRequest } from 'ahooks';
import { formatImageUrl } from '@component/utils';
import { DescriptionsDetail } from '@component/ui';
import { CardDetail } from '@component/ui';
import { PreviewFile } from '@component/ui';
import { Button, message, Upload, Modal, Divider } from 'antd';
import { getDetail, onAuditServiceApply, getServiceCondition, getServiceApply, } from './action';
import React, { useState } from 'react';
import { compact } from 'lodash';
import moment from 'moment/moment';
export default function ({ params, serviceUrl }) {
const { historyBack, historyPush, historyReplace } = useRoutes();
const [hiddenNumFlag, setHiddenNumFlag] = useState(false);
const { data = {}, loading } = useRequest(getDetail, {
defaultParams: {
id: params.id,
},
onSuccess: (data) => {
if ((data === null || data === void 0 ? void 0 : data.serviceClassifyType) == 'jizhongfuwu') {
setHiddenNumFlag(true);
}
},
});
const { runAsync } = useRequest(onAuditServiceApply, {
manual: true,
onSuccess(result) {
themeMessage(result);
},
onError(result) {
message.error(result.message);
},
});
const review = [
{ status: '5', title: '退回至下一级', danger: true },
{ status: '2', title: '驳回修改', danger: true },
{ status: '4', title: '提交上级审核' },
{ status: '3', title: '审核通过' },
];
function onFinish(values, status) {
values.ids = params.id;
values.status = status;
if (status == '4' || status == '2') {
Modal.confirm({
content: '即将提交审核,确定要提交吗?',
onOk() {
return runAsync(values).then((res) => {
if (res.type === 'success') {
historyBack();
}
});
},
});
return;
}
if (data.applyStatus == '4') {
Modal.confirm({
content: '即将提交审核,确定要提交吗?',
onOk() {
return runAsync(values).then((res) => {
if (res.type === 'success') {
historyBack();
}
});
},
});
}
else {
Modal.confirm({
content: '审核通过后,可进行服务调度,去调度表示审核通过并调度',
onOk() {
return runAsync(values).then((res) => {
if (res.type === 'success') {
historyReplace('distribution', {
id: data === null || data === void 0 ? void 0 : data.serviceProjectId,
});
}
});
},
});
}
}
const columns = [
{
title: '服务名称',
dataIndex: 'serviceName',
ellipsis: true,
},
{
title: '被服务对象',
dataIndex: 'customerName',
ellipsis: true,
},
{
title: '标准分类',
dataIndex: 'aqServiceName',
ellipsis: true,
},
{
title: '服务活动',
dataIndex: 'serviceTypeName',
ellipsis: true,
},
{
title: '服务费(元)',
dataIndex: 'servicePrice',
ellipsis: true,
},
{
title: '服务机构',
dataIndex: 'executedOrganName',
ellipsis: true,
},
{
title: '服务人员',
dataIndex: 'userName',
ellipsis: true,
},
{
title: '状态',
dataIndex: 'status',
valueEnum: {
1: {
text: '待执行',
},
2: {
text: '已签到',
},
3: {
text: '已提交',
},
10: {
text: '平台待审核',
},
11: {
text: '已完成',
},
12: {
text: '平台驳回',
},
20: {
text: '机构待审核',
},
21: {
text: '机构通过',
},
},
},
{
title: '完成时间',
dataIndex: 'completedAt',
ellipsis: true,
renderText: dateFormatter,
},
{
title: '操作',
valueType: 'option',
fixed: 'right',
width: 70,
align: 'center',
key: 'option',
render: (_, record) => [
_jsx("a", Object.assign({ onClick: () => historyPush(serviceUrl, {
serviceId: record.serviceId,
}) }, { children: "\u67E5\u770B" })),
],
},
];
const serviceColum = React.useMemo(() => [
{
dataIndex: 'policyNumber',
title: '保单号',
},
{
dataIndex: 'serviceObjectName',
title: '被服务对象',
},
{
dataIndex: 'belongToHandlerOrganName',
title: '归属机构',
},
{
dataIndex: 'belongToHandlerUserName',
title: '归属经办人',
renderText(_, item) {
return compact([
item.belongToHandlerUserName,
item.belongToHandlerCode,
]).join(',');
},
},
{
dataIndex: 'startDate',
title: '起保日期',
renderText: dateFormatter,
},
{
dataIndex: 'doneDate',
title: '终保日期',
renderText: dateFormatter,
},
{
dataIndex: 'duePremium',
title: '保费(元)',
},
{
dataIndex: 'paidInPremium',
title: '实收保费(元)',
},
{
dataIndex: 'contactsName',
title: '企业联系人',
},
{
dataIndex: 'contactsPhone',
title: '企业联系电话',
render: (_, record) => record.contactsPhone && phoneEncryption(record.contactsPhone),
},
{
dataIndex: 'email',
title: '企业邮箱',
},
{
dataIndex: 'typePname',
title: '管理分类',
},
], []);
const desColum = React.useMemo(() => [
{
title: '服务名称',
key: 'serviceProjectName',
dataIndex: 'serviceProjectName',
},
{
title: '标准分类',
key: 'aqServiceName',
dataIndex: 'aqServiceName',
},
{
title: '价格方案',
key: 'serviceSchemeName',
dataIndex: 'serviceSchemeName',
},
{
title: '服务价格(元)',
key: 'servicePrice',
dataIndex: 'servicePrice',
},
{
title: '服务活动',
key: 'serviceTypeName',
dataIndex: 'serviceTypeName',
},
{
title: '申请类型',
key: 'applySource',
dataIndex: 'applySource',
valueEnum: {
insure: '内部创建',
company: '企业申请',
policy: '基于保单申请',
},
},
{
title: '申请时间',
key: 'createdAt',
dataIndex: 'createdAt',
renderText: dateFormatter,
},
{
title: '期望服务时间',
key: 'estimatedServiceAt',
dataIndex: 'estimatedServiceAt',
renderText: (str) => moment(str).format('YYYY-MM-DD'),
},
{
title: '申请状态',
key: 'applyStatus',
dataIndex: 'applyStatus',
valueEnum: {
1: '待审核',
2: '驳回',
3: '通过',
4: '已受理',
'-1': '暂存',
},
},
{
title: '已服务次数',
key: 'serviceNum',
dataIndex: 'serviceNum',
hideInDescriptions: hiddenNumFlag,
},
{
title: '已申请次数',
key: 'applyNum',
dataIndex: 'applyNum',
hideInDescriptions: hiddenNumFlag,
},
{
title: '隐患排查次数',
key: 'hiddenServiceQuantity',
dataIndex: 'hiddenServiceQuantity',
hideInDescriptions: hiddenNumFlag,
},
{
title: '风险辨识次数',
key: 'riskServiceQuantity',
dataIndex: 'riskServiceQuantity',
hideInDescriptions: hiddenNumFlag,
},
{
title: '服务地址',
key: 'serviceAddress',
dataIndex: 'serviceAddress',
},
{
title: '最近服务时间',
key: 'latelyDate',
dataIndex: 'latelyDate',
renderText: dateFormatter,
},
{
title: '备注',
key: 'remark',
dataIndex: 'remark',
},
{
title: '服务模式',
key: 'form',
dataIndex: 'form',
valueEnum: {
1: '线上',
2: '线下',
},
},
], [data]);
return (_jsxs("div", Object.assign({ className: "page-content-detail-tabs" }, { children: [_jsx(CardDetail, Object.assign({ title: "\u57FA\u672C\u4FE1\u606F", loading: loading }, { children: _jsx(DescriptionsDetail, Object.assign({ dataSource: data, layout: "horizontal", column: 2, columns: desColum }, { children: _jsx(ProDescriptions.Item, Object.assign({ label: "\u9644\u4EF6" }, { children: _jsx(PreviewFile, { disabled: true, listType: "picture-card", fileList: formatImageUrl(data === null || data === void 0 ? void 0 : data.attachmentPath) }) })) })) })), _jsx(Divider, { className: "self-pro-divider" }), _jsx(CardDetail, Object.assign({ title: "\u88AB\u670D\u52A1\u5BF9\u8C61", loading: loading }, { children: (data === null || data === void 0 ? void 0 : data.serviceApplyId) && (_jsx(ProTable, { params: {
serviceApplyId: data === null || data === void 0 ? void 0 : data.serviceApplyId,
}, tableClassName: "tableClassName", request: getServiceApply, columns: serviceColum, search: false, toolBarRender: false, pagination: {
defaultPageSize: 5,
} })) })), _jsx(Divider, { className: "self-pro-divider" }), _jsx(CardDetail, Object.assign({ title: "\u5386\u53F2\u670D\u52A1\u60C5\u51B5" }, { children: (data === null || data === void 0 ? void 0 : data.policyNumber) && (_jsx(ProTable, { params: {
policyNumber: data === null || data === void 0 ? void 0 : data.policyNumber,
}, request: getServiceCondition, tableClassName: "tableClassName", columns: columns, search: false, toolBarRender: false, pagination: {
defaultPageSize: 5,
} })) })), (params === null || params === void 0 ? void 0 : params.review) && (_jsxs(FooterToolbar, { children: [review.map((item) => {
if (getStorage('isSup') != 1 && item.status == '4') {
return;
}
if ((data === null || data === void 0 ? void 0 : data.visibleReturnedBtn) != 2 && item.status == '5')
return;
return (_jsx(ModalForm, Object.assign({ title: "\u5BA1\u6838\u610F\u89C1", layout: "horizontal", labelCol: { span: 4 }, wrapperCol: { span: 16 }, submitTimeout: 2000, onFinish: (values) => onFinish(values, item.status), trigger: item.danger ? (_jsx(Button, Object.assign({ danger: true }, { children: item.title }))) : (_jsx(Button, Object.assign({ type: "primary" }, { children: item.title }))) }, { children: _jsx(ProFormTextArea, { name: "auditOpinion", fieldProps: {
maxLength: 500,
showCount: true,
}, label: "\u5BA1\u6838\u610F\u89C1", rules: [{ required: true, message: '请输入审核意见' }], placeholder: "\u8BF7\u8F93\u5165\u5BA1\u6838\u610F\u89C1" }) })));
}), _jsx(Button, Object.assign({ danger: true, onClick: () => historyBack('/app/preventiveServices/serviceApply/serviceApplyAudit') }, { children: "\u9000\u51FA" }))] }))] })));
}