summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHongyuan Ma2018-07-28 16:42:25 +0000
committerHongyuan Ma2018-07-28 16:42:25 +0000
commit83b48d11f86115d53c42f7fe8c4f0a29c5eaf1f6 (patch)
tree211d38053d146daec52637b32e58ad732c97fb08
parent5a24a0442545ba5730316305cae4f4c1bfea87d3 (diff)
rewrite filter component
-rw-r--r--front-end/src/component/result-filter/index.jsx1
-rw-r--r--front-end/src/page/status/index.jsx17
-rw-r--r--front-end/src/util/record-table/index.jsx5
3 files changed, 14 insertions, 9 deletions
diff --git a/front-end/src/component/result-filter/index.jsx b/front-end/src/component/result-filter/index.jsx
index 0e7329f..f004dff 100644
--- a/front-end/src/component/result-filter/index.jsx
+++ b/front-end/src/component/result-filter/index.jsx
@@ -13,6 +13,7 @@ class ResultFilter extends React.Component {
{'cate': 'Category 2', 'name': '30 days'}
],
restoreNum: 0,
+ branch_list:this.props.branch_list,
selected: [{
'cate': 'Category 1',
'index': 0,
diff --git a/front-end/src/page/status/index.jsx b/front-end/src/page/status/index.jsx
index 3093d1b..781926c 100644
--- a/front-end/src/page/status/index.jsx
+++ b/front-end/src/page/status/index.jsx
@@ -16,6 +16,7 @@ class Status extends React.Component {
total: 3,
filter: {},
branch_list: [],
+ selected_branches:[],
list: [
// {
// 'alias': 'a_name',
@@ -32,7 +33,7 @@ class Status extends React.Component {
},
- this.onPageChange = this.onPageChange.bind(this);
+ this.onPageChange = this.onPageChange.bind(this);
this.onIsLoadingChange = this.onIsLoadingChange.bind(this);
this.handleApplyBtnClick = this.handleApplyBtnClick.bind(this);
this.loadRecordList = this.loadRecordList.bind(this);
@@ -45,9 +46,10 @@ class Status extends React.Component {
handleApplyBtnClick(params) {
console.log('handle apply!')
- let self = this
- this.setState({filter: params}, () => {
- self.loadRecordList()
+ let _this = this
+ let selected_branches = []
+ this.setState({
+ selected_branches: selected_branches,
});
}
@@ -55,6 +57,7 @@ class Status extends React.Component {
_record.getBranchList().then(res => {
this.setState({
branch_list: res.results,
+ selected_branches: res.results,
});
console.dir(res.results)
}, errMsg => {
@@ -119,9 +122,9 @@ class Status extends React.Component {
display: show
};
console.log('hi')
- console.dir(this.state.branch_list)
+ console.dir(this.state.selected_branches)
console.log('done')
- let table_list = this.state.branch_list.map((value, index) => (
+ let table_list = this.state.selected_branches.map((value, index) => (
<RecordTable branch={value.branch_name}/>
))
@@ -135,7 +138,7 @@ class Status extends React.Component {
</p>
- <ResultFilter isLoading={this.state.isLoading} onIsLoadingChange={this.onIsLoadingChange}
+ <ResultFilter branch_list={this.state.branch_list} isLoading={this.state.isLoading} onIsLoadingChange={this.onIsLoadingChange}
onApplyBtnClick={this.handleApplyBtnClick}/>
{table_list}
{/*<RecordTable list={this.state.list} total={this.state.total} current={this.state.currentPage} loadfunc={this.loadRecordList}/>*/}
diff --git a/front-end/src/util/record-table/index.jsx b/front-end/src/util/record-table/index.jsx
index d68eb7b..bffb955 100644
--- a/front-end/src/util/record-table/index.jsx
+++ b/front-end/src/util/record-table/index.jsx
@@ -93,10 +93,11 @@ class RecordTable extends React.Component {
console.log(this.state.list)
}
onPageNumChange(current) {
+ let _this = this
this.setState({
currentPage: current
}, () => {
- this.props.loadfunc(current);
+ this.loadRecordListByBranch(_this.state.branch,current);
});
console.log('current:' + this.state.currentPage)
}
@@ -188,7 +189,7 @@ class RecordTable extends React.Component {
<Table.Row>
<Table.HeaderCell colSpan='10'>
<Pagination style={style} onChange={(current) => this.onPageNumChange(current)} pageSize={2}
- current={this.state.currentPage} total={this.props.total}/>
+ current={this.state.currentPage} total={this.state.total}/>
</Table.HeaderCell>