@ximatai/muyun-web-app 0.26.9 → 0.26.10

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 (70) hide show
  1. package/dist/{MetadataOrchestrationView-CzhAgEdX.js → MetadataOrchestrationView-BhtVwJII.js} +182 -182
  2. package/dist/{ModuleActionManagementView-CM2d8jPO.js → ModuleActionManagementView-DpZS-xAD.js} +70 -70
  3. package/dist/RoleAuthorizationView-8lilhtMB.js +646 -0
  4. package/dist/{RoleDetailWorkspaceView-CzaQ3Dz1.js → RoleDetailWorkspaceView-CFha6JHn.js} +1 -1
  5. package/dist/{RoleManagementView-nY7qu4GF.js → RoleManagementView-0_KDrzgh.js} +511 -514
  6. package/dist/index.css +1 -1
  7. package/dist/index.js +282 -302
  8. package/dist/{platform-components-CIi6GdC9.js → platform-components-oRIsIoxu.js} +2060 -1893
  9. package/dist/types/app/StaticRoutePageHost.vue.d.ts +2 -0
  10. package/dist/types/consumer/AppWorkbenchShell.vue.d.ts +4 -2
  11. package/dist/types/consumer/index.d.ts +1 -1
  12. package/dist/types/dynamic-page-runtime/ManagedDetailRelationInlineSurface.vue.d.ts +3 -1
  13. package/dist/types/dynamic-page-runtime/ManagedDetailRelationSurface.vue.d.ts +2 -1
  14. package/dist/types/dynamic-page-runtime/ModulePageDetailRelations.vue.d.ts +3 -1
  15. package/dist/types/dynamic-page-runtime/ModulePageListExpansionSurface.vue.d.ts +2 -1
  16. package/dist/types/dynamic-page-runtime/ModulePageListRelationExpansion.vue.d.ts +2 -1
  17. package/dist/types/dynamic-page-runtime/ModulePageListRelationExpansions.vue.d.ts +2 -1
  18. package/dist/types/dynamic-page-runtime/ModulePageRecordContent.vue.d.ts +3 -1
  19. package/dist/types/dynamic-page-runtime/PageNavigatorExplorer.vue.d.ts +7 -2
  20. package/dist/types/dynamic-page-runtime/composables/useModulePageDetailExtensionRuntime.d.ts +2 -0
  21. package/dist/types/dynamic-page-runtime/composables/useNavigatorRuntime.d.ts +69 -15
  22. package/dist/types/dynamic-page-runtime/composables/useRecordEditingSession.d.ts +3 -2
  23. package/dist/types/dynamic-page-runtime/index.d.ts +2 -1
  24. package/dist/types/dynamic-page-runtime/modulePageEnhancements.d.ts +35 -3
  25. package/dist/types/dynamic-page-runtime/navigatorEntrySelection.d.ts +18 -0
  26. package/dist/types/dynamic-page-runtime/pageContextRuntime.d.ts +8 -0
  27. package/dist/types/dynamic-page-runtime/pageNavigatorItemModel.d.ts +13 -0
  28. package/dist/types/dynamic-page-runtime/recordDetailController.d.ts +9 -8
  29. package/dist/types/platform-admin-runtime/platformModulePageEnhancement.d.ts +6 -0
  30. package/dist/types/platform-components/CrudRecordListExplorer.vue.d.ts +4 -0
  31. package/dist/types/platform-components/ManagementPanelHeader.vue.d.ts +2 -0
  32. package/dist/types/platform-components/RecordDetailDrawer.vue.d.ts +5 -3
  33. package/dist/types/platform-components/RecordExplorerPanel.vue.d.ts +2 -0
  34. package/dist/types/platform-components/RecordFormFields.vue.d.ts +2 -2
  35. package/dist/types/platform-components/RecordModeDrawer.vue.d.ts +2 -0
  36. package/dist/types/platform-components/RecordPanelButton.vue.d.ts +2 -0
  37. package/dist/types/platform-components/RecordPicker.vue.d.ts +2 -0
  38. package/dist/types/platform-components/RecordQueryListPanel.vue.d.ts +7 -1
  39. package/dist/types/platform-components/RecordStatusSwitch.vue.d.ts +2 -0
  40. package/dist/types/platform-components/TreeRecordExplorer.vue.d.ts +4 -0
  41. package/dist/types/platform-components/index.d.ts +0 -2
  42. package/dist/types/platform-components/recordFormFieldModel.d.ts +16 -2
  43. package/dist/types/platform-components/recordPickerConstraints.d.ts +2 -0
  44. package/dist/types/platform-workbench/Workbench.vue.d.ts +4 -2
  45. package/dist/types/vue-ui-antdv/components/UiSidePanel.vue.d.ts +4 -2
  46. package/dist/types/vue-ui-antdv/components/UiSwitch.vue.d.ts +2 -0
  47. package/dist/types/web-contracts/index.d.ts +72 -2
  48. package/dist/types/web-core/http.d.ts +6 -0
  49. package/dist/types/web-core/module/index.d.ts +1 -1
  50. package/dist/types/web-core/module/moduleContext.d.ts +2 -1
  51. package/dist/types/web-core/module/staticModuleClient.d.ts +6 -0
  52. package/dist/types/web-core/realtime.d.ts +8 -0
  53. package/dist/{workspaceViews-CkERhK0K.js → workspaceViews-D-RiJ64o.js} +3341 -3011
  54. package/package.json +1 -1
  55. package/dist/DictionaryManagementView-CtIQpqVA.js +0 -1035
  56. package/dist/MenuManagementView-DJhkN2sG.js +0 -837
  57. package/dist/RoleAuthorizationView-jn_WUCeg.js +0 -599
  58. package/dist/SystemUserDetailWorkspaceView-CBvqmWvP.js +0 -17
  59. package/dist/SystemUserManagementView-AEomKvK7.js +0 -887
  60. package/dist/currentUserContext-B1lj1WgF.js +0 -11
  61. package/dist/types/platform-components/scopedResourceTreeModuleContext.d.ts +0 -6
  62. package/dist/types/views/DictionaryManagementView.vue.d.ts +0 -3
  63. package/dist/types/views/MenuManagementView.vue.d.ts +0 -3
  64. package/dist/types/views/SystemUserDetailWorkspaceView.vue.d.ts +0 -7
  65. package/dist/types/views/SystemUserManagementView.vue.d.ts +0 -7
  66. package/dist/types/views/dictionaryManagementState.d.ts +0 -215
  67. package/dist/types/views/menuManagementState.d.ts +0 -180
  68. package/dist/types/views/systemUserDetailWorkspaceSession.d.ts +0 -12
  69. package/dist/types/views/systemUserDetailWorkspaceView.d.ts +0 -5
  70. package/dist/workspaceViewSessions-B5g4M0rT.js +0 -51
@@ -0,0 +1,646 @@
1
+ import { It as e, Mt as t, Nt as n, Rt as r, St as i, T as a, V as ee, Wt as te, _t as ne, at as o, dr as s, ft as re, it as ie, pt as ae, st as oe, u as se, ut as ce, v as c, vt as le } from "./platform-components-oRIsIoxu.js";
2
+ import { A as ue, N as de, v as l, w as u } from "./workspaceViews-D-RiJ64o.js";
3
+ import { Fragment as d, computed as f, createBlock as p, createCommentVNode as fe, createElementBlock as m, createElementVNode as h, createSlots as g, createTextVNode as _, createVNode as v, defineComponent as y, guardReactiveProps as pe, normalizeClass as me, normalizeProps as he, onBeforeUnmount as ge, onMounted as _e, openBlock as b, ref as x, renderSlot as S, resolveDynamicComponent as ve, toDisplayString as C, toValue as w, unref as T, watch as ye, withCtx as E } from "vue";
4
+ //#endregion
5
+ //#region src/platform-admin-runtime/WorkspaceViewDrawer.vue
6
+ var be = /* @__PURE__ */ y({
7
+ name: "WorkspaceViewDrawer",
8
+ __name: "WorkspaceViewDrawer",
9
+ props: {
10
+ open: { type: Boolean },
11
+ title: {},
12
+ container: {},
13
+ subtitle: { default: void 0 },
14
+ profile: { default: "detail" },
15
+ promotion: { default: void 0 }
16
+ },
17
+ emits: ["close"],
18
+ setup(e, { emit: t }) {
19
+ let n = e, r = t, i = f(() => n.profile === "wide-work" ? "min(600px, 100vw)" : 520);
20
+ return (t, n) => (b(), p(T(ee), {
21
+ open: e.open,
22
+ title: e.title,
23
+ "render-mode": e.container ? "inline" : "portal",
24
+ subtitle: e.subtitle,
25
+ width: i.value,
26
+ promotion: e.promotion,
27
+ onClose: n[0] ||= (e) => r("close")
28
+ }, g({
29
+ default: E(() => [S(t.$slots, "default")]),
30
+ _: 2
31
+ }, [t.$slots.operation ? {
32
+ name: "operation",
33
+ fn: E(() => [S(t.$slots, "operation")]),
34
+ key: "0"
35
+ } : void 0]), 1032, [
36
+ "open",
37
+ "title",
38
+ "render-mode",
39
+ "subtitle",
40
+ "width",
41
+ "promotion"
42
+ ]));
43
+ }
44
+ });
45
+ //#endregion
46
+ //#region src/platform-admin-runtime/useWorkspaceViewPromotion.ts
47
+ function D(e) {
48
+ return e.hasStableIdentity && e.busy !== !0 && e.canChangeHost !== !1;
49
+ }
50
+ function xe(e) {
51
+ let t = de();
52
+ return f(() => {
53
+ let n = w(e.input);
54
+ if (!(!n || !D(w(e.eligibility)) || !t)) return {
55
+ title: "固定为页签",
56
+ promote: async () => {
57
+ if (await e.beforePromote?.(n) === !1) {
58
+ e.onPromotionRejected?.();
59
+ return;
60
+ }
61
+ let r = t.openPage(u(e.view, n, "tab", w(e.title)));
62
+ e.onPromoted?.(r);
63
+ }
64
+ };
65
+ });
66
+ }
67
+ //#endregion
68
+ //#region src/views/roleGrantClient.ts
69
+ function Se(e) {
70
+ return {
71
+ accountRoleGrants(t) {
72
+ return e.request({ path: `/iam.role/${encodeURIComponent(t)}/account-grants` });
73
+ },
74
+ grantAccountRole(t, n) {
75
+ return e.request({
76
+ method: "POST",
77
+ path: `/iam.role/${encodeURIComponent(t)}/account-grants`,
78
+ body: n
79
+ });
80
+ },
81
+ deleteAccountRoleGrant(t, n) {
82
+ return e.request({
83
+ method: "POST",
84
+ path: `/iam.role/${encodeURIComponent(t)}/account-grants/${encodeURIComponent(n)}/delete`
85
+ });
86
+ },
87
+ userSelector(t) {
88
+ return e.request({
89
+ method: "POST",
90
+ path: "/iam.user/selector/query",
91
+ body: t
92
+ });
93
+ },
94
+ employmentRoleGrants(t) {
95
+ return e.request({ path: `/iam.role/${encodeURIComponent(t)}/employment-grants` });
96
+ },
97
+ grantEmploymentRole(t, n) {
98
+ return e.request({
99
+ method: "POST",
100
+ path: `/iam.role/${encodeURIComponent(t)}/employment-grants`,
101
+ body: { employeePositionId: n }
102
+ });
103
+ },
104
+ deleteEmploymentRoleGrant(t, n) {
105
+ return e.request({
106
+ method: "POST",
107
+ path: `/iam.role/${encodeURIComponent(t)}/employment-grants/${encodeURIComponent(n)}/delete`
108
+ });
109
+ },
110
+ employmentSelector(t, n) {
111
+ return e.request({
112
+ method: "POST",
113
+ path: `/iam.role/${encodeURIComponent(t)}/employment-selector/query`,
114
+ body: n
115
+ });
116
+ },
117
+ authorizationModules(t) {
118
+ return e.request({ path: `/iam.role/authorizationModules/${encodeURIComponent(t)}` });
119
+ },
120
+ permissionMatrix(t, n) {
121
+ return e.request({
122
+ method: "POST",
123
+ path: `/iam.role/permissionMatrix/${encodeURIComponent(t)}`,
124
+ body: { moduleAliases: n }
125
+ });
126
+ },
127
+ grantAction(t, n) {
128
+ return e.request({
129
+ method: "POST",
130
+ path: `/iam.role/grant/${encodeURIComponent(t)}`,
131
+ body: n
132
+ });
133
+ },
134
+ revokeAction(t, n, r) {
135
+ return e.request({
136
+ method: "POST",
137
+ path: `/iam.role/revoke/${encodeURIComponent(t)}`,
138
+ body: {
139
+ moduleAlias: n,
140
+ actionCode: r
141
+ }
142
+ });
143
+ },
144
+ replacePermissionMatrix(t, n) {
145
+ return e.request({
146
+ method: "POST",
147
+ path: `/iam.role/permissionMatrix/${encodeURIComponent(t)}/replace`,
148
+ body: { actions: n }
149
+ });
150
+ },
151
+ dataGrantActionMatrix(t) {
152
+ return e.request({ path: `/iam.role/dataGrantActionMatrix/${encodeURIComponent(t)}` });
153
+ },
154
+ dataScopePolicyCatalog(t, n) {
155
+ return e.request({
156
+ path: `/iam.role/dataScopePolicyCatalog/${encodeURIComponent(t)}`,
157
+ query: n ? { moduleAlias: n } : void 0
158
+ });
159
+ },
160
+ replaceDataGrantActions(t, n) {
161
+ return e.request({
162
+ method: "POST",
163
+ path: `/iam.role/dataGrantActions/${encodeURIComponent(t)}`,
164
+ body: { actions: n }
165
+ });
166
+ }
167
+ };
168
+ }
169
+ //#endregion
170
+ //#region src/platform-admin-runtime/workspaceViewSessions.ts
171
+ var O = /* @__PURE__ */ new Map(), k = /* @__PURE__ */ new Map();
172
+ function A(e, t) {
173
+ return `${e.type}:${P(t)}`;
174
+ }
175
+ async function j(e, t, n) {
176
+ let r = A(e, t), i = k.get(r), a = i && [...i].at(-1);
177
+ return a ? await a(F(n)) ? "accepted" : "rejected" : (O.set(r, F(n)), "accepted");
178
+ }
179
+ function M(e, t, n) {
180
+ let r = A(e, t), i = k.get(r) ?? /* @__PURE__ */ new Set();
181
+ return i.add(n), k.set(r, i), () => {
182
+ i.delete(n), i.size === 0 && k.delete(r);
183
+ };
184
+ }
185
+ function N(e, t) {
186
+ let n = A(e, t), r = O.get(n);
187
+ return O.delete(n), r;
188
+ }
189
+ function P(e) {
190
+ return Array.isArray(e) ? `[${e.map(P).join(",")}]` : e && typeof e == "object" ? `{${Object.entries(e).sort(([e], [t]) => e.localeCompare(t)).map(([e, t]) => `${JSON.stringify(e)}:${P(t)}`).join(",")}}` : JSON.stringify(e);
191
+ }
192
+ function F(e) {
193
+ return JSON.parse(JSON.stringify(e));
194
+ }
195
+ //#endregion
196
+ //#region src/views/roleAuthorizationWorkspaceSession.ts
197
+ function Ce(e, t) {
198
+ return j(l, e, t);
199
+ }
200
+ function we(e, t) {
201
+ return M(l, e, t);
202
+ }
203
+ function Te(e) {
204
+ return N(l, e);
205
+ }
206
+ //#endregion
207
+ //#region src/views/RoleAuthorizationView.vue?vue&type=script&setup=true&lang.ts
208
+ var Ee = { class: "panel-title" }, De = {
209
+ key: 4,
210
+ class: "authorization-layout"
211
+ }, Oe = {
212
+ key: 0,
213
+ class: "authorization-column-header"
214
+ }, ke = {
215
+ key: 2,
216
+ class: "data-scope-editor"
217
+ }, Ae = { key: 0 }, je = { key: 1 }, Me = { key: 3 }, Ne = {
218
+ key: 4,
219
+ class: "not-applicable"
220
+ }, I = /*@__PURE__*/ y({
221
+ name: "RoleAuthorizationView",
222
+ __name: "RoleAuthorizationView",
223
+ props: {
224
+ roleId: {},
225
+ container: {},
226
+ drawer: { type: Boolean }
227
+ },
228
+ emits: ["close"],
229
+ setup(r, { emit: ee }) {
230
+ let s = r, de = ee, u = te({ moduleAlias: "iam.role" }), y = Se(u.http), S = s.roleId ?? new URLSearchParams(window.location.search).get("roleId") ?? "", w = ue(), D = s.roleId ? { roleId: s.roleId } : void 0, O = D ? Te(D) : void 0, k = x(), A = x([]), j = x(), M = x([]), N = x(), P = x(), F = x(!1), I = x(!1), L = x(!1), R = x(), z = x(), B = /* @__PURE__ */ new Map(), V = /* @__PURE__ */ new Map(), H = x(0), Pe, U = f(() => k.value?.roleKind === "group"), W = f(() => k.value?.roleKind === "dataGrant"), G = f(() => k.value?.assignmentType === "employment"), K = f(() => k.value?.title ?? S ?? "角色"), q = f(() => `授权:${K.value}`), Fe = f(() => Ie.value ? `动作授权 - ${Ie.value.title}` : `动作授权 - ${K.value}`), Ie = f(() => A.value.find((e) => e.moduleAlias === j.value)), Le = f(() => A.value.map((e) => ({
231
+ id: e.moduleAlias,
232
+ parentId: e.parentId,
233
+ title: e.title,
234
+ secondary: e.applicationAlias
235
+ }))), Re = f(() => (P.value?.options ?? []).map((e) => ({
236
+ value: e.code,
237
+ label: e.title
238
+ }))), ze = f(() => (P.value?.referenceDependencies ?? []).map((e) => ({
239
+ value: e.referenceFieldId,
240
+ label: `${e.title} → ${e.targetModuleTitle}`
241
+ }))), Be = f(() => new Map((P.value?.referenceDependencies ?? []).map((e) => [e.referenceFieldId, e]))), Ve = [
242
+ {
243
+ key: "title",
244
+ title: "动作",
245
+ width: 130
246
+ },
247
+ {
248
+ key: "granted",
249
+ title: "授权",
250
+ width: 88,
251
+ align: "center"
252
+ },
253
+ {
254
+ key: "dataScopePolicy",
255
+ title: "数据范围",
256
+ width: 160
257
+ }
258
+ ], He = [
259
+ {
260
+ key: "title",
261
+ title: "标准动作",
262
+ width: 130
263
+ },
264
+ {
265
+ key: "configured",
266
+ title: "启用模板",
267
+ width: 104,
268
+ align: "center"
269
+ },
270
+ {
271
+ key: "dataScopePolicy",
272
+ title: "数据范围",
273
+ width: 160
274
+ }
275
+ ], Ue = f(() => M.value), We = f(() => N.value?.actions ?? []), J = f(() => s.drawer === !0 || !!D && w?.presentation === "drawer"), Y = f(() => !!D), Ge = f(() => J.value ? be : Y.value ? a : "div"), Ke = f(() => J.value ? {
276
+ open: !0,
277
+ title: q.value,
278
+ container: s.container ?? null,
279
+ profile: l.drawerProfile,
280
+ promotion: Ze.value,
281
+ onClose: ut
282
+ } : Y.value ? { title: q.value } : {}), qe = f(() => {
283
+ let e = N.value;
284
+ return !e || z.value === void 0 ? !1 : JSON.stringify(e.actions) !== z.value;
285
+ }), Je = f(() => H.value >= 0 && [...B.entries()].some(([e, t]) => V.get(e) !== JSON.stringify(t))), X = f(() => qe.value || Je.value), Ye = f(() => M.value.length > 0 && M.value.every((e) => e.granted)), Xe = f(() => M.value.some((e) => e.granted) && !Ye.value), Ze = xe({
286
+ view: l,
287
+ input: () => D,
288
+ title: q,
289
+ eligibility: () => ({
290
+ hasStableIdentity: !!(S && k.value),
291
+ busy: L.value
292
+ }),
293
+ beforePromote: (e) => Ce(e, {
294
+ selectedModuleAlias: j.value,
295
+ dataGrantMatrix: N.value,
296
+ actionDrafts: [...B.entries()].map(([e, t]) => ({
297
+ moduleAlias: e,
298
+ actions: t
299
+ })),
300
+ actionSnapshots: [...V.entries()].map(([e, t]) => ({
301
+ moduleAlias: e,
302
+ snapshot: t
303
+ }))
304
+ }).then((e) => e === "accepted"),
305
+ onPromoted: dt,
306
+ onPromotionRejected: () => oe("目标页签存在未确认的授权配置;请先确认或关闭该页签后再固定当前抽屉。", {
307
+ source: "role-authorization",
308
+ phase: "validation"
309
+ })
310
+ });
311
+ _e(() => {
312
+ D && !J.value && (Pe = we(D, ft)), Z();
313
+ }), ye(q, (e) => {
314
+ Y.value && w?.setTitle(e);
315
+ }, { immediate: !0 }), ye(j, () => void Qe()), _e(() => window.addEventListener("beforeunload", mt)), ge(() => {
316
+ Pe?.(), window.removeEventListener("beforeunload", mt);
317
+ });
318
+ async function Z() {
319
+ if (!S) {
320
+ R.value = "缺少角色标识,无法打开授权页。";
321
+ return;
322
+ }
323
+ F.value = !0, R.value = void 0;
324
+ try {
325
+ if (k.value = await u.crud.view(S), k.value.roleKind === "group") return;
326
+ if (k.value.roleKind === "dataGrant") {
327
+ let [e, t] = await Promise.all([y.dataGrantActionMatrix(S), y.dataScopePolicyCatalog(S)]);
328
+ N.value = O?.dataGrantMatrix ?? e, P.value = t, z.value = JSON.stringify(e.actions);
329
+ return;
330
+ }
331
+ A.value = (await y.authorizationModules(S)).records, j.value = O?.selectedModuleAlias ?? A.value[0]?.moduleAlias;
332
+ } catch (e) {
333
+ R.value = "授权信息加载失败,请重试。", o(e, {
334
+ source: "role-authorization",
335
+ phase: "load"
336
+ });
337
+ } finally {
338
+ F.value = !1;
339
+ }
340
+ }
341
+ async function Qe() {
342
+ let e = j.value;
343
+ if (!(!e || W.value || U.value)) {
344
+ I.value = !0;
345
+ try {
346
+ let [t, n] = await Promise.all([y.permissionMatrix(S, [e]), y.dataScopePolicyCatalog(S, e)]), r = (t.modules[0]?.actions ?? []).map(st), i = O?.actionDrafts?.find((t) => t.moduleAlias === e)?.actions;
347
+ M.value = B.get(e) ?? i ?? r, B.has(e) || (B.set(e, M.value), V.set(e, O?.actionSnapshots?.find((t) => t.moduleAlias === e)?.snapshot ?? JSON.stringify(r))), H.value += 1, P.value = n;
348
+ } catch (e) {
349
+ o(e, {
350
+ source: "role-authorization",
351
+ phase: "load"
352
+ });
353
+ } finally {
354
+ I.value = !1;
355
+ }
356
+ }
357
+ }
358
+ function Q(e, t) {
359
+ t && e.dataAuth && G.value && !e.dataScopePolicy && (e.dataScopePolicy = "inheritDataGrant"), t && e.dataScopePolicy === "referenceDependency" && !e.referenceFieldId && (e.dataScopePolicy = "inheritDataGrant"), e.granted = t, H.value += 1;
360
+ }
361
+ function $e(e) {
362
+ M.value.forEach((t) => Q(t, e));
363
+ }
364
+ function et(e, t) {
365
+ if (e.dataScopePolicy = String(t || "none"), e.dataScopePolicy === "referenceDependency") {
366
+ e.referenceFieldId = void 0, e.referenceActionCode = void 0, H.value += 1;
367
+ return;
368
+ }
369
+ e.referenceFieldId = void 0, e.referenceActionCode = void 0, H.value += 1;
370
+ }
371
+ function tt(e, t) {
372
+ let n = Be.value.get(String(t || ""));
373
+ e.referenceFieldId = n?.referenceFieldId, e.referenceActionCode = n?.referenceActionCode, H.value += 1;
374
+ }
375
+ function nt(e) {
376
+ return Be.value.get(String(e || ""));
377
+ }
378
+ function rt(e) {
379
+ return typeof e == "string" || typeof e == "number" ? e : void 0;
380
+ }
381
+ function it(e) {
382
+ return e.dataScopePolicy ?? "inheritDataGrant";
383
+ }
384
+ function at(e) {
385
+ return !!e.dataAuth && G.value;
386
+ }
387
+ function ot(e, t) {
388
+ return e.key === "dataScopePolicy" && at(t);
389
+ }
390
+ function st(e) {
391
+ return G.value && e.dataAuth && e.dataScopePolicy === "none" ? {
392
+ ...e,
393
+ dataScopePolicy: "inheritDataGrant"
394
+ } : e;
395
+ }
396
+ async function ct() {
397
+ if (N.value) {
398
+ L.value = !0;
399
+ try {
400
+ await ie(await y.replaceDataGrantActions(S, N.value.actions.map((e) => ({
401
+ actionCode: e.actionCode,
402
+ dataScopePolicy: e.dataScopePolicy,
403
+ enabled: e.configured
404
+ }))), {
405
+ source: "role-authorization",
406
+ phase: "action",
407
+ fallbackMessage: "数据权限模板已保存"
408
+ }), z.value = JSON.stringify(N.value.actions);
409
+ } catch (e) {
410
+ o(e, {
411
+ source: "role-authorization",
412
+ phase: "action"
413
+ });
414
+ } finally {
415
+ L.value = !1;
416
+ }
417
+ }
418
+ }
419
+ async function lt() {
420
+ let e = [...B.entries()].filter(([e, t]) => V.get(e) !== JSON.stringify(t));
421
+ if (e.length) {
422
+ L.value = !0;
423
+ try {
424
+ await ie(await y.replacePermissionMatrix(S, e.flatMap(([e, t]) => t.map((t) => ({
425
+ moduleAlias: e,
426
+ actionCode: t.actionCode,
427
+ granted: !!t.granted,
428
+ dataScopePolicy: t.granted && t.dataAuth && G.value ? t.dataScopePolicy ?? "inheritDataGrant" : void 0,
429
+ referenceFieldId: t.granted && t.dataScopePolicy === "referenceDependency" ? t.referenceFieldId : void 0,
430
+ referenceActionCode: t.granted && t.dataScopePolicy === "referenceDependency" ? t.referenceActionCode : void 0
431
+ })))), {
432
+ source: "role-authorization",
433
+ phase: "action",
434
+ fallbackMessage: "角色授权已保存"
435
+ }), e.forEach(([e, t]) => V.set(e, JSON.stringify(t))), H.value += 1;
436
+ } catch (e) {
437
+ o(e, {
438
+ source: "role-authorization",
439
+ phase: "action"
440
+ });
441
+ } finally {
442
+ L.value = !1;
443
+ }
444
+ }
445
+ }
446
+ async function $() {
447
+ if (W.value) {
448
+ await ct();
449
+ return;
450
+ }
451
+ await lt();
452
+ }
453
+ async function ut() {
454
+ X.value && !await ce({
455
+ title: "放弃未确认的授权配置",
456
+ content: "当前修改尚未确认,关闭后将丢失这些修改。",
457
+ okText: "放弃修改",
458
+ danger: !0
459
+ }) || pt();
460
+ }
461
+ function dt() {
462
+ pt();
463
+ }
464
+ function ft(e) {
465
+ return X.value ? !1 : (j.value = e.selectedModuleAlias, N.value = e.dataGrantMatrix, B.clear(), V.clear(), e.actionDrafts?.forEach(({ moduleAlias: e, actions: t }) => B.set(e, t)), e.actionSnapshots?.forEach(({ moduleAlias: e, snapshot: t }) => V.set(e, t)), H.value += 1, !0);
466
+ }
467
+ function pt() {
468
+ if (s.drawer === !0) {
469
+ de("close");
470
+ return;
471
+ }
472
+ w?.dismiss();
473
+ }
474
+ function mt(e) {
475
+ X.value && (e.preventDefault(), e.returnValue = "");
476
+ }
477
+ return (r, a) => (b(), p(ve(Ge.value), he(pe(Ke.value)), g({
478
+ default: E(() => [h("section", { class: me(["role-authorization-page", { "role-authorization-page--drawer": J.value }]) }, [F.value ? (b(), p(T(ae), {
479
+ key: 0,
480
+ tip: "加载授权信息"
481
+ })) : R.value ? (b(), p(T(re), {
482
+ key: 1,
483
+ title: "授权页加载失败",
484
+ message: R.value
485
+ }, null, 8, ["message"])) : U.value ? (b(), p(T(le), {
486
+ key: 2,
487
+ title: "角色组不独立授权",
488
+ description: "角色组只组合成员角色;请到成员角色分别配置动作和数据权限。"
489
+ })) : W.value && N.value ? (b(), p(T(c), {
490
+ key: 3,
491
+ class: "data-grant-content",
492
+ title: Y.value ? "数据权限模板" : `数据权限模板 - ${K.value}`,
493
+ searchable: !1,
494
+ onRefresh: Z
495
+ }, {
496
+ default: E(() => [h("header", Ee, [a[3] ||= h("div", null, [h("h3", null, "标准动作的数据范围模板"), h("p", null, "模板只会在具体任职的普通角色动作选择“继承数据授权角色”时生效。")], -1), Y.value ? fe("v-if", !0) : (b(), p(T(e), {
497
+ key: 0,
498
+ type: "primary",
499
+ disabled: !X.value,
500
+ loading: L.value,
501
+ onClick: $
502
+ }, {
503
+ default: E(() => [...a[2] ||= [_(" 确认 ", -1)]]),
504
+ _: 1
505
+ }, 8, ["disabled", "loading"]))]), v(T(ne), {
506
+ columns: He,
507
+ rows: We.value,
508
+ "row-key": "actionCode",
509
+ "horizontal-scroll": ""
510
+ }, {
511
+ cell: E(({ column: e, record: n }) => [e.key === "title" ? (b(), m(d, { key: 0 }, [h("strong", null, C(n.title || n.actionCode), 1), h("small", null, C(n.actionCode), 1)], 64)) : e.key === "configured" ? (b(), p(T(i), {
512
+ key: 1,
513
+ checked: !!n.configured,
514
+ disabled: L.value,
515
+ onChange: (e) => n.configured = e
516
+ }, null, 8, [
517
+ "checked",
518
+ "disabled",
519
+ "onChange"
520
+ ])) : (b(), p(T(t), {
521
+ key: 2,
522
+ value: n.dataScopePolicy,
523
+ options: Re.value,
524
+ disabled: !n.configured || L.value,
525
+ placeholder: "请选择数据范围",
526
+ "allow-clear": !1,
527
+ "onUpdate:value": (e) => n.dataScopePolicy = String(e || "")
528
+ }, null, 8, [
529
+ "value",
530
+ "options",
531
+ "disabled",
532
+ "onUpdate:value"
533
+ ]))]),
534
+ _: 1
535
+ }, 8, ["rows"])]),
536
+ _: 1
537
+ }, 8, ["title"])) : (b(), m("section", De, [v(T(c), {
538
+ class: "module-panel",
539
+ title: "模块树",
540
+ "refresh-title": "刷新模块目录",
541
+ searchable: !1,
542
+ onRefresh: Z
543
+ }, {
544
+ default: E(() => [v(T(se), {
545
+ records: Le.value,
546
+ "selected-id": j.value,
547
+ onSelect: a[0] ||= (e) => j.value = e.id
548
+ }, null, 8, ["records", "selected-id"])]),
549
+ _: 1
550
+ }), v(T(c), {
551
+ class: "action-panel",
552
+ title: Fe.value,
553
+ searchable: !1
554
+ }, g({
555
+ default: E(() => [I.value ? (b(), p(T(ae), {
556
+ key: 0,
557
+ tip: "加载模块动作"
558
+ })) : j.value ? (b(), p(T(ne), {
559
+ key: 2,
560
+ columns: Ve,
561
+ rows: Ue.value,
562
+ "row-key": "actionCode",
563
+ "fill-height": "",
564
+ "horizontal-scroll": ""
565
+ }, {
566
+ header: E(({ column: e }) => [e.key === "granted" ? (b(), m("span", Oe, [v(T(n), {
567
+ checked: Ye.value,
568
+ indeterminate: Xe.value,
569
+ disabled: L.value || !M.value.length,
570
+ "aria-label": "全选当前模块动作授权",
571
+ onChange: $e
572
+ }, null, 8, [
573
+ "checked",
574
+ "indeterminate",
575
+ "disabled"
576
+ ]), a[5] ||= _(" 授权 ", -1)])) : (b(), m(d, { key: 1 }, [_(C(e.title), 1)], 64))]),
577
+ cell: E(({ column: e, record: r }) => [e.key === "title" ? (b(), m(d, { key: 0 }, [h("strong", null, C(r.title || r.actionCode), 1), h("small", null, C(r.permissionActionCode || r.actionCode), 1)], 64)) : e.key === "granted" ? (b(), p(T(n), {
578
+ key: 1,
579
+ checked: !!r.granted,
580
+ disabled: L.value,
581
+ onChange: (e) => Q(r, e)
582
+ }, null, 8, [
583
+ "checked",
584
+ "disabled",
585
+ "onChange"
586
+ ])) : r.dataAuth && G.value && r.granted ? (b(), m("div", ke, [v(T(t), {
587
+ value: it(r),
588
+ options: Re.value,
589
+ disabled: L.value,
590
+ "allow-clear": !1,
591
+ "onUpdate:value": (e) => et(r, e)
592
+ }, null, 8, [
593
+ "value",
594
+ "options",
595
+ "disabled",
596
+ "onUpdate:value"
597
+ ]), r.dataScopePolicy === "referenceDependency" ? (b(), m(d, { key: 0 }, [v(T(t), {
598
+ value: rt(r.referenceFieldId),
599
+ options: ze.value,
600
+ disabled: L.value,
601
+ placeholder: "请选择引用字段",
602
+ "allow-clear": !1,
603
+ "onUpdate:value": (e) => tt(r, e)
604
+ }, null, 8, [
605
+ "value",
606
+ "options",
607
+ "disabled",
608
+ "onUpdate:value"
609
+ ]), r.referenceFieldId ? (b(), m("small", Ae, " 依赖目标:" + C(nt(r.referenceFieldId)?.targetModuleTitle) + " · " + C(nt(r.referenceFieldId)?.referenceActionTitle), 1)) : (b(), m("small", je, "请先选择引用字段,再开启该动作授权。"))], 64)) : fe("v-if", !0)])) : ot(e, r) ? (b(), m("span", Me, "—")) : (b(), m("span", Ne, "不适用"))]),
610
+ _: 1
611
+ }, 8, ["rows"])) : (b(), p(T(le), {
612
+ key: 1,
613
+ title: "请选择模块"
614
+ }))]),
615
+ _: 2
616
+ }, [Y.value ? void 0 : {
617
+ name: "actions",
618
+ fn: E(() => [v(T(e), {
619
+ type: "primary",
620
+ disabled: !X.value,
621
+ loading: L.value,
622
+ onClick: $
623
+ }, {
624
+ default: E(() => [...a[4] ||= [_(" 确认 ", -1)]]),
625
+ _: 1
626
+ }, 8, ["disabled", "loading"])]),
627
+ key: "0"
628
+ }]), 1032, ["title"])]))], 2)]),
629
+ _: 2
630
+ }, [Y.value && !U.value ? {
631
+ name: "operation",
632
+ fn: E(() => [v(T(e), {
633
+ type: "primary",
634
+ disabled: !X.value,
635
+ loading: L.value,
636
+ onClick: $
637
+ }, {
638
+ default: E(() => [...a[1] ||= [_(" 确认 ", -1)]]),
639
+ _: 1
640
+ }, 8, ["disabled", "loading"])]),
641
+ key: "0"
642
+ } : void 0]), 1040));
643
+ }
644
+ }), L = /* @__PURE__ */ s({ default: () => R }), R = /*#__PURE__*/ r(I, [["__scopeId", "data-v-8b9dc5d9"]]);
645
+ //#endregion
646
+ export { N as a, M as i, L as n, Se as o, j as r, xe as s, R as t };
@@ -1,4 +1,4 @@
1
- import { t as e } from "./RoleManagementView-nY7qu4GF.js";
1
+ import { t as e } from "./RoleManagementView-0_KDrzgh.js";
2
2
  import { createBlock as t, defineComponent as n, openBlock as r } from "vue";
3
3
  //#endregion
4
4
  //#region src/views/RoleDetailWorkspaceView.vue