From 91b86a3b6cd1384d5400eb1059b5c115da1f5e44 Mon Sep 17 00:00:00 2001 From: felixpan <1q2w3e4r> Date: Sat, 21 Jan 2017 00:47:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E5=B8=A6=E5=85=B3?= =?UTF-8?q?=E9=94=AE=E5=AD=97=E6=90=9C=E7=B4=A2=E6=97=B6=E5=88=86=E9=A1=B5?= =?UTF-8?q?=E8=B7=B3=E8=BD=ACbug;=E6=96=B0=E5=A2=9E=E4=BA=86=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E5=88=B7=E6=96=B0=E5=90=8E=EF=BC=8C=E9=A6=96=E6=AC=A1?= =?UTF-8?q?=E8=AF=B7=E6=B1=82=E6=95=B0=E6=8D=AE=E5=8F=AF=E4=BB=A5=E5=90=8C?= =?UTF-8?q?=E6=97=B6=E5=B8=A6=E5=85=B3=E9=94=AE=E5=AD=97=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E4=B8=8E=E9=A1=B5=E7=A0=81=E8=BF=87=E6=BB=A4=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ui/search.js | 4 ++-- src/components/users/search.js | 2 +- src/routes/users.js | 14 ++++++++++++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/components/ui/search.js b/src/components/ui/search.js index 235d56c..7e89ae2 100644 --- a/src/components/ui/search.js +++ b/src/components/ui/search.js @@ -37,14 +37,14 @@ class Search extends React.Component { this.handleSearch() } render () { - const {size, select, selectOptions, selectProps, style} = this.props + const {size, select, selectOptions, selectProps, style, keyword} = this.props const {clearVisible} = this.state return ( {select && } - + {clearVisible && } diff --git a/src/components/users/search.js b/src/components/users/search.js index aad9930..0d2d175 100644 --- a/src/components/users/search.js +++ b/src/components/users/search.js @@ -20,7 +20,7 @@ const search = ({ select: true, selectOptions: [{ value: 'name', name: '姓名' }, { value: 'address', name: '地址' }], selectProps: { - defaultValue: 'name' + defaultValue: field || 'name' }, onSearch: (value) => { onSearch(value) diff --git a/src/routes/users.js b/src/routes/users.js index b4be09b..3361e5a 100644 --- a/src/routes/users.js +++ b/src/routes/users.js @@ -31,9 +31,11 @@ function Users ({ location, dispatch, users }) { loading, pagination: pagination, onPageChange (page) { + const query = location.query dispatch(routerRedux.push({ pathname: '/users', query: { + ...query, page: page.current, pageSize: page.pageSize } @@ -60,6 +62,18 @@ function Users ({ location, dispatch, users }) { field, keyword, onSearch (fieldsValue) { + !!fieldsValue.keyword.length ? + dispatch(routerRedux.push({ + pathname: '/users', + query: { + field: fieldsValue.field, + keyword: fieldsValue.keyword + } + })) : + dispatch(routerRedux.push({ + pathname: '/users' + })) + dispatch({ type: 'users/query', payload: fieldsValue