using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using System.Collections.Generic; using System.Threading.Tasks; using VOL.Core.Filters; using VOL.Entity.DomainModels; namespace VOL.Core.Controllers.Basic { public class WebBaseController : BaseController { public WebBaseController(string projectName, string folder, string tablename, IServiceBase service) : base(projectName, folder, tablename, service) { } /// /// 获取grid分页数据 /// /// /// [ActionPermission(Enums.ActionPermissionOptions.Search)] [HttpPost] public override async Task GetPageData(PageDataOptions loadData) { return await base.GetPageData(loadData); } [HttpPost] [ActionPermission(Enums.ActionPermissionOptions.Upload)] public override async Task Upload(List fileInput) { return await base.Upload(fileInput); } /// /// 导出文件,返回日期+文件名 /// /// /// [ActionPermission(Enums.ActionPermissionOptions.Export)] [HttpPost] public override async Task Export(PageDataOptions loadData) { return await base.Export(loadData); } /// /// 下载文件 /// /// /// [ActionPermission(Enums.ActionPermissionOptions.Export)] [HttpGet] public override ActionResult DownLoadFile(string fileName) { return base.DownLoadFile(fileName); } /// /// 通过key删除文件 /// /// /// [ActionPermission(Enums.ActionPermissionOptions.Delete)] [HttpPost] public override async Task Del(object[] keys) { return await base.Del(keys); } /// /// 审核 /// /// /// [ActionPermission(Enums.ActionPermissionOptions.Audit)] [HttpPost] public override async Task Audit(object[] id, int? auditStatus, string auditReason) { return await base.Audit(id, auditStatus, auditReason); } /// /// 推进状态 任务状态 sys_task_status /// /// /// [ActionPermission(Enums.ActionPermissionOptions.PushStatus)] [HttpPost] public override async Task PushStatus(object[] keys, int execution, string reason) { return await base.PushStatus(keys, execution, reason); } /// /// 新增支持主子表 /// /// /// [ActionPermission(Enums.ActionPermissionOptions.Add)] [HttpPost] public async Task Add([ModelBinder]Dictionary mainData, [ModelBinder] List> detailData) { SaveModel saveModel = new SaveModel() { MainData = mainData, DetailData = detailData }; return Json(await base.Add(saveModel)); } /// /// 编辑支持主子表 /// [ModelBinder(BinderType =(typeof(ModelBinder.BaseModelBinder)))]可指定绑定modelbinder /// /// /// [ActionPermission(Enums.ActionPermissionOptions.Update)] [HttpPost] public async Task Update([ModelBinder(BinderType = (typeof(ModelBinder.BaseModelBinder)))]Dictionary mainData, [ModelBinder] List> detailData, [ModelBinder] List delKeys) { SaveModel saveModel = new SaveModel() { DelKeys = delKeys, MainData = mainData, DetailData = detailData }; var data = await base.Update(saveModel); return Json(data); } } }