@@ -26,7 +26,7 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers | |||
[HttpGet] | |||
public ActionResult Index() | |||
{ | |||
return View(); | |||
return View(); | |||
} | |||
/// <summary> | |||
/// 表单页 | |||
@@ -35,7 +35,7 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers | |||
[HttpGet] | |||
public ActionResult Form() | |||
{ | |||
return View(); | |||
return View(); | |||
} | |||
#endregion | |||
@@ -71,11 +71,10 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers | |||
[AjaxOnly] | |||
public ActionResult GetFormData(string keyValue) | |||
{ | |||
var PartyCateData = partyManageIBLL.GetPartyCateEntity( keyValue ); | |||
var PartyManageData = partyManageIBLL.GetPartyManageEntity( PartyCateData.ID ); | |||
var jsonData = new { | |||
var PartyManageData = partyManageIBLL.GetPartyManageEntity(keyValue); | |||
var jsonData = new | |||
{ | |||
PartyManage = PartyManageData, | |||
PartyCate = PartyCateData, | |||
}; | |||
return Success(jsonData); | |||
} | |||
@@ -116,14 +115,10 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers | |||
[HttpPost] | |||
[ValidateAntiForgeryToken] | |||
[AjaxOnly] | |||
public ActionResult SaveForm(string keyValue, string strEntity, string strpartyManageEntity) | |||
public ActionResult SaveForm(string keyValue, string strEntity) | |||
{ | |||
PartyCateEntity entity = strEntity.ToObject<PartyCateEntity>(); | |||
PartyManageEntity partyManageEntity = strpartyManageEntity.ToObject<PartyManageEntity>(); | |||
partyManageIBLL.SaveEntity(keyValue,entity,partyManageEntity); | |||
if (string.IsNullOrEmpty(keyValue)) | |||
{ | |||
} | |||
PartyManageEntity entity = strEntity.ToObject<PartyManageEntity>(); | |||
partyManageIBLL.SaveEntity(keyValue, entity); | |||
return Success("保存成功!"); | |||
} | |||
#endregion | |||
@@ -3,17 +3,25 @@ | |||
Layout = "~/Views/Shared/_Form.cshtml"; | |||
} | |||
<div class="lr-form-wrap" id="form"> | |||
<div class="col-xs-12 lr-form-item" data-table="PartyManage" > | |||
<div class="col-xs-12 lr-form-item" data-table="PartyManage"> | |||
<div class="lr-form-item-title">学年<font face="宋体">*</font></div> | |||
<div id="Year" isvalid="yes" checkexpession="NotNull"></div> | |||
</div> | |||
<div class="col-xs-12 lr-form-item" data-table="PartyManage"> | |||
<div class="lr-form-item-title">学期</div> | |||
<div id="Semester"></div> | |||
</div> | |||
<div class="col-xs-12 lr-form-item" data-table="PartyManage"> | |||
<div class="lr-form-item-title">所属分类<font face="宋体">*</font></div> | |||
<div id="CateId" isvalid="yes" checkexpession="NotNull" ></div> | |||
<div id="CateId" isvalid="yes" checkexpession="NotNull"></div> | |||
</div> | |||
<div class="col-xs-12 lr-form-item" data-table="PartyManage" > | |||
<div class="col-xs-12 lr-form-item" data-table="PartyManage"> | |||
<div class="lr-form-item-title">标题<font face="宋体">*</font></div> | |||
<input id="Title" type="text" class="form-control" isvalid="yes" checkexpession="NotNull" /> | |||
</div> | |||
<div class="col-xs-12 lr-form-item" data-table="PartyManage" > | |||
<div class="col-xs-12 lr-form-item" data-table="PartyManage"> | |||
<div class="lr-form-item-title">附件上传</div> | |||
<div id="Filepath" ></div> | |||
<div id="Filepath"></div> | |||
</div> | |||
</div> | |||
@Html.AppendJsFile("/Areas/PersonnelManagement/Views/PartyManage/Form.js") |
@@ -15,6 +15,22 @@ var bootstrap = function ($, learun) { | |||
page.initData(); | |||
}, | |||
bind: function () { | |||
$('#Year').lrselect({ | |||
placeholder: "学年", | |||
allowSearch: false, | |||
url: top.$.rootUrl + '/EducationalAdministration/EADateArrange/GetAcademicYearNo', | |||
value: 'value', | |||
text: 'text', | |||
maxHeight: 200, | |||
}); | |||
//学期 | |||
$('#Semester').lrselect({ | |||
placeholder: "学期", | |||
allowSearch: false, | |||
url: top.$.rootUrl + '/EducationalAdministration/EADateArrange/GetSemester', | |||
value: 'value', | |||
text: 'text' | |||
}); | |||
$('#CateId').lrDataSourceSelect({ code: 'partycate',value: 'id',text: 'name' }); | |||
$('#Filepath').lrUploader(); | |||
}, | |||
@@ -38,9 +54,9 @@ var bootstrap = function ($, learun) { | |||
if (!$('body').lrValidform()) { | |||
return false; | |||
} | |||
var postData = {}; | |||
postData.strpartyManageEntity = JSON.stringify($('[data-table="PartyManage"]').lrGetFormData()); | |||
postData.strEntity = JSON.stringify($('[data-table="PartyCate"]').lrGetFormData()); | |||
var postData = { | |||
strEntity: JSON.stringify($('body').lrGetFormData()) | |||
}; | |||
$.lrSaveForm(top.$.rootUrl + '/PersonnelManagement/PartyManage/SaveForm?keyValue=' + keyValue, postData, function (res) { | |||
// 保存成功后才回调 | |||
if (!!callBack) { | |||
@@ -19,6 +19,28 @@ | |||
<div class="lr-layout-tool-item"> | |||
<div id="datesearch"></div> | |||
</div> | |||
<div class="lr-layout-tool-item"> | |||
<div id="multiple_condition_query"> | |||
<div class="lr-query-formcontent"> | |||
<div class="col-xs-12 lr-form-item"> | |||
<div class="lr-form-item-title">标题</div> | |||
<input id="Title" type="text" class="form-control" /> | |||
</div> | |||
@*<div class="col-xs-12 lr-form-item"> | |||
<div class="lr-form-item-title">创建人</div> | |||
<div id="FCreater"></div> | |||
</div>*@ | |||
<div class="col-xs-12 lr-form-item"> | |||
<div class="lr-form-item-title">学年</div> | |||
<div id="Year"></div> | |||
</div> | |||
<div class="col-xs-12 lr-form-item"> | |||
<div class="lr-form-item-title">学期</div> | |||
<div id="Semester"></div> | |||
</div> | |||
</div> | |||
</div> | |||
</div> | |||
</div> | |||
<div class="lr-layout-tool-right"> | |||
<div class=" btn-group btn-group-sm"> | |||
@@ -67,6 +67,22 @@ var bootstrap = function ($, learun) { | |||
page.search(queryJson); | |||
} | |||
}, 220, 400); | |||
$('#Year').lrselect({ | |||
placeholder: "学年", | |||
allowSearch: false, | |||
url: top.$.rootUrl + '/EducationalAdministration/EADateArrange/GetAcademicYearNo', | |||
value: 'value', | |||
text: 'text', | |||
maxHeight: 200, | |||
}); | |||
//学期 | |||
$('#Semester').lrselect({ | |||
placeholder: "学期", | |||
allowSearch: false, | |||
url: top.$.rootUrl + '/EducationalAdministration/EADateArrange/GetSemester', | |||
value: 'value', | |||
text: 'text' | |||
}); | |||
// 新增 | |||
$('#lr_add').on('click', function () { | |||
learun.layerForm({ | |||
@@ -102,7 +118,7 @@ var bootstrap = function ($, learun) { | |||
if (learun.checkrow(keyValue)) { | |||
learun.layerConfirm('是否确认删除该项!', function (res) { | |||
if (res) { | |||
learun.deleteForm(top.$.rootUrl + '/PersonnelManagement/PartyManage/DeleteForm', { keyValue: keyValue}, function () { | |||
learun.deleteForm(top.$.rootUrl + '/PersonnelManagement/PartyManage/DeleteForm', { keyValue: keyValue }, function () { | |||
refreshGirdData(); | |||
}); | |||
} | |||
@@ -128,7 +144,7 @@ var bootstrap = function ($, learun) { | |||
//访问情况统计 | |||
$("#lr_statistics").on('click', function () { | |||
var keyValue = $('#gridtable').jfGridValue('FFile'); | |||
var keyValue = $('#gridtable').jfGridValue('Filepath'); | |||
if (learun.checkrow(keyValue)) { | |||
learun.layerFormForPercent({ | |||
id: 'form', | |||
@@ -150,18 +166,22 @@ var bootstrap = function ($, learun) { | |||
$('#gridtable').jfGrid({ | |||
url: top.$.rootUrl + '/PersonnelManagement/PartyManage/GetPageList', | |||
headData: [ | |||
{ label: "所属分类", name: "CateId", width: 200, align: "left", | |||
formatterAsync: function (callback, value, row, op,$cell) { | |||
learun.clientdata.getAsync('custmerData', { | |||
url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'partycate', | |||
key: value, | |||
keyId: 'id', | |||
callback: function (_data) { | |||
callback(_data['name']); | |||
} | |||
}); | |||
}}, | |||
{ label: "标题", name: "Title", width: 200, align: "left"}, | |||
{ | |||
label: "所属分类", name: "CateId", width: 200, align: "left", | |||
formatterAsync: function (callback, value, row, op, $cell) { | |||
learun.clientdata.getAsync('custmerData', { | |||
url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'partycate', | |||
key: value, | |||
keyId: 'id', | |||
callback: function (_data) { | |||
callback(_data['name']); | |||
} | |||
}); | |||
} | |||
}, | |||
{ label: "学年", name: "Year", width: 200, align: "left" }, | |||
{ label: "学期", name: "Semester", width: 200, align: "left" }, | |||
{ label: "标题", name: "Title", width: 200, align: "left" }, | |||
{ | |||
label: "附件上传", name: "Filepath", width: 200, align: "left" | |||
, formatterAsync: function (callback, value, row, op, $cell) { | |||
@@ -181,7 +201,7 @@ var bootstrap = function ($, learun) { | |||
} | |||
}, | |||
], | |||
mainId:'ID', | |||
mainId: 'ID', | |||
isPage: true | |||
}); | |||
}, | |||
@@ -189,7 +209,7 @@ var bootstrap = function ($, learun) { | |||
param = param || {}; | |||
param.StartTime = startTime; | |||
param.EndTime = endTime; | |||
$('#gridtable').jfGridSet('reload',{ queryJson: JSON.stringify(param) }); | |||
$('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); | |||
} | |||
}; | |||
refreshGirdData = function () { | |||
@@ -24,7 +24,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||
/// <param name="pagination">分页参数</param> | |||
/// <param name="queryJson">查询参数</param> | |||
/// <returns></returns> | |||
public IEnumerable<PartyCateEntity> GetPageList(Pagination pagination, string queryJson) | |||
public IEnumerable<PartyManageEntity> GetPageList(Pagination pagination, string queryJson) | |||
{ | |||
try | |||
{ | |||
@@ -163,11 +163,11 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||
/// <param name="keyValue">主键</param> | |||
/// <param name="entity">实体</param> | |||
/// <returns></returns> | |||
public void SaveEntity(string keyValue, PartyCateEntity entity,PartyManageEntity partyManageEntity) | |||
public void SaveEntity(string keyValue, PartyManageEntity entity) | |||
{ | |||
try | |||
{ | |||
partyManageService.SaveEntity(keyValue, entity,partyManageEntity); | |||
partyManageService.SaveEntity(keyValue, entity); | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -51,6 +51,12 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||
public string Filepath { get; set; } | |||
[Column("CTYPE")] | |||
public string CType { get; set; } | |||
[Column("YEAR")] | |||
public string Year { get; set; } | |||
[Column("SEMESTER")] | |||
public string Semester { get; set; } | |||
#endregion | |||
#region 扩展操作 | |||
@@ -60,6 +66,8 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||
public void Create() | |||
{ | |||
this.ID = Guid.NewGuid().ToString(); | |||
this.Createtime = DateTime.Now; | |||
this.Creator = LoginUserInfo.Get().userId; | |||
} | |||
/// <summary> | |||
/// 编辑调用 | |||
@@ -20,7 +20,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||
/// </summary> | |||
/// <param name="queryJson">查询参数</param> | |||
/// <returns></returns> | |||
IEnumerable<PartyCateEntity> GetPageList(Pagination pagination, string queryJson); | |||
IEnumerable<PartyManageEntity> GetPageList(Pagination pagination, string queryJson); | |||
/// <summary> | |||
/// 获取PartyManage表实体数据 | |||
/// </summary> | |||
@@ -50,7 +50,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <param name="entity">实体</param> | |||
void SaveEntity(string keyValue, PartyCateEntity entity,PartyManageEntity partyManageEntity); | |||
void SaveEntity(string keyValue, PartyManageEntity entity); | |||
#endregion | |||
} | |||
@@ -25,7 +25,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||
/// <param name="pagination">查询参数</param> | |||
/// <param name="queryJson">查询参数</param> | |||
/// <returns></returns> | |||
public IEnumerable<PartyCateEntity> GetPageList(Pagination pagination, string queryJson) | |||
public IEnumerable<PartyManageEntity> GetPageList(Pagination pagination, string queryJson) | |||
{ | |||
try | |||
{ | |||
@@ -37,7 +37,33 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||
var queryParam = queryJson.ToJObject(); | |||
// 虚拟参数 | |||
var dp = new DynamicParameters(new { }); | |||
return this.BaseRepository("CollegeMIS").FindList<PartyCateEntity>(strSql.ToString(), dp, pagination); | |||
if (!queryParam["Year"].IsEmpty()) | |||
{ | |||
dp.Add("Year", queryParam["Year"].ToString(), DbType.String); | |||
strSql.Append(" AND t.Year = @Year "); | |||
} | |||
if (!queryParam["Semester"].IsEmpty()) | |||
{ | |||
dp.Add("Semester", queryParam["Semester"].ToString(), DbType.String); | |||
strSql.Append(" AND t.Semester = @Semester "); | |||
} | |||
if (!queryParam["Creator"].IsEmpty()) | |||
{ | |||
dp.Add("Creator", queryParam["Creator"].ToString(), DbType.String); | |||
strSql.Append(" AND t.Creator = @Creator "); | |||
} | |||
if (!queryParam["CateId"].IsEmpty()) | |||
{ | |||
dp.Add("CateId", queryParam["CateId"].ToString(), DbType.String); | |||
strSql.Append(" AND t.CateId = @CateId "); | |||
} | |||
if (!queryParam["StartTime"].IsEmpty() && !queryParam["EndTime"].IsEmpty()) | |||
{ | |||
dp.Add("startTime", queryParam["StartTime"].ToDate(), DbType.DateTime); | |||
dp.Add("endTime", queryParam["EndTime"].ToDate(), DbType.DateTime); | |||
strSql.Append(" AND ( t.Createtime >= @startTime AND t.Createtime <= @endTime ) "); | |||
} | |||
return this.BaseRepository("CollegeMIS").FindList<PartyManageEntity>(strSql.ToString(), dp, pagination); | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -61,7 +87,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||
{ | |||
try | |||
{ | |||
return this.BaseRepository("CollegeMIS").FindEntity<PartyManageEntity>(t => t.CateId == keyValue); | |||
return this.BaseRepository("CollegeMIS").FindEntity<PartyManageEntity>(keyValue); | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -159,34 +185,23 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <param name="entity">实体</param> | |||
public void SaveEntity(string keyValue, PartyCateEntity entity, PartyManageEntity partyManageEntity) | |||
public void SaveEntity(string keyValue, PartyManageEntity entity) | |||
{ | |||
var db = this.BaseRepository("CollegeMIS").BeginTrans(); | |||
try | |||
{ | |||
if (!string.IsNullOrEmpty(keyValue)) | |||
{ | |||
var partyCateEntityTmp = GetPartyCateEntity(keyValue); | |||
entity.Modify(keyValue); | |||
db.Update(entity); | |||
db.Delete<PartyManageEntity>(t => t.CateId == partyCateEntityTmp.ID); | |||
partyManageEntity.Create(); | |||
partyManageEntity.CateId = partyCateEntityTmp.ID; | |||
db.Insert(partyManageEntity); | |||
this.BaseRepository("CollegeMIS").Update(entity); | |||
} | |||
else | |||
{ | |||
entity.Create(); | |||
db.Insert(entity); | |||
partyManageEntity.Create(); | |||
partyManageEntity.CateId = entity.ID; | |||
db.Insert(partyManageEntity); | |||
this.BaseRepository("CollegeMIS").Insert(entity); | |||
} | |||
db.Commit(); | |||
} | |||
catch (Exception ex) | |||
{ | |||
db.Rollback(); | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||