update 更多查询条件
This commit is contained in:
46
web-react/src/components/form/input-number-range/index.jsx
Normal file
46
web-react/src/components/form/input-number-range/index.jsx
Normal file
@@ -0,0 +1,46 @@
|
||||
import React, { Component } from 'react'
|
||||
import { Col, Input, InputNumber, Row } from 'antd'
|
||||
import { AntIcon } from 'components'
|
||||
|
||||
export default class index extends Component {
|
||||
render() {
|
||||
const { unit, placeholder, value, onChange } = this.props
|
||||
|
||||
console.log(value)
|
||||
|
||||
return (
|
||||
<Input.Group>
|
||||
<Row align="middle">
|
||||
<Col flex="1">
|
||||
<InputNumber
|
||||
{...this.props}
|
||||
className="w-100-p"
|
||||
placeholder={placeholder && placeholder[0]}
|
||||
value={value && value[0]}
|
||||
onChange={e => {
|
||||
const result = [e, value && value[1]]
|
||||
onChange && onChange(result)
|
||||
}}
|
||||
/>
|
||||
</Col>
|
||||
<span className="yo-addon">
|
||||
<AntIcon className="text-gray" type="swap-right" />
|
||||
</span>
|
||||
<Col flex="1">
|
||||
<InputNumber
|
||||
{...this.props}
|
||||
className="w-100-p"
|
||||
placeholder={placeholder && placeholder[1]}
|
||||
value={value && value[1]}
|
||||
onChange={e => {
|
||||
const result = [value && value[0], e]
|
||||
onChange && onChange(result)
|
||||
}}
|
||||
/>
|
||||
</Col>
|
||||
{unit && <span className="yo-addon">{unit}</span>}
|
||||
</Row>
|
||||
</Input.Group>
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,13 @@
|
||||
export { default as AntIcon } from 'components/ant-icon'
|
||||
export { default as AuthorityView } from './authority-view'
|
||||
export { default as Auth } from './authorized'
|
||||
export { default as ColorSelector } from './color-selector'
|
||||
export { default as ColorSelector } from './form/color-selector'
|
||||
export { default as ComponentDynamic } from './component-dynamic'
|
||||
export { default as Container } from './container'
|
||||
export { default as IconSelector } from './icon-selector'
|
||||
export { default as Image } from './image'
|
||||
export { default as ModalForm } from './modal-form'
|
||||
export { default as InputNumberRange } from './form/input-number-range'
|
||||
export { default as PhotoPreview } from './photo-preview'
|
||||
export { default as QueryList } from './query-list'
|
||||
export { default as QueryTable } from './query-table'
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import React, { Component } from 'react'
|
||||
import { Button, Form, List, Pagination, Spin, Tooltip } from 'antd'
|
||||
import { AntIcon } from 'components'
|
||||
import { cloneDeep } from 'lodash'
|
||||
|
||||
const propsMap = ['autoLoad', 'loadData', 'pageIndex', 'pageSize']
|
||||
|
||||
@@ -113,7 +114,7 @@ export default class QueryList extends Component {
|
||||
pageIndex: this.pagination.current,
|
||||
pageSize: this.pagination.pageSize,
|
||||
},
|
||||
this.query
|
||||
cloneDeep(this.query)
|
||||
)
|
||||
|
||||
this.setState(
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React, { Component } from 'react'
|
||||
import { Form, Button, Table, Tooltip, Drawer } from 'antd'
|
||||
import { AntIcon } from 'components'
|
||||
import { isEqual } from 'lodash'
|
||||
import { cloneDeep, isEqual } from 'lodash'
|
||||
|
||||
const propsMap = ['columns', 'autoLoad', 'loadData', 'pageIndex', 'pageSize']
|
||||
|
||||
@@ -44,7 +44,8 @@ function renderQueryBar() {
|
||||
onFinish={value => this.onQuery(value)}
|
||||
initialValues={queryInitialValues}
|
||||
onValuesChange={(changedValues, allValues) =>
|
||||
onQueryChange && onQueryChange(changedValues, allValues)
|
||||
onQueryChange &&
|
||||
this.queryForm.current.setFieldsValue(onQueryChange(changedValues, allValues))
|
||||
}
|
||||
>
|
||||
{query}
|
||||
@@ -74,17 +75,28 @@ function renderQueryBar() {
|
||||
function renderMoreQueryBody() {
|
||||
const { moreQueryVisible } = this.state
|
||||
|
||||
const { moreQuery } = this.props
|
||||
const { moreQuery, onQueryChange, queryInitialValues } = this.props
|
||||
|
||||
return (
|
||||
<Drawer
|
||||
width="33%"
|
||||
width={700}
|
||||
title="查询"
|
||||
className="yo-drawer-form"
|
||||
visible={moreQueryVisible}
|
||||
forceRender
|
||||
onClose={() => this.setState({ moreQueryVisible: false })}
|
||||
>
|
||||
<Form ref={this.moreQueryForm}>
|
||||
<Form
|
||||
layout="vertical"
|
||||
ref={this.moreQueryForm}
|
||||
initialValues={queryInitialValues}
|
||||
onValuesChange={(changedValues, allValues) =>
|
||||
onQueryChange &&
|
||||
this.moreQueryForm.current.setFieldsValue(
|
||||
onQueryChange(changedValues, allValues)
|
||||
)
|
||||
}
|
||||
>
|
||||
<div className="yo-drawer-form--body">{moreQuery}</div>
|
||||
<div className="ant-drawer-footer">
|
||||
<Button.Group>
|
||||
@@ -216,7 +228,7 @@ export default class QueryTable extends Component {
|
||||
pageSize: this.pagination.pageSize,
|
||||
...this.sorter,
|
||||
},
|
||||
this.query
|
||||
cloneDeep(this.query)
|
||||
)
|
||||
if (res.rows || res.data || res.items) {
|
||||
this.setState({
|
||||
@@ -291,7 +303,9 @@ export default class QueryTable extends Component {
|
||||
...queryInitialValues,
|
||||
...queryValues,
|
||||
}
|
||||
onQueryChange && onQueryChange(this.query)
|
||||
|
||||
const changedValues = cloneDeep(this.query)
|
||||
onQueryChange && onQueryChange(changedValues, changedValues)
|
||||
this.onReloadData(true)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user