@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,190 @@
1
+ <script setup lang="tsx">
2
+ import type { ProColumns } from '@pubinfo/pro-components';
3
+ import type { dataPermissionType } from './enum';
4
+ import { deleteRbacPubDataPermissionsDelete, postRbacPubDataPermissionsPageQuery } from '@/api/modules/rbac';
5
+ import { ProTable } from '@pubinfo/pro-components';
6
+ import { useToggle } from '@vueuse/core';
7
+ import { message, Modal } from 'ant-design-vue';
8
+ import CreateAndEditDataPermission from './components/createAndEditDataPermission.vue';
9
+ import { ACTION, dataPermissionOptionsAll, dataPermissionTypeLabel } from './enum';
10
+
11
+ defineOptions({
12
+ name: 'DataPermission',
13
+ });
14
+
15
+ const tableRef = ref();
16
+ const drawerRef = ref();
17
+ const columns: ProColumns<API.shujuquanxianshituduixiang> = [
18
+ {
19
+ valueType: 'a-input',
20
+ title: '数据权限名称',
21
+ dataIndex: 'name',
22
+ fieldProps: {
23
+ placeholder: '请输入',
24
+ allowClear: true,
25
+ },
26
+ },
27
+ {
28
+ valueType: 'a-select',
29
+ title: '数据权限规则',
30
+ dataIndex: 'type',
31
+ fieldProps: {
32
+ placeholder: '请选择',
33
+ allowClear: true,
34
+ options: dataPermissionOptionsAll,
35
+ },
36
+ ellipsis: true,
37
+ },
38
+ {
39
+ hideInSearch: true,
40
+ title: '创建时间',
41
+ dataIndex: 'createTime',
42
+ ellipsis: true,
43
+ },
44
+ {
45
+ hideInSearch: true,
46
+ title: '更新时间',
47
+ dataIndex: 'updateTime',
48
+ ellipsis: true,
49
+ },
50
+ {
51
+ hideInSearch: true,
52
+ title: '操作',
53
+ dataIndex: 'action',
54
+ width: 200,
55
+ fixed: 'right',
56
+ },
57
+ ];
58
+
59
+ async function request(params: any) {
60
+ const { current, pageSize, type, name } = params;
61
+ const ps: any = {
62
+ pageSize,
63
+ currentPage: current,
64
+ doSearchTotal: true,
65
+ type,
66
+ name,
67
+ };
68
+
69
+ const res = await postRbacPubDataPermissionsPageQuery(ps);
70
+
71
+ return {
72
+ success: res.success,
73
+ data: res.data?.records ?? [],
74
+ total: res.data?.total ?? 0,
75
+ };
76
+ }
77
+
78
+ function getListData() {
79
+ tableRef.value.reload();
80
+ }
81
+
82
+ const [loading, setLoading] = useToggle(false);
83
+ function onAction(key: string, record?: API.shujuquanxianshituduixiang): void {
84
+ if (loading.value) {
85
+ return;
86
+ }
87
+ switch (key) {
88
+ case ACTION.ADD:
89
+ drawerRef.value.open(key);
90
+ break;
91
+ case ACTION.EDIT:
92
+ drawerRef.value.open(key, record);
93
+ break;
94
+ case ACTION.REMOVE:
95
+ Modal.confirm({
96
+ title: '删除',
97
+ content: '确定要删除该权限吗?',
98
+ async onOk() {
99
+ setLoading(true);
100
+ deleteRbacPubDataPermissionsDelete({ id: record?.id as string })
101
+ .then((res: API.ResponseDataVoid) => {
102
+ if (res.success) {
103
+ message.success('删除成功');
104
+ getListData();
105
+ }
106
+ })
107
+ .finally(() => setLoading(false));
108
+ },
109
+ });
110
+ break;
111
+ }
112
+ }
113
+ </script>
114
+
115
+ <template>
116
+ <div
117
+ w-full
118
+ h-full
119
+ py-10px
120
+ px-10px
121
+ flex
122
+ flex-col
123
+ class="page-data-permission"
124
+ >
125
+ <ProTable
126
+ ref="tableRef"
127
+ row-key="id"
128
+ :request="request"
129
+ :columns="columns"
130
+ auto-height
131
+ :scroll="{ x: 1000 }"
132
+ >
133
+ <template #toolbar>
134
+ <a-button
135
+ v-auth="'data_permission_create'"
136
+ type="primary"
137
+ @click="onAction(ACTION.ADD)"
138
+ >
139
+ <PlusCircleOutlined />
140
+ {{ ACTION.ADD }}
141
+ </a-button>
142
+ </template>
143
+ <template #bodyCell="{ column, record }">
144
+ <template v-if="column.dataIndex === 'type'">
145
+ <span>{{ dataPermissionTypeLabel[record.type as dataPermissionType] }}</span>
146
+ </template>
147
+
148
+ <template v-if="column.dataIndex === 'action'">
149
+ <a-space>
150
+ <a
151
+ v-auth="'data_permission_edit'"
152
+ class="flex items-center hover:opacity-80"
153
+ @click="onAction(ACTION.EDIT, record)"
154
+ >
155
+ <PubinfoIcon name="edit" class="text-base" />
156
+ <span class="ml-4px">{{ ACTION.EDIT }}</span>
157
+ </a>
158
+ <a
159
+ v-auth="'data_permission_delete'"
160
+ flex
161
+ items-center
162
+ text-red-500
163
+ hover:cursor-pointer
164
+ hover:text-red-500
165
+ hover:opacity-80
166
+ @click="onAction(ACTION.REMOVE, record)"
167
+ >
168
+ <PubinfoIcon name="remove" class="text-base" />
169
+ <span class="ml-4px">{{ ACTION.REMOVE }}</span>
170
+ </a>
171
+ </a-space>
172
+ </template>
173
+ </template>
174
+ </ProTable>
175
+ <CreateAndEditDataPermission ref="drawerRef" @submit="getListData" />
176
+ </div>
177
+ </template>
178
+
179
+ <style lang="scss">
180
+ .page-data-permission {
181
+ .ant-card.pro-table {
182
+ border-top-left-radius: 0;
183
+ border-top-right-radius: 0;
184
+ }
185
+
186
+ .ant-form-item-label {
187
+ width: 102px !important;
188
+ }
189
+ }
190
+ </style>
@@ -0,0 +1,108 @@
1
+ <script setup lang="ts">
2
+ import type { Rule } from 'ant-design-vue/es/form';
3
+ import type { FormExpose } from 'ant-design-vue/es/form/Form';
4
+ import { postDictTypeSave } from '@/api/modules/configData';
5
+ import { useToggle } from '@vueuse/core';
6
+ import { message } from 'ant-design-vue';
7
+ import { ACTION } from '../enum';
8
+
9
+ defineOptions({
10
+ name: 'DrawerDictionary',
11
+ });
12
+
13
+ const emit = defineEmits(['submit']);
14
+
15
+ const rules: Record<string, Rule[]> = {
16
+ name: [{ required: true, message: '请输入类型名称', trigger: 'blur' }],
17
+ code: [{ required: true, message: '请输入类型编码', trigger: 'blur' }],
18
+ };
19
+ const state = reactive({
20
+ title: '',
21
+ });
22
+ const [open, setOpen] = useToggle(false);
23
+ const formRef = ref<FormExpose>();
24
+ const form = ref<Partial<API.DictTypeSaveDto>>({});
25
+
26
+ async function onOpen(key: ACTION, record?: API.DictTypeVo) {
27
+ setOpen(true);
28
+ state.title = key;
29
+ if (key === ACTION.EDIT) {
30
+ form.value = { ...record ?? {} };
31
+ }
32
+ else {
33
+ form.value = {};
34
+ }
35
+ }
36
+ const [loading, setLoading] = useToggle(false);
37
+
38
+ function onSubmit() {
39
+ formRef.value?.validate().then(() => {
40
+ setLoading(true);
41
+ const params: any = { ...form.value };
42
+ postDictTypeSave(params)
43
+ .then((res: API.ResponseDataString) => {
44
+ if (res.success) {
45
+ message.success(`${state.title}成功!`);
46
+ setOpen(false);
47
+ emit('submit');
48
+ }
49
+ })
50
+ .finally(() => setLoading(false));
51
+ });
52
+ }
53
+
54
+ function close() {
55
+ setOpen(false);
56
+ }
57
+
58
+ defineExpose({
59
+ open: onOpen,
60
+ });
61
+ </script>
62
+
63
+ <template>
64
+ <a-drawer
65
+ v-model:open="open"
66
+ :title="`${state.title}类型`"
67
+ placement="right"
68
+ :width="520"
69
+ destroy-on-close
70
+ :footer-style="{ textAlign: 'right' }"
71
+ @close="close"
72
+ >
73
+ <a-form
74
+ ref="formRef"
75
+ :model="form"
76
+ :rules="rules"
77
+ :label-col="{ span: 4 }"
78
+ >
79
+ <a-form-item label="类型名称" name="name">
80
+ <a-input v-model:value="form.name" :maxlength="30" />
81
+ </a-form-item>
82
+ <a-form-item label="类型编码" name="code">
83
+ <a-input v-model:value="form.code" :maxlength="30" :disabled="state.title === ACTION.EDIT" />
84
+ </a-form-item>
85
+ <a-form-item label="描述" name="description">
86
+ <a-textarea
87
+ v-model:value="form.description"
88
+ :rows="3"
89
+ show-count
90
+ :maxlength="200"
91
+ />
92
+ </a-form-item>
93
+ <a-form-item label="排序" name="sort">
94
+ <a-input-number v-model:value="form.sort" />
95
+ </a-form-item>
96
+ </a-form>
97
+ <template #footer>
98
+ <a-space>
99
+ <a-button @click="close">
100
+ 取消
101
+ </a-button>
102
+ <a-button type="primary" :loading="loading" @click="onSubmit()">
103
+ 提交
104
+ </a-button>
105
+ </a-space>
106
+ </template>
107
+ </a-drawer>
108
+ </template>
@@ -0,0 +1,115 @@
1
+ <script setup lang="ts">
2
+ import type { Rule } from 'ant-design-vue/es/form';
3
+ import type { FormExpose } from 'ant-design-vue/es/form/Form';
4
+ import { postDictItemSave } from '@/api/modules/configData';
5
+ import { useToggle } from '@vueuse/core';
6
+ import { message } from 'ant-design-vue';
7
+ import { ACTION } from '../enum';
8
+
9
+ defineOptions({
10
+ name: 'DrawerDictionaryItem',
11
+ });
12
+
13
+ const emit = defineEmits(['submit']);
14
+
15
+ const rules: Record<string, Rule[]> = {
16
+ dictLabel: [{ required: true, message: '请输入字典项名称', trigger: 'blur' }],
17
+ dictValue: [{ required: true, message: '请输入字典项值', trigger: 'blur' }],
18
+ };
19
+ const state = reactive({
20
+ title: '',
21
+ code: '',
22
+ });
23
+ const [open, setOpen] = useToggle(false);
24
+ const formRef = ref<FormExpose>();
25
+ const form = ref<Partial<API.DictItemSaveDto>>({});
26
+
27
+ async function onOpen(key: ACTION, code: string, record?: API.DictItemVo) {
28
+ setOpen(true);
29
+ state.title = key;
30
+ state.code = code;
31
+ if (key === ACTION.EDIT) {
32
+ form.value = record ?? {};
33
+ }
34
+ else {
35
+ form.value = {};
36
+ form.value.enable = true;
37
+ form.value.code = code;
38
+ }
39
+ }
40
+ const [loading, setLoading] = useToggle(false);
41
+
42
+ function onSubmit() {
43
+ formRef.value?.validate().then(() => {
44
+ setLoading(true);
45
+ const params: any = { ...form.value };
46
+ postDictItemSave(params)
47
+ .then((res: API.ResponseDataString) => {
48
+ if (res.success) {
49
+ message.success(`${state.title}成功!`);
50
+ setOpen(false);
51
+ emit('submit');
52
+ }
53
+ })
54
+ .finally(() => setLoading(false));
55
+ });
56
+ }
57
+
58
+ function close() {
59
+ setOpen(false);
60
+ }
61
+
62
+ defineExpose({
63
+ open: onOpen,
64
+ });
65
+ </script>
66
+
67
+ <template>
68
+ <a-drawer
69
+ v-model:open="open"
70
+ :title="`${state.title}字典数据`"
71
+ placement="right"
72
+ :width="520"
73
+ destroy-on-close
74
+ :footer-style="{ textAlign: 'right' }"
75
+ @close="close"
76
+ >
77
+ <a-form
78
+ ref="formRef"
79
+ :model="form"
80
+ :rules="rules"
81
+ :label-col="{ span: 5 }"
82
+ >
83
+ <a-form-item label="字典项名称" name="dictLabel">
84
+ <a-input v-model:value="form.dictLabel" :maxlength="100" />
85
+ </a-form-item>
86
+ <a-form-item label="字典项值" name="dictValue">
87
+ <a-input v-model:value="form.dictValue" :maxlength="100" />
88
+ </a-form-item>
89
+ <a-form-item label="描述" name="description">
90
+ <a-textarea
91
+ v-model:value="form.description"
92
+ :rows="3"
93
+ show-count
94
+ :maxlength="200"
95
+ />
96
+ </a-form-item>
97
+ <a-form-item label="排序" name="sort">
98
+ <a-input-number v-model:value="form.sort" />
99
+ </a-form-item>
100
+ <a-form-item label="是否启动" name="enable">
101
+ <a-switch v-model:checked="form.enable" />
102
+ </a-form-item>
103
+ </a-form>
104
+ <template #footer>
105
+ <a-space>
106
+ <a-button @click="close">
107
+ 取消
108
+ </a-button>
109
+ <a-button type="primary" :loading="loading" @click="onSubmit()">
110
+ 提交
111
+ </a-button>
112
+ </a-space>
113
+ </template>
114
+ </a-drawer>
115
+ </template>
@@ -0,0 +1,8 @@
1
+ export enum ACTION {
2
+ ADD = '新增',
3
+ ADDNEXT = '字典数据',
4
+ /** 编辑 */
5
+ EDIT = '修改',
6
+ /** 删除 */
7
+ REMOVE = '删除',
8
+ }
@@ -0,0 +1,194 @@
1
+ <script setup lang="tsx">
2
+ import type { ProColumns } from '@pubinfo/pro-components';
3
+ import { deleteDictTypeDeleteById, postDictTypePage } from '@/api/modules/configData';
4
+ import { ProTable } from '@pubinfo/pro-components';
5
+ import { message, Modal } from 'ant-design-vue';
6
+ import DrawerDictionary from './components/drawerDictionary.vue';
7
+ import { ACTION } from './enum';
8
+
9
+ defineOptions({
10
+ name: 'Dictionary',
11
+ });
12
+
13
+ const { auth } = useAuth();
14
+ const tableRef = ref();
15
+ const drawerDictionaryRef = ref();
16
+ const columns: ProColumns<API.DictTypeVo> = [
17
+ {
18
+ valueType: 'a-input',
19
+ width: 50,
20
+ hideInTable: true,
21
+ title: '名称或编码',
22
+ dataIndex: 'searchName',
23
+ fieldProps: {
24
+ placeholder: '请输入名称或者编码',
25
+ allowClear: true,
26
+ },
27
+ },
28
+ {
29
+ hideInSearch: true,
30
+ minWidth: 100,
31
+ title: '类型名称',
32
+ dataIndex: 'name',
33
+ ellipsis: true,
34
+ },
35
+ {
36
+ hideInSearch: true,
37
+ minWidth: 80,
38
+ title: '类型编码',
39
+ dataIndex: 'code',
40
+ ellipsis: true,
41
+ },
42
+ {
43
+ hideInSearch: true,
44
+ minWidth: 100,
45
+ title: '描述',
46
+ dataIndex: 'description',
47
+ ellipsis: true,
48
+ },
49
+ {
50
+ hideInSearch: true,
51
+ width: 80,
52
+ minWidth: 60,
53
+ title: '排序',
54
+ dataIndex: 'sort',
55
+ },
56
+ {
57
+ hideInSearch: true,
58
+ title: '操作',
59
+ dataIndex: 'action',
60
+ width: 240,
61
+ fixed: 'right',
62
+ hideInTable() {
63
+ return !auth([
64
+ 'dictionary_data',
65
+ 'dictionary_edit',
66
+ 'dictionary_remove',
67
+ ]);
68
+ },
69
+ },
70
+ ];
71
+
72
+ async function request(params: any) {
73
+ const { current, pageSize, searchName } = params;
74
+ const res = await postDictTypePage({
75
+ currentPage: current,
76
+ pageSize,
77
+ name: searchName,
78
+ doSearchTotal: true,
79
+ });
80
+ return {
81
+ success: res.success,
82
+ data: res.data?.records ?? [],
83
+ total: res.data?.total ?? 0,
84
+ };
85
+ }
86
+
87
+ const router = useRouter();
88
+
89
+ function onAction(key: string, record?: API.DictTypeVo): void {
90
+ switch (key) {
91
+ case ACTION.ADD:
92
+ drawerDictionaryRef.value.open(key);
93
+ break;
94
+ case ACTION.EDIT:
95
+ drawerDictionaryRef.value.open(key, record);
96
+ break;
97
+ case ACTION.REMOVE:
98
+ Modal.confirm({
99
+ title: '删除',
100
+ content: '确定要删除该类型吗?',
101
+ onOk() {
102
+ deleteDictTypeDeleteById({ id: record?.id as string })
103
+ .then((res: API.ResponseDataVoid) => {
104
+ if (res.success) {
105
+ message.success('删除成功');
106
+ getDictionaryData();
107
+ }
108
+ });
109
+ },
110
+ });
111
+ break;
112
+ case ACTION.ADDNEXT:
113
+ router.push({
114
+ name: 'DictionaryItem',
115
+ params: {
116
+ id: `${record?.id}`,
117
+ },
118
+ query: {
119
+ code: `${record?.code}`,
120
+ },
121
+ });
122
+ break;
123
+ }
124
+ }
125
+
126
+ function getDictionaryData() {
127
+ tableRef.value.reload();
128
+ }
129
+ </script>
130
+
131
+ <template>
132
+ <div
133
+ py-10px
134
+ px-10px
135
+ w-full
136
+ h-full
137
+ >
138
+ <ProTable
139
+ ref="tableRef"
140
+ row-key="id"
141
+ :request="request"
142
+ :columns="columns"
143
+ auto-height
144
+ :scroll="{ x: 1040 }"
145
+ >
146
+ <template #toolbar>
147
+ <a-button v-auth="'dictionary_add'" type="primary" @click="onAction(ACTION.ADD)">
148
+ <PlusCircleOutlined />
149
+ {{ ACTION.ADD }}
150
+ </a-button>
151
+ </template>
152
+ <template #bodyCell="{ column, record }">
153
+ <template v-if="column.dataIndex === 'code'">
154
+ <div class="flex items-center">
155
+ <PubinfoIcon name="icard" class="text-20px" />
156
+ <span class="ml-4px">{{ record.code }}</span>
157
+ </div>
158
+ </template>
159
+ <template v-if="column.dataIndex === 'action'">
160
+ <a-space>
161
+ <a
162
+ v-auth="'dictionary_data'"
163
+ class="flex items-center"
164
+ @click="onAction(ACTION.ADDNEXT, record)"
165
+ >
166
+ <PubinfoIcon name="zddata" class="text-20px" />
167
+ <span class="ml-4px">{{ ACTION.ADDNEXT }}</span>
168
+ </a>
169
+ <a
170
+ v-auth="'dictionary_edit'"
171
+ class="flex items-center"
172
+ @click="onAction(ACTION.EDIT, record)"
173
+ >
174
+ <PubinfoIcon name="edit" class="text-base" />
175
+ <span class="ml-4px">{{ ACTION.EDIT }}</span>
176
+ </a>
177
+ <a
178
+ v-auth="'dictionary_remove'"
179
+ class="flex items-center text-red-500 hover:cursor-pointer hover:opacity-80"
180
+ @click="onAction(ACTION.REMOVE, record)"
181
+ >
182
+ <PubinfoIcon name="remove" class="text-base" />
183
+ <span class="ml-4px">{{ ACTION.REMOVE }}</span>
184
+ </a>
185
+ </a-space>
186
+ </template>
187
+ </template>
188
+ </ProTable>
189
+ <DrawerDictionary
190
+ ref="drawerDictionaryRef"
191
+ @submit="getDictionaryData()"
192
+ />
193
+ </div>
194
+ </template>