@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.
Files changed (291) hide show
  1. package/package.json +53 -0
  2. package/src/api/modules/assist/gonggaofuwu.ts +109 -0
  3. package/src/api/modules/assist/index.ts +5 -0
  4. package/src/api/modules/assist/qunzujiekou.ts +95 -0
  5. package/src/api/modules/assist/quyujiekou.ts +97 -0
  6. package/src/api/modules/assist/typings.d.ts +364 -0
  7. package/src/api/modules/configData/heibaimingdanfuwu.ts +95 -0
  8. package/src/api/modules/configData/index.ts +5 -0
  9. package/src/api/modules/configData/typings.d.ts +347 -0
  10. package/src/api/modules/configData/xitongpeizhifuwu.ts +322 -0
  11. package/src/api/modules/configData/zidianfuwu.ts +151 -0
  12. package/src/api/modules/log/caozuorizhifuwu.ts +37 -0
  13. package/src/api/modules/log/denglurizhifuwu.ts +37 -0
  14. package/src/api/modules/log/index.ts +4 -0
  15. package/src/api/modules/log/typings.d.ts +179 -0
  16. package/src/api/modules/rbac/gangweijiekou.ts +93 -0
  17. package/src/api/modules/rbac/index.ts +13 -0
  18. package/src/api/modules/rbac/jiaosejiekou.ts +124 -0
  19. package/src/api/modules/rbac/pubJiaosezukongzhiqi.ts +113 -0
  20. package/src/api/modules/rbac/shujuquanxianzhubiaokongzhiqi.ts +186 -0
  21. package/src/api/modules/rbac/typings.d.ts +2001 -0
  22. package/src/api/modules/rbac/yonghujiekou.ts +225 -0
  23. package/src/api/modules/rbac/yonghushoucangbiaojiekou.ts +93 -0
  24. package/src/api/modules/rbac/yonghuzuijinchangyongbiaojiekou.ts +72 -0
  25. package/src/api/modules/rbac/ziyuanjiekou.ts +223 -0
  26. package/src/api/modules/rbac/zuhuguanlijiekou.ts +91 -0
  27. package/src/api/modules/rbac/zuzhijiaosebiaokongzhiqi.ts +76 -0
  28. package/src/api/modules/rbac/zuzhijiekou.ts +171 -0
  29. package/src/api/request.ts +3 -0
  30. package/src/assets/icons/403.svg +1 -0
  31. package/src/assets/icons/403_dark.svg +1 -0
  32. package/src/assets/icons/404.svg +1 -0
  33. package/src/assets/icons/404_dark.svg +1 -0
  34. package/src/assets/icons/add-child.svg +1 -0
  35. package/src/assets/icons/authority.svg +1 -0
  36. package/src/assets/icons/authorize.svg +1 -0
  37. package/src/assets/icons/blacklist-disable.svg +1 -0
  38. package/src/assets/icons/blacklist-enable.svg +1 -0
  39. package/src/assets/icons/browser-360.svg +1 -0
  40. package/src/assets/icons/browser-chrome.svg +1 -0
  41. package/src/assets/icons/browser-edge.svg +1 -0
  42. package/src/assets/icons/browser-ie.svg +1 -0
  43. package/src/assets/icons/browser-other.svg +1 -0
  44. package/src/assets/icons/browser-qq.svg +1 -0
  45. package/src/assets/icons/browser-safari.svg +1 -0
  46. package/src/assets/icons/browser-uc.svg +1 -0
  47. package/src/assets/icons/change-org.svg +1 -0
  48. package/src/assets/icons/edit.svg +1 -0
  49. package/src/assets/icons/empty-data.svg +1 -0
  50. package/src/assets/icons/favorites.svg +1 -0
  51. package/src/assets/icons/icard.svg +1 -0
  52. package/src/assets/icons/icon_animation.svg +1 -0
  53. package/src/assets/icons/icon_breadcrumb.svg +1 -0
  54. package/src/assets/icons/icon_copyright.svg +1 -0
  55. package/src/assets/icons/icon_jt.svg +1 -0
  56. package/src/assets/icons/icon_layout.svg +1 -0
  57. package/src/assets/icons/icon_mainpage.svg +1 -0
  58. package/src/assets/icons/icon_menu.svg +1 -0
  59. package/src/assets/icons/icon_page_size.svg +1 -0
  60. package/src/assets/icons/icon_position_type.svg +1 -0
  61. package/src/assets/icons/icon_safe_manage.svg +1 -0
  62. package/src/assets/icons/icon_screen_scale.svg +6 -0
  63. package/src/assets/icons/icon_system_manage.svg +1 -0
  64. package/src/assets/icons/icon_tabbar.svg +1 -0
  65. package/src/assets/icons/icon_toolbar.svg +1 -0
  66. package/src/assets/icons/icon_topbar.svg +1 -0
  67. package/src/assets/icons/icon_watermark.svg +1 -0
  68. package/src/assets/icons/image-load-fail.svg +1 -0
  69. package/src/assets/icons/log-center.svg +1 -0
  70. package/src/assets/icons/logo-sig.svg +1 -0
  71. package/src/assets/icons/logo.svg +1 -0
  72. package/src/assets/icons/mima.svg +1 -0
  73. package/src/assets/icons/not-data.svg +1 -0
  74. package/src/assets/icons/org-main.svg +1 -0
  75. package/src/assets/icons/org-unmain.svg +1 -0
  76. package/src/assets/icons/process-management.svg +1 -0
  77. package/src/assets/icons/project-management.svg +1 -0
  78. package/src/assets/icons/rbac.svg +1 -0
  79. package/src/assets/icons/remove.svg +1 -0
  80. package/src/assets/icons/resource-app.svg +1 -0
  81. package/src/assets/icons/resource-btn.svg +1 -0
  82. package/src/assets/icons/resource-index.svg +1 -0
  83. package/src/assets/icons/resource-menu.svg +1 -0
  84. package/src/assets/icons/resource-nonmenu.svg +1 -0
  85. package/src/assets/icons/setting-manage.svg +1 -0
  86. package/src/assets/icons/test.svg +1 -0
  87. package/src/assets/icons/theme-check-mark.svg +1 -0
  88. package/src/assets/icons/theme-title.svg +1 -0
  89. package/src/assets/icons/toolbar-collapse.svg +1 -0
  90. package/src/assets/icons/tree_icon.svg +1 -0
  91. package/src/assets/icons/tree_icon_checked.svg +1 -0
  92. package/src/assets/icons/view.svg +1 -0
  93. package/src/assets/icons/workbench.svg +1 -0
  94. package/src/assets/icons/zddata.svg +1 -0
  95. package/src/assets/icons/zy_checked.svg +1 -0
  96. package/src/assets/icons/zy_default.svg +1 -0
  97. package/src/assets/images/layout/item1.webp +0 -0
  98. package/src/assets/images/layout/item1_dark.webp +0 -0
  99. package/src/assets/images/layout/item2.webp +0 -0
  100. package/src/assets/images/layout/item2_dark.webp +0 -0
  101. package/src/assets/images/layout/item3.webp +0 -0
  102. package/src/assets/images/layout/item3_dark.webp +0 -0
  103. package/src/assets/images/layout/item4.webp +0 -0
  104. package/src/assets/images/layout/item4_dark.webp +0 -0
  105. package/src/assets/images/layout/item5.webp +0 -0
  106. package/src/assets/images/layout/item5_dark.webp +0 -0
  107. package/src/assets/images/page-width/anto_min_w_dark.webp +0 -0
  108. package/src/assets/images/page-width/auto.webp +0 -0
  109. package/src/assets/images/page-width/auto_dark.webp +0 -0
  110. package/src/assets/images/page-width/auto_min_w.webp +0 -0
  111. package/src/assets/images/page-width/auto_min_w_dark.webp +0 -0
  112. package/src/assets/images/page-width/icon_auto.webp +0 -0
  113. package/src/assets/images/page-width/icon_auto_dark.webp +0 -0
  114. package/src/assets/images/page-width/icon_auto_min_w.webp +0 -0
  115. package/src/assets/images/page-width/icon_auto_min_w_dark.webp +0 -0
  116. package/src/assets/images/page-width/icon_middle.webp +0 -0
  117. package/src/assets/images/page-width/icon_middle_dark.webp +0 -0
  118. package/src/assets/images/page-width/icon_middle_max_w.webp +0 -0
  119. package/src/assets/images/page-width/icon_middle_max_w_dark.webp +0 -0
  120. package/src/assets/images/page-width/middle.webp +0 -0
  121. package/src/assets/images/page-width/middle_dark.webp +0 -0
  122. package/src/assets/images/page-width/middle_max_w.webp +0 -0
  123. package/src/assets/images/page-width/middle_max_w_dark.webp +0 -0
  124. package/src/assets/lottie/breadcrumb/dark/enable.json +1 -0
  125. package/src/assets/lottie/breadcrumb/dark/enableMainMenu.json +1 -0
  126. package/src/assets/lottie/breadcrumb/dark/style.json +1 -0
  127. package/src/assets/lottie/breadcrumb/light/enable.json +1 -0
  128. package/src/assets/lottie/breadcrumb/light/enableMainMenu.json +1 -0
  129. package/src/assets/lottie/breadcrumb/light/style.json +1 -0
  130. package/src/assets/lottie/layout/data-test.json +1 -0
  131. package/src/assets/lottie/layout/data.json +1 -0
  132. package/src/assets/lottie/menu/dark/enableHotkeys.json +1 -0
  133. package/src/assets/lottie/menu/dark/enableSubMenuCollapseButton.json +1 -0
  134. package/src/assets/lottie/menu/dark/isRounded.json +1 -0
  135. package/src/assets/lottie/menu/dark/menuActiveStyle.json +1 -0
  136. package/src/assets/lottie/menu/dark/subMenuCollapse.json +1 -0
  137. package/src/assets/lottie/menu/dark/subMenuUniqueOpened.json +1 -0
  138. package/src/assets/lottie/menu/light/enableHotkeys.json +1 -0
  139. package/src/assets/lottie/menu/light/enableSubMenuCollapseButton.json +1 -0
  140. package/src/assets/lottie/menu/light/isRounded.json +1 -0
  141. package/src/assets/lottie/menu/light/menuActiveStyle.json +1 -0
  142. package/src/assets/lottie/menu/light/subMenuCollapse.json +1 -0
  143. package/src/assets/lottie/menu/light/subMenuUniqueOpened.json +1 -0
  144. package/src/assets/lottie/other/dark/enableCopyright.json +1 -0
  145. package/src/assets/lottie/other/dark/enableHotkeys.json +1 -0
  146. package/src/assets/lottie/other/dark/switchTabbarAndToolbar.json +1 -0
  147. package/src/assets/lottie/other/light/enableCopyright.json +1 -0
  148. package/src/assets/lottie/other/light/enableHotkeys.json +1 -0
  149. package/src/assets/lottie/other/light/switchTabbarAndToolbar.json +1 -0
  150. package/src/assets/lottie/page_animation/dark/fadeinout.json +1 -0
  151. package/src/assets/lottie/page_animation/dark/fadeinout_old.json +1 -0
  152. package/src/assets/lottie/page_animation/dark/tobottom.json +1 -0
  153. package/src/assets/lottie/page_animation/dark/tobottom_old.json +1 -0
  154. package/src/assets/lottie/page_animation/dark/toleft.json +1 -0
  155. package/src/assets/lottie/page_animation/dark/toleft_old.json +1 -0
  156. package/src/assets/lottie/page_animation/dark/toright.json +1 -0
  157. package/src/assets/lottie/page_animation/dark/toright_old.json +1 -0
  158. package/src/assets/lottie/page_animation/dark/totop.json +1 -0
  159. package/src/assets/lottie/page_animation/dark/totop_old.json +1 -0
  160. package/src/assets/lottie/page_animation/light/fadeinout.json +1 -0
  161. package/src/assets/lottie/page_animation/light/tobottom.json +1 -0
  162. package/src/assets/lottie/page_animation/light/toleft.json +1 -0
  163. package/src/assets/lottie/page_animation/light/toright.json +1 -0
  164. package/src/assets/lottie/page_animation/light/totop.json +1 -0
  165. package/src/assets/lottie/tabbar/dark/enable.json +1 -0
  166. package/src/assets/lottie/tabbar/dark/enableHotkeys.json +1 -0
  167. package/src/assets/lottie/tabbar/dark/enableIcon.json +1 -0
  168. package/src/assets/lottie/tabbar/dark/enableMemory.json +1 -0
  169. package/src/assets/lottie/tabbar/dark/style.json +1 -0
  170. package/src/assets/lottie/tabbar/light/enable.json +1 -0
  171. package/src/assets/lottie/tabbar/light/enableHotkeys.json +1 -0
  172. package/src/assets/lottie/tabbar/light/enableIcon.json +1 -0
  173. package/src/assets/lottie/tabbar/light/enableMemory.json +1 -0
  174. package/src/assets/lottie/tabbar/light/style.json +1 -0
  175. package/src/assets/lottie/toolbar/dark/enableColorScheme.json +1 -0
  176. package/src/assets/lottie/toolbar/dark/enableFullscreen.json +1 -0
  177. package/src/assets/lottie/toolbar/dark/enableI18n.json +1 -0
  178. package/src/assets/lottie/toolbar/dark/enableNotification.json +1 -0
  179. package/src/assets/lottie/toolbar/dark/enablePageReload.json +1 -0
  180. package/src/assets/lottie/toolbar/dark/enableUserPreferences.json +1 -0
  181. package/src/assets/lottie/toolbar/dark/navSearchEnable.json +1 -0
  182. package/src/assets/lottie/toolbar/dark/navSearchEnableHotkeys.json +1 -0
  183. package/src/assets/lottie/toolbar/light/enableColorScheme.json +1 -0
  184. package/src/assets/lottie/toolbar/light/enableFullscreen.json +1 -0
  185. package/src/assets/lottie/toolbar/light/enableI18n.json +1 -0
  186. package/src/assets/lottie/toolbar/light/enableNotification.json +1 -0
  187. package/src/assets/lottie/toolbar/light/enablePageReload.json +1 -0
  188. package/src/assets/lottie/toolbar/light/enableUserPreferences.json +1 -0
  189. package/src/assets/lottie/toolbar/light/navSearchEnable.json +1 -0
  190. package/src/assets/lottie/toolbar/light/navSearchEnableHotkeys.json +1 -0
  191. package/src/assets/lottie/watermark/dark/enableWatermark.json +1 -0
  192. package/src/assets/lottie/watermark/light/enableWatermark.json +1 -0
  193. package/src/assets/styles/vxe-table.css +13 -0
  194. package/src/components/GroupSelector/index.vue +311 -0
  195. package/src/components/OrgTree/index.vue +91 -0
  196. package/src/components/OrgUserSelector/OrgSelector.vue +135 -0
  197. package/src/components/OrgUserSelector/UserSelector.vue +164 -0
  198. package/src/components/OrgUserSelector/index.ts +47 -0
  199. package/src/components/OrgUserSelector/provider.ts +373 -0
  200. package/src/components/ResourceSelector/enum.ts +5 -0
  201. package/src/components/ResourceSelector/hooks/useAppAndResource.ts +96 -0
  202. package/src/components/ResourceSelector/index.vue +432 -0
  203. package/src/composables/useLottie.ts +65 -0
  204. package/src/index.ts +31 -0
  205. package/src/interface.ts +54 -0
  206. package/src/routes/index.ts +156 -0
  207. package/src/routes/modules/authority.manage.menu.ts +105 -0
  208. package/src/routes/modules/log.manage.menu.ts +45 -0
  209. package/src/routes/modules/safe.manage.menu.ts +71 -0
  210. package/src/routes/modules/stylesetting.manage.menu.ts +130 -0
  211. package/src/routes/modules/system.manage.menu.ts +92 -0
  212. package/src/stores/index.ts +1 -0
  213. package/src/views/blackWhiteList/components/drawerBlackWhiteList.vue +132 -0
  214. package/src/views/blackWhiteList/enum.ts +7 -0
  215. package/src/views/blackWhiteList/index.vue +309 -0
  216. package/src/views/blackWhiteList/types.ts +4 -0
  217. package/src/views/breadcrumb_setting/animationData.ts +15 -0
  218. package/src/views/breadcrumb_setting/index.vue +147 -0
  219. package/src/views/components/HCheckList.vue +47 -0
  220. package/src/views/components/animation_item.vue +37 -0
  221. package/src/views/components/setItem.vue +126 -0
  222. package/src/views/data-permission/components/createAndEditDataPermission.vue +354 -0
  223. package/src/views/data-permission/enum.ts +59 -0
  224. package/src/views/data-permission/index.vue +190 -0
  225. package/src/views/dictionary/components/drawerDictionary.vue +108 -0
  226. package/src/views/dictionary/components/drawerDictionaryItem.vue +115 -0
  227. package/src/views/dictionary/enum.ts +8 -0
  228. package/src/views/dictionary/index.vue +194 -0
  229. package/src/views/dictionary/itemlist.vue +164 -0
  230. package/src/views/group/components/drawerGroup.vue +177 -0
  231. package/src/views/group/enum.ts +25 -0
  232. package/src/views/group/index.vue +207 -0
  233. package/src/views/layout_setting/index.vue +306 -0
  234. package/src/views/log_center/components/browserType.vue +35 -0
  235. package/src/views/log_center/components/loginHistoryDetail.vue +71 -0
  236. package/src/views/log_center/components/operateHistoryDetail.vue +80 -0
  237. package/src/views/log_center/login_history.vue +239 -0
  238. package/src/views/log_center/operate_history.vue +233 -0
  239. package/src/views/menu_setting/animationData.ts +27 -0
  240. package/src/views/menu_setting/index.vue +207 -0
  241. package/src/views/organization/components/drawerOrganization.vue +161 -0
  242. package/src/views/organization/components/drawerRole.vue +159 -0
  243. package/src/views/organization/components/roleSelect.vue +258 -0
  244. package/src/views/organization/enum.ts +26 -0
  245. package/src/views/organization/index.vue +516 -0
  246. package/src/views/other_setting/animationData.ts +15 -0
  247. package/src/views/other_setting/index.vue +250 -0
  248. package/src/views/other_setting/interface.ts +26 -0
  249. package/src/views/page_animation_setting/animationData.ts +23 -0
  250. package/src/views/page_animation_setting/index.vue +200 -0
  251. package/src/views/page_w_setting/index.vue +238 -0
  252. package/src/views/position/components/drawerPosition.vue +131 -0
  253. package/src/views/position/enum.ts +8 -0
  254. package/src/views/position/index.vue +167 -0
  255. package/src/views/region/components/drawerRegion.vue +143 -0
  256. package/src/views/region/enum.ts +24 -0
  257. package/src/views/region/index.vue +246 -0
  258. package/src/views/resource/components/ResourceEdit.vue +209 -0
  259. package/src/views/resource/components/RoleRelation.vue +100 -0
  260. package/src/views/resource/enum.ts +35 -0
  261. package/src/views/resource/index.vue +237 -0
  262. package/src/views/resource/interface.ts +6 -0
  263. package/src/views/role/components/ResourceRelation.vue +113 -0
  264. package/src/views/role/components/drawerRole.vue +191 -0
  265. package/src/views/role/enum.ts +26 -0
  266. package/src/views/role/index.vue +183 -0
  267. package/src/views/role/interface.ts +6 -0
  268. package/src/views/role_group/components/ResourceRelation.vue +91 -0
  269. package/src/views/role_group/components/drawerRole.vue +153 -0
  270. package/src/views/role_group/components/roleSelect.vue +224 -0
  271. package/src/views/role_group/enum.ts +22 -0
  272. package/src/views/role_group/index.vue +170 -0
  273. package/src/views/role_group/interface.ts +6 -0
  274. package/src/views/safe_setting/index.vue +237 -0
  275. package/src/views/tabbar_setting/animationData.ts +23 -0
  276. package/src/views/tabbar_setting/index.vue +186 -0
  277. package/src/views/tenant/components/TenantEdit.vue +226 -0
  278. package/src/views/tenant/index.vue +192 -0
  279. package/src/views/tenant/interface.ts +4 -0
  280. package/src/views/theme_setting/index.vue +465 -0
  281. package/src/views/toolbar_setting/animationData.ts +42 -0
  282. package/src/views/toolbar_setting/index.vue +189 -0
  283. package/src/views/user/components/OrgAndPosition.vue +156 -0
  284. package/src/views/user/components/UserAuthorization.vue +260 -0
  285. package/src/views/user/components/UserEdit.vue +267 -0
  286. package/src/views/user/components/roleSelect.vue +258 -0
  287. package/src/views/user/enum.ts +13 -0
  288. package/src/views/user/index.vue +266 -0
  289. package/src/views/user/interface.ts +43 -0
  290. package/src/views/watermark_setting/animationData.ts +7 -0
  291. package/src/views/watermark_setting/index.vue +236 -0
@@ -0,0 +1,13 @@
1
+ @import "vxe-table/lib/style.css";
2
+
3
+ html.dark [data-theme="dark"],
4
+ html.dark [data-theme="dark"] *,
5
+ html.dark [data-theme="dark"]::before,
6
+ html.dark [data-theme="dark"]::after {
7
+ --vxe-table-header-background-color: #1d1d1d;
8
+ --vxe-table-body-background-color: #141414;
9
+ --vxe-table-border-color: rgb(253 253 253 / 12%);
10
+ --vxe-table-header-font-color: rgb(255 255 255 / 85%);
11
+ --vxe-font-color: rgb(255 255 255 / 85%);
12
+ --vxe-table-row-hover-background-color: #1d1d1d;
13
+ }
@@ -0,0 +1,311 @@
1
+ <script setup lang="ts">
2
+ import { postGroupList } from '@/api/modules/assist';
3
+ import { GROUP_TYPE } from '@/views/group/enum';
4
+ import { useToggle } from '@vueuse/core';
5
+
6
+ defineOptions({
7
+ name: 'GroupSelector',
8
+ });
9
+
10
+ const emit = defineEmits(['select']);
11
+
12
+ interface IOption {
13
+ label: string
14
+ value: string
15
+ name: string
16
+ id: string
17
+ };
18
+
19
+ const currentTab = ref('OrgGroup');
20
+ const isOrgMode = computed(() => currentTab.value === 'OrgGroup');
21
+ const orgGroupList = ref<IOption[]>([]);
22
+ const userGroupList = ref<IOption[]>([]);
23
+ const selectedOrgGroups = ref<string[]>([]);
24
+ const selectedUserGroups = ref<string[]>([]);
25
+ const selectedData = computed(() => {
26
+ const list = isOrgMode.value ? orgGroupList : userGroupList;
27
+ const selectedKeys = isOrgMode.value ? selectedOrgGroups : selectedUserGroups;
28
+ return list.value.filter(item => selectedKeys.value.includes(item.value));
29
+ });
30
+
31
+ const open = defineModel<boolean>('open');
32
+ const setOpen = useToggle(open);
33
+
34
+ getData();
35
+
36
+ function getData() {
37
+ getGroupsData(GROUP_TYPE.ORG);
38
+ getGroupsData(GROUP_TYPE.PER);
39
+ }
40
+
41
+ function getGroupsData(type: GROUP_TYPE.ORG | GROUP_TYPE.PER) {
42
+ postGroupList({ type }).then((res) => {
43
+ if (res && res.data && res.data.length) {
44
+ const list = res.data.map((item) => {
45
+ const { name = '', id = '' } = item;
46
+ const shortName = name.length > 20 ? `${name.substring(0, 20)}...` : name;
47
+ return {
48
+ label: shortName,
49
+ value: id,
50
+ name,
51
+ id,
52
+ };
53
+ });
54
+
55
+ if (type === GROUP_TYPE.ORG) {
56
+ orgGroupList.value = list;
57
+ }
58
+ else {
59
+ userGroupList.value = list;
60
+ }
61
+ }
62
+ });
63
+ }
64
+
65
+ function onOpen(selectedGroups: IOption[]) {
66
+ if (selectedGroups && selectedGroups.length) {
67
+ const groups = selectedGroups.map((item) => {
68
+ return item.value;
69
+ });
70
+ if (isOrgMode.value) {
71
+ selectedOrgGroups.value = groups;
72
+ }
73
+ else {
74
+ selectedUserGroups.value = groups;
75
+ }
76
+ }
77
+ else {
78
+ selectedOrgGroups.value = [];
79
+ selectedUserGroups.value = [];
80
+ }
81
+ setOpen(true);
82
+ }
83
+
84
+ function onClearAll() {
85
+ if (isOrgMode.value) {
86
+ clearOrgGroups();
87
+ }
88
+ else {
89
+ clearUserGroups();
90
+ }
91
+ }
92
+
93
+ function clearOrgGroups() {
94
+ selectedOrgGroups.value = [];
95
+ }
96
+
97
+ function clearUserGroups() {
98
+ selectedUserGroups.value = [];
99
+ }
100
+
101
+ function onRemoveGroup(value: string) {
102
+ const selectedKeys = isOrgMode.value ? selectedOrgGroups : selectedUserGroups;
103
+ const index = selectedKeys.value.findIndex(item => item === value);
104
+ if (index !== -1) {
105
+ selectedKeys.value.splice(index, 1);
106
+ }
107
+ }
108
+
109
+ function notifySelect() {
110
+ emit('select', selectedData.value);
111
+ setOpen(false);
112
+ }
113
+
114
+ defineExpose({
115
+ open: onOpen,
116
+ });
117
+ </script>
118
+
119
+ <template>
120
+ <a-modal
121
+ v-model:open="open"
122
+ class="group-modal"
123
+ title="编辑群组"
124
+ :mask-closable="false"
125
+ :width="750"
126
+ >
127
+ <div class="h-340px border-1px border-solid flex flex-row border_color">
128
+ <div class="w-360px">
129
+ <a-tabs v-model:active-key="currentTab" class="h-full overflow-hidden">
130
+ <a-tab-pane key="OrgGroup" tab="组织群组">
131
+ <a-checkbox-group v-model:value="selectedOrgGroups" :options="orgGroupList" />
132
+ </a-tab-pane>
133
+ <a-tab-pane key="UserGroup" tab="用户群组" force-render>
134
+ <a-checkbox-group v-model:value="selectedUserGroups" :options="userGroupList" />
135
+ </a-tab-pane>
136
+ </a-tabs>
137
+ </div>
138
+
139
+ <div class="flex-1 flex flex-col border-solid border-0px border-l-1px border_color">
140
+ <div class="w-full h-38px bg-[rgb(245,245,245)] flex px-15px items-center justify-between text-[#1D2129] dark:bg-[#000] dark:text-[#F2F3F5]">
141
+ <div class="">
142
+ 已选群组
143
+ </div>
144
+ <div class="cursor-pointer text-[#165DFF]" @click="onClearAll">
145
+ 清空
146
+ </div>
147
+ </div>
148
+ <div class="flex-1 p-10px overflow-auto">
149
+ <div v-for="item in selectedData" :key="item.value" class="inline-block mb-6px max-w-300px">
150
+ <a-tooltip v-if="item.name && item.name.length > 20" :title="item.name">
151
+ <a-tag class="custom_tag bg-[#e8f3ff] dark:bg-[#141414]" closable @close="onRemoveGroup(item.value)">
152
+ {{ item.label }}
153
+ </a-tag>
154
+ </a-tooltip>
155
+ <a-tag
156
+ v-else
157
+ class="custom_tag bg-[#e8f3ff] dark:bg-[#141414]"
158
+ closable
159
+ @close="onRemoveGroup(item.value)"
160
+ >
161
+ {{ item.label }}
162
+ </a-tag>
163
+ </div>
164
+ </div>
165
+ </div>
166
+ </div>
167
+
168
+ <template #footer>
169
+ <a-button @click="setOpen(false)">
170
+ 取消
171
+ </a-button>
172
+ <a-button type="primary" @click="notifySelect">
173
+ 确定
174
+ </a-button>
175
+ </template>
176
+ </a-modal>
177
+ </template>
178
+
179
+ <style lang="scss">
180
+ .group-modal {
181
+ .ant-tabs-content-holder {
182
+ padding: 0 16px 8px;
183
+ overflow: auto;
184
+ }
185
+
186
+ .ant-tabs-nav::before {
187
+ display: none;
188
+ }
189
+
190
+ .ant-tabs-nav-wrap {
191
+ height: 38px;
192
+ background: rgb(245 245 245);
193
+ }
194
+
195
+ .ant-tabs-tab {
196
+ padding: 0 12px;
197
+ margin: 0;
198
+
199
+ & + .ant-tabs-tab {
200
+ margin-left: 0 !important;
201
+ }
202
+ }
203
+
204
+ .ant-tabs-tab-active {
205
+ background: white;
206
+ }
207
+
208
+ .ant-checkbox-group {
209
+ display: block;
210
+ }
211
+
212
+ .ant-checkbox-wrapper {
213
+ display: flex;
214
+ margin-bottom: 8px;
215
+ }
216
+
217
+ .ant-tabs-ink-bar {
218
+ display: none;
219
+ }
220
+ }
221
+
222
+ .dark .group-modal {
223
+ .ant-tabs-nav-wrap {
224
+ color: #f2f3f5;
225
+ background: #000;
226
+ }
227
+
228
+ .ant-tabs-tab-active {
229
+ background: rgb(20 20 20);
230
+ }
231
+ }
232
+ </style>
233
+
234
+ <style lang='scss' scoped>
235
+ .group-modal {
236
+ :deep(.ant-modal-content) {
237
+ padding: 0;
238
+ border-radius: 0;
239
+ }
240
+
241
+ :deep(.ant-modal-header) {
242
+ padding: 12px 16px;
243
+ margin-bottom: 0;
244
+ border-bottom: 1px solid #e5e6eb;
245
+ }
246
+
247
+ :deep(.ant-modal-title) {
248
+ font-size: 16px;
249
+ font-weight: 500;
250
+ color: #1d2129;
251
+ }
252
+
253
+ :deep(.ant-modal-body) {
254
+ padding: 16px;
255
+ }
256
+
257
+ :deep(.ant-modal-footer) {
258
+ padding: 16px;
259
+ border-top: 1px solid #e5e6eb;
260
+
261
+ .ant-btn {
262
+ border-radius: 2px;
263
+ }
264
+ }
265
+ }
266
+
267
+ :deep(.ant-tree-checkbox) {
268
+ margin-block-start: 0;
269
+ margin-inline-end: 2px;
270
+ }
271
+
272
+ :deep(.ant-tree-checkbox + span .ant-tree-iconEle) {
273
+ margin-right: 4px;
274
+ }
275
+
276
+ .custom_tag {
277
+ padding: 3px 8px;
278
+ border-width: 0;
279
+ border-radius: 2px;
280
+
281
+ :deep(.ant-tag-close-icon) {
282
+ color: rgb(22 93 255 / 60%);
283
+
284
+ &:hover {
285
+ color: #165dff;
286
+ }
287
+ }
288
+ }
289
+
290
+ .border_color {
291
+ border-color: #e5e6eb;
292
+ }
293
+
294
+ [data-theme="dark"] {
295
+ .border_color {
296
+ border-color: rgb(253 253 253 / 12%);
297
+ }
298
+ }
299
+
300
+ .border_c {
301
+ border: 1px dashed #ccc;
302
+ border-radius: 10px;
303
+ }
304
+
305
+ :deep(.ant-dropdown-link) {
306
+ padding: 4px 6px;
307
+ font-size: 12px;
308
+ border-radius: 2px;
309
+ transform: scale(0.7);
310
+ }
311
+ </style>
@@ -0,0 +1,91 @@
1
+ <script setup lang="ts">
2
+ import type { EventDataNode, TreeProps } from 'ant-design-vue/es/tree';
3
+ import { getRbacOrgOrgListByParentId } from '@/api/modules/rbac';
4
+ import { useToggle } from '@vueuse/core';
5
+
6
+ defineOptions({
7
+ name: 'OrgTree',
8
+ });
9
+
10
+ const props = defineProps<{
11
+ auth?: string
12
+ }>();
13
+
14
+ type TreeNode = API.PubOrg & { isLeaf?: boolean, children?: TreeNode[] };
15
+
16
+ const treeData = ref<TreeProps['treeData'] & TreeNode[]>([]);
17
+ const [loading, setLoading] = useToggle(false);
18
+
19
+ function onLoadData(treeNode?: EventDataNode) {
20
+ return new Promise<void>((resolve, reject) => {
21
+ if (treeNode?.dataRef?.children) {
22
+ resolve();
23
+ return;
24
+ }
25
+
26
+ setLoading(true);
27
+ getRbacOrgOrgListByParentId(
28
+ {
29
+ parentId: treeNode?.dataRef?.id, enable: true,
30
+ },
31
+ {
32
+ headers: { 'X-ResourceMark': props.auth },
33
+ })
34
+ .then((res) => {
35
+ if (res.success) {
36
+ const data = res?.data?.map(formatTreeNode) ?? [];
37
+ if (treeNode?.dataRef) {
38
+ treeNode.dataRef.children = data;
39
+ }
40
+ else {
41
+ treeData.value = data;
42
+ }
43
+ }
44
+ treeData.value = [...treeData.value];
45
+ resolve();
46
+ })
47
+ .catch(reject)
48
+ .finally(() => setLoading(false));
49
+ });
50
+ }
51
+
52
+ function formatTreeNode(data: API.PubOrg) {
53
+ return {
54
+ key: data.id!,
55
+ isLeaf: data.leaf,
56
+ ...data,
57
+ };
58
+ }
59
+
60
+ onMounted(() => {
61
+ onLoadData();
62
+ });
63
+ </script>
64
+
65
+ <template>
66
+ <a-card :body-style="{ padding: '16px' }" class="w-full h-full overflow-y-auto overflow-x-hidden">
67
+ <a-spin :spinning="loading">
68
+ <a-empty v-if="treeData.length === 0" />
69
+ <a-tree
70
+ v-else
71
+ v-bind="$attrs"
72
+ block-node
73
+ :load-data="onLoadData"
74
+ :tree-data="treeData"
75
+ :field-names="{ children: 'children', title: 'name', key: 'id' }"
76
+ >
77
+ <template #title="node">
78
+ <div class="flex w-full items-center overflow-hidden">
79
+ <span :title="node.name" class="truncate">{{ node.name }}</span>
80
+ </div>
81
+ </template>
82
+ </a-tree>
83
+ </a-spin>
84
+ </a-card>
85
+ </template>
86
+
87
+ <style scoped>
88
+ :deep(.ant-tree .ant-tree-node-content-wrapper) {
89
+ overflow: hidden;
90
+ }
91
+ </style>
@@ -0,0 +1,135 @@
1
+ <script setup lang="ts">
2
+ import { ContentSelector, OrgProvider } from '@pubinfo/headlessui';
3
+ import { useToggle } from '@vueuse/core';
4
+ import { Form, Modal } from 'ant-design-vue';
5
+ import { orgFieldNames, useOrgAPIs } from './provider';
6
+ import '@pubinfo/headlessui/style.css';
7
+
8
+ export interface ModelValue extends Record<string, any> {
9
+ orgId?: string
10
+ orgName?: string
11
+ }
12
+
13
+ export interface OrgSelectorProps {
14
+ /** 标题 */
15
+ title?: string
16
+ /** 多选 */
17
+ multiple?: boolean
18
+ /** 数据权限 */
19
+ auth?: string
20
+ /** 替换接口 */
21
+ apis?: ReturnType<typeof useOrgAPIs>
22
+ /** Tab页 */
23
+ tabs?: Array<{ value: string, label: string }>
24
+ /** 禁用数据 */
25
+ disabledData?: (node: any) => boolean
26
+ /** 过滤组织数据 */
27
+ filter?: (node: any) => boolean
28
+ /** 提交 */
29
+ onSubmit?: (selected: ModelValue[]) => void
30
+ }
31
+
32
+ defineOptions({
33
+ name: 'OrgSelector',
34
+ });
35
+
36
+ const props = withDefaults(
37
+ defineProps<OrgSelectorProps>(),
38
+ {
39
+ title: '选择组织',
40
+ multiple: false,
41
+ apis: () => ({}),
42
+ tabs: () => [
43
+ { value: 'RecentlyUsed', label: '最近常用' },
44
+ { value: 'Favorites', label: '收藏' },
45
+ { value: 'OrgTree', label: '全部' },
46
+ { value: 'Groups', label: '群组' },
47
+ ],
48
+ disabledData: () => false,
49
+ filter: () => true,
50
+ },
51
+ );
52
+
53
+ const attrs = useAttrs();
54
+
55
+ const orgAPIs = {
56
+ ...useOrgAPIs({ auth: props.auth, filter: props.filter }),
57
+ ...props.apis,
58
+ };
59
+
60
+ // 双向绑定
61
+ const open = defineModel<boolean>('open');
62
+ const modelValue = defineModel<ModelValue[]>({ default: [] });
63
+
64
+ const selectValue = ref<ModelValue[]>([]);
65
+ const setOpen = useToggle(open);
66
+ const { onFieldChange } = Form.useInjectFormItemContext();
67
+
68
+ function onOpen() {
69
+ setOpen(true);
70
+ }
71
+ watch(open, async (_open) => {
72
+ if (!_open) {
73
+ return;
74
+ }
75
+
76
+ if (!modelValue.value.length) {
77
+ selectValue.value = [];
78
+ return;
79
+ }
80
+
81
+ try {
82
+ // 回显选中项
83
+ selectValue.value = await orgAPIs?.getSelectedData?.(modelValue.value) ?? modelValue.value;
84
+ }
85
+ catch {
86
+ selectValue.value = modelValue.value;
87
+ }
88
+ }, { immediate: true });
89
+
90
+ function onSubmit() {
91
+ modelValue.value = selectValue.value;
92
+ props.onSubmit?.(selectValue.value);
93
+ onFieldChange();
94
+ setOpen(false);
95
+
96
+ // 添加最近常用
97
+ orgAPIs?.addRecentlyUsed?.(selectValue.value);
98
+ }
99
+
100
+ defineExpose({
101
+ open: onOpen,
102
+ });
103
+ </script>
104
+
105
+ <template>
106
+ <div>
107
+ <span v-if="$slots.trigger" @click="onOpen()">
108
+ <slot name="trigger" />
109
+ </span>
110
+
111
+ <Modal
112
+ v-bind="attrs"
113
+ v-model:open="open"
114
+ :title="title"
115
+ :width="760"
116
+ :z-index="1001"
117
+ ok-text="确认"
118
+ cancel-text="取消"
119
+ @ok="onSubmit()"
120
+ >
121
+ <OrgProvider
122
+ :apis="orgAPIs"
123
+ :field-names="orgFieldNames"
124
+ >
125
+ <ContentSelector
126
+ v-model="selectValue"
127
+ default-tab="OrgTree"
128
+ :tabs="tabs"
129
+ :multiple="multiple"
130
+ :disabled-data="disabledData"
131
+ />
132
+ </OrgProvider>
133
+ </Modal>
134
+ </div>
135
+ </template>
@@ -0,0 +1,164 @@
1
+ <script setup lang="ts">
2
+ import { ContentSelector, OrgProvider, UserProvider } from '@pubinfo/headlessui';
3
+ import { useToggle } from '@vueuse/core';
4
+ import { Form, Modal } from 'ant-design-vue';
5
+ import { omit, pick } from 'lodash-es';
6
+ import { orgFieldNames, resolveId, useOrgAPIs, userFieldNames, useUserAPIs } from './provider';
7
+ import '@pubinfo/headlessui/style.css';
8
+
9
+ export interface ModelValue extends Record<string, any> {
10
+ orgId?: string
11
+ userId?: string
12
+ userName?: string
13
+ }
14
+
15
+ interface SelectValue extends Record<string, any> {
16
+ /** userFieldNames.value */
17
+ orgUserId?: string
18
+ userName?: string
19
+ }
20
+
21
+ export interface UserSelectorProps {
22
+ /** 标题 */
23
+ title?: string
24
+ /** 多选 */
25
+ multiple?: boolean
26
+ /** 数据权限 */
27
+ auth?: string
28
+ /** 替换接口 */
29
+ apis?: ReturnType<typeof useUserAPIs> & Pick<ReturnType<typeof useOrgAPIs>, 'orgTree' | 'orgList'>
30
+ /** Tab页 */
31
+ tabs?: Array<{ value: string, label: string }>
32
+ /** 禁用数据 */
33
+ disabledData?: (node: any) => boolean
34
+ /** 过滤组织数据 */
35
+ filterOrg?: (node: any) => boolean
36
+ /** 过滤用户数据 */
37
+ filterUser?: (node: any) => boolean
38
+ /** 提交 */
39
+ onSubmit?: (selected: ModelValue[]) => void
40
+ }
41
+
42
+ defineOptions({
43
+ name: 'UserSelector',
44
+ });
45
+
46
+ const props = withDefaults(
47
+ defineProps<UserSelectorProps>(),
48
+ {
49
+ title: '选择用户',
50
+ multiple: false,
51
+ apis: () => ({}),
52
+ tabs: () => [
53
+ { value: 'RecentlyUsed', label: '最近常用' },
54
+ { value: 'Favorites', label: '收藏' },
55
+ { value: 'TreeUserList', label: '全部' },
56
+ { value: 'Groups', label: '群组' },
57
+ ],
58
+ disabledData: () => false,
59
+ filterOrg: () => true,
60
+ filterUser: () => true,
61
+ },
62
+ );
63
+
64
+ const attrs = useAttrs();
65
+
66
+ const orgAPIs = {
67
+ ...useOrgAPIs({ auth: props.auth, filter: props.filterOrg }),
68
+ ...pick(props.apis, ['orgTree', 'orgList']),
69
+ };
70
+ const userAPIs = {
71
+ ...useUserAPIs({ auth: props.auth, filter: props.filterUser }),
72
+ ...omit(props.apis, ['orgTree', 'orgList']),
73
+ };
74
+
75
+ // 双向绑定
76
+ const open = defineModel<boolean>('open');
77
+ const modelValue = defineModel<ModelValue[]>({ default: [] });
78
+
79
+ const selectValue = ref<SelectValue[]>([]);
80
+ const setOpen = useToggle(open);
81
+ const { onFieldChange } = Form.useInjectFormItemContext();
82
+
83
+ function onOpen() {
84
+ setOpen(true);
85
+ }
86
+ watch(open, async (_open) => {
87
+ if (!_open) {
88
+ return;
89
+ }
90
+
91
+ if (!modelValue.value.length) {
92
+ selectValue.value = [];
93
+ return;
94
+ }
95
+
96
+ try {
97
+ // 回显选中项
98
+ selectValue.value = await userAPIs?.getSelectedData?.(modelValue.value) ?? modelValue.value;
99
+ }
100
+ catch {
101
+ selectValue.value = modelValue.value;
102
+ }
103
+ }, { immediate: true });
104
+
105
+ function onSubmit() {
106
+ const finalValue = selectValue.value?.map((item) => {
107
+ const ids = resolveId(item[userFieldNames.value]);
108
+ return {
109
+ ...item,
110
+ orgId: ids.orgId,
111
+ userId: ids.userId,
112
+ };
113
+ });
114
+
115
+ modelValue.value = finalValue;
116
+ props.onSubmit?.(finalValue);
117
+ onFieldChange();
118
+ setOpen(false);
119
+
120
+ // 添加最近常用
121
+ userAPIs?.addRecentlyUsed?.(finalValue);
122
+ }
123
+
124
+ defineExpose({
125
+ open: onOpen,
126
+ });
127
+ </script>
128
+
129
+ <template>
130
+ <div>
131
+ <span v-if="$slots.trigger" @click="onOpen()">
132
+ <slot name="trigger" />
133
+ </span>
134
+
135
+ <Modal
136
+ v-bind="attrs"
137
+ v-model:open="open"
138
+ :title="title"
139
+ :width="760"
140
+ :z-index="1001"
141
+ ok-text="确认"
142
+ cancel-text="取消"
143
+ @ok="onSubmit()"
144
+ >
145
+ <OrgProvider
146
+ :apis="orgAPIs"
147
+ :field-names="orgFieldNames"
148
+ >
149
+ <UserProvider
150
+ :apis="userAPIs"
151
+ :field-names="userFieldNames"
152
+ >
153
+ <ContentSelector
154
+ v-model="selectValue"
155
+ default-tab="TreeUserList"
156
+ :tabs="tabs"
157
+ :multiple="multiple"
158
+ :disabled-data="disabledData"
159
+ />
160
+ </UserProvider>
161
+ </OrgProvider>
162
+ </Modal>
163
+ </div>
164
+ </template>