@ximatai/muyun-web-app 0.26.7 → 0.26.8

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 (87) hide show
  1. package/dist/{EmployeeDetailWorkspaceView-DYJLlkSz.js → EmployeeDetailWorkspaceView-DswEDSxH.js} +1 -1
  2. package/dist/{EmployeeManagementView-taxWUa7g.js → EmployeeManagementView-C9STtw08.js} +385 -386
  3. package/dist/{MetadataOrchestrationView-B-CPudJl.js → MetadataOrchestrationView-DKYVGMzy.js} +95 -95
  4. package/dist/{ModuleActionManagementView-CmVj0e0C.js → ModuleActionManagementView-DiVzuPdu.js} +72 -72
  5. package/dist/{RoleAuthorizationView-q_6CsBYq.js → RoleAuthorizationView-C0s4Bog7.js} +47 -47
  6. package/dist/{RoleDetailWorkspaceView-DmJlJgAj.js → RoleDetailWorkspaceView-dqHxKVfd.js} +1 -1
  7. package/dist/{RoleManagementView-HCa9rH0f.js → RoleManagementView-D43pUCxi.js} +468 -469
  8. package/dist/{SystemUserDetailWorkspaceView-U6Ij0US1.js → SystemUserDetailWorkspaceView-CQ9WeLrR.js} +1 -1
  9. package/dist/SystemUserManagementView-D75_ylYk.js +758 -0
  10. package/dist/{UserDetailWorkspaceView-OPYvD6mH.js → UserDetailWorkspaceView-BCST01d2.js} +1 -1
  11. package/dist/UserManagementView-CcdvDo_y.js +964 -0
  12. package/dist/index.css +1 -1
  13. package/dist/index.js +2278 -4726
  14. package/dist/{pageRealtime-CzJlr9hs.js → pageRealtime-EAiGWKEo.js} +87 -85
  15. package/dist/{platform-components-DKKWbNrz.js → platform-components-CFU_zR7-.js} +2145 -1866
  16. package/dist/types/app/workbenchStartup.d.ts +6 -2
  17. package/dist/types/consumer/AppWorkbenchShell.vue.d.ts +2 -2
  18. package/dist/types/consumer/index.d.ts +4 -3
  19. package/dist/types/dynamic-page-runtime/DynamicModuleWorkspaceDetailView.vue.d.ts +10 -0
  20. package/dist/types/dynamic-page-runtime/DynamicRecordDetailActions.vue.d.ts +38 -0
  21. package/dist/types/dynamic-page-runtime/NavigatorManagementEditor.vue.d.ts +25 -0
  22. package/dist/types/dynamic-page-runtime/PageNavigatorExplorer.vue.d.ts +43 -0
  23. package/dist/types/dynamic-page-runtime/detailSurfacePreference.d.ts +10 -0
  24. package/dist/types/dynamic-page-runtime/index.d.ts +2 -1
  25. package/dist/types/dynamic-page-runtime/modulePageEnhancements.d.ts +38 -0
  26. package/dist/types/dynamic-page-runtime/modulePageNavigation.d.ts +1 -1
  27. package/dist/types/dynamic-page-runtime/pageContextRuntime.d.ts +6 -0
  28. package/dist/types/dynamic-page-runtime/recordDetailController.d.ts +27 -0
  29. package/dist/types/platform-admin-runtime/index.d.ts +1 -1
  30. package/dist/types/platform-admin-runtime/platformAdminRoutes.d.ts +5 -0
  31. package/dist/types/platform-admin-runtime/realtime.d.ts +2 -1
  32. package/dist/types/platform-components/BusinessNotificationPanel.vue.d.ts +12 -0
  33. package/dist/types/platform-components/CrudRecordListExplorer.vue.d.ts +6 -0
  34. package/dist/types/platform-components/ManagementPanelHeader.vue.d.ts +5 -3
  35. package/dist/types/platform-components/ManagementWorkspace.vue.d.ts +8 -2
  36. package/dist/types/platform-components/RecordActionBar.vue.d.ts +1 -1
  37. package/dist/types/platform-components/RecordDetailDrawer.vue.d.ts +4 -1
  38. package/dist/types/platform-components/RecordDetailLayout.vue.d.ts +8 -6
  39. package/dist/types/platform-components/RecordDetailPanel.vue.d.ts +7 -5
  40. package/dist/types/platform-components/RecordModeDrawer.vue.d.ts +4 -1
  41. package/dist/types/platform-components/RecordMultiPicker.vue.d.ts +1 -1
  42. package/dist/types/platform-components/RecordPanelButton.vue.d.ts +2 -0
  43. package/dist/types/platform-components/RecordPicker.vue.d.ts +1 -1
  44. package/dist/types/platform-components/RecordQueryListPanel.vue.d.ts +9 -2
  45. package/dist/types/platform-components/RecordStatusSwitch.vue.d.ts +3 -0
  46. package/dist/types/platform-components/StaticManagementLayout.vue.d.ts +13 -7
  47. package/dist/types/platform-components/TreeRecordExplorer.vue.d.ts +3 -0
  48. package/dist/types/platform-components/index.d.ts +4 -2
  49. package/dist/types/platform-components/managementWorkspaceLayout.d.ts +14 -0
  50. package/dist/types/platform-components/recordFormFieldModel.d.ts +2 -2
  51. package/dist/types/platform-components/recycleBinState.d.ts +2 -0
  52. package/dist/types/platform-components/scopedTreeModuleContext.d.ts +11 -0
  53. package/dist/types/platform-workbench/index.d.ts +1 -0
  54. package/dist/types/platform-workbench/menuNavigation.d.ts +3 -0
  55. package/dist/types/platform-workbench/modulePageWorkspaceViews.d.ts +7 -0
  56. package/dist/types/platform-workbench/workbenchLayout.d.ts +36 -0
  57. package/dist/types/platform-workbench/workbenchNavigation.d.ts +2 -0
  58. package/dist/types/platform-workbench/workspaceViewHost.d.ts +2 -0
  59. package/dist/types/vue-ui-antdv/components/UiButton.vue.d.ts +1 -1
  60. package/dist/types/vue-ui-antdv/components/UiDataTable.vue.d.ts +1 -1
  61. package/dist/types/vue-ui-antdv/components/UiIcon.vue.d.ts +1 -1
  62. package/dist/types/vue-ui-antdv/components/UiModal.vue.d.ts +1 -1
  63. package/dist/types/vue-ui-antdv/components/UiSelect.vue.d.ts +1 -1
  64. package/dist/types/vue-ui-antdv/components/UiTreeSelect.vue.d.ts +7 -1
  65. package/dist/types/vue-ui-antdv/index.d.ts +1 -0
  66. package/dist/types/web-contracts/index.d.ts +110 -17
  67. package/dist/types/web-core/businessNotifications.d.ts +3 -0
  68. package/dist/types/web-core/index.d.ts +1 -0
  69. package/dist/types/web-core/module/moduleContext.d.ts +1 -0
  70. package/dist/types/web-core/module/runtimeContext.d.ts +3 -1
  71. package/dist/types/web-core/module/staticModuleClient.d.ts +8 -1
  72. package/dist/types/web-core/realtime.d.ts +5 -1
  73. package/dist/{useUserSessionRows-CBHEzRFQ.js → useUserSessionRows-DCpUZCzN.js} +2 -2
  74. package/dist/workspaceViewSessions-Dj1LjdG1.js +4984 -0
  75. package/package.json +1 -1
  76. package/dist/SystemUserManagementView-C1CkKivH.js +0 -758
  77. package/dist/UserManagementView-gbCL9SnC.js +0 -965
  78. package/dist/currentUserContext-B1lj1WgF.js +0 -11
  79. package/dist/types/views/ApplicationManagementView.vue.d.ts +0 -3
  80. package/dist/types/views/DepartmentManagementView.vue.d.ts +0 -3
  81. package/dist/types/views/FieldSpecManagementView.vue.d.ts +0 -3
  82. package/dist/types/views/OrganizationManagementView.vue.d.ts +0 -3
  83. package/dist/types/views/applicationManagementState.d.ts +0 -64
  84. package/dist/types/views/departmentManagementState.d.ts +0 -137
  85. package/dist/types/views/fieldSpecManagementState.d.ts +0 -80
  86. package/dist/types/views/organizationManagementState.d.ts +0 -64
  87. package/dist/workspaceViewSessions-DkB9myrq.js +0 -3252
@@ -0,0 +1,964 @@
1
+ import { C as e, F as t, Ft as n, I as r, J as i, Kn as ee, M as te, N as ne, Nt as a, T as re, Vt as ie, X as ae, ct as o, dt as s, h as oe, i as c, it as se, j as l, k as ce, kt as u, l as le, nt as ue, r as de, ut as d, v as f, w as fe, y as p, yt as pe } from "./platform-components-CFU_zR7-.js";
2
+ import { S as me, d as m, i as he, j as ge, n as h, r as g, t as _ } from "./workspaceViewSessions-Dj1LjdG1.js";
3
+ import { f as v, n as _e } from "./pageRealtime-EAiGWKEo.js";
4
+ import { t as ve } from "./useUserSessionRows-DCpUZCzN.js";
5
+ import { Fragment as y, computed as b, createBlock as x, createCommentVNode as S, createElementBlock as C, createElementVNode as w, createTextVNode as T, createVNode as E, defineComponent as D, normalizeClass as ye, onBeforeUnmount as be, onMounted as xe, openBlock as O, ref as k, toDisplayString as A, unref as j, watch as M, withCtx as N, withModifiers as P } from "vue";
6
+ //#region src/platform-admin-runtime/sessionRecovery.ts
7
+ var F;
8
+ function I(e, t) {
9
+ return F?.(e, t) ?? !1;
10
+ }
11
+ //#endregion
12
+ //#region src/platform-admin-runtime/backendHttp.ts
13
+ function Se(e = {}) {
14
+ return ee({
15
+ baseUrl: void 0,
16
+ token: e.withAuth === !1 ? void 0 : v(void 0),
17
+ credentials: Ce(void 0),
18
+ onAuthenticationRequired: e.withAuth === !1 ? void 0 : (e, t) => I(e, t)
19
+ });
20
+ }
21
+ function Ce(e) {
22
+ return e === "include" || e === "omit" || e === "same-origin" ? e : void 0;
23
+ }
24
+ //#endregion
25
+ //#region src/views/UserDetailContent.vue?vue&type=script&setup=true&lang.ts
26
+ var we = {
27
+ key: 1,
28
+ class: "user-detail-state"
29
+ }, Te = {
30
+ key: 1,
31
+ class: "user-password-reset-result"
32
+ }, Ee = { key: 0 }, L = { key: 1 }, De = { class: "user-form-label" }, Oe = /*#__PURE__*/ n(/* @__PURE__ */ D({
33
+ name: "UserDetailContent",
34
+ __name: "UserDetailContent",
35
+ props: {
36
+ mode: {},
37
+ draft: {},
38
+ selectedUser: {},
39
+ loading: { type: Boolean },
40
+ loadFailed: { type: Boolean },
41
+ saving: { type: Boolean },
42
+ tenantTitle: {},
43
+ fields: {},
44
+ fallback: {},
45
+ fieldNames: {},
46
+ password: {},
47
+ resetPasswordResult: {},
48
+ displayOf: { type: Function },
49
+ disabledOf: { type: Function }
50
+ },
51
+ emits: [
52
+ "retry",
53
+ "save",
54
+ "update:field",
55
+ "update:password"
56
+ ],
57
+ setup(e, { emit: t }) {
58
+ let n = t;
59
+ return (t, r) => e.loading ? (O(), x(j(s), {
60
+ key: 0,
61
+ class: "user-detail-state",
62
+ tip: "加载用户详情"
63
+ })) : e.loadFailed ? (O(), C("div", we, [E(j(d), {
64
+ title: "详情加载失败",
65
+ message: "无法加载用户详情,请重试"
66
+ }), E(j(a), {
67
+ type: "primary",
68
+ "icon-name": "reload",
69
+ onClick: r[0] ||= (e) => n("retry")
70
+ }, {
71
+ default: N(() => [...r[4] ||= [T("重试", -1)]]),
72
+ _: 1
73
+ })])) : e.mode === "view" || e.mode === "create" || e.selectedUser ? (O(), C(y, { key: 2 }, [
74
+ e.mode === "view" ? (O(), x(j(l), {
75
+ key: 0,
76
+ record: e.draft,
77
+ fields: e.fields,
78
+ fallback: e.fallback,
79
+ "display-of": e.displayOf
80
+ }, null, 8, [
81
+ "record",
82
+ "fields",
83
+ "fallback",
84
+ "display-of"
85
+ ])) : S("v-if", !0),
86
+ e.mode === "view" && e.resetPasswordResult?.temporaryPassword ? (O(), C("div", Te, [
87
+ r[6] ||= w("span", null, "临时密码", -1),
88
+ E(j(u), {
89
+ value: e.resetPasswordResult.temporaryPassword,
90
+ disabled: ""
91
+ }, null, 8, ["value"]),
92
+ e.resetPasswordResult.expiresAt ? (O(), C("small", Ee, [r[5] ||= T(" 有效期至 ", -1), E(j(i), { value: e.resetPasswordResult.expiresAt }, null, 8, ["value"])])) : S("v-if", !0)
93
+ ])) : S("v-if", !0),
94
+ e.mode === "view" ? S("v-if", !0) : (O(), C("form", {
95
+ key: 2,
96
+ class: "user-form",
97
+ onSubmit: r[3] ||= P((e) => n("save"), ["prevent"])
98
+ }, [
99
+ w("label", null, [r[7] ||= w("span", { class: "user-form-label" }, "当前租户", -1), E(j(u), {
100
+ value: e.tenantTitle,
101
+ disabled: ""
102
+ }, null, 8, ["value"])]),
103
+ e.mode === "resetPassword" ? S("v-if", !0) : (O(), x(j(p), {
104
+ key: 0,
105
+ record: e.draft,
106
+ "field-names": e.fieldNames,
107
+ fields: e.fields,
108
+ fallback: e.fallback,
109
+ disabled: e.saving,
110
+ "disabled-of": e.disabledOf,
111
+ "onUpdate:field": r[1] ||= (e, t) => n("update:field", e, t)
112
+ }, null, 8, [
113
+ "record",
114
+ "field-names",
115
+ "fields",
116
+ "fallback",
117
+ "disabled",
118
+ "disabled-of"
119
+ ])),
120
+ e.mode === "create" || e.mode === "resetPassword" ? (O(), C("label", L, [w("span", De, A(e.mode === "create" ? "初始密码" : "新密码"), 1), E(j(u), {
121
+ value: e.password,
122
+ type: "password",
123
+ disabled: e.saving,
124
+ placeholder: "请输入密码",
125
+ "allow-clear": "",
126
+ "onUpdate:value": r[2] ||= (e) => n("update:password", e)
127
+ }, null, 8, ["value", "disabled"])])) : S("v-if", !0)
128
+ ], 32)),
129
+ e.mode !== "create" && e.mode !== "resetPassword" ? (O(), x(j(f), {
130
+ key: 3,
131
+ record: e.draft
132
+ }, null, 8, ["record"])) : S("v-if", !0)
133
+ ], 64)) : S("v-if", !0);
134
+ }
135
+ }), [["__scopeId", "data-v-621edc75"]]);
136
+ //#endregion
137
+ //#region src/views/userDetailWorkspaceSession.ts
138
+ function ke(e, t) {
139
+ return _(m, e, {
140
+ ...t,
141
+ selectedUser: { ...t.selectedUser },
142
+ draft: { ...t.draft },
143
+ tenant: t.tenant ? { ...t.tenant } : void 0
144
+ });
145
+ }
146
+ function Ae(e, t) {
147
+ return h(m, e, t);
148
+ }
149
+ function je(e) {
150
+ return g(m, e);
151
+ }
152
+ //#endregion
153
+ //#region src/views/userDetailStateModel.ts
154
+ function Me(e) {
155
+ return !e;
156
+ }
157
+ function Ne(e) {
158
+ return e.activeRequestSeq === e.requestSeq && e.selectedUserKey === e.recordId;
159
+ }
160
+ function Pe(e) {
161
+ return e === "edit" ? "edit" : "view";
162
+ }
163
+ //#endregion
164
+ //#region src/views/UserManagementView.vue
165
+ var Fe = /*#__PURE__*/ n(/* @__PURE__ */ D({
166
+ name: "UserManagementView",
167
+ __name: "UserManagementView",
168
+ props: {
169
+ recordId: {},
170
+ mode: {}
171
+ },
172
+ setup(n) {
173
+ let i = n, ee = ie({ moduleAlias: "iam.tenant" }), a = ie({ moduleAlias: "iam.user" }), s = ge(), l = me(), u = k(""), d = k(0), f = k(0), p = k(), h = k(), g = k(), _ = k(!1), v = k("view"), y = k(!1), w = k(!1), T = k(!1), D = k(0), A = k(X(void 0)), P = k(""), F = k(), I = k(ne(void 0)), { expandedUserKeys: Ce, handleUserListLoaded: we, handleUserRowExpand: Te, handleUserSessionBusinessEvent: Ee, loadUserSessions: L, resetUserSessionRows: De, userOnlineStatusTitle: Fe, userSessionState: R } = ve({
174
+ context: a,
175
+ source: "user-management"
176
+ }), Ie = b(() => ee), z = b(() => !!i.recordId), B = b(() => z.value && l?.presentation === "drawer"), Le = b(() => !z.value || B.value), V = b(() => s?.value?.system === !0), H = b(() => {
177
+ let e = s?.value?.tenantId;
178
+ if (!(s?.value?.system === !0 || !e)) return {
179
+ id: e,
180
+ title: e,
181
+ alias: e,
182
+ enabled: !0
183
+ };
184
+ }), Re = b(() => $e(a, p.value)), ze = b(() => [
185
+ {
186
+ key: "username",
187
+ title: "账号",
188
+ width: "180px"
189
+ },
190
+ {
191
+ key: "onlineStatus",
192
+ title: "在线状态",
193
+ width: "100px",
194
+ align: "center"
195
+ },
196
+ {
197
+ key: "enabled",
198
+ title: "状态",
199
+ type: "enabledStatus",
200
+ width: "90px",
201
+ align: "center"
202
+ },
203
+ {
204
+ key: "passwordStatus",
205
+ title: "密码状态",
206
+ width: "120px"
207
+ },
208
+ {
209
+ key: "employeeNo",
210
+ title: "职员工号",
211
+ width: "150px"
212
+ },
213
+ {
214
+ key: "employeeTitle",
215
+ title: "职员姓名",
216
+ width: "150px"
217
+ },
218
+ {
219
+ key: "lastLoginAt",
220
+ title: "最后登录时间",
221
+ type: "datetime",
222
+ width: "180px"
223
+ }
224
+ ]), Be = b(() => !!p.value?.id), Ve = b(() => p.value ? `用户列表 - ${$(p.value)}` : "用户列表"), He = b(() => v.value === "create" ? "新建用户" : Dt(g.value ?? A.value)), Ue = b(() => {
225
+ if (v.value !== "create") return Ot(g.value ?? A.value);
226
+ }), U = b(() => {
227
+ if (y.value) return !1;
228
+ if (v.value === "create") return !!p.value?.id && a.can("create") === !0;
229
+ if (v.value === "edit") return !!g.value?.id && a.can("update") === !0;
230
+ if (v.value === "resetPassword") {
231
+ let e = g.value?.id;
232
+ return !!e && a.can("changePassword", e) === !0;
233
+ }
234
+ return !1;
235
+ }), W = b(() => !g.value?.id || y.value ? !1 : a.can(Et(g.value)) === !0), We = b(() => v.value === "view" ? g.value?.id ? [
236
+ {
237
+ key: "edit",
238
+ actionCode: "update",
239
+ title: "编辑",
240
+ iconName: "edit",
241
+ disabled: T.value
242
+ },
243
+ {
244
+ key: "resetPassword",
245
+ actionCode: "changePassword",
246
+ title: "修改密码",
247
+ iconName: "lock",
248
+ disabled: T.value
249
+ },
250
+ {
251
+ key: "resetGeneratedPassword",
252
+ actionCode: "resetPassword",
253
+ title: "重置密码",
254
+ iconName: "reload",
255
+ disabled: T.value
256
+ },
257
+ {
258
+ key: "delete",
259
+ actionCode: "delete",
260
+ title: "删除",
261
+ iconName: "delete",
262
+ danger: !0,
263
+ disabled: T.value
264
+ }
265
+ ] : [] : [{
266
+ key: "cancel",
267
+ title: "取消",
268
+ iconName: "close",
269
+ disabled: T.value
270
+ }, {
271
+ key: "save",
272
+ actionCode: v.value === "create" ? "create" : v.value === "resetPassword" ? "changePassword" : "update",
273
+ title: "保存",
274
+ iconName: "save",
275
+ primary: !0,
276
+ loading: T.value,
277
+ disabled: !U.value
278
+ }]), Ge = b(() => We.value), Ke = b(() => v.value === "view" ? g.value?.id ? [{
279
+ key: "edit",
280
+ actionCode: "update",
281
+ title: "编辑",
282
+ iconName: "edit",
283
+ disabled: T.value
284
+ }] : [] : v.value === "edit" ? [{
285
+ key: "cancel",
286
+ title: "取消",
287
+ iconName: "close",
288
+ disabled: T.value
289
+ }, {
290
+ key: "save",
291
+ actionCode: "update",
292
+ title: "保存",
293
+ iconName: "save",
294
+ primary: !0,
295
+ loading: T.value,
296
+ disabled: !U.value
297
+ }] : []), qe = he({
298
+ view: m,
299
+ input: b(() => {
300
+ let e = g.value?.id, t = v.value;
301
+ return e && (t === "view" || t === "edit") ? { recordId: e } : void 0;
302
+ }),
303
+ title: b(() => Dt(g.value)),
304
+ eligibility: b(() => ({
305
+ hasStableIdentity: !!g.value?.id && !y.value,
306
+ busy: T.value
307
+ })),
308
+ beforePromote: async (e) => {
309
+ let t = g.value;
310
+ if (t) return await ke(e, {
311
+ selectedUser: t,
312
+ draft: A.value,
313
+ tenant: p.value,
314
+ mode: v.value === "edit" ? "edit" : "view",
315
+ password: P.value,
316
+ resetPasswordResult: F.value
317
+ }) === "accepted";
318
+ },
319
+ onPromoted: K
320
+ });
321
+ M(g, (e) => {
322
+ !z.value || !e || l?.setTitle(Dt(e));
323
+ }, { immediate: !0 });
324
+ let Je = b(() => ({
325
+ username: {
326
+ label: "账号",
327
+ required: !0,
328
+ visible: !0,
329
+ placeholder: "请输入登录账号"
330
+ },
331
+ enabled: {
332
+ label: "允许登录",
333
+ visible: !0,
334
+ controlType: "enabledStatus"
335
+ }
336
+ })), Ye = b(() => ["username", "enabled"]), Xe;
337
+ xe(() => {
338
+ if (Qe(), i.recordId) {
339
+ let e = { recordId: i.recordId };
340
+ B.value || (Xe = Ae(e, Ze));
341
+ let t = je(e);
342
+ if (t) {
343
+ yt(t);
344
+ return;
345
+ }
346
+ G({ id: i.recordId }, i.mode ?? "view");
347
+ }
348
+ }), be(() => Xe?.());
349
+ function Ze(e) {
350
+ return v.value === "view" ? (yt(e), !0) : !1;
351
+ }
352
+ _e(Ee), M(H, nt, { immediate: !0 }), M(p, () => {
353
+ z.value || (h.value = void 0, g.value = void 0, De(), A.value = X(p.value), K(), f.value += 1);
354
+ });
355
+ async function Qe() {
356
+ try {
357
+ I.value = ne((await a.runtime.ready).uiDescriptor);
358
+ } catch (e) {
359
+ ue(e, {
360
+ source: "user-management",
361
+ phase: "load"
362
+ });
363
+ }
364
+ }
365
+ function $e(e, t) {
366
+ return {
367
+ ...e,
368
+ crud: {
369
+ ...e.crud,
370
+ query: (n) => e.crud.query(et(n, t))
371
+ }
372
+ };
373
+ }
374
+ function et(e, t) {
375
+ let n = [...e?.conditions ?? []];
376
+ return t?.id && n.push({
377
+ fieldName: "tenantId",
378
+ operator: "EQ",
379
+ values: [t.id]
380
+ }), {
381
+ ...e,
382
+ conditions: n
383
+ };
384
+ }
385
+ function tt(e) {
386
+ !V.value || p.value || e.length > 0 && rt(e[0]);
387
+ }
388
+ function nt(e = H.value) {
389
+ z.value || !e || V.value || p.value || (p.value = e);
390
+ }
391
+ function rt(e) {
392
+ q() && (p.value = e);
393
+ }
394
+ function it(e) {
395
+ e.key === "create" && st();
396
+ }
397
+ function at(e, t) {
398
+ if (q()) {
399
+ if (e.key === "view") {
400
+ G(t, "view");
401
+ return;
402
+ }
403
+ if (e.key === "edit") {
404
+ G(t, "edit");
405
+ return;
406
+ }
407
+ e.key === "delete" && vt(t);
408
+ }
409
+ }
410
+ function ot(e) {
411
+ q() && G(e, "view");
412
+ }
413
+ function st() {
414
+ if (q()) {
415
+ if (!p.value?.id) {
416
+ se("请先选择租户", { phase: "validation" });
417
+ return;
418
+ }
419
+ g.value = void 0, h.value = void 0, A.value = X(p.value), P.value = "", v.value = "create", y.value = !1, w.value = !1, D.value += 1, _.value = !0;
420
+ }
421
+ }
422
+ async function G(e, t) {
423
+ if (!q()) return;
424
+ let n = String(e.id ?? "");
425
+ if (!n) return;
426
+ h.value = n, _.value = !0, v.value = t, g.value = void 0, A.value = Z(e), P.value = "", F.value = void 0, y.value = !0, w.value = !1;
427
+ let r = D.value + 1;
428
+ D.value = r;
429
+ try {
430
+ let e = await a.crud.view(n);
431
+ if (!J(n, r)) return;
432
+ if (!e?.id) {
433
+ w.value = !0, se("未找到指定用户", {
434
+ source: "user-management",
435
+ phase: "load"
436
+ });
437
+ return;
438
+ }
439
+ let i = await ct(n);
440
+ if (!J(n, r)) return;
441
+ Y({
442
+ ...e,
443
+ ...i
444
+ }, t);
445
+ } catch (e) {
446
+ J(n, r) && (w.value = !0, ue(e, {
447
+ source: "user-management",
448
+ phase: "load"
449
+ }));
450
+ } finally {
451
+ J(n, r) && (y.value = !1);
452
+ }
453
+ }
454
+ function ct(e) {
455
+ return Se().request({ path: `/iam.user/${encodeURIComponent(e)}/employee-binding` });
456
+ }
457
+ function K() {
458
+ T.value || (D.value += 1, y.value = !1, w.value = !1, _.value = !1, v.value = "view", P.value = "", F.value = void 0, A.value = g.value ? Z(g.value) : X(p.value), B.value && l?.dismiss());
459
+ }
460
+ function lt() {
461
+ if (!T.value) {
462
+ if (!g.value?.id || v.value === "create") {
463
+ K();
464
+ return;
465
+ }
466
+ A.value = Z(g.value), P.value = "", F.value = void 0, v.value = "view", y.value = !1, w.value = !1;
467
+ }
468
+ }
469
+ function ut(e) {
470
+ if (e.key === "cancel") {
471
+ lt();
472
+ return;
473
+ }
474
+ if (e.key === "save") {
475
+ ft();
476
+ return;
477
+ }
478
+ if (q()) {
479
+ if (e.key === "edit" && g.value) {
480
+ A.value = Z(g.value), v.value = "edit";
481
+ return;
482
+ }
483
+ if (e.key === "resetPassword" && g.value) {
484
+ P.value = "", F.value = void 0, v.value = "resetPassword";
485
+ return;
486
+ }
487
+ if (e.key === "resetGeneratedPassword" && g.value) {
488
+ mt();
489
+ return;
490
+ }
491
+ e.key === "delete" && vt(g.value);
492
+ }
493
+ }
494
+ function dt() {
495
+ let e = String(A.value.id ?? h.value ?? "");
496
+ if (!e) return;
497
+ let t = v.value === "create" ? "view" : v.value;
498
+ G({
499
+ ...A.value,
500
+ id: e
501
+ }, t);
502
+ }
503
+ async function ft() {
504
+ if (v.value === "resetPassword") {
505
+ await pt();
506
+ return;
507
+ }
508
+ await de({
509
+ loading: T,
510
+ mode: v.value === "edit" ? "edit" : "create",
511
+ source: "user-management",
512
+ validateContext: () => v.value === "create" && !p.value?.id ? "请先选择租户" : void 0,
513
+ canSave: () => U.value,
514
+ deniedMessage: "当前用户无权保存用户",
515
+ createRecord: () => St(A.value, p.value, v.value, P.value),
516
+ validateRecord: Ct,
517
+ save: (e, t) => t === "edit" && g.value?.id ? a.crud.update(g.value.id, e) : a.crud.insert(e),
518
+ onSaved: ({ record: e }) => {
519
+ Y(e), f.value += 1;
520
+ }
521
+ });
522
+ }
523
+ async function pt() {
524
+ await c({
525
+ loading: T,
526
+ source: "user-management",
527
+ record: () => g.value?.id ? g.value : void 0,
528
+ canExecute: () => U.value,
529
+ deniedMessage: "当前用户无权重置用户密码",
530
+ execute: (e) => a.http.request({
531
+ method: "POST",
532
+ path: `/iam.user/changePassword/${encodeURIComponent(e.id)}`,
533
+ body: { password: P.value }
534
+ }),
535
+ onExecuted: async (e, t) => {
536
+ Y(await a.crud.view(t.id)), f.value += 1;
537
+ }
538
+ });
539
+ }
540
+ async function mt() {
541
+ await c({
542
+ loading: T,
543
+ source: "user-management",
544
+ record: () => g.value?.id ? g.value : void 0,
545
+ canExecute: (e) => a.can("resetPassword", e.id) === !0,
546
+ deniedMessage: "当前用户无权重置用户密码",
547
+ execute: (e) => a.http.request({
548
+ method: "POST",
549
+ path: `/iam.user/resetPassword/${encodeURIComponent(e.id)}`
550
+ }),
551
+ onExecuted: async (e, t) => {
552
+ Y(await a.crud.view(t.id)), F.value = e, f.value += 1;
553
+ }
554
+ });
555
+ }
556
+ async function ht(e, t) {
557
+ await c({
558
+ loading: T,
559
+ source: "user-management",
560
+ record: () => e?.id ? e : void 0,
561
+ canExecute: (e) => a.can("revokeSession", e.id) === !0 && !t.current,
562
+ deniedMessage: "当前用户无权下线该登录会话",
563
+ confirm: (e) => o({
564
+ title: "下线登录会话",
565
+ content: `确认下线用户「${Q(e)}」的该登录会话?`,
566
+ okText: "下线",
567
+ danger: !0
568
+ }),
569
+ execute: (e) => a.http.request({
570
+ method: "POST",
571
+ path: `/iam.user/${encodeURIComponent(e.id)}/sessions/${encodeURIComponent(t.id)}/revoke`
572
+ }),
573
+ onExecuted: (e, t) => {
574
+ L(t.id), f.value += 1;
575
+ }
576
+ });
577
+ }
578
+ async function gt(e) {
579
+ let t = bt(String(e.id ?? "")).map((e) => e.id);
580
+ if (t.length === 0) {
581
+ se("当前没有可下线的登录会话", {
582
+ source: "user-management",
583
+ phase: "validation"
584
+ });
585
+ return;
586
+ }
587
+ await c({
588
+ loading: T,
589
+ source: "user-management",
590
+ record: () => e?.id ? e : void 0,
591
+ canExecute: (e) => a.can("revokeSessions", e.id) === !0,
592
+ deniedMessage: "当前用户无权批量下线登录会话",
593
+ confirm: (e) => o({
594
+ title: "批量下线登录会话",
595
+ content: `确认下线用户「${Q(e)}」的 ${t.length} 个登录会话?`,
596
+ okText: "全部下线",
597
+ danger: !0
598
+ }),
599
+ execute: (e) => a.http.request({
600
+ method: "POST",
601
+ path: `/iam.user/${encodeURIComponent(e.id)}/sessions/revoke`,
602
+ body: { sessionIds: t }
603
+ }),
604
+ onExecuted: (e, t) => {
605
+ L(t.id), f.value += 1;
606
+ }
607
+ });
608
+ }
609
+ async function _t() {
610
+ await c({
611
+ loading: T,
612
+ source: "user-management",
613
+ record: () => g.value?.id ? g.value : void 0,
614
+ canExecute: () => W.value,
615
+ deniedMessage: "当前用户无权变更用户启停状态",
616
+ execute: (e) => e.enabled === !1 ? a.crud.enable(e.id, { version: e.version }) : a.crud.disable(e.id, { version: e.version }),
617
+ onExecuted: async (e, t) => {
618
+ Y(await a.crud.view(t.id)), f.value += 1;
619
+ }
620
+ });
621
+ }
622
+ async function vt(e) {
623
+ await c({
624
+ loading: T,
625
+ source: "user-management",
626
+ record: () => e?.id ? e : void 0,
627
+ canExecute: () => a.can("delete") === !0,
628
+ deniedMessage: "当前用户无权删除用户",
629
+ confirm: (e) => o({
630
+ title: "删除用户",
631
+ content: `确认删除用户「${Q(e)}」?`,
632
+ okText: "删除",
633
+ danger: !0
634
+ }),
635
+ execute: (e) => a.crud.delete(String(e.id), { version: e.version }),
636
+ onExecuted: (e, t) => {
637
+ h.value === String(t.id) && (h.value = void 0, g.value = void 0, A.value = X(p.value), _.value = !1, v.value = "view", y.value = !1, w.value = !1, D.value += 1), f.value += 1;
638
+ }
639
+ });
640
+ }
641
+ function q() {
642
+ return Me(T.value);
643
+ }
644
+ function J(e, t) {
645
+ return Ne({
646
+ activeRequestSeq: D.value,
647
+ requestSeq: t,
648
+ selectedUserKey: h.value,
649
+ recordId: e
650
+ });
651
+ }
652
+ function Y(e, t = "view") {
653
+ return g.value = e, h.value = e.id, A.value = Z(e), P.value = "", v.value = Pe(t), _.value = !0, y.value = !1, w.value = !1, D.value += 1, D.value;
654
+ }
655
+ function yt(e) {
656
+ g.value = e.selectedUser, h.value = e.selectedUser.id, p.value = e.tenant, A.value = e.draft, v.value = e.mode, P.value = e.password, F.value = e.resetPasswordResult, _.value = !0, y.value = !1, w.value = !1, D.value += 1;
657
+ }
658
+ function bt(e) {
659
+ return !e || a.can("revokeSession", e) !== !0 ? [] : R(e).records.filter((e) => !e.current);
660
+ }
661
+ function xt(e, t) {
662
+ return !!e && !t.current && a.can("revokeSession", e) === !0;
663
+ }
664
+ function X(e) {
665
+ return {
666
+ tenantId: e?.id,
667
+ enabled: !0
668
+ };
669
+ }
670
+ function Z(e) {
671
+ return {
672
+ ...e,
673
+ password: void 0
674
+ };
675
+ }
676
+ function St(e, t, n, r) {
677
+ return le(e, {
678
+ tenantId: t?.id ?? e.tenantId,
679
+ username: e.username?.trim(),
680
+ enabled: e.enabled !== !1,
681
+ password: n === "create" ? r.trim() : void 0
682
+ });
683
+ }
684
+ function Ct(e) {
685
+ for (let t of ["username"]) {
686
+ let n = te(t, {
687
+ fields: I.value,
688
+ fallback: Je.value
689
+ });
690
+ if (n.visible && n.required && !e[t]) return `请填写${n.label}`;
691
+ }
692
+ if (v.value === "create" && !e.password) return "请填写初始密码";
693
+ if (v.value === "resetPassword" && !P.value.trim()) return "请填写新密码";
694
+ }
695
+ function wt(e) {
696
+ return e === "username" && v.value === "edit";
697
+ }
698
+ function Tt(e, t) {
699
+ A.value = {
700
+ ...A.value,
701
+ [e]: t
702
+ };
703
+ }
704
+ function Et(e) {
705
+ return e.enabled === !1 ? "enable" : "disable";
706
+ }
707
+ function Q(e) {
708
+ return String(e?.username ?? e?.id ?? "用户");
709
+ }
710
+ function Dt(e) {
711
+ return Q(e);
712
+ }
713
+ function Ot(e) {
714
+ let t = String(e?.employeeTitle ?? "").trim();
715
+ return t ? `职员:${t}` : "未关联职员";
716
+ }
717
+ function $(e) {
718
+ return String(e?.title ?? e?.alias ?? e?.id ?? "未命名租户");
719
+ }
720
+ let kt = () => void 0;
721
+ function At(e) {
722
+ return {
723
+ title: $(e),
724
+ secondary: e.alias ?? e.id,
725
+ muted: e.enabled === !1
726
+ };
727
+ }
728
+ return (n, i) => (O(), C("section", { class: ye(["user-management-page", { "user-management-page--task": z.value && !B.value }]) }, [
729
+ !z.value || B.value ? (O(), x(j(fe), {
730
+ key: 0,
731
+ class: "user-scope-panel",
732
+ title: "租户",
733
+ "refresh-title": "刷新租户列表",
734
+ "search-keyword": u.value,
735
+ "search-placeholder": "搜索租户名称、alias 或 ID",
736
+ searchable: V.value,
737
+ onRefresh: i[2] ||= (e) => V.value ? d.value += 1 : nt(),
738
+ "onUpdate:searchKeyword": i[3] ||= (e) => u.value = e
739
+ }, {
740
+ default: N(() => [!V.value && H.value ? (O(), C("button", {
741
+ key: 0,
742
+ class: "user-scope-entry",
743
+ type: "button",
744
+ onClick: i[0] ||= (e) => rt(H.value)
745
+ }, [E(j(pe), {
746
+ title: $(H.value),
747
+ secondary: "当前租户",
748
+ clickable: "",
749
+ selected: p.value?.id === H.value.id
750
+ }, null, 8, ["title", "selected"])])) : S("v-if", !0), V.value ? (O(), x(j(ae), {
751
+ key: 1,
752
+ context: Ie.value,
753
+ "selected-id": p.value?.id,
754
+ "reload-key": d.value,
755
+ keyword: u.value,
756
+ "empty-description": "暂无租户",
757
+ "loading-tip": "加载租户列表",
758
+ "fallback-title": "未命名租户",
759
+ "item-of": At,
760
+ onLoaded: tt,
761
+ onSelect: i[1] ||= (e) => rt(e)
762
+ }, null, 8, [
763
+ "context",
764
+ "selected-id",
765
+ "reload-key",
766
+ "keyword"
767
+ ])) : S("v-if", !0)]),
768
+ _: 1
769
+ }, 8, ["search-keyword", "searchable"])) : S("v-if", !0),
770
+ !z.value || B.value ? (O(), x(j(oe), {
771
+ key: 1,
772
+ class: "user-list-panel",
773
+ context: Re.value,
774
+ title: Ve.value,
775
+ columns: ze.value,
776
+ "standard-crud-actions": "",
777
+ "standard-crud-row-actions": "",
778
+ "selected-key": h.value,
779
+ "expanded-row-keys": j(Ce),
780
+ "cell-renderers": { onlineStatus: j(Fe) },
781
+ "reload-key": f.value,
782
+ ready: Be.value,
783
+ "quick-search-placeholder": "搜索账号",
784
+ "empty-description": "当前租户暂无账号",
785
+ "waiting-description": "请选择租户",
786
+ onAction: it,
787
+ onRowAction: at,
788
+ onRowDblclick: ot,
789
+ onRowExpand: j(Te),
790
+ onLoaded: j(we),
791
+ onSelect: i[4] ||= (e) => h.value = String(e.id ?? "")
792
+ }, {
793
+ expandedRow: N(({ record: e }) => [E(j(re), {
794
+ sessions: j(R)(String(e.id ?? "")).records,
795
+ loading: j(R)(String(e.id ?? "")).loading,
796
+ error: j(R)(String(e.id ?? "")).error,
797
+ "actions-disabled": T.value,
798
+ "can-revoke": (t) => xt(String(e.id ?? ""), t),
799
+ "can-revoke-all": bt(String(e.id ?? "")).length > 1,
800
+ onRefresh: (t) => j(L)(String(e.id ?? "")),
801
+ onRevoke: (t) => ht(e, t),
802
+ onRevokeAll: (t) => gt(e)
803
+ }, null, 8, [
804
+ "sessions",
805
+ "loading",
806
+ "error",
807
+ "actions-disabled",
808
+ "can-revoke",
809
+ "can-revoke-all",
810
+ "onRefresh",
811
+ "onRevoke",
812
+ "onRevokeAll"
813
+ ])]),
814
+ _: 1
815
+ }, 8, [
816
+ "context",
817
+ "title",
818
+ "columns",
819
+ "selected-key",
820
+ "expanded-row-keys",
821
+ "cell-renderers",
822
+ "reload-key",
823
+ "ready",
824
+ "onRowExpand",
825
+ "onLoaded"
826
+ ])) : S("v-if", !0),
827
+ Le.value ? (O(), x(j(t), {
828
+ key: 2,
829
+ open: _.value,
830
+ title: He.value,
831
+ subtitle: Ue.value,
832
+ "close-on-outside": v.value === "view",
833
+ promotion: j(qe),
834
+ onClose: K
835
+ }, {
836
+ status: N(() => [v.value === "view" && g.value ? (O(), x(j(e), {
837
+ key: 0,
838
+ enabled: g.value.enabled !== !1,
839
+ disabled: T.value || !W.value,
840
+ loading: T.value,
841
+ "show-label": !1,
842
+ onChange: _t
843
+ }, null, 8, [
844
+ "enabled",
845
+ "disabled",
846
+ "loading"
847
+ ])) : S("v-if", !0)]),
848
+ operation: N(() => [E(j(r), {
849
+ context: Re.value,
850
+ actions: Ge.value,
851
+ "record-id": g.value?.id,
852
+ onAction: ut
853
+ }, null, 8, [
854
+ "context",
855
+ "actions",
856
+ "record-id"
857
+ ])]),
858
+ default: N(() => [E(Oe, {
859
+ mode: v.value,
860
+ draft: A.value,
861
+ "selected-user": g.value,
862
+ loading: y.value,
863
+ "load-failed": w.value,
864
+ saving: T.value || y.value,
865
+ "tenant-title": $(p.value),
866
+ fields: I.value,
867
+ fallback: Je.value,
868
+ "field-names": Ye.value,
869
+ password: P.value,
870
+ "reset-password-result": F.value,
871
+ "display-of": kt,
872
+ "disabled-of": wt,
873
+ onRetry: dt,
874
+ onSave: ft,
875
+ "onUpdate:field": Tt,
876
+ "onUpdate:password": i[5] ||= (e) => P.value = e
877
+ }, null, 8, [
878
+ "mode",
879
+ "draft",
880
+ "selected-user",
881
+ "loading",
882
+ "load-failed",
883
+ "saving",
884
+ "tenant-title",
885
+ "fields",
886
+ "fallback",
887
+ "field-names",
888
+ "password",
889
+ "reset-password-result"
890
+ ])]),
891
+ _: 1
892
+ }, 8, [
893
+ "open",
894
+ "title",
895
+ "subtitle",
896
+ "close-on-outside",
897
+ "promotion"
898
+ ])) : (O(), x(j(ce), {
899
+ key: 3,
900
+ title: He.value,
901
+ subtitle: Ue.value
902
+ }, {
903
+ status: N(() => [v.value === "view" && g.value ? (O(), x(j(e), {
904
+ key: 0,
905
+ enabled: g.value.enabled !== !1,
906
+ disabled: T.value || !W.value,
907
+ loading: T.value,
908
+ "show-label": !1,
909
+ onChange: _t
910
+ }, null, 8, [
911
+ "enabled",
912
+ "disabled",
913
+ "loading"
914
+ ])) : S("v-if", !0)]),
915
+ operation: N(() => [E(j(r), {
916
+ context: j(a),
917
+ actions: Ke.value,
918
+ "record-id": g.value?.id,
919
+ onAction: ut
920
+ }, null, 8, [
921
+ "context",
922
+ "actions",
923
+ "record-id"
924
+ ])]),
925
+ default: N(() => [E(Oe, {
926
+ mode: v.value,
927
+ draft: A.value,
928
+ "selected-user": g.value,
929
+ loading: y.value,
930
+ "load-failed": w.value,
931
+ saving: T.value || y.value,
932
+ "tenant-title": $(p.value ?? { id: A.value.tenantId }),
933
+ fields: I.value,
934
+ fallback: Je.value,
935
+ "field-names": Ye.value,
936
+ password: P.value,
937
+ "reset-password-result": F.value,
938
+ "display-of": kt,
939
+ "disabled-of": wt,
940
+ onRetry: dt,
941
+ onSave: ft,
942
+ "onUpdate:field": Tt,
943
+ "onUpdate:password": i[6] ||= (e) => P.value = e
944
+ }, null, 8, [
945
+ "mode",
946
+ "draft",
947
+ "selected-user",
948
+ "loading",
949
+ "load-failed",
950
+ "saving",
951
+ "tenant-title",
952
+ "fields",
953
+ "fallback",
954
+ "field-names",
955
+ "password",
956
+ "reset-password-result"
957
+ ])]),
958
+ _: 1
959
+ }, 8, ["title", "subtitle"]))
960
+ ], 2));
961
+ }
962
+ }), [["__scopeId", "data-v-9f0f413a"]]);
963
+ //#endregion
964
+ export { Se as n, Fe as t };