|
|
|
@ -21,14 +21,14 @@ class Signedinlist extends Component {
|
|
|
|
|
attendance_status:undefined,
|
|
|
|
|
state:[
|
|
|
|
|
{id:undefined,name:"全部状态"},
|
|
|
|
|
{id:"NORMAL",name:"正常出勤"},
|
|
|
|
|
{id:"LEAVE",name:"请假"},
|
|
|
|
|
{id:"ABSENCE",name:"旷课"},
|
|
|
|
|
{id:"NORMAL",name:"正常签到"},
|
|
|
|
|
{id:"LEAVE",name:"请 假"},
|
|
|
|
|
{id:"ABSENCE",name:"旷 课"},
|
|
|
|
|
],
|
|
|
|
|
newstate:[
|
|
|
|
|
{id:"NORMAL",name:"正常出勤"},
|
|
|
|
|
{id:"LEAVE",name:"请假"},
|
|
|
|
|
{id:"ABSENCE",name:"旷课"},
|
|
|
|
|
{id:"NORMAL",name:"正常签到"},
|
|
|
|
|
{id:"LEAVE",name:"请 假"},
|
|
|
|
|
{id:"ABSENCE",name:"旷 课"},
|
|
|
|
|
],
|
|
|
|
|
course_members_count:'--',
|
|
|
|
|
attendance_count:'--',
|
|
|
|
@ -36,31 +36,36 @@ class Signedinlist extends Component {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
|
|
|
let {attendanceslist}=this.state;
|
|
|
|
|
if(this.props.headdata){
|
|
|
|
|
let listattendanceslist=attendanceslist;
|
|
|
|
|
if(headdata.course_groups){
|
|
|
|
|
|
|
|
|
|
if(headdata.course_groups.length>0){
|
|
|
|
|
headdata.course_groups.map((item,key)=>{
|
|
|
|
|
listattendanceslist.push(item)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.setState({
|
|
|
|
|
listattendanceslist:listattendanceslist,
|
|
|
|
|
data:response.data,
|
|
|
|
|
course_members_count:headdata.all_count,
|
|
|
|
|
attendance_count:headdata.normal_count
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.getdatas(this.props&&this.props.switattendance_id,1,[],undefined)
|
|
|
|
|
// this.getpath()
|
|
|
|
|
}
|
|
|
|
|
componentDidUpdate(prevProps, prevState) {
|
|
|
|
|
if(prevProps.headdata!=this.props.headdata){
|
|
|
|
|
|
|
|
|
|
let {attendanceslist}=this.state;
|
|
|
|
|
if(this.props.headdata){
|
|
|
|
|
let listattendanceslist=attendanceslist;
|
|
|
|
|
if(this.props.headdata.course_groups){
|
|
|
|
|
|
|
|
|
|
if(this.props.headdata.course_groups.length>0){
|
|
|
|
|
this.props.headdata.course_groups.map((item,key)=>{
|
|
|
|
|
listattendanceslist.push(item)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.setState({
|
|
|
|
|
listattendanceslist:listattendanceslist,
|
|
|
|
|
data:this.props.headdata,
|
|
|
|
|
course_members_count:this.props.headdata.normal_count,
|
|
|
|
|
attendance_count:this.props.headdata.all_count
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
getdatas=(id,page,group_ids,attendance_status)=>{
|
|
|
|
|
this.setState({
|
|
|
|
|
loading:true,
|
|
|
|
@ -101,24 +106,25 @@ class Signedinlist extends Component {
|
|
|
|
|
neval=[]
|
|
|
|
|
this.setState({
|
|
|
|
|
group_ids: [],
|
|
|
|
|
page:1
|
|
|
|
|
})
|
|
|
|
|
}else{
|
|
|
|
|
neval=[value]
|
|
|
|
|
this.setState({
|
|
|
|
|
group_ids: [value],
|
|
|
|
|
page:1
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let {page,attendance_status}=this.state;
|
|
|
|
|
this.getdatas(this.props&&this.props.switattendance_id,page,neval,attendance_status)
|
|
|
|
|
this.getdatas(this.props&&this.props.switattendance_id,1,neval,attendance_status)
|
|
|
|
|
if(this.props.defaultActiveKey==="1"){
|
|
|
|
|
this.getpath(value)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
getpath=(id)=>{
|
|
|
|
|
let {attendanceslist}=this.state;
|
|
|
|
|
let listattendanceslist=attendanceslist
|
|
|
|
|
let listattendanceslist=[]
|
|
|
|
|
let url=`/weapps/attendances/${this.props&&this.props.switattendance_id}.json`;
|
|
|
|
|
axios.get(url).then((response) => {
|
|
|
|
|
if(response.data){
|
|
|
|
@ -140,12 +146,12 @@ class Signedinlist extends Component {
|
|
|
|
|
})
|
|
|
|
|
}else{
|
|
|
|
|
this.setState({
|
|
|
|
|
course_members_count:response.data.all_count,
|
|
|
|
|
attendance_count: response.data.normal_count
|
|
|
|
|
course_members_count:response.data.normal_count,
|
|
|
|
|
attendance_count: response.data.all_count
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
this.setState({
|
|
|
|
|
listattendanceslist:attendanceslist,
|
|
|
|
|
listattendanceslist:listattendanceslist,
|
|
|
|
|
data:response.data
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
@ -160,16 +166,18 @@ class Signedinlist extends Component {
|
|
|
|
|
neval=undefined
|
|
|
|
|
this.setState({
|
|
|
|
|
attendance_status:undefined,
|
|
|
|
|
page:1
|
|
|
|
|
})
|
|
|
|
|
}else{
|
|
|
|
|
neval=value
|
|
|
|
|
this.setState({
|
|
|
|
|
attendance_status: value,
|
|
|
|
|
page:1
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let {page,group_ids}=this.state;
|
|
|
|
|
this.getdatas(this.props&&this.props.switattendance_id,page,group_ids,neval)
|
|
|
|
|
this.getdatas(this.props&&this.props.switattendance_id,1,group_ids,neval)
|
|
|
|
|
}
|
|
|
|
|
paginationonChange = (pageNumber) => {
|
|
|
|
|
this.setState({
|
|
|
|
@ -181,6 +189,17 @@ class Signedinlist extends Component {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
handleChange=(attendance_status,value)=>{
|
|
|
|
|
|
|
|
|
|
let {member_attendances}=this.state;
|
|
|
|
|
let newmember_attendances=member_attendances;
|
|
|
|
|
|
|
|
|
|
newmember_attendances.map((item,key)=>{
|
|
|
|
|
if(item.user_id===value){
|
|
|
|
|
item.attendance_status=attendance_status
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let url=`/weapps/course_member_attendances/update_status.json`;
|
|
|
|
|
|
|
|
|
|
axios.post(url, {
|
|
|
|
@ -192,7 +211,9 @@ class Signedinlist extends Component {
|
|
|
|
|
.then((response) => {
|
|
|
|
|
if (response.data.status == 0) {
|
|
|
|
|
this.props.showNotification(`修改状态成功`);
|
|
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
member_attendances:newmember_attendances
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.catch(function (error) {
|
|
|
|
@ -203,38 +224,54 @@ class Signedinlist extends Component {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
render() {
|
|
|
|
|
let {attendanceslist,state,data,member_attendances,newstate}=this.state;
|
|
|
|
|
let {attendanceslist,state,data,member_attendances,newstate,attendance_status}=this.state;
|
|
|
|
|
|
|
|
|
|
const columns = [
|
|
|
|
|
{
|
|
|
|
|
title: '序号',
|
|
|
|
|
dataIndex: 'index',
|
|
|
|
|
key: 'index',
|
|
|
|
|
width:300,
|
|
|
|
|
className: "textcenter",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '姓名',
|
|
|
|
|
dataIndex: 'user_name',
|
|
|
|
|
key: 'user_name',
|
|
|
|
|
width:300,
|
|
|
|
|
className: "textcenter",
|
|
|
|
|
render: (text, record) => (
|
|
|
|
|
<span>{record.user_name===null?"--":record.user_name}</span>
|
|
|
|
|
)
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '学号',
|
|
|
|
|
dataIndex: 'student_id',
|
|
|
|
|
key: 'student_id',
|
|
|
|
|
width:300,
|
|
|
|
|
className: "textcenter",
|
|
|
|
|
render: (text, record) => (
|
|
|
|
|
<span>{record.student_id===null?"--":record.student_id}</span>
|
|
|
|
|
)
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '状态',
|
|
|
|
|
key: 'attendance_status',
|
|
|
|
|
width:300,
|
|
|
|
|
dataIndex: 'attendance_status',
|
|
|
|
|
className: "textcenter",
|
|
|
|
|
render: (text, record) => (
|
|
|
|
|
<span>
|
|
|
|
|
<Select key={record.index} defaultValue={record.attendance_status} className={"Signedinlistbox"} style={{ width: 167 }} onChange={(e)=>this.handleChange(e,record.user_id)}>
|
|
|
|
|
<Select key={record.index} defaultValue={record.attendance_status}
|
|
|
|
|
// className={"Signedinlistbox"}
|
|
|
|
|
className={record.attendance_status==="NORMAL"?"color26C7C9 Signedinlistbox sginboxcolor26C7C9":record.attendance_status==="LEAVE"?"colorEAAE4E Signedinlistbox sginboxcolorEAAE4E":record.attendance_status==="ABSENCE"?"colorFF835C Signedinlistbox sginboxcolorFF835C":"Signedinlistbox"}
|
|
|
|
|
|
|
|
|
|
style={{ width: 167 }} onChange={(e)=>this.handleChange(e,record.user_id)}>
|
|
|
|
|
{
|
|
|
|
|
newstate&&newstate.map((item,key)=>{
|
|
|
|
|
return(
|
|
|
|
|
<Option value={item.id} key={key}>{item.name}</Option>
|
|
|
|
|
<Option value={item.id} key={key}
|
|
|
|
|
className={item.name==="正常签到"?"color26C7C9 sginbox":item.name==="请 假"?"colorEAAE4E sginbox":item.name==="旷 课"?"colorFF835C sginbox":""}>{item.name}</Option>
|
|
|
|
|
)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
@ -265,11 +302,18 @@ class Signedinlist extends Component {
|
|
|
|
|
|
|
|
|
|
<Col className="gutter-row ml20" span={6}>
|
|
|
|
|
|
|
|
|
|
<Select defaultValue="全部状态" className={"Signedinlistbox"} style={{ width: 167 }} onChange={this.handleChangestate}>
|
|
|
|
|
<Select defaultValue="全部状态"
|
|
|
|
|
className={"Signedinlistbox"}
|
|
|
|
|
//className={attendance_status&&attendance_status==="NORMAL"?"color26C7C9 Signedinlistbox sginboxcolor26C7C9":attendance_status&&attendance_status==="LEAVE"?"colorEAAE4E Signedinlistbox sginboxcolorEAAE4E":attendance_status&&attendance_status==="ABSENCE"?"colorFF835C Signedinlistbox sginboxcolorFF835C":"Signedinlistbox"}
|
|
|
|
|
style={{ width: 167 }} onChange={this.handleChangestate}>
|
|
|
|
|
{
|
|
|
|
|
state&&state.map((item,key)=>{
|
|
|
|
|
return(
|
|
|
|
|
<Option value={item.id} key={key}>{item.name}</Option>
|
|
|
|
|
<Option value={item.id} key={key}
|
|
|
|
|
//className={item.name==="正常签到"?"color26C7C9":item.name==="请假"?"colorEAAE4E":item.name==="旷课"?"colorFF835C":""}
|
|
|
|
|
>
|
|
|
|
|
{item.name}
|
|
|
|
|
</Option>
|
|
|
|
|
)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|