From 5f374f79c9802d3086b91e6537e6c9683819a388 Mon Sep 17 00:00:00 2001 From: ndbs Date: Wed, 14 Jun 2023 09:41:02 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9C=80=E6=B1=82=E5=8F=98=E6=9B=B4=20?= =?UTF-8?q?=E7=A7=91=E7=A0=94=E9=A1=B9=E7=9B=AE=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/SRProjectController.cs | 25 ++- .../Views/SRProject/CheckForm.cshtml | 19 ++ .../Views/SRProject/CheckForm.js | 53 ++++++ .../Views/SRProject/Form.cshtml | 50 ++++-- .../Views/SRProject/Form.js | 3 + .../Views/SRProject/Index.cshtml | 18 +- .../Views/SRProject/Index.js | 164 ++++++++++++++++-- .../Learun.Application.Web.csproj | 2 + .../SRProject/SRProjectBLL.cs | 18 ++ .../SRProject/SRProjectEntity.cs | 75 +++++--- .../SRProject/SRProjectIBLL.cs | 1 + .../SRProject/SRProjectService.cs | 73 ++++++-- 12 files changed, 421 insertions(+), 80 deletions(-) create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/SRProject/CheckForm.cshtml create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/SRProject/CheckForm.js diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/SRProjectController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/SRProjectController.cs index b35745ad4..efdc197f3 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/SRProjectController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/SRProjectController.cs @@ -26,7 +26,7 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers [HttpGet] public ActionResult Index() { - return View(); + return View(); } /// /// 表单页 @@ -35,7 +35,12 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers [HttpGet] public ActionResult Form() { - return View(); + return View(); + } + [HttpGet] + public ActionResult CheckForm() + { + return View(); } #endregion @@ -69,8 +74,9 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers [AjaxOnly] public ActionResult GetFormData(string keyValue) { - var SRProjectData = sRProjectIBLL.GetSRProjectEntity( keyValue ); - var jsonData = new { + var SRProjectData = sRProjectIBLL.GetSRProjectEntity(keyValue); + var jsonData = new + { SRProject = SRProjectData, }; return Success(jsonData); @@ -102,9 +108,18 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers public ActionResult SaveForm(string keyValue, string strEntity) { SRProjectEntity entity = strEntity.ToObject(); - sRProjectIBLL.SaveEntity(keyValue,entity); + sRProjectIBLL.SaveEntity(keyValue, entity); return Success("保存成功!"); } + + [HttpPost] + [AjaxOnly] + public ActionResult CheckForm(string keyValue, string strEntity) + { + SRProjectEntity entity = strEntity.ToObject(); + sRProjectIBLL.CheckEntity(keyValue, entity); + return Success("评价成功!"); + } #endregion } diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/SRProject/CheckForm.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/SRProject/CheckForm.cshtml new file mode 100644 index 000000000..04c2b793c --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/SRProject/CheckForm.cshtml @@ -0,0 +1,19 @@ +@{ + ViewBag.Title = "SRProject"; + Layout = "~/Views/Shared/_Form.cshtml"; +} +
+
+
级别*
+
+
+
+
评价教师*
+ +
+
+
备注
+ +
+
+@Html.AppendJsFile("/Areas/PersonnelManagement/Views/SRProject/CheckForm.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/SRProject/CheckForm.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/SRProject/CheckForm.js new file mode 100644 index 000000000..16f5fb0e6 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/SRProject/CheckForm.js @@ -0,0 +1,53 @@ +/* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn) + * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + * 创建人:超级管理员 + * 日 期:2023-06-12 11:42 + * 描 述:TeachingCompetition + */ +var acceptClick; +var keyValue = request('keyValue'); +var bootstrap = function ($, learun) { + "use strict"; + var page = { + init: function () { + $('.lr-form-wrap').lrscroll(); + page.bind(); + //page.initData(); + }, + bind: function () { + $('#AuditUser')[0].lrvalue = learun.clientdata.get(['userinfo']).userId; + $('#AuditUser').val(learun.clientdata.get(['userinfo']).realName); + $('#Grade').lrDataItemSelect({ code: 'EncouragementDegree' }); + }, + //initData: function () { + //if (!!keyValue) { + // $.lrSetForm(top.$.rootUrl + '/EducationalAdministration/TeachingCompetition/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]); + // } + // } + // }); + //} + //} + }; + // 保存数据 + acceptClick = function (callBack) { + if (!$('body').lrValidform()) { + return false; + } + var postData = { + strEntity: JSON.stringify($('body').lrGetFormData()) + }; + $.lrSaveForm(top.$.rootUrl + '/PersonnelManagement/SRProject/CheckForm?keyValue=' + keyValue, postData, function (res) { + // 保存成功后才回调 + if (!!callBack) { + callBack(); + } + }); + }; + page.init(); +} diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/SRProject/Form.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/SRProject/Form.cshtml index 72f0093cb..faa3029b0 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/SRProject/Form.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/SRProject/Form.cshtml @@ -3,25 +3,45 @@ Layout = "~/Views/Shared/_Form.cshtml"; }
-
-
名称
- +
+
部门*
+
-
-
内容
- +
+
主持人*
+
-
-
单位
- +
+
组员
+
-
-
经费
- +
+
题目
+
-
-
参与人
- +
+
课题编号
+ +
+
+
立项时间*
+ +
+
+
结题时间*
+ +
+
+
奖励金额
+ +
+
+
成果形式
+ +
+
+
备注
+
@Html.AppendJsFile("/Areas/PersonnelManagement/Views/SRProject/Form.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/SRProject/Form.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/SRProject/Form.js index 78cffcb42..c9169e005 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/SRProject/Form.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/SRProject/Form.js @@ -15,6 +15,9 @@ var bootstrap = function ($, learun) { page.initData(); }, bind: function () { + $('#DepartmentId').lrDataSourceSelect({ code: 'classdata', value: 'id', text: 'name' }); + $('#Compere').lrDataSourceSelect({ code: 'TeacherInfo', value: 'f_account', text: 'f_realname' }); + $('#Participant').lrUserSelect(1); }, initData: function () { if (!!keyValue) { diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/SRProject/Index.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/SRProject/Index.cshtml index da07c1c53..6674aaf3c 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/SRProject/Index.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/SRProject/Index.cshtml @@ -11,13 +11,18 @@
-
名称
- +
部门
+
-
单位
- +
级别
+
+
+
题目
+ +
+
@@ -27,9 +32,10 @@
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/SRProject/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/SRProject/Index.js index ac19a258c..02d194387 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/SRProject/Index.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/SRProject/Index.js @@ -16,18 +16,20 @@ var bootstrap = function ($, learun) { $('#multiple_condition_query').lrMultipleQuery(function (queryJson) { page.search(queryJson); }, 220, 400); + $('#DepartmentId').lrDataSourceSelect({ code: 'classdata', value: 'id', text: 'name' }); + $('#Grade').lrDataItemSelect({ code: 'EncouragementDegree' }); // 刷新 $('#lr_refresh').on('click', function () { location.reload(); }); // 新增 $('#lr_add').on('click', function () { - learun.layerForm({ + learun.layerForm({ id: 'form', title: '新增', url: top.$.rootUrl + '/PersonnelManagement/SRProject/Form', width: 600, - height: 400, + height: 500, callBack: function (id) { return top[id].acceptClick(refreshGirdData); } @@ -37,12 +39,16 @@ var bootstrap = function ($, learun) { $('#lr_edit').on('click', function () { var keyValue = $('#gridtable').jfGridValue('ID'); if (learun.checkrow(keyValue)) { + if (keyValue.indexOf(',') != -1) { + learun.alert.warning("只能选择一条记录进行编辑!"); + return; + } learun.layerForm({ id: 'form', title: '编辑', url: top.$.rootUrl + '/PersonnelManagement/SRProject/Form?keyValue=' + keyValue, width: 600, - height: 400, + height: 500, callBack: function (id) { return top[id].acceptClick(refreshGirdData); } @@ -53,35 +59,165 @@ var bootstrap = function ($, learun) { $('#lr_delete').on('click', function () { var keyValue = $('#gridtable').jfGridValue('ID'); if (learun.checkrow(keyValue)) { - learun.layerConfirm('是否确认删除该项!', function (res) { + learun.layerConfirm('是否确认删除该项!', function (res) { if (res) { - learun.deleteForm(top.$.rootUrl + '/PersonnelManagement/SRProject/DeleteForm', { keyValue: keyValue}, function () { + learun.deleteForm(top.$.rootUrl + '/PersonnelManagement/SRProject/DeleteForm', { keyValue: keyValue }, function () { refreshGirdData(); }); } }); } }); + // 评价 + $('#lr_check').on('click', function () { + var keyValue = $('#gridtable').jfGridValue('ID'); + if (learun.checkrow(keyValue)) { + learun.layerForm({ + id: 'form', + title: '评价', + url: top.$.rootUrl + '/PersonnelManagement/SRProject/CheckForm?keyValue=' + keyValue, + width: 600, + height: 300, + callBack: function (id) { + return top[id].acceptClick(refreshGirdData); + } + }); + } + }); }, // 初始化列表 initGird: function () { - $('#gridtable').lrAuthorizeJfGrid({ + $('#gridtable').jfGrid({ url: top.$.rootUrl + '/PersonnelManagement/SRProject/GetPageList', headData: [ - { label: "名称", name: "Name", width: 100, align: "left"}, - { label: "内容", name: "Content", width: 100, align: "left"}, - { label: "单位", name: "Unit", width: 100, align: "left"}, - { label: "经费", name: "Amount", width: 100, align: "left"}, - { label: "参与人", name: "Participant", width: 100, align: "left"}, + { + label: "部门", name: "DepartmentId", width: 100, align: "left", + formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('custmerData', { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'classdata', + key: value, + keyId: 'id', + callback: function (_data) { + callback(_data['name']); + } + }); + } + }, + { + label: "主持人", name: "Compere", width: 100, align: "left", + formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('custmerData', { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'TeacherInfo', + key: value, + keyId: 'f_account', + callback: function (_data) { + callback(_data['f_realname']); + } + }); + } + }, + { + label: "参与人", name: "Participant", width: 240, align: "left", + formatterAsync: function (callback, value, row, op, $cell) { + if (value && value.indexOf(',') != -1) { + var content = ''; + var texts = value.split(','); + for (var i = 0; i < texts.length; i++) { + learun.clientdata.getAsync('custmerData', { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'TeacherInfo', + key: texts[i], + keyId: 'f_userid', + callback: function (_data) { + callback(content += _data.f_realname + ','); + } + }); + + } + content = content.substring(0, content.length - 1); + callback(content); + } else { + learun.clientdata.getAsync('custmerData', { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'TeacherInfo', + key: value, + keyId: 'f_userid', + callback: function (_data) { + callback(_data['f_realname']); + } + }); + } + } + }, + { label: "题目", name: "TaskContent", width: 100, align: "left" }, + { label: "课题编号", name: "TaskNo", width: 100, align: "left" }, + { + label: "立项时间", name: "StartTime", width: 100, align: "left" + , formatter: function (cellvalue) { + return learun.formatDate(cellvalue, 'yyyy-MM-dd'); + } + }, + { + label: "结题时间", name: "EndTime", width: 100, align: "left" + , formatter: function (cellvalue) { + return learun.formatDate(cellvalue, 'yyyy-MM-dd'); + } + }, + { label: "成果形式", name: "ResultForm", width: 100, align: "left" }, + { + label: "级别", name: "Grade", width: 100, align: "left", + formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('dataItem', { + key: value, + code: 'EncouragementDegree', + callback: function (_data) { + callback(_data.text); + } + }); + } + }, + { + label: "审批部门", name: "AuditDepartment", width: 100, align: "left", + formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('custmerData', { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'classdata', + key: value, + keyId: 'id', + callback: function (_data) { + callback(_data['name']); + } + }); + } + }, + { + label: "审批用户", name: "AuditUser", width: 100, align: "left", + formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('custmerData', { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'TeacherInfo', + key: value, + keyId: 'f_userid', + callback: function (_data) { + callback(_data['f_realname']); + } + }); + } + }, + { + label: "审批时间", name: "AuditTime", width: 100, align: "left" + , formatter: function (cellvalue) { + return learun.formatDate(cellvalue, 'yyyy-MM-dd hh-mm-ss'); + } + }, + { label: "审批备注", name: "AuditRemark", width: 100, align: "left" }, ], - mainId:'ID', - isPage: true + mainId: 'ID', + isPage: true, + isMultiselect: true, + sidx: "CreateTime desc" }); page.search(); }, search: function (param) { param = param || {}; - $('#gridtable').jfGridSet('reload',{ queryJson: JSON.stringify(param) }); + $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); } }; refreshGirdData = function () { diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj b/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj index 3ffbd47a6..535de509d 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj @@ -1860,6 +1860,7 @@ + @@ -8123,6 +8124,7 @@ + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/SRProject/SRProjectBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/SRProject/SRProjectBLL.cs index 27550a959..eb158d637 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/SRProject/SRProjectBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/SRProject/SRProjectBLL.cs @@ -118,6 +118,24 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement } } + public void CheckEntity(string keyValue, SRProjectEntity entity) + { + try + { + sRProjectService.CheckEntity(keyValue, entity); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } #endregion } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/SRProject/SRProjectEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/SRProject/SRProjectEntity.cs index 1112c7586..59569d2e3 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/SRProject/SRProjectEntity.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/SRProject/SRProjectEntity.cs @@ -11,7 +11,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement /// 日 期:2019-12-31 10:49 /// 描 述:科技项目 ///
- public class SRProjectEntity + public class SRProjectEntity { #region 实体成员 /// @@ -19,31 +19,56 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement /// [Column("ID")] public string ID { get; set; } - /// - /// 名称 - /// - [Column("NAME")] - public string Name { get; set; } - /// - /// 内容 - /// - [Column("CONTENT")] - public string Content { get; set; } - /// - /// 单位 - /// - [Column("UNIT")] - public string Unit { get; set; } - /// - /// 经费 - /// - [Column("AMOUNT")] - public decimal? Amount { get; set; } - /// - /// 参与人 - /// + + [Column("DEPARTMENTID")] + public string DepartmentId { get; set; } + + [Column("COMPERE")] + public string Compere { get; set; } + [Column("PARTICIPANT")] public string Participant { get; set; } + + [Column("TASKCONTENT")] + public string TaskContent { get; set; } + + [Column("TASKNO")] + public string TaskNo { get; set; } + + [Column("STARTTIME")] + public DateTime? StartTime { get; set; } + + [Column("ENDTIME")] + public DateTime? EndTime { get; set; } + + [Column("AMOUNT")] + public decimal? Amount { get; set; } + + [Column("GRADE")] + public string Grade { get; set; } + + [Column("RESULTFORM")] + public string ResultForm { get; set; } + + [Column("REMARK")] + public string Remark { get; set; } + + [Column("CREATETIME")] + public DateTime? CreateTime { get; set; } + + [Column("CREATEUSER")] + public string CreateUser { get; set; } + + [Column("AUDITDEPARTMENT")] + public string AuditDepartment { get; set; } + + [Column("AUDITUSER")] + public string AuditUser { get; set; } + + [Column("AuditRemark")] + public string AuditRemark { get; set; } + [Column("AUDITTIME")] + public DateTime? AuditTime { get; set; } #endregion #region 扩展操作 @@ -53,6 +78,8 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement public void Create() { this.ID = Guid.NewGuid().ToString(); + this.CreateUser = LoginUserInfo.Get().userId; + this.CreateTime = DateTime.Now; } /// /// 编辑调用 diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/SRProject/SRProjectIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/SRProject/SRProjectIBLL.cs index f43ebc75b..43cf30cdb 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/SRProject/SRProjectIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/SRProject/SRProjectIBLL.cs @@ -43,6 +43,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement /// /// void SaveEntity(string keyValue, SRProjectEntity entity); + void CheckEntity(string keyValue, SRProjectEntity entity); #endregion } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/SRProject/SRProjectService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/SRProject/SRProjectService.cs index 65b502640..3ec40d4ac 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/SRProject/SRProjectService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/SRProject/SRProjectService.cs @@ -30,30 +30,28 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement { var strSql = new StringBuilder(); strSql.Append("SELECT "); - strSql.Append(@" - t.ID, - t.Name, - t.Content, - t.Unit, - t.Amount, - t.Participant - "); + strSql.Append(@"t.* "); strSql.Append(" FROM SRProject t "); strSql.Append(" WHERE 1=1 "); var queryParam = queryJson.ToJObject(); // 虚拟参数 var dp = new DynamicParameters(new { }); - if (!queryParam["Name"].IsEmpty()) + if (!queryParam["DepartmentId"].IsEmpty()) { - dp.Add("Name", "%" + queryParam["Name"].ToString() + "%", DbType.String); - strSql.Append(" AND t.Name Like @Name "); + dp.Add("DepartmentId", queryParam["DepartmentId"].ToString(), DbType.String); + strSql.Append(" AND t.DepartmentId = @DepartmentId "); } - if (!queryParam["Unit"].IsEmpty()) + if (!queryParam["TaskContent"].IsEmpty()) { - dp.Add("Unit", "%" + queryParam["Unit"].ToString() + "%", DbType.String); - strSql.Append(" AND t.Unit Like @Unit "); + dp.Add("TaskContent", "%" + queryParam["TaskContent"].ToString() + "%", DbType.String); + strSql.Append(" AND t.TaskContent Like @TaskContent "); } - return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(),dp, pagination); + if (!queryParam["Grade"].IsEmpty()) + { + dp.Add("Grade", queryParam["Grade"].ToString(), DbType.String); + strSql.Append(" AND t.Grade = @Grade "); + } + return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp, pagination); } catch (Exception ex) { @@ -103,12 +101,19 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement /// public void DeleteEntity(string keyValue) { + var db = this.BaseRepository("CollegeMIS").BeginTrans(); try { - this.BaseRepository("CollegeMIS").Delete(t=>t.ID == keyValue); + var id = keyValue.Split(','); + foreach (var item in id) + { + db.Delete(t => t.ID == item); + } + db.Commit(); } catch (Exception ex) { + db.Rollback(); if (ex is ExceptionEx) { throw; @@ -153,6 +158,42 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement } } + /// + /// 保存实体数据(新增、修改) + /// + /// 主键 + /// 实体 + public void CheckEntity(string keyValue, SRProjectEntity entity) + { + var db = this.BaseRepository("CollegeMIS").BeginTrans(); + try + { + var Id = keyValue.Split(','); + foreach (var item in Id) + { + SRProjectEntity model = db.FindEntity(x => x.ID == item); + model.Grade = entity.Grade; + model.AuditUser = entity.AuditUser; + model.AuditTime = DateTime.Now; + model.AuditDepartment = LoginUserInfo.Get().departmentId; + model.AuditRemark = entity.AuditRemark; + db.Update(model); + } + db.Commit(); + } + catch (Exception ex) + { + db.Rollback(); + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } #endregion }