/// <summary> /// 对增删查改页面使用的Ajax表格操作列进行标准的设置 /// 添加以下按钮 /// - 查看(如果编辑Url不是空,且数据未删除) /// - 删除(如果批量Url不是空,且数据未删除) /// - 恢复(如果批量Url不是空,且数据已删除) /// - 永久删除(如果批量Url不是空,且数据已删除) /// </summary> /// <typeparam name="TCrudController">控制器的类型</typeparam> /// <param name="column">操作列</param> /// <param name="request">搜索请求</param> public static void StandardSetupFor <TCrudController>( this AjaxTableActionColumn column, AjaxTableSearchRequest request) where TCrudController : class, ICrudController, new() { var app = new TCrudController(); var deleted = request.Conditions.GetOrDefault <bool>("Deleted"); if (!string.IsNullOrEmpty(app.EditUrl) && !deleted) { column.AddEditActionFor <TCrudController>(); } if (!string.IsNullOrEmpty(app.BatchUrl)) { if (!deleted && app.AllowDeleteRecover) { column.AddDeleteActionFor <TCrudController>(); } if (deleted && app.AllowDeleteRecover) { column.AddRecoverActionFor <TCrudController>(); } if (deleted && app.AllowDeleteForever) { column.AddDeleteForeverActionFor <TCrudController>(); } } }