@pubinfo/module-rbac 2.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +53 -0
- package/src/api/modules/assist/gonggaofuwu.ts +109 -0
- package/src/api/modules/assist/index.ts +5 -0
- package/src/api/modules/assist/qunzujiekou.ts +95 -0
- package/src/api/modules/assist/quyujiekou.ts +97 -0
- package/src/api/modules/assist/typings.d.ts +364 -0
- package/src/api/modules/configData/heibaimingdanfuwu.ts +95 -0
- package/src/api/modules/configData/index.ts +5 -0
- package/src/api/modules/configData/typings.d.ts +347 -0
- package/src/api/modules/configData/xitongpeizhifuwu.ts +322 -0
- package/src/api/modules/configData/zidianfuwu.ts +151 -0
- package/src/api/modules/log/caozuorizhifuwu.ts +37 -0
- package/src/api/modules/log/denglurizhifuwu.ts +37 -0
- package/src/api/modules/log/index.ts +4 -0
- package/src/api/modules/log/typings.d.ts +179 -0
- package/src/api/modules/rbac/gangweijiekou.ts +93 -0
- package/src/api/modules/rbac/index.ts +13 -0
- package/src/api/modules/rbac/jiaosejiekou.ts +124 -0
- package/src/api/modules/rbac/pubJiaosezukongzhiqi.ts +113 -0
- package/src/api/modules/rbac/shujuquanxianzhubiaokongzhiqi.ts +186 -0
- package/src/api/modules/rbac/typings.d.ts +2001 -0
- package/src/api/modules/rbac/yonghujiekou.ts +225 -0
- package/src/api/modules/rbac/yonghushoucangbiaojiekou.ts +93 -0
- package/src/api/modules/rbac/yonghuzuijinchangyongbiaojiekou.ts +72 -0
- package/src/api/modules/rbac/ziyuanjiekou.ts +223 -0
- package/src/api/modules/rbac/zuhuguanlijiekou.ts +91 -0
- package/src/api/modules/rbac/zuzhijiaosebiaokongzhiqi.ts +76 -0
- package/src/api/modules/rbac/zuzhijiekou.ts +171 -0
- package/src/api/request.ts +3 -0
- package/src/assets/icons/403.svg +1 -0
- package/src/assets/icons/403_dark.svg +1 -0
- package/src/assets/icons/404.svg +1 -0
- package/src/assets/icons/404_dark.svg +1 -0
- package/src/assets/icons/add-child.svg +1 -0
- package/src/assets/icons/authority.svg +1 -0
- package/src/assets/icons/authorize.svg +1 -0
- package/src/assets/icons/blacklist-disable.svg +1 -0
- package/src/assets/icons/blacklist-enable.svg +1 -0
- package/src/assets/icons/browser-360.svg +1 -0
- package/src/assets/icons/browser-chrome.svg +1 -0
- package/src/assets/icons/browser-edge.svg +1 -0
- package/src/assets/icons/browser-ie.svg +1 -0
- package/src/assets/icons/browser-other.svg +1 -0
- package/src/assets/icons/browser-qq.svg +1 -0
- package/src/assets/icons/browser-safari.svg +1 -0
- package/src/assets/icons/browser-uc.svg +1 -0
- package/src/assets/icons/change-org.svg +1 -0
- package/src/assets/icons/edit.svg +1 -0
- package/src/assets/icons/empty-data.svg +1 -0
- package/src/assets/icons/favorites.svg +1 -0
- package/src/assets/icons/icard.svg +1 -0
- package/src/assets/icons/icon_animation.svg +1 -0
- package/src/assets/icons/icon_breadcrumb.svg +1 -0
- package/src/assets/icons/icon_copyright.svg +1 -0
- package/src/assets/icons/icon_jt.svg +1 -0
- package/src/assets/icons/icon_layout.svg +1 -0
- package/src/assets/icons/icon_mainpage.svg +1 -0
- package/src/assets/icons/icon_menu.svg +1 -0
- package/src/assets/icons/icon_page_size.svg +1 -0
- package/src/assets/icons/icon_position_type.svg +1 -0
- package/src/assets/icons/icon_safe_manage.svg +1 -0
- package/src/assets/icons/icon_screen_scale.svg +6 -0
- package/src/assets/icons/icon_system_manage.svg +1 -0
- package/src/assets/icons/icon_tabbar.svg +1 -0
- package/src/assets/icons/icon_toolbar.svg +1 -0
- package/src/assets/icons/icon_topbar.svg +1 -0
- package/src/assets/icons/icon_watermark.svg +1 -0
- package/src/assets/icons/image-load-fail.svg +1 -0
- package/src/assets/icons/log-center.svg +1 -0
- package/src/assets/icons/logo-sig.svg +1 -0
- package/src/assets/icons/logo.svg +1 -0
- package/src/assets/icons/mima.svg +1 -0
- package/src/assets/icons/not-data.svg +1 -0
- package/src/assets/icons/org-main.svg +1 -0
- package/src/assets/icons/org-unmain.svg +1 -0
- package/src/assets/icons/process-management.svg +1 -0
- package/src/assets/icons/project-management.svg +1 -0
- package/src/assets/icons/rbac.svg +1 -0
- package/src/assets/icons/remove.svg +1 -0
- package/src/assets/icons/resource-app.svg +1 -0
- package/src/assets/icons/resource-btn.svg +1 -0
- package/src/assets/icons/resource-index.svg +1 -0
- package/src/assets/icons/resource-menu.svg +1 -0
- package/src/assets/icons/resource-nonmenu.svg +1 -0
- package/src/assets/icons/setting-manage.svg +1 -0
- package/src/assets/icons/test.svg +1 -0
- package/src/assets/icons/theme-check-mark.svg +1 -0
- package/src/assets/icons/theme-title.svg +1 -0
- package/src/assets/icons/toolbar-collapse.svg +1 -0
- package/src/assets/icons/tree_icon.svg +1 -0
- package/src/assets/icons/tree_icon_checked.svg +1 -0
- package/src/assets/icons/view.svg +1 -0
- package/src/assets/icons/workbench.svg +1 -0
- package/src/assets/icons/zddata.svg +1 -0
- package/src/assets/icons/zy_checked.svg +1 -0
- package/src/assets/icons/zy_default.svg +1 -0
- package/src/assets/images/layout/item1.webp +0 -0
- package/src/assets/images/layout/item1_dark.webp +0 -0
- package/src/assets/images/layout/item2.webp +0 -0
- package/src/assets/images/layout/item2_dark.webp +0 -0
- package/src/assets/images/layout/item3.webp +0 -0
- package/src/assets/images/layout/item3_dark.webp +0 -0
- package/src/assets/images/layout/item4.webp +0 -0
- package/src/assets/images/layout/item4_dark.webp +0 -0
- package/src/assets/images/layout/item5.webp +0 -0
- package/src/assets/images/layout/item5_dark.webp +0 -0
- package/src/assets/images/page-width/anto_min_w_dark.webp +0 -0
- package/src/assets/images/page-width/auto.webp +0 -0
- package/src/assets/images/page-width/auto_dark.webp +0 -0
- package/src/assets/images/page-width/auto_min_w.webp +0 -0
- package/src/assets/images/page-width/auto_min_w_dark.webp +0 -0
- package/src/assets/images/page-width/icon_auto.webp +0 -0
- package/src/assets/images/page-width/icon_auto_dark.webp +0 -0
- package/src/assets/images/page-width/icon_auto_min_w.webp +0 -0
- package/src/assets/images/page-width/icon_auto_min_w_dark.webp +0 -0
- package/src/assets/images/page-width/icon_middle.webp +0 -0
- package/src/assets/images/page-width/icon_middle_dark.webp +0 -0
- package/src/assets/images/page-width/icon_middle_max_w.webp +0 -0
- package/src/assets/images/page-width/icon_middle_max_w_dark.webp +0 -0
- package/src/assets/images/page-width/middle.webp +0 -0
- package/src/assets/images/page-width/middle_dark.webp +0 -0
- package/src/assets/images/page-width/middle_max_w.webp +0 -0
- package/src/assets/images/page-width/middle_max_w_dark.webp +0 -0
- package/src/assets/lottie/breadcrumb/dark/enable.json +1 -0
- package/src/assets/lottie/breadcrumb/dark/enableMainMenu.json +1 -0
- package/src/assets/lottie/breadcrumb/dark/style.json +1 -0
- package/src/assets/lottie/breadcrumb/light/enable.json +1 -0
- package/src/assets/lottie/breadcrumb/light/enableMainMenu.json +1 -0
- package/src/assets/lottie/breadcrumb/light/style.json +1 -0
- package/src/assets/lottie/layout/data-test.json +1 -0
- package/src/assets/lottie/layout/data.json +1 -0
- package/src/assets/lottie/menu/dark/enableHotkeys.json +1 -0
- package/src/assets/lottie/menu/dark/enableSubMenuCollapseButton.json +1 -0
- package/src/assets/lottie/menu/dark/isRounded.json +1 -0
- package/src/assets/lottie/menu/dark/menuActiveStyle.json +1 -0
- package/src/assets/lottie/menu/dark/subMenuCollapse.json +1 -0
- package/src/assets/lottie/menu/dark/subMenuUniqueOpened.json +1 -0
- package/src/assets/lottie/menu/light/enableHotkeys.json +1 -0
- package/src/assets/lottie/menu/light/enableSubMenuCollapseButton.json +1 -0
- package/src/assets/lottie/menu/light/isRounded.json +1 -0
- package/src/assets/lottie/menu/light/menuActiveStyle.json +1 -0
- package/src/assets/lottie/menu/light/subMenuCollapse.json +1 -0
- package/src/assets/lottie/menu/light/subMenuUniqueOpened.json +1 -0
- package/src/assets/lottie/other/dark/enableCopyright.json +1 -0
- package/src/assets/lottie/other/dark/enableHotkeys.json +1 -0
- package/src/assets/lottie/other/dark/switchTabbarAndToolbar.json +1 -0
- package/src/assets/lottie/other/light/enableCopyright.json +1 -0
- package/src/assets/lottie/other/light/enableHotkeys.json +1 -0
- package/src/assets/lottie/other/light/switchTabbarAndToolbar.json +1 -0
- package/src/assets/lottie/page_animation/dark/fadeinout.json +1 -0
- package/src/assets/lottie/page_animation/dark/fadeinout_old.json +1 -0
- package/src/assets/lottie/page_animation/dark/tobottom.json +1 -0
- package/src/assets/lottie/page_animation/dark/tobottom_old.json +1 -0
- package/src/assets/lottie/page_animation/dark/toleft.json +1 -0
- package/src/assets/lottie/page_animation/dark/toleft_old.json +1 -0
- package/src/assets/lottie/page_animation/dark/toright.json +1 -0
- package/src/assets/lottie/page_animation/dark/toright_old.json +1 -0
- package/src/assets/lottie/page_animation/dark/totop.json +1 -0
- package/src/assets/lottie/page_animation/dark/totop_old.json +1 -0
- package/src/assets/lottie/page_animation/light/fadeinout.json +1 -0
- package/src/assets/lottie/page_animation/light/tobottom.json +1 -0
- package/src/assets/lottie/page_animation/light/toleft.json +1 -0
- package/src/assets/lottie/page_animation/light/toright.json +1 -0
- package/src/assets/lottie/page_animation/light/totop.json +1 -0
- package/src/assets/lottie/tabbar/dark/enable.json +1 -0
- package/src/assets/lottie/tabbar/dark/enableHotkeys.json +1 -0
- package/src/assets/lottie/tabbar/dark/enableIcon.json +1 -0
- package/src/assets/lottie/tabbar/dark/enableMemory.json +1 -0
- package/src/assets/lottie/tabbar/dark/style.json +1 -0
- package/src/assets/lottie/tabbar/light/enable.json +1 -0
- package/src/assets/lottie/tabbar/light/enableHotkeys.json +1 -0
- package/src/assets/lottie/tabbar/light/enableIcon.json +1 -0
- package/src/assets/lottie/tabbar/light/enableMemory.json +1 -0
- package/src/assets/lottie/tabbar/light/style.json +1 -0
- package/src/assets/lottie/toolbar/dark/enableColorScheme.json +1 -0
- package/src/assets/lottie/toolbar/dark/enableFullscreen.json +1 -0
- package/src/assets/lottie/toolbar/dark/enableI18n.json +1 -0
- package/src/assets/lottie/toolbar/dark/enableNotification.json +1 -0
- package/src/assets/lottie/toolbar/dark/enablePageReload.json +1 -0
- package/src/assets/lottie/toolbar/dark/enableUserPreferences.json +1 -0
- package/src/assets/lottie/toolbar/dark/navSearchEnable.json +1 -0
- package/src/assets/lottie/toolbar/dark/navSearchEnableHotkeys.json +1 -0
- package/src/assets/lottie/toolbar/light/enableColorScheme.json +1 -0
- package/src/assets/lottie/toolbar/light/enableFullscreen.json +1 -0
- package/src/assets/lottie/toolbar/light/enableI18n.json +1 -0
- package/src/assets/lottie/toolbar/light/enableNotification.json +1 -0
- package/src/assets/lottie/toolbar/light/enablePageReload.json +1 -0
- package/src/assets/lottie/toolbar/light/enableUserPreferences.json +1 -0
- package/src/assets/lottie/toolbar/light/navSearchEnable.json +1 -0
- package/src/assets/lottie/toolbar/light/navSearchEnableHotkeys.json +1 -0
- package/src/assets/lottie/watermark/dark/enableWatermark.json +1 -0
- package/src/assets/lottie/watermark/light/enableWatermark.json +1 -0
- package/src/assets/styles/vxe-table.css +13 -0
- package/src/components/GroupSelector/index.vue +311 -0
- package/src/components/OrgTree/index.vue +91 -0
- package/src/components/OrgUserSelector/OrgSelector.vue +135 -0
- package/src/components/OrgUserSelector/UserSelector.vue +164 -0
- package/src/components/OrgUserSelector/index.ts +47 -0
- package/src/components/OrgUserSelector/provider.ts +373 -0
- package/src/components/ResourceSelector/enum.ts +5 -0
- package/src/components/ResourceSelector/hooks/useAppAndResource.ts +96 -0
- package/src/components/ResourceSelector/index.vue +432 -0
- package/src/composables/useLottie.ts +65 -0
- package/src/index.ts +31 -0
- package/src/interface.ts +54 -0
- package/src/routes/index.ts +156 -0
- package/src/routes/modules/authority.manage.menu.ts +105 -0
- package/src/routes/modules/log.manage.menu.ts +45 -0
- package/src/routes/modules/safe.manage.menu.ts +71 -0
- package/src/routes/modules/stylesetting.manage.menu.ts +130 -0
- package/src/routes/modules/system.manage.menu.ts +92 -0
- package/src/stores/index.ts +1 -0
- package/src/views/blackWhiteList/components/drawerBlackWhiteList.vue +132 -0
- package/src/views/blackWhiteList/enum.ts +7 -0
- package/src/views/blackWhiteList/index.vue +309 -0
- package/src/views/blackWhiteList/types.ts +4 -0
- package/src/views/breadcrumb_setting/animationData.ts +15 -0
- package/src/views/breadcrumb_setting/index.vue +147 -0
- package/src/views/components/HCheckList.vue +47 -0
- package/src/views/components/animation_item.vue +37 -0
- package/src/views/components/setItem.vue +126 -0
- package/src/views/data-permission/components/createAndEditDataPermission.vue +354 -0
- package/src/views/data-permission/enum.ts +59 -0
- package/src/views/data-permission/index.vue +190 -0
- package/src/views/dictionary/components/drawerDictionary.vue +108 -0
- package/src/views/dictionary/components/drawerDictionaryItem.vue +115 -0
- package/src/views/dictionary/enum.ts +8 -0
- package/src/views/dictionary/index.vue +194 -0
- package/src/views/dictionary/itemlist.vue +164 -0
- package/src/views/group/components/drawerGroup.vue +177 -0
- package/src/views/group/enum.ts +25 -0
- package/src/views/group/index.vue +207 -0
- package/src/views/layout_setting/index.vue +306 -0
- package/src/views/log_center/components/browserType.vue +35 -0
- package/src/views/log_center/components/loginHistoryDetail.vue +71 -0
- package/src/views/log_center/components/operateHistoryDetail.vue +80 -0
- package/src/views/log_center/login_history.vue +239 -0
- package/src/views/log_center/operate_history.vue +233 -0
- package/src/views/menu_setting/animationData.ts +27 -0
- package/src/views/menu_setting/index.vue +207 -0
- package/src/views/organization/components/drawerOrganization.vue +161 -0
- package/src/views/organization/components/drawerRole.vue +159 -0
- package/src/views/organization/components/roleSelect.vue +258 -0
- package/src/views/organization/enum.ts +26 -0
- package/src/views/organization/index.vue +516 -0
- package/src/views/other_setting/animationData.ts +15 -0
- package/src/views/other_setting/index.vue +250 -0
- package/src/views/other_setting/interface.ts +26 -0
- package/src/views/page_animation_setting/animationData.ts +23 -0
- package/src/views/page_animation_setting/index.vue +200 -0
- package/src/views/page_w_setting/index.vue +238 -0
- package/src/views/position/components/drawerPosition.vue +131 -0
- package/src/views/position/enum.ts +8 -0
- package/src/views/position/index.vue +167 -0
- package/src/views/region/components/drawerRegion.vue +143 -0
- package/src/views/region/enum.ts +24 -0
- package/src/views/region/index.vue +246 -0
- package/src/views/resource/components/ResourceEdit.vue +209 -0
- package/src/views/resource/components/RoleRelation.vue +100 -0
- package/src/views/resource/enum.ts +35 -0
- package/src/views/resource/index.vue +237 -0
- package/src/views/resource/interface.ts +6 -0
- package/src/views/role/components/ResourceRelation.vue +113 -0
- package/src/views/role/components/drawerRole.vue +191 -0
- package/src/views/role/enum.ts +26 -0
- package/src/views/role/index.vue +183 -0
- package/src/views/role/interface.ts +6 -0
- package/src/views/role_group/components/ResourceRelation.vue +91 -0
- package/src/views/role_group/components/drawerRole.vue +153 -0
- package/src/views/role_group/components/roleSelect.vue +224 -0
- package/src/views/role_group/enum.ts +22 -0
- package/src/views/role_group/index.vue +170 -0
- package/src/views/role_group/interface.ts +6 -0
- package/src/views/safe_setting/index.vue +237 -0
- package/src/views/tabbar_setting/animationData.ts +23 -0
- package/src/views/tabbar_setting/index.vue +186 -0
- package/src/views/tenant/components/TenantEdit.vue +226 -0
- package/src/views/tenant/index.vue +192 -0
- package/src/views/tenant/interface.ts +4 -0
- package/src/views/theme_setting/index.vue +465 -0
- package/src/views/toolbar_setting/animationData.ts +42 -0
- package/src/views/toolbar_setting/index.vue +189 -0
- package/src/views/user/components/OrgAndPosition.vue +156 -0
- package/src/views/user/components/UserAuthorization.vue +260 -0
- package/src/views/user/components/UserEdit.vue +267 -0
- package/src/views/user/components/roleSelect.vue +258 -0
- package/src/views/user/enum.ts +13 -0
- package/src/views/user/index.vue +266 -0
- package/src/views/user/interface.ts +43 -0
- package/src/views/watermark_setting/animationData.ts +7 -0
- package/src/views/watermark_setting/index.vue +236 -0
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { getRbacPubRoleGroupGetAll, getRbacPubRoleGroupGetById, getRbacRoleRoleList } from '@/api/modules/rbac';
|
|
3
|
+
import { SearchOutlined } from '@ant-design/icons-vue';
|
|
4
|
+
import { useToggle } from '@vueuse/core';
|
|
5
|
+
|
|
6
|
+
defineOptions({
|
|
7
|
+
name: 'RoleSelect',
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
const emit = defineEmits(['select']);
|
|
11
|
+
|
|
12
|
+
const loading = ref(false);
|
|
13
|
+
const checkedKeys: Ref<string[]> = ref([]);
|
|
14
|
+
const rightItems: Ref<API.PubRole[]> = ref([]);
|
|
15
|
+
const roleData = ref<API.PubRole[]>([]);
|
|
16
|
+
const searchContent = ref('');
|
|
17
|
+
const open = defineModel<boolean>('open');
|
|
18
|
+
const selectedGroupId = ref('');
|
|
19
|
+
const roleGroupOptions = ref<API.PubRoleGroup[]>([]);
|
|
20
|
+
const roleInGroup = ref<API.PubRole[]>([]);
|
|
21
|
+
|
|
22
|
+
const setOpen = useToggle(open);
|
|
23
|
+
watch(() => checkedKeys.value, (val) => {
|
|
24
|
+
rightItems.value = val.reduce((acc: API.PubRole[], ite: string) => {
|
|
25
|
+
const temp = roleData.value.find(item => item.id === ite) || {};
|
|
26
|
+
acc.push(temp);
|
|
27
|
+
return acc;
|
|
28
|
+
}, []);
|
|
29
|
+
}, { deep: true });
|
|
30
|
+
watch(() => selectedGroupId.value, (val) => {
|
|
31
|
+
changeGroup(val);
|
|
32
|
+
});
|
|
33
|
+
async function onOpen(ids: string[]) {
|
|
34
|
+
// 获取所有角色组
|
|
35
|
+
const groupRes = await getRbacPubRoleGroupGetAll({ name: '' });
|
|
36
|
+
roleGroupOptions.value = groupRes.data || [];
|
|
37
|
+
selectedGroupId.value = '';
|
|
38
|
+
await changeGroup('');
|
|
39
|
+
checkedKeys.value = [...ids];
|
|
40
|
+
setOpen(true);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function clearAllChecked() {
|
|
44
|
+
checkedKeys.value = [];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function handleCloseTag(removedTagId: string) {
|
|
48
|
+
const index = checkedKeys.value.findIndex(item => item === removedTagId);
|
|
49
|
+
if (index >= 0) {
|
|
50
|
+
checkedKeys.value.splice(index, 1);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function notifySelect() {
|
|
55
|
+
emit('select', rightItems.value);
|
|
56
|
+
setOpen(false);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function filterName(v: API.PubRole) {
|
|
60
|
+
return roleInGroup.value.findIndex(item => item.id === v.id) > -1 && v.name?.includes(searchContent.value);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// 切换角色组
|
|
64
|
+
async function changeGroup(value: string | undefined) {
|
|
65
|
+
loading.value = true;
|
|
66
|
+
if (value) {
|
|
67
|
+
const res = await getRbacPubRoleGroupGetById({ id: value });
|
|
68
|
+
loading.value = false;
|
|
69
|
+
roleInGroup.value = res.data?.roles || [];
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
const res = await getRbacRoleRoleList();
|
|
73
|
+
loading.value = false;
|
|
74
|
+
roleData.value = res.data || [];
|
|
75
|
+
// 获取两个数组交集
|
|
76
|
+
roleInGroup.value = [...roleData.value].filter(x => [...(res.data || [])].some(y => y.id === x.id));
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
defineExpose({
|
|
80
|
+
open: onOpen,
|
|
81
|
+
});
|
|
82
|
+
</script>
|
|
83
|
+
|
|
84
|
+
<template>
|
|
85
|
+
<a-modal
|
|
86
|
+
v-model:open="open"
|
|
87
|
+
class="custom_modal"
|
|
88
|
+
title="角色选择"
|
|
89
|
+
:mask-closable="false"
|
|
90
|
+
:width="750"
|
|
91
|
+
>
|
|
92
|
+
<div class="h-340px border-1px border-solid flex flex-row border_color">
|
|
93
|
+
<div class="w-360px flex flex-col">
|
|
94
|
+
<div class="flex-1 overflow-hidden py-10px px-10px">
|
|
95
|
+
<a-input v-model:value="searchContent" placeholder="请输入" allow-clear>
|
|
96
|
+
<template #addonBefore>
|
|
97
|
+
<a-select v-model:value="selectedGroupId" style="width: 90px;">
|
|
98
|
+
<a-select-option value="">
|
|
99
|
+
全部
|
|
100
|
+
</a-select-option>
|
|
101
|
+
<a-select-option v-for="item in roleGroupOptions" :key="item.id" :value="item.id">
|
|
102
|
+
<a-tooltip :title="item.name">
|
|
103
|
+
{{ item.name }}
|
|
104
|
+
</a-tooltip>
|
|
105
|
+
</a-select-option>
|
|
106
|
+
</a-select>
|
|
107
|
+
</template>
|
|
108
|
+
<template #suffix>
|
|
109
|
+
<SearchOutlined />
|
|
110
|
+
</template>
|
|
111
|
+
</a-input>
|
|
112
|
+
<div class="overflow-y-auto overflow-x-hidden h-[calc(100%-30px)] mt-10px">
|
|
113
|
+
<a-spin v-if="loading" class="cent" />
|
|
114
|
+
<a-checkbox-group v-else v-model:value="checkedKeys" class="w-full">
|
|
115
|
+
<div v-for="ite in roleData" v-show="filterName(ite)" :key="ite.id" class="w-full py-10px bodb">
|
|
116
|
+
<a-checkbox :value="ite.id">
|
|
117
|
+
<a-tooltip v-if="(ite.name || '').length > 22" :title="ite.name">
|
|
118
|
+
{{ `${ite?.name?.slice(0, 22)}...` }}
|
|
119
|
+
</a-tooltip>
|
|
120
|
+
<span v-else>{{ ite.name }}</span>
|
|
121
|
+
</a-checkbox>
|
|
122
|
+
</div>
|
|
123
|
+
</a-checkbox-group>
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
</div>
|
|
127
|
+
|
|
128
|
+
<div class="flex-1 flex flex-col border-solid border-0px border-l-1px border_color">
|
|
129
|
+
<div class="w-full h-34px bg-[#F2F3F5] flex px-15px items-center justify-between text-[#1D2129] dark:bg-[#1D2129] dark:text-[#F2F3F5]">
|
|
130
|
+
<div class="">
|
|
131
|
+
已选角色
|
|
132
|
+
</div>
|
|
133
|
+
<div class="cursor-pointer text-[#165DFF]" @click="clearAllChecked">
|
|
134
|
+
清空
|
|
135
|
+
</div>
|
|
136
|
+
</div>
|
|
137
|
+
<div class="flex-1 p-10px overflow-auto">
|
|
138
|
+
<div v-for="item in rightItems" :key="item.id" class="inline-block mb-6px max-w-300px">
|
|
139
|
+
<a-tooltip v-if="(item.name || '').length > 20" :title="item.name">
|
|
140
|
+
<a-tag class="custom_tag bg-[#e8f3ff] dark:bg-[#141414]" closable @close="handleCloseTag(item.id || '')">
|
|
141
|
+
{{ `${item?.name?.slice(0, 20)}...` }}
|
|
142
|
+
</a-tag>
|
|
143
|
+
</a-tooltip>
|
|
144
|
+
<a-tag
|
|
145
|
+
v-else
|
|
146
|
+
class="custom_tag bg-[#e8f3ff] dark:bg-[#141414]"
|
|
147
|
+
closable
|
|
148
|
+
@close="handleCloseTag(item.id || '')"
|
|
149
|
+
>
|
|
150
|
+
{{ item.name }}
|
|
151
|
+
</a-tag>
|
|
152
|
+
</div>
|
|
153
|
+
</div>
|
|
154
|
+
</div>
|
|
155
|
+
</div>
|
|
156
|
+
|
|
157
|
+
<template #footer>
|
|
158
|
+
<a-button @click="setOpen(false)">
|
|
159
|
+
取消
|
|
160
|
+
</a-button>
|
|
161
|
+
<a-button type="primary" @click="notifySelect">
|
|
162
|
+
确定
|
|
163
|
+
</a-button>
|
|
164
|
+
</template>
|
|
165
|
+
</a-modal>
|
|
166
|
+
</template>
|
|
167
|
+
|
|
168
|
+
<style lang="scss" scoped>
|
|
169
|
+
.cent {
|
|
170
|
+
position: relative;
|
|
171
|
+
top: 50%;
|
|
172
|
+
left: 50%;
|
|
173
|
+
transform: translate(-50%, -50%);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.border_color {
|
|
177
|
+
border-color: #e5e6eb;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
[data-theme="dark"] {
|
|
181
|
+
.border_color {
|
|
182
|
+
border-color: rgb(253 253 253 / 12%);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.border_c {
|
|
187
|
+
border: 1px dashed #ccc;
|
|
188
|
+
border-radius: 10px;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
:deep(.ant-dropdown-link) {
|
|
192
|
+
padding: 4px 6px;
|
|
193
|
+
font-size: 12px;
|
|
194
|
+
border-radius: 2px;
|
|
195
|
+
transform: scale(0.7);
|
|
196
|
+
}
|
|
197
|
+
</style>
|
|
198
|
+
|
|
199
|
+
<style lang='scss' scoped>
|
|
200
|
+
.custom_modal {
|
|
201
|
+
:deep(.ant-modal-content) {
|
|
202
|
+
padding: 0;
|
|
203
|
+
border-radius: 0;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
:deep(.ant-modal-header) {
|
|
207
|
+
padding: 12px 16px;
|
|
208
|
+
margin-bottom: 0;
|
|
209
|
+
border-bottom: 1px solid #e5e6eb;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
:deep(.ant-modal-title) {
|
|
213
|
+
font-size: 16px;
|
|
214
|
+
font-weight: 500;
|
|
215
|
+
color: #1d2129;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
:deep(.ant-modal-body) {
|
|
219
|
+
padding: 16px;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.bodb {
|
|
223
|
+
border-bottom: 1px solid #e5e6eb;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
:deep(.ant-modal-footer) {
|
|
227
|
+
padding: 16px;
|
|
228
|
+
border-top: 1px solid #e5e6eb;
|
|
229
|
+
|
|
230
|
+
.ant-btn {
|
|
231
|
+
border-radius: 2px;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
:deep(.ant-tree-checkbox) {
|
|
237
|
+
margin-block-start: 0;
|
|
238
|
+
margin-inline-end: 2px;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
:deep(.ant-tree-checkbox + span .ant-tree-iconEle) {
|
|
242
|
+
margin-right: 4px;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.custom_tag {
|
|
246
|
+
padding: 3px 8px;
|
|
247
|
+
border-width: 0;
|
|
248
|
+
border-radius: 2px;
|
|
249
|
+
|
|
250
|
+
:deep(.ant-tag-close-icon) {
|
|
251
|
+
color: rgb(22 93 255 / 60%);
|
|
252
|
+
|
|
253
|
+
&:hover {
|
|
254
|
+
color: #165dff;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
</style>
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
<script setup lang="tsx">
|
|
2
|
+
import type { ProColumns } from '@pubinfo/pro-components';
|
|
3
|
+
import type { EventDataNode } from 'ant-design-vue/es/tree';
|
|
4
|
+
import type { CurrentOrg, Data, Query } from './interface';
|
|
5
|
+
import { getRbacUserUserDelete, postRbacUserUserPage, putRbacUserResetPassword } from '@/api/modules/rbac';
|
|
6
|
+
import { ProTable } from '@pubinfo/pro-components';
|
|
7
|
+
import { Badge, message, Modal, Popover, Space } from 'ant-design-vue';
|
|
8
|
+
import UserAuthorization from './components/UserAuthorization.vue';
|
|
9
|
+
import UserEdit from './components/UserEdit.vue';
|
|
10
|
+
import { ACTION } from './enum';
|
|
11
|
+
|
|
12
|
+
defineOptions({
|
|
13
|
+
name: 'User',
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const { auth } = useAuth();
|
|
17
|
+
|
|
18
|
+
const columns: ProColumns<API.PubUserBo> = [
|
|
19
|
+
{
|
|
20
|
+
valueType: 'a-input',
|
|
21
|
+
bind: 'value',
|
|
22
|
+
title: '登录账号',
|
|
23
|
+
dataIndex: 'loginName',
|
|
24
|
+
ellipsis: true,
|
|
25
|
+
fieldProps: {
|
|
26
|
+
placeholder: '请输入',
|
|
27
|
+
allowClear: true,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
valueType: 'a-input',
|
|
32
|
+
bind: 'value',
|
|
33
|
+
title: '真实姓名',
|
|
34
|
+
dataIndex: 'realName',
|
|
35
|
+
ellipsis: true,
|
|
36
|
+
fieldProps: {
|
|
37
|
+
placeholder: '请输入',
|
|
38
|
+
allowClear: true,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
title: '手机号',
|
|
43
|
+
dataIndex: 'mobile',
|
|
44
|
+
ellipsis: true,
|
|
45
|
+
hideInSearch: true,
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
title: '组织名称',
|
|
49
|
+
dataIndex: 'userOrgList',
|
|
50
|
+
ellipsis: true,
|
|
51
|
+
hideInSearch: true,
|
|
52
|
+
customRender({ text: list }) {
|
|
53
|
+
return (
|
|
54
|
+
<Popover
|
|
55
|
+
placement="topLeft"
|
|
56
|
+
getPopupContainer={() => document.body}
|
|
57
|
+
v-slots={{
|
|
58
|
+
default: () => list?.map((item: API.PubUserOrgBo) => item.orgName).join(','),
|
|
59
|
+
content: () => (
|
|
60
|
+
<Space direction="vertical">
|
|
61
|
+
{list.map((item: API.PubUserOrgBo) => {
|
|
62
|
+
return <Badge status={item.main ? 'processing' : 'success'} text={item.orgName} />;
|
|
63
|
+
})}
|
|
64
|
+
</Space>
|
|
65
|
+
),
|
|
66
|
+
}}
|
|
67
|
+
/>
|
|
68
|
+
);
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
title: '电子邮箱',
|
|
73
|
+
dataIndex: 'email',
|
|
74
|
+
ellipsis: true,
|
|
75
|
+
hideInSearch: true,
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
title: '是否启用',
|
|
79
|
+
dataIndex: 'enable',
|
|
80
|
+
width: 100,
|
|
81
|
+
hideInSearch: true,
|
|
82
|
+
customRender({ text }) {
|
|
83
|
+
return (
|
|
84
|
+
text
|
|
85
|
+
? <Badge status="success" text="是" />
|
|
86
|
+
: <Badge status="error" text="否" />
|
|
87
|
+
);
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
title: '操作',
|
|
92
|
+
dataIndex: 'action',
|
|
93
|
+
fixed: 'right',
|
|
94
|
+
width: 280,
|
|
95
|
+
hideInSearch: true,
|
|
96
|
+
hideInTable() {
|
|
97
|
+
return !auth([
|
|
98
|
+
'user_authorize',
|
|
99
|
+
'user_reset_password',
|
|
100
|
+
'user_edit',
|
|
101
|
+
'user_remove',
|
|
102
|
+
]);
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
];
|
|
106
|
+
|
|
107
|
+
const currentOrg = ref<CurrentOrg>({});
|
|
108
|
+
const currentUser = ref<Data>({});
|
|
109
|
+
const query = ref<Query>({});
|
|
110
|
+
const tableRef = ref();
|
|
111
|
+
async function request(params: any) {
|
|
112
|
+
const { current, pageSize, ...rest } = params;
|
|
113
|
+
const res = await postRbacUserUserPage({
|
|
114
|
+
currentPage: current,
|
|
115
|
+
pageSize,
|
|
116
|
+
orgId: currentOrg.value?.orgId,
|
|
117
|
+
...query.value,
|
|
118
|
+
...rest,
|
|
119
|
+
});
|
|
120
|
+
return {
|
|
121
|
+
success: res.success,
|
|
122
|
+
data: res.data?.records ?? [],
|
|
123
|
+
total: res.data?.total ?? 0,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function getUserData() {
|
|
128
|
+
tableRef.value.reload();
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function onSelect(_: unknown, { node }: { node: EventDataNode & API.PubOrg }) {
|
|
132
|
+
if (node.selected) {
|
|
133
|
+
currentOrg.value = {};
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
currentOrg.value = {
|
|
137
|
+
orgId: node.id,
|
|
138
|
+
orgName: node.name,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
getUserData();
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const editRef = ref();
|
|
146
|
+
const authorizationRef = ref();
|
|
147
|
+
function onAction(key: ACTION, record?: Data) {
|
|
148
|
+
switch (key) {
|
|
149
|
+
case ACTION.ADD:
|
|
150
|
+
editRef.value.open(key);
|
|
151
|
+
break;
|
|
152
|
+
|
|
153
|
+
case ACTION.AUTHORIZE:
|
|
154
|
+
if (record) {
|
|
155
|
+
currentUser.value = record;
|
|
156
|
+
}
|
|
157
|
+
if (authorizationRef.value && authorizationRef.value.open) {
|
|
158
|
+
authorizationRef.value.open();
|
|
159
|
+
}
|
|
160
|
+
break;
|
|
161
|
+
|
|
162
|
+
case ACTION.EDIT:
|
|
163
|
+
editRef.value.open(key, record);
|
|
164
|
+
break;
|
|
165
|
+
|
|
166
|
+
case ACTION.RESET_PASSWORD:
|
|
167
|
+
Modal.confirm({
|
|
168
|
+
title: '重置密码',
|
|
169
|
+
content: '确定要重置该用户密码吗?',
|
|
170
|
+
async onOk() {
|
|
171
|
+
const res = await putRbacUserResetPassword({ userId: record?.id as string });
|
|
172
|
+
if (res.success) {
|
|
173
|
+
message.success('重置密码成功');
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
});
|
|
177
|
+
break;
|
|
178
|
+
|
|
179
|
+
case ACTION.REMOVE: {
|
|
180
|
+
const hasMultiOrg = record?.userOrgList && record.userOrgList?.length > 1;
|
|
181
|
+
Modal.confirm({
|
|
182
|
+
title: '删除',
|
|
183
|
+
content: `确定要删除该用户吗?${hasMultiOrg ? '该用户存在多个组织下,若只需移除组织,请在编辑中操作。' : ''}`,
|
|
184
|
+
async onOk() {
|
|
185
|
+
const res = await getRbacUserUserDelete({ userId: record?.id as string });
|
|
186
|
+
if (res.success) {
|
|
187
|
+
message.success('删除成功');
|
|
188
|
+
getUserData();
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
});
|
|
192
|
+
break;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// 根据数据的业务逻辑判断是否按钮展示
|
|
198
|
+
function isShow(key: ACTION, record: Data) {
|
|
199
|
+
// 租户管理员只有重置密码
|
|
200
|
+
if (record.userType === '2') {
|
|
201
|
+
return [ACTION.RESET_PASSWORD].includes(key);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
return [ACTION.AUTHORIZE, ACTION.RESET_PASSWORD, ACTION.EDIT, ACTION.REMOVE].includes(key);
|
|
205
|
+
}
|
|
206
|
+
</script>
|
|
207
|
+
|
|
208
|
+
<template>
|
|
209
|
+
<div
|
|
210
|
+
w-full
|
|
211
|
+
h-full
|
|
212
|
+
py-10px
|
|
213
|
+
px-10px
|
|
214
|
+
overflow-hidden
|
|
215
|
+
>
|
|
216
|
+
<a-row :gutter="[8, 8]" :wrap="false" class="h-full">
|
|
217
|
+
<a-col flex="320px" class="h-full overflow-hidden">
|
|
218
|
+
<OrgTree :select-keys="[query.orgId]" :bordered="false" auth="organization" @select="onSelect" />
|
|
219
|
+
</a-col>
|
|
220
|
+
|
|
221
|
+
<a-col flex="auto" class="h-full">
|
|
222
|
+
<ProTable
|
|
223
|
+
ref="tableRef"
|
|
224
|
+
:row-key="(record: any) => `${record.id}-${record.orgId}`"
|
|
225
|
+
:request="request"
|
|
226
|
+
:columns="columns"
|
|
227
|
+
:scroll="{ x: 800 }"
|
|
228
|
+
auto-height
|
|
229
|
+
>
|
|
230
|
+
<template #toolbar>
|
|
231
|
+
<a-button v-auth="'user_add'" type="primary" @click="onAction(ACTION.ADD)">
|
|
232
|
+
<PlusCircleOutlined />
|
|
233
|
+
{{ ACTION.ADD }}
|
|
234
|
+
</a-button>
|
|
235
|
+
</template>
|
|
236
|
+
|
|
237
|
+
<template #bodyCell="{ column, record }">
|
|
238
|
+
<template v-if="column.dataIndex === 'action'">
|
|
239
|
+
<a-space>
|
|
240
|
+
<a v-if="isShow(ACTION.AUTHORIZE, record)" v-auth="'user_authorize'" class="flex items-center" @click="onAction(ACTION.AUTHORIZE, record)">
|
|
241
|
+
<PubinfoIcon name="authorize" mr-1 text-base />
|
|
242
|
+
<span>{{ ACTION.AUTHORIZE }}</span>
|
|
243
|
+
</a>
|
|
244
|
+
<a v-if="isShow(ACTION.RESET_PASSWORD, record)" v-auth="'user_reset_password'" class="flex items-center" @click="onAction(ACTION.RESET_PASSWORD, record)">
|
|
245
|
+
<PubinfoIcon name="i-ci-arrows-reload-01" mr-1 text-base />
|
|
246
|
+
<span>{{ ACTION.RESET_PASSWORD }}</span>
|
|
247
|
+
</a>
|
|
248
|
+
<a v-if="isShow(ACTION.EDIT, record)" v-auth="'user_edit'" class="flex items-center" @click="onAction(ACTION.EDIT, record)">
|
|
249
|
+
<PubinfoIcon name="edit" class="mr-1 text-base" />
|
|
250
|
+
<span>{{ ACTION.EDIT }}</span>
|
|
251
|
+
</a>
|
|
252
|
+
<span v-if="isShow(ACTION.REMOVE, record)" v-auth="'user_remove'" class="flex items-center text-red-500 hover:cursor-pointer hover:opacity-80" @click="onAction(ACTION.REMOVE, record)">
|
|
253
|
+
<PubinfoIcon name="remove" class="mr-1 text-base" />
|
|
254
|
+
<span>{{ ACTION.REMOVE }}</span>
|
|
255
|
+
</span>
|
|
256
|
+
</a-space>
|
|
257
|
+
</template>
|
|
258
|
+
</template>
|
|
259
|
+
</ProTable>
|
|
260
|
+
</a-col>
|
|
261
|
+
</a-row>
|
|
262
|
+
|
|
263
|
+
<UserEdit ref="editRef" :current-org="currentOrg" @submit="getUserData" />
|
|
264
|
+
<UserAuthorization ref="authorizationRef" :user-id="currentUser.id || ''" />
|
|
265
|
+
</div>
|
|
266
|
+
</template>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export type Query = API.PubUserQueryDto;
|
|
2
|
+
export type Data = API.PubUserBo;
|
|
3
|
+
export type AddForm = API.PubUserAddDto & Record<string, unknown>;
|
|
4
|
+
export type EditForm = API.PubUserUpdateDto & Record<string, unknown>;
|
|
5
|
+
|
|
6
|
+
interface BaseSelect {
|
|
7
|
+
value: string
|
|
8
|
+
label: string
|
|
9
|
+
}
|
|
10
|
+
export type Form = Omit<API.PubUserBo, 'userOrgList'> & {
|
|
11
|
+
userOrgList: Array<Omit<API.PubUserOrgBo, 'roles' | 'posts'> & { positionList: BaseSelect[] }>
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export interface CurrentOrg {
|
|
15
|
+
orgId?: string
|
|
16
|
+
orgName?: string
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface AuthItem {
|
|
20
|
+
dataPermissionIds?: any[]
|
|
21
|
+
roleIds?: any[]
|
|
22
|
+
userId?: string
|
|
23
|
+
orgId: string
|
|
24
|
+
orgName: string
|
|
25
|
+
main: boolean
|
|
26
|
+
[key: string]: any
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface SelectItem {
|
|
30
|
+
label: string
|
|
31
|
+
key: string
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export type OptionItem = string | SelectItem;
|
|
35
|
+
|
|
36
|
+
export interface ResultAuthItem {
|
|
37
|
+
dataPermissionIds: OptionItem[]
|
|
38
|
+
roleIds: OptionItem[]
|
|
39
|
+
userId: string
|
|
40
|
+
orgId: string
|
|
41
|
+
orgName: string
|
|
42
|
+
main: boolean
|
|
43
|
+
}
|