⚡ 修改授权逻辑.
This commit is contained in:
@@ -20,12 +20,10 @@
|
||||
<!-- 角色提示信息 -->
|
||||
<template v-if="type === GrantType.ROLE">
|
||||
当前选择的角色为 <span class="span-blue mr4">{{ currentSubject.text }}</span>
|
||||
<span class="span-blue ml4" v-if="currentSubject.code === AdminRoleCode">管理员拥有全部权限, 无需配置</span>
|
||||
</template>
|
||||
<!-- 用户提示信息 -->
|
||||
<template v-else-if="type === GrantType.USER">
|
||||
当前选择的用户为 <span class="span-blue mr4">{{ currentSubject.text }}</span>
|
||||
<span class="ml4">若当前选择的用户角色包含管理员则无需配置 (管理员拥有全部权限)</span>
|
||||
</template>
|
||||
</span>
|
||||
</a-alert>
|
||||
@@ -57,7 +55,6 @@
|
||||
import type { TabRouterItem } from '@/components/view/tab-router/types';
|
||||
import type { AssetAuthorizedDataQueryRequest, AssetDataGrantRequest } from '@/api/asset/asset-data-grant';
|
||||
import { ref } from 'vue';
|
||||
import { AdminRoleCode } from '@/types/const';
|
||||
import { GrantType } from '../types/const';
|
||||
import RouterRoles from './router-roles.vue';
|
||||
import RouterUsers from './router-users.vue';
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<template>
|
||||
<grant-layout :type="type"
|
||||
:loading="loading"
|
||||
@fetch="fetchAuthorizedGroup"
|
||||
@fetch="fetchAuthorizedData"
|
||||
@grant="doGrant">
|
||||
<!-- 分组 -->
|
||||
<host-group-tree outer-class="group-main-tree"
|
||||
v-model:checked-keys="checkedGroups"
|
||||
<host-group-tree v-model:checked-keys="checkedGroups"
|
||||
outer-class="group-main-tree"
|
||||
:checkable="true"
|
||||
:editable="false"
|
||||
:loading="loading"
|
||||
@@ -44,7 +44,7 @@
|
||||
const selectedGroup = ref<TreeNodeData>({});
|
||||
|
||||
// 获取授权列表
|
||||
const fetchAuthorizedGroup = async (request: AssetAuthorizedDataQueryRequest) => {
|
||||
const fetchAuthorizedData = async (request: AssetAuthorizedDataQueryRequest) => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const { data } = await getAuthorizedHostGroup(request);
|
||||
@@ -60,6 +60,7 @@
|
||||
const doGrant = async (request: AssetDataGrantRequest) => {
|
||||
setLoading(true);
|
||||
try {
|
||||
// 执行授权
|
||||
await grantHostGroup({
|
||||
...request,
|
||||
idList: checkedGroups.value
|
||||
@@ -69,6 +70,8 @@
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
// 查询数据
|
||||
await fetchAuthorizedData(request);
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<grant-layout :type="type"
|
||||
:loading="loading"
|
||||
@fetch="fetchAuthorizedGroup"
|
||||
@fetch="fetchAuthorizedData"
|
||||
@grant="doGrant">
|
||||
<!-- 主机身份表格 -->
|
||||
<a-table row-key="id"
|
||||
@@ -73,7 +73,7 @@
|
||||
const hostKeys = ref<Array<HostKeyQueryResponse>>([]);
|
||||
|
||||
// 获取授权列表
|
||||
const fetchAuthorizedGroup = async (request: AssetAuthorizedDataQueryRequest) => {
|
||||
const fetchAuthorizedData = async (request: AssetAuthorizedDataQueryRequest) => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const { data } = await getAuthorizedHostIdentity(request);
|
||||
@@ -88,6 +88,7 @@
|
||||
const doGrant = async (request: AssetDataGrantRequest) => {
|
||||
setLoading(true);
|
||||
try {
|
||||
// 执行授权
|
||||
await grantHostIdentity({
|
||||
...request,
|
||||
idList: selectedKeys.value
|
||||
@@ -97,6 +98,8 @@
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
// 查询数据
|
||||
await fetchAuthorizedData(request);
|
||||
};
|
||||
|
||||
// 点击行
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<grant-layout :type="type"
|
||||
:loading="loading"
|
||||
@fetch="fetchAuthorizedGroup"
|
||||
@fetch="fetchAuthorizedData"
|
||||
@grant="doGrant">
|
||||
<!-- 主机秘钥表格 -->
|
||||
<a-table row-key="id"
|
||||
@@ -49,7 +49,7 @@
|
||||
const hostKeys = ref<Array<HostKeyQueryResponse>>([]);
|
||||
|
||||
// 获取授权列表
|
||||
const fetchAuthorizedGroup = async (request: AssetAuthorizedDataQueryRequest) => {
|
||||
const fetchAuthorizedData = async (request: AssetAuthorizedDataQueryRequest) => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const { data } = await getAuthorizedHostKey(request);
|
||||
@@ -64,6 +64,7 @@
|
||||
const doGrant = async (request: AssetDataGrantRequest) => {
|
||||
setLoading(true);
|
||||
try {
|
||||
// 执行授权
|
||||
await grantHostKey({
|
||||
...request,
|
||||
idList: selectedKeys.value
|
||||
@@ -73,6 +74,8 @@
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
// 查询数据
|
||||
await fetchAuthorizedData(request);
|
||||
};
|
||||
|
||||
// 点击行
|
||||
|
||||
Reference in New Issue
Block a user