using learun.iapplication; using Microsoft.AspNetCore.Mvc; using System.Threading.Tasks; namespace EC.Web.Areas.LR_SystemModule.Controllers { /// /// 版 本 EasyCode EC管理后台 /// Copyright (c) 2019-present EC管理有限公司 /// 创建人:tobin /// 日 期:2019.09.27 /// 描 述:数据字典 /// [Area("LR_SystemModule")] public class DataItemController : MvcControllerBase { private readonly DataItemIBLL _dataItemIBLL; public DataItemController(DataItemIBLL dataItemIBLL) { _dataItemIBLL = dataItemIBLL; } #region 视图功能 /// /// 数据字典管理 /// /// [HttpGet] public IActionResult Index() { return View(); } /// /// 明细管理(表单) /// /// [HttpGet] public IActionResult Form() { return View(); } /// /// 分类管理 /// /// [HttpGet] public IActionResult ClassifyIndex() { return View(); } /// /// 分类管理(表单) /// /// [HttpGet] public IActionResult ClassifyForm() { return View(); } /// /// 明细管理 /// /// [HttpGet] public IActionResult DetailIndex() { return View(); } #endregion 视图功能 #region 字典分类 /// /// 获取字典分类列表 /// /// 关键词(名称/编码) /// [HttpGet] [AjaxOnly] public async Task GetClassifyList(string keyword) { var data = await _dataItemIBLL.GetClassifyList(keyword, false); return this.Success(data); } /// /// 获取字典分类列表(树结构) /// /// [HttpGet] [AjaxOnly] public async Task GetClassifyTree() { var data = await _dataItemIBLL.GetClassifyTree(); return this.Success(data); } /// /// 保存分类数据 /// /// 主键 /// 实体 /// [HttpPost] [AjaxOnly] public async Task SaveClassifyForm(string keyValue, DataItemEntity entity) { await _dataItemIBLL.SaveClassifyEntity(keyValue, entity); return SuccessInfo("保存成功!"); } /// /// 删除分类数据 /// /// 主键 /// [HttpPost] [AjaxOnly] public async Task DeleteClassifyForm(string keyValue) { await _dataItemIBLL.DeleteClassify(keyValue); return SuccessInfo("删除成功!"); } #endregion 字典分类 #region 字典明细 /// /// 获取数据字典明显根据分类编号 /// /// 分类编号 /// 查询条件 /// [HttpGet] [AjaxOnly] public async Task GetDetailList(string itemCode, string keyword) { var data = await _dataItemIBLL.GetDetailList(itemCode, keyword); return Success(data); } /// /// 获取数据字典明显树形数据 /// /// 分类编号 /// [HttpGet] [AjaxOnly] public async Task GetDetailTree(string itemCode) { var data = await _dataItemIBLL.GetDetailTree(itemCode); return Success(data); } /// /// 保存明细数据实体 /// /// 主键 /// 分类编码 /// 实体 [HttpPost] [AjaxOnly] public async Task SaveDetailForm(string keyValue, string itemCode, DataItemDetailEntity entity) { var data = await _dataItemIBLL.GetClassifyEntityByCode(itemCode); entity.F_ItemId = data.F_ItemId; await _dataItemIBLL.SaveDetailEntity(keyValue, entity); return SuccessInfo("保存成功!"); } /// /// 删除明细数据 /// /// 主键 /// [HttpPost] [AjaxOnly] public async Task DeleteDetailForm(string keyValue) { await _dataItemIBLL.DeleteDetail(keyValue); return SuccessInfo("删除成功!"); } #endregion 字典明细 #region 明细数据应用于下拉框 /// /// 获取数据字典明显根据分类编号 /// /// 分类编码 /// 父级主键 /// [HttpGet] [AjaxOnly] public async Task GetDetailListByParentId(string itemCode, string parentId) { var data = await _dataItemIBLL.GetDetailListByParentId(itemCode, parentId); return Success(data); } #endregion 明细数据应用于下拉框 /// /// 获取数据字典明显根据分类编号 /// /// 分类编号 /// public async Task GetCodeList(string itemCode) { var data = await _dataItemIBLL.GetDetailList(itemCode); return Success(data); } } }