Subform modal 弹出效果优化 & 解决按钮多了个 } 的问题

This commit is contained in:
liaoxuezhi 2019-10-22 17:12:10 +08:00
parent 0c00d876d2
commit 38f170f164

View File

@ -179,15 +179,17 @@ export default class SubFormControl extends React.PureComponent<SubFormProps, Su
data-tooltip="编辑详情" data-tooltip="编辑详情"
data-position="bottom" data-position="bottom"
> >
{(value && labelField && value[labelField] && stripTag(value[labelField])) {(value && labelField && value[labelField] && stripTag(value[labelField])) ||
|| render('label', render(
'label',
{ {
type: 'tpl', type: 'tpl',
tpl: btnLabel tpl: btnLabel
}, },
{ {
data data
})} }
)}
</span> </span>
</div> </div>
)) ))
@ -225,8 +227,9 @@ export default class SubFormControl extends React.PureComponent<SubFormProps, Su
data-position="bottom" data-position="bottom"
> >
<span className={`${ns}SubForm-valueLabel`}> <span className={`${ns}SubForm-valueLabel`}>
{(value && labelField && value[labelField] && stripTag(value[labelField])) {(value && labelField && value[labelField] && stripTag(value[labelField])) ||
|| render('label', render(
'label',
{ {
type: 'tpl', type: 'tpl',
tpl: btnLabel tpl: btnLabel
@ -234,7 +237,7 @@ export default class SubFormControl extends React.PureComponent<SubFormProps, Su
{ {
data data
} }
)}} )}
</span> </span>
</div> </div>
</div> </div>
@ -248,16 +251,12 @@ export default class SubFormControl extends React.PureComponent<SubFormProps, Su
return ( return (
<div className={cx(`${ns}SubFormControl`, className)}> <div className={cx(`${ns}SubFormControl`, className)}>
{multiple ? this.renderMultipe() : this.renderSingle()} {multiple ? this.renderMultipe() : this.renderSingle()}
{openedIndex !== -1 {render(`dalog/${openedIndex}`, this.buildDialogSchema(), {
? render(`dalog/${openedIndex}`, this.buildDialogSchema(), { show: openedIndex !== -1,
onClose: this.close, onClose: this.close,
onConfirm: this.handleDialogConfirm, onConfirm: this.handleDialogConfirm,
data: createObject( data: createObject(data, (multiple ? Array.isArray(value) && value[openedIndex] : value) || {})
data, })}
(multiple ? Array.isArray(value) && value[openedIndex] : value) || {}
)
})
: null}
</div> </div>
); );
} }