smart-admin-web 10.20.1 → 10.21.0

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 (143) hide show
  1. package/dist/api/index.d.ts +19 -1
  2. package/dist/api/index.js +85 -66
  3. package/dist/api/index.js.map +1 -1
  4. package/dist/api/schema.d.ts +448 -1
  5. package/dist/assets/icons/ph-subset.json.js +1 -1
  6. package/dist/components/FormContainer/index.vue.js +87 -75
  7. package/dist/components/FormContainer/index.vue.js.map +1 -1
  8. package/dist/components/UserPicker/UserAvatar.vue.d.ts +8 -0
  9. package/dist/components/UserPicker/UserAvatar.vue.js +8 -0
  10. package/dist/components/UserPicker/UserAvatar.vue.js.map +1 -0
  11. package/dist/components/UserPicker/UserAvatar2.vue.js +38 -0
  12. package/dist/components/UserPicker/UserAvatar2.vue.js.map +1 -0
  13. package/dist/components/UserPicker/index.vue.js +1 -1
  14. package/dist/components/UserPicker/index2.vue.js +328 -186
  15. package/dist/components/UserPicker/index2.vue.js.map +1 -1
  16. package/dist/index.js +248 -246
  17. package/dist/lib/runtime.js +1 -1
  18. package/dist/lib/watermark.d.ts +1 -1
  19. package/dist/locales/en-US.d.ts +62 -3
  20. package/dist/locales/en-US.js +65 -6
  21. package/dist/locales/en-US.js.map +1 -1
  22. package/dist/locales/kernelMenuTitles.js +1 -0
  23. package/dist/locales/kernelMenuTitles.js.map +1 -1
  24. package/dist/locales/zh-CN.d.ts +62 -3
  25. package/dist/locales/zh-CN.js +65 -6
  26. package/dist/locales/zh-CN.js.map +1 -1
  27. package/dist/router/viewRegistry.js +6 -6
  28. package/dist/router/viewRegistry.js.map +1 -1
  29. package/dist/style.css +1 -1
  30. package/dist/theme/naive-theme.js +80 -77
  31. package/dist/theme/naive-theme.js.map +1 -1
  32. package/dist/types/api.d.ts +91 -0
  33. package/dist/types/api.js +17 -15
  34. package/dist/types/api.js.map +1 -1
  35. package/dist/utils/shake.d.ts +1 -0
  36. package/dist/utils/shake.js +30 -0
  37. package/dist/utils/shake.js.map +1 -0
  38. package/dist/views/login/LoginForm.vue.js +2 -2
  39. package/dist/views/login/LoginForm2.vue.js +135 -135
  40. package/dist/views/login/LoginForm2.vue.js.map +1 -1
  41. package/dist/views/login/components/LoginDesk.vue.js +1 -1
  42. package/dist/views/login/components/LoginDesk2.vue.js +59 -47
  43. package/dist/views/login/components/LoginDesk2.vue.js.map +1 -1
  44. package/dist/views/personal/notice2.vue.js +1 -1
  45. package/dist/views/personal/notice2.vue.js.map +1 -1
  46. package/dist/views/personal/sessions.vue.js +2 -2
  47. package/dist/views/personal/sessions2.vue.js +41 -40
  48. package/dist/views/personal/sessions2.vue.js.map +1 -1
  49. package/dist/views/system/ai-usage/index.vue.js +3 -3
  50. package/dist/views/system/ai-usage/index2.vue.js +13 -12
  51. package/dist/views/system/ai-usage/index2.vue.js.map +1 -1
  52. package/dist/views/system/config/components/AdvancedSection.vue.js +3 -3
  53. package/dist/views/system/config/components/AdvancedSection2.vue.js +2 -1
  54. package/dist/views/system/config/components/AdvancedSection2.vue.js.map +1 -1
  55. package/dist/views/system/dict/index.vue.js +2 -2
  56. package/dist/views/system/dict/index2.vue.js +12 -1
  57. package/dist/views/system/dict/index2.vue.js.map +1 -1
  58. package/dist/views/system/file/index2.vue.js +1 -0
  59. package/dist/views/system/file/index2.vue.js.map +1 -1
  60. package/dist/views/system/job/index.vue.js +3 -3
  61. package/dist/views/system/job/index2.vue.js +182 -181
  62. package/dist/views/system/job/index2.vue.js.map +1 -1
  63. package/dist/views/system/job-log/components/AttemptTable2.vue.js +8 -3
  64. package/dist/views/system/job-log/components/AttemptTable2.vue.js.map +1 -1
  65. package/dist/views/system/job-log/index.vue.js +1 -1
  66. package/dist/views/system/job-log/index2.vue.js +5 -5
  67. package/dist/views/system/job-log/index2.vue.js.map +1 -1
  68. package/dist/views/system/log/exception/index.vue.js +2 -2
  69. package/dist/views/system/log/exception/index2.vue.js +8 -5
  70. package/dist/views/system/log/exception/index2.vue.js.map +1 -1
  71. package/dist/views/system/log/login/index2.vue.js +21 -12
  72. package/dist/views/system/log/login/index2.vue.js.map +1 -1
  73. package/dist/views/system/log/op/index.vue.js +2 -2
  74. package/dist/views/system/log/op/index2.vue.js +50 -40
  75. package/dist/views/system/log/op/index2.vue.js.map +1 -1
  76. package/dist/views/system/menu/components/ButtonManager.vue.js +2 -2
  77. package/dist/views/system/menu/components/ButtonManager2.vue.js +45 -36
  78. package/dist/views/system/menu/components/ButtonManager2.vue.js.map +1 -1
  79. package/dist/views/system/menu/index.vue.js +2 -2
  80. package/dist/views/system/menu/index2.vue.js +11 -11
  81. package/dist/views/system/menu/index2.vue.js.map +1 -1
  82. package/dist/views/system/module/index.vue.js +1 -1
  83. package/dist/views/system/module/index2.vue.js +171 -117
  84. package/dist/views/system/module/index2.vue.js.map +1 -1
  85. package/dist/views/system/notice/index.vue.js +3 -3
  86. package/dist/views/system/notice/index2.vue.js +1 -0
  87. package/dist/views/system/notice/index2.vue.js.map +1 -1
  88. package/dist/views/system/org/index.vue.js +2 -2
  89. package/dist/views/system/org/index2.vue.js +70 -67
  90. package/dist/views/system/org/index2.vue.js.map +1 -1
  91. package/dist/views/system/position/index.vue.js +2 -2
  92. package/dist/views/system/position/index2.vue.js +57 -48
  93. package/dist/views/system/position/index2.vue.js.map +1 -1
  94. package/dist/views/system/recycle/index.vue.js +1 -1
  95. package/dist/views/system/recycle/index2.vue.js +3 -1
  96. package/dist/views/system/recycle/index2.vue.js.map +1 -1
  97. package/dist/views/system/role/components/GrantMenuSheet.vue.d.ts +2 -0
  98. package/dist/views/system/role/components/GrantMenuSheet.vue.js +2 -2
  99. package/dist/views/system/role/components/GrantMenuSheet2.vue.js +54 -49
  100. package/dist/views/system/role/components/GrantMenuSheet2.vue.js.map +1 -1
  101. package/dist/views/system/role/components/GrantMenuTable.vue.js +1 -1
  102. package/dist/views/system/role/components/GrantMenuTable2.vue.js +159 -195
  103. package/dist/views/system/role/components/GrantMenuTable2.vue.js.map +1 -1
  104. package/dist/views/system/role/components/grantMenuGroups.d.ts +54 -0
  105. package/dist/views/system/role/components/grantMenuGroups.js +116 -76
  106. package/dist/views/system/role/components/grantMenuGroups.js.map +1 -1
  107. package/dist/views/system/role/index.vue.js +2 -2
  108. package/dist/views/system/role/index2.vue.js +152 -145
  109. package/dist/views/system/role/index2.vue.js.map +1 -1
  110. package/dist/views/system/session/index2.vue.js +39 -35
  111. package/dist/views/system/session/index2.vue.js.map +1 -1
  112. package/dist/views/system/user/components/UserGrantEffectiveTable.vue.d.ts +10 -0
  113. package/dist/views/system/user/components/UserGrantEffectiveTable.vue.js +5 -0
  114. package/dist/views/system/user/components/UserGrantEffectiveTable.vue.js.map +1 -0
  115. package/dist/views/system/user/components/UserGrantEffectiveTable2.vue.js +96 -0
  116. package/dist/views/system/user/components/UserGrantEffectiveTable2.vue.js.map +1 -0
  117. package/dist/views/system/user/components/UserGrantMenuSheet.vue.d.ts +13 -0
  118. package/dist/views/system/user/components/UserGrantMenuSheet.vue.js +8 -0
  119. package/dist/views/system/user/components/UserGrantMenuSheet.vue.js.map +1 -0
  120. package/dist/views/system/user/components/UserGrantMenuSheet2.vue.js +216 -0
  121. package/dist/views/system/user/components/UserGrantMenuSheet2.vue.js.map +1 -0
  122. package/dist/views/system/user/components/UserGrantMenuTable.vue.d.ts +13 -0
  123. package/dist/views/system/user/components/UserGrantMenuTable.vue.js +8 -0
  124. package/dist/views/system/user/components/UserGrantMenuTable.vue.js.map +1 -0
  125. package/dist/views/system/user/components/UserGrantMenuTable2.vue.js +186 -0
  126. package/dist/views/system/user/components/UserGrantMenuTable2.vue.js.map +1 -0
  127. package/dist/views/system/user/components/UserGrantNodeRow.vue.d.ts +31 -0
  128. package/dist/views/system/user/components/UserGrantNodeRow.vue.js +8 -0
  129. package/dist/views/system/user/components/UserGrantNodeRow.vue.js.map +1 -0
  130. package/dist/views/system/user/components/UserGrantNodeRow2.vue.js +171 -0
  131. package/dist/views/system/user/components/UserGrantNodeRow2.vue.js.map +1 -0
  132. package/dist/views/system/user/components/UserGrantOverviewDrawer.vue.d.ts +21 -0
  133. package/dist/views/system/user/components/UserGrantOverviewDrawer.vue.js +5 -0
  134. package/dist/views/system/user/components/UserGrantOverviewDrawer.vue.js.map +1 -0
  135. package/dist/views/system/user/components/UserGrantOverviewDrawer2.vue.js +178 -0
  136. package/dist/views/system/user/components/UserGrantOverviewDrawer2.vue.js.map +1 -0
  137. package/dist/views/system/user/components/userGrantState.d.ts +64 -0
  138. package/dist/views/system/user/components/userGrantState.js +117 -0
  139. package/dist/views/system/user/components/userGrantState.js.map +1 -0
  140. package/dist/views/system/user/index.vue.js +2 -2
  141. package/dist/views/system/user/index2.vue.js +250 -207
  142. package/dist/views/system/user/index2.vue.js.map +1 -1
  143. package/package.json +3 -3
@@ -1,89 +1,93 @@
1
- import { defineComponent as ye, ref as m, shallowRef as x, onMounted as be, h as f, reactive as j, computed as K, resolveDirective as ge, openBlock as g, createElementBlock as J, Fragment as we, createVNode as a, unref as o, withCtx as s, withDirectives as Q, createBlock as D, createTextVNode as X, toDisplayString as w, createCommentVNode as k, createElementVNode as ke } from "vue";
2
- import { useMessage as Se, NSpace as Ue, NButton as S, NDropdown as Te, NForm as Y, NFormItem as v, NInput as M, NInputNumber as Ae, NSwitch as Z, NSelect as Ce } from "naive-ui";
3
- import { useI18n as De } from "vue-i18n";
4
- import { SmartTable as Ie } from "smart-naive-table";
5
- import ee from "../../../components/AppIcon.vue.js";
6
- import le from "../../../components/FormContainer/index.vue.js";
1
+ import { defineComponent as ke, ref as d, shallowRef as I, onMounted as Se, h as f, reactive as X, computed as Y, resolveDirective as Ue, openBlock as w, createElementBlock as Z, Fragment as Te, createVNode as a, unref as o, withCtx as s, withDirectives as ee, createBlock as N, createTextVNode as le, toDisplayString as U, createCommentVNode as T, createElementVNode as Oe } from "vue";
2
+ import { useMessage as Ae, NSpace as Ce, NButton as O, NDropdown as De, NForm as te, NFormItem as v, NInput as E, NInputNumber as Ie, NSwitch as oe, NSelect as Ne } from "naive-ui";
3
+ import { useI18n as Re } from "vue-i18n";
4
+ import { SmartTable as _e } from "smart-naive-table";
5
+ import re from "../../../components/AppIcon.vue.js";
6
+ import ae from "../../../components/FormContainer/index.vue.js";
7
7
  /* empty css */
8
- import Oe from "../../../components/StatusSwitch/index.vue.js";
9
- import Ne from "../../../components/OrgTreeSelect/index.vue.js";
10
- import _e from "../../../components/UserPicker/index.vue.js";
11
- import Pe from "./components/GrantMenuSheet.vue.js";
12
- import { useConfirm as Re } from "../../../composables/useConfirm.js";
13
- import { useBatchDelete as xe } from "../../../composables/useBatchDelete.js";
14
- import { moduleApi as Me, roleApi as d, menuApi as Ee, userApi as ze } from "../../../api/index.js";
15
- import { useAuthStore as Be } from "../../../stores/auth.js";
8
+ import Pe from "../../../components/StatusSwitch/index.vue.js";
9
+ import Me from "../../../components/OrgTreeSelect/index.vue.js";
10
+ import xe from "../../../components/UserPicker/index.vue.js";
11
+ import Ee from "./components/GrantMenuSheet.vue.js";
12
+ import { grantScopeForRole as Be, isBuiltinRole as ze } from "./components/grantMenuGroups.js";
13
+ import { useConfirm as qe } from "../../../composables/useConfirm.js";
14
+ import { useBatchDelete as Fe } from "../../../composables/useBatchDelete.js";
15
+ import { moduleApi as He, roleApi as m, menuApi as Ge, userApi as Le } from "../../../api/index.js";
16
+ import { useAuthStore as Ve } from "../../../stores/auth.js";
16
17
  import { translateError as h } from "../../../utils/error.js";
17
- import { SEARCH_ACTIONS as qe, deriveHeaderFilters as He } from "../../../utils/tableFilter.js";
18
- import { TABLE_MIN_ROW_HEIGHT as Fe, TABLE_TOOLBAR as Ge } from "../../../utils/tableToolbar.js";
19
- import Le from "../../../components/TableTotal/index.vue.js";
18
+ import { SEARCH_ACTIONS as $e, deriveHeaderFilters as We } from "../../../utils/tableFilter.js";
19
+ import { TABLE_MIN_ROW_HEIGHT as je, TABLE_TOOLBAR as Ke } from "../../../utils/tableToolbar.js";
20
+ import Je from "../../../components/TableTotal/index.vue.js";
20
21
  import { DataScopeType as y } from "../../../types/api.js";
21
- const Ve = { class: "form-hint" }, $e = {
22
+ const Qe = { class: "form-hint" }, Xe = {
22
23
  key: 0,
23
24
  class: "scope-who"
24
- }, te = 0, pl = /* @__PURE__ */ ye({
25
+ }, B = 0, wl = /* @__PURE__ */ ke({
25
26
  __name: "index",
26
- setup(We) {
27
- const { t } = De(), c = Se(), { confirm: oe } = Re(), i = Be(), U = m(), I = x([]);
28
- be(async () => {
27
+ setup(Ye) {
28
+ const { t } = Re(), c = Ae(), { confirm: ne } = qe(), i = Ve(), A = d(), z = I([]);
29
+ Se(async () => {
29
30
  try {
30
- I.value = await Me.list();
31
+ z.value = await He.list();
31
32
  } catch {
32
33
  }
33
34
  });
34
- async function E(l) {
35
+ async function q(l) {
35
36
  try {
36
- const { total: e } = await ze.page({ page: 1, pageSize: 1, roleId: l });
37
+ const { total: e } = await Le.page({ page: 1, pageSize: 1, roleId: l });
37
38
  return e;
38
39
  } catch {
39
40
  return null;
40
41
  }
41
42
  }
42
- const { checkedKeys: z, run: re } = xe({
43
- remove: d.batchRemove,
43
+ const { checkedKeys: F, run: se } = Fe({
44
+ remove: m.batchRemove,
44
45
  refresh: () => {
45
46
  var l;
46
- return (l = U.value) == null ? void 0 : l.refresh();
47
+ return (l = A.value) == null ? void 0 : l.refresh();
47
48
  },
48
49
  successMsg: t("role.deleted"),
49
50
  content: async (l) => {
50
- const e = await Promise.all(l.map(E));
51
+ const e = await Promise.all(l.map(q));
51
52
  if (e.some((r) => r === null)) return t("common.batchDeleteConfirm", { count: l.length });
52
- const n = e.reduce((r, C) => r + C, 0);
53
+ const n = e.reduce((r, g) => r + g, 0);
53
54
  return n === 0 ? t("common.batchDeleteConfirm", { count: l.length }) : t("role.batchDeleteWithUsers", { count: l.length, users: n });
54
55
  }
55
56
  });
56
- async function ae(l) {
57
- var C;
58
- const e = await E(l.id), n = e === null ? t("role.deleteConfirm", { name: l.name }) : e === 0 ? t("role.deleteConfirmNoUsers", { name: l.name }) : t("role.deleteConfirmWithUsers", { name: l.name, count: e });
59
- await oe({
57
+ async function ue(l) {
58
+ var g;
59
+ const e = await q(l.id), n = e === null ? t("role.deleteConfirm", { name: l.name }) : e === 0 ? t("role.deleteConfirmNoUsers", { name: l.name }) : t("role.deleteConfirmWithUsers", { name: l.name, count: e });
60
+ await ne({
60
61
  content: n,
61
62
  type: "error",
62
- action: () => d.remove(l.id),
63
+ action: () => m.remove(l.id),
63
64
  successMsg: t("role.deleted")
64
- }) && ((C = U.value) == null || C.refresh());
65
+ }) && ((g = A.value) == null || g.refresh());
65
66
  }
66
- const B = (l) => ({
67
+ const H = (l) => ({
67
68
  name: l.name,
68
69
  code: l.code,
69
70
  sort: l.sort,
70
71
  enabled: l.enabled,
71
72
  remark: l.remark ?? "",
72
73
  isDelegatable: l.isDelegatable ?? !1
73
- }), q = [
74
+ }), G = [
74
75
  { type: "selection" },
75
76
  { type: "index", title: () => t("common.rowNo"), width: 64, align: "center" },
76
77
  {
77
78
  key: "code",
79
+ width: 180,
80
+ ellipsis: { tooltip: !0 },
78
81
  title: () => t("role.code"),
79
82
  render: (l) => f("span", { class: "mono muted" }, l.code)
80
83
  },
81
84
  {
82
85
  key: "name",
86
+ ellipsis: { tooltip: !0 },
83
87
  title: () => t("role.name"),
84
88
  card: "title",
85
89
  // 窄档卡片以角色名称为标题,编码作为字段
86
- search: { actions: qe.fuzzy }
90
+ search: { actions: $e.fuzzy }
87
91
  },
88
92
  {
89
93
  key: "sort",
@@ -95,10 +99,10 @@ const Ve = { class: "form-hint" }, $e = {
95
99
  key: "enabled",
96
100
  title: () => t("common.status"),
97
101
  width: 90,
98
- render: (l) => f(Oe, {
102
+ render: (l) => f(Pe, {
99
103
  value: l.enabled,
100
104
  disabled: !i.isSuperAdmin || !i.hasPerm("PUT:/api/v1/sys/role/{id}"),
101
- request: (e) => d.update(l.id, { ...B(l), enabled: e }),
105
+ request: (e) => m.update(l.id, { ...H(l), enabled: e }),
102
106
  "onUpdate:value": (e) => {
103
107
  l.enabled = e;
104
108
  }
@@ -122,33 +126,33 @@ const Ve = { class: "form-hint" }, $e = {
122
126
  i.isSuperAdmin && i.hasPerm("PUT:/api/v1/sys/role/datascope") ? { label: t("role.dataScope"), key: "scope" } : null,
123
127
  i.hasPerm("PUT:/api/v1/sys/role/users") ? { label: t("role.grantUsers"), key: "users" } : null
124
128
  ].filter((n) => n !== null);
125
- return f(Ue, { size: 4, wrapItem: !1 }, () => [
129
+ return f(Ce, { size: 4, wrapItem: !1 }, () => [
126
130
  i.isSuperAdmin && i.hasPerm("PUT:/api/v1/sys/role/{id}") ? f(
127
- S,
128
- { size: "small", quaternary: !0, type: "primary", onClick: () => ue(l) },
131
+ O,
132
+ { size: "small", quaternary: !0, type: "primary", onClick: () => de(l) },
129
133
  () => t("common.edit")
130
134
  ) : null,
131
135
  i.isSuperAdmin && i.hasPerm("DELETE:/api/v1/sys/role/{id}") ? f(
132
- S,
133
- { size: "small", quaternary: !0, type: "error", onClick: () => ae(l) },
136
+ O,
137
+ { size: "small", quaternary: !0, type: "error", onClick: () => ue(l) },
134
138
  () => t("common.delete")
135
139
  ) : null,
136
140
  e.length ? f(
137
- Te,
141
+ De,
138
142
  {
139
143
  options: e,
140
144
  onSelect: (n) => {
141
- n === "menus" ? ce(l) : n === "scope" ? ve(l) : de(l);
145
+ n === "menus" ? pe(l) : n === "scope" ? be(l) : ve(l);
142
146
  }
143
147
  },
144
- () => f(S, { size: "small", quaternary: !0 }, () => t("common.more"))
148
+ () => f(O, { size: "small", quaternary: !0 }, () => t("common.more"))
145
149
  ) : null
146
150
  ]);
147
151
  }
148
152
  }
149
153
  ];
150
- He(q);
151
- const T = m(!1), H = m(null), b = m(null), ne = {
154
+ We(G);
155
+ const C = d(!1), L = d(null), b = d(null), ie = {
152
156
  code: {
153
157
  required: !0,
154
158
  whitespace: !0,
@@ -161,175 +165,177 @@ const Ve = { class: "form-hint" }, $e = {
161
165
  message: () => t("role.nameRequired"),
162
166
  trigger: ["input", "blur"]
163
167
  }
164
- }, F = () => ({
168
+ }, V = () => ({
165
169
  name: "",
166
170
  code: "",
167
171
  sort: 0,
168
172
  enabled: !0,
169
173
  remark: "",
170
174
  isDelegatable: !1
171
- }), u = j(F());
172
- function se() {
173
- b.value = null, Object.assign(u, F()), T.value = !0;
175
+ }), u = X(V());
176
+ function ce() {
177
+ b.value = null, Object.assign(u, V()), C.value = !0;
174
178
  }
175
- function ue(l) {
176
- b.value = l.id, Object.assign(u, B(l)), T.value = !0;
179
+ function de(l) {
180
+ b.value = l.id, Object.assign(u, H(l)), C.value = !0;
177
181
  }
178
- async function ie() {
182
+ async function me() {
179
183
  var l, e;
180
- await ((l = H.value) == null ? void 0 : l.validate());
184
+ await ((l = L.value) == null ? void 0 : l.validate());
181
185
  try {
182
- b.value === null ? await d.add({ ...u }) : await d.update(b.value, { ...u }), c.success(t("role.saved")), await ((e = U.value) == null ? void 0 : e.refresh());
186
+ b.value === null ? await m.add({ ...u }) : await m.update(b.value, { ...u }), c.success(t("role.saved")), await ((e = A.value) == null ? void 0 : e.refresh());
183
187
  } catch (n) {
184
188
  return c.error(h(n)), !1;
185
189
  }
186
190
  }
187
- const O = m(!1), G = x([]), L = x([]), N = m(null), V = m(te);
188
- async function ce(l) {
189
- var e;
191
+ const R = d(!1), $ = I([]), W = I([]), k = d(null), j = d(B), S = I([]);
192
+ async function pe(l) {
193
+ var e, n;
190
194
  try {
191
- const [n, r] = await Promise.all([Ee.tree(), d.getMenus(l.id)]);
192
- N.value = l, G.value = n, L.value = r, V.value = i.currentModuleId ?? ((e = I.value[0]) == null ? void 0 : e.id) ?? te, O.value = !0;
193
- } catch (n) {
194
- c.error(h(n));
195
+ const [r, g] = await Promise.all([Ge.tree(), m.getMenus(l.id)]), x = Be(l, r, z.value, g);
196
+ k.value = l, $.value = x.tree, S.value = x.modules, W.value = x.granted;
197
+ const Q = i.currentModuleId ?? ((e = S.value[0]) == null ? void 0 : e.id) ?? B;
198
+ j.value = S.value.some((we) => we.id === Q) ? Q : ((n = S.value[0]) == null ? void 0 : n.id) ?? B, R.value = !0;
199
+ } catch (r) {
200
+ c.error(h(r));
195
201
  }
196
202
  }
197
- async function me(l) {
198
- if (N.value !== null)
203
+ async function fe(l) {
204
+ if (k.value !== null)
199
205
  try {
200
- await d.setMenus(N.value.id, l), c.success(t("role.grantSaved"));
206
+ await m.setMenus(k.value.id, l), c.success(t("role.grantSaved"));
201
207
  } catch (e) {
202
208
  return c.error(h(e)), !1;
203
209
  }
204
210
  }
205
- const $ = m(null), _ = m(null);
206
- async function de(l) {
211
+ const K = d(null), _ = d(null);
212
+ async function ve(l) {
207
213
  var e;
208
214
  _.value = l.id;
209
215
  try {
210
- const n = await d.getUsers(l.id);
211
- (e = $.value) == null || e.open(n);
216
+ const n = await m.getUsers(l.id);
217
+ (e = K.value) == null || e.open(n);
212
218
  } catch (n) {
213
219
  c.error(h(n));
214
220
  }
215
221
  }
216
- async function pe(l) {
222
+ async function he(l) {
217
223
  if (_.value !== null)
218
224
  try {
219
- await d.setUsers(_.value, l), c.success(t("role.grantUsersSaved"));
225
+ await m.setUsers(_.value, l), c.success(t("role.grantUsersSaved"));
220
226
  } catch (e) {
221
227
  c.error(h(e));
222
228
  }
223
229
  }
224
- const P = m(!1), R = m(null), A = m(null), p = j({
230
+ const P = d(!1), M = d(null), D = d(null), p = X({
225
231
  scopeType: y.Org,
226
232
  customOrgIds: []
227
- }), W = K(() => p.scopeType === y.Custom), fe = K(() => [
233
+ }), J = Y(() => p.scopeType === y.Custom), ye = Y(() => [
228
234
  { label: t("role.scope.all"), value: y.All },
229
235
  { label: t("role.scope.org"), value: y.Org },
230
236
  { label: t("role.scope.orgAndChildren"), value: y.OrgAndChildren },
231
237
  { label: t("role.scope.self"), value: y.Self },
232
238
  { label: t("role.scope.custom"), value: y.Custom }
233
239
  ]);
234
- async function ve(l) {
235
- R.value = l.id, A.value = l;
240
+ async function be(l) {
241
+ M.value = l.id, D.value = l;
236
242
  try {
237
- const e = await d.getDataScope(l.id);
243
+ const e = await m.getDataScope(l.id);
238
244
  p.scopeType = (e == null ? void 0 : e.scopeType) ?? y.Org, p.customOrgIds = e != null && e.customOrgIds ? e.customOrgIds.split(",").filter(Boolean).map(Number) : [], P.value = !0;
239
245
  } catch (e) {
240
246
  c.error(h(e));
241
247
  }
242
248
  }
243
- async function he() {
244
- if (R.value !== null)
249
+ async function ge() {
250
+ if (M.value !== null)
245
251
  try {
246
- await d.setDataScope(
247
- R.value,
252
+ await m.setDataScope(
253
+ M.value,
248
254
  p.scopeType,
249
- W.value ? p.customOrgIds : void 0
255
+ J.value ? p.customOrgIds : void 0
250
256
  ), c.success(t("role.scopeSaved"));
251
257
  } catch (l) {
252
258
  return c.error(h(l)), !1;
253
259
  }
254
260
  }
255
261
  return (l, e) => {
256
- const n = ge("auth");
257
- return g(), J(we, null, [
258
- a(o(Ie), {
259
- toolbar: o(Ge),
262
+ const n = Ue("auth");
263
+ return w(), Z(Te, null, [
264
+ a(o(_e), {
265
+ toolbar: o(Ke),
260
266
  ref_key: "tableRef",
261
- ref: U,
262
- columns: q,
263
- fetcher: o(d).page,
267
+ ref: A,
268
+ columns: G,
269
+ fetcher: o(m).page,
264
270
  search: { container: "table" },
265
271
  "fill-height": "",
266
- "min-row-height": o(Fe),
272
+ "min-row-height": o(je),
267
273
  "card-on-narrow": "",
268
274
  "storage-key": "sys-role",
269
- "checked-row-keys": o(z),
270
- "onUpdate:checkedRowKeys": e[0] || (e[0] = (r) => z.value = r),
275
+ "checked-row-keys": o(F),
276
+ "onUpdate:checkedRowKeys": e[0] || (e[0] = (r) => F.value = r),
271
277
  onError: e[1] || (e[1] = (r) => o(c).error(o(h)(r)))
272
278
  }, {
273
279
  "pagination-prefix": s(({ itemCount: r }) => [
274
- a(Le, { count: r }, null, 8, ["count"])
280
+ a(Je, { count: r }, null, 8, ["count"])
275
281
  ]),
276
282
  "toolbar-right": s(() => [
277
- o(i).isSuperAdmin ? Q((g(), D(o(S), {
283
+ o(i).isSuperAdmin ? ee((w(), N(o(O), {
278
284
  key: 0,
279
285
  type: "primary",
280
- onClick: se
286
+ onClick: ce
281
287
  }, {
282
288
  icon: s(() => [
283
- a(ee, {
289
+ a(re, {
284
290
  icon: "ph:plus",
285
291
  size: 16
286
292
  })
287
293
  ]),
288
294
  default: s(() => [
289
- X(" " + w(o(t)("common.add")), 1)
295
+ le(" " + U(o(t)("common.add")), 1)
290
296
  ]),
291
297
  _: 1
292
298
  })), [
293
299
  [n, "POST:/api/v1/sys/role/add"]
294
- ]) : k("", !0)
300
+ ]) : T("", !0)
295
301
  ]),
296
302
  batch: s(() => [
297
- o(i).isSuperAdmin ? Q((g(), D(o(S), {
303
+ o(i).isSuperAdmin ? ee((w(), N(o(O), {
298
304
  key: 0,
299
305
  secondary: "",
300
306
  type: "error",
301
- onClick: o(re)
307
+ onClick: o(se)
302
308
  }, {
303
309
  icon: s(() => [
304
- a(ee, {
310
+ a(re, {
305
311
  icon: "ph:trash",
306
312
  size: 16
307
313
  })
308
314
  ]),
309
315
  default: s(() => [
310
- X(" " + w(o(t)("common.batchDelete")), 1)
316
+ le(" " + U(o(t)("common.batchDelete")), 1)
311
317
  ]),
312
318
  _: 1
313
319
  }, 8, ["onClick"])), [
314
320
  [n, "POST:/api/v1/sys/role/batch-delete"]
315
- ]) : k("", !0)
321
+ ]) : T("", !0)
316
322
  ]),
317
323
  _: 1
318
324
  }, 8, ["toolbar", "fetcher", "min-row-height", "checked-row-keys"]),
319
- a(le, {
320
- show: T.value,
321
- "onUpdate:show": e[8] || (e[8] = (r) => T.value = r),
325
+ a(ae, {
326
+ show: C.value,
327
+ "onUpdate:show": e[8] || (e[8] = (r) => C.value = r),
322
328
  title: b.value === null ? o(t)("role.addTitle") : o(t)("role.editTitle"),
323
329
  width: 480,
324
- "on-confirm": ie,
330
+ "on-confirm": me,
325
331
  "confirm-text": o(t)("common.save")
326
332
  }, {
327
333
  default: s(() => [
328
- a(o(Y), {
334
+ a(o(te), {
329
335
  ref_key: "formRef",
330
- ref: H,
336
+ ref: L,
331
337
  model: u,
332
- rules: ne,
338
+ rules: ie,
333
339
  "label-placement": "left",
334
340
  "label-width": 80
335
341
  }, {
@@ -339,7 +345,7 @@ const Ve = { class: "form-hint" }, $e = {
339
345
  path: "code"
340
346
  }, {
341
347
  default: s(() => [
342
- a(o(M), {
348
+ a(o(E), {
343
349
  value: u.code,
344
350
  "onUpdate:value": e[2] || (e[2] = (r) => u.code = r),
345
351
  placeholder: o(t)("role.code"),
@@ -353,7 +359,7 @@ const Ve = { class: "form-hint" }, $e = {
353
359
  path: "name"
354
360
  }, {
355
361
  default: s(() => [
356
- a(o(M), {
362
+ a(o(E), {
357
363
  value: u.name,
358
364
  "onUpdate:value": e[3] || (e[3] = (r) => u.name = r),
359
365
  placeholder: o(t)("role.name")
@@ -365,7 +371,7 @@ const Ve = { class: "form-hint" }, $e = {
365
371
  label: o(t)("role.sort")
366
372
  }, {
367
373
  default: s(() => [
368
- a(o(Ae), {
374
+ a(o(Ie), {
369
375
  value: u.sort,
370
376
  "onUpdate:value": e[4] || (e[4] = (r) => u.sort = r),
371
377
  min: 0,
@@ -378,7 +384,7 @@ const Ve = { class: "form-hint" }, $e = {
378
384
  label: o(t)("role.remark")
379
385
  }, {
380
386
  default: s(() => [
381
- a(o(M), {
387
+ a(o(E), {
382
388
  value: u.remark,
383
389
  "onUpdate:value": e[5] || (e[5] = (r) => u.remark = r),
384
390
  type: "textarea",
@@ -392,59 +398,60 @@ const Ve = { class: "form-hint" }, $e = {
392
398
  label: o(t)("common.status")
393
399
  }, {
394
400
  default: s(() => [
395
- a(o(Z), {
401
+ a(o(oe), {
396
402
  value: u.enabled,
397
403
  "onUpdate:value": e[6] || (e[6] = (r) => u.enabled = r)
398
404
  }, null, 8, ["value"])
399
405
  ]),
400
406
  _: 1
401
407
  }, 8, ["label"]),
402
- o(i).isSuperAdmin ? (g(), D(o(v), {
408
+ o(i).isSuperAdmin ? (w(), N(o(v), {
403
409
  key: 0,
404
410
  label: o(t)("role.isDelegatable")
405
411
  }, {
406
412
  feedback: s(() => [
407
- ke("span", Ve, w(o(t)("role.isDelegatableHint")), 1)
413
+ Oe("span", Qe, U(o(t)("role.isDelegatableHint")), 1)
408
414
  ]),
409
415
  default: s(() => [
410
- a(o(Z), {
416
+ a(o(oe), {
411
417
  value: u.isDelegatable,
412
418
  "onUpdate:value": e[7] || (e[7] = (r) => u.isDelegatable = r)
413
419
  }, null, 8, ["value"])
414
420
  ]),
415
421
  _: 1
416
- }, 8, ["label"])) : k("", !0)
422
+ }, 8, ["label"])) : T("", !0)
417
423
  ]),
418
424
  _: 1
419
425
  }, 8, ["model"])
420
426
  ]),
421
427
  _: 1
422
428
  }, 8, ["show", "title", "confirm-text"]),
423
- a(Pe, {
424
- show: O.value,
425
- "onUpdate:show": e[9] || (e[9] = (r) => O.value = r),
426
- tree: G.value,
427
- granted: L.value,
428
- modules: I.value,
429
- "default-module-id": V.value,
430
- "on-save": me
431
- }, null, 8, ["show", "tree", "granted", "modules", "default-module-id"]),
432
- a(_e, {
429
+ a(Ee, {
430
+ show: R.value,
431
+ "onUpdate:show": e[9] || (e[9] = (r) => R.value = r),
432
+ tree: $.value,
433
+ granted: W.value,
434
+ modules: S.value,
435
+ "default-module-id": j.value,
436
+ hint: k.value && !o(ze)(k.value) ? o(t)("role.systemMenusBuiltinOnly") : void 0,
437
+ "on-save": fe
438
+ }, null, 8, ["show", "tree", "granted", "modules", "default-module-id", "hint"]),
439
+ a(xe, {
433
440
  ref_key: "userPickerRef",
434
- ref: $,
435
- onConfirm: pe
441
+ ref: K,
442
+ onConfirm: he
436
443
  }, null, 512),
437
- a(le, {
444
+ a(ae, {
438
445
  show: P.value,
439
446
  "onUpdate:show": e[12] || (e[12] = (r) => P.value = r),
440
447
  title: o(t)("role.dataScope"),
441
448
  width: 480,
442
- "on-confirm": he,
449
+ "on-confirm": ge,
443
450
  "confirm-text": o(t)("common.save")
444
451
  }, {
445
452
  default: s(() => [
446
- A.value ? (g(), J("div", $e, w(A.value.name) + " · " + w(A.value.code), 1)) : k("", !0),
447
- a(o(Y), {
453
+ D.value ? (w(), Z("div", Xe, U(D.value.name) + " · " + U(D.value.code), 1)) : T("", !0),
454
+ a(o(te), {
448
455
  model: p,
449
456
  "label-placement": "left",
450
457
  "label-width": 90
@@ -454,20 +461,20 @@ const Ve = { class: "form-hint" }, $e = {
454
461
  label: o(t)("role.scopeType")
455
462
  }, {
456
463
  default: s(() => [
457
- a(o(Ce), {
464
+ a(o(Ne), {
458
465
  value: p.scopeType,
459
466
  "onUpdate:value": e[10] || (e[10] = (r) => p.scopeType = r),
460
- options: fe.value
467
+ options: ye.value
461
468
  }, null, 8, ["value", "options"])
462
469
  ]),
463
470
  _: 1
464
471
  }, 8, ["label"]),
465
- W.value ? (g(), D(o(v), {
472
+ J.value ? (w(), N(o(v), {
466
473
  key: 0,
467
474
  label: o(t)("role.customOrgs")
468
475
  }, {
469
476
  default: s(() => [
470
- a(Ne, {
477
+ a(Me, {
471
478
  value: p.customOrgIds,
472
479
  "onUpdate:value": e[11] || (e[11] = (r) => p.customOrgIds = r),
473
480
  multiple: "",
@@ -475,7 +482,7 @@ const Ve = { class: "form-hint" }, $e = {
475
482
  }, null, 8, ["value", "placeholder"])
476
483
  ]),
477
484
  _: 1
478
- }, 8, ["label"])) : k("", !0)
485
+ }, 8, ["label"])) : T("", !0)
479
486
  ]),
480
487
  _: 1
481
488
  }, 8, ["model"])
@@ -487,6 +494,6 @@ const Ve = { class: "form-hint" }, $e = {
487
494
  }
488
495
  });
489
496
  export {
490
- pl as default
497
+ wl as default
491
498
  };
492
499
  //# sourceMappingURL=index2.vue.js.map