From d52a07bec94bd9c03a107c6bf599534176ed2aa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Fri, 13 Mar 2020 22:49:07 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/signin/css/Signinstatistics.css | 40 +++ .../courses/signin/student/Signedinlist.js | 255 +++++++++++++++++- 2 files changed, 282 insertions(+), 13 deletions(-) diff --git a/public/react/src/modules/courses/signin/css/Signinstatistics.css b/public/react/src/modules/courses/signin/css/Signinstatistics.css index 820d07f1c..0cd32b0a4 100644 --- a/public/react/src/modules/courses/signin/css/Signinstatistics.css +++ b/public/react/src/modules/courses/signin/css/Signinstatistics.css @@ -121,4 +121,44 @@ #form_in_modal_end_time{ height:40px; background: #fafafa !important; +} + +.Signedinlistbox .ant-select-selection--single{ + height:40px !important; + background:rgba(255,255,255,1); + border:1px solid rgba(234,234,234,1); + border-radius:4px; +} + +.Signedinlistbox .ant-select-selection__rendered{ + line-height: 40px !important; +} + +.Signedintextright{ + text-align: right; +} + +.color26C7C9{ + color:#26C7C9; +} + +.colorEAAE4E{ + color:#EAAE4E; +} + +.colorFF835C{ + color:#FF835C; +} + +.color1890FF{ + color:#1890FF; +} + +.backfff .ant-table-thead tr th{ + background: #fff; + border-bottom:1px solid #EBEBEB !important; +} + +.textcenter{ + text-align: center !important; } \ No newline at end of file diff --git a/public/react/src/modules/courses/signin/student/Signedinlist.js b/public/react/src/modules/courses/signin/student/Signedinlist.js index 6abafe580..92d35f125 100644 --- a/public/react/src/modules/courses/signin/student/Signedinlist.js +++ b/public/react/src/modules/courses/signin/student/Signedinlist.js @@ -1,35 +1,264 @@ +import "../css/Signinstatistics.css" import React,{ Component } from "react"; -import { Row, Col,Select } from 'antd'; - +import { Row, Col,Select,Table,Pagination } from 'antd'; +import axios from 'axios'; const { Option } = Select; class Signedinlist extends Component { + constructor(props) { super(props) + this.state={ + limit:5, + page:1, + loading:false, + attendanceslist:[{id:undefined,name:"全部分班"}], + data:null, + group_ids:[], + members_count:0, + attendance_status:undefined, + state:[ + {id:undefined,name:"全部状态"}, + {id:"NORMAL",name:"正常出勤"}, + {id:"LEAVE",name:"请假"}, + {id:"ABSENCE",name:"旷课"}, + ], + newstate:[ + {id:"NORMAL",name:"正常出勤"}, + {id:"LEAVE",name:"请假"}, + {id:"ABSENCE",name:"旷课"}, + ] + } + } + + componentDidMount() { + console.log(this.props.headdata) + 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) + }) + } + this.setState({ + listattendanceslist:attendanceslist, + data:response.data + }) + + } + + }) + this.getdatas(this.props&&this.props.switattendance_id,1,[],undefined) + } + + getdatas=(id,page,group_ids,attendance_status)=>{ + this.setState({ + loading:true, + member_attendances:[], + }) + let that=this; + let url=`/weapps/course_member_attendances.json`; + axios.get(url,{params:{ + group_ids:group_ids, + attendance_id:id, + attendance_status:attendance_status, + page:page, + limit:5, + } + }).then((response) => { + + if(response){ + this.setState({ + member_attendances:response.data.member_attendances, + members_count:response.data.members_count, + loading:false + }) + + } + }).catch((error) => { + that.setState({ + loading:false + }) + + }); } - handleChange=(value)=>{ - console.log(`selected ${value}`); + handleChangegroup_ids=(e)=>{ + console.log(this.props.headdata) + console.log(e) + return + let neval + if(!value){ + neval=[] + this.setState({ + group_ids: [], + }) + }else{ + neval=[value] + this.setState({ + group_ids: [value], + }) + } + + let {page,attendance_status}=this.state; + this.getdatas(this.props&&this.props.switattendance_id,page,neval,attendance_status) + } + handleChangestate=(value)=>{ + let neval + + if(!value){ + neval=undefined + this.setState({ + attendance_status:undefined, + }) + }else{ + neval=value + this.setState({ + attendance_status: value, + }) + } + + let {page,group_ids}=this.state; + this.getdatas(this.props&&this.props.switattendance_id,page,group_ids,neval) + } + paginationonChange = (pageNumber) => { + this.setState({ + page: pageNumber, + }) + let {group_ids,attendance_status}=this.state; + this.getdatas(this.props&&this.props.switattendance_id,pageNumber,group_ids,attendance_status) + + } + + handleChange=(attendance_status,value)=>{ + let url=`/weapps/course_member_attendances/update_status.json`; + + axios.post(url, { + attendance_id:this.props.switattendance_id, + attendance_status:attendance_status, + course_id:this.props.match.params.coursesId, + user_id: value, + }) + .then((response) => { + if (response.data.status == 0) { + this.props.showNotification(`修改状态成功`); + + } + }) + .catch(function (error) { + console.log(error); + }); + + + } render() { + let {attendanceslist,state,data,member_attendances,newstate}=this.state; + + const columns = [ + { + title: '序号', + dataIndex: 'index', + key: 'index', + className: "textcenter", + }, + { + title: '姓名', + dataIndex: 'user_name', + key: 'user_name', + className: "textcenter", + }, + { + title: '学号', + dataIndex: 'student_id', + key: 'student_id', + className: "textcenter", + }, + { + title: '状态', + key: 'attendance_status', + dataIndex: 'attendance_status', + render: (text, record) => ( + + + + ), + }, + ]; return( - - - - + {attendanceslist&&attendanceslist.map((item,key)=>{ + return( + + ) + })} + + + + + + + + + + + + + + + + {this.props.defaultActiveKey==="2"? + 正常签到:{data&&data.normal_count} + 请假:{data&&data.leave_count} + 旷课:{data&&data.absence_count} + : + 已签到:33 + 应签到:33 + } + + + - col-12 +
+ + + +
+ +
)