mode
This commit is contained in:
parent
3237e61585
commit
acccf234d3
|
@ -6,7 +6,8 @@ class FeTable extends Component {
|
|||
super(props)
|
||||
this.state = {
|
||||
data: [],
|
||||
columns: []
|
||||
columns: [],
|
||||
total: 0
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,7 +15,8 @@ class FeTable extends Component {
|
|||
if (props.data !== state.data && props.data) {
|
||||
return {
|
||||
data: props.data,
|
||||
columns: props.columns
|
||||
columns: props.columns,
|
||||
total: props.total
|
||||
}
|
||||
}
|
||||
return null
|
||||
|
@ -24,15 +26,22 @@ class FeTable extends Component {
|
|||
return this.props.callback(e.target.innerText, value)
|
||||
}
|
||||
|
||||
onChange = e =>{
|
||||
return this.props.pageChange(e)
|
||||
}
|
||||
|
||||
onShowSizeChange = (current,pageSize) =>{
|
||||
return this.props.onShowSizeChange(current,pageSize)
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<React.Fragment>
|
||||
<Table bordered style={{ marginBottom: 20 }} dataSource={this.state.data} columns={this.state.columns} onRow={record => {
|
||||
return {
|
||||
<Table bordered style={{ marginBottom: 20 }} dataSource={this.state.data} columns={this.state.columns} onRow={record => {return {
|
||||
onClick: event => this.jumpRow(event, record)
|
||||
}
|
||||
}
|
||||
} />
|
||||
}} pagination={{total: this.state.total,onChange:this.onChange.bind(this),showSizeChanger:true,
|
||||
onShowSizeChange:this.onShowSizeChange.bind(this)}}/>
|
||||
</React.Fragment>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ class Dashboard extends Component {
|
|||
rating: {}, //评价记录
|
||||
industry: [], //行业分布
|
||||
company: [], //新增企业
|
||||
total: 0,
|
||||
columns: [
|
||||
{ title: '企业ID', dataIndex: '企业ID', key: 0 },
|
||||
{ title: '企业名称', dataIndex: '企业名称', key: 1 },
|
||||
|
@ -70,7 +71,8 @@ class Dashboard extends Component {
|
|||
// 新增企业
|
||||
api.get("/admin/board/get_new_companies", { page_no: 1, page_size: 10 }).then(res => {
|
||||
this.setState({
|
||||
company: res.result
|
||||
company: res.result.records,
|
||||
total: res.result.total
|
||||
})
|
||||
})
|
||||
}
|
||||
|
@ -210,6 +212,25 @@ class Dashboard extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
pageChange = e =>{
|
||||
|
||||
api.get("/admin/board/get_new_companies", { page_no: e, page_size: 10 }).then(res => {
|
||||
this.setState({
|
||||
company: res.result.records,
|
||||
total: res.result.total
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// onShowSizeChange = (current,pageSize) =>{
|
||||
// api.get("/admin/board/get_new_companies", { page_no: current, page_size: pageSize }).then(res => {
|
||||
// this.setState({
|
||||
// company: res.result.records,
|
||||
// total: res.result.total
|
||||
// })
|
||||
// })
|
||||
// }
|
||||
|
||||
render() {
|
||||
return (
|
||||
<React.Fragment>
|
||||
|
@ -251,7 +272,7 @@ class Dashboard extends Component {
|
|||
</Col>
|
||||
<Col span={16}>
|
||||
<Card title="新增企业信息">
|
||||
<FeTable data={this.state.company} columns={this.state.columns} callback={this.callback.bind(this)}></FeTable>
|
||||
<FeTable data={this.state.company} columns={this.state.columns} callback={this.callback.bind(this)} total={this.state.total} pageChange={this.pageChange.bind(this)}></FeTable>
|
||||
</Card>
|
||||
</Col>
|
||||
</Row>
|
||||
|
|
|
@ -48,14 +48,18 @@ class Side extends Component {
|
|||
}
|
||||
|
||||
render() {
|
||||
const menus = localStorage.getItem("menus").split(',') || ['Board', 'Manage', 'Model', 'Test', 'Setting']
|
||||
const menuItem = menus.map((item, i) => {
|
||||
var menus,menuItem
|
||||
|
||||
if (localStorage.getItem("menus")) {
|
||||
menus = localStorage.getItem("menus").split(',') || ['Board', 'Manage', 'Model', 'Test', 'Setting']
|
||||
menuItem = menus.map((item, i) => {
|
||||
return <Menu.ItemGroup title={item} key={i}>
|
||||
{this.state.data.map((ele, index) => {
|
||||
return ele.category === item ? <Menu.Item key={index.toString()} icon={ele.icon} onClick={this.handleClick}>{ele.title}</Menu.Item> : null
|
||||
})}
|
||||
</Menu.ItemGroup>
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
<Menu
|
||||
|
|
Loading…
Reference in New Issue