From 30931687496aa6da050191e4ce9507f568bb5745 Mon Sep 17 00:00:00 2001 From: zhangli <1109134334@qq.com> Date: Tue, 22 Mar 2022 11:02:26 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=89=E4=BF=AE=E8=AF=BE=E8=AF=BE=E7=A8=8B--?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E5=8A=A0=20=E6=98=AF=E5=90=A6=E5=B7=B2?= =?UTF-8?q?=E9=80=89=E4=B8=93=E4=B8=9A=E3=80=81=E9=80=89=E8=AF=BE=E4=B8=93?= =?UTF-8?q?=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Views/ElectiveMajor/Index.js | 10 +++++ .../OpenLessonPlanOfElective/MergeIndex.js | 40 +++++++++++++------ .../ElectiveMajor/ElectiveMajorService.cs | 24 ++++++----- .../OpenLessonPlanOfElectiveService.cs | 7 +++- 4 files changed, 58 insertions(+), 23 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ElectiveMajor/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ElectiveMajor/Index.js index 58dfa6639..6839e2da6 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ElectiveMajor/Index.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ElectiveMajor/Index.js @@ -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(); } diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/OpenLessonPlanOfElective/MergeIndex.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/OpenLessonPlanOfElective/MergeIndex.js index 465946539..470213e9a 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/OpenLessonPlanOfElective/MergeIndex.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/OpenLessonPlanOfElective/MergeIndex.js @@ -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 ""; + } else { + return ""; + } + } + }, + { + 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, diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ElectiveMajor/ElectiveMajorService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ElectiveMajor/ElectiveMajorService.cs index 4152e37ad..106cc3bd4 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ElectiveMajor/ElectiveMajorService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ElectiveMajor/ElectiveMajorService.cs @@ -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(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(); } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/OpenLessonPlanOfElective/OpenLessonPlanOfElectiveService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/OpenLessonPlanOfElective/OpenLessonPlanOfElectiveService.cs index 6bd019da2..add886d1d 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/OpenLessonPlanOfElective/OpenLessonPlanOfElectiveService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/OpenLessonPlanOfElective/OpenLessonPlanOfElectiveService.cs @@ -359,7 +359,10 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration { list = this.BaseRepository("CollegeMIS").FindList(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(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;