diff --git a/web-react/src/components/modal-form/index.jsx b/web-react/src/components/modal-form/index.jsx index defda6c..3e1a5e5 100644 --- a/web-react/src/components/modal-form/index.jsx +++ b/web-react/src/components/modal-form/index.jsx @@ -1,5 +1,5 @@ import React, { Component } from 'react' -import { message as Message, Modal } from 'antd' +import { Button, Drawer, message as Message, Modal } from 'antd' import { cloneDeep, isEqual } from 'lodash' export default class ModalForm extends Component { @@ -74,7 +74,7 @@ export default class ModalForm extends Component { await body.fillData(this.data) // 保存此时的form内容为快照 - if (this.compareOnClose) { + if (this.compareOnClose && body.form && body.form.current) { this.snapshot = cloneDeep(body.form.current.getFieldsValue()) } } @@ -91,7 +91,7 @@ export default class ModalForm extends Component { return } - if (this.compareOnClose) { + if (this.compareOnClose && body.form && body.form.current) { const formData = body.form.current.getFieldsValue() if (!isEqual(this.snapshot, formData)) { Modal.confirm({ @@ -146,7 +146,7 @@ export default class ModalForm extends Component { on = { ...on, - onCancel: () => this.onClose(this.compareOnClose) + onCancel: () => this.onClose() } return @@ -163,7 +163,20 @@ export default class ModalForm extends Component { * @returns */ renderDrawer(props, on, childWithProps) { - return
+ on = { + ...on, + onClose: () => this.onClose() + } + + return +
+ {childWithProps} +
+
+ + +
+
} render() { diff --git a/web-react/src/components/query-table-actions/index.jsx b/web-react/src/components/query-table-actions/index.jsx index 6d562a4..a539d77 100644 --- a/web-react/src/components/query-table-actions/index.jsx +++ b/web-react/src/components/query-table-actions/index.jsx @@ -7,12 +7,14 @@ export default class QueryTableActions extends Component { const { children } = this.props const actions = [] - Array.isArray(children) ? children.forEach((action, i) => { - actions.push(action) - if (i < this.props.children.length - 1) { - actions.push() - } - }) : (actions.push(children)) + Array.isArray(children) ? children + .filter(action => action) + .forEach((action, i) => { + actions.push(action) + if (i < this.props.children.length - 1) { + actions.push() + } + }) : (actions.push(children)) return actions } diff --git a/web-react/src/components/query-table/index.jsx b/web-react/src/components/query-table/index.jsx index 83f3fa6..9d0ecf9 100644 --- a/web-react/src/components/query-table/index.jsx +++ b/web-react/src/components/query-table/index.jsx @@ -86,7 +86,7 @@ export default class QueryTable extends Component { async onLoadData() { this.onLoading() - const res = await this.props.loadData({ + const res = await this.loadData({ pageIndex: this.pagination.current, pageSize: this.pagination.pageSize, ...this.sorter @@ -241,7 +241,7 @@ export default class QueryTable extends Component { - +
) }