@@ -3,6 +3,7 @@ using System.Data; | |||
using Learun.Application.TwoDevelopment.EducationalAdministration; | |||
using System.Web.Mvc; | |||
using System.Collections.Generic; | |||
using System.Collections; | |||
namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||
{ | |||
@@ -26,7 +27,7 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||
[HttpGet] | |||
public ActionResult Index() | |||
{ | |||
return View(); | |||
return View(); | |||
} | |||
/// <summary> | |||
/// 表单页 | |||
@@ -35,8 +36,19 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||
[HttpGet] | |||
public ActionResult Form() | |||
{ | |||
return View(); | |||
return View(); | |||
} | |||
/// <summary> | |||
/// 日程管理 | |||
/// </summary> | |||
/// <returns></returns> | |||
[HttpGet] | |||
public ActionResult ScheduleIndex() | |||
{ | |||
return View(); | |||
} | |||
#endregion | |||
#region 获取数据 | |||
@@ -74,6 +86,29 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||
var data = schoolCalendarIBLL.GetList(queryJson); | |||
return Success(data); | |||
} | |||
/// <summary> | |||
/// 获取日程数据 | |||
/// </summary> | |||
/// <returns></returns> | |||
[HttpGet] | |||
public ActionResult GetListForSchedule() | |||
{ | |||
var userInfo = LoginUserInfo.Get(); | |||
List<Hashtable> data = new List<Hashtable>(); | |||
foreach (SchoolCalendarEntity entity in schoolCalendarIBLL.GetList()) | |||
{ | |||
Hashtable ht = new Hashtable(); | |||
ht["id"] = entity.ID; | |||
ht["academicYearNo"] = "【" + entity.AcademicYearNo + "】"; | |||
ht["title"] = entity.Content; | |||
ht["end"] = (entity.EndTime.ToDate().ToString("yyyy-MM-dd") + " " + entity.EndTime.ToString().Substring(0, 2) + ":" + entity.EndTime.ToString().Substring(2, 2)).ToDate().ToString("yyyy-MM-dd HH:mm:ss"); | |||
ht["start"] = (entity.StartTime.ToDate().ToString("yyyy-MM-dd") + " " + entity.StartTime.ToString().Substring(0, 2) + ":" + entity.StartTime.ToString().Substring(2, 2)).ToDate().ToString("yyyy-MM-dd HH:mm:ss"); | |||
ht["allDay"] = false; | |||
data.Add(ht); | |||
} | |||
return ToJsonResult(data); | |||
} | |||
/// <summary> | |||
/// 获取表单数据 | |||
/// <summary> | |||
@@ -82,8 +117,9 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||
[AjaxOnly] | |||
public ActionResult GetFormData(string keyValue) | |||
{ | |||
var SchoolCalendarData = schoolCalendarIBLL.GetSchoolCalendarEntity( keyValue ); | |||
var jsonData = new { | |||
var SchoolCalendarData = schoolCalendarIBLL.GetSchoolCalendarEntity(keyValue); | |||
var jsonData = new | |||
{ | |||
SchoolCalendar = SchoolCalendarData, | |||
}; | |||
return Success(jsonData); | |||
@@ -114,11 +150,49 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||
[AjaxOnly] | |||
public ActionResult SaveForm(string keyValue, string strEntity) | |||
{ | |||
UserInfo userInfo = LoginUserInfo.Get(); SchoolCalendarEntity entity = strEntity.ToObject<SchoolCalendarEntity>(); | |||
schoolCalendarIBLL.SaveEntity(userInfo,keyValue,entity); | |||
UserInfo userInfo = LoginUserInfo.Get(); | |||
SchoolCalendarEntity entity = strEntity.ToObject<SchoolCalendarEntity>(); | |||
//根据学年和学期查询 | |||
var model = schoolCalendarIBLL.GetSchoolCalendarEntityByNo(entity.AcademicYearNo, entity.Semester); | |||
if (string.IsNullOrEmpty(keyValue)) | |||
{ | |||
if (model != null) | |||
{ | |||
return Fail("当前学期已存在!"); | |||
} | |||
} | |||
else | |||
{ | |||
if (model != null && model.ID != keyValue) | |||
{ | |||
return Fail("当前学期已存在!"); | |||
} | |||
} | |||
schoolCalendarIBLL.SaveEntity(userInfo, keyValue, entity); | |||
return Success("保存成功!"); | |||
} | |||
#endregion | |||
#region 扩展数据 | |||
/// <summary> | |||
/// 学年 | |||
/// </summary> | |||
/// <returns></returns> | |||
[HttpGet] | |||
public ActionResult GenerateNearByAcademic() | |||
{ | |||
return Success(Learun.Util.WebHelper.GenerateNearByAcademic()); | |||
} | |||
/// <summary> | |||
/// 学期 | |||
/// </summary> | |||
/// <returns></returns> | |||
[HttpGet] | |||
public ActionResult GenerateNearBySemeter() | |||
{ | |||
return Success(Learun.Util.WebHelper.GenerateNearBySemeter()); | |||
} | |||
#endregion | |||
} | |||
} |
@@ -3,13 +3,21 @@ | |||
Layout = "~/Views/Shared/_Form.cshtml"; | |||
} | |||
<div class="lr-form-wrap"> | |||
<div class="col-xs-6 lr-form-item" data-table="SchoolCalendar"> | |||
@*<div class="col-xs-6 lr-form-item" data-table="SchoolCalendar"> | |||
<div class="lr-form-item-title">学年</div> | |||
<input id="AcademicYearNo" type="text" class="form-control" /> | |||
</div> | |||
<div class="col-xs-6 lr-form-item" data-table="SchoolCalendar"> | |||
<div class="lr-form-item-title">学期</div> | |||
<div id="Semester" isvalid="yes" checkexpession="NotNull"></div> | |||
</div>*@ | |||
<div class="col-xs-12 lr-form-item" data-table="SchoolCalendar"> | |||
<div class="lr-form-item-title">学年<font face="宋体">*</font></div> | |||
<div id="AcademicYearNo" isvalid="yes" checkexpession="NotNull"></div> | |||
</div> | |||
<div class="col-xs-12 lr-form-item" data-table="SchoolCalendar"> | |||
<div class="lr-form-item-title">学期<font face="宋体">*</font></div> | |||
<div id="Semester" isvalid="yes" checkexpession="NotNull"></div> | |||
</div> | |||
<div class="col-xs-6 lr-form-item" data-table="SchoolCalendar"> | |||
<div class="lr-form-item-title">开始日期</div> | |||
@@ -15,8 +15,22 @@ var bootstrap = function ($, learun) { | |||
page.initData(); | |||
}, | |||
bind: function () { | |||
$("#Semester").lrDataItemSelect({ code: 'Semester' }); | |||
//学年 | |||
$('#AcademicYearNo').lrselect({ | |||
placeholder: "请选择学年", | |||
allowSearch: true, | |||
url: top.$.rootUrl + '/EducationalAdministration/SchoolCalendar/GenerateNearByAcademic', | |||
value: 'value', | |||
text: 'text' | |||
}); | |||
//学期 | |||
$('#Semester').lrselect({ | |||
placeholder: "请选择学年", | |||
allowSearch: true, | |||
url: top.$.rootUrl + '/EducationalAdministration/SchoolCalendar/GenerateNearBySemeter', | |||
value: 'value', | |||
text: 'text' | |||
}); | |||
}, | |||
initData: function () { | |||
if (!!keyValue) { | |||
@@ -46,6 +60,7 @@ var bootstrap = function ($, learun) { | |||
if (!!callBack) { | |||
callBack(); | |||
} | |||
learun.frameTab.currentIframe().location.reload(); | |||
}); | |||
}; | |||
page.init(); | |||
@@ -0,0 +1,158 @@ | |||
<!DOCTYPE html> | |||
<html> | |||
<head> | |||
<meta name="viewport" content="width=device-width" /> | |||
<title>日程管理</title> | |||
<script src="~/Content/jquery/plugin/fullcalendar/js/jquery-1.7.2.min.js"></script> | |||
<script src="~/Content/jquery/plugin/jquery-ui/jquery-ui.min.js"></script> | |||
<script src="~/Content/jquery/plugin/fullcalendar/js/fullcalendar.min.js"></script> | |||
<link href="~/Content/jquery/plugin/fullcalendar/css/fullcalendar.css" rel="stylesheet" /> | |||
@Html.AppendCssFile( | |||
"/Views/LR_Content/style/lr-common.css", | |||
"/Views/LR_Content/style/lr-iframe-index.css" | |||
) | |||
<script type='text/javascript'> | |||
$(document).ready(function () { | |||
resize(); | |||
$('.calendar').fullCalendar({ | |||
header: { | |||
left: 'prev,next', | |||
center: 'title', | |||
right: 'agendaDay,agendaWeek,month' | |||
}, | |||
monthNamesShort: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"], | |||
dayNamesShort: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"], | |||
buttonText: { | |||
prev: '上一页', | |||
next: '下一页', | |||
month: '月视图', | |||
week: '周视图', | |||
day: '日视图' | |||
}, | |||
titleFormat: "yyyy年MM月", | |||
columnFormat: { | |||
month: 'ddd', | |||
week: 'MM月dd日 ddd', | |||
day: 'MM月dd日 ddd' | |||
}, | |||
allDayText: '今天', | |||
axisFormat: "HH:00", | |||
height: $(window).height() - 55, | |||
dayClick: function (date, allDay, jsEvent, view) { | |||
var _date = $.fullCalendar.formatDate(date, 'yyyy-MM-dd'); | |||
var _time = $.fullCalendar.formatDate(date, 'HHmm'); | |||
btn_add(_date, _time); | |||
@*if (top.learun.formatDate(_date, 'yyyyMMdd') >= ('@Learun.Util.Time.GetToday("yyyyMMdd")')) { | |||
btn_add(_date, _time); | |||
}*@ | |||
}, | |||
editable: true, | |||
eventLimit: true, | |||
eventAfterRender: function (event, element, view) {//数据绑定上去后添加相应信息在页面上 | |||
//var fstart = $.fullCalendar.formatDate(event.start, "HH:mm"); | |||
//var fend = $.fullCalendar.formatDate(event.end, "HH:mm"); | |||
if (view.name == "month") {//按月份 | |||
var evtcontent = '<div class="fc-event-inner fc-event-skin" data-id="' + event.id + '">'; | |||
//evtcontent += '<span class="fc-event-time">' + fstart + " - " + fend + '</span>'; | |||
evtcontent += '<span class="fc-event-time">' + event.academicYearNo + '</span>'; | |||
evtcontent += '<span class="fc-event-title">: ' + event.title + '</span>'; | |||
evtcontent += '</div><div class="ui-resizable-handle ui-resizable-e"> </div>'; | |||
evtcontent += '<div class="fc-event-delete" style="width:100%;height:100%;background-color:#000;" data-id="' + event.id +'">删除</div>'; | |||
element.html(evtcontent); | |||
} else { | |||
var evtcontent = '<div class="fc-event-inner fc-event-skin" data-id="' + event.id +'" style="height:98%">'; | |||
evtcontent += '<div class="fc-event-head fc-event-skin">'; | |||
evtcontent += '<span class="fc-event-time">' + event.academicYearNo + '</span>'; | |||
//evtcontent += '<div class="fc-event-time">' + fstart + " - " + fend + event.title + '</div>'; | |||
evtcontent += '<div class="fc-event-title">' + event.title + '</div>'; | |||
evtcontent += '</div>'; | |||
evtcontent += '<div class="fc-event-content"></div>'; | |||
evtcontent += '<div class="fc-event-bg"></div>'; | |||
evtcontent += '</div>'; | |||
evtcontent += '<div class="fc-event-delete" style="width:100%;height:2%;background-color:#000;" data-id="' + event.id +'">删除</div>'; | |||
element.html(evtcontent); | |||
} | |||
}, | |||
events: (function () { | |||
var _data = []; | |||
$.ajax({ | |||
url: top.$.rootUrl + '/EducationalAdministration/SchoolCalendar/GetListForSchedule', | |||
type: "get", | |||
dataType: "json", | |||
async: false, | |||
success: function (data) { | |||
_data = data; | |||
} | |||
}); | |||
return _data; | |||
})() | |||
}); | |||
}); | |||
function resize() { | |||
$('#pageayout').height($(window).height() - 20); | |||
$(window).resize(function (e) { | |||
window.setTimeout(function () { | |||
$('#pageayout').height($(window).height() - 20); | |||
}, 200); | |||
e.stopPropagation(); | |||
}); | |||
} | |||
//添加校历 | |||
function btn_add(date, time) { | |||
top.learun.layerForm({ | |||
id: 'form', | |||
title: '添加校历', | |||
url: '/EducationalAdministration/SchoolCalendar/Form', | |||
width: 600, | |||
height: 400, | |||
callBack: function (id) { | |||
return top[id].acceptClick(); | |||
} | |||
}); | |||
}; | |||
//编辑校历 | |||
$(document).on('click', '.fc-event-inner', function () { | |||
var keyValue = $(this).attr('data-id'); | |||
top.learun.layerForm({ | |||
id: 'form', | |||
title: '编辑校历', | |||
url: '/EducationalAdministration/SchoolCalendar/Form?keyValue='+keyValue, | |||
width: 600, | |||
height: 400, | |||
callBack: function (id) { | |||
return top[id].acceptClick(); | |||
} | |||
}); | |||
}); | |||
//删除日程 | |||
$(document).on('click', '.fc-event-delete', function () { | |||
var keyValue = $(this).attr('data-id'); | |||
if (!keyValue) { | |||
learun.alert.warning("请选择日程!"); | |||
return false; | |||
} | |||
top.learun.layerConfirm('是否确认删除该项!', function (res) { | |||
if (res) { | |||
top.learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/SchoolCalendar/DeleteForm', { keyValue: keyValue }, function () { | |||
callback(); | |||
}); | |||
} | |||
}); | |||
}); | |||
function callback() { | |||
location.reload(); | |||
} | |||
</script> | |||
</head> | |||
<body> | |||
<div id="pageayout" class="border" style="overflow: auto; padding: 0px;"> | |||
<div id='calendar' class="calendar" style="margin: 10px;background: #fff; "></div> | |||
</div> | |||
</body> | |||
</html> |
@@ -7120,6 +7120,7 @@ | |||
<Content Include="Areas\LR_OAModule\Views\Notice\IndexRecycle.cshtml" /> | |||
<Content Include="Areas\LR_SystemModule\Views\Log\ApiIndex.cshtml" /> | |||
<Content Include="Areas\LR_NewWorkFlow\Views\NWFProcess\ContractFilingMonitor.cshtml" /> | |||
<Content Include="Areas\EducationalAdministration\Views\SchoolCalendar\ScheduleIndex.cshtml" /> | |||
<None Include="Properties\PublishProfiles\FolderProfile.pubxml" /> | |||
<Content Include="Views\Login\Default-beifen.cshtml" /> | |||
<None Include="Properties\PublishProfiles\FolderProfile1.pubxml" /> | |||
@@ -67,6 +67,29 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
} | |||
} | |||
/// <summary> | |||
/// 获取列表 | |||
/// </summary> | |||
/// <returns>返回列表</returns> | |||
public IEnumerable<SchoolCalendarEntity> GetList() | |||
{ | |||
try | |||
{ | |||
return schoolCalendarService.GetList(); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 获取SchoolCalendar表实体数据 | |||
/// <param name="keyValue">主键</param> | |||
@@ -91,6 +114,25 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
} | |||
} | |||
public SchoolCalendarEntity GetSchoolCalendarEntityByNo(string academicYearNo,string semester) | |||
{ | |||
try | |||
{ | |||
return schoolCalendarService.GetSchoolCalendarEntityByNo(academicYearNo, semester); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
#endregion | |||
#region 提交数据 | |||
@@ -143,6 +185,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
} | |||
} | |||
#endregion | |||
} | |||
@@ -23,6 +23,11 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
/// <returns></returns> | |||
IEnumerable<SchoolCalendarEntity> GetPageList(Pagination pagination, string queryJson); | |||
/// <summary> | |||
/// 获取列表 | |||
/// </summary> | |||
/// <returns>返回列表</returns> | |||
IEnumerable<SchoolCalendarEntity> GetList(); | |||
/// <summary> | |||
/// 获取页面显示列表数据 | |||
/// <summary> | |||
/// <param name="queryJson">查询参数</param> | |||
@@ -34,6 +39,13 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
/// <summary> | |||
/// <returns></returns> | |||
SchoolCalendarEntity GetSchoolCalendarEntity(string keyValue); | |||
/// <summary> | |||
/// 根据学年获取SchoolCalendar表实体数据 | |||
/// <param name="keyValue">主键</param> | |||
/// <summary> | |||
/// <returns></returns> | |||
SchoolCalendarEntity GetSchoolCalendarEntityByNo(string academicYearNo,string semester); | |||
#endregion | |||
#region 提交数据 | |||
@@ -54,7 +54,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
dp.Add("Semester", "%" + queryParam["Semester"].ToString() + "%", DbType.String); | |||
strSql.Append(" AND t.Semester Like @Semester "); | |||
} | |||
return this.BaseRepository().FindList<SchoolCalendarEntity>(strSql.ToString(),dp, pagination); | |||
return this.BaseRepository().FindList<SchoolCalendarEntity>(strSql.ToString(), dp, pagination); | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -103,7 +103,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
dp.Add("Semester", "%" + queryParam["Semester"].ToString() + "%", DbType.String); | |||
strSql.Append(" AND t.Semester Like @Semester "); | |||
} | |||
return this.BaseRepository().FindList<SchoolCalendarEntity>(strSql.ToString(),dp); | |||
return this.BaseRepository().FindList<SchoolCalendarEntity>(strSql.ToString(), dp); | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -118,6 +118,25 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
} | |||
} | |||
/// <summary> | |||
/// 获取列表 | |||
/// </summary> | |||
/// <returns>返回列表</returns> | |||
public IEnumerable<SchoolCalendarEntity> GetList() | |||
{ | |||
try | |||
{ | |||
return this.BaseRepository().FindList<SchoolCalendarEntity>(); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
throw; | |||
else | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
/// <summary> | |||
/// 获取SchoolCalendar表实体数据 | |||
/// <param name="keyValue">主键</param> | |||
@@ -142,6 +161,29 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
} | |||
} | |||
/// <summary> | |||
/// 获取SchoolCalendar表实体数据 | |||
/// <param name="keyValue">主键</param> | |||
/// <summary> | |||
/// <returns></returns> | |||
public SchoolCalendarEntity GetSchoolCalendarEntityByNo(string academicYearNo, string semester) | |||
{ | |||
try | |||
{ | |||
return this.BaseRepository().FindEntity<SchoolCalendarEntity>(x => x.AcademicYearNo == academicYearNo && x.Semester == semester); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
#endregion | |||
#region 提交数据 | |||
@@ -155,7 +197,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
{ | |||
try | |||
{ | |||
this.BaseRepository().Delete<SchoolCalendarEntity>(t=>t.ID == keyValue); | |||
this.BaseRepository().Delete<SchoolCalendarEntity>(t => t.ID == keyValue); | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -175,13 +217,13 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
/// <param name="keyValue">主键</param> | |||
/// <summary> | |||
/// <returns></returns> | |||
public void SaveEntity( UserInfo userInfo, string keyValue, SchoolCalendarEntity entity) | |||
public void SaveEntity(UserInfo userInfo, string keyValue, SchoolCalendarEntity entity) | |||
{ | |||
try | |||
{ | |||
if (!string.IsNullOrEmpty(keyValue)) | |||
{ | |||
entity.Modify(keyValue,userInfo); | |||
entity.Modify(keyValue, userInfo); | |||
this.BaseRepository().Update(entity); | |||
} | |||
else | |||