@@ -28,6 +28,11 @@ | |||
if ($et.hasClass('lr-btn-danger')) { | |||
page.btnClick(item, $item, $page); | |||
} | |||
else if ($et.hasClass('lr-btn-blue')) {//提交 | |||
page.btnClickOfSubmit(item, $item, $page); | |||
}else if ($et.hasClass('lr-btn-blue')) {//销假 | |||
page.btnClickOfReply(item, $item, $page); | |||
} | |||
else { | |||
page.rowClick(item, $item, $page); | |||
} | |||
@@ -43,18 +48,23 @@ | |||
} | |||
}); | |||
$multiple.find('#CreateUserDeptNo').lrpickerex({ | |||
type: 'sourceData', | |||
code: 'CdDeptInfo', | |||
ivalue:'deptno', | |||
itext:'deptname' }); | |||
type: 'sourceData', | |||
code: 'CdDeptInfo', | |||
ivalue: 'deptno', | |||
itext: 'deptname', | |||
placeHolders: '请选择' }); | |||
$multiple.find('#CreateUserClassNo').lrpickerex({ | |||
type: 'sourceData', | |||
code: 'bjsj', | |||
ivalue:'classno', | |||
itext:'classname' }); | |||
type: 'sourceData', | |||
code: 'bjsj', | |||
ivalue: 'classno', | |||
itext: 'classname', | |||
placeHolders: '请选择' }); | |||
$multiple.find('#LeaveType').lrpickerex({ | |||
type: 'dataItem', | |||
code: 'LeaveType' | |||
type: 'sourceData', | |||
code: 'StuLeaveType', | |||
ivalue: 'typeno', | |||
itext: 'typename', | |||
placeHolders: '请选择' | |||
}); | |||
$page.find('#lr_EducationalAdministrationDtStuLeave_btn').on('tap', function () { | |||
learun.nav.go({ path: 'EducationalAdministration/DtStuLeave/form', title: '新增', type: 'right' }); | |||
@@ -89,7 +99,6 @@ | |||
}); | |||
}, | |||
rowRender: function (_index, _item, _$item, $page) {// 渲染列表行数据 | |||
_$item.append($('<p class="lr-ellipsis"><span>提交状态:</span></p>').dataFormatter({ value: _item.FlowNo == 1 })); | |||
_$item.addClass('lr-list-item lr-list-item-multi'); | |||
_$item.append($('<p class="lr-ellipsis"><span>所属系:</span></p>').dataFormatter({ value: _item.CreateUserDeptNo, | |||
type: 'dataSource', | |||
@@ -113,11 +122,11 @@ | |||
})); | |||
_$item.append($('<p class="lr-ellipsis"><span>开始时间:</span></p>').dataFormatter({ value: _item.BeginDate, | |||
type: 'datetime', | |||
dateformat: 'yyyy-MM-dd HH:mm' | |||
dateformat: 'yyyy-MM-dd hh:mm' | |||
})); | |||
_$item.append($('<p class="lr-ellipsis"><span>结束时间:</span></p>').dataFormatter({ value: _item.EndDate, | |||
type: 'datetime', | |||
dateformat: 'yyyy-MM-dd HH:mm' | |||
dateformat: 'yyyy-MM-dd hh:mm' | |||
})); | |||
_$item.append($('<p class="lr-ellipsis"><span>申请理由:</span></p>').dataFormatter({ value: _item.LeaveReason })); | |||
var lastStatus = ""; | |||
@@ -136,18 +145,37 @@ | |||
rowClick: function (item, $item, $page) {// 列表行点击触发方法 | |||
learun.nav.go({ path: 'EducationalAdministration/DtStuLeave/form', title: '详情', type: 'right', param: { keyValue: item.Id ,FlowNo:item.FlowNo} }); | |||
}, | |||
btnClickOfSubmit: function (item, $item, $page) {// 左滑按钮点击事件 | |||
var FlowNo=item.FlowNo; | |||
if(FlowNo!=0) | |||
{ | |||
learun.layer.toast("当前项目已提交,请勿重复提交!"); | |||
return; | |||
} | |||
learun.layer.confirm('确定要提交该笔数据吗?', function (_index) { | |||
if (_index === '1') { | |||
learun.layer.loading(true, '正在提交该笔数据'); | |||
learun.httppost(config.webapi + 'learun/EducationalAdministration/DtStuLeave/submit', item.Id, (data) => { | |||
if (data) {// 提交数据成功 | |||
page.grid.reload(); | |||
} | |||
learun.layer.loading(false); | |||
}); | |||
} | |||
}, '智慧校园提示', ['取消', '确定']); | |||
}, | |||
btnClick: function (item, $item, $page) {// 左滑按钮点击事件 | |||
var FlowNo=item.FlowNo; | |||
if(FlowNo!=0) | |||
if(FlowNo!=2) | |||
{ | |||
learun.layer.toast("当前项目已提交,不可删除!"); | |||
learun.layer.toast("当前项目暂不能销假!"); | |||
return; | |||
} | |||
learun.layer.confirm('确定要删除该笔数据吗?', function (_index) { | |||
learun.layer.confirm('确定要销假吗?', function (_index) { | |||
if (_index === '1') { | |||
learun.layer.loading(true, '正在删除该笔数据'); | |||
learun.httppost(config.webapi + 'learun/EducationalAdministration/DtStuLeave/delete', item.Id , (data) => { | |||
if (data) {// 删除数据成功 | |||
learun.layer.loading(true, '正在销假'); | |||
learun.httppost(config.webapi + 'learun/EducationalAdministration/DtStuLeave/delete', item.Id, (data) => { | |||
if (data) {// 销假成功 | |||
page.grid.reload(); | |||
} | |||
learun.layer.loading(false); | |||
@@ -155,7 +183,20 @@ | |||
} | |||
}, 'Learun智慧校园提示', ['取消', '确定']); | |||
}, | |||
rowBtns: ['<a class="lr-btn-danger">删除</a>'] // 列表行左滑按钮 | |||
// btnClickOfReply: function (item, $item, $page) {// 左滑按钮点击事件 | |||
// var FlowNo=item.FlowNo; | |||
// if(FlowNo!=2) | |||
// { | |||
// learun.layer.toast("当前项暂不能销假,!"); | |||
// return; | |||
// } | |||
// learun.nav.go({ path: 'EducationalAdministration/DtStuLeave/reply', title: '销假', type: 'right', param: { keyValue: item.SComplaintId } }); | |||
// }, | |||
rowBtns: [ | |||
'<a class="lr-btn-danger">删除</a>', | |||
'<a class="lr-btn-blue">提交</a>', | |||
'<a class="lr-btn-green">销假</a>', | |||
] // 列表行左滑按钮 | |||
}; | |||
return page; | |||
})(); |
@@ -10,7 +10,6 @@ | |||
<div id="CreateUserClassNo" isvalid="yes" checkexpession="NotNull" errormsg="班级"></div> | |||
</div> | |||
<div class="lr-form-row " data-table="DtStuLeave"> | |||
<label>申请用户</label> | |||
<div id="CreateUserName"></div> | |||
</div> | |||
@@ -14,7 +14,6 @@ | |||
init: function($page, param) { | |||
keyValue = param.keyValue; | |||
Statu = param.FlowNo; | |||
console.log(222, keyValue); | |||
// 添加头部按钮列表 | |||
var _html = '\ | |||
<div class="lr-form-header-cancel" >取消</div>\ | |||
@@ -59,11 +58,10 @@ | |||
}); | |||
// 更多 | |||
$header.find('.lr-form-header-more').on('tap', function() { | |||
if(keyValue){ | |||
console.log(Statu,111) | |||
if(Statu!=0){ | |||
learun.layer.warning("当前项已提交不删除!"); | |||
return false; | |||
if (keyValue) { | |||
if (Statu != 0) { | |||
learun.layer.warning("当前项已提交不删除!"); | |||
return false; | |||
} | |||
} | |||
learun.actionsheet({ | |||
@@ -125,32 +123,6 @@ | |||
} else { // 如果是 | |||
learun.nav.closeCurrent(); | |||
} | |||
// learun.layer.confirm('请确认是否提交?', function( | |||
// _index) { | |||
// if (_index === '1') { | |||
// learun.layer.loading(true, | |||
// '正在提交该项数据'); | |||
// learun.httppost(config.webapi + | |||
// 'learun/EducationalAdministration/DtStuLeave/SubmitList', | |||
// {keyValue:keyValue,FlowNo:1,processId}, (data) => { | |||
// learun.layer.loading( | |||
// false); | |||
// // if (data) { // 删除数据成功 | |||
// // learun.nav | |||
// // .closeCurrent(); | |||
// // var prepage = learun | |||
// // .nav.getpage( | |||
// // 'EducationalAdministration/DtStuLeave' | |||
// // ); | |||
// // prepage.grid | |||
// // .reload(); | |||
// // } | |||
// }); | |||
// } | |||
// }, 'Learun智慧校园提示', ['保存为草稿', '确定']); | |||
var prepage = learun.nav.getpage( | |||
'EducationalAdministration/DtStuLeave'); | |||
prepage.grid.reload(); | |||
} | |||
}); | |||
}); | |||
@@ -175,7 +147,7 @@ | |||
learun.layer.loading(false); | |||
}); | |||
} else { | |||
$header.find('.lr-form-header-方').show(); | |||
$header.find('.lr-form-header-cancel').show(); | |||
$header.find('.lr-form-header-submit').show(); | |||
} | |||
}, | |||
@@ -184,13 +156,22 @@ | |||
type: 'sourceData', | |||
code: 'CdDeptInfo', | |||
ivalue: 'deptno', | |||
itext: 'deptname' | |||
itext: 'deptname', | |||
placeHolders: '请选择' | |||
}); | |||
$page.find('#CreateUserClassNo').lrpickerex({ | |||
type: 'sourceData', | |||
code: 'bjsj', | |||
ivalue: 'classno', | |||
itext: 'classname' | |||
itext: 'classname', | |||
placeHolders: '请选择' | |||
}); | |||
$page.find('#LeaveType').lrpickerex({ | |||
type: 'sourceData', | |||
code: 'StuLeaveType', | |||
ivalue: 'typeno', | |||
itext: 'typename', | |||
placeHolders: '请选择' | |||
}); | |||
$page.find('#CreateUserName').lrselect({ | |||
type: 'user' | |||
@@ -198,10 +179,6 @@ | |||
if (!keyValue) { | |||
$page.find('#CreateUserName').lrselectSet(learun.storage.get('userinfo').baseinfo.userId); | |||
} | |||
$page.find('#LeaveType').lrpickerex({ | |||
code: 'LeaveType', | |||
type: 'dataItem' | |||
}); | |||
$page.find('#BeginDate').lrdate({}); | |||
$page.find('#EndDate').lrdate({}); | |||
}, | |||
@@ -1,4 +1,5 @@ | |||
using Nancy; | |||
using System; | |||
using Nancy; | |||
using Learun.Util; | |||
using System.Collections.Generic; | |||
using Learun.Application.TwoDevelopment.EducationalAdministration; | |||
@@ -26,6 +27,8 @@ namespace Learun.Application.WebApi | |||
Get["/form"] = GetForm; | |||
Post["/delete"] = DeleteForm; | |||
Post["/save"] = SaveForm; | |||
Post["/submit"] = CancelFrom; | |||
//Post["/cancel"] = CancelFrom; | |||
} | |||
#region 获取数据 | |||
@@ -66,8 +69,9 @@ namespace Learun.Application.WebApi | |||
public Response GetForm(dynamic _) | |||
{ | |||
string keyValue = this.GetReqData(); | |||
var DtStuLeaveData = dtStuLeaveIBLL.GetDtStuLeaveEntity( keyValue ); | |||
var jsonData = new { | |||
var DtStuLeaveData = dtStuLeaveIBLL.GetDtStuLeaveEntity(keyValue); | |||
var jsonData = new | |||
{ | |||
DtStuLeave = DtStuLeaveData, | |||
}; | |||
return Success(jsonData); | |||
@@ -96,8 +100,66 @@ namespace Learun.Application.WebApi | |||
{ | |||
ReqFormEntity parameter = this.GetReqData<ReqFormEntity>(); | |||
DtStuLeaveEntity entity = parameter.strEntity.ToObject<DtStuLeaveEntity>(); | |||
dtStuLeaveIBLL.SaveEntity(parameter.keyValue,entity); | |||
return Success("保存成功!"); | |||
if (entity.BeginDate < entity.EndDate) | |||
{ | |||
TimeSpan ts = Convert.ToDateTime(entity.EndDate) - Convert.ToDateTime(entity.BeginDate); | |||
if (ts.Hours < 12) | |||
{ | |||
entity.LeaveDay = ("0.5").ToDecimal(); | |||
} | |||
else if (ts.Hours >= 12 && ts.Hours <= 24) | |||
{ | |||
entity.LeaveDay = 1; | |||
} | |||
else | |||
{ | |||
entity.LeaveDay = ts.Days; | |||
} | |||
entity.SchemeCode = "DtStuLeave"; | |||
var userinfo = LoginUserInfo.Get(); | |||
entity.CreateUserId = userinfo.userId; | |||
if (string.IsNullOrEmpty(parameter.keyValue)) | |||
{ | |||
entity.FlowNo = "0"; | |||
entity.LeaveAddTime = DateTime.Now; | |||
} | |||
dtStuLeaveIBLL.SaveEntity(parameter.keyValue, entity); | |||
return Success("保存成功!"); | |||
} | |||
else | |||
{ | |||
return Fail("请假时间不得早于结束时间"); | |||
} | |||
} | |||
#endregion | |||
#region 扩展代码 | |||
/// <summary> | |||
/// | |||
/// <param name="_"></param> | |||
/// <summary> | |||
/// <returns></returns> | |||
public Response SubmitForm(dynamic _) | |||
{ | |||
ReqFormEntity parameter = this.GetReqData<ReqFormEntity>(); | |||
DtStuLeaveEntity entity = parameter.strEntity.ToObject<DtStuLeaveEntity>(); | |||
entity.processId = Guid.NewGuid().ToString(); | |||
dtStuLeaveIBLL.SaveEntity(parameter.keyValue, entity); | |||
dtStuLeaveIBLL.ModifyStatus(parameter.keyValue, 1, parameter.strEntity); | |||
return Success("提交成功!"); | |||
} | |||
/// <summary> | |||
/// 休假 | |||
/// <param name="_"></param> | |||
/// <summary> | |||
/// <returns></returns> | |||
public Response CancelFrom(dynamic _) | |||
{ | |||
string keyValue = this.GetReqData(); | |||
dtStuLeaveIBLL.IsFinish(keyValue); | |||
return Success("销假成功!"); | |||
} | |||
#endregion | |||
@@ -106,9 +168,10 @@ namespace Learun.Application.WebApi | |||
/// <summary> | |||
/// 表单实体类 | |||
/// <summary> | |||
private class ReqFormEntity { | |||
private class ReqFormEntity | |||
{ | |||
public string keyValue { get; set; } | |||
public string strEntity{ get; set; } | |||
public string strEntity { get; set; } | |||
} | |||
#endregion | |||
@@ -210,6 +210,29 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
} | |||
} | |||
/// <summary> | |||
/// 完成销假 | |||
/// <param name="keyValue">主键</param> | |||
/// <summary> | |||
/// <returns></returns> | |||
public void IsFinish(string keyValue) | |||
{ | |||
try | |||
{ | |||
dtStuLeaveService.IsFinish(keyValue); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
#endregion | |||
} | |||
@@ -44,7 +44,12 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
#endregion | |||
#region 提交数据 | |||
/// <summary> | |||
/// 完成销假 | |||
/// <param name="keyValue">主键</param> | |||
/// <summary> | |||
/// <returns></returns> | |||
void IsFinish(string keyValue); | |||
/// <summary> | |||
/// 删除实体数据 | |||
/// <param name="keyValue">主键</param> | |||
@@ -188,6 +188,31 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 完成销假 | |||
/// <param name="keyValue">主键</param> | |||
/// <summary> | |||
/// <returns></returns> | |||
public void IsFinish(string keyValue) | |||
{ | |||
try | |||
{ | |||
var entity = this.BaseRepository("CollegeMIS").FindEntity<DtStuLeaveEntity>(a => a.Id == keyValue); | |||
entity.FlowNo = "3"; | |||
this.BaseRepository("CollegeMIS").Update(entity); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 保存实体数据(新增、修改) | |||