Browse Source

feat(cli): 列表视图页增加高级查询条件支持.

pull/772/head
cKey 3 years ago
parent
commit
3842b83cbd
  1. 19
      aspnet-core/modules/cli/LINGYUN.Abp.Cli/LINGYUN/Abp/Cli/UI/Vben/VbenViewScriptGenerator.cs

19
aspnet-core/modules/cli/LINGYUN.Abp.Cli/LINGYUN/Abp/Cli/UI/Vben/VbenViewScriptGenerator.cs

@ -86,22 +86,35 @@ public class VbenViewScriptGenerator : IVbenViewScriptGenerator, ISingletonDepen
.Select(action => action.Value) .Select(action => action.Value)
.FirstOrDefault(); .FirstOrDefault();
// 高级查询
var getAvailableFieldsAction = controllerModel.Actions
.Where(action => action.Value.Name.Equals("GetAvailableFieldsAsync"))
.Select(action => action.Value)
.FirstOrDefault();
var advancedSearchAction = controllerModel.Actions
.Where(action => action.Value.Name.Equals("GetListAsyncByDynamicInput"))
.Select(action => action.Value)
.FirstOrDefault();
var tableContent = await _templateRenderer.RenderAsync( var tableContent = await _templateRenderer.RenderAsync(
"VbenTableView", "VbenTableView",
new new
{ {
Key = "id", Key = "id",
PagedRequest = pagedResultAction != null, PagedRequest = pagedResultAction != null,
HasAdvancedSearch = getAvailableFieldsAction != null && advancedSearchAction != null,
AvailableFieldsAction = getAvailableFieldsAction?.UniqueName ?? "GetAvailableFieldsAsync",
AdvancedSearchAction = advancedSearchAction?.UniqueName ?? "GetListAsyncByDynamicInput",
GetListAction = pagedResultAction?.UniqueName ?? "GetListAsyncByInput", GetListAction = pagedResultAction?.UniqueName ?? "GetListAsyncByInput",
HasCreate = createAction != null, HasCreate = createAction != null,
CreatePermission = true, CreatePermission = createAction != null && createAction.AllowAnonymous != true,
CreatePermissionName = $"{moduleDefinition.RemoteServiceName.ToPascalCase()}.{controllerModel.ControllerName.ToPascalCase()}.Create", CreatePermissionName = $"{moduleDefinition.RemoteServiceName.ToPascalCase()}.{controllerModel.ControllerName.ToPascalCase()}.Create",
HasUpdate = updateAction != null, HasUpdate = updateAction != null,
UpdatePermission = true, UpdatePermission = updateAction != null && updateAction.AllowAnonymous != true,
UpdatePermissionName = $"{moduleDefinition.RemoteServiceName.ToPascalCase()}.{controllerModel.ControllerName.ToPascalCase()}.Update", UpdatePermissionName = $"{moduleDefinition.RemoteServiceName.ToPascalCase()}.{controllerModel.ControllerName.ToPascalCase()}.Update",
HasDelete = deleteAction != null, HasDelete = deleteAction != null,
DeleteAction = deleteAction?.UniqueName ?? "DeleteAsyncById", DeleteAction = deleteAction?.UniqueName ?? "DeleteAsyncById",
DeletePermission = true, DeletePermission = deleteAction != null && deleteAction.AllowAnonymous != true,
DeletePermissionName = $"{moduleDefinition.RemoteServiceName.ToPascalCase()}.{controllerModel.ControllerName.ToPascalCase()}.Delete", DeletePermissionName = $"{moduleDefinition.RemoteServiceName.ToPascalCase()}.{controllerModel.ControllerName.ToPascalCase()}.Delete",
Application = controllerModel.ControllerName, Application = controllerModel.ControllerName,
ModalName = $"{controllerModel.ControllerName.ToPascalCase()}Modal", ModalName = $"{controllerModel.ControllerName.ToPascalCase()}Modal",

Loading…
Cancel
Save