diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/PartyCateController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/PartyCateController.cs index 617399a14..82079107e 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/PartyCateController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/PartyCateController.cs @@ -85,6 +85,44 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers var data = partyCateIBLL.GetEntity(keyValue); return Success(data); } + + /// + /// 获取左侧树形数据 + /// + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetTree(string CType) + { + var data = partyCateIBLL.GetTree(CType); + return Success(data); + } + + /// + /// 获取字典分类列表(树结构) + /// + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetClassifyTree(string CType) + { + var data = partyCateIBLL.GetClassifyTree(CType); + return this.JsonResult(data); + } + + /// + /// 获取目录分类列表 + /// + /// 关键词(名称/编码) + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetClassifyList(string keyword, string CType) + { + var data = partyCateIBLL.GetClassifyList(keyword, CType); + return this.JsonResult(data); + } + #endregion #region 提交数据 diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyCate/Form.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyCate/Form.cshtml index 44c2c3bc4..4655aa07f 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyCate/Form.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyCate/Form.cshtml @@ -3,33 +3,17 @@ Layout = "~/Views/Shared/_Form.cshtml"; }
-
-
ID*
- +
+
上级
+
-
-
Name*
+
+
名称*
-
-
CType*
- -
-
-
父Id*
- -
-
+
排序*
-
-
Creator*
- -
-
-
Createtime*
- -
@Html.AppendJsFile("/Areas/PersonnelManagement/Views/PartyCate/Form.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyCate/Form.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyCate/Form.js index cf70f1a45..6d8863f3f 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyCate/Form.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyCate/Form.js @@ -5,6 +5,9 @@ * 描 述:PartyCate */ var acceptClick; +var parentId = request('parentId'); +var CType = request('CType'); +var selectedRow = top.layer_ClassifyIndex.selectedRow; var keyValue = request('keyValue'); var bootstrap = function ($, learun) { "use strict"; @@ -14,6 +17,13 @@ var bootstrap = function ($, learun) { page.initData(); }, bind: function () { + // 上级 + $('#CParentId').lrselect({ + url: top.$.rootUrl + '/PersonnelManagement/PartyCate/GetClassifyTree?CType=' + CType, + type: 'tree', + allowSearch: true, + maxHeight: 225 + }).lrselectSet(parentId); }, initData: function () { if (!!selectedRow) { @@ -26,7 +36,19 @@ var bootstrap = function ($, learun) { if (!$('#form').lrValidform()) { return false; } + var postData = $('#form').lrGetFormData(keyValue); + if (postData["CParentId"] == '' || postData["CParentId"] == ' ') { + postData["CParentId"] = '0'; + } + if (CType) { + postData.CType = CType; + } + else if (postData["CParentId"] == keyValue) { + 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) { diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyCate/Index.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyCate/Index.cshtml index 2fd37e7ce..e4bfd8b31 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyCate/Index.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyCate/Index.cshtml @@ -2,23 +2,16 @@ ViewBag.Title = "PartyCate"; Layout = "~/Views/Shared/_Index.cshtml"; } -
-
-
-
树形目录
-
-
-
+
-
-
标题
+
- +
@@ -26,8 +19,8 @@
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyCate/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyCate/Index.js index 95f32f312..76a0fef8d 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyCate/Index.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyCate/Index.js @@ -30,8 +30,8 @@ var bootstrap = function ($, learun) { id: 'form', title: '新增', url: top.$.rootUrl + '/PersonnelManagement/PartyCate/Form', - width: 700, - height: 400, + width: 400, + height: 300, callBack: function (id) { return top[id].acceptClick(refreshGirdData); } @@ -46,8 +46,8 @@ var bootstrap = function ($, learun) { id: 'form', title: '编辑', url: top.$.rootUrl + '/PersonnelManagement/PartyCate/Form?keyValue=' + keyValue, - width: 700, - height: 400, + width: 400, + height: 300, callBack: function (id) { return top[id].acceptClick(refreshGirdData); } @@ -60,7 +60,8 @@ var bootstrap = function ($, learun) { if (learun.checkrow(keyValue)) { learun.layerConfirm('是否确认删除该项!', function (res) { if (res) { - learun.deleteForm(top.$.rootUrl + '/PersonnelManagement/PartyCate/DeleteForm', { keyValue: keyValue}, function () { + learun.deleteForm(top.$.rootUrl + '/PersonnelManagement/PartyCate/DeleteForm', { keyValue: keyValue }, function () { + refreshGirdData(); }); } }); @@ -71,16 +72,14 @@ var bootstrap = function ($, learun) { $('#gridtable').lrAuthorizeJfGrid({ url: top.$.rootUrl + '/PersonnelManagement/PartyCate/GetPageList', headData: [ - { label: 'ID', name: 'ID', width: 200, align: "left" }, - { label: 'Name', name: 'Name', width: 200, align: "left" }, - { label: 'CType', name: 'CType', width: 200, align: "left" }, - { label: '父Id', name: 'CParentId', width: 200, align: "left" }, - { label: '排序', name: 'COrder', width: 200, align: "left" }, - { label: 'Creator', name: 'Creator', width: 200, align: "left" }, - { label: 'Createtime', name: 'Createtime', width: 200, align: "left" }, + { label: '名称', name: 'Name', width: 200, align: "left" }, + { label: '排序', name: 'COrder', width: 200, align: "left" }, ], - mainId:'ID', - isPage: true + mainId: 'ID', + sidx: 'COrder desc', + isTree: true, + parentId: 'CParentId', + reloadSelected: true }); page.search(); }, diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyManage/Index.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyManage/Index.cshtml index e5dd33989..c71fcbaa6 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyManage/Index.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyManage/Index.cshtml @@ -2,7 +2,7 @@ ViewBag.Title = "党政办管理"; Layout = "~/Views/Shared/_Index.cshtml"; } -
+
树形列表
@@ -25,10 +25,11 @@
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyManage/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyManage/Index.js index bd95b9ca7..06c9bc711 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyManage/Index.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyManage/Index.js @@ -5,6 +5,8 @@ * 描 述:党政办管理 */ var refreshGirdData; +var selectedId; +var CType = request('CType'); var bootstrap = function ($, learun) { "use strict"; var startTime; @@ -15,11 +17,15 @@ var bootstrap = function ($, learun) { page.bind(); }, bind: function () { + if (!CType) { + CType = 1; + } // 初始化左侧树形数据 $('#dataTree').lrtree({ - url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetTree?code=partycate&parentId=id&Id=id&showId=name', + url: top.$.rootUrl + '/PersonnelManagement/PartyCateList/GetTree?CType=' + CType, nodeClick: function (item) { - page.search({ CateId: item.value }); + selectedId = item.value; + page.search({ CId: item.value }); } }); // 时间搜索框 @@ -46,19 +52,27 @@ var bootstrap = function ($, learun) { selectfn: function (begin, end) { startTime = begin; endTime = end; - page.search(); + if (selectedId) { + page.search({ CId: selectedId }); + } } }); // 刷新 $('#lr_refresh').on('click', function () { location.reload(); }); + $('#multiple_condition_query').lrMultipleQuery(function (queryJson) { + if (selectedId) { + queryJson.CId = selectedId; + page.search(queryJson); + } + }, 220, 400); // 新增 $('#lr_add').on('click', function () { learun.layerForm({ id: 'form', title: '新增', - url: top.$.rootUrl + '/PersonnelManagement/PartyManage/Form', + url: top.$.rootUrl + '/PersonnelManagement/PartyManage/Form?selectedId=' + selectedId + '&CType=' + CType, width: 600, height: 400, callBack: function (id) { @@ -73,7 +87,7 @@ var bootstrap = function ($, learun) { learun.layerForm({ id: 'form', title: '编辑', - url: top.$.rootUrl + '/PersonnelManagement/PartyManage/Form?keyValue=' + keyValue, + url: top.$.rootUrl + '/PersonnelManagement/PartyManage/Form?keyValue=' + keyValue + '&selectedId=' + selectedId + '&CType=' + CType, width: 600, height: 400, callBack: function (id) { @@ -95,6 +109,37 @@ var bootstrap = function ($, learun) { }); } }); + /*分类管理*/ + $('#lr_category').on('click', function () { + learun.layerForm({ + id: 'TypeIndex', + title: '分类管理', + url: top.$.rootUrl + '/PersonnelManagement/PartyCate/Index?CType=' + CType, + width: 800, + height: 500, + maxmin: true, + btn: null, + end: function () { + learun.clientdata.update('dataItem'); + location.reload(); + } + }); + }); + + //访问情况统计 + $("#lr_statistics").on('click', function () { + var keyValue = $('#gridtable').jfGridValue('FFile'); + if (learun.checkrow(keyValue)) { + learun.layerFormForPercent({ + id: 'form', + title: '访问情况统计', + url: top.$.rootUrl + '/PersonnelManagement/MP_BrowseRecord/IndexFile?keyValue=' + keyValue, + width: '70%', + height: '70%', + btn: null + }); + } + }); // 打印 $('#lr_print').on('click', function () { $('#gridtable').jqprintTable(); @@ -117,7 +162,24 @@ var bootstrap = function ($, learun) { }); }}, { label: "标题", name: "Title", width: 100, align: "left"}, - { label: "附件上传", name: "Filepath", width: 100, align: "left"}, + { + label: "附件上传", name: "Filepath", width: 100, align: "left" + , formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('custmerData', + { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'FileInfo', + key: value, + keyId: 'f_folderid', + sync: true, + callback: function (_data) { + if (_data.f_filename) { + + callback('' + _data['f_filename'] + ''); + } + } + }); + } + }, ], mainId:'ID', isPage: true @@ -131,7 +193,19 @@ var bootstrap = function ($, learun) { } }; refreshGirdData = function () { - $('#gridtable').jfGridSet('reload'); + if (selectedId) { + page.search({ CId: selectedId }); + } + //$('#gridtable').jfGridSet('reload'); }; page.init(); } +function downLoad(fileId, fileTwo, lrToken) { + if (fileTwo) { + + top.learun.postFormSilence(top.$.rootUrl + '/PersonnelManagement/MP_QualityObjectives/AddFileRecord', { fileId: fileTwo }, function () { + + }); + } + top.learun.download({ url: top.$.rootUrl + '/LR_SystemModule/Annexes/DownAnnexesFile', param: { fileId: fileId, __RequestVerificationToken: $.lrToken }, method: 'POST' }); +} diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Learun.Application.TwoDevelopment.csproj b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Learun.Application.TwoDevelopment.csproj index dc99d8983..6f35bf219 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Learun.Application.TwoDevelopment.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Learun.Application.TwoDevelopment.csproj @@ -550,6 +550,7 @@ + @@ -2107,7 +2108,6 @@ - diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/PartyCate/PartyCateBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/PartyCate/PartyCateBLL.cs index 1fe222c80..6015f0b06 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/PartyCate/PartyCateBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/PartyCate/PartyCateBLL.cs @@ -91,6 +91,114 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement } } + /// + /// 获取左侧树形数据 + /// + /// + public List GetTree(string CType) + { + try + { + DataTable list = partyCateService.GetSqlTree(CType); + List treeList = new List(); + 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); + } + } + } + + /// + /// 分类列表 + /// + /// 关键词(名称/编码) + /// 是否只取有效 + /// + public List GetClassifyList(string keyword, string CType) + { + try + { + List list = partyCateService.GetList(CType); + if (!string.IsNullOrEmpty(keyword)) + { + list = list.FindAll(t => t.Name.Contains(keyword)); + } + + return list; + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + + /// + /// 获取分类树形数据 + /// + /// + public List GetClassifyTree(string CType) + { + try + { + List classifyList = partyCateService.GetList(CType); + List treeList = new List(); + foreach (var item in classifyList) + { + TreeModel node = new TreeModel(); + node.id = item.ID; + node.text = item.Name; + node.value = item.ID; + node.showcheck = false; + node.checkstate = 0; + node.isexpand = true; + node.parentId = item.CParentId; + treeList.Add(node); + } + return treeList.ToTree(); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + #endregion #region 提交数据 diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/PartyCate/PartyCateIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/PartyCate/PartyCateIBLL.cs index 6faf8c897..d40718827 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/PartyCate/PartyCateIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/PartyCate/PartyCateIBLL.cs @@ -20,7 +20,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement /// /// 查询参数 /// - IEnumerable GetList( string queryJson ); + IEnumerable GetList(string queryJson); /// /// 获取列表分页数据 /// @@ -34,6 +34,12 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement /// 主键 /// PartyCateEntity GetEntity(string keyValue); + + List GetTree(string CType); + + List GetClassifyTree(string CType); + List GetClassifyList(string keyword, string CType); + #endregion #region 提交数据 diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/PartyCate/PartyCateService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/PartyCate/PartyCateService.cs index c261c74b4..adadc071b 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/PartyCate/PartyCateService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/PartyCate/PartyCateService.cs @@ -5,6 +5,8 @@ using System; using System.Collections.Generic; using System.Data; using System.Text; +using System.Linq; + namespace Learun.Application.TwoDevelopment.PersonnelManagement { @@ -17,47 +19,22 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement /// public class PartyCateService : RepositoryFactory { - #region 构造函数和属性 - - private string fieldSql; - /// - /// 构造方法 - /// - public PartyCateService() - { - fieldSql=@" - t.ID, - t.Name, - t.CType, - t.CParentId, - t.COrder, - t.Creator, - t.Createtime - "; - } - #endregion - #region 获取数据 - /// - /// 获取列表数据 + /// 获取列表分页数据 /// + /// 分页参数 /// 条件参数 /// - public IEnumerable GetList( string queryJson ) + public IEnumerable GetPageList(Pagination pagination, string queryJson) { try { - //参考写法 - //var queryParam = queryJson.ToJObject(); - // 虚拟参数 - //var dp = new DynamicParameters(new { }); - //dp.Add("startTime", queryParam["StartTime"].ToDate(), DbType.DateTime); var strSql = new StringBuilder(); strSql.Append("SELECT "); - strSql.Append(fieldSql); + strSql.Append(" t.* "); strSql.Append(" FROM PartyCate t "); - return this.BaseRepository("CollegeMIS").FindList(strSql.ToString()); + return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), pagination); } catch (Exception ex) { @@ -73,20 +50,15 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement } /// - /// 获取列表分页数据 + /// 获取实体数据 /// - /// 分页参数 - /// 条件参数 + /// 主键 /// - public IEnumerable GetPageList(Pagination pagination, string queryJson) + public PartyCateEntity GetEntity(string keyValue) { try { - var strSql = new StringBuilder(); - strSql.Append("SELECT "); - strSql.Append(fieldSql); - strSql.Append(" FROM PartyCate t "); - return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), pagination); + return this.BaseRepository("CollegeMIS").FindEntity(keyValue); } catch (Exception ex) { @@ -102,15 +74,14 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement } /// - /// 获取实体数据 + /// 获取树形数据 /// - /// 主键 /// - public PartyCateEntity GetEntity(string keyValue) + public DataTable GetSqlTree(string CType) { try { - return this.BaseRepository("CollegeMIS").FindEntity(keyValue); + return this.BaseRepository("CollegeMIS").FindTable($" SELECT * FROM dbo.PartyCate WHERE CType='{CType}' "); } catch (Exception ex) { @@ -125,6 +96,26 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement } } + public List GetList(string CType) + { + var ctype = int.Parse(CType); + try + { + return this.BaseRepository("CollegeMIS").FindList(a => a.CType == ctype).ToList(); + + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } #endregion #region 提交数据 @@ -137,7 +128,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement { try { - this.BaseRepository("CollegeMIS").Delete(t=>t.ID == keyValue); + this.BaseRepository("CollegeMIS").Delete(t => t.ID == keyValue); } catch (Exception ex) {