using Learun.Application.Base.SystemModule; using Learun.Util; using System.Web.Mvc; namespace Learun.Application.Web.Areas.LR_SystemModule.Controllers { /// /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园 /// Copyright (c) 2013-2018 北京泉江科技有限公司 /// 创建人:陈彬彬 /// 日 期:2017.03.09 /// 描 述:数据字典 /// public class DataItemController : MvcControllerBase { #region 属性 private DataItemIBLL dataItemIBLL = new DataItemBLL(); #endregion #region 视图功能 /*明细管理*/ /// /// 数据字典管理 /// /// [HttpGet] public ActionResult Index() { return View(); } /// /// 明细管理(表单) /// /// [HttpGet] public ActionResult Form() { return View(); } /*分类管理*/ /// /// 分类管理 /// /// [HttpGet] public ActionResult ClassifyIndex() { return View(); } /// /// 分类管理(表单) /// /// [HttpGet] public ActionResult ClassifyForm() { return View(); } /// /// 明细管理 /// /// [HttpGet] public ActionResult DetailIndex() { return View(); } #endregion #region 字典分类 /// /// 获取字典分类列表 /// /// 关键词(名称/编码) /// [HttpGet] [AjaxOnly] public ActionResult GetClassifyList(string keyword) { var data = dataItemIBLL.GetClassifyList(keyword, false); return this.JsonResult(data); } /// /// 获取字典分类列表(树结构) /// /// [HttpGet] [AjaxOnly] public ActionResult GetClassifyTree() { var data = dataItemIBLL.GetClassifyTree(); return this.JsonResult(data); } /// /// 保存分类数据 /// /// 主键 /// 实体 /// [HttpPost] [ValidateAntiForgeryToken] [AjaxOnly] public ActionResult SaveClassifyForm(string keyValue, DataItemEntity entity) { dataItemIBLL.SaveClassifyEntity(keyValue, entity); return Success("保存成功!"); } /// /// 删除分类数据 /// /// 主键 /// [HttpPost] [AjaxOnly] public ActionResult DeleteClassifyForm(string keyValue) { dataItemIBLL.VirtualDeleteClassify(keyValue); return Success("删除成功!"); } /// /// 分类编号不能重复 /// /// 编码 /// 主键 /// [HttpGet] [AjaxOnly] public ActionResult ExistItemCode(string keyValue, string F_ItemCode) { bool res = dataItemIBLL.ExistItemCode(keyValue, F_ItemCode); return JsonResult(res); } /// /// 分类名称不能重复 /// /// 名称 /// 主键 /// [HttpGet] [AjaxOnly] public ActionResult ExistItemName(string keyValue, string F_ItemName) { bool res = dataItemIBLL.ExistItemName(keyValue, F_ItemName); return JsonResult(res); } #endregion #region 字典明细 /// /// 获取数据字典明显根据分类编号 /// /// 分类编号 /// 查询条件 /// [HttpGet] [AjaxOnly] public ActionResult GetDetailList(string itemCode, string keyword) { var data = dataItemIBLL.GetDetailList(itemCode, keyword); return JsonResult(data); } /// /// 获取数据字典明显根据分类编号 /// /// 分类编号 /// 查询条件 /// [HttpGet] [AjaxOnly] public ActionResult GetDetailList2(string itemCode, string keyword) { var data = dataItemIBLL.GetDetailList2(itemCode, keyword); return JsonResult(data); } /// /// 获取数据字典明显根据分类编号 +条件 /// /// /// 条件 /// [HttpGet] [AjaxOnly] public ActionResult GetDetailList3(string itemCode, string strWhere) { var data = dataItemIBLL.GetDetailList3(itemCode, strWhere); return JsonResult(data); } /// /// 获取数据字典明显树形数据 /// /// 分类编号 /// [HttpGet] [AjaxOnly] public ActionResult GetDetailTree(string itemCode) { var data = dataItemIBLL.GetDetailTree(itemCode); return JsonResult(data); } /// /// 项目值不能重复 /// /// 主键 /// 项目值 /// 分类编码 /// [HttpGet] [AjaxOnly] public ActionResult ExistDetailItemValue(string keyValue, string F_ItemValue, string itemCode) { bool res = dataItemIBLL.ExistDetailItemValue(keyValue, F_ItemValue, itemCode); return JsonResult(res); } /// /// 项目名不能重复 /// /// 主键 /// 项目名 /// 分类编码 /// [HttpGet] [AjaxOnly] public ActionResult ExistDetailItemName(string keyValue, string F_ItemName, string itemCode) { bool res = dataItemIBLL.ExistDetailItemName(keyValue, F_ItemName, itemCode); return JsonResult(res); } /// /// 保存明细数据实体 /// /// 主键 /// 分类编码 /// 实体 [HttpPost] [AjaxOnly] [ValidateAntiForgeryToken] public ActionResult SaveDetailForm(string keyValue, string itemCode, DataItemDetailEntity entity) { var data = dataItemIBLL.GetClassifyEntityByCode(itemCode); entity.F_ItemId = data.F_ItemId; dataItemIBLL.SaveDetailEntity(keyValue, entity); return Success("保存成功!"); } /// /// 删除明细数据 /// /// 主键 /// [HttpPost] [AjaxOnly] public ActionResult DeleteDetailForm(string keyValue) { dataItemIBLL.VirtualDeleteDetail(keyValue); return Success("删除成功!"); } /// /// 获取映射数据 /// /// [HttpGet] [AjaxOnly] public ActionResult GetMap(string ver) { var data = dataItemIBLL.GetModelMap(); string md5 = Md5Helper.Encrypt(data.ToJson(), 32); if (md5 == ver) { return Success("no update"); } else { var jsondata = new { data = data, ver = md5 }; return JsonResult(jsondata); } } #endregion #region 明细数据应用于下拉框 /// /// 获取数据字典明显根据分类编号 /// /// 分类编码 /// 父级主键 /// [HttpGet] [AjaxOnly] public ActionResult GetDetailListByParentId(string itemCode, string parentId) { var data = dataItemIBLL.GetDetailListByParentId(itemCode, parentId); return JsonResult(data); } #endregion } }