diff --git a/public/react/src/modules/courses/busyWork/CommonWorkList.js b/public/react/src/modules/courses/busyWork/CommonWorkList.js index 3b3491675..5a6d460c3 100644 --- a/public/react/src/modules/courses/busyWork/CommonWorkList.js +++ b/public/react/src/modules/courses/busyWork/CommonWorkList.js @@ -112,7 +112,7 @@ function buildColumns(that, student_works, studentData) { title: '学号', dataIndex: 'student_id', key: 'student_id', - + sorter: (a, b) => a.student_id - b.student_id, render: (text, record) => ( ( - + {record.group_name} ), @@ -201,6 +200,7 @@ function buildColumns(that, student_works, studentData) { title: '更新时间', dataIndex: 'update_time', key: 'update_time', + sorter: (a, b) => a.update_time - b.update_time, render: (update_time, record) => ( @@ -306,10 +306,12 @@ function buildColumns(that, student_works, studentData) { } if (!niPingAndIsStudent) { columns.push({ - width: 70, + width: '113px', title: '最终成绩', key: 'work_score', dataIndex: 'work_score', + sorter: (a, b) => a.work_score - b.work_score, + render: (work_score, record) => { return ( @@ -412,6 +414,7 @@ class CommonWorkList extends Component{ } componentDidMount() { + console.log("CommonWorkList 分班list 开始加载"); this.fetchList() on('commonwork_fetch_all', this.fetchAllListener) $("html").animate({ scrollTop: $('html').scrollTop() - 100 }); diff --git a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js index 2bf9035b2..f451ab55a 100644 --- a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js +++ b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js @@ -818,6 +818,7 @@ class Listofworksstudentone extends Component { }, ], b_order: "desc", + myorders: "desc", allow_late: false, checkedValuesine: undefined, checkedValuesineinfo: [], @@ -872,6 +873,7 @@ class Listofworksstudentone extends Component { key: 'stduynumber', align: "center", className: 'font-14 maxnamewidth110', + sorter: true, render: (text, record) => ( {record.stduynumber === undefined ? @@ -1091,6 +1093,7 @@ class Listofworksstudentone extends Component { key: 'finalscore', align: 'center', className: 'font-14', + sorter: true, render: (text, record) => ( { @@ -1530,6 +1533,7 @@ class Listofworksstudentone extends Component { // } // // } + componentDidMount() { // console.log("componentDidMount "); // console.log("调用子组件 "); @@ -1548,6 +1552,68 @@ class Listofworksstudentone extends Component { // this.Gettitleinformation(homeworkid); this.Getalistofworks(homeworkid, false); } + + //tbale 列表塞选数据 + table1handleChange = (pagination, filters, sorter) => { + //"ascend" 升序 + //"descend" 降序 + if (JSON.stringify(sorter) === "{}") { + //没有选择 + } else { + console.log(sorter); + try { + //学生学号排序 + if (sorter.columnKey === "stduynumber") { + if (sorter.order === "ascend") { + //升序 + this.setState({ + myorders: "asc", + orders: "student_id", + loadingstate: true, + }); + this.Startsortingt("student_id", this.state.course_groupyslstwo, this.state.checkedValuesineinfo, this.state.searchtext, this.state.page, this.state.limit, "asc"); + } else if (sorter.order === "descend") { + //降序 + this.setState({ + myorders: "desc", + orders: "student_id", + loadingstate: true, + }) + this.Startsortingt("student_id", this.state.course_groupyslstwo, this.state.checkedValuesineinfo, this.state.searchtext, this.state.page, this.state.limit, "desc"); + } + } + } catch (e) { + + } + + try { + //学生学号排序 + if (sorter.columnKey === "finalscore") { + if (sorter.order === "ascend") { + //升序 + this.setState({ + myorders: "asc", + orders: "work_score", + loadingstate: true, + }) + this.Startsortingt("work_score", this.state.course_groupyslstwo, this.state.checkedValuesineinfo, this.state.searchtext, this.state.page, this.state.limit, "asc"); + } else if (sorter.order === "descend") { + //降序 + this.setState({ + myorders: "desc", + orders: "work_score", + loadingstate: true, + }) + this.Startsortingt("work_score", this.state.course_groupyslstwo, this.state.checkedValuesineinfo, this.state.searchtext, this.state.page, this.state.limit, "desc"); + } + } + } catch (e) { + + } + + } + + } /////////老师操作 // tearchar=()=>{ // var homeworkid = this.props.match.params.homeworkid; @@ -2275,7 +2341,7 @@ class Listofworksstudentone extends Component { //开始排序操作 - Startsortingt = (ordervlue, checkedValuesine, checkedValuesineinfo, searchtext, page, limit) => { + Startsortingt = (ordervlue, checkedValuesine, checkedValuesineinfo, searchtext, page, limit, myorders) => { //要提交的作品状态checkedValuesine //要提交的分班状态checkedValuesineinfo //searchtext 输入的姓名和学号 @@ -2285,10 +2351,18 @@ class Listofworksstudentone extends Component { var homeworkid = this.props.match.params.homeworkid; let urll = `/homework_commons/${homeworkid}/works_list.json?`; - var order = "asc"; - if (ordervlue === "update_time") { - order = "desc"; + var order = this.state.order; + + try { + if (myorders === null || myorders === undefined) { + + } else { + order = myorders; + } + } catch (e) { + } + var checkedValuesines = checkedValuesine; var checkedValuesineinfos = checkedValuesineinfo; var searchtexts = searchtext @@ -2591,7 +2665,7 @@ class Listofworksstudentone extends Component { loadingstate: true, page: 1, }) - this.Startsortingt(this.state.orders, checkedValues, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit); + this.Startsortingt(this.state.orders, checkedValues, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit, this.state.myorders); } else if (checkedValues.length === data.length) { this.setState({ unlimited: 0, @@ -2599,7 +2673,7 @@ class Listofworksstudentone extends Component { loadingstate: true, page: 1, }) - this.Startsortingt(this.state.orders, checkedValues, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit); + this.Startsortingt(this.state.orders, checkedValues, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit, this.state.myorders); } else { // console.log(checkedValues); this.setState({ @@ -2608,7 +2682,7 @@ class Listofworksstudentone extends Component { loadingstate: true, page: 1, }) - this.Startsortingt(this.state.orders, checkedValues, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit); + this.Startsortingt(this.state.orders, checkedValues, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit, this.state.myorders); } } @@ -2625,7 +2699,7 @@ class Listofworksstudentone extends Component { loadingstate: true, page: 1, }) - this.Startsortingt(this.state.orders, this.state.course_groupyslstwo, checkedValues, this.state.searchtext, 1, this.state.limit); + this.Startsortingt(this.state.orders, this.state.course_groupyslstwo, checkedValues, this.state.searchtext, 1, this.state.limit, this.state.myorders); } else if (checkedValues.length === data.length) { this.setState({ unlimitedtwo: 1, @@ -2634,7 +2708,7 @@ class Listofworksstudentone extends Component { loadingstate: true, page: 1, }) - this.Startsortingt(this.state.orders, this.state.checcourse_groupyslstwokedValuesine, checkedValues, this.state.searchtext, 1, this.state.limit); + this.Startsortingt(this.state.orders, this.state.checcourse_groupyslstwokedValuesine, checkedValues, this.state.searchtext, 1, this.state.limit, this.state.myorders); } else { this.setState({ checkedValuesineinfo: checkedValues, @@ -2643,7 +2717,7 @@ class Listofworksstudentone extends Component { loadingstate: true, page: 1, }) - this.Startsortingt(this.state.orders, this.state.course_groupyslstwo, checkedValues, this.state.searchtext, 1, this.state.limit); + this.Startsortingt(this.state.orders, this.state.course_groupyslstwo, checkedValues, this.state.searchtext, 1, this.state.limit, this.state.myorders); } @@ -2676,7 +2750,7 @@ class Listofworksstudentone extends Component { page: 1, limit: 20, }) - this.Startsortingt(this.state.orders, this.state.course_groupyslstwo, this.state.checkedValuesineinfo, value, 1, 20); + this.Startsortingt(this.state.orders, this.state.course_groupyslstwo, this.state.checkedValuesineinfo, value, 1, 20, this.state.myorders); // console.log(value) @@ -2692,7 +2766,7 @@ class Listofworksstudentone extends Component { page: 1, limit: 20, }) - this.Startsortingt(this.state.orders, this.state.course_groupyslstwo, this.state.checkedValuesineinfo, this.state.searchtext, 1, 20); + this.Startsortingt(this.state.orders, this.state.course_groupyslstwo, this.state.checkedValuesineinfo, this.state.searchtext, 1, 20, this.state.myorders); } } //排序 @@ -2704,7 +2778,7 @@ class Listofworksstudentone extends Component { orders: "update_time", loadingstate: true, }) - this.Startsortingt("update_time", this.state.course_groupyslstwo, this.state.checkedValuesineinfo, this.state.searchtext, this.state.page, this.state.limit); + this.Startsortingt("update_time", this.state.course_groupyslstwo, this.state.checkedValuesineinfo, this.state.searchtext, this.state.page, this.state.limit, this.state.myorders); } if (e === "work_score") { @@ -2714,7 +2788,7 @@ class Listofworksstudentone extends Component { orders: "work_score", loadingstate: true, }) - this.Startsortingt("work_score", this.state.course_groupyslstwo, this.state.checkedValuesineinfo, this.state.searchtext, this.state.page, this.state.limit); + this.Startsortingt("work_score", this.state.course_groupyslstwo, this.state.checkedValuesineinfo, this.state.searchtext, this.state.page, this.state.limit, this.state.myorders); } if (e === "student_id") { @@ -2724,7 +2798,7 @@ class Listofworksstudentone extends Component { orders: "student_id", loadingstate: true, }) - this.Startsortingt("student_id", this.state.course_groupyslstwo, this.state.checkedValuesineinfo, this.state.searchtext, this.state.page, this.state.limit); + this.Startsortingt("student_id", this.state.course_groupyslstwo, this.state.checkedValuesineinfo, this.state.searchtext, this.state.page, this.state.limit, this.state.myorders); } } @@ -2771,7 +2845,7 @@ class Listofworksstudentone extends Component { .then((response) => { if (response.data.status == '0') { this.setState({visible: false}); - this.Startsortingt(this.state.orders, this.state.course_groupyslstwo, this.state.checkedValuesineinfo, this.state.searchtext, this.state.page, this.state.limit); + this.Startsortingt(this.state.orders, this.state.course_groupyslstwo, this.state.checkedValuesineinfo, this.state.searchtext, this.state.page, this.state.limit, this.state.myorders); this.props.showNotification(`调分成功`); } }) @@ -2958,7 +3032,7 @@ class Listofworksstudentone extends Component { loadingstate: true, page: 1, }) - this.Startsortingt(this.state.orders, [], this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit); + this.Startsortingt(this.state.orders, [], this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit, this.state.myorders); } notlimitedst = () => { @@ -2969,7 +3043,7 @@ class Listofworksstudentone extends Component { course_groupysls: undefined, loadingstate: true, }) - this.Startsortingt(this.state.orders, this.state.course_groupyslstwo, [], this.state.searchtext, 1, this.state.limit); + this.Startsortingt(this.state.orders, this.state.course_groupyslstwo, [], this.state.searchtext, 1, this.state.limit, this.state.myorders); } //立即截止确定按钮 coursetaskend = () => { @@ -3050,8 +3124,7 @@ class Listofworksstudentone extends Component { page: pageNumber, loadingstate: true, }) - this.Startsortingt(this.state.orders, this.state.course_groupyslstwo, this.state.checkedValuesineinfo, this.state.searchtext, pageNumber, this.state.limit); - + this.Startsortingt(this.state.orders, this.state.course_groupyslstwo, this.state.checkedValuesineinfo, this.state.searchtext, pageNumber, this.state.limit, this.state.myorders); } setComputeTimet = () => { @@ -3454,23 +3527,24 @@ class Listofworksstudentone extends Component { ` } -
- -
+ + {/*
*/} + {/* */} + {/*
*/} @@ -3514,6 +3588,7 @@ class Listofworksstudentone extends Component { dataSource={datajs} columns={columns} pagination={false} + onChange={this.table1handleChange} loading={loadingstate} />}