fix 修复问题
This commit is contained in:
@@ -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 <Modal className="yo-modal-form" {...props} {...on}>
|
||||
@@ -163,7 +163,20 @@ export default class ModalForm extends Component {
|
||||
* @returns
|
||||
*/
|
||||
renderDrawer(props, on, childWithProps) {
|
||||
return <div></div>
|
||||
on = {
|
||||
...on,
|
||||
onClose: () => this.onClose()
|
||||
}
|
||||
|
||||
return <Drawer className="yo-drawer-form" {...props} {...on}>
|
||||
<div class="yo-drawer-form--body">
|
||||
{childWithProps}
|
||||
</div>
|
||||
<div className="ant-drawer-footer">
|
||||
<Button onClick={on.onClose}>取消</Button>
|
||||
<Button loading={this.state.confirmLoading} onClick={on.onOk} type="primary">确定</Button>
|
||||
</div>
|
||||
</Drawer>
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
@@ -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(<Divider type="vertical" key={i} />)
|
||||
}
|
||||
}) : (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(<Divider type="vertical" key={i} />)
|
||||
}
|
||||
}) : (actions.push(children))
|
||||
|
||||
return actions
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
</Button.Group>
|
||||
</div>
|
||||
</div>
|
||||
<Table className="yo-table" {...props} {...on} />
|
||||
<Table className="yo-table" {...props} {...on} sticky />
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user