Bläddra i källkod

考场座位图 编辑是否有空位代码

娄底高职分支
ndbs 1 månad sedan
förälder
incheckning
0433a3417b
12 ändrade filer med 283 tillägg och 50 borttagningar
  1. +44
    -12
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/Exam_ExamRoomController.cs
  2. +124
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamRoom/FormSeat.cshtml
  3. +1
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamRoom/Index.cshtml
  4. +20
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamRoom/Index.js
  5. +1
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj
  6. +4
    -4
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamRoom/Exam_ExamRoomBLL.cs
  7. +1
    -1
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamRoom/Exam_ExamRoomIBLL.cs
  8. +22
    -26
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamRoom/Exam_ExamRoomService.cs
  9. +24
    -1
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamRoomDetail/Exam_ExamRoomDetailBLL.cs
  10. +1
    -1
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamRoomDetail/Exam_ExamRoomDetailEntity.cs
  11. +2
    -1
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamRoomDetail/Exam_ExamRoomDetailIBLL.cs
  12. +39
    -4
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamRoomDetail/Exam_ExamRoomDetailService.cs

+ 44
- 12
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/Exam_ExamRoomController.cs Visa fil

@@ -3,6 +3,7 @@ using System.Data;
using Learun.Application.TwoDevelopment.EducationalAdministration;
using System.Web.Mvc;
using System.Collections.Generic;
using System.Linq;

namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers
{
@@ -16,6 +17,7 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers
public class Exam_ExamRoomController : MvcControllerBase
{
private Exam_ExamRoomIBLL exam_ExamRoomIBLL = new Exam_ExamRoomBLL();
private Exam_ExamRoomDetailIBLL exam_ExamRoomDetailIBLL = new Exam_ExamRoomDetailBLL();

#region 视图功能

@@ -46,7 +48,11 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers
{
return View();
}

[HttpGet]
public ActionResult FormSeat()
{
return View();
}
#endregion

#region 获取数据
@@ -88,6 +94,23 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers
};
return Success(jsonData);
}

/// <summary>
/// 获取表单数据
/// </summary>
/// <param name="keyValue">主键</param>
/// <returns></returns>
public ActionResult GetClassRoomDetailData(string classroomNo, string AcademicYearNo, int? Semester)
{
var Exam_ExamRoomData = exam_ExamRoomIBLL.GetEntityByClassroomNo(classroomNo, AcademicYearNo, Semester);
var Exam_ExamRoomDetailData = exam_ExamRoomDetailIBLL.GetList("").Where(x => x.ClassRoomNo == classroomNo && x.AcademicYearNo == AcademicYearNo && x.Semester == Semester).OrderBy(x => x.ECOrder);
var jsonData = new
{
Exam_ExamRoomDetailData = Exam_ExamRoomDetailData,
Exam_ExamRoomData = Exam_ExamRoomData
};
return Success(jsonData);
}
#endregion

#region 提交数据
@@ -113,7 +136,8 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers
[AjaxOnly]
public ActionResult Import(string AcademicYearNo, string Semester, int SeatRows, int SeatColumns)
{
int res = exam_ExamRoomIBLL.Import(AcademicYearNo, Semester,SeatRows,SeatColumns);
int res = exam_ExamRoomIBLL.Import(AcademicYearNo, Semester, SeatRows, SeatColumns);
exam_ExamRoomIBLL.SeatEntity(AcademicYearNo, Semester);
return Success("导入" + res + "条数据!");
}
/// <summary>
@@ -139,9 +163,9 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers
public ActionResult SaveForm(string keyValue, string strEntity)
{
Exam_ExamRoomEntity entity = strEntity.ToObject<Exam_ExamRoomEntity>();
//判断考场编号有无重复
var model = exam_ExamRoomIBLL.GetEntityByClassroomNo(entity.ClassroomNo,entity.AcademicYearNo,entity.Semester);
var model = exam_ExamRoomIBLL.GetEntityByClassroomNo(entity.ClassroomNo, entity.AcademicYearNo, entity.Semester);
if (model != null && string.IsNullOrEmpty(keyValue))
{
return Fail("考场编号重复!");
@@ -159,13 +183,6 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers
}
return Success("保存成功!");
}
[HttpPost]
[AjaxOnly]
public ActionResult SeatForm(string AcademicYearNo, string Semester,string Type)
{
int res = exam_ExamRoomIBLL.SeatEntity(AcademicYearNo, Semester);
return Success("清空" + res + "条数据!");
}

/// <summary>
/// 启用/停用
@@ -180,7 +197,22 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers
exam_ExamRoomIBLL.Lock(keyValue, EREnabled);
return Success("操作成功!");
}
/// <summary>
/// 座位保存允许做人
/// </summary>
/// <param name="ClassroomNo"></param>
/// <param name="AcademicYearNo"></param>
/// <param name="Semester"></param>
/// <param name="list"></param>
/// <returns></returns>
[HttpPost]
[ValidateAntiForgeryToken]
[AjaxOnly]
public ActionResult SaveDetailForm(string ClassroomNo, string AcademicYearNo, int Semester, List<Exam_ExamRoomDetailEntity> list)
{
exam_ExamRoomDetailIBLL.SaveSaveDetailEntity(ClassroomNo, AcademicYearNo, Semester, list);
return Success("保存成功!");
}
#endregion

}
}

+ 124
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamRoom/FormSeat.cshtml Visa fil

@@ -0,0 +1,124 @@
@{
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}}排考座位表
<div class="btn btn-primary no-print" style="position:absolute;right:0;top:6px" v-on:click="printClick">打 印</div>
</div>
@*<div class="desc" style="display:flex;justifyContent:space-between;color:#666;padding:10px;">
<span>监考老师:{{dataOne.teach}}</span>
<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'}">
<div class="content" style="border:1px solid #ccc;padding:6px;">
<div>{{item.StuName}}</div>
{{item.SitNumber}}
</div>
</li>
</ul>
<div style="color:#333;font-size:14px;text-align:center;line-height:80px" v-if="isEmpty">暂无数据</div>
</div>
<script>
var vm = new Vue({
el: "#app",
data() {
return {
SeatList: [],
dataOne: {},
StuListColumns: [],
width: '10%',
isEmpty: false,
}
},
created() {
this.getData()
},
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')
},
type: "Post",
dataType: "json",
async: true,
cache: false,
success: (res) => {
console.log(res,"data")
if (res.code == 200) {
this.SeatList = res.data.SeatList || []
this.dataOne = res.data.dataOne || {}
if (!this.SeatList.length) {
this.isEmpty = true
return
}
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)
}
})
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) {
},
beforeSend: function () {
},

complete: function () {
}
})
},
printClick() {
$('.btn').css('display', 'none')
$('.SeatList').css('overflow', 'unset')
$('.SeatList').css('height', 'auto')
$('#app').jqprint({ noPrintSelector: ".no-print", })
$('.SeatList').css('height', '600px')
$('.SeatList').css('overflow', 'scroll')
$('.btn').css('display', 'block')
}
},
})
</script>

+ 1
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamRoom/Index.cshtml Visa fil

@@ -45,6 +45,7 @@
<div class=" btn-group btn-group-sm">
<a id="lr_importByBasic" class="btn btn-default"><i class="fa fa-plus"></i>&nbsp;从教室导入</a>
<a id="lr_emptyWhere" class="btn btn-default"><i class="fa fa-trash-o"></i>&nbsp;按条件清空数据</a>
<a id="lr_seat" class="btn btn-default"><i class="fa fa-plus"></i>&nbsp;座位</a>
</div>
</div>
</div>


+ 20
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamRoom/Index.js Visa fil

@@ -172,6 +172,26 @@ var bootstrap = function ($, learun) {
}
});

$('#lr_seat').on('click', function () {
var keyValue = $('#gridtable').jfGridValue('ERId');
var IsEdit = $('#gridtable').jfGridValue('IsEdit');
if (IsEdit.indexOf('false') != -1) {
learun.alert.warning("选中记录中包含不可编辑项目!");
return;
}
if (learun.checkrow(keyValue)) {
var AcademicYearNo = $('#gridtable').jfGridValue('AcademicYearNo');
var Semester = $('#gridtable').jfGridValue('Semester');
var classroomNo = $('#gridtable').jfGridValue('ClassroomNo');
learun.layerForm({
id: 'form_seat',
title: '座位',
width: 1200,
height: 800,
url: top.$.rootUrl + '/EducationalAdministration/Exam_ExamRoom/FormSeat?keyValue=' + keyValue + '&AcademicYearNo=' + AcademicYearNo + '&Semester=' + Semester + '&ClassRoomNo=' + classroomNo,
});
}
});
},
// 初始化列表
initGird: function () {


+ 1
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj Visa fil

@@ -8010,6 +8010,7 @@
<Content Include="Areas\EducationalAdministration\Views\Exam_ArrangeExamTermNew\IndexClassRoom.cshtml" />
<Content Include="Areas\EducationalAdministration\Views\StuScoreOfPrevious\Index.cshtml" />
<Content Include="Areas\EducationalAdministration\Views\StuScoreOfPrevious\ImportForm.cshtml" />
<Content Include="Areas\EducationalAdministration\Views\Exam_ExamRoom\FormSeat.cshtml" />
<None Include="Properties\PublishProfiles\CustomProfile.pubxml" />
<None Include="Properties\PublishProfiles\FolderProfile.pubxml" />
<Content Include="Views\Login\Default-beifen.cshtml" />


+ 4
- 4
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamRoom/Exam_ExamRoomBLL.cs Visa fil

@@ -166,7 +166,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
{
try
{
return exam_ExamRoomService.Import(AcademicYearNo, Semester,SeatRows,SeatColumns);
return exam_ExamRoomService.Import(AcademicYearNo, Semester, SeatRows, SeatColumns);
}
catch (Exception ex)
{
@@ -200,11 +200,11 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
}
}
}
public string SeatEntity(string AcademicYearNo, string Semester, int Type)
public void SeatEntity(string AcademicYearNo, string Semester)
{
try
{
exam_ExamRoomService.SeatEntity(AcademicYearNo, Semester, Type);
exam_ExamRoomService.SeatEntity(AcademicYearNo, Semester);
}
catch (Exception ex)
{
@@ -218,7 +218,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
}
}
}
#endregion

}


+ 1
- 1
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamRoom/Exam_ExamRoomIBLL.cs Visa fil

@@ -52,7 +52,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration

int Import(string AcademicYearNo, string Semester, int SeatRows, int SeatColumns);
int DeleteWhere(string AcademicYearNo, string Semester);
string SeatEntity(string AcademicYearNo, string Semester, int Type);
void SeatEntity(string AcademicYearNo, string Semester);
#endregion

}


+ 22
- 26
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamRoom/Exam_ExamRoomService.cs Visa fil

@@ -327,7 +327,7 @@ select NEWID(),'{AcademicYearNo}','{Semester}',ClassroomName,[ClassroomNo],{Seat
{
try
{
string sql = $"delete Exam_ExamRoom where AcademicYearNo='{AcademicYearNo}' and Semester='{Semester}' and IsEdit = 'true'";
string sql = $"delete Exam_ExamRoom where AcademicYearNo='{AcademicYearNo}' and Semester='{Semester}' and IsEdit = 'true';delete Exam_ExamRoomdetail where AcademicYearNo ='" + AcademicYearNo + "' and Semester='" + Semester + "' and IsEdit = 1 ;";
return this.BaseRepository("CollegeMIS").ExecuteBySql(sql);
}
catch (Exception ex)
@@ -346,42 +346,38 @@ select NEWID(),'{AcademicYearNo}','{Semester}',ClassroomName,[ClassroomNo],{Seat


/// <summary>
/// 删除实体数据
/// 考场座位表
/// </summary>
/// <param name="keyValue">主键</param>
public string SeatEntity(string AcademicYearNo, int Semester, int Type)
public void SeatEntity(string AcademicYearNo, string Semester)
{
var db = this.BaseRepository().BeginTrans();
var db = this.BaseRepository("CollegeMIS").BeginTrans();
try
{
if (Type == 1)
var intSemester = Convert.ToInt32(Semester);
var room = db.FindList<Exam_ExamRoomEntity>().Where(x => x.AcademicYearNo == AcademicYearNo && x.Semester == intSemester).ToList();
List<Exam_ExamRoomDetailEntity> entityList = new List<Exam_ExamRoomDetailEntity>();
if (room.Count() > 0)
{
var room = db.FindList<Exam_ExamRoomEntity>().Where(x => x.AcademicYearNo == AcademicYearNo && x.Semester == Semester).ToList();
if (room.Count() > 0)
for (int i = 0; i < room.Count(); i++)
{
Exam_ExamRoomDetailEntity entity = new Exam_ExamRoomDetailEntity();
for (int i = 0; i < room.Count(); i++)
for (int j = 0; j < room[i].SeatCount; j++)
{
for (int j = 0; j < room[i].SeatCount; j++)
{
entity.AcademicYearNo = AcademicYearNo;
entity.Semester = Semester;
entity.ClassRoomNo = room[j].ClassroomNo;
entity.ClassRoomName = room[j].ClassroomName;
entity.ECOrder = i + 1;
entity.Create();
db.Insert(entity);
}
room[i].IsEdit = false;//修改为不可编辑
var entity = new Exam_ExamRoomDetailEntity();
entity.AcademicYearNo = AcademicYearNo;
entity.Semester = intSemester;
entity.ClassRoomNo = room[i].ClassroomNo;
entity.ClassRoomName = room[i].ClassroomName;
entity.ECOrder = j + 1;
entity.ECEnabled = true;
entity.Create();
entityList.Add(entity);
}
room[i].IsEdit = true;
}
db.Update(room);//修改为不可编辑
}
else
{
var sql = "delete from Exam_ExamRoomDetail where AcademicYearNo ='" + AcademicYearNo + "' and Semester='"+ Semester + "'; update Exam_ExamRoom set IsEdit = 1 where AcademicYearNo ='" + AcademicYearNo + "' and Semester='; ";
this.BaseRepository("CollegeMIS").ExecuteBySql(sql);
}
db.Insert(entityList);
db.Update(room);
db.Commit();
}
catch (Exception ex)


+ 24
- 1
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamRoomDetail/Exam_ExamRoomDetailBLL.cs Visa fil

@@ -138,7 +138,30 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
}
}
}
/// <summary>
/// 保存实体数据(新增、修改)
/// </summary>
/// <param name="keyValue">主键</param>
/// <param name="entity">实体</param>
/// <returns></returns>
public void SaveSaveDetailEntity(string ClassroomNo, string AcademicYearNo, int Semester, List<Exam_ExamRoomDetailEntity> entity)
{
try
{
exam_ExamRoomDetailService.SaveSaveDetailEntity(ClassroomNo, AcademicYearNo, Semester,entity);
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowBusinessException(ex);
}
}
}
#endregion

}


+ 1
- 1
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamRoomDetail/Exam_ExamRoomDetailEntity.cs Visa fil

@@ -51,7 +51,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
[Column("ACADEMICYEARNO")]
public string AcademicYearNo { get; set; }
/// <summary>
/// EPRId
/// Semester
/// </summary>
/// <returns></returns>
[Column("Semester")]


+ 2
- 1
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamRoomDetail/Exam_ExamRoomDetailIBLL.cs Visa fil

@@ -45,7 +45,8 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
/// <param name="keyValue">主键</param>
/// <param name="entity">实体</param>
void SaveEntity(string keyValue, Exam_ExamRoomDetailEntity entity);
void SaveSaveDetailEntity(string ClassroomNo, string AcademicYearNo, int Semester, List<Exam_ExamRoomDetailEntity> entity);

#endregion

}


+ 39
- 4
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamRoomDetail/Exam_ExamRoomDetailService.cs Visa fil

@@ -197,10 +197,45 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
}
}
}

/// 自动生成班级有多少个座位
/// 开始考试后/考试安排以后不可编辑班级座位
///
/// <summary>
/// 保存实体数据(新增、修改)
/// </summary>
/// <param name="keyValue">主键</param>
/// <param name="entity">实体</param>
public void SaveSaveDetailEntity(string ClassroomNo , string AcademicYearNo,int Semester,List<Exam_ExamRoomDetailEntity> entity)
{
var db = this.BaseRepository("CollegeMIS").BeginTrans();
try
{
var del = db.FindList<Exam_ExamRoomDetailEntity>(x=>x.ClassRoomNo== ClassroomNo&& x.AcademicYearNo== AcademicYearNo&& x.Semester== Semester);
db.Delete(del);
if (entity.Count()>0)
{
entity.OrderBy(x => x.ECOrder);
for (int i = 0; i < entity.Count(); i++)
{
var insertEntity = new Exam_ExamRoomDetailEntity();
insertEntity.ClassRoomNo = entity[i].ClassRoomNo;
insertEntity.ClassRoomName = entity[i].ClassRoomName;
insertEntity.ECEnabled = entity[i].ECEnabled;
insertEntity.ECOrder = i+1;
}
}
db.Commit();
}
catch (Exception ex)
{
db.Rollback();
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowServiceException(ex);
}
}
}
#endregion

}


Laddar…
Avbryt
Spara