diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ArrangeExamTermNew/SeatForm.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ArrangeExamTermNew/SeatForm.cshtml index 9d7763c13..6172674ec 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ArrangeExamTermNew/SeatForm.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ArrangeExamTermNew/SeatForm.cshtml @@ -54,9 +54,43 @@ this.dataOne = res.data.dataOne || {} if (!this.StuList.length) { this.isEmpty = true + return } - //this.dataOne.SeatColumns = 12 - this.width = 100 / (this.dataOne.SeatColumns || 10) + '%' + this.width = 100 / this.dataOne.SeatColumns + '%' + //1列:[],2:[] + let data = {} + //计算出多少行 + let rows = Math.ceil(res.data.StuList.length / this.dataOne.SeatColumns); + if (rows == 1) return + //最后一行个数(行全的列数) + let lastRow = res.data.StuList.length % this.dataOne.SeatColumns + lastRow = lastRow || this.dataOne.SeatColumns + //不缺一行的列数据总个数 + let wholeItems = rows * lastRow + let colCurrent = 1 + this.StuList.forEach((e, i) => { + if (i + 1 <= wholeItems) { + colCurrent = Math.ceil((i + 1) / rows) + colCurrent = colCurrent || 1 + if (!data[colCurrent]) data[colCurrent] = [] + data[colCurrent].push(e) + } else { + let colCurrent_ = Math.ceil((i + 1 - wholeItems) / (rows-1)) + colCurrent_ = colCurrent_ || 1 + if (!data[colCurrent_ + colCurrent]) data[colCurrent_ + colCurrent] = [] + data[colCurrent_ + colCurrent].push(e) + } + }) + console.log(data) + let arr = [] + for (let i = 0; i < rows; i++) { + Object.values(data).forEach(e => { + if (e[i]) { + arr.push(e[i]) + } + }) + } + this.StuList = arr } }, error: function (XMLHttpRequest, textStatus, errorThrown) {