@@ -4,6 +4,7 @@ using Learun.Application.TwoDevelopment.PersonnelManagement; | |||
using System.Web.Mvc; | |||
using Learun.Application.TwoDevelopment.LR_CodeDemo; | |||
using System.Collections.Generic; | |||
using Learun.Application.Base.SystemModule; | |||
namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers | |||
{ | |||
@@ -111,6 +112,18 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers | |||
return Success("删除成功!"); | |||
} | |||
/// <summary> | |||
/// 修改审批状态 | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <returns></returns> | |||
[HttpPost] | |||
[AjaxOnly] | |||
public ActionResult ChangeStatusById(string keyValue,string processId) | |||
{ | |||
aDR_AddApplyIBLL.ChangeStatusById(keyValue,processId); | |||
return Success("提交成功!"); | |||
} | |||
/// <summary> | |||
/// 保存实体数据(新增、修改) | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
@@ -11,6 +11,7 @@ var setAuthorize; | |||
// 设置表单数据 | |||
var setFormData; | |||
// 验证数据是否填写完整 | |||
var isUpdate; | |||
var validForm; | |||
// 保存数据 | |||
var save; | |||
@@ -18,24 +19,23 @@ var bootstrap = function ($, learun) { | |||
"use strict"; | |||
// 设置权限 | |||
setAuthorize = function (data) { | |||
if(!!data) | |||
{ | |||
for (var field in data) { | |||
if (data[field].isLook != 1) {// 如果没有查看权限就直接移除 | |||
$('#' + data[field].fieldId).parent().remove(); | |||
} | |||
else { | |||
if (data[field].isEdit != 1) { | |||
$('#' + data[field].fieldId).attr('disabled', 'disabled'); | |||
if ($('#' + data[field].fieldId).hasClass('lrUploader-wrap')) { | |||
$('#' + data[field].fieldId).css({ 'padding-right': '58px' }); | |||
$('#' + data[field].fieldId).find('.btn-success').remove(); | |||
} | |||
} | |||
} | |||
} | |||
} | |||
}; | |||
if (!!data) { | |||
for (var field in data) { | |||
if (data[field].isLook != 1) {// 如果没有查看权限就直接移除 | |||
$('#' + data[field].fieldId).parent().remove(); | |||
} | |||
else { | |||
if (data[field].isEdit != 1) { | |||
$('#' + data[field].fieldId).attr('disabled', 'disabled'); | |||
if ($('#' + data[field].fieldId).hasClass('lrUploader-wrap')) { | |||
$('#' + data[field].fieldId).css({ 'padding-right': '58px' }); | |||
$('#' + data[field].fieldId).find('.btn-success').remove(); | |||
} | |||
} | |||
} | |||
} | |||
} | |||
}; | |||
var page = { | |||
init: function () { | |||
$('.lr-form-wrap').lrscroll(); | |||
@@ -56,7 +56,7 @@ var bootstrap = function ($, learun) { | |||
$.lrSetForm(top.$.rootUrl + '/PersonnelManagement/ADR_AddApply/GetFormData?keyValue=' + keyValue, function (data) { | |||
for (var id in data) { | |||
if (!!data[id].length && data[id].length > 0) { | |||
$('#' + id ).jfGridSet('refreshdata', data[id]); | |||
$('#' + id).jfGridSet('refreshdata', data[id]); | |||
} | |||
else { | |||
$('[data-table="' + id + '"]').lrSetFormData(data[id]); | |||
@@ -67,23 +67,24 @@ var bootstrap = function ($, learun) { | |||
} | |||
}; | |||
// 设置表单数据 | |||
setFormData = function (processId,param,callback) { | |||
setFormData = function (processId, param, callback) { | |||
if (!!processId) { | |||
$.lrSetForm(top.$.rootUrl + '/PersonnelManagement/ADR_AddApply/GetFormDataByProcessId?processId=' + processId, function (data) { | |||
for (var id in data) { | |||
if (!!data[id] && data[id].length > 0) { | |||
$('#' + id ).jfGridSet('refreshdata', data[id]); | |||
} | |||
else { | |||
if(id == 'ADR_AddApply' && data[id] ){ | |||
$('#' + id).jfGridSet('refreshdata', data[id]); | |||
} | |||
else { | |||
if (id == 'ADR_AddApply' && data[id]) { | |||
keyValue = data[id].ID; | |||
} | |||
$('[data-table="' + id + '"]').lrSetFormData(data[id]); | |||
} | |||
$('[data-table="' + id + '"]').lrSetFormData(data[id]); | |||
} | |||
}); | |||
} | |||
callback && callback(); } | |||
} | |||
}); | |||
} | |||
callback && callback(); | |||
} | |||
// 验证数据是否填写完整 | |||
validForm = function () { | |||
if (!$('body').lrValidform()) { | |||
@@ -94,8 +95,8 @@ var bootstrap = function ($, learun) { | |||
// 保存数据 | |||
save = function (processId, callBack, i) { | |||
var formData = $('body').lrGetFormData(); | |||
if(!!processId){ | |||
formData.ProcessId =processId; | |||
if (!!processId) { | |||
formData.ProcessId = processId; | |||
} | |||
var postData = { | |||
strEntity: JSON.stringify(formData) | |||
@@ -33,6 +33,7 @@ | |||
<a id="lr_add" class="btn btn-default"><i class="fa fa-plus"></i> 新增</a> | |||
<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_submit" class="btn btn-default"><i class="fa fa-plus"></i> 提交</a> | |||
</div> | |||
</div> | |||
</div> | |||
@@ -66,8 +66,12 @@ var bootstrap = function ($, learun) { | |||
res = top[id].validForm(); | |||
// 保存数据 | |||
if (res) { | |||
processId = learun.newGuid(); | |||
res = top[id].save(processId, refreshGirdData); | |||
//processId = learun.newGuid(); | |||
//res = top[id].save(processId, refreshGirdData); | |||
res = top[id].save('', function () { | |||
page.search(); | |||
}); | |||
} | |||
return res; | |||
} | |||
@@ -76,6 +80,11 @@ var bootstrap = function ($, learun) { | |||
// 编辑 | |||
$('#lr_edit').on('click', function () { | |||
var keyValue = $('#gridtable').jfGridValue('ID'); | |||
var PStatus = $('#gridtable').jfGridValue('PStatus'); | |||
if (PStatus != 0) { | |||
learun.alert.warning("申请已经提交,不能修改"); | |||
return; | |||
} | |||
if (learun.checkrow(keyValue)) { | |||
learun.layerForm({ | |||
id: 'form', | |||
@@ -101,45 +110,85 @@ var bootstrap = function ($, learun) { | |||
// 删除 | |||
$('#lr_delete').on('click', function () { | |||
var keyValue = $('#gridtable').jfGridValue('ID'); | |||
var PStatus = $('#gridtable').jfGridValue('PStatus'); | |||
if (PStatus != 0) { | |||
learun.alert.warning("申请已经提交,不能修改"); | |||
return; | |||
} | |||
if (learun.checkrow(keyValue)) { | |||
learun.layerConfirm('是否确认删除该项!', function (res) { | |||
if (res) { | |||
learun.deleteForm(top.$.rootUrl + '/PersonnelManagement/ADR_AddApply/DeleteForm', { keyValue: keyValue}, function () { | |||
learun.deleteForm(top.$.rootUrl + '/PersonnelManagement/ADR_AddApply/DeleteForm', { keyValue: keyValue }, function () { | |||
refreshGirdData(); | |||
}); | |||
} | |||
}); | |||
} | |||
}); | |||
// 提交审核 | |||
$('#lr_submit').on('click', function () { | |||
var keyValue = $('#gridtable').jfGridValue('ID'); | |||
var PStatus = $('#gridtable').jfGridValue('PStatus'); | |||
if (PStatus != 0) { | |||
learun.alert.warning("申请已经提交"); | |||
return; | |||
} | |||
if (learun.checkrow(keyValue)) { | |||
learun.layerConfirm('是否确认提交!', function (res) { | |||
if (res) { | |||
processId = learun.newGuid(); | |||
learun.postForm(top.$.rootUrl + '/PersonnelManagement/ADR_AddApply/ChangeStatusById', { keyValue: keyValue, processId: processId }, function (res2) { | |||
refreshGirdData(res2, {}); | |||
}); | |||
} | |||
}); | |||
} | |||
}); | |||
}, | |||
// 初始化列表 | |||
initGird: function () { | |||
$('#gridtable').lrAuthorizeJfGrid({ | |||
url: top.$.rootUrl + '/PersonnelManagement/ADR_AddApply/GetPageList', | |||
headData: [ | |||
{ label: "申请人", name: "UserNo", width: 100, align: "left", | |||
formatterAsync: function (callback, value, row, op,$cell) { | |||
learun.clientdata.getAsync('user', { | |||
key: value, | |||
callback: function (_data) { | |||
callback(_data.name); | |||
} | |||
}); | |||
}}, | |||
{ label: "考勤类型", name: "ADType", width: 100, align: "left", | |||
formatterAsync: function (callback, value, row, op,$cell) { | |||
learun.clientdata.getAsync('dataItem', { | |||
key: value, | |||
code: 'ADType', | |||
callback: function (_data) { | |||
callback(_data.text); | |||
} | |||
}); | |||
}}, | |||
{ label: "补卡时间", name: "AddTime", width: 100, align: "left"}, | |||
{ label: "原因", name: "Remark", width: 100, align: "left"}, | |||
{ | |||
label: "申请人", name: "UserNo", width: 100, align: "left", | |||
formatterAsync: function (callback, value, row, op, $cell) { | |||
learun.clientdata.getAsync('user', { | |||
key: value, | |||
callback: function (_data) { | |||
callback(_data.name); | |||
} | |||
}); | |||
} | |||
}, | |||
{ | |||
label: "考勤类型", name: "ADType", width: 100, align: "left", | |||
formatterAsync: function (callback, value, row, op, $cell) { | |||
learun.clientdata.getAsync('dataItem', { | |||
key: value, | |||
code: 'ADType', | |||
callback: function (_data) { | |||
callback(_data.text); | |||
} | |||
}); | |||
} | |||
}, | |||
{ label: "补卡时间", name: "AddTime", width: 100, align: "left" }, | |||
{ | |||
label: "状态", name: "PStatus", width: 100, align: "left", formatter: function (cellvalue) { | |||
if (cellvalue === 1) { | |||
return '<span class=\"label label-warning\">审批中</span>'; | |||
} else if (cellvalue === 2) { | |||
return '<span class=\"label label-success\">审批通过</span>'; | |||
} else { | |||
return '<span class=\"label label-default\" >草稿</span>'; | |||
} | |||
} | |||
}, | |||
{ label: "原因", name: "Remark", width: 100, align: "left" }, | |||
], | |||
mainId:'ID', | |||
mainId: 'ID', | |||
isPage: true | |||
}); | |||
}, | |||
@@ -147,26 +196,24 @@ 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 (res, postData) { | |||
if (!!res) | |||
{ | |||
if (res.code == 200) | |||
{ | |||
// 发起流程 | |||
var postData = { | |||
schemeCode:'',// 填写流程对应模板编号 | |||
processId:processId, | |||
level:'1', | |||
}; | |||
learun.httpAsync('Post', top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/CreateFlow', postData, function(data) { | |||
learun.loading(false); | |||
}); | |||
if (!!res) { | |||
if (res.code == 200) { | |||
// 发起流程 | |||
var postData = { | |||
schemeCode: 'ADR_AddApply',// 填写流程对应模板编号 | |||
processId: processId, | |||
level: '1', | |||
}; | |||
learun.httpAsync('Post', top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/CreateFlow', postData, function (data) { | |||
learun.loading(false); | |||
}); | |||
} | |||
page.search(); | |||
} | |||
page.search(); | |||
} | |||
}; | |||
page.init(); | |||
} |
@@ -24,6 +24,7 @@ | |||
<typeAlias alias="SW_Ask_StudentMainMethod" type="Learun.Application.WorkFlow.SW_Ask_StudentMainMethod,Learun.Application.WorkFlow" /> | |||
<typeAlias alias="Sys_SendFilePartyMethod" type="Learun.Application.WorkFlow.Sys_SendFilePartyMethod,Learun.Application.WorkFlow" /> | |||
<typeAlias alias="Ass_ReceiveMethod" type="Learun.Application.WorkFlow.Ass_ReceiveMethod,Learun.Application.WorkFlow" /> | |||
<typeAlias alias="ADR_AddApplyMethod" type="Learun.Application.WorkFlow.ADR_AddApplyMethod,Learun.Application.WorkFlow" /> | |||
<!--任务调度器--> | |||
<typeAlias alias="ITSMethod" type="Learun.Application.Extention.TaskScheduling.ITsMethod,Learun.Application.Extention" /> | |||
@@ -57,6 +58,7 @@ | |||
<type type="IWorkFlowMethod" mapTo="SW_Ask_StudentMainMethod" name="SW_Ask_StudentMainMethod"></type> | |||
<type type="IWorkFlowMethod" mapTo="Sys_SendFilePartyMethod" name="Sys_SendFilePartyMethod"></type> | |||
<type type="IWorkFlowMethod" mapTo="Ass_ReceiveMethod" name="Ass_ReceiveMethod"></type> | |||
<type type="IWorkFlowMethod" mapTo="ADR_AddApplyMethod" name="ADR_AddApplyMethod"></type> | |||
<type type="IWorkFlowMethod" mapTo="WFFileRelease" name="wfFileRelease"></type> | |||
</container> | |||
@@ -142,6 +142,49 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||
} | |||
} | |||
/// <summary> | |||
/// 流程审批处理 | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <param name="entity">实体</param> | |||
public void ChangeStatusByProcessId(string processId, int status) | |||
{ | |||
try | |||
{ | |||
aDR_AddApplyService.ChangeStatusByProcessId(processId, status); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
public void ChangeStatusById(string keyValue, string processId) | |||
{ | |||
try | |||
{ | |||
aDR_AddApplyService.ChangeStatusById(keyValue, processId); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
#endregion | |||
} | |||
@@ -11,7 +11,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||
/// 日 期:2020-09-09 16:23 | |||
/// 描 述:补卡申请 | |||
/// </summary> | |||
public class ADR_AddApplyEntity | |||
public class ADR_AddApplyEntity | |||
{ | |||
#region 实体成员 | |||
/// <summary> | |||
@@ -58,6 +58,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||
public void Create() | |||
{ | |||
this.ID = Guid.NewGuid().ToString(); | |||
this.PStatus = 0; | |||
} | |||
/// <summary> | |||
/// 编辑调用 | |||
@@ -49,7 +49,13 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||
/// <param name="keyValue">主键</param> | |||
/// <param name="entity">实体</param> | |||
void SaveEntity(string keyValue, ADR_AddApplyEntity entity); | |||
void ChangeStatusByProcessId(string processId, int status); | |||
#endregion | |||
/// <summary> | |||
/// 修改审批状态 | |||
/// </summary> | |||
/// <param name="keyValue"></param> | |||
/// <param name="processId"></param> | |||
void ChangeStatusById(string keyValue, string processId); | |||
} | |||
} |
@@ -5,6 +5,7 @@ using System; | |||
using System.Collections.Generic; | |||
using System.Data; | |||
using System.Text; | |||
using Learun.Application.TwoDevelopment.LogisticsManagement; | |||
namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||
{ | |||
@@ -36,6 +37,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||
t.UserNo, | |||
t.ADType, | |||
t.AddTime, | |||
t.PStatus, | |||
t.Remark | |||
"); | |||
strSql.Append(" FROM ADR_AddApply t "); | |||
@@ -51,15 +53,15 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||
} | |||
if (!queryParam["UserNo"].IsEmpty()) | |||
{ | |||
dp.Add("UserNo",queryParam["UserNo"].ToString(), DbType.String); | |||
dp.Add("UserNo", queryParam["UserNo"].ToString(), DbType.String); | |||
strSql.Append(" AND t.UserNo = @UserNo "); | |||
} | |||
if (!queryParam["ADType"].IsEmpty()) | |||
{ | |||
dp.Add("ADType",queryParam["ADType"].ToString(), DbType.String); | |||
dp.Add("ADType", queryParam["ADType"].ToString(), DbType.String); | |||
strSql.Append(" AND t.ADType = @ADType "); | |||
} | |||
return this.BaseRepository("CollegeMIS").FindList<ADR_AddApplyEntity>(strSql.ToString(),dp, pagination); | |||
return this.BaseRepository("CollegeMIS").FindList<ADR_AddApplyEntity>(strSql.ToString(), dp, pagination); | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -107,7 +109,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||
{ | |||
try | |||
{ | |||
return this.BaseRepository("CollegeMIS").FindEntity<ADR_AddApplyEntity>(t=>t.ProcessId == processId); | |||
return this.BaseRepository("CollegeMIS").FindEntity<ADR_AddApplyEntity>(t => t.ProcessId == processId); | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -134,7 +136,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||
{ | |||
try | |||
{ | |||
this.BaseRepository("CollegeMIS").Delete<ADR_AddApplyEntity>(t=>t.ID == keyValue); | |||
this.BaseRepository("CollegeMIS").Delete<ADR_AddApplyEntity>(t => t.ID == keyValue); | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -182,8 +184,76 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 流程审批处理 | |||
/// </summary> | |||
/// <param name="processId">流程id</param> | |||
/// <param name="status">处理状态 2 通过 0 未通过</param> | |||
/// <returns></returns> | |||
public void ChangeStatusByProcessId(string processId, int status) | |||
{ | |||
var db = this.BaseRepository("CollegeMIS").BeginTrans(); | |||
try | |||
{ | |||
var addEntity = db.FindEntity<ADR_AddApplyEntity>(a => a.ProcessId == processId); | |||
if (null != addEntity) | |||
{ | |||
var AddTime = addEntity.AddTime.ToDate(); | |||
var recordEntity = new ADR_RecordEntity() | |||
{ | |||
ADYear = AddTime.Year.ToString(), | |||
ADMonth = AddTime.Month.ToString(), | |||
ADDay = AddTime.Day.ToString(), | |||
ClockTime = AddTime, | |||
ADTime = AddTime, | |||
ADType = addEntity.ADType, | |||
UserNo = addEntity.UserNo, | |||
ClockStatus = "1", | |||
}; | |||
recordEntity.Create(); | |||
addEntity.PStatus = status; | |||
db.Insert(recordEntity); | |||
db.Update(addEntity); | |||
db.Commit(); | |||
} | |||
} | |||
catch (Exception ex) | |||
{ | |||
db.Rollback(); | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
#endregion | |||
public void ChangeStatusById(string keyValue, string processId) | |||
{ | |||
try | |||
{ | |||
var addEntity = this.BaseRepository("CollegeMIS").FindEntity<ADR_AddApplyEntity>(a => a.ID == keyValue); | |||
addEntity.ProcessId = processId; | |||
addEntity.PStatus = 1; | |||
this.BaseRepository("CollegeMIS").Update(addEntity); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
} | |||
} |
@@ -94,6 +94,7 @@ | |||
<Compile Include="Delegate\NWFDelegateRuleEntity.cs" /> | |||
<Compile Include="Delegate\NWFDelegateService.cs" /> | |||
<Compile Include="NodeMethod\ArrangeLessonTermAttemperMethod.cs" /> | |||
<Compile Include="NodeMethod\ADR_AddApplyMethod.cs" /> | |||
<Compile Include="NodeMethod\Ass_ReceiveMethod.cs" /> | |||
<Compile Include="NodeMethod\SW_Ask_StudentMainMethod.cs" /> | |||
<Compile Include="NodeMethod\SW_Ask_TypeMethod.cs" /> | |||
@@ -0,0 +1,28 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Learun.Application.TwoDevelopment.AssetManagementSystem; | |||
using Learun.Application.TwoDevelopment.PersonnelManagement; | |||
namespace Learun.Application.WorkFlow | |||
{ | |||
public class ADR_AddApplyMethod : IWorkFlowMethod | |||
{ | |||
ADR_AddApplyIBLL asset = new ADR_AddApplyBLL(); | |||
public void Execute(WfMethodParameter parameter) | |||
{ | |||
if (parameter.code == "agree") | |||
{ | |||
asset.ChangeStatusByProcessId(parameter.processId, 2); | |||
} | |||
else | |||
{ | |||
asset.ChangeStatusByProcessId(parameter.processId, 0); | |||
} | |||
} | |||
} | |||
} |