@ximatai/muyun-web-app 0.26.11 → 0.26.13

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