From 3842b83cbd504e36787d5a4e529805526b1d5bfe Mon Sep 17 00:00:00 2001 From: cKey <35512826+colinin@users.noreply.github.com> Date: Sun, 5 Feb 2023 15:52:12 +0800 Subject: [PATCH] =?UTF-8?q?feat(cli):=20=E5=88=97=E8=A1=A8=E8=A7=86?= =?UTF-8?q?=E5=9B=BE=E9=A1=B5=E5=A2=9E=E5=8A=A0=E9=AB=98=E7=BA=A7=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E6=9D=A1=E4=BB=B6=E6=94=AF=E6=8C=81.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Cli/UI/Vben/VbenViewScriptGenerator.cs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/aspnet-core/modules/cli/LINGYUN.Abp.Cli/LINGYUN/Abp/Cli/UI/Vben/VbenViewScriptGenerator.cs b/aspnet-core/modules/cli/LINGYUN.Abp.Cli/LINGYUN/Abp/Cli/UI/Vben/VbenViewScriptGenerator.cs index a2474a5c3..10785fb6b 100644 --- a/aspnet-core/modules/cli/LINGYUN.Abp.Cli/LINGYUN/Abp/Cli/UI/Vben/VbenViewScriptGenerator.cs +++ b/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) .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( "VbenTableView", new { Key = "id", PagedRequest = pagedResultAction != null, + HasAdvancedSearch = getAvailableFieldsAction != null && advancedSearchAction != null, + AvailableFieldsAction = getAvailableFieldsAction?.UniqueName ?? "GetAvailableFieldsAsync", + AdvancedSearchAction = advancedSearchAction?.UniqueName ?? "GetListAsyncByDynamicInput", GetListAction = pagedResultAction?.UniqueName ?? "GetListAsyncByInput", HasCreate = createAction != null, - CreatePermission = true, + CreatePermission = createAction != null && createAction.AllowAnonymous != true, CreatePermissionName = $"{moduleDefinition.RemoteServiceName.ToPascalCase()}.{controllerModel.ControllerName.ToPascalCase()}.Create", HasUpdate = updateAction != null, - UpdatePermission = true, + UpdatePermission = updateAction != null && updateAction.AllowAnonymous != true, UpdatePermissionName = $"{moduleDefinition.RemoteServiceName.ToPascalCase()}.{controllerModel.ControllerName.ToPascalCase()}.Update", HasDelete = deleteAction != null, DeleteAction = deleteAction?.UniqueName ?? "DeleteAsyncById", - DeletePermission = true, + DeletePermission = deleteAction != null && deleteAction.AllowAnonymous != true, DeletePermissionName = $"{moduleDefinition.RemoteServiceName.ToPascalCase()}.{controllerModel.ControllerName.ToPascalCase()}.Delete", Application = controllerModel.ControllerName, ModalName = $"{controllerModel.ControllerName.ToPascalCase()}Modal",