@ximatai/muyun-web-app 0.26.15 → 0.26.16

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 (257) hide show
  1. package/dist/BusinessActivityLogView-DVM_GB5y.js +18 -0
  2. package/dist/BusinessLogListDrawer-BciMLY9z.js +864 -0
  3. package/dist/ConfigurationTranslationView-B0FosDyz.js +197 -0
  4. package/dist/LoginAuditLogView-3tAozKlC.js +18 -0
  5. package/dist/ModuleActionManagementView-CJRNShGg.js +755 -0
  6. package/dist/{ModuleGovernanceView-LkWCtops.js → ModuleGovernanceView-DsqR_Sj7.js} +6733 -6323
  7. package/dist/RequestErrorLogView-C4yH-TSX.js +18 -0
  8. package/dist/RoleDetailWorkspaceView-BpOoGUwS.js +1435 -0
  9. package/dist/RuntimeLogView-CoKKpJ39.js +316 -0
  10. package/dist/WorkflowAdministrationView-DmUV6vWS.js +650 -0
  11. package/dist/WorkflowConfigurationView-pghDbWEh.js +975 -0
  12. package/dist/WorkflowWorkbenchView-BwWxyDen.js +747 -0
  13. package/dist/es-BST-ixpj.js +22621 -0
  14. package/dist/index.css +1 -1
  15. package/dist/index.js +852 -735
  16. package/dist/moduleGovernanceWorkspaceView-DGEV3ZyT.js +667 -0
  17. package/dist/platform-components-Cl5ZZiuU.js +27139 -0
  18. package/dist/{platform-workbench-C-kE-Yqq.js → platform-workbench-CAHoriIf.js} +7677 -7187
  19. package/dist/rolldown-runtime-BAC7EHh5.js +20 -0
  20. package/dist/types/app/ChangeOwnPasswordDialog.vue.d.ts +1 -1
  21. package/dist/types/app/CurrentUserProfileDialog.vue.d.ts +1 -1
  22. package/dist/types/app/ThemeSkinPreferencesDialog.vue.d.ts +3 -0
  23. package/dist/types/app/businessNotificationNavigation.d.ts +4 -0
  24. package/dist/types/app/menuRouteCompiler.d.ts +3 -0
  25. package/dist/types/app/platformMessage.d.ts +3 -6
  26. package/dist/types/app/themeSkinPreference.d.ts +3 -2
  27. package/dist/types/app/workbenchStartup.d.ts +8 -4
  28. package/dist/types/consumer/AppWorkbenchShell.vue.d.ts +1 -1
  29. package/dist/types/consumer/index.d.ts +3 -1
  30. package/dist/types/dynamic-page-runtime/ManagedDetailRelationInlineSurface.vue.d.ts +1 -1
  31. package/dist/types/dynamic-page-runtime/ManagedDetailRelationSurface.vue.d.ts +1 -1
  32. package/dist/types/dynamic-page-runtime/ModulePageBusinessSession.d.ts +46 -1302
  33. package/dist/types/dynamic-page-runtime/ModulePageDetailRelations.vue.d.ts +1 -1
  34. package/dist/types/dynamic-page-runtime/ModulePageHostRuntime.vue.d.ts +409 -1626
  35. package/dist/types/dynamic-page-runtime/ModulePageListRelationExpansion.vue.d.ts +1 -1
  36. package/dist/types/dynamic-page-runtime/ModulePageRecordContent.vue.d.ts +15 -1
  37. package/dist/types/dynamic-page-runtime/ModuleRecordDetailActions.vue.d.ts +1 -1
  38. package/dist/types/dynamic-page-runtime/NavigatorManagementEditor.vue.d.ts +1 -1
  39. package/dist/types/dynamic-page-runtime/NavigatorPanelActions.vue.d.ts +1 -1
  40. package/dist/types/dynamic-page-runtime/TenantScopeExplorer.vue.d.ts +1 -1
  41. package/dist/types/dynamic-page-runtime/composables/useModulePageBootstrap.d.ts +4 -3
  42. package/dist/types/dynamic-page-runtime/composables/useNavigatorRuntime.d.ts +9 -1301
  43. package/dist/types/dynamic-page-runtime/formActionResult.d.ts +2 -1
  44. package/dist/types/dynamic-page-runtime/formValidationCoordinator.d.ts +1 -1
  45. package/dist/types/dynamic-page-runtime/modulePageEnhancements.d.ts +13 -4
  46. package/dist/types/dynamic-page-runtime/modulePageUnsavedState.d.ts +3 -10
  47. package/dist/types/dynamic-page-runtime/pageActionInvocation.d.ts +2 -1
  48. package/dist/types/dynamic-page-runtime/pageActionPlacement.d.ts +2 -1
  49. package/dist/types/dynamic-page-runtime/pageNavigatorItemModel.d.ts +2 -1
  50. package/dist/types/dynamic-page-runtime/recordCreationReadiness.d.ts +2 -1
  51. package/dist/types/dynamic-page-runtime/recordDisplayProjection.d.ts +7 -3
  52. package/dist/types/dynamic-page-runtime/recordFormAssistantCapabilities.d.ts +5 -4
  53. package/dist/types/dynamic-page-runtime/recordFormDraftAccess.d.ts +3 -0
  54. package/dist/types/dynamic-page-runtime/recordMutationPayload.d.ts +1 -1
  55. package/dist/types/dynamic-page-runtime/recordReferenceDisplay.d.ts +1 -1
  56. package/dist/types/dynamic-page-runtime/recordSaveRecovery.d.ts +2 -1
  57. package/dist/types/dynamic-page-runtime/relationDraftAssistantCapabilities.d.ts +2 -2
  58. package/dist/types/dynamic-page-runtime/useModulePageSession.d.ts +35 -1303
  59. package/dist/types/dynamic-page-runtime/useModuleRecordDataChanges.d.ts +13 -0
  60. package/dist/types/platform-admin-runtime/backendHttp.d.ts +2 -1
  61. package/dist/types/platform-admin-runtime/index.d.ts +3 -1
  62. package/dist/types/platform-admin-runtime/module-menu/moduleMenuClient.d.ts +4 -4
  63. package/dist/types/platform-admin-runtime/module-menu/moduleMenuReceiptStore.d.ts +2 -1
  64. package/dist/types/platform-admin-runtime/module-menu/moduleMenuSession.d.ts +11 -7
  65. package/dist/types/platform-admin-runtime/module-menu/moduleMenuWorkspace.d.ts +16 -7
  66. package/dist/types/platform-admin-runtime/moduleOpenApi.d.ts +4 -3
  67. package/dist/types/platform-admin-runtime/pageRealtime.d.ts +0 -1
  68. package/dist/types/platform-admin-runtime/realtime.d.ts +0 -3
  69. package/dist/types/platform-admin-runtime/role/roleScopeSelectionClient.d.ts +4 -1
  70. package/dist/types/platform-admin-runtime/sessionRecovery.d.ts +3 -1
  71. package/dist/types/platform-admin-runtime/user/useUserSessionRows.d.ts +2 -0
  72. package/dist/types/platform-admin-runtime/user/userOnlineStatusStore.d.ts +1 -5
  73. package/dist/types/platform-components/BusinessNotificationPanel.vue.d.ts +34 -1
  74. package/dist/types/platform-components/CrudRecordListExplorer.vue.d.ts +4 -4
  75. package/dist/types/platform-components/DateTimeText.vue.d.ts +1 -1
  76. package/dist/types/platform-components/DetailRelationListPanel.vue.d.ts +1 -1
  77. package/dist/types/platform-components/DictionaryPicker.vue.d.ts +2 -2
  78. package/dist/types/platform-components/FileSizeText.vue.d.ts +1 -1
  79. package/dist/types/platform-components/FileTransferUploader.vue.d.ts +1 -1
  80. package/dist/types/platform-components/FormulaExpressionEditor.vue.d.ts +7 -7
  81. package/dist/types/platform-components/ModuleActionButton.vue.d.ts +2 -2
  82. package/dist/types/platform-components/QueryCriteriaComposer.vue.d.ts +1 -1
  83. package/dist/types/platform-components/QueryCriteriaGroupEditor.vue.d.ts +1 -1
  84. package/dist/types/platform-components/QueryValueEditor.vue.d.ts +1 -1
  85. package/dist/types/platform-components/RecordActionBar.vue.d.ts +1 -1
  86. package/dist/types/platform-components/RecordDetailDrawer.vue.d.ts +2 -2
  87. package/dist/types/platform-components/RecordDetailFields.vue.d.ts +1 -1
  88. package/dist/types/platform-components/RecordExpandedSubtable.vue.d.ts +2 -2
  89. package/dist/types/platform-components/RecordFileReferenceTransfer.vue.d.ts +1 -1
  90. package/dist/types/platform-components/RecordFormFields.vue.d.ts +2 -2
  91. package/dist/types/platform-components/RecordImageFileReferencePreview.vue.d.ts +1 -1
  92. package/dist/types/platform-components/RecordListExplorer.vue.d.ts +1 -1
  93. package/dist/types/platform-components/RecordModeDrawer.vue.d.ts +5 -5
  94. package/dist/types/platform-components/RecordMultiPicker.vue.d.ts +1 -1
  95. package/dist/types/platform-components/RecordPanelButton.vue.d.ts +1 -1
  96. package/dist/types/platform-components/RecordPermissionDialog.vue.d.ts +1 -1
  97. package/dist/types/platform-components/RecordPicker.vue.d.ts +1 -1
  98. package/dist/types/platform-components/RecordQueryListPanel.vue.d.ts +6 -6
  99. package/dist/types/platform-components/RecordQueryListSurface.vue.d.ts +2 -2
  100. package/dist/types/platform-components/ReferencePicker.vue.d.ts +3 -3
  101. package/dist/types/platform-components/ReferenceRecordDetailBrowser.vue.d.ts +1 -1
  102. package/dist/types/platform-components/ScopedTreePicker.vue.d.ts +1 -1
  103. package/dist/types/platform-components/SingleImageFileReferenceField.vue.d.ts +1 -1
  104. package/dist/types/platform-components/TreeRecordExplorer.vue.d.ts +5 -5
  105. package/dist/types/platform-components/UserPicker.vue.d.ts +2 -2
  106. package/dist/types/platform-components/UserSessionExpandedSubtable.vue.d.ts +1 -1
  107. package/dist/types/platform-components/WorkflowBusinessTaskEditor.vue.d.ts +36 -0
  108. package/dist/types/platform-components/WorkflowDesignProperties.vue.d.ts +40 -0
  109. package/dist/types/platform-components/WorkflowDiagram.vue.d.ts +24 -0
  110. package/dist/types/platform-components/WorkflowParticipantEditor.vue.d.ts +18 -0
  111. package/dist/types/platform-components/WorkflowRecordPanel.vue.d.ts +30 -0
  112. package/dist/types/platform-components/WorkflowTimeline.vue.d.ts +19 -0
  113. package/dist/types/platform-components/crudRecordListModel.d.ts +2 -1
  114. package/dist/types/platform-components/fileTransferUpload.d.ts +10 -0
  115. package/dist/types/platform-components/index.d.ts +8 -2
  116. package/dist/types/platform-components/optionFieldOptions.d.ts +7 -2
  117. package/dist/types/platform-components/platformDateTime.d.ts +2 -0
  118. package/dist/types/platform-components/platformErrorFeedback.d.ts +2 -1
  119. package/dist/types/platform-components/readonlyReferenceDisplay.d.ts +10 -2
  120. package/dist/types/platform-components/recordActionBarModel.d.ts +4 -1
  121. package/dist/types/platform-components/recordDetailFieldModel.d.ts +2 -0
  122. package/dist/types/platform-components/recordFormFieldModel.d.ts +3 -3
  123. package/dist/types/platform-components/recordPickerConstraints.d.ts +4 -1
  124. package/dist/types/platform-components/recordQueryListColumnModel.d.ts +5 -1
  125. package/dist/types/platform-components/recycleBinState.d.ts +3 -2
  126. package/dist/types/platform-components/referencePickerModel.d.ts +9 -1
  127. package/dist/types/platform-components/referencePickerReadError.d.ts +11 -3
  128. package/dist/types/platform-components/referenceRecordDetailBrowser.d.ts +2 -2
  129. package/dist/types/platform-components/softDeletedConflictHandler.d.ts +3 -1
  130. package/dist/types/platform-components/staticCrudManagementState.d.ts +9 -8
  131. package/dist/types/platform-components/treeRecordModel.d.ts +2 -1
  132. package/dist/types/platform-components/userSessionPresentation.d.ts +4 -3
  133. package/dist/types/platform-components/workflowAccountOptions.d.ts +4 -0
  134. package/dist/types/platform-components/workflowDesignEditing.d.ts +11 -0
  135. package/dist/types/platform-components/workflowDiagramModel.d.ts +41 -0
  136. package/dist/types/platform-components/workflowParticipantPolicy.d.ts +11 -0
  137. package/dist/types/platform-components/workflowPresentation.d.ts +11 -0
  138. package/dist/types/platform-workbench/LanguageSelector.vue.d.ts +6 -0
  139. package/dist/types/platform-workbench/Workbench.vue.d.ts +3 -3
  140. package/dist/types/platform-workbench/WorkbenchAssistantPanel.vue.d.ts +1 -1
  141. package/dist/types/platform-workbench/WorkbenchMenu.vue.d.ts +1 -1
  142. package/dist/types/platform-workbench/assistantControlText.d.ts +19 -0
  143. package/dist/types/platform-workbench/configurationCollaboration.d.ts +2 -2
  144. package/dist/types/platform-workbench/constructionDelivery.d.ts +2 -2
  145. package/dist/types/platform-workbench/constructionFields.d.ts +2 -2
  146. package/dist/types/platform-workbench/constructionInitialization.d.ts +2 -2
  147. package/dist/types/platform-workbench/constructionPlanGuard.d.ts +2 -1
  148. package/dist/types/platform-workbench/constructionPlanSession.d.ts +12 -4
  149. package/dist/types/platform-workbench/constructionPresentation.d.ts +6 -0
  150. package/dist/types/platform-workbench/constructionReferenceDiscovery.d.ts +2 -2
  151. package/dist/types/platform-workbench/index.d.ts +2 -1
  152. package/dist/types/platform-workbench/menuNavigation.d.ts +7 -3
  153. package/dist/types/platform-workbench/menuTreeModel.d.ts +2 -1
  154. package/dist/types/platform-workbench/realtimeStatus.d.ts +2 -1
  155. package/dist/types/platform-workbench/useAssistantConversation.d.ts +107 -15
  156. package/dist/types/platform-workbench/useAssistantConversationArchive.d.ts +8 -15
  157. package/dist/types/platform-workbench/useWorkspaceViewUnsavedState.d.ts +1 -5
  158. package/dist/types/platform-workbench/workbenchAssistantCapabilities.d.ts +3 -2
  159. package/dist/types/platform-workbench/workbenchNavigation.d.ts +1 -0
  160. package/dist/types/platform-workbench/workspaceViewContract.d.ts +4 -0
  161. package/dist/types/platform-workbench/workspaceViewDiscardGuard.d.ts +5 -0
  162. package/dist/types/platform-workbench/workspaceViewHost.d.ts +1 -1
  163. package/dist/types/platform-workbench/workspaceViewUnsavedState.d.ts +1 -1
  164. package/dist/types/platform-workbench/workspaceViews.d.ts +3 -2
  165. package/dist/types/views/ConfigurationTranslationView.vue.d.ts +3 -0
  166. package/dist/types/views/MetadataSourceTree.vue.d.ts +0 -2
  167. package/dist/types/views/PageCompositionDescriptorPreview.vue.d.ts +2 -2
  168. package/dist/types/views/PageQuerySummaryEditor.vue.d.ts +2 -2
  169. package/dist/types/views/RoleAuthorizationView.vue.d.ts +1 -1
  170. package/dist/types/views/WorkflowAdministrationView.vue.d.ts +3 -0
  171. package/dist/types/views/WorkflowConfigurationView.vue.d.ts +7 -0
  172. package/dist/types/views/WorkflowWorkbenchView.vue.d.ts +3 -0
  173. package/dist/types/views/businessLogClient.d.ts +5 -2
  174. package/dist/types/views/businessRuleAssistantSurface.d.ts +3 -3
  175. package/dist/types/views/businessRuleEditor.d.ts +2 -1
  176. package/dist/types/views/businessRuleGovernance.d.ts +14 -4
  177. package/dist/types/views/businessRuleSession.d.ts +4 -3
  178. package/dist/types/views/businessRuleWorkspace.d.ts +6 -2
  179. package/dist/types/views/configurationEditorNavigation.d.ts +2 -1
  180. package/dist/types/views/configurationTranslationWorkspace.d.ts +69 -0
  181. package/dist/types/views/dictionaryRadioEligibility.d.ts +2 -1
  182. package/dist/types/views/metadataChangeSetSubmission.d.ts +4 -3
  183. package/dist/types/views/metadataEditorSession.d.ts +15 -9
  184. package/dist/types/views/metadataGovernanceEditor.d.ts +4 -0
  185. package/dist/types/views/metadataModelEditSession.d.ts +3 -2
  186. package/dist/types/views/metadataModelTree.d.ts +2 -1
  187. package/dist/types/views/metadataNaming.d.ts +5 -2
  188. package/dist/types/views/metadataOrchestrationState.d.ts +10 -9
  189. package/dist/types/views/metadataSourceTree.d.ts +3 -2
  190. package/dist/types/views/metadataWorkspace.d.ts +26 -19
  191. package/dist/types/views/moduleRuntimeActivation.d.ts +3 -3
  192. package/dist/types/views/pageCompositionAssistantSurface.d.ts +2 -0
  193. package/dist/types/views/pageCompositionCandidate.d.ts +2 -1
  194. package/dist/types/views/pageCompositionComponents.d.ts +5 -4
  195. package/dist/types/views/pageCompositionDraftState.d.ts +21 -7
  196. package/dist/types/views/pageCompositionMode.d.ts +26 -2
  197. package/dist/types/views/pageCompositionPublication.d.ts +2 -0
  198. package/dist/types/views/pageCompositionSession.d.ts +48 -15
  199. package/dist/types/views/pageCompositionWorkspace.d.ts +90 -29
  200. package/dist/types/views/runtimeLogClient.d.ts +2 -2
  201. package/dist/types/views/usePageCompositionComponents.d.ts +2 -1
  202. package/dist/types/views/workflowConfigurationWorkspaceView.d.ts +5 -0
  203. package/dist/types/vue-ui-antdv/blockingOverlays.d.ts +9 -0
  204. package/dist/types/vue-ui-antdv/components/UiButton.vue.d.ts +1 -1
  205. package/dist/types/vue-ui-antdv/components/UiDataTable.vue.d.ts +2 -2
  206. package/dist/types/vue-ui-antdv/components/UiLanguageProvider.vue.d.ts +18 -0
  207. package/dist/types/vue-ui-antdv/components/UiModal.vue.d.ts +3 -3
  208. package/dist/types/vue-ui-antdv/components/UiRecordExplorerItem.vue.d.ts +2 -2
  209. package/dist/types/vue-ui-antdv/components/UiSearchInput.vue.d.ts +1 -1
  210. package/dist/types/vue-ui-antdv/components/UiSelect.vue.d.ts +1 -1
  211. package/dist/types/vue-ui-antdv/components/UiSidePanel.vue.d.ts +3 -0
  212. package/dist/types/vue-ui-antdv/components/UiTextArea.vue.d.ts +7 -7
  213. package/dist/types/vue-ui-antdv/components/UiTokenInput.vue.d.ts +7 -7
  214. package/dist/types/vue-ui-antdv/components/UiTree.vue.d.ts +1 -1
  215. package/dist/types/vue-ui-antdv/components/UiTreeSelect.vue.d.ts +1 -1
  216. package/dist/types/vue-ui-antdv/confirm.d.ts +3 -2
  217. package/dist/types/vue-ui-antdv/index.d.ts +3 -0
  218. package/dist/types/vue-ui-antdv/languageGlobalScope.d.ts +3 -0
  219. package/dist/types/vue-ui-antdv/languageLocales.d.ts +4 -0
  220. package/dist/types/vue-ui-antdv/theme.d.ts +2 -0
  221. package/dist/types/vue-ui-antdv/types.d.ts +2 -0
  222. package/dist/types/web-contracts/constructionPlan.d.ts +4 -3
  223. package/dist/types/web-contracts/index.d.ts +46 -0
  224. package/dist/types/web-contracts/workflow.d.ts +346 -0
  225. package/dist/types/web-core/actionResult.d.ts +3 -0
  226. package/dist/types/web-core/assistantConfirmation.d.ts +3 -2
  227. package/dist/types/web-core/assistantConversationClient.d.ts +8 -0
  228. package/dist/types/web-core/assistantSurface.d.ts +4 -3
  229. package/dist/types/web-core/errors.d.ts +8 -4
  230. package/dist/types/web-core/index.d.ts +6 -0
  231. package/dist/types/web-core/language.d.ts +54 -0
  232. package/dist/types/web-core/languagePreference.d.ts +8 -0
  233. package/dist/types/web-core/module/dataExchangeClient.d.ts +2 -1
  234. package/dist/types/web-core/module/index.d.ts +1 -0
  235. package/dist/types/web-core/module/moduleContext.d.ts +4 -0
  236. package/dist/types/web-core/module/pageActionEntries.d.ts +3 -2
  237. package/dist/types/web-core/module/runtimeContext.d.ts +15 -2
  238. package/dist/types/web-core/operationConfirmation.d.ts +5 -1
  239. package/dist/types/web-core/operationErrors.d.ts +15 -1
  240. package/dist/types/web-core/presentationTexts.d.ts +16 -0
  241. package/dist/types/web-core/sha256.d.ts +2 -0
  242. package/dist/types/web-core/workflow.d.ts +70 -0
  243. package/dist/types/web-core/workspaceUnsavedState.d.ts +6 -0
  244. package/dist/workspaceViews-BIYGPUAO.js +3437 -0
  245. package/package.json +2 -4
  246. package/dist/BusinessActivityLogView-DVzrZW1X.js +0 -16
  247. package/dist/BusinessLogListDrawer-D-R3wnWr.js +0 -825
  248. package/dist/LoginAuditLogView-BP1eaEPw.js +0 -16
  249. package/dist/ModuleActionManagementView-D17iKVQv.js +0 -691
  250. package/dist/RequestErrorLogView-LzN94-Tk.js +0 -16
  251. package/dist/RoleDetailWorkspaceView-BXA-bzFu.js +0 -1406
  252. package/dist/RuntimeLogView-DUpu2q2w.js +0 -297
  253. package/dist/moduleGovernanceWorkspaceView-COjWtJMr.js +0 -639
  254. package/dist/platform-components-Hs3DrTqE.js +0 -19770
  255. package/dist/rolldown-runtime-DPVXH0ON.js +0 -17
  256. package/dist/sse-Q1wa3p_k.js +0 -187
  257. package/dist/workspaceViews-CHsgLFwY.js +0 -3217
@@ -1,3217 +0,0 @@
1
- import { n as e } from "./rolldown-runtime-DPVXH0ON.js";
2
- import { T as t, _ as n, at as r, h as i, k as a, ot as o, s, t as c, u as l, x as u } from "./platform-workbench-C-kE-Yqq.js";
3
- import { $t as d, Bt as f, C as p, Cn as m, Dn as h, O as g, Pn as _, Qt as v, R as y, Sn as b, T as x, Tn as S, Ut as C, Vt as w, Wr as T, Xt as E, Zt as D, an as O, bn as k, cn as ee, f as A, gn as te, ht as ne, in as j, nn as M, rn as re, u as ie, xn as ae, z as oe } from "./platform-components-Hs3DrTqE.js";
4
- import { n as N } from "./sse-Q1wa3p_k.js";
5
- import { a as P, c as F, l as I, n as se, o as ce, r as le, s as ue, u as de } from "./moduleGovernanceWorkspaceView-COjWtJMr.js";
6
- import { Fragment as L, computed as R, createBlock as z, createCommentVNode as B, createElementBlock as V, createElementVNode as H, createSlots as fe, createTextVNode as U, createVNode as W, defineAsyncComponent as G, defineComponent as K, guardReactiveProps as pe, mergeProps as me, nextTick as he, normalizeClass as ge, normalizeProps as _e, onBeforeUnmount as ve, onMounted as ye, onUnmounted as be, openBlock as q, ref as J, renderList as xe, renderSlot as Se, resolveDynamicComponent as Ce, toDisplayString as Y, toValue as we, unref as X, watch as Z, withCtx as Q, withKeys as Te, withModifiers as Ee } from "vue";
7
- //#region src/views/roleDetailWorkspaceView.ts
8
- var De = /* @__PURE__ */ new Set([
9
- "platform",
10
- "tenant",
11
- "organization"
12
- ]), Oe = de({
13
- type: "iam.role.detail",
14
- route: "/iam/role",
15
- moduleAlias: "iam.role",
16
- component: G(() => import("./RoleDetailWorkspaceView-BXA-bzFu.js")),
17
- layout: "workspace",
18
- routeTitle: "角色管理",
19
- presentations: ["drawer", "tab"],
20
- titleOf: () => "角色详情",
21
- parentRouteQueryOf(e) {
22
- return e.scopeKind === "platform" ? { scopeKind: e.scopeKind } : {
23
- scopeKind: e.scopeKind,
24
- scopeId: e.scopeId
25
- };
26
- },
27
- parse(e) {
28
- let t = e.recordId, n = e.scopeKind, r = e.scopeId;
29
- if (!(typeof t != "string" || !t || typeof n != "string" || !De.has(n) || (n === "platform" ? r !== void 0 : typeof r != "string" || !r))) return {
30
- recordId: t,
31
- scopeKind: n,
32
- ...typeof r == "string" ? { scopeId: r } : {}
33
- };
34
- }
35
- }), ke = de({
36
- type: "iam.role.authorization",
37
- route: "/iam/role/authorization",
38
- moduleAlias: "iam.role",
39
- component: G(() => Promise.resolve().then(() => zn)),
40
- layout: "workspace",
41
- routeTitle: "角色授权",
42
- drawerProfile: "wide-work",
43
- presentations: ["drawer", "tab"],
44
- titleOf: () => "角色授权",
45
- parse(e) {
46
- let t = e.roleId;
47
- return typeof t == "string" && t ? { roleId: t } : void 0;
48
- }
49
- }), Ae = [Oe, ke], je = de({
50
- type: "platform.module.actions",
51
- route: "/_platform/workspace/platform.module.actions",
52
- moduleAlias: "platform.module",
53
- component: G(() => import("./ModuleActionManagementView-D17iKVQv.js").then((e) => e.n)),
54
- layout: "workspace",
55
- routeTitle: "模块管理",
56
- presentations: ["tab"],
57
- titleOf: (e) => `动作:${e.moduleTitle ?? e.moduleAlias}`,
58
- parentRouteQueryOf: () => ({}),
59
- parse(e) {
60
- let t = e.moduleAlias, n = e.moduleTitle;
61
- if (typeof t == "string" && t) return {
62
- moduleAlias: t,
63
- ...typeof n == "string" && n ? { moduleTitle: n } : {},
64
- ...e.moduleKind === "static" || e.moduleKind === "dynamic" ? { moduleKind: e.moduleKind } : {}
65
- };
66
- }
67
- }), Me = /* @__PURE__ */ K({
68
- __name: "ModuleMenuDrawer",
69
- props: { context: {} },
70
- setup(e) {
71
- let t = e, n = String(t.context.record?.alias ?? t.context.record?.id ?? ""), r = l(), a = le(), o = i(), s = () => JSON.stringify([
72
- o?.value?.userId,
73
- o?.value?.tenantId,
74
- o?.value?.organizationId,
75
- o?.value?.system
76
- ]), c = s(), u = !0, d = a?.session(n) ?? P(F(t.context.module.http), n, {
77
- valid: () => u && !!o?.value?.userId && s() === c,
78
- active: () => u
79
- }, ce(c, n, () => !!o?.value?.userId && s() === c), r?.refreshMenus), f = J();
80
- return a?.focus(d), a?.showEditor(d), d.ready.value || d.load(), Z([
81
- d.canSave,
82
- d.saving,
83
- d.saved,
84
- d.resultUnknown
85
- ], () => {
86
- t.context.setCloseBlocked(d.saving.value), t.context.setTitleActions(d.saved.value || d.resultUnknown.value ? [] : [{
87
- key: "add-menu",
88
- label: "添加",
89
- emphasis: "primary",
90
- disabled: !d.canSave.value,
91
- loading: d.saving.value,
92
- run: () => f.value?.save()
93
- }]);
94
- }, { immediate: !0 }), Z(d.saved, (e) => {
95
- e && t.context.refreshDetailExtensions();
96
- }), ve(() => {
97
- u = !1, a?.hideEditor(d), a || d.dispose();
98
- }), (t, n) => (q(), z(ue, {
99
- ref_key: "editor",
100
- ref: f,
101
- session: X(d),
102
- onOpened: n[0] ||= (t) => e.context.close()
103
- }, null, 8, ["session"]));
104
- }
105
- }), Ne = { class: "module-menu-entries" }, Pe = { key: 0 }, Fe = {
106
- key: 1,
107
- role: "status"
108
- }, Ie = { key: 2 }, Le = { key: 0 }, $ = /*#__PURE__*/ h(/* @__PURE__ */ K({
109
- __name: "ModuleMenuEntriesSection",
110
- props: { context: {} },
111
- setup(e) {
112
- let t = e, n = l(), r = J([]), i = J(/* @__PURE__ */ new Map()), a = J(!1), o = J(""), s = 0;
113
- ve(() => s++), Z(() => [t.context.record.id, t.context.refreshKey], () => void c(), { immediate: !0 });
114
- async function c() {
115
- let e = ++s, n = String(t.context.record.alias ?? t.context.record.id ?? ""), c = F(t.context.module.http);
116
- a.value = !0, o.value = "", r.value = [], i.value = /* @__PURE__ */ new Map();
117
- try {
118
- let [t, a] = await Promise.all([c.schemes(), c.visible()]), o = await Promise.all(t.map(async (e) => I(await c.tree(e.id), e.title ?? e.alias ?? e.id).filter(({ menu: e }) => e.moduleAlias === n)));
119
- if (e !== s) return;
120
- r.value = o.flat(), i.value = new Map(I(a).map(({ menu: e }) => [e.id, e]));
121
- } catch {
122
- e === s && (o.value = "暂时无法读取菜单入口,请确认有菜单管理权限后重试。");
123
- } finally {
124
- e === s && (a.value = !1);
125
- }
126
- }
127
- return (e, t) => (q(), V("div", Ne, [a.value ? (q(), V("span", Pe, "正在加载…")) : o.value ? (q(), V("div", Fe, [U(Y(o.value) + " ", 1), W(X(S), {
128
- type: "link",
129
- onClick: c
130
- }, {
131
- default: Q(() => [...t[0] ||= [U("重试", -1)]]),
132
- _: 1
133
- })])) : r.value.length ? B("v-if", !0) : (q(), V("span", Ie, "尚未添加到菜单,可通过上方“添加到菜单”设置入口。")), (q(!0), V(L, null, xe(r.value, (e) => (q(), V("div", {
134
- key: e.menu.id,
135
- class: "menu-entry"
136
- }, [H("span", null, [U(Y(e.path), 1), e.menu.enabled === !1 ? (q(), V("small", Le, " · 已停用")) : B("v-if", !0)]), i.value.has(e.menu.id) && X(n)?.openMenu ? (q(), z(X(S), {
137
- key: 0,
138
- type: "link",
139
- onClick: (t) => X(n).openMenu(i.value.get(e.menu.id))
140
- }, {
141
- default: Q(() => [...t[1] ||= [H("span", null, "打开", -1)]]),
142
- _: 1
143
- }, 8, ["onClick"])) : B("v-if", !0)]))), 128))]));
144
- }
145
- }), [["__scopeId", "data-v-ff7756d2"]]), Re = je, ze = se, Be = {
146
- id: "platform-module-workspace-actions",
147
- target: { moduleAlias: "platform.module" },
148
- workspaceViews: [ze, Re],
149
- detail: {
150
- sections: [{
151
- key: "module-menu-entries",
152
- title: "菜单入口",
153
- component: $
154
- }],
155
- actions: [
156
- {
157
- key: "module-add-to-menu",
158
- title: "添加到菜单",
159
- state: (e) => ({ visible: Ue(e) !== void 0 }),
160
- run({ openDrawer: e }) {
161
- e({
162
- title: "添加到菜单",
163
- width: "narrow",
164
- component: Me
165
- });
166
- }
167
- },
168
- {
169
- key: "module-actions-workspace",
170
- title: "动作",
171
- state: (e) => ({ visible: Ue(e) !== void 0 }),
172
- run({ record: e, openWorkspaceTab: t }) {
173
- let n = Ue(e);
174
- n && t(Re, {
175
- moduleAlias: n,
176
- moduleTitle: We(e),
177
- moduleKind: Ge(e)
178
- });
179
- }
180
- },
181
- {
182
- key: "module-ui-orchestration-workspace",
183
- title: "低代码",
184
- state: (e) => ({ visible: Ue(e) !== void 0 && Ge(e) === "dynamic" }),
185
- run({ record: e, openWorkspaceTab: t }) {
186
- let n = Ue(e);
187
- n && Ge(e) === "dynamic" && t(ze, {
188
- moduleAlias: n,
189
- moduleTitle: We(e),
190
- governanceTab: "overview"
191
- });
192
- }
193
- }
194
- ]
195
- }
196
- }, Ve = {
197
- id: "dictionary-category-tree-parent-policy",
198
- target: { moduleAlias: "platform.dictionary_category" },
199
- navigator: { treeParentPolicy: {
200
- canUseAsParent: (e) => e.categoryKind === "folder",
201
- rejectionMessage: "字典类目只能挂在目录下"
202
- } }
203
- }, He = {
204
- id: "platform-module-action-entry-scope",
205
- target: { moduleAlias: "platform.module_action" },
206
- navigator: {
207
- hidden: !0,
208
- lockedEntry: {
209
- navigatorKey: "module",
210
- unavailableDescription: "模块上下文不可用"
211
- }
212
- },
213
- standardActions: { disabled: ["create"] }
214
- };
215
- function Ue(e) {
216
- return Ke(e, "alias") ?? Ke(e, "id");
217
- }
218
- function We(e) {
219
- return Ke(e, "title");
220
- }
221
- function Ge(e) {
222
- let t = Ke(e, "moduleKind");
223
- return t === "static" || t === "dynamic" ? t : void 0;
224
- }
225
- function Ke(e, t) {
226
- let n = e[t];
227
- return typeof n == "string" && n.trim() ? n : void 0;
228
- }
229
- //#endregion
230
- //#region src/views/PasswordPolicyPreview.vue?vue&type=script&setup=true&lang.ts
231
- var qe = { class: "password-policy-preview" }, Je = {
232
- key: 0,
233
- class: "preview-results"
234
- }, Ye = {
235
- id: "iam-password-policy-preview",
236
- target: { moduleAlias: "iam.password_policy_rule" },
237
- card: { assistant: {
238
- component: /* @__PURE__ */ h(/* @__PURE__ */ K({
239
- name: "PasswordPolicyPreview",
240
- __name: "PasswordPolicyPreview",
241
- props: { context: {} },
242
- setup(e) {
243
- let t = e, n = J("CURRENT"), r = J(""), i = J(), a = J(!1), o = J(!1), s = 0, c = R(() => g(t.context.record)), l = R(() => t.context.mode !== "view" || b(c.value?.id) !== void 0), u = R(() => [{
244
- value: "CURRENT",
245
- label: "本规则",
246
- disabled: !l.value
247
- }, {
248
- value: "ALL",
249
- label: "全规则"
250
- }]);
251
- Z(l, (e) => {
252
- !e && n.value === "CURRENT" && (n.value = "ALL");
253
- }, { immediate: !0 });
254
- function d(e) {
255
- (e !== "CURRENT" || l.value) && (e === "CURRENT" || e === "ALL") && (n.value = e);
256
- }
257
- Z([n, () => t.context.formSessionKey], ([e]) => {
258
- e === "ALL" && f();
259
- }, { immediate: !0 });
260
- async function f() {
261
- let e = ++s;
262
- o.value = !0, a.value = !1, i.value = void 0;
263
- try {
264
- let n = await t.context.module.http.request({ path: "/iam.password_policy_rule/active-global-rules" });
265
- if (e !== s) return;
266
- i.value = Object.freeze(n.map((e) => Object.freeze({ ...e })));
267
- } catch {
268
- if (e !== s) return;
269
- a.value = !0;
270
- } finally {
271
- e === s && (o.value = !1);
272
- }
273
- }
274
- let p = R(() => {
275
- let e = l.value ? c.value : void 0;
276
- if (n.value === "CURRENT") return e ? [e] : [];
277
- if (!i.value) return [];
278
- let t = i.value.filter(S), r = b(e?.id);
279
- if (r) {
280
- let e = t.findIndex((e) => b(e.id) === r);
281
- e >= 0 && t.splice(e, 1);
282
- }
283
- return e && S(e) && t.push(e), t.length > 0 ? t.sort(v) : [];
284
- }), m = R(() => r.value ? p.value.map((e, t) => _(e, r.value, t)) : []), h = R(() => {
285
- if (!l.value && n.value === "CURRENT") return "请选择或新建一条规则";
286
- if (n.value === "ALL" && o.value) return "正在加载权威规则集";
287
- if (n.value === "ALL" && a.value) return "无法加载权威规则集";
288
- if (!r.value) return "输入测试密码后即时反馈";
289
- if (m.value.length === 0) return "当前没有参与试算的启用规则";
290
- let e = m.value.filter((e) => !e.passed).length;
291
- return e === 0 ? `全部通过(${m.value.length}/${m.value.length})` : `${e} 条规则未通过`;
292
- });
293
- function g(e) {
294
- if (e) return e;
295
- }
296
- function _(e, t, n) {
297
- let r = x(e.title, "未命名规则"), i = x(e.message, "未配置失败提示"), a = e.pattern;
298
- if (!a?.trim()) return {
299
- key: y(e, n),
300
- title: r,
301
- message: i,
302
- passed: !1,
303
- diagnostic: "正则表达式不能为空"
304
- };
305
- try {
306
- let o = RegExp(`^(?:${a})$`).test(t);
307
- return {
308
- key: y(e, n),
309
- title: r,
310
- message: i,
311
- passed: o
312
- };
313
- } catch {
314
- return {
315
- key: y(e, n),
316
- title: r,
317
- message: i,
318
- passed: !1,
319
- diagnostic: "当前浏览器不支持该正则语法;保存时仍由服务端 Java 正则校验"
320
- };
321
- }
322
- }
323
- function v(e, t) {
324
- return (e.sortOrder ?? 2 ** 53 - 1) - (t.sortOrder ?? 2 ** 53 - 1) || x(e.title, "").localeCompare(x(t.title, ""));
325
- }
326
- function y(e, t) {
327
- return b(e.id) ?? `draft:${t}`;
328
- }
329
- function b(e) {
330
- return e?.trim() || void 0;
331
- }
332
- function x(e, t) {
333
- return e?.trim() || t;
334
- }
335
- function S(e) {
336
- return e.enabled !== !1 && (e.scopeType == null || e.scopeType.toLowerCase() === "global");
337
- }
338
- return (e, t) => (q(), V("section", qe, [
339
- H("header", null, [t[1] ||= H("h3", null, "密码试算", -1), H("span", { class: ge({ failed: m.value.some((e) => !e.passed) }) }, Y(h.value), 3)]),
340
- W(X(te), {
341
- class: "preview-scope",
342
- value: n.value,
343
- options: u.value,
344
- size: "small",
345
- "onUpdate:value": d
346
- }, null, 8, ["value", "options"]),
347
- W(X(k), {
348
- value: r.value,
349
- "onUpdate:value": t[0] ||= (e) => r.value = e,
350
- type: "text",
351
- autocomplete: "off",
352
- placeholder: "输入测试密码",
353
- "aria-label": "测试密码"
354
- }, null, 8, ["value"]),
355
- m.value.length ? (q(), V("ul", Je, [(q(!0), V(L, null, xe(m.value, (e) => (q(), V("li", {
356
- key: e.key,
357
- class: ge({
358
- passed: e.passed,
359
- failed: !e.passed
360
- })
361
- }, [H("strong", null, Y(e.title), 1), H("span", null, Y(e.diagnostic ?? (e.passed ? "通过" : e.message)), 1)], 2))), 128))])) : B("v-if", !0)
362
- ]));
363
- }
364
- }), [["__scopeId", "data-v-1ebdeb6e"]]),
365
- placement: {
366
- boundary: "outside",
367
- position: "bottom"
368
- }
369
- } }
370
- }, Xe = { class: "tenant-applications-detail" }, Ze = { class: "tenant-applications-summary" }, Qe = {
371
- key: 0,
372
- class: "tenant-applications-status"
373
- }, $e = /*#__PURE__*/ h(/* @__PURE__ */ K({
374
- name: "TenantApplicationsDetailSection",
375
- __name: "TenantApplicationsDetailSection",
376
- props: { context: {} },
377
- setup(e) {
378
- let t = e, n = J([]), r = J(!1), i = 0, a = J(/* @__PURE__ */ new Map()), o = R(() => n.value.map((e) => e.applicationAlias).filter((e) => typeof e == "string" && e.length > 0).map((e) => ({
379
- key: e,
380
- label: a.value.get(e) ? `${a.value.get(e)} · ${e}` : e
381
- })));
382
- Z(() => [t.context.record.id, t.context.refreshKey], () => void s(), { immediate: !0 });
383
- async function s() {
384
- let e = String(t.context.record.id ?? ""), o = ++i;
385
- if (!e) {
386
- n.value = [], a.value = /* @__PURE__ */ new Map(), r.value = !1;
387
- return;
388
- }
389
- r.value = !0, n.value = [], a.value = /* @__PURE__ */ new Map();
390
- try {
391
- let [r, s] = await Promise.all([t.context.module.http.request({
392
- method: "POST",
393
- path: "/platform.application/query",
394
- body: { page: {
395
- pageNum: 1,
396
- pageSize: 200
397
- } }
398
- }), t.context.module.http.request({
399
- method: "POST",
400
- path: c(e, "query"),
401
- body: { page: {
402
- pageNum: 1,
403
- pageSize: 200
404
- } }
405
- })]);
406
- o === i && (a.value = new Map(r.records.filter((e) => e.alias && e.title).map((e) => [e.alias, e.title])), n.value = s.records);
407
- } catch (e) {
408
- o === i && w(e, {
409
- source: "tenant-applications-detail",
410
- phase: "load"
411
- });
412
- } finally {
413
- o === i && (r.value = !1);
414
- }
415
- }
416
- function c(e, t) {
417
- return `/iam.tenant/${encodeURIComponent(e)}/applications/${t}`;
418
- }
419
- return (e, t) => (q(), V("section", Xe, [H("div", Ze, [r.value ? (q(), V("span", Qe, "正在加载…")) : (q(), z(X(m), {
420
- key: 1,
421
- items: o.value,
422
- "max-visible": 8,
423
- "empty-text": "暂无记录"
424
- }, null, 8, ["items"]))])]));
425
- }
426
- }), [["__scopeId", "data-v-2f879564"]]), et = { class: "tenant-application-configuration" }, tt = /*#__PURE__*/ h(/* @__PURE__ */ K({
427
- name: "TenantApplicationConfigurationDrawer",
428
- __name: "TenantApplicationConfigurationDrawer",
429
- props: { context: {} },
430
- setup(e) {
431
- let t = e, n = J([]), r = J(/* @__PURE__ */ new Set()), i = J(!1), a = J(!1), o = [{
432
- key: "title",
433
- title: "应用名称",
434
- width: 260
435
- }, {
436
- key: "alias",
437
- title: "应用 alias",
438
- width: 220
439
- }], s = R(() => n.value), c = R(() => ({
440
- selectedRowKeys: [...r.value],
441
- preserveSelectedRowKeys: !0,
442
- disabledOf: (e) => a.value || e.alias === "iam",
443
- onChange: (e) => {
444
- r.value = new Set(e.map(String));
445
- }
446
- }));
447
- function l() {
448
- t.context.setCloseBlocked(a.value), t.context.setTitleActions([{
449
- key: "cancel",
450
- label: "取消",
451
- disabled: a.value,
452
- run: () => {
453
- a.value || t.context.close();
454
- }
455
- }, {
456
- key: "confirm",
457
- label: "确认",
458
- emphasis: "primary",
459
- disabled: a.value,
460
- loading: a.value,
461
- run: d
462
- }]);
463
- }
464
- ye(() => {
465
- l(), u();
466
- }), Z(a, l);
467
- async function u() {
468
- let e = String(t.context.record?.id ?? "");
469
- if (e) {
470
- i.value = !0;
471
- try {
472
- let [i, a] = await Promise.all([t.context.module.http.request({
473
- method: "POST",
474
- path: "/platform.application/query",
475
- body: { page: {
476
- pageNum: 1,
477
- pageSize: 200
478
- } }
479
- }), t.context.module.http.request({
480
- method: "POST",
481
- path: f(e, "query"),
482
- body: { page: {
483
- pageNum: 1,
484
- pageSize: 200
485
- } }
486
- })]);
487
- n.value = i.records.filter((e) => e.enabled !== !1);
488
- let o = new Set(n.value.map((e) => e.alias).filter(Boolean));
489
- r.value = /* @__PURE__ */ new Set(["iam", ...a.records.map((e) => e.applicationAlias).filter((e) => typeof e == "string" && o.has(e))]);
490
- } catch (e) {
491
- w(e, {
492
- source: "tenant-application-configuration",
493
- phase: "load"
494
- });
495
- } finally {
496
- i.value = !1;
497
- }
498
- }
499
- }
500
- async function d() {
501
- let e = String(t.context.record?.id ?? "");
502
- if (e && !a.value) {
503
- a.value = !0;
504
- try {
505
- await t.context.module.http.request({
506
- method: "POST",
507
- path: f(e, "configure"),
508
- body: { applicationAliases: [...r.value] }
509
- }), t.context.refreshDetailExtensions(), t.context.refreshList(), t.context.close();
510
- } catch (e) {
511
- w(e, {
512
- source: "tenant-application-configuration",
513
- phase: "action"
514
- });
515
- } finally {
516
- a.value = !1;
517
- }
518
- }
519
- }
520
- function f(e, t) {
521
- return `/iam.tenant/${encodeURIComponent(e)}/applications/${t}`;
522
- }
523
- return (e, t) => (q(), V("section", et, [t[0] ||= H("p", null, "勾选表示向当前租户开通应用;取消勾选将移除该租户的应用开通记录。", -1), W(X(M), {
524
- columns: o,
525
- rows: s.value,
526
- loading: i.value,
527
- pagination: !1,
528
- selection: c.value,
529
- "row-key": (e) => String(e.alias ?? e.id ?? ""),
530
- "empty-description": "暂无可配置应用"
531
- }, null, 8, [
532
- "rows",
533
- "loading",
534
- "selection",
535
- "row-key"
536
- ])]));
537
- }
538
- }), [["__scopeId", "data-v-2e68af88"]]), nt = {
539
- id: "iam-tenant-standard-page-enhancement",
540
- target: { moduleAlias: "iam.tenant" },
541
- form: {
542
- contributions: [],
543
- fieldPolicies: [
544
- {
545
- fieldName: "workbenchTitle",
546
- visible: ({ draft: e }) => e.workbenchBrandMode !== "logoOnly"
547
- },
548
- {
549
- fieldName: "workbenchSubtitle",
550
- visible: ({ draft: e }) => e.workbenchBrandMode !== "logoOnly"
551
- },
552
- ...["lightLogoAssetId", "darkLogoAssetId"].map((e) => ({
553
- fieldName: e,
554
- imageUploadHint: ({ draft: e }) => e.workbenchBrandMode === "logoOnly" ? "纯 Logo 模式支持横向或正方形图片(最大 512 KB)" : "Logo + 标题模式仅支持正方形图片(建议 128 × 128 px,最大 512 KB)",
555
- imageUploadAdvisory: ({ draft: e }) => e.workbenchBrandMode === "logoOnly" ? void 0 : rt
556
- }))
557
- ]
558
- },
559
- detail: {
560
- actions: [{
561
- key: "tenant-configure-applications",
562
- title: "配置应用",
563
- state: () => ({ visible: !0 }),
564
- run({ openDrawer: e }) {
565
- e({
566
- title: "配置应用",
567
- width: "wide",
568
- component: tt
569
- });
570
- }
571
- }],
572
- sections: [{
573
- key: "tenant-applications",
574
- title: "已开通应用",
575
- component: $e
576
- }]
577
- }
578
- };
579
- async function rt(e) {
580
- if (!e.type.startsWith("image/") || typeof Image > "u") return "Logo + 标题模式需要可读取的正方形图片。";
581
- try {
582
- let { width: t, height: n } = await it(e), r = t / n;
583
- return r >= .9 && r <= 1.1 ? void 0 : `“${e.name}”为 ${t} × ${n} px;Logo + 标题模式仅允许上传正方形 Logo。`;
584
- } catch {
585
- return "无法读取图片尺寸,请选择正方形 PNG、JPG 或 GIF 图片。";
586
- }
587
- }
588
- function it(e) {
589
- let t = URL.createObjectURL(e);
590
- return new Promise((e, n) => {
591
- let r = new Image();
592
- r.onload = () => {
593
- URL.revokeObjectURL(t), e({
594
- width: r.naturalWidth,
595
- height: r.naturalHeight
596
- });
597
- }, r.onerror = () => {
598
- URL.revokeObjectURL(t), n(/* @__PURE__ */ Error("无法读取图片尺寸"));
599
- }, r.src = t;
600
- });
601
- }
602
- //#endregion
603
- //#region src/platform-admin-runtime/employee/EmployeeAccountDrawer.vue?vue&type=script&setup=true&lang.ts
604
- var at = {
605
- key: 1,
606
- class: "employee-account-drawer"
607
- }, ot = { class: "employee-account-existing-picker" }, st = /*#__PURE__*/ h(/* @__PURE__ */ K({
608
- name: "EmployeeAccountDrawer",
609
- __name: "EmployeeAccountDrawer",
610
- props: { context: {} },
611
- setup(e) {
612
- let t = e, n = J(), r = J(), i = J(""), a = J(""), o = J(!1), s = J(!1);
613
- ye(() => void c());
614
- async function c() {
615
- let e = _();
616
- if (e) {
617
- o.value = !0;
618
- try {
619
- n.value = await t.context.module.http.request({ path: `/iam.employee/${encodeURIComponent(e)}/account` });
620
- } catch (e) {
621
- w(e, {
622
- source: "employee-account",
623
- phase: "load"
624
- });
625
- } finally {
626
- o.value = !1;
627
- }
628
- }
629
- }
630
- async function l() {
631
- let e = _();
632
- if (!e || s.value) return;
633
- let r = i.value.trim();
634
- if (!r || !a.value) {
635
- C("请输入账号和初始密码。", {
636
- source: "employee-account",
637
- phase: "validation"
638
- });
639
- return;
640
- }
641
- s.value = !0;
642
- try {
643
- let i = await t.context.module.http.request({
644
- method: "POST",
645
- path: `/iam.employee/${encodeURIComponent(e)}/account/provision`,
646
- body: {
647
- username: r,
648
- password: a.value
649
- }
650
- });
651
- n.value = T(i).binding, a.value = "", t.context.refreshList();
652
- } catch (e) {
653
- w(e, {
654
- source: "employee-account",
655
- phase: "action"
656
- });
657
- } finally {
658
- s.value = !1;
659
- }
660
- }
661
- async function u(e) {
662
- let t = e[0];
663
- t && await f(t.id);
664
- }
665
- async function f(e) {
666
- let i = _();
667
- if (i && e && !s.value) {
668
- s.value = !0;
669
- try {
670
- n.value = await t.context.module.http.request({
671
- method: "POST",
672
- path: `/iam.employee/${encodeURIComponent(i)}/account`,
673
- body: { userId: e }
674
- }), r.value = void 0, t.context.refreshList(), C("账号已绑定到当前职员。", {
675
- source: "employee-account",
676
- phase: "action"
677
- });
678
- } catch (e) {
679
- w(e, {
680
- source: "employee-account",
681
- phase: "action"
682
- });
683
- } finally {
684
- s.value = !1;
685
- }
686
- }
687
- }
688
- async function p(e) {
689
- let n = _();
690
- if (!n) return {
691
- records: [],
692
- total: 0
693
- };
694
- let r = await t.context.module.http.request({
695
- method: "POST",
696
- path: `/iam.employee/${encodeURIComponent(n)}/account-candidates/query`,
697
- body: {
698
- keyword: e.keyword,
699
- page: {
700
- pageNum: e.pageNum,
701
- pageSize: e.pageSize
702
- }
703
- }
704
- });
705
- return {
706
- records: r.records.map(h),
707
- total: r.total
708
- };
709
- }
710
- async function m(e) {
711
- let n = _();
712
- return !n || e.length === 0 ? [] : (await t.context.module.http.request({
713
- method: "POST",
714
- path: `/iam.employee/${encodeURIComponent(n)}/account-candidates/query`,
715
- body: {
716
- ids: e,
717
- page: {
718
- pageNum: 1,
719
- pageSize: e.length
720
- }
721
- }
722
- })).records.map(h);
723
- }
724
- function h(e) {
725
- return {
726
- id: e.id,
727
- title: e.username ?? e.id,
728
- account: e.username ?? e.id,
729
- employeeName: e.employeeTitle,
730
- organizationId: e.organizationId,
731
- organizationName: e.organizationTitle,
732
- departmentId: e.departmentId,
733
- departmentName: e.departmentTitle
734
- };
735
- }
736
- async function g() {
737
- let e = _();
738
- if (e && n.value && !s.value && await E({
739
- title: "移除账户",
740
- content: "确认移除该职员的账户?该用户账号会同步删除。",
741
- okText: "移除",
742
- danger: !0
743
- })) {
744
- s.value = !0;
745
- try {
746
- await t.context.module.http.request({
747
- method: "POST",
748
- path: `/iam.employee/${encodeURIComponent(e)}/account/delete`
749
- }), n.value = void 0, t.context.refreshList();
750
- } catch (e) {
751
- w(e, {
752
- source: "employee-account",
753
- phase: "action"
754
- });
755
- } finally {
756
- s.value = !1;
757
- }
758
- }
759
- }
760
- function _() {
761
- let e = t.context.record?.id;
762
- return e == null ? void 0 : String(e);
763
- }
764
- return (e, t) => o.value ? (q(), z(X(d), {
765
- key: 0,
766
- tip: "加载账号绑定"
767
- })) : (q(), V("section", at, [_() ? n.value ? (q(), V(L, { key: 1 }, [H("p", null, "当前已绑定用户:" + Y(n.value.userId ?? "-"), 1), W(X(S), {
768
- danger: "",
769
- "icon-name": "delete",
770
- loading: s.value,
771
- onClick: g
772
- }, {
773
- default: Q(() => [...t[3] ||= [U("移除账户", -1)]]),
774
- _: 1
775
- }, 8, ["loading"])], 64)) : (q(), V(L, { key: 2 }, [H("section", ot, [t[4] ||= H("p", null, "绑定已有用户账号;仅显示当前租户内启用且尚未绑定其他职员的账号。", -1), W(X(A), {
776
- value: r.value,
777
- disabled: s.value,
778
- placeholder: "搜索并选择已有登录账号",
779
- title: "选择已有登录账号",
780
- "search-page": p,
781
- "resolve-users": m,
782
- "onUpdate:value": t[0] ||= (e) => r.value = typeof e == "string" ? e : void 0,
783
- onSelect: u
784
- }, null, 8, ["value", "disabled"])]), H("form", { onSubmit: Ee(l, ["prevent"]) }, [
785
- t[8] ||= H("p", null, "也可直接创建登录账号并自动绑定到当前职员。", -1),
786
- H("label", null, [t[5] ||= H("span", null, "账号", -1), W(X(k), {
787
- value: i.value,
788
- "onUpdate:value": t[1] ||= (e) => i.value = e,
789
- disabled: s.value,
790
- placeholder: "请输入登录账号"
791
- }, null, 8, ["value", "disabled"])]),
792
- H("label", null, [t[6] ||= H("span", null, "初始密码", -1), W(X(k), {
793
- value: a.value,
794
- "onUpdate:value": t[2] ||= (e) => a.value = e,
795
- type: "password",
796
- disabled: s.value,
797
- placeholder: "请输入初始密码"
798
- }, null, 8, ["value", "disabled"])]),
799
- W(X(S), {
800
- type: "primary",
801
- "html-type": "submit",
802
- "icon-name": "plus",
803
- loading: s.value
804
- }, {
805
- default: Q(() => [...t[7] ||= [U(" 创建账号并绑定 ", -1)]]),
806
- _: 1
807
- }, 8, ["loading"])
808
- ], 32)], 64)) : (q(), z(X(v), {
809
- key: 0,
810
- title: "职员不存在",
811
- message: "请重新打开职员档案后再设置账号。"
812
- }))]));
813
- }
814
- }), [["__scopeId", "data-v-aa8474e1"]]), ct = {
815
- id: "iam-employee-account-drawer",
816
- target: { moduleAlias: "iam.employee" },
817
- detail: { actions: [{
818
- key: "employee-account",
819
- title: "设置账号",
820
- state: () => ({ visible: !0 }),
821
- run({ module: e, record: t, openDrawer: n }) {
822
- let r = t.id == null ? void 0 : String(t.id);
823
- r && e.can("employeeAccounts", r) !== !1 && n({
824
- title: "设置账号",
825
- width: "standard",
826
- component: st
827
- });
828
- }
829
- }] }
830
- };
831
- function lt(e, t) {
832
- return !1;
833
- }
834
- //#endregion
835
- //#region src/platform-admin-runtime/backendHttp.ts
836
- function ut(e = {}) {
837
- let t = () => N({
838
- baseUrl: void 0,
839
- token: e.withAuth === !1 ? void 0 : a(void 0),
840
- credentials: dt(void 0),
841
- onAuthenticationRequired: e.withAuth === !1 ? void 0 : (e, t) => lt(e, t)
842
- });
843
- return {
844
- request(e) {
845
- return t().request(e);
846
- },
847
- stream(e) {
848
- return t().stream(e);
849
- }
850
- };
851
- }
852
- function dt(e) {
853
- return e === "include" || e === "omit" || e === "same-origin" ? e : void 0;
854
- }
855
- //#endregion
856
- //#region src/platform-admin-runtime/user/userOnlineStatusStore.ts
857
- var ft = "iam.user.session.collectionChanged", pt = J({}), mt = /* @__PURE__ */ new Set(), ht = !1, gt = !1;
858
- function _t() {
859
- vt();
860
- function e(e) {
861
- e && !pt.value[e] && (mt.add(e), yt());
862
- }
863
- function t(e) {
864
- return e ? pt.value[e] : void 0;
865
- }
866
- function n(e) {
867
- e && (mt.add(e), yt());
868
- }
869
- return {
870
- observe: e,
871
- statusOf: t,
872
- refresh: n
873
- };
874
- }
875
- function vt() {
876
- gt || (gt = !0, t((e) => {
877
- xt(e) && (mt.add(e.recordId), yt());
878
- }));
879
- }
880
- function yt() {
881
- ht || (ht = !0, queueMicrotask(() => {
882
- ht = !1, bt();
883
- }));
884
- }
885
- async function bt() {
886
- let e = Array.from(mt);
887
- if (mt.clear(), e.length !== 0) try {
888
- let t = await ut().request({
889
- method: "POST",
890
- path: "/iam.user/sessions/status",
891
- body: { userIds: e }
892
- });
893
- pt.value = {
894
- ...pt.value,
895
- ...Object.fromEntries(t.map((e) => [e.userId, e]))
896
- };
897
- } catch (e) {
898
- w(e, {
899
- source: "iam-user-online-status",
900
- phase: "load"
901
- });
902
- }
903
- }
904
- function xt(e) {
905
- return e.type === ft && e.moduleAlias === "iam.user" && !!e.recordId;
906
- }
907
- //#endregion
908
- //#region src/platform-admin-runtime/user/UserOnlineStatusCell.vue
909
- var St = /*#__PURE__*/ h(/* @__PURE__ */ K({
910
- name: "UserOnlineStatusCell",
911
- __name: "UserOnlineStatusCell",
912
- props: {
913
- record: {},
914
- column: {}
915
- },
916
- setup(e) {
917
- let t = e, n = _t(), r = R(() => t.record.id == null ? void 0 : String(t.record.id)), i = R(() => n.statusOf(r.value)), a = R(() => {
918
- let e = i.value;
919
- if (!e) return "-";
920
- if (e.present) {
921
- let t = e.presentSessionCount ?? 0, n = e.idleSessionCount ?? 0;
922
- return n >= t ? `闲置 (${t}/${e.activeSessionCount})` : `使用中 (${Math.max(0, t - n)}/${e.activeSessionCount})`;
923
- }
924
- return e.online ? `在线 (${e.activeSessionCount})` : "离线";
925
- });
926
- function o() {
927
- n.observe(r.value);
928
- }
929
- return ye(o), Z(r, o), (e, t) => (q(), V("span", { class: ge({
930
- "user-online-status--present": i.value?.present,
931
- "user-online-status--offline": i.value && !i.value.online
932
- }) }, Y(a.value), 3));
933
- }
934
- }), [["__scopeId", "data-v-789ddd4a"]]), Ct = {
935
- key: 1,
936
- class: "user-password-drawer"
937
- }, wt = { key: 0 }, Tt = {
938
- key: 1,
939
- class: "user-password-reset"
940
- }, Et = { key: 0 }, Dt = /*#__PURE__*/ h(/* @__PURE__ */ K({
941
- name: "UserPasswordDrawer",
942
- __name: "UserPasswordDrawer",
943
- props: { context: {} },
944
- setup(e) {
945
- let t = e, n = J(""), r = J(), i = J(!1), a = R(() => t.context.record?.id == null ? void 0 : String(t.context.record.id));
946
- async function o() {
947
- let e = a.value;
948
- if (e && !i.value && t.context.module.can("changePassword", e) === !0) {
949
- if (!n.value) {
950
- C("请输入新密码。", {
951
- source: "iam-user-password",
952
- phase: "validation"
953
- });
954
- return;
955
- }
956
- i.value = !0, t.context.setCloseBlocked(!0);
957
- try {
958
- await t.context.module.http.request({
959
- method: "POST",
960
- path: `/iam.user/changePassword/${encodeURIComponent(e)}`,
961
- body: { password: n.value }
962
- }), n.value = "", C("密码已修改。", {
963
- source: "iam-user-password",
964
- phase: "action"
965
- }), t.context.refreshList(), t.context.refreshDetailExtensions();
966
- } catch (e) {
967
- w(e, {
968
- source: "iam-user-password",
969
- phase: "action"
970
- });
971
- } finally {
972
- t.context.setCloseBlocked(!1), i.value = !1;
973
- }
974
- }
975
- }
976
- async function s() {
977
- let e = a.value;
978
- if (e && !i.value && t.context.module.can("resetPassword", e) === !0) {
979
- i.value = !0, t.context.setCloseBlocked(!0);
980
- try {
981
- r.value = await t.context.module.http.request({
982
- method: "POST",
983
- path: `/iam.user/resetPassword/${encodeURIComponent(e)}`
984
- }), t.context.refreshList(), t.context.refreshDetailExtensions();
985
- } catch (e) {
986
- w(e, {
987
- source: "iam-user-password",
988
- phase: "action"
989
- });
990
- } finally {
991
- t.context.setCloseBlocked(!1), i.value = !1;
992
- }
993
- }
994
- }
995
- return (t, c) => a.value ? (q(), V("section", Ct, [e.context.module.can("changePassword", a.value) === !0 ? (q(), V("label", wt, [
996
- c[2] ||= H("span", null, "新密码", -1),
997
- W(X(k), {
998
- value: n.value,
999
- "onUpdate:value": c[0] ||= (e) => n.value = e,
1000
- type: "password",
1001
- disabled: i.value,
1002
- placeholder: "请输入新密码"
1003
- }, null, 8, ["value", "disabled"]),
1004
- W(X(S), {
1005
- type: "primary",
1006
- loading: i.value,
1007
- onClick: o
1008
- }, {
1009
- default: Q(() => [...c[1] ||= [U("修改密码", -1)]]),
1010
- _: 1
1011
- }, 8, ["loading"])
1012
- ])) : B("v-if", !0), e.context.module.can("resetPassword", a.value) === !0 ? (q(), V("section", Tt, [
1013
- c[6] ||= H("p", null, "由系统生成临时密码。请在安全渠道交付给用户,并提醒其尽快修改。", -1),
1014
- W(X(S), {
1015
- loading: i.value,
1016
- onClick: s
1017
- }, {
1018
- default: Q(() => [...c[3] ||= [U("生成临时密码", -1)]]),
1019
- _: 1
1020
- }, 8, ["loading"]),
1021
- r.value ? (q(), V("dl", Et, [H("div", null, [c[4] ||= H("dt", null, "临时密码", -1), H("dd", null, Y(r.value.temporaryPassword), 1)]), H("div", null, [c[5] ||= H("dt", null, "失效时间", -1), H("dd", null, Y(r.value.expiresAt ?? "-"), 1)])])) : B("v-if", !0)
1022
- ])) : B("v-if", !0)])) : (q(), z(X(v), {
1023
- key: 0,
1024
- title: "用户不存在",
1025
- message: "请重新打开用户详情后再管理密码。"
1026
- }));
1027
- }
1028
- }), [["__scopeId", "data-v-f6125048"]]);
1029
- //#endregion
1030
- //#region src/platform-admin-runtime/user/useUserSessionRows.ts
1031
- function Ot(e) {
1032
- let t = J([]), n = J({}), r = u({ load: async (e) => {
1033
- await Promise.all(e.keys.map((t) => a(t, e.isLatest)));
1034
- } });
1035
- function i(e) {
1036
- r.enqueue(e);
1037
- }
1038
- async function a(t, n) {
1039
- if (e.context.can("sessions", t) !== !1) {
1040
- d(t, {
1041
- ...c(t),
1042
- loading: !0,
1043
- error: void 0
1044
- });
1045
- try {
1046
- await e.context.recordActions(t);
1047
- let r = await e.context.http.request({
1048
- method: "GET",
1049
- path: `/iam.user/${encodeURIComponent(t)}/sessions`
1050
- });
1051
- n(t) && d(t, {
1052
- records: r,
1053
- loading: !1
1054
- });
1055
- } catch (r) {
1056
- if (!n(t)) return;
1057
- let i = w(r, {
1058
- source: `${e.source}-sessions`,
1059
- phase: "load"
1060
- });
1061
- d(t, {
1062
- ...c(t),
1063
- loading: !1,
1064
- error: i.message
1065
- });
1066
- }
1067
- }
1068
- }
1069
- function o(e, n) {
1070
- let r = String(e.id ?? "");
1071
- r && (t.value = n ? Array.from(/* @__PURE__ */ new Set([...t.value, r])) : t.value.filter((e) => e !== r), n && c(r).records.length === 0 && i(r));
1072
- }
1073
- function s(e) {
1074
- if (e.type !== "iam.user.session.collectionChanged" || e.moduleAlias !== "iam.user") return;
1075
- let n = String(e.recordId ?? "");
1076
- n && t.value.includes(n) && i(n);
1077
- }
1078
- function c(e) {
1079
- return e ? n.value[e] ?? {
1080
- records: [],
1081
- loading: !1
1082
- } : {
1083
- records: [],
1084
- loading: !1
1085
- };
1086
- }
1087
- function l() {
1088
- r.reset(), t.value = [], n.value = {};
1089
- }
1090
- function d(e, t) {
1091
- n.value = {
1092
- ...n.value,
1093
- [e]: t
1094
- };
1095
- }
1096
- return {
1097
- handleUserRowExpand: o,
1098
- handleUserSessionBusinessEvent: s,
1099
- loadUserSessions: i,
1100
- reset: l,
1101
- userSessionState: c
1102
- };
1103
- }
1104
- //#endregion
1105
- //#region src/platform-admin-runtime/userModulePageEnhancement.ts
1106
- var kt = {
1107
- id: "iam-user-standard-page-enhancement",
1108
- target: { moduleAlias: "iam.user" },
1109
- navigator: { emptyListScope: ({ currentUser: e, selectedNavigatorRecords: t }) => {
1110
- if (!(e?.system !== !0 || Object.values(t).some(Boolean))) return [{
1111
- fieldName: "tenantId",
1112
- operator: "NULL",
1113
- values: []
1114
- }];
1115
- } },
1116
- list: {
1117
- rowExpansion: {
1118
- key: "iam-user-sessions",
1119
- component: /* @__PURE__ */ K({
1120
- name: "UserSessionListExpansion",
1121
- __name: "UserSessionListExpansion",
1122
- props: { context: {} },
1123
- setup(e) {
1124
- let n = e, r = R(() => n.context.record.id == null ? void 0 : String(n.context.record.id)), i = Ot({
1125
- context: n.context.module,
1126
- source: "iam-user-list-expansion"
1127
- }), a = R(() => i.userSessionState(r.value)), o = R(() => a.value.records.filter((e) => !e.current && n.context.module.can("revokeSession", r.value) === !0)), s = R(() => o.value.length > 1 && n.context.module.can("revokeSessions", r.value) === !0);
1128
- Z([r, () => n.context.expanded], ([e, t]) => {
1129
- e && i.handleUserRowExpand({ id: e }, t);
1130
- }, { immediate: !0 });
1131
- let c = t((e) => i.handleUserSessionBusinessEvent(e));
1132
- be(() => {
1133
- c.unsubscribe(), i.reset();
1134
- });
1135
- async function l(e) {
1136
- let t = r.value;
1137
- t && !e.current && n.context.module.can("revokeSession", t) === !0 && await E({
1138
- title: "下线登录会话",
1139
- content: "确认下线该登录会话?",
1140
- okText: "下线",
1141
- danger: !0
1142
- }) && (await n.context.module.http.request({
1143
- method: "POST",
1144
- path: `/iam.user/${encodeURIComponent(t)}/sessions/${encodeURIComponent(e.id)}/revoke`
1145
- }), i.loadUserSessions(t));
1146
- }
1147
- async function u() {
1148
- let e = r.value, t = o.value.map((e) => e.id);
1149
- e && t.length !== 0 && n.context.module.can("revokeSessions", e) === !0 && await E({
1150
- title: "全部下线",
1151
- content: `确认下线该用户的 ${t.length} 个登录会话?`,
1152
- okText: "全部下线",
1153
- danger: !0
1154
- }) && (await n.context.module.http.request({
1155
- method: "POST",
1156
- path: `/iam.user/${encodeURIComponent(e)}/sessions/revoke`,
1157
- body: { sessionIds: t }
1158
- }), i.loadUserSessions(e));
1159
- }
1160
- return (t, n) => (q(), z(X(p), {
1161
- embedded: "",
1162
- sessions: a.value.records,
1163
- loading: a.value.loading,
1164
- error: a.value.error,
1165
- "can-revoke": (t) => !t.current && e.context.module.can("revokeSession", r.value) === !0,
1166
- "can-revoke-all": s.value,
1167
- onRefresh: n[0] ||= (e) => X(i).loadUserSessions(r.value),
1168
- onRevoke: l,
1169
- onRevokeAll: u
1170
- }, null, 8, [
1171
- "sessions",
1172
- "loading",
1173
- "error",
1174
- "can-revoke",
1175
- "can-revoke-all"
1176
- ]));
1177
- }
1178
- })
1179
- },
1180
- columns: [{
1181
- key: "onlineStatus",
1182
- title: "在线状态",
1183
- width: "112px",
1184
- align: "center",
1185
- before: "enabled",
1186
- cell: St
1187
- }]
1188
- },
1189
- detail: { actions: [{
1190
- key: "iam-user-password",
1191
- actionCode: "changePassword",
1192
- title: "密码管理",
1193
- iconName: "lock",
1194
- state: (e) => ({ visible: e.id != null }),
1195
- run({ openDrawer: e }) {
1196
- e({
1197
- title: "密码管理",
1198
- width: "narrow",
1199
- component: Dt
1200
- });
1201
- }
1202
- }] }
1203
- }, At = "/iam.role/scope-selection/descriptor", jt = "/iam.role/scope-selection/candidates";
1204
- function Mt(e) {
1205
- return {
1206
- async descriptor() {
1207
- return Nt(await e.request({ path: At }));
1208
- },
1209
- async candidates(t) {
1210
- let n = Kt(t.pageNum) ?? 1, r = Kt(t.pageSize) ?? 100;
1211
- return Pt(await e.request({
1212
- method: "POST",
1213
- path: jt,
1214
- body: {
1215
- navigationKey: Ut(t.navigationKey, "navigationKey"),
1216
- level: t.level,
1217
- keyword: Ht(t.keyword),
1218
- parentId: Ht(t.parentId),
1219
- page: {
1220
- pageNum: n,
1221
- pageSize: r
1222
- }
1223
- }
1224
- }), n);
1225
- }
1226
- };
1227
- }
1228
- function Nt(e) {
1229
- let t = zt(e);
1230
- return {
1231
- directSelections: Bt(t.directSelections).flatMap(Ft),
1232
- navigations: Bt(t.navigations).flatMap(It)
1233
- };
1234
- }
1235
- function Pt(e, t) {
1236
- let n = zt(e), r = Bt(n.records).flatMap(Lt), i = Gt(n.pageNum) ?? t, a = Gt(n.pages), o = Wt(n.totalKnown, !0) && a != null ? i < a : r.length > 0;
1237
- return {
1238
- records: r,
1239
- hasMore: o,
1240
- ...o ? { nextPage: i + 1 } : {}
1241
- };
1242
- }
1243
- function Ft(e) {
1244
- let t = zt(e), n = Vt(t.selectionKey);
1245
- return n ? [{
1246
- selectionKey: n,
1247
- label: Vt(t.title ?? t.label) ?? n
1248
- }] : [];
1249
- }
1250
- function It(e) {
1251
- let t = zt(e), n = Vt(t.navigationKey), r = Rt(t.level);
1252
- return !n || !r ? [] : [{
1253
- navigationKey: n,
1254
- level: r,
1255
- label: Vt(t.title ?? t.label) ?? n
1256
- }];
1257
- }
1258
- function Lt(e) {
1259
- let t = zt(e), n = Vt(t.id), r = Vt(t.selectionKey);
1260
- return !n || !r ? [] : [{
1261
- id: n,
1262
- selectionKey: r,
1263
- label: Vt(t.title ?? t.label) ?? r,
1264
- ...Vt(t.subtitle ?? t.secondaryLabel) ? { secondaryLabel: Vt(t.subtitle ?? t.secondaryLabel) } : {},
1265
- expandable: Wt(t.expandable, !1)
1266
- }];
1267
- }
1268
- function Rt(e) {
1269
- return e === "TENANT" || e === "ORGANIZATION" ? e : void 0;
1270
- }
1271
- function zt(e) {
1272
- return e && typeof e == "object" && !Array.isArray(e) ? e : {};
1273
- }
1274
- function Bt(e) {
1275
- return Array.isArray(e) ? e : [];
1276
- }
1277
- function Vt(e) {
1278
- return typeof e == "string" ? Ht(e) : void 0;
1279
- }
1280
- function Ht(e) {
1281
- return e?.trim() || void 0;
1282
- }
1283
- function Ut(e, t) {
1284
- let n = Ht(e);
1285
- if (!n) throw Error(`角色归属范围${t}不能为空`);
1286
- return n;
1287
- }
1288
- function Wt(e, t) {
1289
- return typeof e == "boolean" ? e : t;
1290
- }
1291
- function Gt(e) {
1292
- return typeof e == "number" && Number.isInteger(e) && e > 0 ? e : void 0;
1293
- }
1294
- function Kt(e) {
1295
- return typeof e == "number" && Number.isInteger(e) && e > 0 ? e : void 0;
1296
- }
1297
- //#endregion
1298
- //#region src/platform-admin-runtime/role/RoleScopeTree.vue
1299
- var qt = /* @__PURE__ */ K({
1300
- name: "RoleScopeTree",
1301
- __name: "RoleScopeTree",
1302
- props: { context: {} },
1303
- setup(e) {
1304
- let t = e, n = Mt(ut()), r = J(), i = J(""), a = J(!1), o = J([]), s = J([]), c = J(0), l = J(/* @__PURE__ */ new Map()), u = R(() => t.context.selectionKey), f = R(() => r.value?.navigations.some((e) => e.level === "TENANT") === !0), p = R(() => r.value?.navigations.length !== 0), m = R(() => f.value ? "租户" : "机构"), h = O({
1305
- nodes: () => o.value,
1306
- loader: () => ee,
1307
- version: () => c.value
1308
- }), g = h.nodes, _ = h.states, v = 0, b;
1309
- ye(() => void x()), ve(() => {
1310
- v += 1, b && clearTimeout(b);
1311
- }), Z(i, () => {
1312
- p.value && (b && clearTimeout(b), b = setTimeout(() => void C(), 240));
1313
- });
1314
- async function x() {
1315
- a.value = !0;
1316
- try {
1317
- r.value = await n.descriptor();
1318
- let e = r.value.directSelections[0];
1319
- !t.context.selectionKey && e && ne({
1320
- key: e.selectionKey,
1321
- label: e.label
1322
- }), await S();
1323
- } catch (e) {
1324
- w(e, {
1325
- source: "role-scope-tree",
1326
- phase: "load"
1327
- });
1328
- } finally {
1329
- a.value = !1;
1330
- }
1331
- }
1332
- async function S(e = {}) {
1333
- let t = r.value;
1334
- if (!t) return;
1335
- let n = ++v;
1336
- if (!e.append) {
1337
- s.value = [], c.value += 1, a.value = !0;
1338
- try {
1339
- let e = T(t);
1340
- if (n !== v) return;
1341
- l.value = /* @__PURE__ */ new Map(), A(e), o.value = e.map((e) => e.ui);
1342
- } catch (e) {
1343
- if (n !== v) return;
1344
- o.value = [], w(e, {
1345
- source: "role-scope-tree",
1346
- phase: "load"
1347
- });
1348
- } finally {
1349
- n === v && (a.value = !1);
1350
- }
1351
- }
1352
- }
1353
- async function C() {
1354
- if (await S(), !i.value.trim()) return;
1355
- let e = (r.value?.navigations ?? []).map((e) => `navigation:${e.navigationKey}`);
1356
- s.value = e, await he(), await Promise.all(e.map((e) => h.request(e, "refresh")));
1357
- }
1358
- function T(e) {
1359
- return [
1360
- ...e.directSelections.map((e) => ({
1361
- ui: {
1362
- key: e.selectionKey,
1363
- title: e.label,
1364
- isLeaf: !0
1365
- },
1366
- selection: {
1367
- key: e.selectionKey,
1368
- label: e.label
1369
- }
1370
- })),
1371
- ...e.navigations.filter((e) => e.level === "ORGANIZATION").map((e) => E(e)),
1372
- ...e.navigations.filter((e) => e.level === "TENANT").map((e) => E(e))
1373
- ];
1374
- }
1375
- function E(e) {
1376
- return {
1377
- ui: {
1378
- key: `navigation:${e.navigationKey}`,
1379
- title: e.label,
1380
- isLeaf: !1
1381
- },
1382
- children: {
1383
- navigationKey: e.navigationKey,
1384
- level: e.level
1385
- }
1386
- };
1387
- }
1388
- function D(e, t, n) {
1389
- let r = k(e, t, n);
1390
- return {
1391
- ui: {
1392
- key: e.selectionKey,
1393
- title: e.label,
1394
- secondary: e.secondaryLabel,
1395
- isLeaf: !r
1396
- },
1397
- selection: {
1398
- key: e.selectionKey,
1399
- label: e.label,
1400
- secondaryLabel: e.secondaryLabel
1401
- },
1402
- children: r
1403
- };
1404
- }
1405
- function k(e, t, n) {
1406
- return t === "TENANT" ? {
1407
- navigationKey: e.selectionKey,
1408
- level: "ORGANIZATION"
1409
- } : e.expandable ? {
1410
- navigationKey: n,
1411
- level: "ORGANIZATION",
1412
- parentId: e.id
1413
- } : void 0;
1414
- }
1415
- async function ee(e, t) {
1416
- let r = l.value.get(e.key);
1417
- if (!r?.children) throw Error("角色归属范围已失效");
1418
- try {
1419
- let e = await n.candidates({
1420
- ...r.children,
1421
- keyword: i.value.trim() || void 0,
1422
- pageNum: t.reason === "load-more" ? Number(t.cursor) : 1
1423
- });
1424
- t.signal.throwIfAborted();
1425
- let a = e.records.map((e) => D(e, r.children.level, r.children.navigationKey));
1426
- return A(a), {
1427
- mode: t.reason === "load-more" ? "append" : "replace",
1428
- nodes: a.map((e) => e.ui),
1429
- hasMore: e.hasMore,
1430
- nextCursor: e.nextPage == null ? void 0 : String(e.nextPage)
1431
- };
1432
- } catch (e) {
1433
- throw t.signal.aborted || w(e, {
1434
- source: "role-scope-tree",
1435
- phase: "load"
1436
- }), e;
1437
- }
1438
- }
1439
- function A(e) {
1440
- let t = new Map(l.value);
1441
- e.forEach((e) => t.set(e.ui.key, e)), l.value = t;
1442
- }
1443
- function te(e) {
1444
- let t = l.value.get(e.key)?.selection;
1445
- t && ne(t);
1446
- }
1447
- function ne(e) {
1448
- t.context.selectSelectionKey(e.key, {
1449
- label: e.label,
1450
- secondaryLabel: e.secondaryLabel
1451
- });
1452
- }
1453
- function M() {
1454
- let e = r.value?.directSelections[0];
1455
- e && ne({
1456
- key: e.selectionKey,
1457
- label: e.label
1458
- });
1459
- }
1460
- return (e, t) => (q(), z(X(y), {
1461
- class: "role-scope-tree",
1462
- title: m.value,
1463
- "refresh-title": "刷新角色归属范围",
1464
- "search-keyword": i.value,
1465
- "search-placeholder": "搜索名称、编码或标识",
1466
- searchable: p.value,
1467
- onRefresh: S,
1468
- "onUpdate:searchKeyword": t[3] ||= (e) => i.value = e
1469
- }, {
1470
- default: Q(() => [a.value ? (q(), z(X(d), {
1471
- key: 0,
1472
- tip: "加载角色归属范围"
1473
- })) : (q(), z(X(j), {
1474
- key: 1,
1475
- "expanded-keys": s.value,
1476
- "onUpdate:expandedKeys": t[0] ||= (e) => s.value = e,
1477
- nodes: X(g),
1478
- "selected-key": u.value,
1479
- "reload-key": c.value,
1480
- "load-strategy": "controlled",
1481
- "reload-on-reexpand": "",
1482
- "branch-states": X(_),
1483
- onLoadRequest: t[1] ||= (e) => X(h).request(e.node.key, e.reason, X(h).stateOf(e.node.key).status === "error"),
1484
- onSelect: te,
1485
- onDeselect: M,
1486
- onUnloadChildren: t[2] ||= (e) => X(h).release(e.key)
1487
- }, null, 8, [
1488
- "expanded-keys",
1489
- "nodes",
1490
- "selected-key",
1491
- "reload-key",
1492
- "branch-states"
1493
- ]))]),
1494
- _: 1
1495
- }, 8, [
1496
- "title",
1497
- "search-keyword",
1498
- "searchable"
1499
- ]));
1500
- }
1501
- }), Jt = /* @__PURE__ */ K({
1502
- name: "RoleEnumTitleCell",
1503
- __name: "RoleEnumTitleCell",
1504
- props: {
1505
- record: {},
1506
- column: {}
1507
- },
1508
- setup(e) {
1509
- let t = e, n = R(() => {
1510
- let e = String(t.record[t.column?.key ?? ""] ?? "");
1511
- return {
1512
- account: "账号角色",
1513
- employment: "任职角色",
1514
- standard: "标准角色",
1515
- group: "角色组",
1516
- dataGrant: "数据授权角色",
1517
- system: "系统角色",
1518
- private: "私有",
1519
- ownerAndChildren: "本级及下级",
1520
- tenant: "租户公开",
1521
- platform: "全局公开"
1522
- }[e] ?? (e || "-");
1523
- });
1524
- return (e, t) => (q(), V("span", null, Y(n.value), 1));
1525
- }
1526
- });
1527
- //#endregion
1528
- //#region src/views/roleGrantClient.ts
1529
- function Yt(e) {
1530
- return {
1531
- accountRoleGrants(t, n) {
1532
- return e.request({
1533
- path: `/iam.role/${encodeURIComponent(t)}/account-grants`,
1534
- query: n ? { targetTenantId: n } : void 0
1535
- });
1536
- },
1537
- grantAccountRole(t, n) {
1538
- return e.request({
1539
- method: "POST",
1540
- path: `/iam.role/${encodeURIComponent(t)}/account-grants`,
1541
- body: n
1542
- });
1543
- },
1544
- deleteAccountRoleGrant(t, n, r) {
1545
- return e.request({
1546
- method: "POST",
1547
- path: `/iam.role/${encodeURIComponent(t)}/account-grants/${encodeURIComponent(n)}/delete`,
1548
- query: r ? { targetTenantId: r } : void 0
1549
- });
1550
- },
1551
- accountRoleCandidates(t, n) {
1552
- return e.request({
1553
- method: "POST",
1554
- path: `/iam.role/${encodeURIComponent(t)}/account-role-candidates/query`,
1555
- body: n
1556
- });
1557
- },
1558
- employmentRoleGrants(t) {
1559
- return e.request({ path: `/iam.role/${encodeURIComponent(t)}/employment-grants` });
1560
- },
1561
- grantEmploymentRole(t, n) {
1562
- return e.request({
1563
- method: "POST",
1564
- path: `/iam.role/${encodeURIComponent(t)}/employment-grants`,
1565
- body: { employeePositionId: n }
1566
- });
1567
- },
1568
- deleteEmploymentRoleGrant(t, n) {
1569
- return e.request({
1570
- method: "POST",
1571
- path: `/iam.role/${encodeURIComponent(t)}/employment-grants/${encodeURIComponent(n)}/delete`
1572
- });
1573
- },
1574
- employmentSelector(t, n) {
1575
- return e.request({
1576
- method: "POST",
1577
- path: `/iam.role/${encodeURIComponent(t)}/employment-selector/query`,
1578
- body: n
1579
- });
1580
- },
1581
- authorizationModules(t) {
1582
- return e.request({ path: `/iam.role/authorizationModules/${encodeURIComponent(t)}` });
1583
- },
1584
- permissionMatrix(t, n) {
1585
- return e.request({
1586
- method: "POST",
1587
- path: `/iam.role/permissionMatrix/${encodeURIComponent(t)}`,
1588
- body: { moduleAliases: n }
1589
- });
1590
- },
1591
- grantAction(t, n) {
1592
- return e.request({
1593
- method: "POST",
1594
- path: `/iam.role/grant/${encodeURIComponent(t)}`,
1595
- body: n
1596
- });
1597
- },
1598
- revokeAction(t, n, r) {
1599
- return e.request({
1600
- method: "POST",
1601
- path: `/iam.role/revoke/${encodeURIComponent(t)}`,
1602
- body: {
1603
- moduleAlias: n,
1604
- actionCode: r
1605
- }
1606
- });
1607
- },
1608
- replacePermissionMatrix(t, n) {
1609
- return e.request({
1610
- method: "POST",
1611
- path: `/iam.role/permissionMatrix/${encodeURIComponent(t)}/replace`,
1612
- body: { actions: n }
1613
- });
1614
- },
1615
- dataGrantActionMatrix(t) {
1616
- return e.request({ path: `/iam.role/dataGrantActionMatrix/${encodeURIComponent(t)}` });
1617
- },
1618
- dataScopePolicyCatalog(t, n) {
1619
- return e.request({
1620
- path: `/iam.role/dataScopePolicyCatalog/${encodeURIComponent(t)}`,
1621
- query: n ? { moduleAlias: n } : void 0
1622
- });
1623
- },
1624
- replaceDataGrantActions(t, n) {
1625
- return e.request({
1626
- method: "POST",
1627
- path: `/iam.role/dataGrantActions/${encodeURIComponent(t)}`,
1628
- body: { actions: n }
1629
- });
1630
- }
1631
- };
1632
- }
1633
- //#endregion
1634
- //#region src/views/RoleAccountGrantDrawer.vue?vue&type=script&setup=true&lang.ts
1635
- var Xt = {
1636
- key: 1,
1637
- class: "role-account-grant-drawer-state"
1638
- }, Zt = {
1639
- key: 0,
1640
- class: "role-account-grant-target-tenant"
1641
- }, Qt = {
1642
- key: 1,
1643
- class: "role-account-grant-target-hint"
1644
- }, $t = { class: "role-account-grant-search" }, en = {
1645
- key: 0,
1646
- class: "role-account-grant-selected"
1647
- }, tn = { class: "role-account-grant-selected-title" }, nn = { class: "role-account-grant-selected-list" }, rn = ["disabled", "onClick"], an = 20, on = /*#__PURE__*/ h(/* @__PURE__ */ K({
1648
- name: "RoleAccountGrantDrawer",
1649
- __name: "RoleAccountGrantDrawer",
1650
- props: {
1651
- open: { type: Boolean },
1652
- container: {},
1653
- embedded: { type: Boolean },
1654
- drawerContext: {},
1655
- context: {},
1656
- role: {}
1657
- },
1658
- emits: ["close", "saved"],
1659
- setup(e, { emit: t }) {
1660
- let n = e, r = t, i = J([]), a = J({}), o = J([]), s = J(/* @__PURE__ */ new Set()), c = J(/* @__PURE__ */ new Set()), l = J(""), u = J(""), p = J(1), m = J(0), h = J(!1), g = J(!1), y = J(!1), b = J(!1), x = J(), C = R(() => Yt(n.context.http)), T = _({ moduleAlias: "iam.tenant" }), E = R(() => n.role?.id), O = R(() => n.role ? `绑定用户 - ${je(n.role)}` : "绑定用户"), ee = R(() => n.embedded ? "section" : ne), A = R(() => n.embedded ? {} : {
1661
- open: n.open,
1662
- title: O.value,
1663
- renderMode: n.container ? "inline" : "portal",
1664
- closeTitle: "关闭",
1665
- onClose: ye
1666
- }), te = R(() => n.role?.ownerScopeType === "platform"), j = R(() => x.value?.id), M = R(() => !te.value || !!j.value), re = R(() => T), ie = R(() => {
1667
- let e = /* @__PURE__ */ new Map();
1668
- for (let t of i.value) t.userId && e.set(t.userId, t);
1669
- return e;
1670
- }), ae = R(() => o.value.filter((e) => e.id).map((e) => ({
1671
- id: e.id,
1672
- username: ke(e),
1673
- employeeNo: e.employeeNo ?? "",
1674
- employeeTitle: e.employeeTitle ?? "",
1675
- organizationTitle: e.organizationTitle ?? e.organizationId ?? "",
1676
- departmentTitle: e.departmentTitle ?? e.departmentId ?? "",
1677
- boundTitle: c.value.has(e.id) ? "已绑定" : "未绑定"
1678
- }))), N = R(() => [...s.value].map((e) => a.value[e] ?? Oe(e))), P = R(() => [...s.value].filter((e) => !c.value.has(e))), F = R(() => [...c.value].filter((e) => !s.value.has(e))), I = R(() => P.value.length > 0 || F.value.length > 0), se = {
1679
- rowKey: "id",
1680
- columns: [
1681
- {
1682
- title: "用户账号",
1683
- key: "username",
1684
- width: 140
1685
- },
1686
- {
1687
- title: "职员姓名",
1688
- key: "employeeTitle",
1689
- width: 120
1690
- },
1691
- {
1692
- title: "职员工号",
1693
- key: "employeeNo",
1694
- width: 120
1695
- },
1696
- {
1697
- title: "所属机构",
1698
- key: "organizationTitle",
1699
- width: 140
1700
- },
1701
- {
1702
- title: "所属部门",
1703
- key: "departmentTitle",
1704
- width: 140
1705
- },
1706
- {
1707
- title: "状态",
1708
- key: "boundTitle",
1709
- width: 90
1710
- }
1711
- ]
1712
- }, ce = R(() => ({
1713
- selectedRowKeys: [...s.value],
1714
- preserveSelectedRowKeys: !0,
1715
- disabledOf: () => y.value,
1716
- onChange: (e) => {
1717
- s.value = new Set(e.map((e) => String(e)));
1718
- }
1719
- })), le = R(() => ({
1720
- current: p.value,
1721
- total: m.value,
1722
- pageSize: an,
1723
- showSizeChanger: !1,
1724
- showQuickJumper: !1,
1725
- onChange: (e) => void K(e)
1726
- }));
1727
- Z(() => [n.open, n.role?.id], ([e]) => {
1728
- e ? G() : be();
1729
- }, { immediate: !0 }), Z([
1730
- () => n.embedded,
1731
- () => n.drawerContext,
1732
- s,
1733
- I,
1734
- M,
1735
- P,
1736
- F,
1737
- y,
1738
- h
1739
- ], ue, { immediate: !0 }), ve(() => n.drawerContext?.setOperation(void 0));
1740
- function ue() {
1741
- let e = n.drawerContext;
1742
- n.embedded && e && (e.setSubtitle(`角色:${je(n.role ?? {})} · ${Me(n.role)}`), e.setOperation({
1743
- summary: de(),
1744
- actions: [{
1745
- key: "cancel-account-role-grants",
1746
- label: "取消",
1747
- disabled: y.value || h.value,
1748
- run: ye
1749
- }, {
1750
- key: "save-account-role-grants",
1751
- label: "确定",
1752
- emphasis: "primary",
1753
- disabled: h.value || !M.value || !I.value,
1754
- loading: y.value,
1755
- run: () => void _e()
1756
- }]
1757
- }));
1758
- }
1759
- function de() {
1760
- return M.value ? I.value ? `已选 ${s.value.size} 个用户 · 新增 ${P.value.length} · 移除 ${F.value.length}` : `已选 ${s.value.size} 个用户` : "请选择目标租户";
1761
- }
1762
- async function G() {
1763
- let e = E.value;
1764
- if (!e) {
1765
- be();
1766
- return;
1767
- }
1768
- if (!M.value) {
1769
- Se();
1770
- return;
1771
- }
1772
- h.value = !0, b.value = !1;
1773
- try {
1774
- let t = await C.value.accountRoleGrants(e, j.value);
1775
- i.value = t;
1776
- let n = new Set(t.map((e) => e.userId).filter((e) => !!e));
1777
- c.value = n, s.value = new Set(n), a.value = De([...t.map((e) => Oe(e.userId)).filter((e) => !!e)]), await K(1);
1778
- } catch (e) {
1779
- b.value = !0, w(e, {
1780
- source: "role-account-grants",
1781
- phase: "load"
1782
- });
1783
- } finally {
1784
- h.value = !1;
1785
- }
1786
- }
1787
- async function K(e) {
1788
- let t = E.value;
1789
- if (t && M.value) {
1790
- g.value = !0;
1791
- try {
1792
- let n = await C.value.accountRoleCandidates(t, {
1793
- targetTenantId: j.value,
1794
- keyword: u.value,
1795
- enabledOnly: !0,
1796
- page: {
1797
- pageNum: Math.max(0, e),
1798
- pageSize: an
1799
- }
1800
- });
1801
- o.value = n.records, a.value = {
1802
- ...a.value,
1803
- ...De(n.records)
1804
- }, p.value = n.pageNum, m.value = n.total;
1805
- } catch (e) {
1806
- w(e, {
1807
- source: "role-account-grants",
1808
- phase: "load"
1809
- });
1810
- } finally {
1811
- g.value = !1;
1812
- }
1813
- }
1814
- }
1815
- function pe() {
1816
- u.value = l.value.trim(), K(0);
1817
- }
1818
- function he(e, t) {
1819
- let n = new Set(s.value);
1820
- t ? n.add(e) : n.delete(e), s.value = n;
1821
- }
1822
- async function _e() {
1823
- let e = E.value;
1824
- if (e && M.value) {
1825
- if (!I.value) {
1826
- r("close");
1827
- return;
1828
- }
1829
- y.value = !0;
1830
- try {
1831
- for (let t of P.value) await C.value.grantAccountRole(e, {
1832
- userId: t,
1833
- targetTenantId: j.value
1834
- });
1835
- for (let t of F.value) {
1836
- let n = ie.value.get(t)?.id;
1837
- n && await C.value.deleteAccountRoleGrant(e, n, j.value);
1838
- }
1839
- await f({
1840
- success: !0,
1841
- message: "用户绑定已保存"
1842
- }, {
1843
- source: "role-account-grants",
1844
- phase: "action",
1845
- fallbackMessage: "用户绑定已保存"
1846
- }), r("saved"), r("close");
1847
- } catch (e) {
1848
- w(e, {
1849
- source: "role-account-grants",
1850
- phase: "action"
1851
- });
1852
- } finally {
1853
- y.value = !1;
1854
- }
1855
- }
1856
- }
1857
- function ye() {
1858
- y.value || r("close");
1859
- }
1860
- function be() {
1861
- x.value = void 0, Se();
1862
- }
1863
- function Se() {
1864
- i.value = [], a.value = {}, o.value = [], s.value = /* @__PURE__ */ new Set(), c.value = /* @__PURE__ */ new Set(), l.value = "", u.value = "", p.value = 1, m.value = 0, h.value = !1, g.value = !1, y.value = !1, b.value = !1;
1865
- }
1866
- async function we(e) {
1867
- if (!e) {
1868
- x.value = void 0, Se();
1869
- return;
1870
- }
1871
- let t = await T.crud.view(e);
1872
- x.value = t ?? {
1873
- id: e,
1874
- title: e
1875
- }, await G();
1876
- }
1877
- function Ee(e) {
1878
- he(e, !1);
1879
- }
1880
- function De(e) {
1881
- let t = {};
1882
- for (let n of e) n.id && (t[n.id] = n);
1883
- return t;
1884
- }
1885
- function Oe(e) {
1886
- return e ? {
1887
- id: e,
1888
- username: e
1889
- } : void 0;
1890
- }
1891
- function ke(e) {
1892
- return String(e?.username ?? e?.id ?? "未知用户");
1893
- }
1894
- function Ae(e) {
1895
- return e.employeeTitle && e.employeeNo ? `${e.employeeTitle} / ${e.employeeNo}` : e.employeeTitle ?? e.employeeNo ?? e.employeeId ?? e.id;
1896
- }
1897
- function je(e) {
1898
- return String(e.title ?? e.id ?? "角色");
1899
- }
1900
- function Me(e) {
1901
- return e?.ownerScopeType === "platform" ? "平台范围" : e?.ownerScopeType === "organization" ? "机构范围" : "租户范围";
1902
- }
1903
- return (t, n) => (q(), z(Ce(ee.value), me(A.value, { class: { "role-account-grant-drawer-surface": e.embedded } }), fe({
1904
- default: Q(() => [h.value ? (q(), z(X(d), {
1905
- key: 0,
1906
- class: "role-account-grant-drawer-state",
1907
- tip: "加载用户"
1908
- })) : b.value ? (q(), V("div", Xt, [W(X(v), {
1909
- title: "用户加载失败",
1910
- message: "无法加载当前角色的用户绑定"
1911
- }), W(X(S), {
1912
- type: "primary",
1913
- "icon-name": "reload",
1914
- onClick: G
1915
- }, {
1916
- default: Q(() => [...n[3] ||= [U("重试", -1)]]),
1917
- _: 1
1918
- })])) : (q(), V("section", {
1919
- key: 2,
1920
- class: ge(["role-account-grant-drawer-body", { "role-account-grant-drawer-body--target-tenant": te.value }])
1921
- }, [te.value ? (q(), V("label", Zt, [n[4] ||= H("span", null, "目标租户", -1), W(X(oe), {
1922
- context: re.value,
1923
- value: j.value,
1924
- mode: "list",
1925
- placeholder: "请选择角色下发的目标租户",
1926
- disabled: y.value || h.value,
1927
- "onUpdate:value": we
1928
- }, null, 8, [
1929
- "context",
1930
- "value",
1931
- "disabled"
1932
- ])])) : B("v-if", !0), M.value ? (q(), V(L, { key: 2 }, [
1933
- H("div", $t, [W(X(k), {
1934
- value: l.value,
1935
- "allow-clear": "",
1936
- disabled: y.value,
1937
- placeholder: "搜索用户账号",
1938
- "onUpdate:value": n[0] ||= (e) => l.value = e,
1939
- onKeydown: Te(pe, ["enter"])
1940
- }, null, 8, ["value", "disabled"]), W(X(S), {
1941
- "icon-name": "search",
1942
- disabled: y.value,
1943
- onClick: pe
1944
- }, {
1945
- default: Q(() => [...n[5] ||= [U("查询", -1)]]),
1946
- _: 1
1947
- }, 8, ["disabled"])]),
1948
- W(X(D), {
1949
- class: "role-account-grant-table",
1950
- size: "middle",
1951
- contract: se,
1952
- rows: ae.value,
1953
- loading: g.value,
1954
- pagination: le.value,
1955
- selection: ce.value,
1956
- "fill-height": ""
1957
- }, null, 8, [
1958
- "rows",
1959
- "loading",
1960
- "pagination",
1961
- "selection"
1962
- ]),
1963
- N.value.length > 0 ? (q(), V("section", en, [H("div", tn, [n[6] ||= H("strong", null, "已选用户", -1), H("span", null, Y(N.value.length) + " 个", 1)]), H("div", nn, [(q(!0), V(L, null, xe(N.value, (e) => (q(), V("button", {
1964
- key: e.id,
1965
- type: "button",
1966
- disabled: y.value,
1967
- onClick: (t) => Ee(e.id)
1968
- }, [H("span", null, Y(ke(e)), 1), H("small", null, Y(Ae(e)), 1)], 8, rn))), 128))])])) : B("v-if", !0)
1969
- ], 64)) : (q(), V("div", Qt, " 平台共享角色需要先选择目标租户,再加载可绑定账号。 "))], 2))]),
1970
- _: 2
1971
- }, [e.embedded ? void 0 : {
1972
- name: "operation",
1973
- fn: Q(() => [W(X(S), {
1974
- disabled: y.value || h.value,
1975
- onClick: ye
1976
- }, {
1977
- default: Q(() => [...n[1] ||= [U("取消", -1)]]),
1978
- _: 1
1979
- }, 8, ["disabled"]), W(X(S), {
1980
- type: "primary",
1981
- loading: y.value,
1982
- disabled: h.value || !I.value,
1983
- onClick: _e
1984
- }, {
1985
- default: Q(() => [...n[2] ||= [U(" 确定 ", -1)]]),
1986
- _: 1
1987
- }, 8, ["loading", "disabled"])]),
1988
- key: "0"
1989
- }]), 1040, ["class"]));
1990
- }
1991
- }), [["__scopeId", "data-v-fc27c9ca"]]), sn = /* @__PURE__ */ K({
1992
- name: "RoleAccountGrantDrawerSurface",
1993
- __name: "RoleAccountGrantDrawerSurface",
1994
- props: { context: {} },
1995
- setup(e) {
1996
- let t = e, n = R(() => t.context.module), r = R(() => t.context.record);
1997
- return (e, i) => (q(), z(on, {
1998
- open: "",
1999
- embedded: "",
2000
- "drawer-context": t.context,
2001
- context: n.value,
2002
- role: r.value,
2003
- onClose: t.context.close,
2004
- onSaved: t.context.refreshList
2005
- }, null, 8, [
2006
- "drawer-context",
2007
- "context",
2008
- "role",
2009
- "onClose",
2010
- "onSaved"
2011
- ]));
2012
- }
2013
- }), cn = /*#__PURE__*/ h(/* @__PURE__ */ K({
2014
- name: "EmployeeEmploymentTable",
2015
- __name: "EmployeeEmploymentTable",
2016
- props: {
2017
- rows: {},
2018
- selectedIds: { default: () => /* @__PURE__ */ new Set() },
2019
- selectable: {
2020
- type: Boolean,
2021
- default: !1
2022
- },
2023
- disabled: {
2024
- type: Boolean,
2025
- default: !1
2026
- },
2027
- pagination: {
2028
- type: [Boolean, Object],
2029
- default: !1
2030
- },
2031
- fillHeight: {
2032
- type: Boolean,
2033
- default: !1
2034
- }
2035
- },
2036
- emits: ["update:selectedIds"],
2037
- setup(e, { emit: t }) {
2038
- let n = e, r = t, i = J([]), a = [
2039
- {
2040
- key: "title",
2041
- title: "职员",
2042
- width: 160
2043
- },
2044
- {
2045
- key: "employeeNo",
2046
- title: "工号",
2047
- width: 140
2048
- },
2049
- {
2050
- key: "organizationTitle",
2051
- title: "所属机构",
2052
- width: 180
2053
- },
2054
- {
2055
- key: "employmentCount",
2056
- title: "任职",
2057
- width: 88,
2058
- align: "right"
2059
- },
2060
- {
2061
- key: "selectedCount",
2062
- title: "已选",
2063
- width: 88,
2064
- align: "right"
2065
- }
2066
- ], o = [
2067
- {
2068
- key: "position",
2069
- title: "岗位",
2070
- width: 160
2071
- },
2072
- {
2073
- key: "organization",
2074
- title: "机构",
2075
- width: 160
2076
- },
2077
- {
2078
- key: "department",
2079
- title: "部门",
2080
- width: 160
2081
- },
2082
- {
2083
- key: "primaryPosition",
2084
- title: "主岗位",
2085
- width: 88
2086
- }
2087
- ], s = R(() => {
2088
- let e = /* @__PURE__ */ new Map();
2089
- for (let t of n.rows) {
2090
- let n = t.employeeId ?? t.id, r = e.get(n) ?? {
2091
- employeeId: n,
2092
- title: t.employeeTitle ?? n,
2093
- employeeNo: t.employeeNo,
2094
- organizationTitle: t.organizationTitle,
2095
- positions: []
2096
- };
2097
- r.positions.push(t), e.set(n, r);
2098
- }
2099
- return [...e.values()];
2100
- }), c = R(() => s.value);
2101
- function l(e, t) {
2102
- let n = t;
2103
- return e.key === "title" ? n.title : e.key === "employeeNo" ? n.employeeNo ?? n.employeeId : e.key === "organizationTitle" ? n.organizationTitle ?? "-" : e.key === "employmentCount" ? `${n.positions.length} 项` : e.key === "selectedCount" ? `${d(n)} 项` : "";
2104
- }
2105
- function u(e, t) {
2106
- let n = t;
2107
- return e.key === "position" ? n.positionTitle ?? n.positionId : e.key === "organization" ? n.organizationTitle ?? n.organizationId : e.key === "department" ? n.departmentTitle ?? n.departmentId : e.key === "primaryPosition" ? n.primaryPosition ? "是" : "否" : "";
2108
- }
2109
- function d(e) {
2110
- return e.positions.filter((e) => n.selectedIds.has(e.id)).length;
2111
- }
2112
- function f(e) {
2113
- if (n.selectable) return {
2114
- selectedRowKeys: e.positions.filter((e) => n.selectedIds.has(e.id)).map((e) => e.id),
2115
- preserveSelectedRowKeys: !0,
2116
- disabledOf: () => n.disabled,
2117
- onChange: (t) => p(e, t)
2118
- };
2119
- }
2120
- function p(e, t) {
2121
- let i = new Set(n.selectedIds);
2122
- for (let t of e.positions) i.delete(t.id);
2123
- for (let e of t) i.add(String(e));
2124
- r("update:selectedIds", i);
2125
- }
2126
- function m(e, t) {
2127
- let n = e.employeeId;
2128
- i.value = t ? Array.from(/* @__PURE__ */ new Set([...i.value, n])) : i.value.filter((e) => e !== n);
2129
- }
2130
- function h(e) {
2131
- let t = e.employeeId;
2132
- m(e, !i.value.includes(t));
2133
- }
2134
- return (t, n) => (q(), z(X(M), {
2135
- class: "employee-employment-table",
2136
- columns: a,
2137
- rows: c.value,
2138
- "row-key": "employeeId",
2139
- pagination: e.pagination,
2140
- "expanded-row-keys": i.value,
2141
- "clickable-rows": "",
2142
- "horizontal-scroll": "",
2143
- "fill-height": e.fillHeight,
2144
- onRowExpand: m,
2145
- onRowDblclick: h
2146
- }, {
2147
- cell: Q(({ column: e, record: t }) => [U(Y(l(e, t)), 1)]),
2148
- expandedRow: Q(({ record: e }) => [W(X(x), { title: "任职信息" }, {
2149
- default: Q(() => [W(X(M), {
2150
- columns: o,
2151
- rows: e.positions,
2152
- "row-key": "id",
2153
- pagination: !1,
2154
- selection: f(e),
2155
- "horizontal-scroll": "",
2156
- "row-muted": (e) => e.enabled === !1
2157
- }, {
2158
- cell: Q(({ column: e, record: t }) => [U(Y(u(e, t)), 1)]),
2159
- _: 1
2160
- }, 8, [
2161
- "rows",
2162
- "selection",
2163
- "row-muted"
2164
- ])]),
2165
- _: 2
2166
- }, 1024)]),
2167
- _: 1
2168
- }, 8, [
2169
- "rows",
2170
- "pagination",
2171
- "expanded-row-keys",
2172
- "fill-height"
2173
- ]));
2174
- }
2175
- }), [["__scopeId", "data-v-21f1027e"]]), ln = { key: 1 }, un = {
2176
- key: 2,
2177
- class: "role-employment-grant-body"
2178
- }, dn = {
2179
- key: 0,
2180
- class: "role-employment-grant-selected"
2181
- }, fn = { class: "role-employment-grant-selected-title" }, pn = { class: "role-employment-grant-selected-list" }, mn = ["disabled", "onClick"], hn = /*#__PURE__*/ h(/* @__PURE__ */ K({
2182
- name: "RoleEmploymentGrantDrawer",
2183
- __name: "RoleEmploymentGrantDrawer",
2184
- props: {
2185
- open: { type: Boolean },
2186
- container: {},
2187
- embedded: { type: Boolean },
2188
- drawerContext: {},
2189
- context: {},
2190
- role: {}
2191
- },
2192
- emits: ["close", "saved"],
2193
- setup(e, { emit: t }) {
2194
- let n = e, r = t, i = J([]), a = J([]), o = J({}), s = J(/* @__PURE__ */ new Set()), c = J(/* @__PURE__ */ new Set()), l = J(!1), u = J(!1), p = J(!1), m = J(!1), h = J(1), g = J(0), _ = J(""), y = R(() => n.role?.id), b = R(() => Yt(n.context.http)), x = R(() => `绑定任职 - ${n.role?.title ?? n.role?.id ?? ""}`), C = R(() => n.embedded ? "section" : ne), T = R(() => n.embedded ? {} : {
2195
- open: n.open,
2196
- title: x.value,
2197
- renderMode: n.container ? "inline" : "portal",
2198
- closeTitle: "关闭",
2199
- onClose: () => !p.value && r("close")
2200
- }), E = R(() => [...s.value].filter((e) => !c.value.has(e))), D = R(() => [...c.value].filter((e) => !s.value.has(e))), O = R(() => new Map(i.value.map((e) => [e.employeePositionId, e]))), ee = R(() => a.value.filter((e) => !_.value.trim() || ae(e).includes(_.value.trim()))), A = R(() => [...s.value].map((e) => o.value[e] ?? P(e))), te = R(() => ({
2201
- current: h.value,
2202
- total: g.value,
2203
- pageSize: 50,
2204
- showSizeChanger: !1,
2205
- showQuickJumper: !1,
2206
- onChange: (e) => void M(e)
2207
- }));
2208
- Z(() => [n.open, n.role?.id], ([e]) => {
2209
- e ? M() : ie();
2210
- }, { immediate: !0 }), Z([
2211
- () => n.embedded,
2212
- () => n.drawerContext,
2213
- s,
2214
- E,
2215
- D,
2216
- p,
2217
- u
2218
- ], j, { immediate: !0 }), ve(() => n.drawerContext?.setOperation(void 0));
2219
- function j() {
2220
- let e = n.drawerContext;
2221
- n.embedded && e && (e.setSubtitle(`角色:${n.role?.title ?? n.role?.id ?? "角色"} · ${se(n.role)}`), e.setOperation({
2222
- summary: `已选 ${s.value.size} 个任职${E.value.length || D.value.length ? ` · 新增 ${E.value.length} · 移除 ${D.value.length}` : ""}`,
2223
- actions: [{
2224
- key: "cancel-employment-role-grants",
2225
- label: "取消",
2226
- disabled: p.value,
2227
- run: () => r("close")
2228
- }, {
2229
- key: "save-employment-role-grants",
2230
- label: "确定",
2231
- emphasis: "primary",
2232
- disabled: u.value || E.value.length === 0 && D.value.length === 0,
2233
- loading: p.value,
2234
- run: () => void re()
2235
- }]
2236
- }));
2237
- }
2238
- async function M(e = 1) {
2239
- let t = y.value;
2240
- if (t) {
2241
- u.value = !0, m.value = !1;
2242
- try {
2243
- let [n, r] = await Promise.all([b.value.employmentRoleGrants(t), b.value.employmentSelector(t, {
2244
- enabledOnly: !0,
2245
- page: {
2246
- pageNum: e,
2247
- pageSize: 50
2248
- }
2249
- })]);
2250
- i.value = n, c.value = new Set(n.map((e) => e.employeePositionId).filter((e) => !!e)), o.value = {
2251
- ...o.value,
2252
- ...N(r.records)
2253
- }, l.value ||= (s.value = new Set(c.value), !0), a.value = r.records, h.value = r.pageNum, g.value = r.total;
2254
- } catch (e) {
2255
- m.value = !0, w(e, {
2256
- source: "role-employment-grants",
2257
- phase: "load"
2258
- });
2259
- } finally {
2260
- u.value = !1;
2261
- }
2262
- }
2263
- }
2264
- async function re() {
2265
- let e = y.value;
2266
- if (e) {
2267
- p.value = !0;
2268
- try {
2269
- for (let t of E.value) await b.value.grantEmploymentRole(e, t);
2270
- for (let t of D.value) {
2271
- let n = O.value.get(t)?.id;
2272
- n && await b.value.deleteEmploymentRoleGrant(e, n);
2273
- }
2274
- await f({
2275
- success: !0,
2276
- message: "任职角色授权已保存"
2277
- }, {
2278
- source: "role-employment-grants",
2279
- phase: "action"
2280
- }), r("saved"), r("close");
2281
- } catch (e) {
2282
- w(e, {
2283
- source: "role-employment-grants",
2284
- phase: "action"
2285
- });
2286
- } finally {
2287
- p.value = !1;
2288
- }
2289
- }
2290
- }
2291
- function ie() {
2292
- i.value = [], a.value = [], o.value = {}, s.value = /* @__PURE__ */ new Set(), c.value = /* @__PURE__ */ new Set(), l.value = !1, _.value = "", h.value = 1, g.value = 0, m.value = !1;
2293
- }
2294
- function ae(e) {
2295
- return [
2296
- e.employeeTitle,
2297
- e.employeeNo,
2298
- e.organizationTitle,
2299
- e.departmentTitle,
2300
- e.positionTitle
2301
- ].filter(Boolean).join(" ");
2302
- }
2303
- function oe(e) {
2304
- let t = new Set(s.value);
2305
- t.delete(e), s.value = t;
2306
- }
2307
- function N(e) {
2308
- let t = {};
2309
- for (let n of e) n.id && (t[n.id] = n);
2310
- return t;
2311
- }
2312
- function P(e) {
2313
- return {
2314
- id: e,
2315
- positionId: e
2316
- };
2317
- }
2318
- function F(e) {
2319
- let t = e.positionTitle ?? e.positionId ?? e.id;
2320
- return e.employeeTitle ? `${e.employeeTitle} · ${t}` : t;
2321
- }
2322
- function I(e) {
2323
- return [
2324
- e.employeeNo,
2325
- e.organizationTitle ?? e.organizationId,
2326
- e.departmentTitle ?? e.departmentId
2327
- ].filter(Boolean).join(" / ") || e.id;
2328
- }
2329
- function se(e) {
2330
- return e?.ownerScopeType === "platform" ? "平台范围" : e?.ownerScopeType === "organization" ? "机构范围" : "租户范围";
2331
- }
2332
- return (t, n) => (q(), z(Ce(C.value), me(T.value, { class: { "role-employment-grant-drawer-surface": e.embedded } }), fe({
2333
- default: Q(() => [u.value ? (q(), z(X(d), {
2334
- key: 0,
2335
- tip: "加载任职"
2336
- })) : m.value ? (q(), V("div", ln, [W(X(v), {
2337
- title: "任职加载失败",
2338
- message: "无法加载任职授权"
2339
- }), W(X(S), { onClick: n[1] ||= (e) => M() }, {
2340
- default: Q(() => [...n[6] ||= [U("重试", -1)]]),
2341
- _: 1
2342
- })])) : (q(), V("section", un, [
2343
- W(X(k), {
2344
- value: _.value,
2345
- "onUpdate:value": n[2] ||= (e) => _.value = e,
2346
- "allow-clear": "",
2347
- placeholder: "筛选职员、工号、机构、部门或岗位"
2348
- }, null, 8, ["value"]),
2349
- W(cn, {
2350
- "selected-ids": s.value,
2351
- "onUpdate:selectedIds": n[3] ||= (e) => s.value = e,
2352
- rows: ee.value,
2353
- selectable: "",
2354
- disabled: p.value,
2355
- pagination: te.value,
2356
- "fill-height": ""
2357
- }, null, 8, [
2358
- "selected-ids",
2359
- "rows",
2360
- "disabled",
2361
- "pagination"
2362
- ]),
2363
- A.value.length > 0 ? (q(), V("section", dn, [H("div", fn, [n[7] ||= H("strong", null, "已选任职", -1), H("span", null, Y(A.value.length) + " 个", 1)]), H("div", pn, [(q(!0), V(L, null, xe(A.value, (e) => (q(), V("button", {
2364
- key: e.id,
2365
- type: "button",
2366
- disabled: p.value,
2367
- onClick: (t) => oe(e.id)
2368
- }, [H("span", null, Y(F(e)), 1), H("small", null, Y(I(e)), 1)], 8, mn))), 128))])])) : B("v-if", !0)
2369
- ]))]),
2370
- _: 2
2371
- }, [e.embedded ? void 0 : {
2372
- name: "operation",
2373
- fn: Q(() => [W(X(S), {
2374
- disabled: p.value,
2375
- onClick: n[0] ||= (e) => r("close")
2376
- }, {
2377
- default: Q(() => [...n[4] ||= [U("取消", -1)]]),
2378
- _: 1
2379
- }, 8, ["disabled"]), W(X(S), {
2380
- type: "primary",
2381
- loading: p.value,
2382
- disabled: u.value || E.value.length === 0 && D.value.length === 0,
2383
- onClick: re
2384
- }, {
2385
- default: Q(() => [...n[5] ||= [U(" 确定 ", -1)]]),
2386
- _: 1
2387
- }, 8, ["loading", "disabled"])]),
2388
- key: "0"
2389
- }]), 1040, ["class"]));
2390
- }
2391
- }), [["__scopeId", "data-v-06db3659"]]), gn = /* @__PURE__ */ K({
2392
- name: "RoleEmploymentGrantDrawerSurface",
2393
- __name: "RoleEmploymentGrantDrawerSurface",
2394
- props: { context: {} },
2395
- setup(e) {
2396
- let t = e, n = R(() => t.context.module), r = R(() => t.context.record);
2397
- return (e, i) => (q(), z(hn, {
2398
- open: "",
2399
- embedded: "",
2400
- "drawer-context": t.context,
2401
- context: n.value,
2402
- role: r.value,
2403
- onClose: t.context.close,
2404
- onSaved: t.context.refreshList
2405
- }, null, 8, [
2406
- "drawer-context",
2407
- "context",
2408
- "role",
2409
- "onClose",
2410
- "onSaved"
2411
- ]));
2412
- }
2413
- }), _n = /* @__PURE__ */ K({
2414
- name: "WorkspaceViewDrawer",
2415
- __name: "WorkspaceViewDrawer",
2416
- props: {
2417
- open: { type: Boolean },
2418
- title: {},
2419
- container: {},
2420
- subtitle: { default: void 0 },
2421
- profile: { default: "detail" },
2422
- promotion: { default: void 0 },
2423
- dismissal: { default: void 0 },
2424
- beforeClose: {
2425
- type: Function,
2426
- default: void 0
2427
- }
2428
- },
2429
- emits: ["close"],
2430
- setup(e, { emit: t }) {
2431
- let n = e, r = t, i = R(() => n.profile === "wide-work" ? "wide" : "standard");
2432
- return (t, n) => (q(), z(X(ne), {
2433
- open: e.open,
2434
- title: e.title,
2435
- "render-mode": e.container ? "inline" : "portal",
2436
- subtitle: e.subtitle,
2437
- width: i.value,
2438
- promotion: e.promotion,
2439
- dismissal: e.dismissal,
2440
- "before-close": e.beforeClose,
2441
- onClose: n[0] ||= (e) => r("close")
2442
- }, fe({
2443
- default: Q(() => [Se(t.$slots, "default")]),
2444
- _: 2
2445
- }, [t.$slots.operation ? {
2446
- name: "operation",
2447
- fn: Q(() => [Se(t.$slots, "operation")]),
2448
- key: "0"
2449
- } : void 0]), 1032, [
2450
- "open",
2451
- "title",
2452
- "render-mode",
2453
- "subtitle",
2454
- "width",
2455
- "promotion",
2456
- "dismissal",
2457
- "before-close"
2458
- ]));
2459
- }
2460
- });
2461
- //#endregion
2462
- //#region src/platform-admin-runtime/useWorkspaceViewPromotion.ts
2463
- function vn(e) {
2464
- return e.hasStableIdentity && e.busy !== !0 && e.canChangeHost !== !1;
2465
- }
2466
- function yn(e) {
2467
- let t = l();
2468
- return R(() => {
2469
- let n = we(e.input);
2470
- if (n && vn(we(e.eligibility)) && t) return {
2471
- title: "固定为页签",
2472
- promote: async () => {
2473
- if (await e.beforePromote?.(n) === !1) {
2474
- e.onPromotionRejected?.();
2475
- return;
2476
- }
2477
- let r = t.openPage(o(e.view, n, "tab", we(e.title)));
2478
- e.onPromoted?.(r);
2479
- }
2480
- };
2481
- });
2482
- }
2483
- //#endregion
2484
- //#region src/platform-admin-runtime/workspaceViewSessions.ts
2485
- var bn = /* @__PURE__ */ new Map(), xn = /* @__PURE__ */ new Map();
2486
- function Sn(e, t) {
2487
- return `${e.type}:${En(t)}`;
2488
- }
2489
- async function Cn(e, t, n) {
2490
- let r = Sn(e, t), i = xn.get(r), a = i && [...i].at(-1);
2491
- return a ? await a(Dn(n)) ? "accepted" : "rejected" : (bn.set(r, Dn(n)), "accepted");
2492
- }
2493
- function wn(e, t, n) {
2494
- let r = Sn(e, t), i = xn.get(r) ?? /* @__PURE__ */ new Set();
2495
- return i.add(n), xn.set(r, i), () => {
2496
- i.delete(n), i.size === 0 && xn.delete(r);
2497
- };
2498
- }
2499
- function Tn(e, t) {
2500
- let n = Sn(e, t), r = bn.get(n);
2501
- return bn.delete(n), r;
2502
- }
2503
- function En(e) {
2504
- return Array.isArray(e) ? `[${e.map(En).join(",")}]` : e && typeof e == "object" ? `{${Object.entries(e).sort(([e], [t]) => e.localeCompare(t)).map(([e, t]) => `${JSON.stringify(e)}:${En(t)}`).join(",")}}` : JSON.stringify(e);
2505
- }
2506
- function Dn(e) {
2507
- return JSON.parse(JSON.stringify(e));
2508
- }
2509
- //#endregion
2510
- //#region src/views/roleAuthorizationWorkspaceSession.ts
2511
- function On(e, t) {
2512
- return Cn(ke, e, t);
2513
- }
2514
- function kn(e, t) {
2515
- return wn(ke, e, t);
2516
- }
2517
- function An(e) {
2518
- return Tn(ke, e);
2519
- }
2520
- //#endregion
2521
- //#region src/views/RoleAuthorizationView.vue?vue&type=script&setup=true&lang.ts
2522
- var jn = { class: "panel-title" }, Mn = {
2523
- key: 0,
2524
- class: "authorization-column-header"
2525
- }, Nn = {
2526
- key: 2,
2527
- class: "data-scope-editor"
2528
- }, Pn = { key: 0 }, Fn = { key: 1 }, In = { key: 3 }, Ln = {
2529
- key: 4,
2530
- class: "not-applicable"
2531
- }, Rn = /*@__PURE__*/ K({
2532
- name: "RoleAuthorizationView",
2533
- __name: "RoleAuthorizationView",
2534
- props: {
2535
- roleId: {},
2536
- moduleContext: {},
2537
- container: {},
2538
- drawer: { type: Boolean },
2539
- drawerContext: {}
2540
- },
2541
- emits: ["close"],
2542
- setup(e, { emit: t }) {
2543
- let n = e, r = t, i = _({ moduleAlias: "iam.role" }), a = n.moduleContext ?? i, o = Yt(a.http), l = n.roleId ?? new URLSearchParams(window.location.search).get("roleId") ?? "", u = s(), p = n.roleId ? { roleId: n.roleId } : void 0, m = p ? An(p) : void 0, h = J(), x = J([]), T = J(), D = J(""), O = J([]), k = J(), A = J(), te = J(!1), ne = J(!1), j = J(!1), oe = J(), N = J(), P = /* @__PURE__ */ new Map(), F = /* @__PURE__ */ new Map(), I = J(0), se, ce = R(() => h.value?.roleKind === "group"), le = R(() => h.value?.roleKind === "dataGrant"), ue = R(() => h.value?.assignmentType === "employment"), de = R(() => !!n.drawerContext), G = R(() => h.value?.title ?? l ?? "角色"), K = R(() => `授权:${G.value}`), me = R(() => he.value ? `动作授权 - ${he.value.title}` : `动作授权 - ${G.value}`), he = R(() => x.value.find((e) => e.moduleAlias === T.value)), be = R(() => {
2544
- let e = D.value.trim().toLocaleLowerCase(), t = new Set(e ? x.value.filter((t) => [
2545
- t.title,
2546
- t.moduleAlias,
2547
- t.applicationAlias
2548
- ].filter((e) => !!e).some((t) => t.toLocaleLowerCase().includes(e))).map((e) => e.moduleAlias) : x.value.map((e) => e.moduleAlias)), n = new Map(x.value.map((e) => [e.moduleAlias, e]));
2549
- for (let e of [...t]) {
2550
- let r = n.get(e)?.parentId;
2551
- for (; r && n.has(r) && !t.has(r);) t.add(r), r = n.get(r)?.parentId;
2552
- }
2553
- return x.value.filter((e) => t.has(e.moduleAlias)).map((e) => ({
2554
- id: e.moduleAlias,
2555
- parentId: e.parentId,
2556
- title: e.title,
2557
- secondary: e.applicationAlias
2558
- }));
2559
- }), xe = R(() => (A.value?.options ?? []).map((e) => ({
2560
- value: e.code,
2561
- label: e.title
2562
- }))), Se = R(() => (A.value?.referenceDependencies ?? []).map((e) => ({
2563
- value: e.referenceFieldId,
2564
- label: `${e.title} → ${e.targetModuleTitle}`
2565
- }))), we = R(() => new Map((A.value?.referenceDependencies ?? []).map((e) => [e.referenceFieldId, e]))), Te = R(() => ue.value && O.value.some((e) => !!e.dataAuth)), Ee = R(() => [
2566
- {
2567
- key: "title",
2568
- title: "动作",
2569
- width: 160
2570
- },
2571
- {
2572
- key: "granted",
2573
- title: "授权",
2574
- width: 104,
2575
- align: "center"
2576
- },
2577
- ...Te.value ? [{
2578
- key: "dataScopePolicy",
2579
- title: "数据范围",
2580
- width: 200
2581
- }] : []
2582
- ]), De = [
2583
- {
2584
- key: "title",
2585
- title: "标准动作",
2586
- width: 130
2587
- },
2588
- {
2589
- key: "configured",
2590
- title: "启用模板",
2591
- width: 104,
2592
- align: "center"
2593
- },
2594
- {
2595
- key: "dataScopePolicy",
2596
- title: "数据范围",
2597
- width: 160
2598
- }
2599
- ], Oe = R(() => O.value), Ae = R(() => k.value?.actions ?? []), je = R(() => n.drawer === !0 || !!p && u?.presentation === "drawer"), Me = R(() => !!p), Ne = R(() => Me.value && !de.value), Pe = R(() => de.value ? "div" : je.value ? _n : Me.value ? g : "div"), Fe = R(() => je.value ? {
2600
- open: !0,
2601
- title: K.value,
2602
- container: n.container ?? null,
2603
- profile: ke.drawerProfile,
2604
- promotion: Ve.value,
2605
- dismissal: "guarded",
2606
- beforeClose: it,
2607
- onClose: at
2608
- } : Ne.value ? { title: K.value } : {}), Ie = R(() => {
2609
- let e = k.value;
2610
- return !e || N.value === void 0 ? !1 : JSON.stringify(e.actions) !== N.value;
2611
- }), Le = R(() => I.value >= 0 && [...P.entries()].some(([e, t]) => F.get(e) !== JSON.stringify(t))), $ = R(() => Ie.value || Le.value);
2612
- c("角色授权", () => $.value, () => j.value);
2613
- let Re = R(() => O.value.length > 0 && O.value.every((e) => e.granted)), ze = R(() => O.value.some((e) => e.granted) && !Re.value), Be = R(() => {
2614
- let e = he.value?.title ?? "未选择模块", t = O.value.filter((e) => e.granted).length, n = $.value ? "有未确认修改" : "未修改";
2615
- return `当前模块:${e} · 已授权 ${t}/${O.value.length} 项 · ${n}`;
2616
- }), Ve = yn({
2617
- view: ke,
2618
- input: () => p,
2619
- title: K,
2620
- eligibility: () => ({
2621
- hasStableIdentity: !!(l && h.value),
2622
- busy: j.value
2623
- }),
2624
- beforePromote: (e) => On(e, {
2625
- selectedModuleAlias: T.value,
2626
- dataGrantMatrix: k.value,
2627
- actionDrafts: [...P.entries()].map(([e, t]) => ({
2628
- moduleAlias: e,
2629
- actions: t
2630
- })),
2631
- actionSnapshots: [...F.entries()].map(([e, t]) => ({
2632
- moduleAlias: e,
2633
- snapshot: t
2634
- }))
2635
- }).then((e) => e === "accepted"),
2636
- onPromoted: ot,
2637
- onPromotionRejected: () => C("目标页签存在未确认的授权配置;请先确认或关闭该页签后再固定当前抽屉。", {
2638
- source: "role-authorization",
2639
- phase: "validation"
2640
- })
2641
- });
2642
- ye(() => {
2643
- p && !je.value && (se = kn(p, st)), Ue();
2644
- }), Z(K, (e) => {
2645
- Me.value && u?.setTitle(e);
2646
- }, { immediate: !0 }), Z(T, () => void We()), Z([
2647
- G,
2648
- Be,
2649
- $,
2650
- j,
2651
- ce,
2652
- le
2653
- ], He, { immediate: !0 }), ye(() => window.addEventListener("beforeunload", lt)), ve(() => {
2654
- se?.(), n.drawerContext?.setOperation(void 0), n.drawerContext?.setSubtitle(void 0), window.removeEventListener("beforeunload", lt);
2655
- });
2656
- function He() {
2657
- let e = n.drawerContext;
2658
- if (e) {
2659
- if (e.setSubtitle(`${G.value} · ${ut(h.value)}`), ce.value) {
2660
- e.setOperation(void 0);
2661
- return;
2662
- }
2663
- e.setOperation({
2664
- summary: le.value ? $.value ? "有未确认修改" : "未修改" : Be.value,
2665
- actions: [{
2666
- key: "confirm-role-authorization",
2667
- label: "确认",
2668
- emphasis: "primary",
2669
- disabled: j.value || !$.value,
2670
- loading: j.value,
2671
- run: () => void rt()
2672
- }]
2673
- });
2674
- }
2675
- }
2676
- async function Ue() {
2677
- if (!l) {
2678
- oe.value = "缺少角色标识,无法打开授权页。";
2679
- return;
2680
- }
2681
- te.value = !0, oe.value = void 0;
2682
- try {
2683
- if (h.value = await a.crud.view(l), h.value.roleKind === "group") return;
2684
- if (h.value.roleKind === "dataGrant") {
2685
- let [e, t] = await Promise.all([o.dataGrantActionMatrix(l), o.dataScopePolicyCatalog(l)]);
2686
- k.value = m?.dataGrantMatrix ?? e, A.value = t, N.value = JSON.stringify(e.actions);
2687
- return;
2688
- }
2689
- x.value = (await o.authorizationModules(l)).records, T.value = m?.selectedModuleAlias ?? x.value[0]?.moduleAlias;
2690
- } catch (e) {
2691
- oe.value = "授权信息加载失败,请重试。", w(e, {
2692
- source: "role-authorization",
2693
- phase: "load"
2694
- });
2695
- } finally {
2696
- te.value = !1;
2697
- }
2698
- }
2699
- async function We() {
2700
- let e = T.value;
2701
- if (!(!e || le.value || ce.value)) {
2702
- ne.value = !0;
2703
- try {
2704
- let [t, n] = await Promise.all([o.permissionMatrix(l, [e]), o.dataScopePolicyCatalog(l, e)]), r = (t.modules[0]?.actions ?? []).map(et), i = m?.actionDrafts?.find((t) => t.moduleAlias === e)?.actions, a = P.get(e) ?? i;
2705
- O.value = a ?? r, P.has(e) || (P.set(e, O.value), F.set(e, m?.actionSnapshots?.find((t) => t.moduleAlias === e)?.snapshot ?? JSON.stringify(r))), I.value += 1, A.value = n;
2706
- } catch (e) {
2707
- w(e, {
2708
- source: "role-authorization",
2709
- phase: "load"
2710
- });
2711
- } finally {
2712
- ne.value = !1;
2713
- }
2714
- }
2715
- }
2716
- function Ge(e, t) {
2717
- t && e.dataAuth && ue.value && !e.dataScopePolicy && (e.dataScopePolicy = "inheritDataGrant"), t && e.dataScopePolicy === "referenceDependency" && !e.referenceFieldId && (e.dataScopePolicy = "inheritDataGrant"), e.granted = t, I.value += 1;
2718
- }
2719
- function Ke(e) {
2720
- O.value.forEach((t) => Ge(t, e));
2721
- }
2722
- function qe(e, t) {
2723
- if (e.dataScopePolicy = String(t || "none"), e.dataScopePolicy === "referenceDependency") {
2724
- e.referenceFieldId = void 0, e.referenceActionCode = void 0, I.value += 1;
2725
- return;
2726
- }
2727
- e.referenceFieldId = void 0, e.referenceActionCode = void 0, I.value += 1;
2728
- }
2729
- function Je(e, t) {
2730
- let n = we.value.get(String(t || ""));
2731
- e.referenceFieldId = n?.referenceFieldId, e.referenceActionCode = n?.referenceActionCode, I.value += 1;
2732
- }
2733
- function Ye(e) {
2734
- return we.value.get(String(e || ""));
2735
- }
2736
- function Xe(e) {
2737
- return typeof e == "string" || typeof e == "number" ? e : void 0;
2738
- }
2739
- function Ze(e) {
2740
- return e.dataScopePolicy ?? "inheritDataGrant";
2741
- }
2742
- function Qe(e) {
2743
- return !!e.dataAuth && ue.value;
2744
- }
2745
- function $e(e, t) {
2746
- return e.key === "dataScopePolicy" && Qe(t);
2747
- }
2748
- function et(e) {
2749
- return ue.value && e.dataAuth && e.dataScopePolicy === "none" ? {
2750
- ...e,
2751
- dataScopePolicy: "inheritDataGrant"
2752
- } : e;
2753
- }
2754
- async function tt() {
2755
- if (k.value) {
2756
- j.value = !0;
2757
- try {
2758
- let e = await o.replaceDataGrantActions(l, k.value.actions.map((e) => ({
2759
- actionCode: e.actionCode,
2760
- dataScopePolicy: e.dataScopePolicy,
2761
- enabled: e.configured
2762
- })));
2763
- await f(e, {
2764
- source: "role-authorization",
2765
- phase: "action",
2766
- fallbackMessage: "数据权限模板已保存"
2767
- }), N.value = JSON.stringify(k.value.actions);
2768
- } catch (e) {
2769
- w(e, {
2770
- source: "role-authorization",
2771
- phase: "action"
2772
- });
2773
- } finally {
2774
- j.value = !1;
2775
- }
2776
- }
2777
- }
2778
- async function nt() {
2779
- let e = [...P.entries()].filter(([e, t]) => F.get(e) !== JSON.stringify(t));
2780
- if (e.length) {
2781
- j.value = !0;
2782
- try {
2783
- let t = await o.replacePermissionMatrix(l, e.flatMap(([e, t]) => t.map((t) => ({
2784
- moduleAlias: e,
2785
- actionCode: t.actionCode,
2786
- granted: !!t.granted,
2787
- dataScopePolicy: t.granted && t.dataAuth && ue.value ? t.dataScopePolicy ?? "inheritDataGrant" : void 0,
2788
- referenceFieldId: t.granted && t.dataScopePolicy === "referenceDependency" ? t.referenceFieldId : void 0,
2789
- referenceActionCode: t.granted && t.dataScopePolicy === "referenceDependency" ? t.referenceActionCode : void 0
2790
- }))));
2791
- await f(t, {
2792
- source: "role-authorization",
2793
- phase: "action",
2794
- fallbackMessage: "角色授权已保存"
2795
- }), e.forEach(([e, t]) => F.set(e, JSON.stringify(t))), I.value += 1;
2796
- } catch (e) {
2797
- w(e, {
2798
- source: "role-authorization",
2799
- phase: "action"
2800
- });
2801
- } finally {
2802
- j.value = !1;
2803
- }
2804
- }
2805
- }
2806
- async function rt() {
2807
- if (le.value) {
2808
- await tt();
2809
- return;
2810
- }
2811
- await nt();
2812
- }
2813
- async function it() {
2814
- return !$.value || E({
2815
- title: "放弃未确认的授权配置",
2816
- content: "当前修改尚未确认,关闭后将丢失这些修改。",
2817
- okText: "放弃修改",
2818
- danger: !0
2819
- });
2820
- }
2821
- function at() {
2822
- ct();
2823
- }
2824
- function ot() {
2825
- ct();
2826
- }
2827
- function st(e) {
2828
- return !$.value && (T.value = e.selectedModuleAlias, k.value = e.dataGrantMatrix, P.clear(), F.clear(), e.actionDrafts?.forEach(({ moduleAlias: e, actions: t }) => P.set(e, t)), e.actionSnapshots?.forEach(({ moduleAlias: e, snapshot: t }) => F.set(e, t)), I.value += 1, !0);
2829
- }
2830
- function ct() {
2831
- if (n.drawer === !0) {
2832
- r("close");
2833
- return;
2834
- }
2835
- u?.dismiss();
2836
- }
2837
- function lt(e) {
2838
- $.value && (e.preventDefault(), e.returnValue = "");
2839
- }
2840
- function ut(e) {
2841
- return e?.ownerScopeType === "platform" ? "平台范围" : e?.ownerScopeType === "organization" ? "机构范围" : "租户范围";
2842
- }
2843
- return (e, t) => (q(), z(Ce(Pe.value), _e(pe(Fe.value)), fe({
2844
- default: Q(() => [H("section", { class: ge(["role-authorization-page", { "role-authorization-page--drawer": je.value || de.value }]) }, [te.value ? (q(), z(X(d), {
2845
- key: 0,
2846
- tip: "加载授权信息"
2847
- })) : oe.value ? (q(), z(X(v), {
2848
- key: 1,
2849
- title: "授权页加载失败",
2850
- message: oe.value
2851
- }, null, 8, ["message"])) : ce.value ? (q(), z(X(re), {
2852
- key: 2,
2853
- title: "角色组不独立授权",
2854
- description: "角色组只组合成员角色;请到成员角色分别配置动作和数据权限。"
2855
- })) : le.value && k.value ? (q(), z(X(y), {
2856
- key: 3,
2857
- class: "data-grant-content",
2858
- title: Ne.value ? "数据权限模板" : `数据权限模板 - ${G.value}`,
2859
- searchable: !1,
2860
- onRefresh: Ue
2861
- }, {
2862
- default: Q(() => [H("header", jn, [t[4] ||= H("div", null, [H("h3", null, "标准动作的数据范围模板"), H("p", null, "模板只会在具体任职的普通角色动作选择“继承数据授权角色”时生效。")], -1), Me.value ? B("v-if", !0) : (q(), z(X(S), {
2863
- key: 0,
2864
- type: "primary",
2865
- disabled: !$.value,
2866
- loading: j.value,
2867
- onClick: rt
2868
- }, {
2869
- default: Q(() => [...t[3] ||= [U(" 确认 ", -1)]]),
2870
- _: 1
2871
- }, 8, ["disabled", "loading"]))]), W(X(M), {
2872
- columns: De,
2873
- rows: Ae.value,
2874
- "row-key": "actionCode",
2875
- "horizontal-scroll": ""
2876
- }, {
2877
- cell: Q(({ column: e, record: t }) => [e.key === "title" ? (q(), V(L, { key: 0 }, [H("strong", null, Y(t.title || t.actionCode), 1), H("small", null, Y(t.actionCode), 1)], 64)) : e.key === "configured" ? (q(), z(X(ee), {
2878
- key: 1,
2879
- checked: !!t.configured,
2880
- disabled: j.value,
2881
- onChange: (e) => t.configured = e
2882
- }, null, 8, [
2883
- "checked",
2884
- "disabled",
2885
- "onChange"
2886
- ])) : (q(), z(X(ae), {
2887
- key: 2,
2888
- value: t.dataScopePolicy,
2889
- options: xe.value,
2890
- disabled: !t.configured || j.value,
2891
- placeholder: "请选择数据范围",
2892
- "allow-clear": !1,
2893
- "onUpdate:value": (e) => t.dataScopePolicy = String(e || "")
2894
- }, null, 8, [
2895
- "value",
2896
- "options",
2897
- "disabled",
2898
- "onUpdate:value"
2899
- ]))]),
2900
- _: 1
2901
- }, 8, ["rows"])]),
2902
- _: 1
2903
- }, 8, ["title"])) : (q(), V("section", {
2904
- key: 4,
2905
- class: ge(["authorization-layout", { "authorization-layout--compact-actions": !Te.value }])
2906
- }, [W(X(y), {
2907
- "search-keyword": D.value,
2908
- "onUpdate:searchKeyword": t[1] ||= (e) => D.value = e,
2909
- class: "module-panel",
2910
- title: "模块树",
2911
- "refresh-title": "刷新模块目录",
2912
- "search-placeholder": "搜索模块名称或别名",
2913
- onRefresh: Ue
2914
- }, {
2915
- default: Q(() => [W(X(ie), {
2916
- records: be.value,
2917
- "selected-id": T.value,
2918
- onSelect: t[0] ||= (e) => T.value = e.id
2919
- }, null, 8, ["records", "selected-id"])]),
2920
- _: 1
2921
- }, 8, ["search-keyword"]), W(X(y), {
2922
- class: "action-panel",
2923
- title: me.value,
2924
- searchable: !1
2925
- }, fe({
2926
- default: Q(() => [ne.value ? (q(), z(X(d), {
2927
- key: 0,
2928
- tip: "加载模块动作"
2929
- })) : T.value ? (q(), z(X(M), {
2930
- key: 2,
2931
- columns: Ee.value,
2932
- rows: Oe.value,
2933
- "row-key": "actionCode",
2934
- "fill-height": "",
2935
- "horizontal-scroll": ""
2936
- }, {
2937
- header: Q(({ column: e }) => [e.key === "granted" ? (q(), V("span", Mn, [W(X(b), {
2938
- checked: Re.value,
2939
- indeterminate: ze.value,
2940
- disabled: j.value || !O.value.length,
2941
- "aria-label": "全选当前模块动作授权",
2942
- onChange: Ke
2943
- }, null, 8, [
2944
- "checked",
2945
- "indeterminate",
2946
- "disabled"
2947
- ]), t[6] ||= U(" 授权 ", -1)])) : (q(), V(L, { key: 1 }, [U(Y(e.title), 1)], 64))]),
2948
- cell: Q(({ column: e, record: t }) => [e.key === "title" ? (q(), V(L, { key: 0 }, [H("strong", null, Y(t.title || t.actionCode), 1), H("small", null, Y(t.permissionActionCode || t.actionCode), 1)], 64)) : e.key === "granted" ? (q(), z(X(b), {
2949
- key: 1,
2950
- checked: !!t.granted,
2951
- disabled: j.value,
2952
- onChange: (e) => Ge(t, e)
2953
- }, null, 8, [
2954
- "checked",
2955
- "disabled",
2956
- "onChange"
2957
- ])) : t.dataAuth && ue.value && t.granted ? (q(), V("div", Nn, [W(X(ae), {
2958
- value: Ze(t),
2959
- options: xe.value,
2960
- disabled: j.value,
2961
- "allow-clear": !1,
2962
- "onUpdate:value": (e) => qe(t, e)
2963
- }, null, 8, [
2964
- "value",
2965
- "options",
2966
- "disabled",
2967
- "onUpdate:value"
2968
- ]), t.dataScopePolicy === "referenceDependency" ? (q(), V(L, { key: 0 }, [W(X(ae), {
2969
- value: Xe(t.referenceFieldId),
2970
- options: Se.value,
2971
- disabled: j.value,
2972
- placeholder: "请选择引用字段",
2973
- "allow-clear": !1,
2974
- "onUpdate:value": (e) => Je(t, e)
2975
- }, null, 8, [
2976
- "value",
2977
- "options",
2978
- "disabled",
2979
- "onUpdate:value"
2980
- ]), t.referenceFieldId ? (q(), V("small", Pn, " 依赖目标:" + Y(Ye(t.referenceFieldId)?.targetModuleTitle) + " · " + Y(Ye(t.referenceFieldId)?.referenceActionTitle), 1)) : (q(), V("small", Fn, "请先选择引用字段,再开启该动作授权。"))], 64)) : B("v-if", !0)])) : $e(e, t) ? (q(), V("span", In, "—")) : (q(), V("span", Ln, "不适用"))]),
2981
- _: 1
2982
- }, 8, ["columns", "rows"])) : (q(), z(X(re), {
2983
- key: 1,
2984
- title: "请选择模块"
2985
- }))]),
2986
- _: 2
2987
- }, [Me.value ? void 0 : {
2988
- name: "actions",
2989
- fn: Q(() => [W(X(S), {
2990
- type: "primary",
2991
- disabled: !$.value,
2992
- loading: j.value,
2993
- onClick: rt
2994
- }, {
2995
- default: Q(() => [...t[5] ||= [U(" 确认 ", -1)]]),
2996
- _: 1
2997
- }, 8, ["disabled", "loading"])]),
2998
- key: "0"
2999
- }]), 1032, ["title"])], 2))], 2)]),
3000
- _: 2
3001
- }, [Ne.value && !ce.value ? {
3002
- name: "operation",
3003
- fn: Q(() => [W(X(S), {
3004
- type: "primary",
3005
- disabled: !$.value,
3006
- loading: j.value,
3007
- onClick: rt
3008
- }, {
3009
- default: Q(() => [...t[2] ||= [U(" 确认 ", -1)]]),
3010
- _: 1
3011
- }, 8, ["disabled", "loading"])]),
3012
- key: "0"
3013
- } : void 0]), 1040));
3014
- }
3015
- }), zn = /* @__PURE__ */ e({ default: () => Bn }), Bn = /*#__PURE__*/ h(Rn, [["__scopeId", "data-v-ee79d1ea"]]), Vn = { class: "role-authorization-drawer-surface" }, Hn = /*#__PURE__*/ h(/* @__PURE__ */ K({
3016
- name: "RoleAuthorizationDrawerSurface",
3017
- __name: "RoleAuthorizationDrawerSurface",
3018
- props: { context: {} },
3019
- setup(e) {
3020
- let t = e, n = t.context.module;
3021
- return (e, r) => (q(), V("section", Vn, [t.context.record?.id == null ? B("v-if", !0) : (q(), z(Bn, {
3022
- key: 0,
3023
- "role-id": String(t.context.record.id),
3024
- "module-context": X(n),
3025
- "drawer-context": t.context
3026
- }, null, 8, [
3027
- "role-id",
3028
- "module-context",
3029
- "drawer-context"
3030
- ]))]));
3031
- }
3032
- }), [["__scopeId", "data-v-04d29709"]]), Un = {
3033
- key: 0,
3034
- class: "role-group-member-form-field"
3035
- }, Wn = {
3036
- id: "iam-role-scope-and-actions",
3037
- target: { moduleAlias: "iam.role" },
3038
- navigator: {
3039
- bypassListScope: !0,
3040
- extension: {
3041
- key: "iam-role-scope-tree",
3042
- component: qt,
3043
- selection: { kind: "roleScope" }
3044
- }
3045
- },
3046
- list: { cellComponents: [
3047
- {
3048
- key: "assignmentType",
3049
- cell: Jt
3050
- },
3051
- {
3052
- key: "roleKind",
3053
- cell: Jt
3054
- },
3055
- {
3056
- key: "sharePolicy",
3057
- cell: Jt
3058
- }
3059
- ] },
3060
- form: {
3061
- contributions: [{
3062
- key: "role-group-members",
3063
- component: /* @__PURE__ */ h(/* @__PURE__ */ K({
3064
- name: "RoleGroupMemberFormField",
3065
- __name: "RoleGroupMemberFormField",
3066
- props: { context: {} },
3067
- setup(e) {
3068
- let t = e, n = J([]), r = J(!1), i = R(() => t.context.draft.roleKind === "group"), a = R(() => d(t.context.draft.memberRoleIds)), o = R(() => String(t.context.draft.id ?? "") || void 0), s = R(() => new Set(n.value.filter((e) => e.roleKind === "dataGrant" && e.id && a.value.includes(e.id)).map((e) => e.id))), c = R(() => n.value.filter((e) => e.id && e.id !== o.value).map((e) => ({
3069
- label: `${e.title ?? e.id} / ${e.roleKind === "dataGrant" ? "数据授权角色" : "标准角色"}`,
3070
- value: e.id,
3071
- disabled: e.roleKind === "dataGrant" && s.value.size > 0 && !a.value.includes(e.id)
3072
- })));
3073
- Z([i, () => t.context.formSessionKey], () => void l(), { immediate: !0 });
3074
- async function l() {
3075
- if (!i.value) {
3076
- n.value = [];
3077
- return;
3078
- }
3079
- r.value = !0;
3080
- try {
3081
- let e = await t.context.queryRecords({
3082
- page: {
3083
- pageNum: 1,
3084
- pageSize: 500
3085
- },
3086
- conditions: [
3087
- {
3088
- fieldName: "assignmentType",
3089
- operator: "EQ",
3090
- values: ["employment"]
3091
- },
3092
- {
3093
- fieldName: "roleKind",
3094
- operator: "IN",
3095
- values: ["standard", "dataGrant"]
3096
- },
3097
- {
3098
- fieldName: "enabled",
3099
- operator: "EQ",
3100
- values: [!0]
3101
- },
3102
- {
3103
- fieldName: "ownerScopeType",
3104
- operator: "EQ",
3105
- values: [t.context.draft.ownerScopeType]
3106
- },
3107
- ...t.context.draft.ownerScopeId ? [{
3108
- fieldName: "ownerScopeId",
3109
- operator: "EQ",
3110
- values: [t.context.draft.ownerScopeId]
3111
- }] : []
3112
- ],
3113
- sorts: [{ field: "sortOrder" }, { field: "title" }]
3114
- });
3115
- n.value = e.records;
3116
- } finally {
3117
- r.value = !1;
3118
- }
3119
- }
3120
- function u(e) {
3121
- let n = Array.isArray(e) ? e.map((e) => String(e).trim()).filter(Boolean) : [];
3122
- t.context.setField("memberRoleIds", n.length > 0 ? n.join(",") : void 0);
3123
- }
3124
- function d(e) {
3125
- return typeof e == "string" ? e.split(",").map((e) => e.trim()).filter(Boolean) : [];
3126
- }
3127
- return (t, n) => i.value ? (q(), V("label", Un, [n[0] ||= H("span", null, "成员角色", -1), W(X(ae), {
3128
- mode: "multiple",
3129
- value: a.value,
3130
- options: c.value,
3131
- loading: r.value,
3132
- placeholder: "请选择成员角色",
3133
- disabled: e.context.mode === "view",
3134
- "allow-clear": "",
3135
- "onUpdate:value": u
3136
- }, null, 8, [
3137
- "value",
3138
- "options",
3139
- "loading",
3140
- "disabled"
3141
- ])])) : B("v-if", !0);
3142
- }
3143
- }), [["__scopeId", "data-v-665f4381"]]),
3144
- location: {
3145
- surface: "record-card",
3146
- fieldName: "memberRoleIds",
3147
- placement: "after"
3148
- }
3149
- }],
3150
- fieldPolicies: [{
3151
- fieldName: "memberRoleIds",
3152
- visible: () => !1
3153
- }]
3154
- },
3155
- recordActions: [
3156
- {
3157
- key: "role-bind-account",
3158
- actionCode: "accountRoleGrants",
3159
- title: "绑定",
3160
- state: (e) => ({
3161
- visible: e.assignmentType === "account",
3162
- disabled: e.systemManaged === !0
3163
- }),
3164
- run({ openDrawer: e }) {
3165
- e({
3166
- title: "绑定用户",
3167
- width: "extraWide",
3168
- component: sn
3169
- });
3170
- }
3171
- },
3172
- {
3173
- key: "role-bind-employment",
3174
- actionCode: "employmentRoleGrants",
3175
- title: "绑定",
3176
- state: (e) => ({
3177
- visible: e.assignmentType !== "account",
3178
- disabled: e.systemManaged === !0
3179
- }),
3180
- run({ openDrawer: e }) {
3181
- e({
3182
- title: "绑定任职",
3183
- width: "extraWide",
3184
- component: gn
3185
- });
3186
- }
3187
- },
3188
- {
3189
- key: "role-authorize",
3190
- actionCode: "rolePermissions",
3191
- title: "授权",
3192
- state: (e) => ({
3193
- visible: e.roleKind !== "group",
3194
- disabled: e.systemManaged === !0
3195
- }),
3196
- run({ openDrawer: e }) {
3197
- e({
3198
- title: "角色授权",
3199
- width: "wide",
3200
- component: Hn
3201
- });
3202
- }
3203
- }
3204
- ]
3205
- };
3206
- r("platform-admin-runtime", Ae), n("platform-admin-runtime", [
3207
- Be,
3208
- Ve,
3209
- He,
3210
- Ye,
3211
- nt,
3212
- ct,
3213
- kt,
3214
- Wn
3215
- ]);
3216
- //#endregion
3217
- export { Tn as a, on as c, wn as i, ut as l, zn as n, yn as o, Cn as r, hn as s, Bn as t, Oe as u };