@@ -2,7 +2,6 @@
ViewBag.Title = "考场信息-查看";
Layout = "~/Views/Shared/_Index.cshtml";
}
<link href="~/Content/css/UserCenter/user.css" rel="stylesheet" />
<div id="app" style="padding:20px;">
<div class="title" style="font-size:18px;color:#333;lineHeight:50px;textAlign:center;position:relative;">
{{dataOne.tClassroomName}}排考座位表
@@ -13,16 +12,17 @@
<span>考试时间:{{dataOne.EaxmStartTime}}{{dataOne.EaxmEndTime}}</span>
</div>*@
<ul class="SeatList" style="overflow:scroll;height:600px">
<li v-for="item in SeatList" :key="item.SitNumber " :style="{width:width,float:'left',padding:'36px 10px',height:'58px',textAlign:'center'}">
<li v-for="(item,index) in SeatList" :ECEnabled="item.ECEnabled" v-on:click="itemClick(index)" :key="index " :style="{width:width,float:'left',padding:'36px 10px',height:'58px',textAlign:'center',color:item.ECEnabled?'#E6A23C':'#409EFF '}">
<div class="content" style="border:1px solid #ccc;padding:6px;">
<div>{{item.StuName }}</div>
{{item.SitNumb er}}
<div>{{item.ECEnabled?'禁用':'正常' }}</div>
{{item.ECOrd er}}
</div>
</li>
</ul>
<div style="color:#333;font-size:14px;text-align:center;line-height:80px" v-if="isEmpty">暂无数据</div>
</div>
<script>
var acceptClick;
var vm = new Vue({
el: "#app",
data() {
@@ -37,17 +37,12 @@
created() {
this.getData()
},
mounted() {
acceptClick = this.submit
},
methods: {
getData: function () {
$.ajax({
//保存接口
//传参学年学期,考场编号+名称 +list(ECorder,EcEnbaled)空就是fasle 允许有人就是true
//$.lrSaveForm(top.$.rootUrl + '/EducationalAdministration/Exam_ExamRoom/SaveDetailForm?keyValue=' + keyValue, postData, function (res) {
// // 保存成功后才回调
// if (!!callBack) {
// callBack();
// }
//});
url: '/EducationalAdministration/Exam_ExamRoom/GetClassRoomDetailData',
data: {
ClassRoomNo: request('ClassRoomNo'), AcademicYearNo: request('AcademicYearNo'), Semester: request('Semester')
@@ -57,48 +52,36 @@
async: true,
cache: false,
success: (res) => {
console.log(res,"data")
console.log(res, "data")
if (res.code == 200) {
this.SeatList = res.data.SeatList || []
this.dataOne = res.data.dataOne || {}
if (!this. SeatList.length) {
let SeatList = res.data.Exam_ExamRoomDetailData || []
this.dataOne = res.data.Exam_ExamRoomData || {}
if (!SeatList.length) {
this.isEmpty = true
return
}
//多少列
let cols = this.dataOne.SeatColumns
//多少行
let rows = this.dataOne.SeatRows
//列的宽度
this.width = 100 / this.dataOne.SeatColumns + '%'
//1列:[],2:[]
let data = {}
//计算出多少行
let rows = Math.ceil(res.data.SeatList.length / this.dataOne.SeatColumns);
if (rows == 1) return
//最后一行个数(行全的列数)
let lastRow = res.data.SeatList.length % this.dataOne.SeatColumns
lastRow = lastRow || this.dataOne.SeatColumns
//不缺一行的列数据总个数
let wholeItems = rows * lastRow
let colCurrent = 1
this.SeatList.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)
function arrayToMatrix(arr, size) {
var matrix = [], index = 0;
for (var i = 0; i < arr.length; i += size) {
let pushArr = arr.slice(i, i + size)
if (index % 2 !== 0) pushArr.reverse();
index += 1
matrix.push(pushArr);
}
return matrix;
}
SeatList = arrayToMatrix(SeatList, rows)
for (let row = 0; row < rows; row++) {
for (let col = 0; col < cols; col++) {
this.SeatList.push(SeatList[col][row])
}
})
let arr = []
for (let i = 0; i < rows; i++) {
Object.values(data).forEach(e => {
if (e[i]) {
arr.push(e[i])
}
})
}
this.SeatList = arr
}
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
@@ -110,6 +93,24 @@
}
})
},
itemClick(index) {
//保存接口
//传参学年学期,考场编号+名称 +list(ECorder,EcEnbaled)空就是fasle 允许有人就是true
this.SeatList[index].ECEnabled = !this.SeatList[index].ECEnabled
},
submit(callBack) {
var postData = {
ClassRoomNo: request('ClassRoomNo'), AcademicYearNo: request('AcademicYearNo'), Semester: Number(request('Semester')),
list: this.SeatList
};
$.lrSaveForm(top.$.rootUrl + '/EducationalAdministration/Exam_ExamRoom/SaveDetailForm?keyValue=' + request('keyValue'), postData, function (res) {
// 保存成功后才回调
if (!!callBack) {
callBack();
}
});
},
printClick() {
$('.btn').css('display', 'none')
$('.SeatList').css('overflow', 'unset')