Files
fe_service_ebtp_frontend/src/utils/RiskPreventionSoft/index.tsx
2022-07-29 10:28:53 +08:00

100 lines
3.1 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import React from 'react';
import { Modal, Tag } from 'antd';
import { ExclamationCircleOutlined } from '@ant-design/icons';
import type { ProColumns } from '@ant-design/pro-table';
import ProTable from '@ant-design/pro-table';
import './riskStyle.less'
interface RiskPreventionSoftProps {
modalVisible: boolean;
onCancel: () => void;
onSubmit: () => void;
data: Array<any>;
}
const modalHeight = window.innerHeight * 96 / 100;
/**
* 风险防控通用(软控)
* @param props
* @returns
*/
const RiskPreventionSoft: React.FC<RiskPreventionSoftProps> = (props) => {
const { modalVisible, onCancel, onSubmit, data } = props;
const columns: ProColumns<any[]>[] = [
{
dataIndex: 'regulationStrategy',
title: '规则响应策略',
width: '13%',
valueEnum: {
hard: { text: '强控', status: 'Error' },
soft: { text: '软控', status: 'Warning' },
alarm: { text: '预警', status: 'Processing' }
},
},
{
dataIndex: 'regulationName',
title: '规则模型名称',
width: '13%',
},
{
dataIndex: 'regulationRank',
title: '风险响应等级',
width: '13%',
valueEnum: {
first: { text: '风险一级' },
second: { text: '风险二级' },
third: { text: '风险三级' }
},
},
{
dataIndex: 'message',
title: '规则相应内容',
},
];
return (
<Modal
destroyOnClose
title="风控中心校验结果"
visible={modalVisible}
width={'60%'}
style={{ maxHeight: modalHeight }}
bodyStyle={{ maxHeight: modalHeight - 107, overflowY: 'auto', padding: '8px 24px 16px' }}
centered
onCancel={() => onCancel()}
onOk={() => {
onSubmit();
onCancel();
}}
>
<div>
<Tag icon={<ExclamationCircleOutlined />} color="warning" className="risk-top-tag">
</Tag>
{data.map(ite => ite?.result.map((item: any) => (
<div>
<div className="risk-table-title">
<span className="table-scene-name"><span>{item.sceneName}</span></span>
<span>{item.publishDepartName}</span>
</div>
<ProTable<any>
columns={columns}
dataSource={item.regulationData}
rowKey="regulationId"
size='small'
pagination={false}
toolBarRender={false}
search={false}
/>
</div>
)
))}
</div>
</Modal>
);
};
export default RiskPreventionSoft;