|
|
@ -46,6 +46,7 @@ const { TextArea } = Input;
|
|
|
|
|
|
|
|
|
|
|
|
const subPanelpayloadAttributes = {};
|
|
|
|
const subPanelpayloadAttributes = {};
|
|
|
|
const fieldKeys = [];
|
|
|
|
const fieldKeys = [];
|
|
|
|
|
|
|
|
let subFormContainer = {};
|
|
|
|
|
|
|
|
|
|
|
|
class PolicyInfo extends React.Component {
|
|
|
|
class PolicyInfo extends React.Component {
|
|
|
|
constructor(props) {
|
|
|
|
constructor(props) {
|
|
|
@ -55,6 +56,7 @@ class PolicyInfo extends React.Component {
|
|
|
|
data: {},
|
|
|
|
data: {},
|
|
|
|
policyFeatureList: [],
|
|
|
|
policyFeatureList: [],
|
|
|
|
activePanelKeys: [],
|
|
|
|
activePanelKeys: [],
|
|
|
|
|
|
|
|
activeSubPanelKeys: [],
|
|
|
|
profilePreviewKey: '',
|
|
|
|
profilePreviewKey: '',
|
|
|
|
customInputDataArray: [],
|
|
|
|
customInputDataArray: [],
|
|
|
|
inputTableDataSources: {},
|
|
|
|
inputTableDataSources: {},
|
|
|
@ -65,22 +67,57 @@ class PolicyInfo extends React.Component {
|
|
|
|
setProfileInfo = e => {
|
|
|
|
setProfileInfo = e => {
|
|
|
|
let activePolicies = [];
|
|
|
|
let activePolicies = [];
|
|
|
|
let activePolicyFields = {};
|
|
|
|
let activePolicyFields = {};
|
|
|
|
|
|
|
|
let activeSubPanels = [];
|
|
|
|
const allFields = this.props.form.getFieldsValue();
|
|
|
|
const allFields = this.props.form.getFieldsValue();
|
|
|
|
this.props.policyFeatureList.map(element => {
|
|
|
|
this.props.policyFeatureList.map(element => {
|
|
|
|
activePolicies.push(element.featureCode);
|
|
|
|
activePolicies.push(element.featureCode);
|
|
|
|
let featureData = JSON.parse(element.content);
|
|
|
|
let featureData = JSON.parse(element.content);
|
|
|
|
Object.keys(featureData).map(key => {
|
|
|
|
Object.keys(featureData).map(key => {
|
|
|
|
let regex = new RegExp(`${element.featureCode}.+${key}`, 'g');
|
|
|
|
if (element.featureCode in subPanelpayloadAttributes) {
|
|
|
|
Object.keys(allFields).map(fieldName => {
|
|
|
|
Object.entries(subPanelpayloadAttributes[element.featureCode]).map(
|
|
|
|
if (fieldName.match(regex) != null) {
|
|
|
|
([panelKey, payloadAttr]) => {
|
|
|
|
activePolicyFields[fieldName] = featureData[key];
|
|
|
|
if (key === payloadAttr) {
|
|
|
|
}
|
|
|
|
activeSubPanels.push(`${element.featureCode}-${panelKey}`);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let regex = new RegExp(`${element.featureCode}.+${key}`, 'g');
|
|
|
|
|
|
|
|
Object.keys(allFields).map(fieldName => {
|
|
|
|
|
|
|
|
if (fieldName.match(regex) != null) {
|
|
|
|
|
|
|
|
activePolicyFields[fieldName] = featureData[key];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
} else if (element.featureCode in subFormContainer) {
|
|
|
|
|
|
|
|
let regex = new RegExp(`.+${element.featureCode}-${key}`, 'g');
|
|
|
|
|
|
|
|
Object.keys(allFields).map(fieldName => {
|
|
|
|
|
|
|
|
if (fieldName.match(regex) != null) {
|
|
|
|
|
|
|
|
activePolicyFields[fieldName] = featureData[key];
|
|
|
|
|
|
|
|
if (
|
|
|
|
|
|
|
|
!activePolicies.includes(
|
|
|
|
|
|
|
|
fieldName.replace(`-${element.featureCode}-${key}`, ''),
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
activePolicies.push(
|
|
|
|
|
|
|
|
fieldName.replace(`-${element.featureCode}-${key}`, ''),
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
let regex = new RegExp(`${element.featureCode}.+${key}`, 'g');
|
|
|
|
|
|
|
|
Object.keys(allFields).map(fieldName => {
|
|
|
|
|
|
|
|
if (fieldName.match(regex) != null) {
|
|
|
|
|
|
|
|
activePolicyFields[fieldName] = featureData[key];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
this.props.form.setFieldsValue(activePolicyFields);
|
|
|
|
this.props.form.setFieldsValue(activePolicyFields);
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
activePanelKeys: activePolicies,
|
|
|
|
activePanelKeys: activePolicies,
|
|
|
|
|
|
|
|
activeSubPanelKeys: activeSubPanels,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -235,7 +272,7 @@ class PolicyInfo extends React.Component {
|
|
|
|
{getFieldDecorator(`${columnData.key}${i}`, {
|
|
|
|
{getFieldDecorator(`${columnData.key}${i}`, {
|
|
|
|
initialValue: columnData.others.initialDataIndex,
|
|
|
|
initialValue: columnData.others.initialDataIndex,
|
|
|
|
})(
|
|
|
|
})(
|
|
|
|
<Select>
|
|
|
|
<Select disabled>
|
|
|
|
{columnData.others.option.map((option, i) => {
|
|
|
|
{columnData.others.option.map((option, i) => {
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<Option key={i} value={option.key}>
|
|
|
|
<Option key={i} value={option.key}>
|
|
|
@ -285,6 +322,7 @@ class PolicyInfo extends React.Component {
|
|
|
|
onChange={e =>
|
|
|
|
onChange={e =>
|
|
|
|
this.handleSelectedPanel(e, item.optional.subPanel)
|
|
|
|
this.handleSelectedPanel(e, item.optional.subPanel)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
disabled
|
|
|
|
>
|
|
|
|
>
|
|
|
|
{item.optional.option.map((option, i) => {
|
|
|
|
{item.optional.option.map((option, i) => {
|
|
|
|
return (
|
|
|
|
return (
|
|
|
@ -332,7 +370,7 @@ class PolicyInfo extends React.Component {
|
|
|
|
{getFieldDecorator(`${item.id}`, {
|
|
|
|
{getFieldDecorator(`${item.id}`, {
|
|
|
|
initialValue: `${item.optional.option[0].name}`,
|
|
|
|
initialValue: `${item.optional.option[0].name}`,
|
|
|
|
})(
|
|
|
|
})(
|
|
|
|
<Select>
|
|
|
|
<Select disabled>
|
|
|
|
{item.optional.option.map((option, i) => {
|
|
|
|
{item.optional.option.map((option, i) => {
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<Option key={i} value={option.value}>
|
|
|
|
<Option key={i} value={option.value}>
|
|
|
@ -413,7 +451,7 @@ class PolicyInfo extends React.Component {
|
|
|
|
valuePropName: 'checked',
|
|
|
|
valuePropName: 'checked',
|
|
|
|
initialValue: item.optional.ischecked,
|
|
|
|
initialValue: item.optional.ischecked,
|
|
|
|
})(
|
|
|
|
})(
|
|
|
|
<Checkbox>
|
|
|
|
<Checkbox disabled>
|
|
|
|
<span>
|
|
|
|
<span>
|
|
|
|
{item.label}
|
|
|
|
{item.label}
|
|
|
|
<Tooltip title={item.tooltip} placement="right">
|
|
|
|
<Tooltip title={item.tooltip} placement="right">
|
|
|
@ -459,7 +497,7 @@ class PolicyInfo extends React.Component {
|
|
|
|
valuePropName: 'checked',
|
|
|
|
valuePropName: 'checked',
|
|
|
|
initialValue: item.optional.ischecked,
|
|
|
|
initialValue: item.optional.ischecked,
|
|
|
|
})(
|
|
|
|
})(
|
|
|
|
<Checkbox>
|
|
|
|
<Checkbox disabled>
|
|
|
|
<span>
|
|
|
|
<span>
|
|
|
|
{item.label}
|
|
|
|
{item.label}
|
|
|
|
<Tooltip title={item.tooltip} placement="right">
|
|
|
|
<Tooltip title={item.tooltip} placement="right">
|
|
|
@ -629,12 +667,20 @@ class PolicyInfo extends React.Component {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
onPreview = e => {
|
|
|
|
onPreview = e => {
|
|
|
|
|
|
|
|
this.setProfileInfo();
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
profilePreviewKey: 'profileInfo',
|
|
|
|
profilePreviewKey: 'profileInfo',
|
|
|
|
isInfoPreview: true,
|
|
|
|
isInfoPreview: true,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onCancelPreview = e => {
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
|
|
|
profilePreviewKey: 'profileInfo',
|
|
|
|
|
|
|
|
isInfoPreview: false,
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
render() {
|
|
|
|
const { policyUIConfigurationsList } = this.props;
|
|
|
|
const { policyUIConfigurationsList } = this.props;
|
|
|
|
const { getFieldDecorator } = this.props.form;
|
|
|
|
const { getFieldDecorator } = this.props.form;
|
|
|
@ -645,16 +691,26 @@ class PolicyInfo extends React.Component {
|
|
|
|
<Title level={4}>Profile Information</Title>
|
|
|
|
<Title level={4}>Profile Information</Title>
|
|
|
|
</Col>
|
|
|
|
</Col>
|
|
|
|
<Col span={16}>
|
|
|
|
<Col span={16}>
|
|
|
|
<Button type="link" icon="eye" onClick={this.onPreview}>
|
|
|
|
<Button
|
|
|
|
|
|
|
|
type="link"
|
|
|
|
|
|
|
|
icon="eye"
|
|
|
|
|
|
|
|
onClick={this.onPreview}
|
|
|
|
|
|
|
|
style={{ display: this.state.isInfoPreview ? 'none' : 'inline' }}
|
|
|
|
|
|
|
|
>
|
|
|
|
<Text
|
|
|
|
<Text
|
|
|
|
style={{
|
|
|
|
style={{
|
|
|
|
fontSize: 'small',
|
|
|
|
fontSize: 'small',
|
|
|
|
display: this.state.isInfoPreview ? 'none' : 'inline',
|
|
|
|
|
|
|
|
}}
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
>
|
|
|
|
(Click to view policy information)
|
|
|
|
(Click to view policy information)
|
|
|
|
</Text>
|
|
|
|
</Text>
|
|
|
|
</Button>
|
|
|
|
</Button>
|
|
|
|
|
|
|
|
<Button
|
|
|
|
|
|
|
|
type="link"
|
|
|
|
|
|
|
|
icon="eye-invisible"
|
|
|
|
|
|
|
|
onClick={this.onCancelPreview}
|
|
|
|
|
|
|
|
style={{ display: this.state.isInfoPreview ? 'inline' : 'none' }}
|
|
|
|
|
|
|
|
/>
|
|
|
|
</Col>
|
|
|
|
</Col>
|
|
|
|
</Row>
|
|
|
|
</Row>
|
|
|
|
<Collapse
|
|
|
|
<Collapse
|
|
|
@ -670,11 +726,7 @@ class PolicyInfo extends React.Component {
|
|
|
|
}}
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<div className="tab-container">
|
|
|
|
<div className="tab-container">
|
|
|
|
<Tabs
|
|
|
|
<Tabs tabPosition={'left'} size={'large'}>
|
|
|
|
tabPosition={'left'}
|
|
|
|
|
|
|
|
size={'large'}
|
|
|
|
|
|
|
|
onChange={this.setProfileInfo}
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
{policyUIConfigurationsList.map((element, i) => {
|
|
|
|
{policyUIConfigurationsList.map((element, i) => {
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<TabPane tab={<span>{element.name}</span>} key={i}>
|
|
|
|
<TabPane tab={<span>{element.name}</span>} key={i}>
|
|
|
@ -720,6 +772,8 @@ class PolicyInfo extends React.Component {
|
|
|
|
<div>
|
|
|
|
<div>
|
|
|
|
{Object.values(panel.subFormLists).map(
|
|
|
|
{Object.values(panel.subFormLists).map(
|
|
|
|
(form, i) => {
|
|
|
|
(form, i) => {
|
|
|
|
|
|
|
|
subFormContainer[`${form.id}`] =
|
|
|
|
|
|
|
|
panel.panelId;
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<Form name={form.id} key={i}>
|
|
|
|
<Form name={form.id} key={i}>
|
|
|
|
<Form.Item
|
|
|
|
<Form.Item
|
|
|
|