@@ -5,6 +5,7 @@ | |||
* 描 述:选课专业 | |||
*/ | |||
var refreshGirdData; | |||
var acceptClick; | |||
var OLPOEId = request("OLPOEId"); | |||
var bootstrap = function ($, learun) { | |||
"use strict"; | |||
@@ -129,8 +130,17 @@ var bootstrap = function ($, learun) { | |||
$('#gridtablemanagemajor').jfGridSet('reload', { queryJson: JSON.stringify(param) }); | |||
} | |||
}; | |||
refreshGirdData = function () { | |||
page.search(); | |||
}; | |||
// 保存数据 | |||
acceptClick = function (callBack) { | |||
if (!!callBack) { | |||
learun.layerClose(window.name); | |||
callBack(); | |||
} | |||
}; | |||
page.init(); | |||
} |
@@ -40,7 +40,10 @@ var bootstrap = function ($, learun) { | |||
url: top.$.rootUrl + '/EducationalAdministration/ElectiveMajor/Index?OLPOEId=' + keyValue, | |||
width: 1000, | |||
height: 700, | |||
btn: null | |||
//btn: null | |||
callBack: function (id) { | |||
return top[id].acceptClick(refreshGirdData); | |||
} | |||
}); | |||
} | |||
@@ -222,18 +225,29 @@ var bootstrap = function ($, learun) { | |||
{ label: "通过人数", name: "StuNum", width: 60, align: "left" }, | |||
{ label: "已报人数(预)", name: "StuNumOfApplyPre", width: 80, align: "left" }, | |||
{ label: "通过人数(预)", name: "StuNumPre", width: 80, align: "left" }, | |||
//{ | |||
// label: "选课专业", name: "ElectiveMajorList", width: 150, align: "left",formatter: function (cellvalue,row) { | |||
// var str = ""; | |||
// for (var i = 0; i < row.ElectiveMajorList.length; i++) { | |||
// str += row.ElectiveMajorList[i].Grade + "级" + row.ElectiveMajorList[i].MajorName; | |||
// if (i != row.ElectiveMajorList.length - 1) { | |||
// str += ","; | |||
// } | |||
// } | |||
// return str; | |||
// } | |||
//} | |||
{ | |||
label: "是否已选专业", name: "IsElectiveMajor", width: 100, align: "left", formatter: function (cellvalue,row) { | |||
if (!!row.ElectiveMajorList && row.ElectiveMajorList.length > 0) { | |||
return "<span class=\"label label-success\">是</span>"; | |||
} else { | |||
return "<span class=\"label label-default\">否</span>"; | |||
} | |||
} | |||
}, | |||
{ | |||
label: "选课专业", name: "ElectiveMajorList", width: 150, align: "left", formatter: function (cellvalue, row) { | |||
var str = ""; | |||
if (!!cellvalue && cellvalue.length > 0) { | |||
for (var i = 0; i < cellvalue.length; i++) { | |||
str += cellvalue[i].Grade + "级" + cellvalue[i].MajorName; | |||
if (i != cellvalue.length - 1) { | |||
str += ","; | |||
} | |||
} | |||
} | |||
return str; | |||
} | |||
} | |||
], | |||
mainId: 'Id', | |||
isPage: true, | |||
@@ -4,6 +4,7 @@ using Learun.Util; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Data; | |||
using System.Linq; | |||
using System.Text; | |||
namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
@@ -261,18 +262,23 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
{ | |||
var now = DateTime.Now; | |||
var loginInfo = LoginUserInfo.Get(); | |||
var list = db.FindList<ElectiveMajorEntity>(x => x.OLPOEId == olpoeId); | |||
//添加 | |||
foreach (var item in dataList) | |||
{ | |||
var entity = new ElectiveMajorEntity(); | |||
entity.Create(); | |||
entity.OLPOEId = olpoeId; | |||
entity.MajorId = item.ID; | |||
entity.Grade = item.Grade; | |||
entity.CreateUserId = loginInfo.userId; | |||
entity.CreateUserName = loginInfo.realName; | |||
entity.CreateDate = now; | |||
db.Insert(entity); | |||
//判断是否已选 | |||
if (list.Where(x => x.MajorId == item.ID).Count() <= 0) | |||
{ | |||
var entity = new ElectiveMajorEntity(); | |||
entity.Create(); | |||
entity.OLPOEId = olpoeId; | |||
entity.MajorId = item.ID; | |||
entity.Grade = item.Grade; | |||
entity.CreateUserId = loginInfo.userId; | |||
entity.CreateUserName = loginInfo.realName; | |||
entity.CreateDate = now; | |||
db.Insert(entity); | |||
} | |||
} | |||
db.Commit(); | |||
} | |||
@@ -359,7 +359,10 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
{ | |||
list = this.BaseRepository("CollegeMIS").FindList<OpenLessonPlanOfElectiveEntity>(strSql.ToString(), dp).ToList(); | |||
} | |||
//选课专业 | |||
var majorSql = | |||
@"SELECT t.MajorName,t.MajorNo,a.* FROM ElectiveMajor a left join CdMajor t on a.majorid=t.id"; | |||
var electiveMajorList = this.BaseRepository("CollegeMIS").FindList<ElectiveMajorEntity>(majorSql); | |||
foreach (var item in list) | |||
{ | |||
//模式二:正式选课 | |||
@@ -381,6 +384,8 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
item.StuNumPre = aaa.Where(x => x.Status == 2).Count(); | |||
//选课专业 | |||
item.ElectiveMajorList = electiveMajorList.Where(x => x.OLPOEId == item.Id).ToList(); | |||
} | |||
return list; | |||