@@ -120,6 +120,19 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers | |||
teacherTrainIBLL.SaveEntity(keyValue, entity); | |||
return Success("保存成功!"); | |||
} | |||
/// <summary> | |||
/// 提交数据 | |||
/// <param name="keyValue">主键</param> | |||
/// <summary> | |||
/// <returns></returns> | |||
[HttpPost] | |||
[AjaxOnly] | |||
public ActionResult EnableDisableForm(string keyValue,string status) | |||
{ | |||
teacherTrainIBLL.EnableDisable(keyValue,status); | |||
return Success("操作成功!"); | |||
} | |||
#endregion | |||
} | |||
@@ -9,7 +9,7 @@ | |||
</div> | |||
<div class="col-xs-12 lr-form-item" data-table="TeacherTrain"> | |||
<div class="lr-form-item-title">教师姓名<font face="宋体">*</font></div> | |||
<div id="EID" isvalid="yes" checkexpession="NotNull"></div> | |||
<input id="EID" type="text" readonly class="form-control currentInfo lr-currentInfo-user" /> | |||
</div> | |||
<div class="col-xs-6 lr-form-item" data-table="TeacherTrain"> | |||
<div class="lr-form-item-title">培训开始时间<font face="宋体">*</font></div> | |||
@@ -35,14 +35,18 @@ | |||
<div class="lr-form-item-title">所获证书<font face="宋体">*</font></div> | |||
<input id="TTCertificates" type="text" class="form-control" isvalid="yes" checkexpession="NotNull" /> | |||
</div> | |||
<div class="col-xs-6 lr-form-item" data-table="TeacherTrain"> | |||
<div class="col-xs-4 lr-form-item" data-table="TeacherTrain"> | |||
<div class="lr-form-item-title">培训级别<font face="宋体">*</font></div> | |||
<div id="TTLevel" isvalid="yes" checkexpession="NotNull"></div> | |||
</div> | |||
<div class="col-xs-6 lr-form-item" data-table="TeacherTrain"> | |||
<div class="col-xs-4 lr-form-item" data-table="TeacherTrain"> | |||
<div class="lr-form-item-title">培训人数<font face="宋体">*</font></div> | |||
<input id="TTEmpNum" type="number" class="form-control" isvalid="yes" checkexpession="NotNull" /> | |||
</div> | |||
<div class="col-xs-4 lr-form-item" data-table="TeacherTrain"> | |||
<div class="lr-form-item-title">学时<font face="宋体">*</font></div> | |||
<input id="ClassHour" type="number" class="form-control" isvalid="yes" checkexpession="NotNull" /> | |||
</div> | |||
<div class="col-xs-12 lr-form-item" data-table="TeacherTrain"> | |||
<div class="lr-form-item-title">备注</div> | |||
<input id="TTComment" type="text" class="form-control" /> | |||
@@ -15,12 +15,8 @@ var bootstrap = function ($, learun) { | |||
page.initData(); | |||
}, | |||
bind: function () { | |||
$('#EID').lrformselect({ | |||
layerUrl: top.$.rootUrl + '/LR_OrganizationModule/User/SelectOnlyForm', | |||
layerUrlW: 400, | |||
layerUrlH: 300, | |||
dataUrl: top.$.rootUrl + '/LR_OrganizationModule/User/GetListByUserIds' | |||
}); | |||
$('#EID')[0].lrvalue = learun.clientdata.get(['userinfo']).userId; | |||
$('#EID').val(learun.clientdata.get(['userinfo']).realName); | |||
$("#TTLevel").lrDataItemSelect({ code: 'TrainLevel' }); | |||
$('#Path').lrUploader(); | |||
}, | |||
@@ -10,10 +10,30 @@ | |||
<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="TTUnit" type="text" class="form-control" /> | |||
</div> | |||
<div class="col-xs-12 lr-form-item"> | |||
<div class="lr-form-item-title">教师姓名</div> | |||
<div id="EID"></div> | |||
</div> | |||
<div class="col-xs-6 lr-form-item"> | |||
<div class="lr-form-item-title">培训机构</div> | |||
<input id="TTOrganization" type="text" class="form-control" /> | |||
</div> | |||
<div class="col-xs-6 lr-form-item"> | |||
<div class="lr-form-item-title">培训方式</div> | |||
<input id="TTWay" type="text" class="form-control" /> | |||
</div> | |||
<div class="col-xs-6 lr-form-item"> | |||
<div class="lr-form-item-title">所获证书</div> | |||
<input id="TTCertificates" type="text" class="form-control" /> | |||
</div> | |||
<div class="col-xs-6 lr-form-item"> | |||
<div class="lr-form-item-title">培训级别</div> | |||
<div id="TTLevel"></div> | |||
</div> | |||
</div> | |||
</div> | |||
</div> | |||
@@ -27,6 +47,8 @@ | |||
<a id="lr_edit" class="btn btn-default"><i class="fa fa-pencil-square-o"></i> 修改</a> | |||
<a id="lr_delete" class="btn btn-default"><i class="fa fa-trash-o"></i> 删除</a> | |||
<a id="lr_view" class="btn btn-default"><i class="fa fa-search-minus"></i> 查看</a> | |||
<a id="lr_check" class="btn btn-default"><i class="fa fa-lock"></i> 审核</a> | |||
<a id="lr_uncheck" class="btn btn-default"><i class="fa fa-unlock"></i> 去审</a> | |||
</div> | |||
</div> | |||
</div> | |||
@@ -16,7 +16,8 @@ var bootstrap = function ($, learun) { | |||
$('#multiple_condition_query').lrMultipleQuery(function (queryJson) { | |||
page.search(queryJson); | |||
}, 220, 400); | |||
$('#EID').lrUserSelect(0); | |||
$('#EID').lrDataSourceSelect({ code: 'teacheruserdata', value: 'f_userid', text: 'f_realname' }); | |||
$("#TTLevel").lrDataItemSelect({ code: 'TrainLevel' }); | |||
// 刷新 | |||
$('#lr_refresh').on('click', function () { | |||
location.reload(); | |||
@@ -38,6 +39,15 @@ var bootstrap = function ($, learun) { | |||
$('#lr_edit').on('click', function () { | |||
var keyValue = $('#gridtable').jfGridValue('TTID'); | |||
if (learun.checkrow(keyValue)) { | |||
if (keyValue.indexOf(',') != -1) { | |||
learun.alert.warning("只能选择一条记录进行编辑!"); | |||
return; | |||
} | |||
var State = $('#gridtable').jfGridValue('State'); | |||
if (State === "1") { | |||
learun.alert.warning("当前项目已审核不能编辑!"); | |||
return; | |||
} | |||
learun.layerForm({ | |||
id: 'form', | |||
title: '编辑', | |||
@@ -53,6 +63,11 @@ var bootstrap = function ($, learun) { | |||
// 删除 | |||
$('#lr_delete').on('click', function () { | |||
var keyValue = $('#gridtable').jfGridValue('TTID'); | |||
var State = $('#gridtable').jfGridValue('State'); | |||
if (State.indexOf('1') != -1) { | |||
learun.alert.warning("选中记录中包含已审核项目,已审核不能删除!"); | |||
return; | |||
} | |||
if (learun.checkrow(keyValue)) { | |||
learun.layerConfirm('是否确认删除该项!', function (res) { | |||
if (res) { | |||
@@ -66,6 +81,10 @@ var bootstrap = function ($, learun) { | |||
//查看 | |||
$('#lr_view').on('click', function () { | |||
var keyValue = $('#gridtable').jfGridValue('TTID'); | |||
if (keyValue.indexOf(',') != -1) { | |||
learun.alert.warning("只能选择一条记录进行查看!"); | |||
return; | |||
} | |||
if (learun.checkrow(keyValue)) { | |||
learun.layerForm({ | |||
id: 'formteachertrain', | |||
@@ -80,12 +99,59 @@ var bootstrap = function ($, learun) { | |||
}); | |||
} | |||
}); | |||
//审核 | |||
$('#lr_check').on('click', function () { | |||
var keyValue = $('#gridtable').jfGridValue('TTID'); | |||
if (learun.checkrow(keyValue)) { | |||
var State = $('#gridtable').jfGridValue('State'); | |||
if (State.indexOf('1') != -1) { | |||
learun.alert.warning("选中记录中包含已审核项目!"); | |||
return; | |||
} | |||
learun.layerConfirm('是否确认审核该项?', function (res) { | |||
if (res) { | |||
learun.postForm(top.$.rootUrl + '/PersonnelManagement/TeacherTrain/EnableDisableForm', { keyValue: keyValue, status: "1" }, function () { | |||
refreshGirdData(); | |||
}); | |||
} | |||
}); | |||
} | |||
}); | |||
//去审 | |||
$('#lr_uncheck').on('click', function () { | |||
var keyValue = $('#gridtable').jfGridValue('TTID'); | |||
if (learun.checkrow(keyValue)) { | |||
var State = $('#gridtable').jfGridValue('State'); | |||
var StateArr = State.split(','); | |||
if ($.inArray('0', StateArr) != -1 || $.inArray('', StateArr) != -1) { | |||
learun.alert.warning("选中记录中包含未审核项目!"); | |||
return; | |||
} | |||
learun.layerConfirm('是否确认取消审核该项?', function (res) { | |||
if (res) { | |||
learun.postForm(top.$.rootUrl + '/PersonnelManagement/TeacherTrain/EnableDisableForm', { keyValue: keyValue, status: "0"}, function () { | |||
refreshGirdData(); | |||
}); | |||
} | |||
}); | |||
} | |||
}); | |||
}, | |||
// 初始化列表 | |||
initGird: function () { | |||
$('#gridtable').lrAuthorizeJfGrid({ | |||
url: top.$.rootUrl + '/PersonnelManagement/TeacherTrain/GetPageList', | |||
headData: [ | |||
{ | |||
label: "状态", name: "State", width: 100, align: "left", | |||
formatter: function (cellvalue, row) { | |||
if (cellvalue === "1") { | |||
return '<span class=\"label label-primary\" >已提交</span>'; | |||
} else { | |||
return '<span class=\"label label-default\" >草稿</span>'; | |||
} | |||
} | |||
}, | |||
{ label: "培训组织单位", name: "TTUnit", width: 100, align: "left" }, | |||
{ | |||
label: "教师姓名", name: "EID", width: 100, align: "left", | |||
@@ -104,6 +170,7 @@ var bootstrap = function ($, learun) { | |||
{ label: "培训机构", name: "TTOrganization", width: 100, align: "left" }, | |||
{ label: "培训方式", name: "TTWay", width: 100, align: "left" }, | |||
{ label: "所获证书", name: "TTCertificates", width: 100, align: "left" }, | |||
{ label: "学时", name: "ClassHour", width: 100, align: "left" }, | |||
{ | |||
label: "培训级别", name: "TTLevel", width: 100, align: "left", | |||
formatterAsync: function (callback, value, row, op, $cell) { | |||
@@ -119,7 +186,8 @@ var bootstrap = function ($, learun) { | |||
{ label: "备注", name: "TTComment", width: 100, align: "left" }, | |||
], | |||
mainId: 'TTID', | |||
isPage: true | |||
isPage: true, | |||
isMultiselect: true, | |||
}); | |||
page.search(); | |||
}, | |||
@@ -141,6 +141,29 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||
} | |||
} | |||
/// <summary> | |||
/// 审核去审 | |||
/// </summary> | |||
/// <param name="keyValue"></param> | |||
/// <param name="status"></param> | |||
public void EnableDisable(string keyValue, string status) | |||
{ | |||
try | |||
{ | |||
teacherTrainService.EnableDisable(keyValue, status); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
#endregion | |||
} | |||
@@ -89,6 +89,17 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||
/// </summary> | |||
[Column("PATH")] | |||
public string Path { get; set; } | |||
/// <summary> | |||
/// 学时 | |||
/// </summary> | |||
[Column("CLASSHOUR")] | |||
public decimal? ClassHour { get; set; } | |||
/// <summary> | |||
/// 状态 | |||
/// </summary> | |||
[Column("STATE")] | |||
public string State { get; set; } | |||
#endregion | |||
#region 扩展操作 | |||
@@ -98,6 +109,8 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||
public void Create() | |||
{ | |||
this.TTID = Guid.NewGuid().ToString(); | |||
this.EName = LoginUserInfo.Get().realName; | |||
this.State = "0"; | |||
} | |||
/// <summary> | |||
/// 编辑调用 | |||
@@ -106,6 +119,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||
public void Modify(string keyValue) | |||
{ | |||
this.TTID = keyValue; | |||
this.EName = LoginUserInfo.Get().realName; | |||
} | |||
#endregion | |||
#region 扩展字段 | |||
@@ -50,6 +50,13 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||
/// <summary> | |||
/// <returns></returns> | |||
void SaveEntity(string keyValue, TeacherTrainEntity entity); | |||
/// <summary> | |||
/// 审核去审 | |||
/// </summary> | |||
/// <param name="keyValue"></param> | |||
/// <param name="status"></param> | |||
void EnableDisable(string keyValue, string status); | |||
#endregion | |||
} | |||
@@ -7,6 +7,7 @@ using System; | |||
using System.Collections.Generic; | |||
using System.Data; | |||
using System.Text; | |||
using System.Linq; | |||
namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||
{ | |||
@@ -38,11 +39,37 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||
var queryParam = queryJson.ToJObject(); | |||
// 虚拟参数 | |||
var dp = new DynamicParameters(new { }); | |||
if (!queryParam["TTUnit"].IsEmpty()) | |||
{ | |||
dp.Add("TTUnit", "%" + queryParam["TTUnit"].ToString() + "%", DbType.String); | |||
strSql.Append(" AND t.TTUnit like @TTUnit "); | |||
} | |||
if (!queryParam["EID"].IsEmpty()) | |||
{ | |||
dp.Add("EID", queryParam["EID"].ToString(), DbType.String); | |||
strSql.Append(" AND t.EID = @EID "); | |||
} | |||
if (!queryParam["TTWay"].IsEmpty()) | |||
{ | |||
dp.Add("TTWay", "%" + queryParam["TTWay"].ToString() + "%", DbType.String); | |||
strSql.Append(" AND t.TTWay like @TTWay "); | |||
} | |||
if (!queryParam["TTCertificates"].IsEmpty()) | |||
{ | |||
dp.Add("TTCertificates", "%" + queryParam["TTCertificates"].ToString() + "%", DbType.String); | |||
strSql.Append(" AND t.TTCertificates like @TTCertificates "); | |||
} | |||
if (!queryParam["TTLevel"].IsEmpty()) | |||
{ | |||
dp.Add("TTLevel", queryParam["TTLevel"].ToString(), DbType.String); | |||
strSql.Append(" AND t.TTLevel = @TTLevel "); | |||
} | |||
var user = LoginUserInfo.Get(); | |||
if (!user.isSystem && !user.roleIds.Contains("e945769f-0db0-4ee7-8fc1-d343d4fe473b")) | |||
{ | |||
strSql.Append(" AND t.EID = '" + user.userId + "' "); | |||
} | |||
return this.BaseRepository().FindList<TeacherTrainEntity>(strSql.ToString(), dp, pagination); | |||
} | |||
catch (Exception ex) | |||
@@ -177,6 +204,44 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||
} | |||
} | |||
/// <summary> | |||
/// 审核去审 | |||
/// </summary> | |||
/// <param name="keyValue"></param> | |||
/// <param name="status"></param> | |||
public void EnableDisable(string keyValue, string status) | |||
{ | |||
var db = BaseRepository().BeginTrans(); | |||
try | |||
{ | |||
List<string> Ids = keyValue.Split(',').ToList(); | |||
List<TeacherTrainEntity> Entity = new List<TeacherTrainEntity>(); | |||
foreach (var item in Ids) | |||
{ | |||
var list = this.BaseRepository().FindEntity<TeacherTrainEntity>(x => x.TTID == item); | |||
if (list != null) | |||
{ | |||
list.State = status; | |||
Entity.Add(list); | |||
} | |||
} | |||
db.Update(Entity); | |||
db.Commit(); | |||
} | |||
catch (Exception ex) | |||
{ | |||
db.Rollback(); | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
#endregion | |||
} | |||