|
- using System.Linq;
- using Learun.Application.Organization;
- using System.Web.Mvc;
-
- namespace Learun.Application.Web.Areas.LR_OrganizationModule.Controllers
- {
- /// <summary>
- /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
- /// Copyright (c) 2013-2018 北京泉江科技有限公司
- /// 创建人:陈彬彬
- /// 日 期:2017.03.09
- /// 描 述:岗位管理
- /// </summary>
- public class PostController : MvcControllerBase
- {
- private PostIBLL postIBLL = new PostBLL();
- private CompanyIBLL companyIBLL = new CompanyBLL();
-
- #region 获取视图
- /// <summary>
- /// 主页
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult Index()
- {
- return View();
- }
- /// <summary>
- /// 表单
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult Form()
- {
- return View();
- }
- /// <summary>
- /// 岗位选择页面
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult SelectForm()
- {
- return View();
- }
-
- #endregion
-
- #region 获取数据
- /// <summary>
- /// 获取岗位列表信息
- /// </summary>
- /// <param name="keyWord">查询关键字</param>
- /// <returns></returns>
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetList(string companyId, string keyword, string departmentId)
- {
- var data = postIBLL.GetList(companyId, keyword, departmentId);
- return JsonResult(data);
- }
- /// <summary>
- /// 获取树形数据
- /// </summary>
- /// <param name="companyId">公司主键</param>
- /// <returns></returns>
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetTree(string companyId)
- {
- var data = postIBLL.GetTree(companyId);
- return JsonResult(data);
- }
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetAllTree(string companyId, string parentId)
- {
- if (string.IsNullOrEmpty(companyId))
- {
- var companylist = companyIBLL.GetList();
- var data = postIBLL.GetAllTree(companylist);
- return JsonResult(data);
- }
- else
- {
- var data = postIBLL.GetTree(companyId, parentId);
- return JsonResult(data);
- }
- }
-
- /// <summary>
- /// 获取岗位名称
- /// </summary>
- /// <param name="keyValue">岗位主键</param>
- /// <returns></returns>
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetEntityName(string keyValue)
- {
- if (keyValue == "0")
- {
- return SuccessString("");
- }
- var data = postIBLL.GetEntity(keyValue);
- return SuccessString(data.F_Name);
- }
-
- /// <summary>
- /// 获取岗位实体数据
- /// </summary>
- /// <param name="keyValue">岗位主键</param>
- /// <returns></returns>
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetEntity(string keyValue)
- {
- var data = postIBLL.GetEntity(keyValue);
- return JsonResult(data);
- }
- #endregion
-
- #region 提交数据
- /// <summary>
- /// 保存表单数据
- /// </summary>
- /// <param name="keyValue">主键</param>
- /// <param name="entity">实体</param>
- /// <returns></returns>
- [HttpPost]
- [ValidateAntiForgeryToken]
- [AjaxOnly]
- public ActionResult SaveForm(string keyValue, PostEntity entity)
- {
- var list = postIBLL.GetList(entity.F_CompanyId);
- if (list.Any(a => a.F_EnCode == entity.F_EnCode))
- {
- return Fail("岗位编号重复");
- }
- postIBLL.SaveEntity(keyValue, entity);
- return Success("保存成功!");
- }
- /// <summary>
- /// 删除表单数据
- /// </summary>
- /// <param name="keyValue">主键</param>
- /// <returns></returns>
- [HttpPost]
- [AjaxOnly]
- public ActionResult DeleteForm(string keyValue)
- {
- postIBLL.VirtualDelete(keyValue);
- return Success("删除成功!");
- }
- #endregion
- }
- }
|