fix 修复问题
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import React, { Component } from 'react'
|
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'
|
import { cloneDeep, isEqual } from 'lodash'
|
||||||
|
|
||||||
export default class ModalForm extends Component {
|
export default class ModalForm extends Component {
|
||||||
@@ -74,7 +74,7 @@ export default class ModalForm extends Component {
|
|||||||
|
|
||||||
await body.fillData(this.data)
|
await body.fillData(this.data)
|
||||||
// 保存此时的form内容为快照
|
// 保存此时的form内容为快照
|
||||||
if (this.compareOnClose) {
|
if (this.compareOnClose && body.form && body.form.current) {
|
||||||
this.snapshot = cloneDeep(body.form.current.getFieldsValue())
|
this.snapshot = cloneDeep(body.form.current.getFieldsValue())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -91,7 +91,7 @@ export default class ModalForm extends Component {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.compareOnClose) {
|
if (this.compareOnClose && body.form && body.form.current) {
|
||||||
const formData = body.form.current.getFieldsValue()
|
const formData = body.form.current.getFieldsValue()
|
||||||
if (!isEqual(this.snapshot, formData)) {
|
if (!isEqual(this.snapshot, formData)) {
|
||||||
Modal.confirm({
|
Modal.confirm({
|
||||||
@@ -146,7 +146,7 @@ export default class ModalForm extends Component {
|
|||||||
|
|
||||||
on = {
|
on = {
|
||||||
...on,
|
...on,
|
||||||
onCancel: () => this.onClose(this.compareOnClose)
|
onCancel: () => this.onClose()
|
||||||
}
|
}
|
||||||
|
|
||||||
return <Modal className="yo-modal-form" {...props} {...on}>
|
return <Modal className="yo-modal-form" {...props} {...on}>
|
||||||
@@ -163,7 +163,20 @@ export default class ModalForm extends Component {
|
|||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
renderDrawer(props, on, childWithProps) {
|
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() {
|
render() {
|
||||||
|
|||||||
@@ -7,7 +7,9 @@ export default class QueryTableActions extends Component {
|
|||||||
const { children } = this.props
|
const { children } = this.props
|
||||||
const actions = []
|
const actions = []
|
||||||
|
|
||||||
Array.isArray(children) ? children.forEach((action, i) => {
|
Array.isArray(children) ? children
|
||||||
|
.filter(action => action)
|
||||||
|
.forEach((action, i) => {
|
||||||
actions.push(action)
|
actions.push(action)
|
||||||
if (i < this.props.children.length - 1) {
|
if (i < this.props.children.length - 1) {
|
||||||
actions.push(<Divider type="vertical" key={i} />)
|
actions.push(<Divider type="vertical" key={i} />)
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ export default class QueryTable extends Component {
|
|||||||
async onLoadData() {
|
async onLoadData() {
|
||||||
this.onLoading()
|
this.onLoading()
|
||||||
|
|
||||||
const res = await this.props.loadData({
|
const res = await this.loadData({
|
||||||
pageIndex: this.pagination.current,
|
pageIndex: this.pagination.current,
|
||||||
pageSize: this.pagination.pageSize,
|
pageSize: this.pagination.pageSize,
|
||||||
...this.sorter
|
...this.sorter
|
||||||
@@ -241,7 +241,7 @@ export default class QueryTable extends Component {
|
|||||||
</Button.Group>
|
</Button.Group>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Table className="yo-table" {...props} {...on} />
|
<Table className="yo-table" {...props} {...on} sticky />
|
||||||
</section>
|
</section>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user