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.
180 lines
16 KiB
180 lines
16 KiB
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { |
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } |
|
return new (P || (P = Promise))(function (resolve, reject) { |
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } |
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } |
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } |
|
step((generator = generator.apply(thisArg, _arguments || [])).next()); |
|
}); |
|
}; |
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; |
|
import { ModalForm, ProDescriptions, ProFormTextArea, ProTable, FooterToolbar, } from '@ant-design/pro-components'; |
|
import { useRequest } from 'ahooks'; |
|
import { Button, message, Modal, Upload, Divider } from 'antd'; |
|
import React, { useMemo } from 'react'; |
|
import { formatImageUrl, useRoutes, getStorage, dateFormatter, themeMessage, } from '@component/utils'; |
|
import { getRiskInfo, onAuditRiskApply } from './action'; |
|
import { auditStatusList, riskGradeStatus } from './constans'; |
|
import { CardDetail } from '@component/ui'; |
|
import { PreviewFile } from '@component/ui'; |
|
import { DescriptionsDetail } from '@component/ui'; |
|
import themeColor from 'theme.less'; |
|
import { isEmpty, omitBy, pick } from 'lodash'; |
|
export default function ({ params, serviceUrl, policyUrl, client }) { |
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4; |
|
const { historyBack, paramsParse, historyPush } = useRoutes(); |
|
function trackStatusEnum(data) { |
|
switch (data) { |
|
case -1: |
|
return '未跟踪'; |
|
case 1: |
|
return '继续跟踪'; |
|
case 2: |
|
return '结束跟踪'; |
|
default: |
|
return null; |
|
} |
|
} |
|
const { data = {} } = useRequest(getRiskInfo, { |
|
defaultParams: { |
|
id: paramsParse.riskId, |
|
}, |
|
}); |
|
const review = [ |
|
{ |
|
status: '5', |
|
title: '退回至下一级', |
|
danger: true, |
|
hidden: client === 'expert', |
|
}, |
|
{ status: '4', title: '驳回修改', danger: true }, |
|
{ status: '2', title: '提交上级审核' }, |
|
{ status: '3', title: '审核通过' }, |
|
]; |
|
const { loading, runAsync } = useRequest(onAuditRiskApply, { |
|
manual: true, |
|
onSuccess(result) { |
|
themeMessage(result, historyBack); |
|
}, |
|
onError(result) { |
|
message.error(result.message); |
|
}, |
|
}); |
|
function onFinish(values, status) { |
|
return __awaiter(this, void 0, void 0, function* () { |
|
values.riskId = params.riskId; |
|
values.auditStatus = status; |
|
values.serviceId = data === null || data === void 0 ? void 0 : data.risk.serviceId; |
|
yield runAsync(Object.assign({}, values)); |
|
}); |
|
} |
|
function onReview(title, auditStatus) { |
|
Modal.confirm({ |
|
content: title, |
|
okButtonProps: { |
|
loading: loading, |
|
}, |
|
cancelButtonProps: { |
|
loading: loading, |
|
}, |
|
onOk() { |
|
runAsync({ |
|
riskId: data === null || data === void 0 ? void 0 : data.risk.riskId, |
|
auditStatus, |
|
serviceId: data === null || data === void 0 ? void 0 : data.risk.serviceId, |
|
}); |
|
}, |
|
}); |
|
} |
|
const columns = useMemo(() => [ |
|
{ |
|
title: '事故类型', |
|
dataIndex: 'accidentTypeName', |
|
ellipsis: true, |
|
width: 150, |
|
}, |
|
{ |
|
title: '后果严重度', |
|
dataIndex: 'severity', |
|
valueEnum: { |
|
1: '导致很多人死亡', |
|
2: '一人死亡,或多人重伤', |
|
3: '一人重伤,或多人轻伤', |
|
4: '一人轻伤,或较大经济损失', |
|
5: '无人受伤,有一般经济损失', |
|
}, |
|
ellipsis: true, |
|
}, |
|
{ |
|
title: '事故发生率', |
|
dataIndex: 'frequency', |
|
valueEnum: { |
|
1: '基本不可能', |
|
2: '不太可能', |
|
3: '有可能', |
|
4: '非必然可能', |
|
5: '必然发生', |
|
}, |
|
ellipsis: true, |
|
}, |
|
{ |
|
title: '日常防范措施', |
|
dataIndex: 'conventionMeasures', |
|
width: 300, |
|
ellipsis: true, |
|
}, |
|
{ |
|
title: '应急措施', |
|
dataIndex: 'emergencyMeasures', |
|
width: 300, |
|
ellipsis: true, |
|
}, |
|
{ |
|
title: '评估等级', |
|
dataIndex: 'riskGrade', |
|
render: (_, record) => riskGradeStatus.map((item, index) => { |
|
if (item.val == record.riskGrade) { |
|
return (_jsx("span", Object.assign({ style: { color: item.color } }, { children: item.text }), index)); |
|
} |
|
return null; |
|
}), |
|
width: 100, |
|
}, |
|
], []); |
|
return (_jsxs("div", Object.assign({ className: "page-content-detail-tabs" }, { children: [_jsx(CardDetail, Object.assign({ title: "\u670D\u52A1\u4FE1\u606F" }, { children: _jsxs(DescriptionsDetail, Object.assign({ column: 2, layout: "horizontal" }, { children: [_jsx(ProDescriptions.Item, Object.assign({ label: "\u670D\u52A1\u540D\u79F0" }, { children: _jsx("a", Object.assign({ onClick: () => { |
|
var _a; |
|
historyPush(serviceUrl, { |
|
serviceId: (_a = data === null || data === void 0 ? void 0 : data.service) === null || _a === void 0 ? void 0 : _a.serviceId, |
|
}); |
|
} }, { children: (_a = data === null || data === void 0 ? void 0 : data.service) === null || _a === void 0 ? void 0 : _a.serviceName })) })), client === 'expert' ? null : (_jsx(ProDescriptions.Item, Object.assign({ label: "\u4FDD\u5355\u53F7" }, { children: policyUrl ? (_jsx("a", Object.assign({ onClick: () => { |
|
var _a; |
|
historyPush(policyUrl, { |
|
policyNumber: (_a = data === null || data === void 0 ? void 0 : data.service) === null || _a === void 0 ? void 0 : _a.policyNumber, |
|
}); |
|
} }, { children: (_b = data === null || data === void 0 ? void 0 : data.service) === null || _b === void 0 ? void 0 : _b.policyNumber }))) : null }))), _jsx(ProDescriptions.Item, Object.assign({ label: "\u6807\u51C6\u5206\u7C7B" }, { children: (_c = data === null || data === void 0 ? void 0 : data.service) === null || _c === void 0 ? void 0 : _c.aqServiceName })), _jsx(ProDescriptions.Item, Object.assign({ label: "\u670D\u52A1\u673A\u6784" }, { children: (_d = data === null || data === void 0 ? void 0 : data.service) === null || _d === void 0 ? void 0 : _d.executedOrganName })), _jsx(ProDescriptions.Item, Object.assign({ label: "\u9879\u76EE\u5F00\u59CB\u65F6\u95F4" }, { children: dateFormatter((_e = data === null || data === void 0 ? void 0 : data.service) === null || _e === void 0 ? void 0 : _e.serviceStartAt) })), _jsx(ProDescriptions.Item, Object.assign({ label: "\u670D\u52A1\u5730\u5740" }, { children: (_f = data === null || data === void 0 ? void 0 : data.service) === null || _f === void 0 ? void 0 : _f.address })), _jsx(ProDescriptions.Item, Object.assign({ label: "\u9879\u76EE\u7ED3\u675F\u65F6\u95F4" }, { children: dateFormatter((_g = data === null || data === void 0 ? void 0 : data.service) === null || _g === void 0 ? void 0 : _g.serviceCompleteAt) }))] })) })), _jsx(Divider, { className: "self-pro-divider" }), _jsx(CardDetail, Object.assign({ title: "\u98CE\u9669\u4FE1\u606F" }, { children: _jsxs(DescriptionsDetail, Object.assign({ column: 2, layout: "horizontal" }, { children: [_jsx(ProDescriptions.Item, Object.assign({ label: "\u98CE\u9669\u540D\u79F0" }, { children: (_h = data === null || data === void 0 ? void 0 : data.risk) === null || _h === void 0 ? void 0 : _h.riskName })), _jsx(ProDescriptions.Item, Object.assign({ label: "\u98CE\u9669\u7F16\u53F7" }, { children: (_j = data === null || data === void 0 ? void 0 : data.risk) === null || _j === void 0 ? void 0 : _j.riskNumber })), _jsx(ProDescriptions.Item, Object.assign({ label: "\u670D\u52A1\u4EBA\u5458" }, { children: (_k = data === null || data === void 0 ? void 0 : data.service) === null || _k === void 0 ? void 0 : _k.userName })), _jsx(ProDescriptions.Item, Object.assign({ label: "\u98CE\u9669\u63CF\u8FF0" }, { children: (_l = data === null || data === void 0 ? void 0 : data.risk) === null || _l === void 0 ? void 0 : _l.riskContent })), _jsx("br", {}), _jsx(ProDescriptions.Item, Object.assign({ label: "\u573A\u6240/\u90E8\u4F4D" }, { children: (_m = data === null || data === void 0 ? void 0 : data.risk) === null || _m === void 0 ? void 0 : _m.discoveredAddress })), _jsx("br", {}), _jsx(ProDescriptions.Item, Object.assign({ label: "\u53D1\u73B0\u65F6\u95F4", span: 2 }, { children: dateFormatter((_o = data === null || data === void 0 ? void 0 : data.risk) === null || _o === void 0 ? void 0 : _o.discoveredAt) })), _jsx(ProDescriptions.Item, Object.assign({ label: "\u73B0\u573A\u7167\u7247", span: 2 }, { children: _jsx(PreviewFile, { disabled: true, listType: "picture-card", fileList: formatImageUrl((_p = data === null || data === void 0 ? void 0 : data.risk) === null || _p === void 0 ? void 0 : _p.attachmentIds) }) }))] })) })), _jsx(Divider, { className: "self-pro-divider" }), _jsx(CardDetail, Object.assign({ title: "\u6D89\u53CA\u4E8B\u6545\u7C7B\u578B" }, { children: _jsx(DescriptionsDetail, Object.assign({ layout: "horizontal" }, { children: _jsx(ProDescriptions.Item, { children: _jsx(ProTable, { toolBarRender: false, search: false, columns: columns, dataSource: (_q = data === null || data === void 0 ? void 0 : data.risk) === null || _q === void 0 ? void 0 : _q.list, pagination: false, rowKey: "riskAccidentRelationId" }) }) })) })), _jsx(Divider, { className: "self-pro-divider" }), !isEmpty(omitBy(pick(data === null || data === void 0 ? void 0 : data.risk, [ |
|
'commitUserName', |
|
'commitOrganName', |
|
'controls', |
|
'controlAt', |
|
'controlPhoto', |
|
]), isEmpty)) && (_jsx(CardDetail, Object.assign({ title: "\u7BA1\u63A7\u4FE1\u606F" }, { children: _jsxs(DescriptionsDetail, Object.assign({ column: 1, layout: "horizontal" }, { children: [_jsx(ProDescriptions.Item, Object.assign({ label: "\u63D0\u4EA4\u4EBA" }, { children: (_r = data === null || data === void 0 ? void 0 : data.risk) === null || _r === void 0 ? void 0 : _r.commitUserName })), _jsx(ProDescriptions.Item, Object.assign({ label: "\u63D0\u4EA4\u4EBA\u6240\u5728\u673A\u6784" }, { children: (_s = data === null || data === void 0 ? void 0 : data.risk) === null || _s === void 0 ? void 0 : _s.commitOrganName })), _jsx(ProDescriptions.Item, Object.assign({ label: "\u7BA1\u63A7\u63AA\u65BD" }, { children: (_t = data === null || data === void 0 ? void 0 : data.risk) === null || _t === void 0 ? void 0 : _t.controls })), _jsx(ProDescriptions.Item, Object.assign({ label: "\u7BA1\u63A7\u65F6\u95F4" }, { children: dateFormatter((_u = data === null || data === void 0 ? void 0 : data.risk) === null || _u === void 0 ? void 0 : _u.controlAt) })), _jsx(ProDescriptions.Item, Object.assign({ label: "\u7BA1\u63A7\u7167\u7247" }, { children: _jsx(PreviewFile, { disabled: true, listType: "picture-card", fileList: formatImageUrl((_v = data === null || data === void 0 ? void 0 : data.risk) === null || _v === void 0 ? void 0 : _v.controlPhoto) }) })), _jsx(ProDescriptions.Item, Object.assign({ label: "\u5BA1\u6838\u7ED3\u8BBA" }, { children: auditStatusList.map((item, index) => { |
|
var _a; |
|
if (item.val == ((_a = data === null || data === void 0 ? void 0 : data.risk) === null || _a === void 0 ? void 0 : _a.auditStatus)) { |
|
return (_jsx("span", Object.assign({ style: { color: item.color || themeColor.blackStatus } }, { children: item.text }), index)); |
|
} |
|
return null; |
|
}) }))] })) }))), _jsx(Divider, { className: "self-pro-divider" }), ((_w = data === null || data === void 0 ? void 0 : data.risk) === null || _w === void 0 ? void 0 : _w.trackStatus) != -1 && (_jsx(CardDetail, Object.assign({ title: "\u8DDF\u8E2A\u60C5\u51B5" }, { children: _jsxs(DescriptionsDetail, Object.assign({ column: 2, layout: "horizontal" }, { children: [_jsx(ProDescriptions.Item, Object.assign({ label: "\u8DDF\u8E2A\u4EBA" }, { children: (_x = data === null || data === void 0 ? void 0 : data.risk) === null || _x === void 0 ? void 0 : _x.trackUserName })), _jsx(ProDescriptions.Item, Object.assign({ label: "\u8DDF\u8E2A\u4EBA\u6240\u5728\u673A\u6784" }, { children: (_y = data === null || data === void 0 ? void 0 : data.risk) === null || _y === void 0 ? void 0 : _y.trackOrganName })), _jsx(ProDescriptions.Item, Object.assign({ label: "\u8DDF\u8E2A\u72B6\u6001" }, { children: trackStatusEnum((_z = data === null || data === void 0 ? void 0 : data.risk) === null || _z === void 0 ? void 0 : _z.trackStatus) })), ((_0 = data === null || data === void 0 ? void 0 : data.risk) === null || _0 === void 0 ? void 0 : _0.trackStatus) !== 2 ? (_jsx(ProDescriptions.Item, Object.assign({ label: "\u9884\u8BA1\u4E0B\u6B21\u8DDF\u8E2A\u65F6\u95F4" }, { children: dateFormatter((_1 = data === null || data === void 0 ? void 0 : data.risk) === null || _1 === void 0 ? void 0 : _1.estimateNextTrackAt) }))) : null, _jsx(ProDescriptions.Item, Object.assign({ label: "\u8DDF\u8E2A\u65F6\u95F4" }, { children: dateFormatter((_2 = data === null || data === void 0 ? void 0 : data.risk) === null || _2 === void 0 ? void 0 : _2.trackAt) })), _jsx(ProDescriptions.Item, Object.assign({ label: "\u8DDF\u8E2A\u60C5\u51B5" }, { children: (_3 = data === null || data === void 0 ? void 0 : data.risk) === null || _3 === void 0 ? void 0 : _3.trackSituation })), _jsx(ProDescriptions.Item, Object.assign({ label: "\u8DDF\u8E2A\u7167\u7247" }, { children: _jsx(PreviewFile, { disabled: true, listType: "picture-card", fileList: formatImageUrl((_4 = data === null || data === void 0 ? void 0 : data.risk) === null || _4 === void 0 ? void 0 : _4.trackAttachments) }) }))] })) }))), (params === null || params === void 0 ? void 0 : params.review) && (_jsx(FooterToolbar, { children: review.map((item) => { |
|
var _a; |
|
if (getStorage('isSup') != 1 && item.status == '2') { |
|
return; |
|
} |
|
if (item === null || item === void 0 ? void 0 : item.hidden) |
|
return; |
|
if (((_a = data === null || data === void 0 ? void 0 : data.service) === null || _a === void 0 ? void 0 : _a.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 === null || item === void 0 ? void 0 : 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" }) }))); |
|
}) }))] }))); |
|
}
|
|
|