Browse Source

Improve user permission readability

pull/556/head
cKey 4 years ago
parent
commit
598921eb36
  1. 12
      apps/vue/src/components/Permission/src/PermissionModal.vue
  2. 1
      apps/vue/src/components/Permission/src/types/permission.ts
  3. 2
      apps/vue/src/views/identity/user/components/UserTable.vue
  4. 3
      apps/vue/src/views/identity/user/hooks/usePermission.ts

12
apps/vue/src/components/Permission/src/PermissionModal.vue

@ -2,7 +2,7 @@
<BasicModal <BasicModal
v-bind="$attrs" v-bind="$attrs"
@register="registerModal" @register="registerModal"
:title="title" :title="getIdentity"
:width="800" :width="800"
:min-height="600" :min-height="600"
@ok="handleSubmit" @ok="handleSubmit"
@ -57,7 +57,7 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { defineComponent, ref } from 'vue'; import { computed, defineComponent, ref } from 'vue';
import { message } from 'ant-design-vue'; import { message } from 'ant-design-vue';
import { Card, Checkbox, Col, Divider, Row, Tabs } from 'ant-design-vue'; import { Card, Checkbox, Col, Divider, Row, Tabs } from 'ant-design-vue';
import { useLocalization } from '/@/hooks/abp/useLocalization'; import { useLocalization } from '/@/hooks/abp/useLocalization';
@ -70,6 +70,7 @@
providerName: 'G', providerName: 'G',
providerKey: '', providerKey: '',
readonly: false, readonly: false,
identity: '',
}; };
export default defineComponent({ export default defineComponent({
@ -107,6 +108,12 @@
const [registerModal, { closeModal, changeOkLoading }] = useModalInner((val) => { const [registerModal, { closeModal, changeOkLoading }] = useModalInner((val) => {
model.value = val; model.value = val;
}); });
const getIdentity = computed(() => {
if (model.value.identity) {
return `${L('Permissions')} - ${model.value.identity}`;
}
return title.value;
})
function handleVisibleChange(visible: boolean) { function handleVisibleChange(visible: boolean) {
if (!visible) { if (!visible) {
@ -130,6 +137,7 @@
L, L,
activeKey, activeKey,
title, title,
getIdentity,
permissionTab, permissionTab,
permissionTree, permissionTree,
permissionGrantKeys, permissionGrantKeys,

1
apps/vue/src/components/Permission/src/types/permission.ts

@ -2,6 +2,7 @@ export interface PermissionProps {
providerName: string; providerName: string;
providerKey?: string; providerKey?: string;
readonly: boolean; readonly: boolean;
identity?: string;
} }
export interface PermissionTree { export interface PermissionTree {

2
apps/vue/src/views/identity/user/components/UserTable.vue

@ -58,7 +58,7 @@
{ {
auth: 'AbpIdentity.Users.ManagePermissions', auth: 'AbpIdentity.Users.ManagePermissions',
label: L('Permissions'), label: L('Permissions'),
onClick: showPermissionModal.bind(null, record.id), onClick: showPermissionModal.bind(null, record.id, record.userName),
}, },
{ {
auth: 'AbpIdentity.Users.ManageClaims', auth: 'AbpIdentity.Users.ManageClaims',

3
apps/vue/src/views/identity/user/hooks/usePermission.ts

@ -4,12 +4,13 @@ import { useUserStoreWithOut } from '/@/store/modules/user';
export function usePermission() { export function usePermission() {
const [registerModel, { openModal }] = useModal(); const [registerModel, { openModal }] = useModal();
function showPermissionModal(userId: string) { function showPermissionModal(userId: string, userName: string) {
const userStore = useUserStoreWithOut(); const userStore = useUserStoreWithOut();
const props = { const props = {
providerName: 'U', providerName: 'U',
providerKey: userId, providerKey: userId,
readonly: userStore.getUserInfo.userId === userId, readonly: userStore.getUserInfo.userId === userId,
identity: userName,
}; };
openModal(true, props, true); openModal(true, props, true);
} }

Loading…
Cancel
Save