|
|
@@ -24,11 +24,8 @@ import CurrencyTabItem
|
|
|
from './CurrencyTabItem'
|
|
|
import { saveListState } from '../../../redux/actions/listState'
|
|
|
import { LIST_PAGE_SIZE } from '../../../configs/constans.config'
|
|
|
-import { GlobalEvent } from '../../../utils/common/eventbus/eventbus'
|
|
|
-import { CURRENCY_DETAIL_DATA_REFRESH } from '../../../utils/common/eventbus/events.types'
|
|
|
-import { refreshFormState } from '../../../redux/actions/formState'
|
|
|
-import { FILTER_STATE } from '../../../redux/constants/actionTypes'
|
|
|
import CurrencyDetail from '../currencyDetail/CurrencyDetail'
|
|
|
+import { refreshFormState } from '../../../redux/actions/formState'
|
|
|
|
|
|
class CurrencyList extends Component {
|
|
|
|
|
|
@@ -46,11 +43,8 @@ class CurrencyList extends Component {
|
|
|
}
|
|
|
|
|
|
componentDidMount () {
|
|
|
+ this.props.onRef && this.props.onRef(this)
|
|
|
const hei = this.state.height - ReactDOM.findDOMNode(this.lv).offsetTop
|
|
|
- //将标识设置为FILTER_STATE,保证数据不错乱
|
|
|
- refreshFormState({
|
|
|
- stateType: FILTER_STATE,
|
|
|
- })
|
|
|
this.setState({
|
|
|
height: hei,
|
|
|
refreshing: false,
|
|
|
@@ -63,33 +57,19 @@ class CurrencyList extends Component {
|
|
|
const {
|
|
|
requestList,
|
|
|
requestTab,
|
|
|
- requestSearchConfig,
|
|
|
- formState: { filterGroupList },
|
|
|
- listState: { tabList, listData, scrollTop },
|
|
|
+ listState: { tabList, listData },
|
|
|
} = this.props
|
|
|
|
|
|
- if (isObjEmpty(tabList) && !isObjNull(requestTab)) {
|
|
|
+ if (isObjEmpty(tabList) && isObjEmpty(listData) && !isObjNull(requestTab)) {
|
|
|
requestTab()
|
|
|
} else if (isObjEmpty(listData) && !isObjNull(requestList)) {
|
|
|
saveListState({
|
|
|
pageIndex: 0,
|
|
|
})
|
|
|
requestList()
|
|
|
+ } else {
|
|
|
+ this.recoveryScroll()
|
|
|
}
|
|
|
-
|
|
|
- if (isObjEmpty(filterGroupList) && !isObjNull(requestSearchConfig)) {
|
|
|
- requestSearchConfig()
|
|
|
- }
|
|
|
- GlobalEvent.on(CURRENCY_DETAIL_DATA_REFRESH, (billGroupModelList) => {
|
|
|
- saveListState({
|
|
|
- filterGroupList: billGroupModelList,
|
|
|
- })
|
|
|
- setTimeout(() => {
|
|
|
- this.forceUpdate()
|
|
|
- }, 0)
|
|
|
- }, this)
|
|
|
-
|
|
|
- ReactDOM.findDOMNode(this.lv).scrollTop = scrollTop
|
|
|
}
|
|
|
|
|
|
componentWillUnmount () {
|
|
|
@@ -97,7 +77,7 @@ class CurrencyList extends Component {
|
|
|
}
|
|
|
|
|
|
render () {
|
|
|
- const { listState: { tabList, tabSelect, listData }, rowCount, addAble } = this.props
|
|
|
+ const { listState: { tabList, tabSelect, listData, pageIndex }, rowCount, addAble } = this.props
|
|
|
const { listDataSource, height, hasNextPage, filterOpen } = this.state
|
|
|
|
|
|
const refreshLayout = this.getRefreshLayout()
|
|
|
@@ -141,7 +121,7 @@ class CurrencyList extends Component {
|
|
|
<ListView
|
|
|
ref={el => this.lv = el}
|
|
|
dataSource={listDataSource.cloneWithRows(listData)}
|
|
|
- initialListSize={LIST_PAGE_SIZE}
|
|
|
+ initialListSize={(pageIndex + 1) * LIST_PAGE_SIZE}
|
|
|
renderFooter={() => {
|
|
|
return hasNextPage && <LoadingMore/>
|
|
|
}}
|
|
|
@@ -154,6 +134,9 @@ class CurrencyList extends Component {
|
|
|
style={{
|
|
|
height,
|
|
|
}}
|
|
|
+ onContentSizeChange={() => {
|
|
|
+ console.log('onContentSizeChange', 'onContentSizeChange')
|
|
|
+ }}
|
|
|
pullToRefresh={refreshLayout}
|
|
|
onEndReachedThreshold={10}
|
|
|
onEndReached={hasNextPage ? this.loadDataList : null}
|
|
|
@@ -171,6 +154,13 @@ class CurrencyList extends Component {
|
|
|
)
|
|
|
}
|
|
|
|
|
|
+ recoveryScroll = () => {
|
|
|
+ const { listState: { scrollTop } } = this.props
|
|
|
+ setTimeout(() => {
|
|
|
+ }, 0)
|
|
|
+ ReactDOM.findDOMNode(this.lv).scrollTop = scrollTop
|
|
|
+ }
|
|
|
+
|
|
|
getRefreshLayout () {
|
|
|
const { refreshing } = this.state
|
|
|
return <PullToRefresh
|
|
|
@@ -189,7 +179,9 @@ class CurrencyList extends Component {
|
|
|
}
|
|
|
|
|
|
getFilterLayout = () => {
|
|
|
- const { params } = this.props
|
|
|
+ const {
|
|
|
+ params, formState: { filterGroupList },
|
|
|
+ } = this.props
|
|
|
return (
|
|
|
<div
|
|
|
className='currency-list-content-filter-content'>
|
|
|
@@ -197,6 +189,7 @@ class CurrencyList extends Component {
|
|
|
onRef={ref => this.cd = ref}
|
|
|
caller={params.caller}
|
|
|
id={params.id}
|
|
|
+ formData={filterGroupList}
|
|
|
>
|
|
|
<div className='currency-list-content-filter-func'>
|
|
|
<Button
|
|
|
@@ -245,6 +238,9 @@ class CurrencyList extends Component {
|
|
|
saveListState({
|
|
|
scrollTop: ReactDOM.findDOMNode(this.lv).scrollTop,
|
|
|
})
|
|
|
+ refreshFormState({
|
|
|
+ filterGroupList: this.cd && this.cd.state.billGroupList,
|
|
|
+ })
|
|
|
const { onItemClick } = this.props
|
|
|
onItemClick && onItemClick(rowData)
|
|
|
}
|
|
|
@@ -259,6 +255,9 @@ class CurrencyList extends Component {
|
|
|
saveListState({
|
|
|
scrollTop: ReactDOM.findDOMNode(this.lv).scrollTop,
|
|
|
})
|
|
|
+ refreshFormState({
|
|
|
+ filterGroupList: this.cd && this.cd.state.billGroupList,
|
|
|
+ })
|
|
|
const { onDocAdd } = this.props
|
|
|
onDocAdd && onDocAdd()
|
|
|
}
|