feat:等保

feat:等保-对/role/auth 接口可以支持权限配置全部和4个菜单,按钮,字段,表单 开分。
feat:用户权限-支持手动登出角色.
This commit is contained in:
lvjunzhao
2025-02-08 09:21:26 +08:00
parent 4969728bfa
commit df76bceab2
5 changed files with 271 additions and 42 deletions

View File

@ -13,9 +13,24 @@
<a-button type="primary" v-auth="'role:view'" @click="handleViewUser">
{{ t('查看成员') }}
</a-button>
<a-button type="primary" v-auth="'role:functionalAuth'" @click="handleAuth">
<!-- <a-button type="primary" v-auth="'role:functionalAuth'" @click="handleAuth">
{{ t('功能授权') }}
</a-button>
</a-button> -->
<a-dropdown v-auth="'role:functionalAuth'" >
<template #overlay>
<a-menu @click="handleAuth">
<a-menu-item key="4">全部</a-menu-item>
<a-menu-item key="0">菜单</a-menu-item>
<a-menu-item key="1">按钮</a-menu-item>
<a-menu-item key="2">字段</a-menu-item>
<a-menu-item key="3">表单</a-menu-item>
</a-menu>
</template>
<a-button type="primary" >
{{ t('功能授权') }}
<DownOutlined />
</a-button>
</a-dropdown>
<a-button type="primary" v-auth="'role:functionalAuth'" @click="handleAppAuth">
{{ t('移动端功能授权') }}
</a-button>
@ -25,6 +40,9 @@
<a-button type="primary" v-auth="'role:homeAuth'" @click="handleHomeAuth">
{{ t('首页授权') }}
</a-button>
<a-button type="primary" v-auth="'role:logoutRole'" @click="handleLogoutRole">
{{ t('登出角色用户') }}
</a-button>
</template>
<template #action="{ record }">
<TableAction
@ -87,6 +105,7 @@
addRoleUser,
getRoleUser,
addRoleInterface,
logoutByRoleId,
} from '/@/api/system/role';
import AuthModal from '../dataAuthority/components/AuthModal.vue';
import HomeModal from './components/HomeModal.vue';
@ -96,7 +115,7 @@
import AppAuthModal from './components/AppAuthModal.vue';
import { SelectDepartment } from '/@/components/SelectOrganizational/index';
import { useMessage } from '/@/hooks/web/useMessage';
import { Switch } from 'ant-design-vue';
import { Switch, Modal } from 'ant-design-vue';
import { PageWrapper } from '/@/components/Page';
import { useModal } from '/@/components/Modal';
import { useI18n } from '/@/hooks/web/useI18n';
@ -374,6 +393,30 @@
id: res.id,
});
}
function handleLogoutRole() {
let res = warning();
if (!res) {
return;
}
Modal.confirm({
title: '确认是否登出角色用户?',
// content: '确认是否登出角色用户',
okText: '是',
okType: 'danger',
cancelText: '否',
onOk() {
logoutByRoleId(res.id).then((_) => {
notification.info({
message: t('登出成功'),
description: t('成功'),
}); //提示消息
});
},
onCancel() {
console.log('Cancel');
},
});
}
return {
registerTable,
registerRoleModal,
@ -398,6 +441,7 @@
t,
registerAppAuthModal,
handleAppAuth,
handleLogoutRole,
};
},
});