@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,47 @@
|
|
|
1
|
+
import type { ModelValue as OrgModelValue, OrgSelectorProps } from './OrgSelector.vue';
|
|
2
|
+
|
|
3
|
+
import type { ModelValue as UserModelValue, UserSelectorProps } from './UserSelector.vue';
|
|
4
|
+
import { createApp, h } from 'vue';
|
|
5
|
+
|
|
6
|
+
import OrgSelector from './OrgSelector.vue';
|
|
7
|
+
import UserSelector from './UserSelector.vue';
|
|
8
|
+
|
|
9
|
+
export function selectOrg(props: OrgSelectorProps & { modelValue?: OrgModelValue[] }) {
|
|
10
|
+
createAppElement(OrgSelector, props);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function selectUser(props: UserSelectorProps & { modelValue?: UserModelValue[] }) {
|
|
14
|
+
createAppElement(UserSelector, props);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function createAppElement(
|
|
18
|
+
component: typeof OrgSelector | typeof UserSelector,
|
|
19
|
+
props: Parameters<typeof selectUser | typeof selectOrg>[0],
|
|
20
|
+
) {
|
|
21
|
+
const app = createApp({
|
|
22
|
+
render() {
|
|
23
|
+
return h(component, {
|
|
24
|
+
...props,
|
|
25
|
+
open: true,
|
|
26
|
+
onSubmit: (...arg) => {
|
|
27
|
+
props.onSubmit?.(...arg);
|
|
28
|
+
close();
|
|
29
|
+
},
|
|
30
|
+
onCancel: () => {
|
|
31
|
+
close();
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const container = document.createElement('div');
|
|
38
|
+
document.body.appendChild(container);
|
|
39
|
+
app.mount(container);
|
|
40
|
+
|
|
41
|
+
function close() {
|
|
42
|
+
setTimeout(() => {
|
|
43
|
+
app.unmount();
|
|
44
|
+
document.body.removeChild(container);
|
|
45
|
+
}, 500);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
import type { OrgProviderProps, UserProviderProps } from '@pubinfo/headlessui';
|
|
2
|
+
import { getGroupDetailById, postGroupFindPage } from '@/api/modules/assist';
|
|
3
|
+
import { getRbacOrgOrgListByParentId, getRbacOrgSearchSubOrgById, postRbacCollectAdd, postRbacCollectFindPage, postRbacCollectRemoveCollect, postRbacOrgSearch, postRbacOrgSearchOrgByIds, postRbacUsedAddBatch, postRbacUsedFindPage, postRbacUserUserAndOrgList, postRbacUserUserForMultiOrgPage } from '@/api/modules/rbac';
|
|
4
|
+
import { message } from 'ant-design-vue';
|
|
5
|
+
|
|
6
|
+
interface ExtraApis {
|
|
7
|
+
/** 回显选中项 */
|
|
8
|
+
getSelectedData?: (items: any[]) => Promise<any[]>
|
|
9
|
+
/** 添加到最近常用 */
|
|
10
|
+
addRecentlyUsed?: (items: any[]) => Promise<any>
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
type Filter<T = any> = (value: T, index: number) => boolean;
|
|
14
|
+
|
|
15
|
+
export const orgFieldNames: OrgProviderProps['fieldNames'] = {
|
|
16
|
+
value: 'orgId',
|
|
17
|
+
label: 'orgName',
|
|
18
|
+
favorite: 'collect',
|
|
19
|
+
info: 'fullName',
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const userFieldNames: OrgProviderProps['fieldNames'] = {
|
|
23
|
+
value: 'orgUserId',
|
|
24
|
+
label: 'userName',
|
|
25
|
+
favorite: 'collect',
|
|
26
|
+
info: 'fullName',
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export function joinId(orgId: string = '', userId: string = '') {
|
|
30
|
+
return `${orgId}_${userId}`;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function resolveId(orgUserId: string) {
|
|
34
|
+
const [orgId, userId] = orgUserId?.split('_');
|
|
35
|
+
return {
|
|
36
|
+
orgId,
|
|
37
|
+
userId,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function setDataAuth(auth?: string) {
|
|
42
|
+
if (auth) {
|
|
43
|
+
return {
|
|
44
|
+
headers: { 'X-ResourceMark': auth },
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return {};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function useOrgAPIs(
|
|
52
|
+
{ auth, filter }: { auth?: string, filter: Filter },
|
|
53
|
+
): OrgProviderProps['apis'] & ExtraApis {
|
|
54
|
+
return {
|
|
55
|
+
// 回显选中项
|
|
56
|
+
async getSelectedData(items: any[]) {
|
|
57
|
+
const res = await postRbacOrgSearchOrgByIds(
|
|
58
|
+
items.map(item => item[orgFieldNames.value]),
|
|
59
|
+
setDataAuth(auth),
|
|
60
|
+
);
|
|
61
|
+
return res?.data?.map((e) => {
|
|
62
|
+
return {
|
|
63
|
+
...e,
|
|
64
|
+
[orgFieldNames.value]: e.id,
|
|
65
|
+
[orgFieldNames.label]: e.name,
|
|
66
|
+
[orgFieldNames.info]: e.fullName,
|
|
67
|
+
};
|
|
68
|
+
}) ?? [];
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
// 添加到最近常用
|
|
72
|
+
async addRecentlyUsed(items: any[]) {
|
|
73
|
+
await postRbacUsedAddBatch(items.map((item) => {
|
|
74
|
+
return {
|
|
75
|
+
type: '1',
|
|
76
|
+
orgId: item[orgFieldNames.value],
|
|
77
|
+
orgName: item[orgFieldNames.label],
|
|
78
|
+
};
|
|
79
|
+
}), setDataAuth(auth));
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
// 最近常用
|
|
83
|
+
async recentlyUsed({ search, current }) {
|
|
84
|
+
const res = await postRbacUsedFindPage({
|
|
85
|
+
type: '1',
|
|
86
|
+
orgName: search,
|
|
87
|
+
currentPage: current,
|
|
88
|
+
pageSize: 20,
|
|
89
|
+
showIsCollect: true,
|
|
90
|
+
}, setDataAuth(auth));
|
|
91
|
+
return {
|
|
92
|
+
total: 20,
|
|
93
|
+
data: res.data?.records?.map((e) => {
|
|
94
|
+
return {
|
|
95
|
+
...e,
|
|
96
|
+
[orgFieldNames.value]: e.orgId,
|
|
97
|
+
[orgFieldNames.label]: e.orgName,
|
|
98
|
+
[orgFieldNames.info]: e.fullOrgName,
|
|
99
|
+
};
|
|
100
|
+
}) ?? [],
|
|
101
|
+
};
|
|
102
|
+
},
|
|
103
|
+
|
|
104
|
+
// 收藏
|
|
105
|
+
async favorites({ search, current, pageSize }) {
|
|
106
|
+
const res = await postRbacCollectFindPage({
|
|
107
|
+
type: '1',
|
|
108
|
+
orgName: search,
|
|
109
|
+
currentPage: current,
|
|
110
|
+
pageSize,
|
|
111
|
+
}, setDataAuth(auth));
|
|
112
|
+
return {
|
|
113
|
+
total: res.data?.total ?? 0,
|
|
114
|
+
data: res.data?.records?.map((e) => {
|
|
115
|
+
return {
|
|
116
|
+
...e,
|
|
117
|
+
[orgFieldNames.value]: e.orgId,
|
|
118
|
+
[orgFieldNames.label]: e.orgName,
|
|
119
|
+
[orgFieldNames.info]: e.fullOrgName,
|
|
120
|
+
};
|
|
121
|
+
}) ?? [],
|
|
122
|
+
};
|
|
123
|
+
},
|
|
124
|
+
|
|
125
|
+
// 添加取消收藏
|
|
126
|
+
async favoriteToggle({ favorite, record }) {
|
|
127
|
+
const request = favorite ? postRbacCollectAdd : postRbacCollectRemoveCollect;
|
|
128
|
+
const res = await request({ type: '1', orgId: record?.[orgFieldNames.value] }, setDataAuth(auth));
|
|
129
|
+
if (res.success) {
|
|
130
|
+
message.success(favorite ? '收藏成功' : '取消收藏成功');
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
|
|
134
|
+
// 群组列表
|
|
135
|
+
async groups({ search, current, pageSize }) {
|
|
136
|
+
const res = await postGroupFindPage({
|
|
137
|
+
type: '1',
|
|
138
|
+
name: search,
|
|
139
|
+
currentPage: current,
|
|
140
|
+
pageSize,
|
|
141
|
+
});
|
|
142
|
+
return {
|
|
143
|
+
total: res.data?.total ?? 0,
|
|
144
|
+
data: res.data?.records?.map((e) => {
|
|
145
|
+
return {
|
|
146
|
+
...e,
|
|
147
|
+
[orgFieldNames.value]: e.id,
|
|
148
|
+
[orgFieldNames.label]: e.name,
|
|
149
|
+
};
|
|
150
|
+
}) ?? [],
|
|
151
|
+
};
|
|
152
|
+
},
|
|
153
|
+
|
|
154
|
+
// 群组数据
|
|
155
|
+
async groupData({ node }) {
|
|
156
|
+
const res = await getGroupDetailById({ id: node?.id, showIsCollect: true }, setDataAuth(auth));
|
|
157
|
+
return res.data?.pubGroupMemberList?.map((e) => {
|
|
158
|
+
return {
|
|
159
|
+
...e,
|
|
160
|
+
[orgFieldNames.value]: e.orgId,
|
|
161
|
+
[orgFieldNames.label]: e.orgName,
|
|
162
|
+
[orgFieldNames.info]: e.fullOrgName,
|
|
163
|
+
isLeaf: true,
|
|
164
|
+
};
|
|
165
|
+
}).filter(filter) ?? [];
|
|
166
|
+
},
|
|
167
|
+
|
|
168
|
+
// 组织树
|
|
169
|
+
async orgTree({ node }) {
|
|
170
|
+
const res = await getRbacOrgOrgListByParentId({
|
|
171
|
+
parentId: node?.orgId,
|
|
172
|
+
enable: true,
|
|
173
|
+
showFullName: true,
|
|
174
|
+
showIsCollect: true,
|
|
175
|
+
}, setDataAuth(auth));
|
|
176
|
+
return res.data?.map((e) => {
|
|
177
|
+
return {
|
|
178
|
+
...e,
|
|
179
|
+
[orgFieldNames.value]: e.id,
|
|
180
|
+
[orgFieldNames.label]: e.name,
|
|
181
|
+
[orgFieldNames.info]: e.fullName,
|
|
182
|
+
isLeaf: e.leaf,
|
|
183
|
+
};
|
|
184
|
+
}).filter(filter) ?? [];
|
|
185
|
+
},
|
|
186
|
+
|
|
187
|
+
// 组织的所有子节点
|
|
188
|
+
async orgChildren({ node }) {
|
|
189
|
+
const res = await getRbacOrgSearchSubOrgById({ parentId: node?.orgId }, setDataAuth(auth));
|
|
190
|
+
return res.data?.map((e) => {
|
|
191
|
+
return {
|
|
192
|
+
...e,
|
|
193
|
+
[orgFieldNames.value]: e.id,
|
|
194
|
+
[orgFieldNames.label]: e.name,
|
|
195
|
+
[orgFieldNames.info]: e.fullName,
|
|
196
|
+
isLeaf: e.leaf,
|
|
197
|
+
};
|
|
198
|
+
}).filter(filter) ?? [];
|
|
199
|
+
},
|
|
200
|
+
|
|
201
|
+
// 组织列表
|
|
202
|
+
async orgList({ search, current, pageSize }) {
|
|
203
|
+
const res = await postRbacOrgSearch({
|
|
204
|
+
keyWord: search,
|
|
205
|
+
currentPage: current,
|
|
206
|
+
pageSize,
|
|
207
|
+
showIsCollect: true,
|
|
208
|
+
}, setDataAuth(auth));
|
|
209
|
+
return {
|
|
210
|
+
total: res.data?.total ?? 0,
|
|
211
|
+
data: res.data?.records?.map((e) => {
|
|
212
|
+
return {
|
|
213
|
+
...e,
|
|
214
|
+
[orgFieldNames.value]: e.id,
|
|
215
|
+
[orgFieldNames.label]: e.simpleName,
|
|
216
|
+
[orgFieldNames.info]: e.fullName,
|
|
217
|
+
};
|
|
218
|
+
}).filter(filter) ?? [],
|
|
219
|
+
};
|
|
220
|
+
},
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
export function useUserAPIs(
|
|
225
|
+
{ auth, filter }: { auth?: string, filter: Filter },
|
|
226
|
+
): UserProviderProps['apis'] & ExtraApis {
|
|
227
|
+
return {
|
|
228
|
+
// 回显选中项
|
|
229
|
+
async getSelectedData(items: any[]) {
|
|
230
|
+
const res = await postRbacUserUserAndOrgList(items.map((item) => {
|
|
231
|
+
return {
|
|
232
|
+
orgId: item.orgId,
|
|
233
|
+
userId: item.userId,
|
|
234
|
+
};
|
|
235
|
+
}), setDataAuth(auth));
|
|
236
|
+
return res?.data?.map((e) => {
|
|
237
|
+
return {
|
|
238
|
+
...e,
|
|
239
|
+
[userFieldNames.value]: joinId(e?.orgId, e.id),
|
|
240
|
+
[userFieldNames.label]: e.realName,
|
|
241
|
+
[userFieldNames.info]: e.fullOrgName,
|
|
242
|
+
};
|
|
243
|
+
}) ?? [];
|
|
244
|
+
},
|
|
245
|
+
|
|
246
|
+
// 添加到最近常用
|
|
247
|
+
async addRecentlyUsed(items: any[]) {
|
|
248
|
+
await postRbacUsedAddBatch(items.map((item) => {
|
|
249
|
+
const ids = resolveId(item[userFieldNames.value]);
|
|
250
|
+
return {
|
|
251
|
+
type: '2',
|
|
252
|
+
orgId: ids.orgId,
|
|
253
|
+
userId: ids.userId,
|
|
254
|
+
userName: item[userFieldNames.label],
|
|
255
|
+
};
|
|
256
|
+
}), setDataAuth(auth));
|
|
257
|
+
},
|
|
258
|
+
|
|
259
|
+
// 最近常用
|
|
260
|
+
async recentlyUsed({ search, current }) {
|
|
261
|
+
const res = await postRbacUsedFindPage({
|
|
262
|
+
type: '2',
|
|
263
|
+
userName: search,
|
|
264
|
+
currentPage: current,
|
|
265
|
+
pageSize: 20,
|
|
266
|
+
showIsCollect: true,
|
|
267
|
+
}, setDataAuth(auth));
|
|
268
|
+
return {
|
|
269
|
+
total: 20,
|
|
270
|
+
data: res.data?.records?.map((e) => {
|
|
271
|
+
return {
|
|
272
|
+
...e,
|
|
273
|
+
[userFieldNames.value]: joinId(e.orgId, e.userId),
|
|
274
|
+
[userFieldNames.label]: e.userName,
|
|
275
|
+
[userFieldNames.info]: e.fullOrgName,
|
|
276
|
+
};
|
|
277
|
+
}) ?? [],
|
|
278
|
+
};
|
|
279
|
+
},
|
|
280
|
+
|
|
281
|
+
// 收藏
|
|
282
|
+
async favorites({ search, current, pageSize }) {
|
|
283
|
+
const res = await postRbacCollectFindPage({
|
|
284
|
+
type: '2',
|
|
285
|
+
userName: search,
|
|
286
|
+
currentPage: current,
|
|
287
|
+
pageSize,
|
|
288
|
+
}, setDataAuth(auth));
|
|
289
|
+
return {
|
|
290
|
+
total: res.data?.total ?? 0,
|
|
291
|
+
data: res.data?.records?.map((e) => {
|
|
292
|
+
return {
|
|
293
|
+
...e,
|
|
294
|
+
[userFieldNames.value]: joinId(e.orgId, e.userId),
|
|
295
|
+
[userFieldNames.label]: e.userName,
|
|
296
|
+
[userFieldNames.info]: e.fullOrgName,
|
|
297
|
+
};
|
|
298
|
+
}) ?? [],
|
|
299
|
+
};
|
|
300
|
+
},
|
|
301
|
+
|
|
302
|
+
// 添加取消收藏
|
|
303
|
+
async favoriteToggle({ favorite, record }) {
|
|
304
|
+
const request = favorite ? postRbacCollectAdd : postRbacCollectRemoveCollect;
|
|
305
|
+
const ids = resolveId(record?.[userFieldNames.value]);
|
|
306
|
+
const res = await request({
|
|
307
|
+
type: '2',
|
|
308
|
+
orgId: ids.orgId,
|
|
309
|
+
userId: ids.userId,
|
|
310
|
+
}, setDataAuth(auth));
|
|
311
|
+
if (res.success) {
|
|
312
|
+
message.success(favorite ? '收藏成功' : '取消收藏成功');
|
|
313
|
+
}
|
|
314
|
+
},
|
|
315
|
+
|
|
316
|
+
// 群组列表
|
|
317
|
+
async groups({ search, current, pageSize }) {
|
|
318
|
+
const res = await postGroupFindPage({
|
|
319
|
+
type: '2',
|
|
320
|
+
name: search,
|
|
321
|
+
currentPage: current,
|
|
322
|
+
pageSize,
|
|
323
|
+
}, setDataAuth(auth));
|
|
324
|
+
return {
|
|
325
|
+
total: res.data?.total ?? 0,
|
|
326
|
+
data: res.data?.records?.map((e) => {
|
|
327
|
+
return {
|
|
328
|
+
...e,
|
|
329
|
+
[userFieldNames.value]: e.id,
|
|
330
|
+
[userFieldNames.label]: e.name,
|
|
331
|
+
};
|
|
332
|
+
}) ?? [],
|
|
333
|
+
};
|
|
334
|
+
},
|
|
335
|
+
|
|
336
|
+
// 群组数据
|
|
337
|
+
async groupData({ node }) {
|
|
338
|
+
const res = await getGroupDetailById({ id: node?.id, showIsCollect: true }, setDataAuth(auth));
|
|
339
|
+
return res.data?.pubGroupMemberList?.map((e) => {
|
|
340
|
+
return {
|
|
341
|
+
...e,
|
|
342
|
+
[userFieldNames.value]: joinId(e.orgId, e.userId),
|
|
343
|
+
[userFieldNames.label]: e.userName,
|
|
344
|
+
[userFieldNames.info]: e.fullOrgName,
|
|
345
|
+
isLeaf: true,
|
|
346
|
+
};
|
|
347
|
+
}).filter(filter) ?? [];
|
|
348
|
+
},
|
|
349
|
+
|
|
350
|
+
// 用户列表
|
|
351
|
+
async userList({ orgId, search, current, pageSize }) {
|
|
352
|
+
const res = await postRbacUserUserForMultiOrgPage({
|
|
353
|
+
orgId,
|
|
354
|
+
realName: search,
|
|
355
|
+
currentPage: current,
|
|
356
|
+
pageSize,
|
|
357
|
+
enable: true,
|
|
358
|
+
showIsCollect: true,
|
|
359
|
+
}, setDataAuth(auth));
|
|
360
|
+
return {
|
|
361
|
+
total: res.data?.total ?? 0,
|
|
362
|
+
data: res.data?.records?.map((e) => {
|
|
363
|
+
return {
|
|
364
|
+
...e,
|
|
365
|
+
[userFieldNames.value]: joinId(e.orgId, e.userId),
|
|
366
|
+
[userFieldNames.label]: e.userName,
|
|
367
|
+
[userFieldNames.info]: e.fullOrgName,
|
|
368
|
+
};
|
|
369
|
+
}).filter(filter) ?? [],
|
|
370
|
+
};
|
|
371
|
+
},
|
|
372
|
+
};
|
|
373
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import type { ResourceMode } from '../enum';
|
|
2
|
+
import { getRbacResourceAppList, getRbacResourceGroupResourceTree } from '@/api/modules/rbac';
|
|
3
|
+
import { RESOURCE_MODE } from '../enum';
|
|
4
|
+
|
|
5
|
+
export type TreeNode = API.PubResource & {
|
|
6
|
+
children?: TreeNode[]
|
|
7
|
+
disabled?: boolean
|
|
8
|
+
};
|
|
9
|
+
export interface StringMap<T> { [key: string]: T };
|
|
10
|
+
|
|
11
|
+
export interface SelectedResourceInfo {
|
|
12
|
+
id: string
|
|
13
|
+
name: string
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default function useAppAndResource(mode?: ResourceMode) {
|
|
17
|
+
const resourceModelRef = ref();
|
|
18
|
+
const appList: Ref<API.PubResource[] | { label: string | undefined, value: string | undefined }[]> = ref([]);
|
|
19
|
+
const treeData: Ref<TreeNode[]> = ref([]);
|
|
20
|
+
const resourceMap: Ref<StringMap<string>> = ref({});
|
|
21
|
+
const selectedResources = ref<SelectedResourceInfo[]>([]);
|
|
22
|
+
const isDataPermissionMode = computed(() => mode === RESOURCE_MODE.DATA_PERMISSION);
|
|
23
|
+
|
|
24
|
+
function getAppList() {
|
|
25
|
+
getRbacResourceAppList().then((res) => {
|
|
26
|
+
if (res?.success) {
|
|
27
|
+
const data = res.data ?? [];
|
|
28
|
+
const list: { label: string | undefined, value: string | undefined }[] = data.map((item: API.PubResource) => {
|
|
29
|
+
return { label: item.name, value: item.id };
|
|
30
|
+
});
|
|
31
|
+
appList.value = list;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
async function updateTreeDataAndResourceMap(appId: string) {
|
|
37
|
+
const treeRes = await getRbacResourceGroupResourceTree({ appId });
|
|
38
|
+
treeData.value = treeRes?.data ?? [];
|
|
39
|
+
markDisabledNodesAndGenerateMap(treeData.value);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function markDisabledNodesAndGenerateMap(nodes: TreeNode[]) {
|
|
43
|
+
nodes.forEach((node) => {
|
|
44
|
+
if (node.id) {
|
|
45
|
+
resourceMap.value[node.id] = node.name!;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (isDataPermissionMode.value && node.enableDataPermission === false) {
|
|
49
|
+
// 未开启数据权限的节点标记为不可选
|
|
50
|
+
node.disabled = true;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (node.children && node.children.length) {
|
|
54
|
+
markDisabledNodesAndGenerateMap(node.children);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function setSelectedResources(resources: SelectedResourceInfo[]) {
|
|
60
|
+
selectedResources.value = resources;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
function updateSelectedResources(resourceIds: string[]) {
|
|
64
|
+
if (!resourceIds.length || !Object.keys(resourceMap.value).length) {
|
|
65
|
+
return [];
|
|
66
|
+
}
|
|
67
|
+
selectedResources.value = resourceIds.map((id) => {
|
|
68
|
+
return { id, name: resourceMap.value[id] };
|
|
69
|
+
}).filter(item => item.name);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
function clearSelectedResources() {
|
|
73
|
+
selectedResources.value = [];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function openResourceModel(resourceIds: string[]) {
|
|
77
|
+
if (resourceModelRef.value && resourceModelRef.value.open) {
|
|
78
|
+
resourceModelRef.value.open(resourceIds, treeData.value, resourceMap.value);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return {
|
|
83
|
+
appList,
|
|
84
|
+
resourceModelRef,
|
|
85
|
+
treeData,
|
|
86
|
+
resourceMap,
|
|
87
|
+
selectedResources,
|
|
88
|
+
isDataPermissionMode,
|
|
89
|
+
getAppList,
|
|
90
|
+
updateTreeDataAndResourceMap,
|
|
91
|
+
setSelectedResources,
|
|
92
|
+
updateSelectedResources,
|
|
93
|
+
clearSelectedResources,
|
|
94
|
+
openResourceModel,
|
|
95
|
+
};
|
|
96
|
+
}
|