Merge branches 'PCqiandao' and 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

PCqiandao
杨树明 5 years ago
commit a5071cd445

@ -9,6 +9,7 @@ import {
Axis, Axis,
Tooltip, Tooltip,
} from "bizcharts"; } from "bizcharts";
import LoadingSpin from "../../../../common/LoadingSpin";
const { Option } = Select; const { Option } = Select;
class Signinstatistics extends Component { class Signinstatistics extends Component {
@ -17,10 +18,14 @@ class Signinstatistics extends Component {
this.state={ this.state={
datas:null, datas:null,
newlist:[], newlist:[],
course_groups:[{id:"全部",name:"全部"}] course_groups:[{id:"全部",name:"全部"}],
spal:false,
} }
} }
getdata=(group_id)=>{ getdata=(group_id)=>{
this.setState({
spal:true
})
const coursesId=this.props.match.params.coursesId; const coursesId=this.props.match.params.coursesId;
let url=`/weapps/courses/${coursesId}/attendances.json` let url=`/weapps/courses/${coursesId}/attendances.json`
axios.get(url,{params:{ axios.get(url,{params:{
@ -60,7 +65,15 @@ class Signinstatistics extends Component {
} }
} }
}) this.setState({
spal:false
})
}).catch((error) => {
this.setState({
spal:false
})
})
} }
componentDidMount() { componentDidMount() {
@ -84,7 +97,7 @@ class Signinstatistics extends Component {
} }
render() { render() {
let {datas,newlist,course_groups}=this.state; let {datas,newlist,course_groups,spal}=this.state;
const cols = { const cols = {
month: { month: {
@ -95,11 +108,22 @@ class Signinstatistics extends Component {
return( return(
<React.Fragment > <React.Fragment >
<div>
{
spal===true?
<div style={{
minHeight:"500px",
}}>
<LoadingSpin></LoadingSpin>
</div>
<Row type="flex" justify="space-between" className={"mt20"}> :
<style> <div>
{
` <Row type="flex" justify="space-between" className={"mt20"}>
<style>
{
`
.lishiqiandao{ .lishiqiandao{
background-image: url(${getImageUrl(`images/qiandao/lishi.png`)}); background-image: url(${getImageUrl(`images/qiandao/lishi.png`)});
} }
@ -113,108 +137,112 @@ class Signinstatistics extends Component {
background-image: url(${getImageUrl(`images/qiandao/qingjia.png`)}); background-image: url(${getImageUrl(`images/qiandao/qingjia.png`)});
} }
` `
} }
</style> </style>
<Col span={6}> <Col span={6}>
<Card style={{ width: 209 }} className={"gutterrowbox lishiqiandao"}> <Card style={{ width: 209 }} className={"gutterrowbox lishiqiandao"}>
<div className={"gutterrowboxcontent ml5"}>{datas&&datas.all_history_count}</div> <div className={"gutterrowboxcontent ml5"}>{datas&&datas.all_history_count}</div>
</Card> </Card>
</Col> </Col>
<Col span={6}> <Col span={6}>
<Card style={{ width: 209 }} className={"ml8 gutterrowbox daokeqiandao"}> <Card style={{ width: 209 }} className={"ml8 gutterrowbox daokeqiandao"}>
<div className={"gutterrowboxcontent ml5"}>{datas?(datas&&datas.avg_normal_rate*100).toFixed(0)+"%":""}</div> <div className={"gutterrowboxcontent ml5"}>{datas?(datas&&datas.avg_normal_rate*100).toFixed(0)+"%":""}</div>
</Card> </Card>
</Col> </Col>
<Col span={6}> <Col span={6}>
<Card style={{ width: 209 }} className={"ml14 gutterrowbox kuangkeqiandao"}> <Card style={{ width: 209 }} className={"ml14 gutterrowbox kuangkeqiandao"}>
<div className={"gutterrowboxcontent ml5"}>{datas?(datas&&datas.avg_absence_rate*100).toFixed(0)+"%":""}</div> <div className={"gutterrowboxcontent ml5"}>{datas?(datas&&datas.avg_absence_rate*100).toFixed(0)+"%":""}</div>
</Card> </Card>
</Col> </Col>
<Col span={6} > <Col span={6} >
<Card style={{ width: 209 }} className={"ml20 gutterrowbox qingjiaqiandao"}> <Card style={{ width: 209 }} className={"ml20 gutterrowbox qingjiaqiandao"}>
<div className={"gutterrowboxcontent ml5"}>{datas?(datas&&datas.avg_leave_rate*100).toFixed(0)+"%":""}</div> <div className={"gutterrowboxcontent ml5"}>{datas?(datas&&datas.avg_leave_rate*100).toFixed(0)+"%":""}</div>
</Card> </Card>
</Col> </Col>
</Row> </Row>
<div className={"SigninstatisticsChart mt20"}> <div className={"SigninstatisticsChart mt20"}>
<div className={"pd30"}> <div className={"pd30"}>
<Row> <Row>
<Col span={14}> <Col span={14}>
<Row type="flex" justify="start"> <Row type="flex" justify="start">
<Col span={5}> <Col span={5}>
<Row> <Row>
<Col span={12} className={"mindaoke mr5"}></Col> <Col span={12} className={"mindaoke mr5"}></Col>
<Col>到课率</Col> <Col>到课率</Col>
</Row> </Row>
</Col> </Col>
<Col span={5}> <Col span={5}>
<Row> <Row>
<Col span={12} className={"minkuangke mr5"}></Col> <Col span={12} className={"minkuangke mr5"}></Col>
<Col>旷课率</Col> <Col>旷课率</Col>
</Row> </Row>
</Col> </Col>
<Col span={5}> <Col span={5}>
<Row> <Row>
<Col span={12} className={"minqingjia mr5"}></Col> <Col span={12} className={"minqingjia mr5"}></Col>
<Col>请假率</Col> <Col>请假率</Col>
</Row> </Row>
</Col> </Col>
</Row> </Row>
</Col> </Col>
<Col span={10}><Row type="flex" justify="end"> <Col span={10}><Row type="flex" justify="end">
<Col span={8} className={"Signinstatisticsfont"}>显示最近十次签到</Col> <Col span={8} className={"Signinstatisticsfont"}>显示最近十次签到</Col>
<Col span={10}> <Col span={10}>
<Select defaultValue={"全部"} onChange={(e)=>this.handleChange(e)} style={{width:"130px"}}> <Select defaultValue={"全部"} onChange={(e)=>this.handleChange(e)} style={{width:"130px"}}>
{course_groups&&course_groups.map((item,key)=>{ {course_groups&&course_groups.map((item,key)=>{
return( return(
<Option value={item.id} title={item.name} >{item.name}</Option> <Option value={item.id} title={item.name} >{item.name}</Option>
) )
})} })}
</Select> </Select>
</Col> </Col>
</Row></Col> </Row></Col>
</Row> </Row>
</div> </div>
<div className={"padding03000"}> <div className={"padding03000"}>
<Chart height={400} data={newlist} scale={cols} forceFit> <Chart height={400} data={newlist} scale={cols} forceFit>
{/*<Legend />*/} {/*<Legend />*/}
<Axis name="month" /> <Axis name="month" />
<Axis <Axis
name="temperature" name="temperature"
label={{ label={{
formatter: val => `${val}%` formatter: val => `${val}%`
}} }}
/> />
<Tooltip <Tooltip
crosshairs={{ crosshairs={{
type: "y" type: "y"
}} }}
/> />
<Geom <Geom
type="line" type="line"
position="month*temperature" position="month*temperature"
size={2} size={2}
// color={"city"} // color={"city"}
shape={"smooth"} shape={"smooth"}
color={["city", ["#26C7C9", "#FF835C","#EDBA6F"]]} color={["city", ["#26C7C9", "#FF835C","#EDBA6F"]]}
/> />
<Geom <Geom
type="point" type="point"
position="month*temperature" position="month*temperature"
size={4} size={4}
shape={"circle"} shape={"circle"}
color={["city", ["#26C7C9", "#FF835C","#EDBA6F"]]} color={["city", ["#26C7C9", "#FF835C","#EDBA6F"]]}
style={{ style={{
stroke: "#fff", stroke: "#fff",
lineWidth: 1 lineWidth: 1
}} }}
/> />
</Chart> </Chart>
</div> </div>
</div> </div>
</div>
}
</div>
</React.Fragment> </React.Fragment>
) )
@ -227,4 +255,4 @@ class Signinstatistics extends Component {
export default Signinstatistics; export default Signinstatistics;

@ -3,6 +3,7 @@ import React,{ Component } from "react";
import { Row, Col,Select,Table,Pagination } from 'antd'; import { Row, Col,Select,Table,Pagination } from 'antd';
import axios from 'axios'; import axios from 'axios';
import LoadingSpin from "../../../../common/LoadingSpin"; import LoadingSpin from "../../../../common/LoadingSpin";
import NoneDatas from "../component/NoneDatas";
const { Option } = Select; const { Option } = Select;
class Signedinlist extends Component { class Signedinlist extends Component {
@ -85,10 +86,13 @@ class Signedinlist extends Component {
this.setState({ this.setState({
member_attendances:response.data.member_attendances, member_attendances:response.data.member_attendances,
members_count:response.data.members_count, members_count:response.data.members_count,
loading:false
}) })
} }
this.setState({
loading:false
})
}).catch((error) => { }).catch((error) => {
that.setState({ that.setState({
loading:false loading:false
@ -304,12 +308,21 @@ class Signedinlist extends Component {
</Row> </Row>
<div className={"backfff mt10"}> <div className={"backfff mt10"}>
{ {
this.state.loading===true?
<div style={{
minHeight:"400px",
}}>
<LoadingSpin></LoadingSpin>
</div>
:
member_attendances&&member_attendances.length===0? member_attendances&&member_attendances.length===0?
<div style={{ <div style={{
minHeight:"400px", minHeight:"400px",
}}> }}>
<LoadingSpin></LoadingSpin> {/*<LoadingSpin></LoadingSpin>*/}
<NoneDatas></NoneDatas>
</div> </div>
: :
// loading={this.state.loading} // loading={this.state.loading}
<Table columns={columns} dataSource={member_attendances} pagination={false} /> <Table columns={columns} dataSource={member_attendances} pagination={false} />
@ -319,9 +332,14 @@ class Signedinlist extends Component {
</div> </div>
<div className="mb30 clearfix educontent mt40 intermediatecenter"> <div className="mb30 clearfix educontent mt40 intermediatecenter">
<Pagination showQuickJumper current={this.state.page} onChange={this.paginationonChange} {
pageSize={this.state.limit} member_attendances&&member_attendances.length>0?
total={this.state.members_count}></Pagination> <Pagination showQuickJumper current={this.state.page} onChange={this.paginationonChange}
pageSize={this.state.limit}
total={this.state.members_count}></Pagination>
:""
}
</div> </div>
</React.Fragment> </React.Fragment>

Loading…
Cancel
Save