PCqiandao
杨树明 5 years ago
parent d52a07bec9
commit 80a8e2ee8d

@ -27,12 +27,13 @@ class Signedinlist extends Component {
{id:"NORMAL",name:"正常出勤"},
{id:"LEAVE",name:"请假"},
{id:"ABSENCE",name:"旷课"},
]
],
course_members_count:'--',
attendance_count:'--',
}
}
componentDidMount() {
console.log(this.props.headdata)
let {attendanceslist}=this.state;
let listattendanceslist=attendanceslist
let url=`/weapps/attendances/${this.props&&this.props.switattendance_id}.json`;
@ -44,9 +45,12 @@ class Signedinlist extends Component {
listattendanceslist.push(item)
})
}
this.setState({
listattendanceslist:attendanceslist,
data:response.data
data:response.data,
course_members_count:response.data.all_count,
attendance_count: response.data.normal_count
})
}
@ -87,9 +91,6 @@ class Signedinlist extends Component {
});
}
handleChangegroup_ids=(e)=>{
console.log(this.props.headdata)
console.log(e)
return
let neval
if(!value){
neval=[]
@ -105,6 +106,47 @@ class Signedinlist extends Component {
let {page,attendance_status}=this.state;
this.getdatas(this.props&&this.props.switattendance_id,page,neval,attendance_status)
if(this.props.defaultActiveKey==="1"){
this.getpath(e)
}
}
getpath=(id)=>{
let {attendanceslist}=this.state;
let listattendanceslist=attendanceslist
let url=`/weapps/attendances/${this.props&&this.props.switattendance_id}.json`;
axios.get(url).then((response) => {
if(response.data){
if(response.data.course_groups.length>0){
response.data.course_groups.map((item,key)=>{
listattendanceslist.push(item)
})
}
if(e){
response.data.course_groups.map((item,key)=>{
if(item.id===id){
this.setState({
course_members_count:item.course_members_count,
attendance_count: item.attendance_count
})
}
})
}else{
this.setState({
course_members_count:response.data.all_count,
attendance_count: response.data.normal_count
})
}
this.setState({
listattendanceslist:attendanceslist,
data:response.data
})
}
})
}
handleChangestate=(value)=>{
let neval
@ -208,7 +250,7 @@ class Signedinlist extends Component {
<Select defaultValue="全部分班" className={"Signedinlistbox"} style={{ width: 167 }} onChange={this.handleChangegroup_ids}>
{attendanceslist&&attendanceslist.map((item,key)=>{
return(
<Option value={item}>{item.name}</Option>
<Option value={item.id}>{item.name}</Option>
)
})}
@ -242,8 +284,8 @@ class Signedinlist extends Component {
<span className={"colorEAAE4E mr20"}>请假{data&&data.leave_count}</span>
<span className={"colorFF835C"}>旷课{data&&data.absence_count}</span>
</Col>:<Col className={"Signedintextright "}>
<span className={"mr20"}>已签到<span className={"color1890FF"}>33</span></span>
<span>应签到<span className={"color1890FF"}>33</span></span>
<span className={"mr20"}>已签到<span className={"color1890FF"}>{this.state.course_members_count}</span></span>
<span>应签到<span className={"color1890FF"}>{this.state.attendance_count}</span></span>
</Col>}
</Row>

Loading…
Cancel
Save