@ximatai/muyun-web-app 0.26.11 → 0.26.12

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