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