using learun.iapplication; using learun.util; using Microsoft.AspNetCore.Mvc; using System.Threading.Tasks; namespace EC.Web.Areas.LR_AppManager { /// /// 版 本 EasyCode EC管理后台 /// Copyright (c) 2019-present EC管理有限公司 /// 创建人:tobin /// 日 期:2020.04.08 /// 描 述:移动功能管理 /// [Area("LR_AppManager")] public class FunctionManagerController : MvcControllerBase { private readonly FunctionIBLL _functionIBLL; public FunctionManagerController(FunctionIBLL functionIBLL) { _functionIBLL = functionIBLL; } #region 视图功能 /// /// 管理页面 /// /// [HttpGet] public IActionResult Index() { return View(); } /// /// 表单页面 /// /// [HttpGet] public IActionResult Form() { return View(); } #endregion 视图功能 #region 获取数据 /// /// 获取分页数据 /// /// 分页参数 /// 关键字 /// 类型 /// [HttpGet] [AjaxOnly] public async Task GetPageList(string pagination, string keyword, string type) { Pagination paginationobj = pagination.ToObject(); var data = await _functionIBLL.GetPageList(paginationobj, keyword, type); var jsonData = new { rows = data, paginationobj.total, paginationobj.page, paginationobj.records, }; return Success(jsonData); } /// /// 获取表单数据 /// /// 主键 /// [HttpGet] [AjaxOnly] public async Task GetForm(string keyValue) { FunctionEntity entity = await _functionIBLL.GetEntity(keyValue); FunctionSchemeEntity schemeEntity = await _functionIBLL.GetScheme(entity.F_SchemeId); var jsonData = new { entity, schemeEntity }; return Success(jsonData); } /// /// 获取树形移动功能列表 /// /// [HttpGet] [AjaxOnly] public async Task GetCheckTree() { var data = await _functionIBLL.GetCheckTree(); return Success(data); } #endregion 获取数据 #region 提交数据 /// /// 删除表单数据 /// /// 主键 /// [HttpPost] [AjaxOnly] public async Task DeleteForm(string keyValue) { await _functionIBLL.Delete(keyValue); return SuccessInfo("删除成功!"); } /// /// 保存表单数据 /// /// 主键 /// 实体对象字串 /// 模板实体对象字串 /// [HttpPost] [AjaxOnly] public async Task SaveForm(string keyValue, string strEntity, string strSchemeEntity) { FunctionEntity entity = strEntity.ToObject(); FunctionSchemeEntity schemeEntity = strSchemeEntity.ToObject(); await _functionIBLL.SaveEntity(keyValue, entity, schemeEntity); return SuccessInfo("保存成功!"); } /// /// 启用/停用表单 /// /// 主键 /// 状态1启用0禁用 /// [HttpPost] [AjaxOnly] public async Task UpDateSate(string keyValue, int state) { await _functionIBLL.UpdateState(keyValue, state); return SuccessInfo((state == 1 ? "启用" : "禁用") + "成功!"); } #endregion 提交数据 } }