From a86db56d455b812fa42583d66e795067b0bcfe01 Mon Sep 17 00:00:00 2001 From: cKey <35512826+colinin@users.noreply.github.com> Date: Tue, 22 Dec 2020 14:42:23 +0800 Subject: [PATCH] add user menu manage view --- .../LINGYUN.ApiGateway.Host/event-bus-cap.db | Bin 40960 -> 40960 bytes .../AppPlatformHttpApiHostModule.cs | 4 +- .../LINGYUN.Platform.HttpApi.Host.csproj | 2 +- vueJs/src/api/menu.ts | 24 ++- .../src/layout/components/TagsView/index.vue | 11 +- .../roles/components/ManageRoleMenuDialog.vue | 13 +- .../users/components/ManageUserMenuDialog.vue | 172 ++++++++++++++++++ vueJs/src/views/admin/users/index.vue | 43 +++-- .../components/CreateOrUpdateMenuDialog.vue | 21 +-- 9 files changed, 243 insertions(+), 47 deletions(-) create mode 100644 vueJs/src/views/admin/users/components/ManageUserMenuDialog.vue diff --git a/aspnet-core/services/apigateway/LINGYUN.ApiGateway.Host/event-bus-cap.db b/aspnet-core/services/apigateway/LINGYUN.ApiGateway.Host/event-bus-cap.db index dc066d37fec461d90669698c4d938b7f2fe9c2fb..56ad120b11479f64606ccca2b7eb1dcd39cd2fca 100644 GIT binary patch delta 228 zcmZoTz|?SnX@WGP`9v9KM)QpcOZYjMxHA}dw{T}{<`IbD7Hjcj;$ahPWHxMz=5ThF z7n-Zs6ZuqOa$|I>poyW8nW>?vftjhfiHW79g~{Z^ym}5JBLzbfD?`J{fmO2nXi6r> zcSVRA=^7b@fR$L8nCTgqn;ILK8&Ccy=s5X-1cx3>J6O)b!ot$b+{nPlK-Unc%@|^` vm5I5Yfq|K&shRoa)v}RH98CPr8Th~OKi|xwaGRf-hnbBL>deib^!W+^iSj#% delta 218 zcmZoTz|?SnX@WGP=|mZ4M$?T6OZYh$dABg|ZsC;K%p(xPEyBRSGJ{R9k=d{&_glLNEl1k8;MkrfzCPV5R3 zHPSUS3<0aLGBDCJGBGeSH!_{v81JbE(+d%|FtD&RH!?6X&@}{VF@hKik}@+fv9K^T n+`L*gl8J+n{|f{E7yetDc@%E*b2Bh7NP->rbHnCO`g{cdEw?v- diff --git a/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/AppPlatformHttpApiHostModule.cs b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/AppPlatformHttpApiHostModule.cs index f4a0d45ff..658dddbef 100644 --- a/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/AppPlatformHttpApiHostModule.cs +++ b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/AppPlatformHttpApiHostModule.cs @@ -46,7 +46,7 @@ using Volo.Abp.SettingManagement.EntityFrameworkCore; using Volo.Abp.TenantManagement.EntityFrameworkCore; using Volo.Abp.Threading; using Volo.Abp.VirtualFileSystem; -using Volo.Abp.Http.Client.IdentityModel; +using Volo.Abp.Http.Client.IdentityModel.Web; namespace LINGYUN.Platform { @@ -57,7 +57,7 @@ namespace LINGYUN.Platform typeof(PlatformHttpApiModule), typeof(PlatformEntityFrameworkCoreModule), typeof(AbpIdentityHttpApiClientModule), - typeof(AbpHttpClientIdentityModelModule), + typeof(AbpHttpClientIdentityModelWebModule), typeof(AbpAspNetCoreMultiTenancyModule), typeof(AbpFeatureManagementEntityFrameworkCoreModule), typeof(AbpAuditLoggingEntityFrameworkCoreModule), diff --git a/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/LINGYUN.Platform.HttpApi.Host.csproj b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/LINGYUN.Platform.HttpApi.Host.csproj index 936db6c7f..b67f3cc3e 100644 --- a/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/LINGYUN.Platform.HttpApi.Host.csproj +++ b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/LINGYUN.Platform.HttpApi.Host.csproj @@ -41,7 +41,7 @@ - + diff --git a/vueJs/src/api/menu.ts b/vueJs/src/api/menu.ts index dd29a114a..3ef8ecb01 100644 --- a/vueJs/src/api/menu.ts +++ b/vueJs/src/api/menu.ts @@ -29,8 +29,13 @@ export default class MenuService { return ApiService.Get>(_url, serviceUrl) } - public static getRoleMenuList(payload: GetRoleMenu) { - const _url = sourceUrl + '/by-role?' + urlStringify(payload) + public static getRoleMenuList(role: string, platformType: PlatformType) { + const _url = sourceUrl + `/by-role/${role}/${platformType}` + return ApiService.Get>(_url, serviceUrl) + } + + public static getUserMenuList(userId: string, platformType: PlatformType) { + const _url = sourceUrl + `/by-user/${userId}/${platformType}` return ApiService.Get>(_url, serviceUrl) } @@ -52,6 +57,11 @@ export default class MenuService { const _url = sourceUrl + '/by-role' return ApiService.Put(_url, payload,serviceUrl) } + + public static setUserMenu(payload: UserMenu) { + const _url = sourceUrl + '/by-user' + return ApiService.Put(_url, payload,serviceUrl) + } } export class MenuCreateOrUpdate { @@ -84,11 +94,6 @@ export class GetAllMenu implements ISortedResultRequest { platformType?: PlatformType } -export class GetRoleMenu { - role!: string - platformType!: PlatformType -} - export class GetMenuByPaged extends PagedAndSortedResultRequestDto { filter = '' reverse = false @@ -111,3 +116,8 @@ export class RoleMenu { roleName!: string menuIds = new Array() } + +export class UserMenu { + userId!: string + menuIds = new Array() +} diff --git a/vueJs/src/layout/components/TagsView/index.vue b/vueJs/src/layout/components/TagsView/index.vue index 8786ffd43..f57557c5b 100644 --- a/vueJs/src/layout/components/TagsView/index.vue +++ b/vueJs/src/layout/components/TagsView/index.vue @@ -18,7 +18,7 @@ @click.middle.native="!isAffix(tag)?closeSelectedTag(tag):''" @contextmenu.prevent.native="openMenu(tag, $event)" > - {{ $t('route.' + tag.meta.title) }} + {{ routeTitle(tag) }} { + if (route.meta.displayName) { + return route.meta.displayName + } + return this.$t('route.' + route.meta.title) + } + } + @Watch('$route') private onRouteChange() { this.addTags() diff --git a/vueJs/src/views/admin/roles/components/ManageRoleMenuDialog.vue b/vueJs/src/views/admin/roles/components/ManageRoleMenuDialog.vue index 8845ae388..dacff57a5 100644 --- a/vueJs/src/views/admin/roles/components/ManageRoleMenuDialog.vue +++ b/vueJs/src/views/admin/roles/components/ManageRoleMenuDialog.vue @@ -2,6 +2,7 @@ import { Component, Vue, Prop, Watch } from 'vue-property-decorator' -import MenuService, { Menu, GetAllMenu, GetRoleMenu, RoleMenu } from '@/api/menu' +import MenuService, { Menu, GetAllMenu, RoleMenu } from '@/api/menu' import { generateTree } from '@/utils' -import { PlatformTypes } from '@/api/layout' +import { PlatformType, PlatformTypes } from '@/api/layout' import { Tree } from 'element-ui' @Component({ @@ -90,7 +91,6 @@ export default class ManageRoleMenuDialog extends Vue { private menus = new Array() private roleMenuIds = new Array() private getMenuQuery = new GetAllMenu() - private getRoleMenuQuery = new GetRoleMenu() private platformTypes = PlatformTypes private confirmButtonBusy = false private menuProps = { @@ -110,9 +110,9 @@ export default class ManageRoleMenuDialog extends Vue { this.handleGetRoleMenus() } - private onPlatformTypeChanged(value: any) { - this.getRoleMenuQuery.platformType = value + private onPlatformTypeChanged() { this.handleGetMenus() + this.handleGetRoleMenus() } private handleGetMenus() { @@ -125,9 +125,8 @@ export default class ManageRoleMenuDialog extends Vue { private handleGetRoleMenus() { if (this.showDialog && this.roleName) { - this.getRoleMenuQuery.role = this.roleName MenuService - .getRoleMenuList(this.getRoleMenuQuery) + .getRoleMenuList(this.roleName, this.getMenuQuery.platformType || PlatformType.None) .then(res => { this.roleMenuIds = res.items.map(item => item.id) }) diff --git a/vueJs/src/views/admin/users/components/ManageUserMenuDialog.vue b/vueJs/src/views/admin/users/components/ManageUserMenuDialog.vue new file mode 100644 index 000000000..d49a7aec4 --- /dev/null +++ b/vueJs/src/views/admin/users/components/ManageUserMenuDialog.vue @@ -0,0 +1,172 @@ + + + + + diff --git a/vueJs/src/views/admin/users/index.vue b/vueJs/src/views/admin/users/index.vue index dfa768fb7..263ab8610 100644 --- a/vueJs/src/views/admin/users/index.vue +++ b/vueJs/src/views/admin/users/index.vue @@ -116,10 +116,19 @@