@@ -0,0 +1,117 @@ | |||
using Learun.Util; | |||
using System.Data; | |||
using Learun.Application.TwoDevelopment.CustomFunction; | |||
using System.Web.Mvc; | |||
using System.Collections.Generic; | |||
namespace Learun.Application.Web.Areas.CustomFunction.Controllers | |||
{ | |||
/// <summary> | |||
/// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 | |||
/// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 | |||
/// 创 建:超级管理员 | |||
/// 日 期:2021-09-27 14:45 | |||
/// 描 述:经费预算管理 | |||
/// </summary> | |||
public class FundsManageChildController : MvcControllerBase | |||
{ | |||
private FundsManageChildIBLL fundsManageChildIBLL = new FundsManageChildBLL(); | |||
#region 视图功能 | |||
/// <summary> | |||
/// 主页面 | |||
/// <summary> | |||
/// <returns></returns> | |||
[HttpGet] | |||
public ActionResult Index() | |||
{ | |||
return View(); | |||
} | |||
/// <summary> | |||
/// 表单页 | |||
/// <summary> | |||
/// <returns></returns> | |||
[HttpGet] | |||
public ActionResult Form() | |||
{ | |||
return View(); | |||
} | |||
#endregion | |||
#region 获取数据 | |||
/// <summary> | |||
/// 获取页面显示列表数据 | |||
/// </summary> | |||
/// <param name="pagination">分页参数</param> | |||
/// <param name="queryJson">查询参数</param> | |||
/// <returns></returns> | |||
[HttpGet] | |||
[AjaxOnly] | |||
public ActionResult GetPageList(string pagination, string queryJson) | |||
{ | |||
Pagination paginationobj = pagination.ToObject<Pagination>(); | |||
var data = fundsManageChildIBLL.GetPageList(paginationobj, queryJson); | |||
var jsonData = new | |||
{ | |||
rows = data, | |||
total = paginationobj.total, | |||
page = paginationobj.page, | |||
records = paginationobj.records | |||
}; | |||
return Success(jsonData); | |||
} | |||
/// <summary> | |||
/// 获取表单数据 | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <returns></returns> | |||
[HttpGet] | |||
[AjaxOnly] | |||
public ActionResult GetFormData(string keyValue) | |||
{ | |||
var FundsManageChildData = fundsManageChildIBLL.GetFundsManageChildEntity( keyValue ); | |||
var jsonData = new { | |||
FundsManageChild = FundsManageChildData, | |||
}; | |||
return Success(jsonData); | |||
} | |||
#endregion | |||
#region 提交数据 | |||
/// <summary> | |||
/// 删除实体数据 | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <returns></returns> | |||
[HttpPost] | |||
[AjaxOnly] | |||
public ActionResult DeleteForm(string keyValue) | |||
{ | |||
fundsManageChildIBLL.DeleteEntity(keyValue); | |||
return Success("删除成功!"); | |||
} | |||
/// <summary> | |||
/// 保存实体数据(新增、修改) | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <param name="strEntity">实体</param> | |||
/// <returns></returns> | |||
[HttpPost] | |||
[ValidateAntiForgeryToken] | |||
[AjaxOnly] | |||
public ActionResult SaveForm(string keyValue, string strEntity) | |||
{ | |||
FundsManageChildEntity entity = strEntity.ToObject<FundsManageChildEntity>(); | |||
fundsManageChildIBLL.SaveEntity(keyValue,entity); | |||
if (string.IsNullOrEmpty(keyValue)) | |||
{ | |||
} | |||
return Success("保存成功!"); | |||
} | |||
#endregion | |||
} | |||
} |
@@ -0,0 +1,121 @@ | |||
using Learun.Util; | |||
using System.Data; | |||
using Learun.Application.TwoDevelopment.CustomFunction; | |||
using System.Web.Mvc; | |||
using System.Collections.Generic; | |||
namespace Learun.Application.Web.Areas.CustomFunction.Controllers | |||
{ | |||
/// <summary> | |||
/// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 | |||
/// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 | |||
/// 创 建:超级管理员 | |||
/// 日 期:2021-09-27 11:38 | |||
/// 描 述:经费预算管理 | |||
/// </summary> | |||
public class FundsManageMainController : MvcControllerBase | |||
{ | |||
private FundsManageMainIBLL fundsManageMainIBLL = new FundsManageMainBLL(); | |||
private FundsManageChildIBLL fundsManageChildIBLL = new FundsManageChildBLL(); | |||
#region 视图功能 | |||
/// <summary> | |||
/// 主页面 | |||
/// <summary> | |||
/// <returns></returns> | |||
[HttpGet] | |||
public ActionResult Index() | |||
{ | |||
return View(); | |||
} | |||
/// <summary> | |||
/// 表单页 | |||
/// <summary> | |||
/// <returns></returns> | |||
[HttpGet] | |||
public ActionResult Form() | |||
{ | |||
return View(); | |||
} | |||
#endregion | |||
#region 获取数据 | |||
/// <summary> | |||
/// 获取页面显示列表数据 | |||
/// </summary> | |||
/// <param name="pagination">分页参数</param> | |||
/// <param name="queryJson">查询参数</param> | |||
/// <returns></returns> | |||
[HttpGet] | |||
[AjaxOnly] | |||
public ActionResult GetPageList(string pagination, string queryJson) | |||
{ | |||
Pagination paginationobj = pagination.ToObject<Pagination>(); | |||
var data = fundsManageMainIBLL.GetPageList(paginationobj, queryJson); | |||
var jsonData = new | |||
{ | |||
rows = data, | |||
total = paginationobj.total, | |||
page = paginationobj.page, | |||
records = paginationobj.records | |||
}; | |||
return Success(jsonData); | |||
} | |||
/// <summary> | |||
/// 获取表单数据 | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <returns></returns> | |||
[HttpGet] | |||
[AjaxOnly] | |||
public ActionResult GetFormData(string keyValue) | |||
{ | |||
var FundsManageMainData = fundsManageMainIBLL.GetFundsManageMainEntity(keyValue); | |||
var FundsManageChildData = fundsManageChildIBLL.GetListByMainId(keyValue); | |||
var jsonData = new | |||
{ | |||
FundsManageMain = FundsManageMainData, | |||
FundsManageChild = FundsManageChildData | |||
}; | |||
return Success(jsonData); | |||
} | |||
#endregion | |||
#region 提交数据 | |||
/// <summary> | |||
/// 删除实体数据 | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <returns></returns> | |||
[HttpPost] | |||
[AjaxOnly] | |||
public ActionResult DeleteForm(string keyValue) | |||
{ | |||
fundsManageMainIBLL.DeleteEntity(keyValue); | |||
return Success("删除成功!"); | |||
} | |||
/// <summary> | |||
/// 保存实体数据(新增、修改) | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <param name="strEntity">实体</param> | |||
/// <returns></returns> | |||
[HttpPost] | |||
[ValidateAntiForgeryToken] | |||
[AjaxOnly] | |||
public ActionResult SaveForm(string keyValue, string strEntity, string FundsManageChildList) | |||
{ | |||
FundsManageMainEntity entity = strEntity.ToObject<FundsManageMainEntity>(); | |||
entity.Status = 0; | |||
List<FundsManageChildEntity> fundsManageChildList = FundsManageChildList.ToObject<List<FundsManageChildEntity>>(); | |||
fundsManageMainIBLL.SaveEntity(keyValue, entity, fundsManageChildList); | |||
return Success("保存成功!"); | |||
} | |||
#endregion | |||
} | |||
} |
@@ -0,0 +1,19 @@ | |||
@{ | |||
ViewBag.Title = "经费预算管理"; | |||
Layout = "~/Views/Shared/_Form.cshtml"; | |||
} | |||
<div class="lr-form-wrap" id="form"> | |||
<div class="col-xs-12 lr-form-item" data-table="FundsManageChild" > | |||
<div class="lr-form-item-title">经费预算类型</div> | |||
<div id="Type" ></div> | |||
</div> | |||
<div class="col-xs-12 lr-form-item" data-table="FundsManageChild" > | |||
<div class="lr-form-item-title">费用摘要</div> | |||
<input id="Remark" type="text" class="form-control" /> | |||
</div> | |||
<div class="col-xs-12 lr-form-item" data-table="FundsManageChild" > | |||
<div class="lr-form-item-title">费用金额</div> | |||
<input id="Amount" type="number" class="form-control" /> | |||
</div> | |||
</div> | |||
@Html.AppendJsFile("/Areas/CustomFunction/Views/FundsManageChild/Form.js") |
@@ -0,0 +1,70 @@ | |||
/* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn) | |||
* Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 | |||
* 创建人:超级管理员 | |||
* 日 期:2021-09-27 14:45 | |||
* 描 述:经费预算管理 | |||
*/ | |||
var acceptClick; | |||
var keyValue = request('keyValue'); | |||
var selectedRow; | |||
var bootstrap = function ($, learun) { | |||
"use strict"; | |||
selectedRow = top["layer_form_FundsManageMain"].selectedRow; | |||
var page = { | |||
init: function () { | |||
$('.lr-form-wrap').lrscroll(); | |||
page.bind(); | |||
page.initData(); | |||
}, | |||
bind: function () { | |||
$('#Type').lrDataSourceSelect({ code: 'FundsTypeManage', value: 'id', text: 'name' }); | |||
}, | |||
initData: function () { | |||
//if (!!keyValue) { | |||
// $.lrSetForm(top.$.rootUrl + '/CustomFunction/FundsManageChild/GetFormData?keyValue=' + keyValue, function (data) { | |||
// for (var id in data) { | |||
// if (!!data[id].length && data[id].length > 0) { | |||
// $('#' + id ).jfGridSet('refreshdata', data[id]); | |||
// } | |||
// else { | |||
// $('[data-table="' + id + '"]').lrSetFormData(data[id]); | |||
// } | |||
// } | |||
// }); | |||
//} | |||
if (!!keyValue) { | |||
if (!!selectedRow) { | |||
$('#form').lrSetFormData(selectedRow); | |||
} | |||
} | |||
} | |||
}; | |||
// 保存数据 | |||
acceptClick = function (callBack) { | |||
if (!$('body').lrValidform()) { | |||
return false; | |||
} | |||
//var postData = { | |||
// strEntity: JSON.stringify($('body').lrGetFormData()) | |||
//}; | |||
//$.lrSaveForm(top.$.rootUrl + '/CustomFunction/FundsManageChild/SaveForm?keyValue=' + keyValue, postData, function (res) { | |||
// // 保存成功后才回调 | |||
// if (!!callBack) { | |||
// callBack(); | |||
// } | |||
//}); | |||
var postData = $('body').lrGetFormData(); | |||
if (!!keyValue) { | |||
if (!!selectedRow) { | |||
postData.ID = selectedRow.ID; | |||
} | |||
} else { | |||
postData.ID = learun.newGuid(); | |||
} | |||
if (!!callBack) { | |||
callBack(postData); | |||
return true; | |||
} | |||
}; | |||
page.init(); | |||
} |
@@ -0,0 +1,27 @@ | |||
@{ | |||
ViewBag.Title = "经费预算管理"; | |||
Layout = "~/Views/Shared/_Index.cshtml"; | |||
} | |||
<div class="lr-layout " > | |||
<div class="lr-layout-center"> | |||
<div class="lr-layout-wrap lr-layout-wrap-notitle "> | |||
<div class="lr-layout-tool"> | |||
<div class="lr-layout-tool-left"> | |||
</div> | |||
<div class="lr-layout-tool-right"> | |||
<div class=" btn-group btn-group-sm"> | |||
<a id="lr_refresh" class="btn btn-default"><i class="fa fa-refresh"></i></a> | |||
</div> | |||
<div class=" btn-group btn-group-sm" learun-authorize="yes"> | |||
<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_print" class="btn btn-default"><i class="fa fa-print"></i> 打印</a> | |||
</div> | |||
</div> | |||
</div> | |||
<div class="lr-layout-body" id="gridtable"></div> | |||
</div> | |||
</div> | |||
</div> | |||
@Html.AppendJsFile("/Areas/CustomFunction/Views/FundsManageChild/Index.js") |
@@ -0,0 +1,100 @@ | |||
/* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn) | |||
* Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 | |||
* 创建人:超级管理员 | |||
* 日 期:2021-09-27 14:45 | |||
* 描 述:经费预算管理 | |||
*/ | |||
var refreshGirdData; | |||
var bootstrap = function ($, learun) { | |||
"use strict"; | |||
var page = { | |||
init: function () { | |||
page.initGird(); | |||
page.bind(); | |||
}, | |||
bind: function () { | |||
// 刷新 | |||
$('#lr_refresh').on('click', function () { | |||
location.reload(); | |||
}); | |||
// 新增 | |||
$('#lr_add').on('click', function () { | |||
learun.layerForm({ | |||
id: 'form', | |||
title: '新增', | |||
url: top.$.rootUrl + '/CustomFunction/FundsManageChild/Form', | |||
width: 600, | |||
height: 400, | |||
callBack: function (id) { | |||
return top[id].acceptClick(refreshGirdData); | |||
} | |||
}); | |||
}); | |||
// 编辑 | |||
$('#lr_edit').on('click', function () { | |||
var keyValue = $('#gridtable').jfGridValue('ID'); | |||
if (learun.checkrow(keyValue)) { | |||
learun.layerForm({ | |||
id: 'form', | |||
title: '编辑', | |||
url: top.$.rootUrl + '/CustomFunction/FundsManageChild/Form?keyValue=' + keyValue, | |||
width: 600, | |||
height: 400, | |||
callBack: function (id) { | |||
return top[id].acceptClick(refreshGirdData); | |||
} | |||
}); | |||
} | |||
}); | |||
// 删除 | |||
$('#lr_delete').on('click', function () { | |||
var keyValue = $('#gridtable').jfGridValue('ID'); | |||
if (learun.checkrow(keyValue)) { | |||
learun.layerConfirm('是否确认删除该项!', function (res) { | |||
if (res) { | |||
learun.deleteForm(top.$.rootUrl + '/CustomFunction/FundsManageChild/DeleteForm', { keyValue: keyValue}, function () { | |||
refreshGirdData(); | |||
}); | |||
} | |||
}); | |||
} | |||
}); | |||
// 打印 | |||
$('#lr_print').on('click', function () { | |||
$('#gridtable').jqprintTable(); | |||
}); | |||
}, | |||
// 初始化列表 | |||
initGird: function () { | |||
$('#gridtable').lrAuthorizeJfGrid({ | |||
url: top.$.rootUrl + '/CustomFunction/FundsManageChild/GetPageList', | |||
headData: [ | |||
{ label: "经费预算类型", name: "Type", width: 100, align: "left", | |||
formatterAsync: function (callback, value, row, op,$cell) { | |||
learun.clientdata.getAsync('custmerData', { | |||
url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'FundsTypeManage', | |||
key: value, | |||
keyId: '', | |||
callback: function (_data) { | |||
callback(_data['']); | |||
} | |||
}); | |||
}}, | |||
{ label: "费用摘要", name: "Remark", width: 100, align: "left"}, | |||
{ label: "费用金额", name: "Amount", width: 100, align: "left"}, | |||
], | |||
mainId:'ID', | |||
isPage: true | |||
}); | |||
page.search(); | |||
}, | |||
search: function (param) { | |||
param = param || {}; | |||
$('#gridtable').jfGridSet('reload',{ queryJson: JSON.stringify(param) }); | |||
} | |||
}; | |||
refreshGirdData = function () { | |||
$('#gridtable').jfGridSet('reload'); | |||
}; | |||
page.init(); | |||
} |
@@ -0,0 +1,36 @@ | |||
@{ | |||
ViewBag.Title = "经费预算管理"; | |||
Layout = "~/Views/Shared/_Form.cshtml"; | |||
} | |||
<div class="lr-form-wrap" id="form"> | |||
<div class="col-xs-6 lr-form-item" data-table="FundsManageMain"> | |||
<div class="lr-form-item-title">项目编号<font face="宋体">*</font></div> | |||
<div id="SRProjectBasicId" isvalid="yes" checkexpession="NotNull"></div> | |||
</div> | |||
<div class="col-xs-6 lr-form-item" data-table="FundsManageMain"> | |||
<div class="lr-form-item-title">总预算<font face="宋体">*</font></div> | |||
<input id="FundsSum" type="text" class="form-control" readonly="readonly" /> | |||
</div> | |||
<div class="col-xs-6 lr-form-item" data-table="FundsManageMain"> | |||
<div class="lr-form-item-title">申请时间</div> | |||
<input id="CreateTime" type="text" readonly class="form-control currentInfo lr-currentInfo-time" /> | |||
</div> | |||
<div class="col-xs-6 lr-form-item" data-table="FundsManageMain"> | |||
<div class="lr-form-item-title">申请人</div> | |||
<input id="CreateUserId" type="text" readonly class="form-control currentInfo lr-currentInfo-user" /> | |||
</div> | |||
<div class="col-xs-12 lr-form-item" data-table="FundsManageMain"> | |||
<div class="lr-form-item-title">备注</div> | |||
<textarea id="Remark" class="form-control" style="height:100px;"></textarea> | |||
</div> | |||
<div class="col-xs-12 lr-form-item"> | |||
<div class="lr-form-item-title">明细操作</div> | |||
<input id="detailadd" type="button" class="btn btn-success" value="新增明细" /> | |||
<input id="detailedit" type="button" class="btn btn-warning" value="编辑明细" /> | |||
<input id="detaildel" type="button" class="btn btn-danger" value="移除明细" /> | |||
</div> | |||
<div class="col-xs-12 lr-form-item lr-form-item-grid"> | |||
<div id="FundsManageChild"></div> | |||
</div> | |||
</div> | |||
@Html.AppendJsFile("/Areas/CustomFunction/Views/FundsManageMain/Form.js") |
@@ -0,0 +1,182 @@ | |||
/* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn) | |||
* Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 | |||
* 创建人:超级管理员 | |||
* 日 期:2021-09-27 11:38 | |||
* 描 述:经费预算管理 | |||
*/ | |||
var acceptClick; | |||
var keyValue = request('keyValue'); | |||
// 设置表单数据 | |||
var setFormData; | |||
// 验证数据是否填写完整 | |||
var validForm; | |||
// 保存数据 | |||
var save; | |||
var refreshGirdData; | |||
var selectedRow; | |||
var numm = 1; | |||
var calcTotalPrice; | |||
var tempdatra = new Array(); | |||
var bootstrap = function ($, learun) { | |||
"use strict"; | |||
var page = { | |||
init: function () { | |||
$('.lr-form-wrap').lrscroll(); | |||
$("#detailadd").on('click', function () { | |||
selectedRow = null; | |||
learun.layerForm({ | |||
id: 'formFundsManageChild', | |||
title: '新增明细', | |||
url: top.$.rootUrl + '/CustomFunction/FundsManageChild/Form', | |||
width: 540, | |||
height: 400, | |||
callBack: function (id) { | |||
return top[id].acceptClick(refreshGirdData); | |||
} | |||
}); | |||
}); | |||
$("#detailedit").on('click', function () { | |||
var keyValue = $('#FundsManageChild').jfGridValue('ID'); | |||
selectedRow = $('#FundsManageChild').jfGridGet('rowdata'); | |||
console.log('selectedRow:', selectedRow); | |||
if (learun.checkrow(keyValue)) { | |||
learun.layerForm({ | |||
id: 'formFundsManageChild', | |||
title: '编辑明细', | |||
url: top.$.rootUrl + '/CustomFunction/FundsManageChild/Form?keyValue=' + keyValue, | |||
width: 540, | |||
height: 400, | |||
callBack: function (id) { | |||
return top[id].acceptClick(refreshGirdData); | |||
} | |||
}); | |||
} | |||
}); | |||
$("#detaildel").on('click', function () { | |||
var keyValue = $('#FundsManageChild').jfGridValue('ID'); | |||
if (learun.checkrow(keyValue)) { | |||
learun.layerConfirm('是否确认删除该项!', function (res, index) { | |||
if (res) { | |||
$.each(tempdatra, function (key, val) { | |||
if (tempdatra[key].ID === keyValue) { | |||
tempdatra.splice(key, 1); | |||
} | |||
}); | |||
$('#FundsManageChild').jfGridSet('refreshdata', tempdatra); | |||
calcTotalPrice(); | |||
top.layer.close(index); | |||
} | |||
}); | |||
} | |||
}); | |||
page.bind(); | |||
page.initData(); | |||
}, | |||
bind: function () { | |||
$('#SRProjectBasicId').lrselect({ | |||
allowSearch: true, | |||
url: top.$.rootUrl + '/CustomFunction/SRProjectBasic/GetList', | |||
value: "ID", | |||
text: "EnCode" | |||
}); | |||
$('#CreateTime').val(learun.formatDate(new Date(), 'yyyy-MM-dd hh:mm:ss')); | |||
$('#CreateUserId')[0].lrvalue = learun.clientdata.get(['userinfo']).userId; | |||
$('#CreateUserId').val(learun.clientdata.get(['userinfo']).realName); | |||
$('#FundsManageChild').jfGrid({ | |||
headData: [ | |||
{ | |||
label: '费用类型', name: 'Type', width: 100, align: 'left', | |||
formatterAsync: function (callback, value, row, op, $cell) { | |||
learun.clientdata.getAsync('custmerData', { | |||
url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'FundsTypeManage', | |||
key: value, | |||
keyId: 'id', | |||
callback: function (_data) { | |||
callback(_data['name']); | |||
} | |||
}); | |||
} | |||
}, | |||
{ | |||
label: '费用摘要', name: 'Remark', width: 100, align: 'left' | |||
}, | |||
{ | |||
label: '费用金额', name: 'Amount', width: 100, align: 'left' | |||
}, | |||
], | |||
height: 270, | |||
mainId: 'ID' | |||
}); | |||
}, | |||
initData: function () { | |||
if (!!keyValue) { | |||
$.lrSetForm(top.$.rootUrl + '/CustomFunction/FundsManageMain/GetFormData?keyValue=' + keyValue, function (data) { | |||
for (var id in data) { | |||
if (!!data[id].length && data[id].length > 0) { | |||
$('#' + id).jfGridSet('refreshdata', data[id]); | |||
tempdatra = data[id]; | |||
} | |||
else { | |||
$('[data-table="' + id + '"]').lrSetFormData(data[id]); | |||
} | |||
} | |||
}); | |||
} | |||
} | |||
}; | |||
refreshGirdData = function (temprow) { | |||
var ifnewrow = true; | |||
$.each(tempdatra, function (key, val) { | |||
if (tempdatra[key].ID === temprow.ID) { | |||
tempdatra[key] = temprow; | |||
ifnewrow = false; | |||
} | |||
}); | |||
if (ifnewrow) { | |||
tempdatra.push(temprow); | |||
} | |||
$('#FundsManageChild').jfGridSet('refreshdata', tempdatra); | |||
calcTotalPrice(); | |||
}; | |||
//计算总金额(=单价*数量) | |||
calcTotalPrice = function () { | |||
var totalprice = 0; | |||
$.each(tempdatra, function (i, item) { | |||
totalprice += Number(item.Amount); | |||
}); | |||
$('#FundsSum').val(totalprice.toFixed(2)); | |||
}; | |||
// 验证数据是否填写完整 | |||
validForm = function () { | |||
if (!$('.lr-form-wrap').lrValidform()) { | |||
return false; | |||
} | |||
var datas = $('#FundsManageChild').jfGridGet('rowdatas'); | |||
if (datas == null || datas.length == 0) { | |||
learun.alert.warning("申请未包含明细!请先新增明细!"); | |||
return false; | |||
} | |||
return true; | |||
}; | |||
// 保存数据 | |||
save = function (callBack, i) { | |||
var postData = {}; | |||
var formData = $('[data-table="FundsManageMain"]').lrGetFormData(); | |||
postData.strEntity = JSON.stringify(formData); | |||
postData.FundsManageChildList = JSON.stringify($('#FundsManageChild').jfGridGet('rowdatas')); | |||
//var postData = { | |||
// strEntity: JSON.stringify($('body').lrGetFormData()) | |||
//}; | |||
$.lrSaveForm(top.$.rootUrl + '/CustomFunction/FundsManageMain/SaveForm?keyValue=' + keyValue, postData, function (res) { | |||
// 保存成功后才回调 | |||
if (!!callBack) { | |||
callBack(formData, i); | |||
} | |||
}); | |||
}; | |||
page.init(); | |||
} |
@@ -0,0 +1,38 @@ | |||
@{ | |||
ViewBag.Title = "经费预算管理"; | |||
Layout = "~/Views/Shared/_Index.cshtml"; | |||
} | |||
<div class="lr-layout " > | |||
<div class="lr-layout-center"> | |||
<div class="lr-layout-wrap lr-layout-wrap-notitle "> | |||
<div class="lr-layout-tool"> | |||
<div class="lr-layout-tool-left"> | |||
<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> | |||
<div id="SRProjectBasicId"></div> | |||
</div> | |||
</div> | |||
</div> | |||
</div> | |||
</div> | |||
<div class="lr-layout-tool-right"> | |||
<div class=" btn-group btn-group-sm"> | |||
<a id="lr_refresh" class="btn btn-default"><i class="fa fa-refresh"></i></a> | |||
</div> | |||
<div class=" btn-group btn-group-sm" learun-authorize="yes"> | |||
<a id="lr_look" class="btn btn-default"><i class="fa fa-plus"></i> 查看</a> | |||
<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_print" class="btn btn-default"><i class="fa fa-print"></i> 打印</a> | |||
</div> | |||
</div> | |||
</div> | |||
<div class="lr-layout-body" id="gridtable"></div> | |||
</div> | |||
</div> | |||
</div> | |||
@Html.AppendJsFile("/Areas/CustomFunction/Views/FundsManageMain/Index.js") |
@@ -0,0 +1,138 @@ | |||
/* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn) | |||
* Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 | |||
* 创建人:超级管理员 | |||
* 日 期:2021-09-27 11:38 | |||
* 描 述:经费预算管理 | |||
*/ | |||
var refreshGirdData; | |||
var bootstrap = function ($, learun) { | |||
"use strict"; | |||
var page = { | |||
init: function () { | |||
page.initGird(); | |||
page.bind(); | |||
}, | |||
bind: function () { | |||
$('#multiple_condition_query').lrMultipleQuery(function (queryJson) { | |||
page.search(queryJson); | |||
}, 220, 400); | |||
$('#SRProjectBasicId').lrselect({ | |||
allowSearch: true, | |||
url: top.$.rootUrl + '/CustomFunction/SRProjectBasic/GetList', | |||
value: "ID", | |||
text: "EnCode" | |||
}); | |||
// 刷新 | |||
$('#lr_refresh').on('click', function () { | |||
location.reload(); | |||
}); | |||
// 新增 | |||
$('#lr_add').on('click', function () { | |||
learun.layerForm({ | |||
id: 'form_FundsManageMain', | |||
title: '新增', | |||
url: top.$.rootUrl + '/CustomFunction/FundsManageMain/Form', | |||
width: 900, | |||
height: 650, | |||
callBack: function (id) { | |||
var res = false; | |||
// 验证数据 | |||
res = top[id].validForm(); | |||
// 保存数据 | |||
if (res) { | |||
res = top[id].save( function () { | |||
page.search(); | |||
}); | |||
} | |||
return res;//return top[id].acceptClick(refreshGirdData); | |||
} | |||
}); | |||
}); | |||
// 编辑 | |||
$('#lr_edit').on('click', function () { | |||
var keyValue = $('#gridtable').jfGridValue('ID'); | |||
if (learun.checkrow(keyValue)) { | |||
learun.layerForm({ | |||
id: 'form_FundsManageMain', | |||
title: '编辑', | |||
url: top.$.rootUrl + '/CustomFunction/FundsManageMain/Form?keyValue=' + keyValue, | |||
width: 900, | |||
height: 650, | |||
callBack: function (id) { | |||
var res = false; | |||
// 验证数据 | |||
res = top[id].validForm(); | |||
// 保存数据 | |||
if (res) { | |||
res = top[id].save( function () { | |||
page.search(); | |||
}); | |||
} | |||
return res; | |||
//return top[id].acceptClick(refreshGirdData); | |||
} | |||
}); | |||
} | |||
}); | |||
// 删除 | |||
$('#lr_delete').on('click', function () { | |||
var keyValue = $('#gridtable').jfGridValue('ID'); | |||
if (learun.checkrow(keyValue)) { | |||
learun.layerConfirm('是否确认删除该项!', function (res) { | |||
if (res) { | |||
learun.deleteForm(top.$.rootUrl + '/CustomFunction/FundsManageMain/DeleteForm', { keyValue: keyValue}, function () { | |||
refreshGirdData(); | |||
}); | |||
} | |||
}); | |||
} | |||
}); | |||
// 打印 | |||
$('#lr_print').on('click', function () { | |||
$('#gridtable').jqprintTable(); | |||
}); | |||
}, | |||
// 初始化列表 | |||
initGird: function () { | |||
$('#gridtable').lrAuthorizeJfGrid({ | |||
url: top.$.rootUrl + '/CustomFunction/FundsManageMain/GetPageList', | |||
headData: [ | |||
{ label: "项目编号", name: "SRProjectBasicId", width: 100, align: "left", | |||
formatterAsync: function (callback, value, row, op,$cell) { | |||
learun.clientdata.getAsync('custmerData', { | |||
url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CommunityInfo', | |||
key: value, | |||
keyId: 'id', | |||
callback: function (_data) { | |||
callback(_data['communityname']); | |||
} | |||
}); | |||
}}, | |||
{ label: "总预算", name: "FundsSum", width: 100, align: "left"}, | |||
{ label: "申请时间", name: "CreateTime", width: 100, align: "left"}, | |||
{ label: "申请人", name: "CreateUserId", 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: "Remark", width: 100, align: "left"}, | |||
], | |||
mainId:'ID', | |||
isPage: true | |||
}); | |||
page.search(); | |||
}, | |||
search: function (param) { | |||
param = param || {}; | |||
$('#gridtable').jfGridSet('reload',{ queryJson: JSON.stringify(param) }); | |||
} | |||
}; | |||
refreshGirdData = function () { | |||
$('#gridtable').jfGridSet('reload'); | |||
}; | |||
page.init(); | |||
} |
@@ -831,6 +831,8 @@ | |||
<Compile Include="Areas\CustomFunction\Controllers\SRProjectAchievementController.cs" /> | |||
<Compile Include="Areas\CustomFunction\Controllers\PaperManageController.cs" /> | |||
<Compile Include="Areas\CustomFunction\Controllers\FundsTypeManageController.cs" /> | |||
<Compile Include="Areas\CustomFunction\Controllers\FundsManageMainController.cs" /> | |||
<Compile Include="Areas\CustomFunction\Controllers\FundsManageChildController.cs" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Content Include="Areas\AdmissionsPlatform\Views\AP_OnlineUserInfo\DropOutIndex.js" /> | |||
@@ -6498,6 +6500,14 @@ | |||
<Content Include="Areas\CustomFunction\Views\FundsTypeManage\Index.js" /> | |||
<Content Include="Areas\CustomFunction\Views\FundsTypeManage\Form.cshtml" /> | |||
<Content Include="Areas\CustomFunction\Views\FundsTypeManage\Form.js" /> | |||
<Content Include="Areas\CustomFunction\Views\FundsManageMain\Index.cshtml" /> | |||
<Content Include="Areas\CustomFunction\Views\FundsManageMain\Index.js" /> | |||
<Content Include="Areas\CustomFunction\Views\FundsManageMain\Form.cshtml" /> | |||
<Content Include="Areas\CustomFunction\Views\FundsManageMain\Form.js" /> | |||
<Content Include="Areas\CustomFunction\Views\FundsManageChild\Index.cshtml" /> | |||
<Content Include="Areas\CustomFunction\Views\FundsManageChild\Index.js" /> | |||
<Content Include="Areas\CustomFunction\Views\FundsManageChild\Form.cshtml" /> | |||
<Content Include="Areas\CustomFunction\Views\FundsManageChild\Form.js" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Folder Include="Areas\LR_Desktop\Models\" /> | |||
@@ -0,0 +1,29 @@ | |||
using Learun.Application.TwoDevelopment.CustomFunction; | |||
using System.Data.Entity.ModelConfiguration; | |||
namespace Learun.Application.Mapping | |||
{ | |||
/// <summary> | |||
/// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 | |||
/// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 | |||
/// 创 建:超级管理员 | |||
/// 日 期:2021-09-27 14:45 | |||
/// 描 述:经费预算管理 | |||
/// </summary> | |||
public class FundsManageChildMap : EntityTypeConfiguration<FundsManageChildEntity> | |||
{ | |||
public FundsManageChildMap() | |||
{ | |||
#region 表、主键 | |||
//表 | |||
this.ToTable("FUNDSMANAGECHILD"); | |||
//主键 | |||
this.HasKey(t => t.ID); | |||
#endregion | |||
#region 配置关系 | |||
#endregion | |||
} | |||
} | |||
} | |||
@@ -0,0 +1,29 @@ | |||
using Learun.Application.TwoDevelopment.CustomFunction; | |||
using System.Data.Entity.ModelConfiguration; | |||
namespace Learun.Application.Mapping | |||
{ | |||
/// <summary> | |||
/// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 | |||
/// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 | |||
/// 创 建:超级管理员 | |||
/// 日 期:2021-09-27 11:38 | |||
/// 描 述:经费预算管理 | |||
/// </summary> | |||
public class FundsManageMainMap : EntityTypeConfiguration<FundsManageMainEntity> | |||
{ | |||
public FundsManageMainMap() | |||
{ | |||
#region 表、主键 | |||
//表 | |||
this.ToTable("FUNDSMANAGEMAIN"); | |||
//主键 | |||
this.HasKey(t => t.ID); | |||
#endregion | |||
#region 配置关系 | |||
#endregion | |||
} | |||
} | |||
} | |||
@@ -587,6 +587,8 @@ | |||
<Compile Include="CustomFunction\SRProjectAchievementMap.cs" /> | |||
<Compile Include="CustomFunction\PaperManageMap.cs" /> | |||
<Compile Include="CustomFunction\FundsTypeManageMap.cs" /> | |||
<Compile Include="CustomFunction\FundsManageMainMap.cs" /> | |||
<Compile Include="CustomFunction\FundsManageChildMap.cs" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<ProjectReference Include="..\..\..\Learun.Application.Organization\Learun.Application.Organization.csproj"> | |||
@@ -0,0 +1,147 @@ | |||
using Learun.Util; | |||
using System; | |||
using System.Data; | |||
using System.Collections.Generic; | |||
namespace Learun.Application.TwoDevelopment.CustomFunction | |||
{ | |||
/// <summary> | |||
/// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 | |||
/// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 | |||
/// 创 建:超级管理员 | |||
/// 日 期:2021-09-27 14:45 | |||
/// 描 述:经费预算管理 | |||
/// </summary> | |||
public class FundsManageChildBLL : FundsManageChildIBLL | |||
{ | |||
private FundsManageChildService fundsManageChildService = new FundsManageChildService(); | |||
#region 获取数据 | |||
/// <summary> | |||
/// 获取页面显示列表数据 | |||
/// </summary> | |||
/// <param name="pagination">分页参数</param> | |||
/// <param name="queryJson">查询参数</param> | |||
/// <returns></returns> | |||
public IEnumerable<FundsManageChildEntity> GetPageList(Pagination pagination, string queryJson) | |||
{ | |||
try | |||
{ | |||
return fundsManageChildService.GetPageList(pagination, queryJson); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 获取页面显示列表数据 | |||
/// </summary> | |||
/// <returns></returns> | |||
public IEnumerable<FundsManageChildEntity> GetListByMainId(string mainId) | |||
{ | |||
try | |||
{ | |||
return fundsManageChildService.GetListByMainId(mainId); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 获取FundsManageChild表实体数据 | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <returns></returns> | |||
public FundsManageChildEntity GetFundsManageChildEntity(string keyValue) | |||
{ | |||
try | |||
{ | |||
return fundsManageChildService.GetFundsManageChildEntity(keyValue); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
#endregion | |||
#region 提交数据 | |||
/// <summary> | |||
/// 删除实体数据 | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
public void DeleteEntity(string keyValue) | |||
{ | |||
try | |||
{ | |||
fundsManageChildService.DeleteEntity(keyValue); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 保存实体数据(新增、修改) | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <param name="entity">实体</param> | |||
/// <returns></returns> | |||
public void SaveEntity(string keyValue, FundsManageChildEntity entity) | |||
{ | |||
try | |||
{ | |||
fundsManageChildService.SaveEntity(keyValue, entity); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
#endregion | |||
} | |||
} |
@@ -0,0 +1,80 @@ | |||
using Learun.Util; | |||
using System; | |||
using System.ComponentModel.DataAnnotations.Schema; | |||
namespace Learun.Application.TwoDevelopment.CustomFunction | |||
{ | |||
/// <summary> | |||
/// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 | |||
/// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 | |||
/// 创 建:超级管理员 | |||
/// 日 期:2021-09-27 14:45 | |||
/// 描 述:经费预算管理 | |||
/// </summary> | |||
public class FundsManageChildEntity | |||
{ | |||
#region 实体成员 | |||
/// <summary> | |||
/// 主键 | |||
/// </summary> | |||
[Column("ID")] | |||
public string ID { get; set; } | |||
/// <summary> | |||
/// 主表id | |||
/// </summary> | |||
[Column("MAINID")] | |||
public string MainId { get; set; } | |||
/// <summary> | |||
/// 费用类型 | |||
/// </summary> | |||
[Column("TYPE")] | |||
public string Type { get; set; } | |||
/// <summary> | |||
/// 费用摘要 | |||
/// </summary> | |||
[Column("REMARK")] | |||
public string Remark { get; set; } | |||
/// <summary> | |||
/// 费用金额 | |||
/// </summary> | |||
[Column("AMOUNT")] | |||
public int? Amount { get; set; } | |||
/// <summary> | |||
/// 创建人 | |||
/// </summary> | |||
[Column("CREATEUSERID")] | |||
public string CreateUserId { get; set; } | |||
/// <summary> | |||
/// 创建人 | |||
/// </summary> | |||
[Column("CREATEUSERNAME")] | |||
public string CreateUserName { get; set; } | |||
/// <summary> | |||
/// 申请时间 | |||
/// </summary> | |||
[Column("CREATETIME")] | |||
public DateTime? CreateTime { get; set; } | |||
#endregion | |||
#region 扩展操作 | |||
/// <summary> | |||
/// 新增调用 | |||
/// </summary> | |||
public void Create() | |||
{ | |||
this.ID = Guid.NewGuid().ToString(); | |||
} | |||
/// <summary> | |||
/// 编辑调用 | |||
/// </summary> | |||
/// <param name="keyValue"></param> | |||
public void Modify(string keyValue) | |||
{ | |||
this.ID = keyValue; | |||
} | |||
#endregion | |||
#region 扩展字段 | |||
#endregion | |||
} | |||
} | |||
@@ -0,0 +1,49 @@ | |||
using Learun.Util; | |||
using System.Data; | |||
using System.Collections.Generic; | |||
namespace Learun.Application.TwoDevelopment.CustomFunction | |||
{ | |||
/// <summary> | |||
/// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 | |||
/// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 | |||
/// 创 建:超级管理员 | |||
/// 日 期:2021-09-27 14:45 | |||
/// 描 述:经费预算管理 | |||
/// </summary> | |||
public interface FundsManageChildIBLL | |||
{ | |||
#region 获取数据 | |||
/// <summary> | |||
/// 获取页面显示列表数据 | |||
/// </summary> | |||
/// <param name="queryJson">查询参数</param> | |||
/// <returns></returns> | |||
IEnumerable<FundsManageChildEntity> GetPageList(Pagination pagination, string queryJson); | |||
IEnumerable<FundsManageChildEntity> GetListByMainId(string mainId); | |||
/// <summary> | |||
/// 获取FundsManageChild表实体数据 | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <returns></returns> | |||
FundsManageChildEntity GetFundsManageChildEntity(string keyValue); | |||
#endregion | |||
#region 提交数据 | |||
/// <summary> | |||
/// 删除实体数据 | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
void DeleteEntity(string keyValue); | |||
/// <summary> | |||
/// 保存实体数据(新增、修改) | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <param name="entity">实体</param> | |||
void SaveEntity(string keyValue, FundsManageChildEntity entity); | |||
#endregion | |||
} | |||
} |
@@ -0,0 +1,166 @@ | |||
using Dapper; | |||
using Learun.DataBase.Repository; | |||
using Learun.Util; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Data; | |||
using System.Text; | |||
namespace Learun.Application.TwoDevelopment.CustomFunction | |||
{ | |||
/// <summary> | |||
/// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 | |||
/// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 | |||
/// 创 建:超级管理员 | |||
/// 日 期:2021-09-27 14:45 | |||
/// 描 述:经费预算管理 | |||
/// </summary> | |||
public class FundsManageChildService : RepositoryFactory | |||
{ | |||
#region 获取数据 | |||
/// <summary> | |||
/// 获取页面显示列表数据 | |||
/// </summary> | |||
/// <param name="pagination">查询参数</param> | |||
/// <param name="queryJson">查询参数</param> | |||
/// <returns></returns> | |||
public IEnumerable<FundsManageChildEntity> GetPageList(Pagination pagination, string queryJson) | |||
{ | |||
try | |||
{ | |||
var strSql = new StringBuilder(); | |||
strSql.Append("SELECT "); | |||
strSql.Append(@" | |||
t.ID, | |||
t.Type, | |||
t.Remark, | |||
t.Amount | |||
"); | |||
strSql.Append(" FROM FundsManageChild t "); | |||
strSql.Append(" WHERE 1=1 "); | |||
var queryParam = queryJson.ToJObject(); | |||
// 虚拟参数 | |||
var dp = new DynamicParameters(new { }); | |||
return this.BaseRepository("CollegeMIS").FindList<FundsManageChildEntity>(strSql.ToString(), dp, pagination); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
public IEnumerable<FundsManageChildEntity> GetListByMainId(string mainId) | |||
{ | |||
try | |||
{ | |||
return this.BaseRepository("CollegeMIS").FindList<FundsManageChildEntity>(x => x.MainId == mainId); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 获取FundsManageChild表实体数据 | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <returns></returns> | |||
public FundsManageChildEntity GetFundsManageChildEntity(string keyValue) | |||
{ | |||
try | |||
{ | |||
return this.BaseRepository("CollegeMIS").FindEntity<FundsManageChildEntity>(keyValue); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
#endregion | |||
#region 提交数据 | |||
/// <summary> | |||
/// 删除实体数据 | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
public void DeleteEntity(string keyValue) | |||
{ | |||
try | |||
{ | |||
this.BaseRepository("CollegeMIS").Delete<FundsManageChildEntity>(t => t.ID == keyValue); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 保存实体数据(新增、修改) | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <param name="entity">实体</param> | |||
public void SaveEntity(string keyValue, FundsManageChildEntity entity) | |||
{ | |||
try | |||
{ | |||
if (!string.IsNullOrEmpty(keyValue)) | |||
{ | |||
entity.Modify(keyValue); | |||
this.BaseRepository("CollegeMIS").Update(entity); | |||
} | |||
else | |||
{ | |||
entity.Create(); | |||
this.BaseRepository("CollegeMIS").Insert(entity); | |||
} | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
#endregion | |||
} | |||
} |
@@ -0,0 +1,125 @@ | |||
using Learun.Util; | |||
using System; | |||
using System.Data; | |||
using System.Collections.Generic; | |||
namespace Learun.Application.TwoDevelopment.CustomFunction | |||
{ | |||
/// <summary> | |||
/// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 | |||
/// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 | |||
/// 创 建:超级管理员 | |||
/// 日 期:2021-09-27 11:38 | |||
/// 描 述:经费预算管理 | |||
/// </summary> | |||
public class FundsManageMainBLL : FundsManageMainIBLL | |||
{ | |||
private FundsManageMainService fundsManageMainService = new FundsManageMainService(); | |||
#region 获取数据 | |||
/// <summary> | |||
/// 获取页面显示列表数据 | |||
/// </summary> | |||
/// <param name="pagination">分页参数</param> | |||
/// <param name="queryJson">查询参数</param> | |||
/// <returns></returns> | |||
public IEnumerable<FundsManageMainEntity> GetPageList(Pagination pagination, string queryJson) | |||
{ | |||
try | |||
{ | |||
return fundsManageMainService.GetPageList(pagination, queryJson); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 获取FundsManageMain表实体数据 | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <returns></returns> | |||
public FundsManageMainEntity GetFundsManageMainEntity(string keyValue) | |||
{ | |||
try | |||
{ | |||
return fundsManageMainService.GetFundsManageMainEntity(keyValue); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
#endregion | |||
#region 提交数据 | |||
/// <summary> | |||
/// 删除实体数据 | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
public void DeleteEntity(string keyValue) | |||
{ | |||
try | |||
{ | |||
fundsManageMainService.DeleteEntity(keyValue); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 保存实体数据(新增、修改) | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <param name="entity">实体</param> | |||
/// <returns></returns> | |||
public void SaveEntity(string keyValue, FundsManageMainEntity entity, List<FundsManageChildEntity> fundsManageChildList) | |||
{ | |||
try | |||
{ | |||
fundsManageMainService.SaveEntity(keyValue, entity, fundsManageChildList); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
#endregion | |||
} | |||
} |
@@ -0,0 +1,85 @@ | |||
using Learun.Util; | |||
using System; | |||
using System.ComponentModel.DataAnnotations.Schema; | |||
namespace Learun.Application.TwoDevelopment.CustomFunction | |||
{ | |||
/// <summary> | |||
/// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 | |||
/// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 | |||
/// 创 建:超级管理员 | |||
/// 日 期:2021-09-27 11:38 | |||
/// 描 述:经费预算管理 | |||
/// </summary> | |||
public class FundsManageMainEntity | |||
{ | |||
#region 实体成员 | |||
/// <summary> | |||
/// 主键 | |||
/// </summary> | |||
[Column("ID")] | |||
public string ID { get; set; } | |||
/// <summary> | |||
/// 项目ID | |||
/// </summary> | |||
[Column("SRPROJECTBASICID")] | |||
public string SRProjectBasicId { get; set; } | |||
/// <summary> | |||
/// 总预算 | |||
/// </summary> | |||
[Column("FUNDSSUM")] | |||
public decimal? FundsSum { get; set; } | |||
/// <summary> | |||
/// 备注 | |||
/// </summary> | |||
[Column("REMARK")] | |||
public string Remark { get; set; } | |||
/// <summary> | |||
/// 状态 | |||
/// </summary> | |||
[Column("STATUS")] | |||
public int? Status { get; set; } | |||
/// <summary> | |||
/// 审核人 | |||
/// </summary> | |||
[Column("STATUSUSERID")] | |||
public string StatusUserId { get; set; } | |||
/// <summary> | |||
/// 创建人 | |||
/// </summary> | |||
[Column("CREATEUSERID")] | |||
public string CreateUserId { get; set; } | |||
/// <summary> | |||
/// 创建人 | |||
/// </summary> | |||
[Column("CREATEUSERNAME")] | |||
public string CreateUserName { get; set; } | |||
/// <summary> | |||
/// 申请时间 | |||
/// </summary> | |||
[Column("CREATETIME")] | |||
public DateTime? CreateTime { get; set; } | |||
#endregion | |||
#region 扩展操作 | |||
/// <summary> | |||
/// 新增调用 | |||
/// </summary> | |||
public void Create() | |||
{ | |||
this.ID = Guid.NewGuid().ToString(); | |||
} | |||
/// <summary> | |||
/// 编辑调用 | |||
/// </summary> | |||
/// <param name="keyValue"></param> | |||
public void Modify(string keyValue) | |||
{ | |||
this.ID = keyValue; | |||
} | |||
#endregion | |||
#region 扩展字段 | |||
#endregion | |||
} | |||
} | |||
@@ -0,0 +1,48 @@ | |||
using Learun.Util; | |||
using System.Data; | |||
using System.Collections.Generic; | |||
namespace Learun.Application.TwoDevelopment.CustomFunction | |||
{ | |||
/// <summary> | |||
/// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 | |||
/// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 | |||
/// 创 建:超级管理员 | |||
/// 日 期:2021-09-27 11:38 | |||
/// 描 述:经费预算管理 | |||
/// </summary> | |||
public interface FundsManageMainIBLL | |||
{ | |||
#region 获取数据 | |||
/// <summary> | |||
/// 获取页面显示列表数据 | |||
/// </summary> | |||
/// <param name="queryJson">查询参数</param> | |||
/// <returns></returns> | |||
IEnumerable<FundsManageMainEntity> GetPageList(Pagination pagination, string queryJson); | |||
/// <summary> | |||
/// 获取FundsManageMain表实体数据 | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <returns></returns> | |||
FundsManageMainEntity GetFundsManageMainEntity(string keyValue); | |||
#endregion | |||
#region 提交数据 | |||
/// <summary> | |||
/// 删除实体数据 | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
void DeleteEntity(string keyValue); | |||
/// <summary> | |||
/// 保存实体数据(新增、修改) | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <param name="entity">实体</param> | |||
void SaveEntity(string keyValue, FundsManageMainEntity entity, List<FundsManageChildEntity> fundsManageChildList); | |||
#endregion | |||
} | |||
} |
@@ -0,0 +1,165 @@ | |||
using Dapper; | |||
using Learun.DataBase.Repository; | |||
using Learun.Util; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Data; | |||
using System.Text; | |||
namespace Learun.Application.TwoDevelopment.CustomFunction | |||
{ | |||
/// <summary> | |||
/// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 | |||
/// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 | |||
/// 创 建:超级管理员 | |||
/// 日 期:2021-09-27 11:38 | |||
/// 描 述:经费预算管理 | |||
/// </summary> | |||
public class FundsManageMainService : RepositoryFactory | |||
{ | |||
#region 获取数据 | |||
/// <summary> | |||
/// 获取页面显示列表数据 | |||
/// </summary> | |||
/// <param name="pagination">查询参数</param> | |||
/// <param name="queryJson">查询参数</param> | |||
/// <returns></returns> | |||
public IEnumerable<FundsManageMainEntity> GetPageList(Pagination pagination, string queryJson) | |||
{ | |||
try | |||
{ | |||
var strSql = new StringBuilder(); | |||
strSql.Append("SELECT "); | |||
strSql.Append(@" | |||
t.ID, | |||
t.SRProjectBasicId, | |||
t.FundsSum, | |||
t.CreateTime, | |||
t.CreateUserId, | |||
t.Remark | |||
"); | |||
strSql.Append(" FROM FundsManageMain t "); | |||
strSql.Append(" WHERE 1=1 "); | |||
var queryParam = queryJson.ToJObject(); | |||
// 虚拟参数 | |||
var dp = new DynamicParameters(new { }); | |||
if (!queryParam["SRProjectBasicId"].IsEmpty()) | |||
{ | |||
dp.Add("SRProjectBasicId",queryParam["SRProjectBasicId"].ToString(), DbType.String); | |||
strSql.Append(" AND t.SRProjectBasicId = @SRProjectBasicId "); | |||
} | |||
return this.BaseRepository("CollegeMIS").FindList<FundsManageMainEntity>(strSql.ToString(),dp, pagination); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 获取FundsManageMain表实体数据 | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <returns></returns> | |||
public FundsManageMainEntity GetFundsManageMainEntity(string keyValue) | |||
{ | |||
try | |||
{ | |||
return this.BaseRepository("CollegeMIS").FindEntity<FundsManageMainEntity>(keyValue); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
#endregion | |||
#region 提交数据 | |||
/// <summary> | |||
/// 删除实体数据 | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
public void DeleteEntity(string keyValue) | |||
{ | |||
try | |||
{ | |||
this.BaseRepository("CollegeMIS").Delete<FundsManageMainEntity>(t=>t.ID == keyValue); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 保存实体数据(新增、修改) | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <param name="entity">实体</param> | |||
public void SaveEntity(string keyValue, FundsManageMainEntity entity, List<FundsManageChildEntity> fundsManageChildList) | |||
{ | |||
var db = this.BaseRepository("CollegeMIS").BeginTrans(); | |||
try | |||
{ | |||
if (!string.IsNullOrEmpty(keyValue)) | |||
{ | |||
entity.Modify(keyValue); | |||
db.Update(entity); | |||
} | |||
else | |||
{ | |||
entity.Create(); | |||
keyValue = entity.ID; | |||
db.Insert(entity); | |||
} | |||
db.Delete<FundsManageChildEntity>(t => t.MainId == keyValue); | |||
foreach (FundsManageChildEntity item in fundsManageChildList) | |||
{ | |||
item.Create(); | |||
item.MainId = keyValue; | |||
db.Insert(item); | |||
} | |||
db.Commit(); | |||
} | |||
catch (Exception ex) | |||
{ | |||
db.Rollback(); | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
#endregion | |||
} | |||
} |
@@ -1762,6 +1762,14 @@ | |||
<Compile Include="CustomFunction\FundsTypeManage\FundsTypeManageService.cs" /> | |||
<Compile Include="CustomFunction\FundsTypeManage\FundsTypeManageBLL.cs" /> | |||
<Compile Include="CustomFunction\FundsTypeManage\FundsTypeManageIBLL.cs" /> | |||
<Compile Include="CustomFunction\FundsManageMain\FundsManageMainEntity.cs" /> | |||
<Compile Include="CustomFunction\FundsManageMain\FundsManageMainService.cs" /> | |||
<Compile Include="CustomFunction\FundsManageMain\FundsManageMainBLL.cs" /> | |||
<Compile Include="CustomFunction\FundsManageMain\FundsManageMainIBLL.cs" /> | |||
<Compile Include="CustomFunction\FundsManageChild\FundsManageChildEntity.cs" /> | |||
<Compile Include="CustomFunction\FundsManageChild\FundsManageChildService.cs" /> | |||
<Compile Include="CustomFunction\FundsManageChild\FundsManageChildBLL.cs" /> | |||
<Compile Include="CustomFunction\FundsManageChild\FundsManageChildIBLL.cs" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<ProjectReference Include="..\..\..\Learun.Application.Organization\Learun.Application.Organization.csproj"> | |||