From 9f6651463e83a64dd05524f01e317359bafef837 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 29 Oct 2019 10:12:33 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../exercise/Studentshavecompletedthelist.js | 184 ++++++++++-------- 1 file changed, 103 insertions(+), 81 deletions(-) diff --git a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js index 2c214bc57..1c4d051ff 100644 --- a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js +++ b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js @@ -877,6 +877,7 @@ class Studentshavecompletedthelist extends Component { key: 'stduynumber', align: 'center', className: "edu-txt-center font-14", + sorter: true, render: (text, record) => ( {record.stduynumber === "--" ? @@ -930,6 +931,7 @@ class Studentshavecompletedthelist extends Component { key: 'updatetime', align: 'center', className: "edu-txt-center font-14", + sorter: true, render: (text, record) => ( {record.updatetime==="--"? @@ -978,6 +980,7 @@ class Studentshavecompletedthelist extends Component { key: 'efficiencyscore', align: 'center', className: "edu-txt-center font-14", + sorter: true, render: (text, record) => ( {record.efficiencyscore === "--" ? @@ -1221,6 +1224,7 @@ class Studentshavecompletedthelist extends Component { }, ], exercise_status:0, + order_type: "desc", } // console.log("Studentshavecompletedthelist"); // console.log(props.current_status); @@ -1244,7 +1248,7 @@ class Studentshavecompletedthelist extends Component { }) } - this.Searchdatasys(this.state.order, this.state.course_groupyslstwo, this.state.review, this.state.checkedValuesineinfo, this.state.searchtext, pageNumber, 20); + this.Searchdatasys(this.state.order, this.state.course_groupyslstwo, this.state.review, this.state.checkedValuesineinfo, this.state.searchtext, pageNumber, 20, this.state.order_type); } paginationonChanges = (pageNumber) => { @@ -1459,9 +1463,9 @@ class Studentshavecompletedthelist extends Component { thiss.Generatenewdatasy(response.data.exercise_users, response); } }).catch((error) => { - console.log(error); - console.log("其实数据加载失败了"); - console.log("1111"); + // console.log(error); + // console.log("其实数据加载失败了"); + // console.log("1111"); }); @@ -2050,7 +2054,7 @@ class Studentshavecompletedthelist extends Component { }) } - Searchdatasys = (order, commit_status, review, exercise_group_id, search, page, limit) => { + Searchdatasys = (order, commit_status, review, exercise_group_id, search, page, limit, order_type) => { var exercise_id = this.props.match.params.Id; var url = `/exercises/${exercise_id}/exercise_lists.json`; axios.get((url), { @@ -2062,6 +2066,7 @@ class Studentshavecompletedthelist extends Component { search: search, page: page, limit: limit, + order_type: order_type } }).then((response) => { // console.log("528"); @@ -2098,7 +2103,7 @@ class Studentshavecompletedthelist extends Component { page:1, }) } - this.Searchdatasys(this.state.order, this.state.course_groupyslstwo, null, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit); + this.Searchdatasys(this.state.order, this.state.course_groupyslstwo, null, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit, this.state.order_type); } // notlimiteds = () => { // this.setState({ @@ -2125,7 +2130,7 @@ class Studentshavecompletedthelist extends Component { }) } - this.Searchdatasys(this.state.order, undefined, this.state.review, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit); + this.Searchdatasys(this.state.order, undefined, this.state.review, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit, this.state.order_type); } checkeboxstwo = (checkedValues, data) => { // console.log(checkedValues) @@ -2146,7 +2151,7 @@ class Studentshavecompletedthelist extends Component { }) } - this.Searchdatasys(this.state.order, checkedValues, this.state.review, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit); + this.Searchdatasys(this.state.order, checkedValues, this.state.review, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit, this.state.order_type); } else if (checkedValues.length === data.length) { if (this.state.loadingstate === false) { this.setState({ @@ -2163,10 +2168,10 @@ class Studentshavecompletedthelist extends Component { }) } - this.Searchdatasys(this.state.order, checkedValues, this.state.review, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit); + this.Searchdatasys(this.state.order, checkedValues, this.state.review, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit, this.state.order_type); } else { // console.log(checkedValues); - this.Searchdatasys(this.state.order, checkedValues, this.state.review, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit); + this.Searchdatasys(this.state.order, checkedValues, this.state.review, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit, this.state.order_type); if (this.state.loadingstate === false) { this.setState({ loadingstate: true, @@ -2196,7 +2201,7 @@ class Studentshavecompletedthelist extends Component { course_groups: null, unlimitedtwo: 0 }) - this.Searchdatasys(this.state.order, this.state.commit_status, this.state.review, undefined, this.state.searchtext, null, null) + this.Searchdatasys(this.state.order, this.state.commit_status, this.state.review, undefined, this.state.searchtext, null, null, this.state.order_type) } checkeboxs = (checkedValues, data) => { @@ -2225,7 +2230,7 @@ class Studentshavecompletedthelist extends Component { }) } - this.Searchdatasys(this.state.order, this.state.course_groupyslstwo, checkedValues, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit); + this.Searchdatasys(this.state.order, this.state.course_groupyslstwo, checkedValues, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit, this.state.order_type); } else if (checkedValues.length === data.length) { if (this.state.loadingstate === false) { this.setState({ @@ -2242,7 +2247,7 @@ class Studentshavecompletedthelist extends Component { }) } - this.Searchdatasys(this.state.order, this.state.course_groupyslstwo, checkedValues, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit); + this.Searchdatasys(this.state.order, this.state.course_groupyslstwo, checkedValues, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit, this.state.order_type); } else { // console.log(checkedValues); if (this.state.loadingstate === false) { @@ -2260,7 +2265,7 @@ class Studentshavecompletedthelist extends Component { }) } - this.Searchdatasys(this.state.order, this.state.course_groupyslstwo, checkedValues, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit); + this.Searchdatasys(this.state.order, this.state.course_groupyslstwo, checkedValues, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit, this.state.order_type); } } @@ -2283,7 +2288,7 @@ class Studentshavecompletedthelist extends Component { }) } - this.Searchdatasys(this.state.order, this.state.course_groupyslstwo, this.state.review, undefined, this.state.searchtext, 1, this.state.limit) + this.Searchdatasys(this.state.order, this.state.course_groupyslstwo, this.state.review, undefined, this.state.searchtext, 1, this.state.limit, this.state.order_type) } funtaskstatustwo = (checkedValues, data) => { @@ -2305,7 +2310,7 @@ class Studentshavecompletedthelist extends Component { }) } - this.Searchdatasys(this.state.order, this.state.course_groupyslstwo, this.state.review, checkedValues, this.state.searchtext, 1, this.state.limit) + this.Searchdatasys(this.state.order, this.state.course_groupyslstwo, this.state.review, checkedValues, this.state.searchtext, 1, this.state.limit, this.state.order_type) } else if (checkedValues.length === data.length) { if (this.state.loadingstate === false) { this.setState({ @@ -2322,7 +2327,7 @@ class Studentshavecompletedthelist extends Component { }) } - this.Searchdatasys(this.state.order, this.state.course_groupyslstwo, this.state.review, checkedValues, this.state.searchtext, 1, this.state.limit) + this.Searchdatasys(this.state.order, this.state.course_groupyslstwo, this.state.review, checkedValues, this.state.searchtext, 1, this.state.limit, this.state.order_type) } else { // console.log(checkedValues); if (this.state.loadingstate === false) { @@ -2343,7 +2348,7 @@ class Studentshavecompletedthelist extends Component { } - this.Searchdatasys(this.state.order, this.state.course_groupyslstwo, this.state.review, checkedValues, this.state.searchtext, 1, this.state.limit) + this.Searchdatasys(this.state.order, this.state.course_groupyslstwo, this.state.review, checkedValues, this.state.searchtext, 1, this.state.limit, this.state.order_type) this.props.setcourse_groupysls(checkedValues) } @@ -2364,7 +2369,7 @@ class Studentshavecompletedthelist extends Component { }) } - this.Searchdatasys(this.state.order, this.state.course_groupyslstwo, this.state.review, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit); + this.Searchdatasys(this.state.order, this.state.course_groupyslstwo, this.state.review, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit, this.state.order_type); } }; //搜索学生按钮输入 老师 @@ -2381,7 +2386,7 @@ class Studentshavecompletedthelist extends Component { }) } - this.Searchdatasys(this.state.order, this.state.course_groupyslstwo, this.state.review, this.state.checkedValuesineinfo, value, 1, this.state.limit); + this.Searchdatasys(this.state.order, this.state.course_groupyslstwo, this.state.review, this.state.checkedValuesineinfo, value, 1, this.state.limit, this.state.order_type); // this.Startsorting(this.state.order,this.state.checkedValuesine,this.state.checkedValuesineinfo,value); // console.log(value) @@ -2416,59 +2421,92 @@ class Studentshavecompletedthelist extends Component { }; - //排序 - funordersy = (e) => { - console.log(this.state.course_groupyslstwo); - if (e === "end_at") { - // 时间 - // 时间排序是从小到大 - if (this.state.loadingstate === false) { - this.setState({ - order: "end_at", - loadingstate: true, - }) - } else { - this.setState({ - order: "end_at", - }) + //试卷tbale 列表塞选数据 + table1handleChange = (pagination, filters, sorter) => { + //"ascend" 升序 + //"descend" 降序 + if (JSON.stringify(sorter) === "{}") { + //没有选择 + } else { + try { + //时间排序 + if (sorter.columnKey === "updatetime") { + if (sorter.order === "ascend") { + //升序 + this.setState({ + order: "end_at", + loadingstate: true, + order_type: "asc" + }) + this.Searchdatasys("end_at", this.state.course_groupyslstwo, this.state.review, this.state.checkedValuesineinfo, this.state.searchtext, this.state.page, this.state.limit, "asc"); + } else if (sorter.order === "descend") { + //降序 + this.setState({ + order: "end_at", + loadingstate: true, + order_type: "desc" + }) + this.Searchdatasys("end_at", this.state.course_groupyslstwo, this.state.review, this.state.checkedValuesineinfo, this.state.searchtext, this.state.page, this.state.limit, "desc"); + } + } + } catch (e) { + } - this.Searchdatasys(e, this.state.course_groupyslstwo, this.state.review, this.state.checkedValuesineinfo, this.state.searchtext, this.state.page,this.state.limit); - } + try { + //学生学号排序 + if (sorter.columnKey === "stduynumber") { + if (sorter.order === "ascend") { + //升序 + this.setState({ + order: "student_id", + loadingstate: true, + order_type: "asc" + }) + this.Searchdatasys("student_id", this.state.course_groupyslstwo, this.state.review, this.state.checkedValuesineinfo, this.state.searchtext, this.state.page, this.state.limit, "asc"); + + } else if (sorter.order === "descend") { + //降序 + this.setState({ + order: "student_id", + loadingstate: true, + order_type: "desc" + }) + this.Searchdatasys("student_id", this.state.course_groupyslstwo, this.state.review, this.state.checkedValuesineinfo, this.state.searchtext, this.state.page, this.state.limit, "desc"); - if (e === "score") { - // 成绩 - //成绩排序是从大到小 - if (this.state.loadingstate === false) { - this.setState({ - order: "score", - loadingstate: true, - }) - } else { - this.setState({ - order: "score", - }) + } + } + } catch (e) { } - this.Searchdatasys(e, this.state.course_groupyslstwo, this.state.review, this.state.checkedValuesineinfo, this.state.searchtext, this.state.page,this.state.limit); - } + try { + //成绩排序排序 + if (sorter.columnKey === "efficiencyscore") { + if (sorter.order === "ascend") { + //升序 + this.setState({ + order: "score", + loadingstate: true, + order_type: "asc" + }) + this.Searchdatasys("score", this.state.course_groupyslstwo, this.state.review, this.state.checkedValuesineinfo, this.state.searchtext, this.state.page, this.state.limit, "asc"); + + } else if (sorter.order === "descend") { + //降序 + this.setState({ + order: "score", + loadingstate: true, + order_type: "desc" + }) + this.Searchdatasys("score", this.state.course_groupyslstwo, this.state.review, this.state.checkedValuesineinfo, this.state.searchtext, this.state.page, this.state.limit, "desc"); + + } + } + } catch (e) { - if (e === "student_id") { - //学号 - //学号排序是从大到小 - if (this.state.loadingstate === false) { - this.setState({ - order: "student_id", - loadingstate: true, - }) - } else { - this.setState({ - order: "student_id", - }) } - this.Searchdatasys(e, this.state.course_groupyslstwo, this.state.review, this.state.checkedValuesineinfo, this.state.searchtext, this.state.page,this.state.limit); } } setExerciseReviewAndAnswer = () => { @@ -2634,23 +2672,6 @@ class Studentshavecompletedthelist extends Component { style={{color: '#FF6800'}}>{Teacherliststudentlist === undefined ? "0" : Teacherliststudentlist.exercise_types.total_users}个检索结果({Teacherliststudentlist === undefined ? "0" : Teacherliststudentlist.exercise_types.exercise_all_users}学生) -
- -
@@ -2675,6 +2696,7 @@ class Studentshavecompletedthelist extends Component { columns={columnsys} className="mysjysltable1" pagination={false} + onChange={this.table1handleChange} loading={loadingstate} // onChange={this.TablePaginationsy} />}