@ -14,7 +14,7 @@ class Signedinlist extends Component {
limit : 5 ,
limit : 5 ,
page : 1 ,
page : 1 ,
loading : false ,
loading : false ,
attendanceslist : [ {id : undefined , name : "全部分班" } ],
attendanceslist : [ ],
data : null ,
data : null ,
group _ids : [ ] ,
group _ids : [ ] ,
members _count : 0 ,
members _count : 0 ,
@ -23,12 +23,12 @@ class Signedinlist extends Component {
{ id : undefined , name : "全部状态" } ,
{ id : undefined , name : "全部状态" } ,
{ id : "NORMAL" , name : "正常签到" } ,
{ id : "NORMAL" , name : "正常签到" } ,
{ id : "LEAVE" , name : "请 假" } ,
{ id : "LEAVE" , name : "请 假" } ,
{ id : "ABSENCE" , name : "旷 课 "} ,
{ id : "ABSENCE" , name : this . props . defaultActiveKey === "2" ? "旷 课 ": "未签到 "} ,
] ,
] ,
newstate : [
newstate : [
{ id : "NORMAL" , name : "正常签到" } ,
{ id : "NORMAL" , name : "正常签到" } ,
{ id : "LEAVE" , name : "请 假" } ,
{ id : "LEAVE" , name : "请 假" } ,
{ id : "ABSENCE" , name : "旷 课 "} ,
{ id : "ABSENCE" , name : this . props . defaultActiveKey === "2" ? "旷 课 ": "未签到 "} ,
] ,
] ,
course _members _count : '--' ,
course _members _count : '--' ,
attendance _count : '--' ,
attendance _count : '--' ,
@ -36,17 +36,15 @@ class Signedinlist extends Component {
}
}
componentDidMount ( ) {
componentDidMount ( ) {
this . getdatas ( this . props && this . props . switattendance _id , 1 , [ ] , undefined )
this . getdatas ( this . props && this . props . switattendance _id , 1 , [ ] , undefined )
// this.getpath()
// this.getpath()
}
}
componentDidUpdate ( prevProps , prevState ) {
componentDidUpdate ( prevProps , prevState ) {
if ( prevProps . headdata != this . props . headdata ) {
if ( prevProps . headdata != this . props . headdata ) {
let { attendanceslist } = this . state ;
if ( this . props . headdata ) {
if ( this . props . headdata ) {
let listattendanceslist = attendanceslist ;
let listattendanceslist = [ ] ;
listattendanceslist . push ( { id : undefined , name : "全部分班" } )
if ( this . props . headdata . course _groups ) {
if ( this . props . headdata . course _groups ) {
if ( this . props . headdata . course _groups . length > 0 ) {
if ( this . props . headdata . course _groups . length > 0 ) {
@ -56,7 +54,7 @@ class Signedinlist extends Component {
}
}
}
}
this . setState ( {
this . setState ( {
list attendanceslist: listattendanceslist ,
attendanceslist: listattendanceslist ,
data : this . props . headdata ,
data : this . props . headdata ,
course _members _count : this . props . headdata . normal _count ,
course _members _count : this . props . headdata . normal _count ,
attendance _count : this . props . headdata . all _count
attendance _count : this . props . headdata . all _count
@ -128,7 +126,7 @@ class Signedinlist extends Component {
let url = ` /weapps/attendances/ ${ this . props && this . props . switattendance _id } .json ` ;
let url = ` /weapps/attendances/ ${ this . props && this . props . switattendance _id } .json ` ;
axios . get ( url ) . then ( ( response ) => {
axios . get ( url ) . then ( ( response ) => {
if ( response . data ) {
if ( response . data ) {
listattendanceslist . push ( { id : undefined , name : "全部分班" } )
if ( response . data . course _groups . length > 0 ) {
if ( response . data . course _groups . length > 0 ) {
response . data . course _groups . map ( ( item , key ) => {
response . data . course _groups . map ( ( item , key ) => {
listattendanceslist . push ( item )
listattendanceslist . push ( item )
@ -151,7 +149,7 @@ class Signedinlist extends Component {
} )
} )
}
}
this . setState ( {
this . setState ( {
list attendanceslist: listattendanceslist ,
attendanceslist: listattendanceslist ,
data : response . data
data : response . data
} )
} )
@ -161,7 +159,6 @@ class Signedinlist extends Component {
}
}
handleChangestate = ( value ) => {
handleChangestate = ( value ) => {
let neval
let neval
if ( ! value ) {
if ( ! value ) {
neval = undefined
neval = undefined
this . setState ( {
this . setState ( {
@ -214,6 +211,7 @@ class Signedinlist extends Component {
this . setState ( {
this . setState ( {
member _attendances : newmember _attendances
member _attendances : newmember _attendances
} )
} )
this . props . mygetdatas ( )
}
}
} )
} )
. catch ( function ( error ) {
. catch ( function ( error ) {
@ -264,14 +262,14 @@ class Signedinlist extends Component {
< span >
< span >
< Select key = { record . index } defaultValue = { record . attendance _status }
< Select key = { record . index } defaultValue = { record . attendance _status }
// className={"Signedinlistbox"}
// 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" }
className = { record . attendance _status === "NORMAL" ? "color26C7C9 Signedinlistbox sginboxcolor26C7C9" : record . attendance _status === "LEAVE" ? "colorEAAE4E Signedinlistbox sginboxcolorEAAE4E" : record . attendance _status === "ABSENCE" ? this . props . defaultActiveKey === "2" ? "colorFF835C Signedinlistbox sginboxcolorFF835C ": "color909399 Signedinlistbox sginboxcolor909399 ": "Signedinlistbox" }
style = { { width : 167 } } onChange = { ( e ) => this . handleChange ( e , record . user _id ) } >
style = { { width : 167 } } onChange = { ( e ) => this . handleChange ( e , record . user _id ) } >
{
{
newstate && newstate . map ( ( item , key ) => {
newstate && newstate . map ( ( item , key ) => {
return (
return (
< Option value = { item . id } key = { key }
< Option value = { item . id } key = { key }
className = { item . name === "正常签到" ? "color26C7C9 sginbox" : item . name === "请 假" ? "colorEAAE4E sginbox" : item . name === "旷 课" ? "colorFF835C sginbox" : "" } > { item . name } < / O p t i o n >
className = { item . name === "正常签到" ? "color26C7C9 sginbox" : item . name === "请 假" ? "colorEAAE4E sginbox" : item . name === "旷 课" ? "colorFF835C sginbox" : item . name === "未签到" ? "color909399 sginbox" : "" } > { item . name } < / O p t i o n >
)
)
} )
} )
}
}