@@ -85,19 +85,6 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers | |||
var data = partyCateIBLL.GetEntity(keyValue); | |||
return Success(data); | |||
} | |||
/// <summary> | |||
/// 获取左侧树形数据 | |||
/// <summary> | |||
/// <returns></returns> | |||
[HttpGet] | |||
[AjaxOnly] | |||
public ActionResult GetTree(string CType) | |||
{ | |||
var data = partyCateIBLL.GetTree(CType); | |||
return Success(data); | |||
} | |||
/// <summary> | |||
/// 获取字典分类列表(树结构) | |||
/// </summary> | |||
@@ -79,6 +79,18 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers | |||
}; | |||
return Success(jsonData); | |||
} | |||
/// <summary> | |||
/// 获取左侧树形数据 | |||
/// <summary> | |||
/// <returns></returns> | |||
[HttpGet] | |||
[AjaxOnly] | |||
public ActionResult GetTree(string CType) | |||
{ | |||
var data = partyManageIBLL.GetTree(CType); | |||
return Success(data); | |||
} | |||
#endregion | |||
#region 提交数据 | |||
@@ -3,15 +3,15 @@ | |||
Layout = "~/Views/Shared/_Form.cshtml"; | |||
} | |||
<div class="lr-form-wrap" id="form"> | |||
<div class="col-xs-12 lr-form-item"> | |||
<div class="col-xs-12 lr-form-item" data-table="PartyCate"> | |||
<div class="lr-form-item-title">上级</div> | |||
<div id="CParentId"></div> | |||
</div> | |||
<div class="col-xs-12 lr-form-item"> | |||
<div class="col-xs-12 lr-form-item" data-table="PartyCate"> | |||
<div class="lr-form-item-title">名称<font face="宋体">*</font></div> | |||
<input id="Name" type="text" class="form-control" isvalid="yes" checkexpession="NotNull" /> | |||
</div> | |||
<div class="col-xs-12 lr-form-item"> | |||
<div class="col-xs-12 lr-form-item" data-table="PartyCate"> | |||
<div class="lr-form-item-title">排序<font face="宋体">*</font></div> | |||
<input id="COrder" type="text" class="form-control" isvalid="yes" checkexpession="NotNull" /> | |||
</div> | |||
@@ -4,16 +4,17 @@ | |||
* 日 期:2023-08-03 17:25 | |||
* 描 述:PartyCate | |||
*/ | |||
var acceptClick; | |||
var parentId = request('parentId'); | |||
var CType = request('CType'); | |||
var selectedRow = top.layer_ClassifyIndex.selectedRow; | |||
var keyValue = request('keyValue'); | |||
var acceptClick; | |||
var bootstrap = function ($, learun) { | |||
"use strict"; | |||
var selectedRow = learun.frameTab.currentIframe().selectedRow; | |||
var page = { | |||
init: function () { | |||
$('.lr-form-wrap').lrscroll(); | |||
page.bind(); | |||
page.initData(); | |||
}, | |||
bind: function () { | |||
@@ -47,8 +48,6 @@ var bootstrap = function ($, learun) { | |||
learun.alert.error('上级不能是自己本身'); | |||
return false; | |||
} | |||
var postData = $('#form').lrGetFormData(); | |||
Console.log(postData,"postData") | |||
$.lrSaveForm(top.$.rootUrl + '/PersonnelManagement/PartyCate/SaveForm?keyValue=' + keyValue, postData, function (res) { | |||
// 保存成功后才回调 | |||
if (!!callBack) { | |||
@@ -4,8 +4,9 @@ | |||
* 日 期:2023-08-03 17:25 | |||
* 描 述:PartyCate | |||
*/ | |||
var selectedRow; | |||
var refreshGirdData; | |||
var selectedRow; | |||
var CType = request('CType'); | |||
var bootstrap = function ($, learun) { | |||
"use strict"; | |||
var page = { | |||
@@ -25,11 +26,12 @@ var bootstrap = function ($, learun) { | |||
}); | |||
// 新增 | |||
$('#lr_add').on('click', function () { | |||
var ID = $('#gridtable').jfGridValue('ID'); | |||
selectedRow = null; | |||
learun.layerForm({ | |||
id: 'form', | |||
title: '新增', | |||
url: top.$.rootUrl + '/PersonnelManagement/PartyCate/Form', | |||
url: top.$.rootUrl + '/PersonnelManagement/PartyCate/Form?parentId=' + ID + '&CType=' + CType, | |||
width: 400, | |||
height: 300, | |||
callBack: function (id) { | |||
@@ -39,13 +41,13 @@ var bootstrap = function ($, learun) { | |||
}); | |||
// 编辑 | |||
$('#lr_edit').on('click', function () { | |||
selectedRow = $('#gridtable').jfGridGet('rowdata'); | |||
var keyValue = $('#gridtable').jfGridValue('ID'); | |||
selectedRow = $('#gridtable').jfGridGet('rowdata'); | |||
if (learun.checkrow(keyValue)) { | |||
learun.layerForm({ | |||
id: 'form', | |||
title: '编辑', | |||
url: top.$.rootUrl + '/PersonnelManagement/PartyCate/Form?keyValue=' + keyValue, | |||
url: top.$.rootUrl + '/PersonnelManagement/PartyCate/Form?keyValue=' + keyValue + '&CType=' + CType, | |||
width: 400, | |||
height: 300, | |||
callBack: function (id) { | |||
@@ -70,10 +72,9 @@ var bootstrap = function ($, learun) { | |||
}, | |||
initGird: function () { | |||
$('#gridtable').lrAuthorizeJfGrid({ | |||
url: top.$.rootUrl + '/PersonnelManagement/PartyCate/GetPageList', | |||
url: top.$.rootUrl + '/PersonnelManagement/PartyCate/GetClassifyList?CType=' + CType, | |||
headData: [ | |||
{ label: '名称', name: 'Name', width: 200, align: "left" }, | |||
{ label: '排序', name: 'COrder', width: 200, align: "left" }, | |||
], | |||
mainId: 'ID', | |||
sidx: 'COrder desc', | |||
@@ -28,8 +28,9 @@ | |||
<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_category" class="btn btn-default"><i class="fa fa-print"></i> 目录管理</a> | |||
<a id="lr_print" class="btn btn-default"><i class="fa fa-print"></i> 打印</a> | |||
<a id="lr_category" class="btn btn-default"><i class="fa fa-print"></i> 目录管理</a> | |||
<a id="lr_statistics" class="btn btn-default"><i class="fa fa-print"></i> 访问情况统计</a> | |||
</div> | |||
</div> | |||
</div> | |||
@@ -22,10 +22,10 @@ var bootstrap = function ($, learun) { | |||
} | |||
// 初始化左侧树形数据 | |||
$('#dataTree').lrtree({ | |||
url: top.$.rootUrl + '/PersonnelManagement/PartyCateList/GetTree?CType=' + CType, | |||
url: top.$.rootUrl + '/PersonnelManagement/PartyManage/GetTree?CType=' + CType, | |||
nodeClick: function (item) { | |||
selectedId = item.value; | |||
page.search({ CId: item.value }); | |||
page.search({ CateId: item.value }); | |||
} | |||
}); | |||
// 时间搜索框 | |||
@@ -53,7 +53,7 @@ var bootstrap = function ($, learun) { | |||
startTime = begin; | |||
endTime = end; | |||
if (selectedId) { | |||
page.search({ CId: selectedId }); | |||
page.search({ CateId: selectedId }); | |||
} | |||
} | |||
}); | |||
@@ -63,7 +63,7 @@ var bootstrap = function ($, learun) { | |||
}); | |||
$('#multiple_condition_query').lrMultipleQuery(function (queryJson) { | |||
if (selectedId) { | |||
queryJson.CId = selectedId; | |||
queryJson.CateId = selectedId; | |||
page.search(queryJson); | |||
} | |||
}, 220, 400); | |||
@@ -112,7 +112,7 @@ var bootstrap = function ($, learun) { | |||
/*分类管理*/ | |||
$('#lr_category').on('click', function () { | |||
learun.layerForm({ | |||
id: 'TypeIndex', | |||
id: 'ClassifyIndex', | |||
title: '分类管理', | |||
url: top.$.rootUrl + '/PersonnelManagement/PartyCate/Index?CType=' + CType, | |||
width: 800, | |||
@@ -147,10 +147,10 @@ var bootstrap = function ($, learun) { | |||
}, | |||
// 初始化列表 | |||
initGird: function () { | |||
$('#gridtable').lrAuthorizeJfGrid({ | |||
$('#gridtable').jfGrid({ | |||
url: top.$.rootUrl + '/PersonnelManagement/PartyManage/GetPageList', | |||
headData: [ | |||
{ label: "所属分类", name: "CateId", width: 100, align: "left", | |||
{ label: "所属分类", name: "CateId", width: 200, align: "left", | |||
formatterAsync: function (callback, value, row, op,$cell) { | |||
learun.clientdata.getAsync('custmerData', { | |||
url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'partycate', | |||
@@ -161,9 +161,9 @@ var bootstrap = function ($, learun) { | |||
} | |||
}); | |||
}}, | |||
{ label: "标题", name: "Title", width: 100, align: "left"}, | |||
{ label: "标题", name: "Title", width: 200, align: "left"}, | |||
{ | |||
label: "附件上传", name: "Filepath", width: 100, align: "left" | |||
label: "附件上传", name: "Filepath", width: 200, align: "left" | |||
, formatterAsync: function (callback, value, row, op, $cell) { | |||
learun.clientdata.getAsync('custmerData', | |||
{ | |||
@@ -194,7 +194,7 @@ var bootstrap = function ($, learun) { | |||
}; | |||
refreshGirdData = function () { | |||
if (selectedId) { | |||
page.search({ CId: selectedId }); | |||
page.search({ CateId: selectedId }); | |||
} | |||
//$('#gridtable').jfGridSet('reload'); | |||
}; | |||
@@ -91,45 +91,6 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||
} | |||
} | |||
/// <summary> | |||
/// 获取左侧树形数据 | |||
/// <summary> | |||
/// <returns></returns> | |||
public List<TreeModel> GetTree(string CType) | |||
{ | |||
try | |||
{ | |||
DataTable list = partyCateService.GetSqlTree(CType); | |||
List<TreeModel> treeList = new List<TreeModel>(); | |||
foreach (DataRow item in list.Rows) | |||
{ | |||
TreeModel node = new TreeModel | |||
{ | |||
id = item["cid"].ToString(), | |||
text = item["cname"].ToString(), | |||
value = item["cid"].ToString(), | |||
showcheck = false, | |||
checkstate = 0, | |||
isexpand = true, | |||
parentId = item["cparentid"].ToString() | |||
}; | |||
treeList.Add(node); | |||
} | |||
return treeList.ToTree(); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 分类列表 | |||
/// </summary> | |||
@@ -35,7 +35,6 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||
/// <returns></returns> | |||
PartyCateEntity GetEntity(string keyValue); | |||
List<TreeModel> GetTree(string CType); | |||
List<TreeModel> GetClassifyTree(string CType); | |||
List<PartyCateEntity> GetClassifyList(string keyword, string CType); | |||
@@ -34,7 +34,16 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||
strSql.Append("SELECT "); | |||
strSql.Append(" t.* "); | |||
strSql.Append(" FROM PartyCate t "); | |||
return this.BaseRepository("CollegeMIS").FindList<PartyCateEntity>(strSql.ToString(), pagination); | |||
strSql.Append(" where 1=1 "); | |||
var queryParam = queryJson.ToJObject(); | |||
// 虚拟参数 | |||
var dp = new DynamicParameters(new { }); | |||
if (!queryParam["CateId"].IsEmpty()) | |||
{ | |||
dp.Add("CateId", queryParam["CateId"].ToString(), DbType.String); | |||
strSql.Append(" AND t.CateId = @CateId "); | |||
} | |||
return this.BaseRepository("CollegeMIS").FindList<PartyCateEntity>(strSql.ToString(), dp, pagination); | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -73,28 +82,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||
} | |||
} | |||
/// <summary> | |||
/// 获取树形数据 | |||
/// </summary> | |||
/// <returns></returns> | |||
public DataTable GetSqlTree(string CType) | |||
{ | |||
try | |||
{ | |||
return this.BaseRepository("CollegeMIS").FindTable($" SELECT * FROM dbo.PartyCate WHERE CType='{CType}' "); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
public List<PartyCateEntity> GetList(string CType) | |||
{ | |||
@@ -1,75 +0,0 @@ | |||
using Learun.Util; | |||
using System; | |||
using System.ComponentModel.DataAnnotations.Schema; | |||
namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||
{ | |||
/// <summary> | |||
/// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 | |||
/// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 | |||
/// 创 建:超级管理员 | |||
/// 日 期:2023-07-31 16:59 | |||
/// 描 述:党政办管理 | |||
/// </summary> | |||
public class PartyCateEntity | |||
{ | |||
#region 实体成员 | |||
/// <summary> | |||
/// ID | |||
/// </summary> | |||
[Column("ID")] | |||
public string ID { get; set; } | |||
/// <summary> | |||
/// Name | |||
/// </summary> | |||
[Column("NAME")] | |||
public string Name { get; set; } | |||
/// <summary> | |||
/// Creator | |||
/// </summary> | |||
[Column("CREATOR")] | |||
public string Creator { get; set; } | |||
/// <summary> | |||
/// Createtime | |||
/// </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 扩展字段 | |||
/// <summary> | |||
/// 所属分类 | |||
/// </summary> | |||
[NotMapped] | |||
public string CateId { get; set; } | |||
/// <summary> | |||
/// 标题 | |||
/// </summary> | |||
[NotMapped] | |||
public string Title { get; set; } | |||
/// <summary> | |||
/// 附件上传 | |||
/// </summary> | |||
[NotMapped] | |||
public string Filepath { get; set; } | |||
#endregion | |||
} | |||
} | |||
@@ -91,6 +91,45 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||
} | |||
} | |||
/// <summary> | |||
/// 获取左侧树形数据 | |||
/// <summary> | |||
/// <returns></returns> | |||
public List<TreeModel> GetTree(string CType) | |||
{ | |||
try | |||
{ | |||
DataTable list = partyManageService.GetSqlTree(CType); | |||
List<TreeModel> treeList = new List<TreeModel>(); | |||
foreach (DataRow item in list.Rows) | |||
{ | |||
TreeModel node = new TreeModel | |||
{ | |||
id = item["id"].ToString(), | |||
text = item["name"].ToString(), | |||
value = item["id"].ToString(), | |||
showcheck = false, | |||
checkstate = 0, | |||
isexpand = true, | |||
parentId = item["cparentid"].ToString() | |||
}; | |||
treeList.Add(node); | |||
} | |||
return treeList.ToTree(); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
#endregion | |||
#region 提交数据 | |||
@@ -11,7 +11,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||
/// 日 期:2023-07-31 16:59 | |||
/// 描 述:党政办管理 | |||
/// </summary> | |||
public class PartyManageEntity | |||
public class PartyManageEntity | |||
{ | |||
#region 实体成员 | |||
/// <summary> | |||
@@ -49,6 +49,8 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||
/// </summary> | |||
[Column("FILEPATH")] | |||
public string Filepath { get; set; } | |||
[Column("CTYPE")] | |||
public string CType { get; set; } | |||
#endregion | |||
#region 扩展操作 | |||
@@ -33,6 +33,9 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||
/// <param name="keyValue">主键</param> | |||
/// <returns></returns> | |||
PartyCateEntity GetPartyCateEntity(string keyValue); | |||
List<TreeModel> GetTree(string CType); | |||
#endregion | |||
#region 提交数据 | |||
@@ -31,24 +31,13 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||
{ | |||
var strSql = new StringBuilder(); | |||
strSql.Append("SELECT "); | |||
strSql.Append(@" | |||
t.ID, | |||
t1.CateId, | |||
t1.Title, | |||
t1.Filepath | |||
"); | |||
strSql.Append(" FROM PartyCate t "); | |||
strSql.Append(" LEFT JOIN PartyManage t1 ON t1.CateId = t.ID "); | |||
strSql.Append(@"t.* "); | |||
strSql.Append(" FROM PartyManage t"); | |||
strSql.Append(" WHERE 1=1 "); | |||
var queryParam = queryJson.ToJObject(); | |||
// 虚拟参数 | |||
var dp = new DynamicParameters(new { }); | |||
if (!queryParam["CateId"].IsEmpty()) | |||
{ | |||
dp.Add("CateId",queryParam["CateId"].ToString(), DbType.String); | |||
strSql.Append(" AND t.CateId = @CateId "); | |||
} | |||
return this.BaseRepository("CollegeMIS").FindList<PartyCateEntity>(strSql.ToString(),dp, pagination); | |||
return this.BaseRepository("CollegeMIS").FindList<PartyCateEntity>(strSql.ToString(), dp, pagination); | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -72,7 +61,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||
{ | |||
try | |||
{ | |||
return this.BaseRepository("CollegeMIS").FindEntity<PartyManageEntity>(t=>t.CateId == keyValue); | |||
return this.BaseRepository("CollegeMIS").FindEntity<PartyManageEntity>(t => t.CateId == keyValue); | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -111,6 +100,28 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||
} | |||
} | |||
/// <summary> | |||
/// 获取树形数据 | |||
/// </summary> | |||
/// <returns></returns> | |||
public DataTable GetSqlTree(string CType) | |||
{ | |||
try | |||
{ | |||
return this.BaseRepository("CollegeMIS").FindTable($" SELECT * FROM dbo.PartyCate WHERE CType='{CType}' "); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
#endregion | |||
#region 提交数据 | |||
@@ -124,9 +135,9 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||
var db = this.BaseRepository("CollegeMIS").BeginTrans(); | |||
try | |||
{ | |||
var partyCateEntity = GetPartyCateEntity(keyValue); | |||
db.Delete<PartyManageEntity>(t=>t.CateId == partyCateEntity.ID); | |||
db.Delete<PartyCateEntity>(t=>t.ID == keyValue); | |||
var partyCateEntity = GetPartyCateEntity(keyValue); | |||
db.Delete<PartyManageEntity>(t => t.CateId == partyCateEntity.ID); | |||
db.Delete<PartyCateEntity>(t => t.ID == keyValue); | |||
db.Commit(); | |||
} | |||
catch (Exception ex) | |||
@@ -148,17 +159,17 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <param name="entity">实体</param> | |||
public void SaveEntity(string keyValue, PartyCateEntity entity,PartyManageEntity partyManageEntity) | |||
public void SaveEntity(string keyValue, PartyCateEntity entity, PartyManageEntity partyManageEntity) | |||
{ | |||
var db = this.BaseRepository("CollegeMIS").BeginTrans(); | |||
try | |||
{ | |||
if (!string.IsNullOrEmpty(keyValue)) | |||
{ | |||
var partyCateEntityTmp = GetPartyCateEntity(keyValue); | |||
var partyCateEntityTmp = GetPartyCateEntity(keyValue); | |||
entity.Modify(keyValue); | |||
db.Update(entity); | |||
db.Delete<PartyManageEntity>(t=>t.CateId == partyCateEntityTmp.ID); | |||
db.Delete<PartyManageEntity>(t => t.CateId == partyCateEntityTmp.ID); | |||
partyManageEntity.Create(); | |||
partyManageEntity.CateId = partyCateEntityTmp.ID; | |||
db.Insert(partyManageEntity); | |||