😎租户管理页面增加接口授权(租户id、租管账号id、角色id都相同)

This commit is contained in:
zuohuaijun 2024-06-21 01:25:16 +08:00
parent 480c7b40f1
commit 1aa84f0b00
2 changed files with 13 additions and 4 deletions

View File

@ -1,6 +1,6 @@
<template>
<div class="sys-grantMenu-container">
<el-dialog v-model="state.isShowDialog" draggable :close-on-click-modal="false" width="769px">
<el-dialog v-model="state.isShowDialog" draggable :close-on-click-modal="false">
<template #header>
<div style="color: #fff">
<el-icon size="16" style="margin-right: 3px; display: inline; vertical-align: middle"> <ele-Edit /> </el-icon>

View File

@ -77,15 +77,16 @@
<ModifyRecord :data="scope.row" />
</template>
</el-table-column>
<el-table-column label="操作" width="200" fixed="right" align="center" show-overflow-tooltip>
<el-table-column label="操作" width="350" fixed="right" align="center" show-overflow-tooltip>
<template #default="scope">
<el-button icon="ele-Coin" size="small" text type="danger" @click="createTenant(scope.row)" v-auth="'sysTenant:createDb'" :disabled="scope.row.tenantType == 0"> 创建库 </el-button>
<el-button icon="ele-Edit" size="small" text type="primary" @click="openEditTenant(scope.row)" v-auth="'sysTenant:update'"> 编辑 </el-button>
<el-button icon="ele-Coin" size="small" text type="danger" @click="createTenant(scope.row)" v-auth="'sysTenant:createDb'" :disabled="scope.row.tenantType == 0"> 创建库 </el-button>
<el-button icon="ele-Menu" size="small" text type="primary" @click="openGrantMenu(scope.row)" :v-auth="'sysTenant:grantMenu'"> 授权菜单 </el-button>
<el-button icon="ele-Link" size="small" text type="primary" @click="openGrantApi(scope.row)"> 授权接口 </el-button>
<el-dropdown>
<el-button icon="ele-MoreFilled" size="small" text type="primary" style="padding-left: 12px" />
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item icon="ele-OfficeBuilding" @click="openGrantMenu(scope.row)" :v-auth="'sysTenant:grantMenu'"> 授权菜单 </el-dropdown-item>
<el-dropdown-item icon="ele-RefreshLeft" @click="resetTenantPwd(scope.row)" :v-auth="'sysTenant:resetPwd'"> 重置密码 </el-dropdown-item>
<el-dropdown-item icon="ele-Delete" @click="delTenant(scope.row)" :v-auth="'sysTenant:delete'"> 删除租户 </el-dropdown-item>
</el-dropdown-menu>
@ -109,6 +110,7 @@
<EditTenant ref="editTenantRef" :title="state.editTenantTitle" @handleQuery="handleQuery" />
<GrantMenu ref="grantMenuRef" />
<GrantApi ref="grantApiRef" />
</div>
</template>
@ -117,6 +119,7 @@ import { onMounted, reactive, ref } from 'vue';
import { ElMessageBox, ElMessage } from 'element-plus';
import EditTenant from '/@/views/system/tenant/component/editTenant.vue';
import GrantMenu from '/@/views/system/tenant/component/grantMenu.vue';
import GrantApi from '/@/views/system/role/component/grantApi.vue';
import ModifyRecord from '/@/components/table/modifyRecord.vue';
import { getAPI } from '/@/utils/axios-utils';
@ -125,6 +128,7 @@ import { TenantOutput } from '/@/api-services/models';
const editTenantRef = ref<InstanceType<typeof EditTenant>>();
const grantMenuRef = ref<InstanceType<typeof GrantMenu>>();
const grantApiRef = ref<InstanceType<typeof GrantApi>>();
const state = reactive({
loading: false,
tenantData: [] as Array<TenantOutput>,
@ -178,6 +182,11 @@ const openGrantMenu = async (row: any) => {
grantMenuRef.value?.openDialog(row);
};
//
const openGrantApi = async (row: any) => {
grantApiRef.value?.openDrawer(row);
};
//
const resetTenantPwd = async (row: any) => {
ElMessageBox.confirm(`确定重置密码:【${row.name}】?`, '提示', {