using Learun.Application.Organization; using Learun.Util; using System.Web.Mvc; namespace Learun.Application.Web.Areas.LR_OrganizationModule.Controllers { /// /// 版 本 PIT-ADMS V7.0.3 敏捷开发框架 /// Copyright (c) 2013-2018 Hexagon PPM /// 创建人:研发部 /// 日 期:2017.04.17 /// 描 述:部门管理 /// public class DepartmentController : MvcControllerBase { private DepartmentIBLL departmentIBLL = new DepartmentBLL(); private CompanyIBLL companyIBLL = new CompanyBLL(); #region 获取视图 /// /// 主页 /// /// [HttpGet] public ActionResult Index() { return View(); } /// /// 表单 /// /// [HttpGet] public ActionResult Form() { return View(); } #endregion #region 获取数据 /// /// 获取部门列表信息(根据公司Id) /// /// 公司Id /// 查询关键字 /// [HttpGet] [AjaxOnly] public ActionResult GetList(string companyId,string keyword) { //if (string.IsNullOrEmpty(companyId) && string.IsNullOrEmpty(keyword)) //{ // return Success(departmentIBLL.GetAllList()); //} var data = departmentIBLL.GetList(companyId, keyword); return Success(data); } /// /// 获取树形数据 /// /// 公司id /// 父级id /// [HttpGet] [AjaxOnly] public ActionResult GetTree(string companyId, string parentId) { if (string.IsNullOrEmpty(companyId)) { var companylist = companyIBLL.GetList(); var data = departmentIBLL.GetTree(companylist); return Success(data); } else { var data = departmentIBLL.GetTree(companyId, parentId); return Success(data); } } /// /// 获取部门实体数据 /// /// /// [HttpGet] [AjaxOnly] public ActionResult GetEntity(string departmentId) { var data = departmentIBLL.GetEntity(departmentId); return Success(data); } /// /// 获取映射数据 /// /// [HttpGet] [AjaxOnly] public ActionResult GetMap(string ver) { var data = departmentIBLL.GetModelMap(); string md5 = Md5Helper.Encrypt(data.ToJson(), 32); if (md5 == ver) { return Success("no update"); } else { var jsondata = new { data = data, ver = md5 }; return Success(jsondata); } } #endregion #region 提交数据 /// /// 保存表单数据 /// /// /// /// [HttpPost] [ValidateAntiForgeryToken] [AjaxOnly] public ActionResult SaveForm(string keyValue, DepartmentEntity entity) { departmentIBLL.SaveEntity(keyValue, entity); return Success("保存成功!"); } /// /// 删除表单数据 /// /// /// [HttpPost] [AjaxOnly] public ActionResult DeleteForm(string keyValue) { departmentIBLL.VirtualDelete(keyValue); return Success("删除成功!"); } #endregion } }