|
@@ -1,7 +1,7 @@
|
|
import React from 'react';
|
|
import React from 'react';
|
|
import { connectAlita } from 'redux-alita';
|
|
import { connectAlita } from 'redux-alita';
|
|
import { withRouter } from 'react-router-dom';
|
|
import { withRouter } from 'react-router-dom';
|
|
-import { Button, Input, List, message, Modal, Spin } from 'antd';
|
|
|
|
|
|
+import { Button, Input, List, message, Modal, Spin, Pagination } from 'antd';
|
|
import './styles/label.less';
|
|
import './styles/label.less';
|
|
import AddLabelForm from './widget/AddLabelForm';
|
|
import AddLabelForm from './widget/AddLabelForm';
|
|
|
|
|
|
@@ -17,12 +17,15 @@ class ConfigLabel extends React.Component {
|
|
removeModalVisible: false,
|
|
removeModalVisible: false,
|
|
currentLabel: null,
|
|
currentLabel: null,
|
|
};
|
|
};
|
|
|
|
+ this.params = {
|
|
|
|
+ page: 1,
|
|
|
|
+ pageSize: 10,
|
|
|
|
+ };
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
componentDidMount() {
|
|
this._fetchLabels();
|
|
this._fetchLabels();
|
|
- this.params = {};
|
|
|
|
}
|
|
}
|
|
|
|
|
|
_fetchLabels() {
|
|
_fetchLabels() {
|
|
@@ -73,11 +76,17 @@ class ConfigLabel extends React.Component {
|
|
|
|
|
|
render() {
|
|
render() {
|
|
const { data: labelList = {}, isFetching } = this.props.findPLabel || {};
|
|
const { data: labelList = {}, isFetching } = this.props.findPLabel || {};
|
|
|
|
+ let { records, current, total } = labelList || { total: 0, current: 1, records: [] };
|
|
|
|
+
|
|
|
|
+ console.log('params: ', this.params);
|
|
const { currentLabel } = this.state;
|
|
const { currentLabel } = this.state;
|
|
return (<div className="page-label-container">
|
|
return (<div className="page-label-container">
|
|
<div className="prop-label-header">
|
|
<div className="prop-label-header">
|
|
<Button htmlType="button" type="primary" icon="sync" loading={isFetching}
|
|
<Button htmlType="button" type="primary" icon="sync" loading={isFetching}
|
|
- onClick={this._fetchLabels.bind(this)}/>
|
|
|
|
|
|
+ onClick={() => {
|
|
|
|
+ this.params.page = 1;
|
|
|
|
+ this._fetchLabels();
|
|
|
|
+ }}/>
|
|
<Button htmlType="button" icon="plus"
|
|
<Button htmlType="button" icon="plus"
|
|
onClick={() => this.setState({ currentLabel: {} })}/>
|
|
onClick={() => this.setState({ currentLabel: {} })}/>
|
|
<Input.Search placeholder="输入关键词查询"
|
|
<Input.Search placeholder="输入关键词查询"
|
|
@@ -86,11 +95,20 @@ class ConfigLabel extends React.Component {
|
|
</div>
|
|
</div>
|
|
<Spin className="spin" spinning={isFetching} size="large"/>
|
|
<Spin className="spin" spinning={isFetching} size="large"/>
|
|
<List
|
|
<List
|
|
- dataSource={labelList.records}
|
|
|
|
|
|
+ dataSource={records}
|
|
bordered
|
|
bordered
|
|
size="small"
|
|
size="small"
|
|
renderItem={this.renderItem.bind(this)}
|
|
renderItem={this.renderItem.bind(this)}
|
|
/>
|
|
/>
|
|
|
|
+ <Pagination defaultCurrent={current}
|
|
|
|
+ style={{ marginTop: 10, padding: 10, background: 'white' }}
|
|
|
|
+ onChange={(page, pageSize) => {
|
|
|
|
+ this.params.page = page;
|
|
|
|
+ this.params.pageSize = pageSize;
|
|
|
|
+ this._fetchLabels();
|
|
|
|
+ }}
|
|
|
|
+ total={total}
|
|
|
|
+ pageSize={this.params.pageSize}/>
|
|
<AddLabelForm cancel={() => this.setState({ currentLabel: null })}
|
|
<AddLabelForm cancel={() => this.setState({ currentLabel: null })}
|
|
refresh={this._fetchLabels.bind(this)}
|
|
refresh={this._fetchLabels.bind(this)}
|
|
visible={!!currentLabel}
|
|
visible={!!currentLabel}
|