diff --git a/web-react/src/components/modal-form/index.jsx b/web-react/src/components/modal-form/index.jsx
index 5b86f51..ff78981 100644
--- a/web-react/src/components/modal-form/index.jsx
+++ b/web-react/src/components/modal-form/index.jsx
@@ -15,8 +15,23 @@ function renderModal(props, on, childWithProps) {
onCancel: () => this.onClose(),
}
+ const { buttons } = this.props
+
+ const _buttons = [
+ ,
+ ,
+ ]
+
+ if (Array.isArray(buttons)) {
+ for (const { index, button } of buttons) {
+ _buttons.splice(index, 0, button(this.getData, this.close))
+ }
+ }
+
return (
-
+
{childWithProps}
)
@@ -112,6 +127,13 @@ export default class ModalForm extends Component {
this.setState({ visible: false })
}
+ getData = async () => {
+ const body = this.childNode.current
+ if (!body || !body.getData) throw Error('为获取到子表单')
+
+ return await body.getData()
+ }
+
/**
* 子元素创建后回调
* 对子元素数据进行填充,(如需关闭时对比)之后再获取结构调整后的数据快照