smart-admin-web 10.23.1 → 10.25.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.
@@ -1543,6 +1543,26 @@ export interface paths {
1543
1543
  patch?: never;
1544
1544
  trace?: never;
1545
1545
  };
1546
+ "/api/v1/sys/org/options": {
1547
+ parameters: {
1548
+ query?: never;
1549
+ header?: never;
1550
+ path?: never;
1551
+ cookie?: never;
1552
+ };
1553
+ /**
1554
+ * 机构选择器数据源(平铺 id / parentId / name)。只回拼树所需字段,
1555
+ * 故 `[ActiveSession]` 而非 `[RolePermission]`:没有机构页权限的角色也能在表单里选机构;数据范围与 list 一致。
1556
+ */
1557
+ get: operations["Org_Options"];
1558
+ put?: never;
1559
+ post?: never;
1560
+ delete?: never;
1561
+ options?: never;
1562
+ head?: never;
1563
+ patch?: never;
1564
+ trace?: never;
1565
+ };
1546
1566
  "/api/v1/sys/org/{id}": {
1547
1567
  parameters: {
1548
1568
  query?: never;
@@ -1878,6 +1898,23 @@ export interface paths {
1878
1898
  patch?: never;
1879
1899
  trace?: never;
1880
1900
  };
1901
+ "/api/v1/sys/position/options": {
1902
+ parameters: {
1903
+ query?: never;
1904
+ header?: never;
1905
+ path?: never;
1906
+ cookie?: never;
1907
+ };
1908
+ /** 职位选择器数据源(id / name)。只回 Id 与名称,故 `[ActiveSession]`:没有职位页权限的角色也能在表单里选职位。 */
1909
+ get: operations["Position_Options"];
1910
+ put?: never;
1911
+ post?: never;
1912
+ delete?: never;
1913
+ options?: never;
1914
+ head?: never;
1915
+ patch?: never;
1916
+ trace?: never;
1917
+ };
1881
1918
  "/api/v1/sys/position/{id}": {
1882
1919
  parameters: {
1883
1920
  query?: never;
@@ -2266,6 +2303,26 @@ export interface paths {
2266
2303
  patch?: never;
2267
2304
  trace?: never;
2268
2305
  };
2306
+ "/api/v1/sys/role/options": {
2307
+ parameters: {
2308
+ query?: never;
2309
+ header?: never;
2310
+ path?: never;
2311
+ cookie?: never;
2312
+ };
2313
+ /**
2314
+ * 角色选择器数据源(仅启用,id / name)。只回 Id 与名称,故 `[ActiveSession]`:
2315
+ * 没有角色页权限的角色也能在用户表单里选角色;能否真的分配仍由用户更新接口的授权与转授校验把关。
2316
+ */
2317
+ get: operations["SysRole_Options"];
2318
+ put?: never;
2319
+ post?: never;
2320
+ delete?: never;
2321
+ options?: never;
2322
+ head?: never;
2323
+ patch?: never;
2324
+ trace?: never;
2325
+ };
2269
2326
  "/api/v1/sys/role/{id}": {
2270
2327
  parameters: {
2271
2328
  query?: never;
@@ -2472,6 +2529,26 @@ export interface paths {
2472
2529
  patch?: never;
2473
2530
  trace?: never;
2474
2531
  };
2532
+ "/api/v1/sys/user/options": {
2533
+ parameters: {
2534
+ query?: never;
2535
+ header?: never;
2536
+ path?: never;
2537
+ cookie?: never;
2538
+ };
2539
+ /**
2540
+ * 用户选择器数据源(仅启用,分页,id / name / account)。只回这三个字段,故 `[ActiveSession]`:
2541
+ * 没有用户页权限的角色也能选人;数据范围与 page 一致,不接受客户端排序。
2542
+ */
2543
+ get: operations["User_Options"];
2544
+ put?: never;
2545
+ post?: never;
2546
+ delete?: never;
2547
+ options?: never;
2548
+ head?: never;
2549
+ patch?: never;
2550
+ trace?: never;
2551
+ };
2475
2552
  "/api/v1/sys/user/{id}": {
2476
2553
  parameters: {
2477
2554
  query?: never;
@@ -3948,6 +4025,17 @@ export interface components {
3948
4025
  /** @description 是否启用 */
3949
4026
  enabled?: boolean;
3950
4027
  };
4028
+ /** @description 机构选择器选项:只有拼树所需的三个字段。 */
4029
+ OrgOption: {
4030
+ /** Format: int64 */
4031
+ id: number | string;
4032
+ /**
4033
+ * Format: int64
4034
+ * @description 父机构 Id(0=根)
4035
+ */
4036
+ parentId: number | string;
4037
+ name: string;
4038
+ };
3951
4039
  /**
3952
4040
  * @description 分页结果模型——所有分页查询的统一返回。ORM 中立(放 Core),
3953
4041
  * SqlSugar 侧的 `ToPagedListAsync` 扩展负责把查询物化成它。
@@ -4480,6 +4568,34 @@ export interface components {
4480
4568
  /** @description 当前页数据 */
4481
4569
  items?: components["schemas"]["UserMenuGrantPageItem"][];
4482
4570
  };
4571
+ /**
4572
+ * @description 分页结果模型——所有分页查询的统一返回。ORM 中立(放 Core),
4573
+ * SqlSugar 侧的 `ToPagedListAsync` 扩展负责把查询物化成它。
4574
+ */
4575
+ PagedListOfUserOption: {
4576
+ /**
4577
+ * Format: int32
4578
+ * @description 当前页码(从 1 起)
4579
+ */
4580
+ current?: number | string;
4581
+ /**
4582
+ * Format: int32
4583
+ * @description 每页条数
4584
+ */
4585
+ size?: number | string;
4586
+ /**
4587
+ * Format: int32
4588
+ * @description 总记录数
4589
+ */
4590
+ total?: number | string;
4591
+ /**
4592
+ * Format: int32
4593
+ * @description 总页数(向上取整;Size 为 0 时为 0)
4594
+ */
4595
+ pages?: number | string;
4596
+ /** @description 当前页数据 */
4597
+ items?: components["schemas"]["UserOption"][];
4598
+ };
4483
4599
  /** @description 密码复杂度策略(运行时可配置,见 ISecurityPolicyProvider)。 */
4484
4600
  PasswordPolicy: {
4485
4601
  /**
@@ -4538,6 +4654,12 @@ export interface components {
4538
4654
  /** @description 是否启用 */
4539
4655
  enabled?: boolean;
4540
4656
  };
4657
+ /** @description 职位选择器选项:只有 Id 与名称。 */
4658
+ PositionOption: {
4659
+ /** Format: int64 */
4660
+ id: number | string;
4661
+ name: string;
4662
+ };
4541
4663
  /** @description 再次认证入参。 */
4542
4664
  ReauthInput: {
4543
4665
  /** @description 方法:`totp` | `password` */
@@ -5153,6 +5275,28 @@ export interface components {
5153
5275
  /** @description 业务数据载荷 */
5154
5276
  data?: null | components["schemas"]["MySessionItem"][];
5155
5277
  };
5278
+ /**
5279
+ * @description 统一返回模型——所有接口的响应外壳。
5280
+ * 字段分工:Code 给机器判断;MsgKey+Args 给前端 i18n 渲染;
5281
+ * Message 是后端兜底文案(非浏览器调用方降级用,浏览器端应忽略它);Data 为业务载荷。<example>
5282
+ * 成功:`{ "code": 0, "msgKey": "common.success", "data": {...} }`<br />
5283
+ * 失败:`{ "code": 40001, "msgKey": "error.auth.passwordWrong", "args": {}, "message": "...", "data": null }`</example>
5284
+ */
5285
+ ResultOfIReadOnlyListOfOrgOption: {
5286
+ /**
5287
+ * Format: int32
5288
+ * @description 业务码,0 为成功,其余见 ErrorCode 分段
5289
+ */
5290
+ code?: number | string;
5291
+ /** @description 语义键(前端 i18n 语言包的键),如 `error.auth.passwordWrong` */
5292
+ msgKey?: null | string;
5293
+ /** @description 文案插值参数,与语言包模板占位符对应;无参数时为 null(序列化省略) */
5294
+ args?: null | Record<string, never>;
5295
+ /** @description 兜底文案(仅降级用途,浏览器端一律走 MsgKey 翻译) */
5296
+ message?: null | string;
5297
+ /** @description 业务数据载荷 */
5298
+ data?: null | components["schemas"]["OrgOption"][];
5299
+ };
5156
5300
  /**
5157
5301
  * @description 统一返回模型——所有接口的响应外壳。
5158
5302
  * 字段分工:Code 给机器判断;MsgKey+Args 给前端 i18n 渲染;
@@ -5175,6 +5319,50 @@ export interface components {
5175
5319
  /** @description 业务数据载荷 */
5176
5320
  data?: null | components["schemas"]["PermissionRouteItem"][];
5177
5321
  };
5322
+ /**
5323
+ * @description 统一返回模型——所有接口的响应外壳。
5324
+ * 字段分工:Code 给机器判断;MsgKey+Args 给前端 i18n 渲染;
5325
+ * Message 是后端兜底文案(非浏览器调用方降级用,浏览器端应忽略它);Data 为业务载荷。<example>
5326
+ * 成功:`{ "code": 0, "msgKey": "common.success", "data": {...} }`<br />
5327
+ * 失败:`{ "code": 40001, "msgKey": "error.auth.passwordWrong", "args": {}, "message": "...", "data": null }`</example>
5328
+ */
5329
+ ResultOfIReadOnlyListOfPositionOption: {
5330
+ /**
5331
+ * Format: int32
5332
+ * @description 业务码,0 为成功,其余见 ErrorCode 分段
5333
+ */
5334
+ code?: number | string;
5335
+ /** @description 语义键(前端 i18n 语言包的键),如 `error.auth.passwordWrong` */
5336
+ msgKey?: null | string;
5337
+ /** @description 文案插值参数,与语言包模板占位符对应;无参数时为 null(序列化省略) */
5338
+ args?: null | Record<string, never>;
5339
+ /** @description 兜底文案(仅降级用途,浏览器端一律走 MsgKey 翻译) */
5340
+ message?: null | string;
5341
+ /** @description 业务数据载荷 */
5342
+ data?: null | components["schemas"]["PositionOption"][];
5343
+ };
5344
+ /**
5345
+ * @description 统一返回模型——所有接口的响应外壳。
5346
+ * 字段分工:Code 给机器判断;MsgKey+Args 给前端 i18n 渲染;
5347
+ * Message 是后端兜底文案(非浏览器调用方降级用,浏览器端应忽略它);Data 为业务载荷。<example>
5348
+ * 成功:`{ "code": 0, "msgKey": "common.success", "data": {...} }`<br />
5349
+ * 失败:`{ "code": 40001, "msgKey": "error.auth.passwordWrong", "args": {}, "message": "...", "data": null }`</example>
5350
+ */
5351
+ ResultOfIReadOnlyListOfRoleOption: {
5352
+ /**
5353
+ * Format: int32
5354
+ * @description 业务码,0 为成功,其余见 ErrorCode 分段
5355
+ */
5356
+ code?: number | string;
5357
+ /** @description 语义键(前端 i18n 语言包的键),如 `error.auth.passwordWrong` */
5358
+ msgKey?: null | string;
5359
+ /** @description 文案插值参数,与语言包模板占位符对应;无参数时为 null(序列化省略) */
5360
+ args?: null | Record<string, never>;
5361
+ /** @description 兜底文案(仅降级用途,浏览器端一律走 MsgKey 翻译) */
5362
+ message?: null | string;
5363
+ /** @description 业务数据载荷 */
5364
+ data?: null | components["schemas"]["RoleOption"][];
5365
+ };
5178
5366
  /**
5179
5367
  * @description 统一返回模型——所有接口的响应外壳。
5180
5368
  * 字段分工:Code 给机器判断;MsgKey+Args 给前端 i18n 渲染;
@@ -5836,6 +6024,27 @@ export interface components {
5836
6024
  message?: null | string;
5837
6025
  data?: null | components["schemas"]["PagedListOfUserMenuGrantPageItem"];
5838
6026
  };
6027
+ /**
6028
+ * @description 统一返回模型——所有接口的响应外壳。
6029
+ * 字段分工:Code 给机器判断;MsgKey+Args 给前端 i18n 渲染;
6030
+ * Message 是后端兜底文案(非浏览器调用方降级用,浏览器端应忽略它);Data 为业务载荷。<example>
6031
+ * 成功:`{ "code": 0, "msgKey": "common.success", "data": {...} }`<br />
6032
+ * 失败:`{ "code": 40001, "msgKey": "error.auth.passwordWrong", "args": {}, "message": "...", "data": null }`</example>
6033
+ */
6034
+ ResultOfPagedListOfUserOption: {
6035
+ /**
6036
+ * Format: int32
6037
+ * @description 业务码,0 为成功,其余见 ErrorCode 分段
6038
+ */
6039
+ code?: number | string;
6040
+ /** @description 语义键(前端 i18n 语言包的键),如 `error.auth.passwordWrong` */
6041
+ msgKey?: null | string;
6042
+ /** @description 文案插值参数,与语言包模板占位符对应;无参数时为 null(序列化省略) */
6043
+ args?: null | Record<string, never>;
6044
+ /** @description 兜底文案(仅降级用途,浏览器端一律走 MsgKey 翻译) */
6045
+ message?: null | string;
6046
+ data?: null | components["schemas"]["PagedListOfUserOption"];
6047
+ };
5839
6048
  /**
5840
6049
  * @description 统一返回模型——所有接口的响应外壳。
5841
6050
  * 字段分工:Code 给机器判断;MsgKey+Args 给前端 i18n 渲染;
@@ -6194,6 +6403,12 @@ export interface components {
6194
6403
  */
6195
6404
  isDelegatable?: null | boolean;
6196
6405
  };
6406
+ /** @description 角色选择器选项:只有 Id 与名称。 */
6407
+ RoleOption: {
6408
+ /** Format: int64 */
6409
+ id: number | string;
6410
+ name: string;
6411
+ };
6197
6412
  /**
6198
6413
  * @description 服务器监控快照。只报<b>进程与主机基础面</b>——系统级全量指标(APM/链路/告警)
6199
6414
  * 留给消费方的观测栈(OpenTelemetry 等可选包方向),内核不越位。
@@ -7178,8 +7393,8 @@ export interface components {
7178
7393
  */
7179
7394
  isDelegatable?: null | boolean;
7180
7395
  /**
7181
- * @description 内置角色:内核种子播的固定 Id(1–999)。系统菜单只能授给内置角色,界面上新建的角色(雪花 Id)
7182
- * 与消费者种子里的角色(Id ≥ 1000)都授不了。只读计算属性,不建列。
7396
+ * @description 内置角色:内核种子播的固定 Id(1–999)。除「用户管理」「角色管理」外,系统菜单只能授给内置角色,界面上新建的角色(雪花 Id)
7397
+ * 与消费者种子里的角色(Id ≥ 1000)都授不了那部分。只读计算属性,不建列。
7183
7398
  */
7184
7399
  isBuiltin?: boolean;
7185
7400
  /** @description 软删除标记;`true` 即被全局查询过滤器排除,可经 `RestoreAsync` 恢复。 */
@@ -7547,6 +7762,13 @@ export interface components {
7547
7762
  /** @description 可转授(内置 system 模块恒为 false) */
7548
7763
  delegatable?: boolean;
7549
7764
  };
7765
+ /** @description 用户选择器选项:只有 Id、姓名、账号,其余字段(手机、邮箱、头像等)一律不出。 */
7766
+ UserOption: {
7767
+ /** Format: int64 */
7768
+ id: number | string;
7769
+ name: string;
7770
+ account: string;
7771
+ };
7550
7772
  /** @description 个人资料出参(当前登录用户视角;不含密码哈希)。 */
7551
7773
  UserProfile: {
7552
7774
  /** Format: int64 */
@@ -10295,6 +10517,28 @@ export interface operations {
10295
10517
  };
10296
10518
  };
10297
10519
  };
10520
+ Org_Options: {
10521
+ parameters: {
10522
+ query?: never;
10523
+ header?: never;
10524
+ path?: never;
10525
+ cookie?: never;
10526
+ };
10527
+ requestBody?: never;
10528
+ responses: {
10529
+ /** @description OK */
10530
+ 200: {
10531
+ headers: {
10532
+ [name: string]: unknown;
10533
+ };
10534
+ content: {
10535
+ "text/plain": components["schemas"]["ResultOfIReadOnlyListOfOrgOption"];
10536
+ "application/json": components["schemas"]["ResultOfIReadOnlyListOfOrgOption"];
10537
+ "text/json": components["schemas"]["ResultOfIReadOnlyListOfOrgOption"];
10538
+ };
10539
+ };
10540
+ };
10541
+ };
10298
10542
  Org_Get: {
10299
10543
  parameters: {
10300
10544
  query?: never;
@@ -10852,6 +11096,28 @@ export interface operations {
10852
11096
  };
10853
11097
  };
10854
11098
  };
11099
+ Position_Options: {
11100
+ parameters: {
11101
+ query?: never;
11102
+ header?: never;
11103
+ path?: never;
11104
+ cookie?: never;
11105
+ };
11106
+ requestBody?: never;
11107
+ responses: {
11108
+ /** @description OK */
11109
+ 200: {
11110
+ headers: {
11111
+ [name: string]: unknown;
11112
+ };
11113
+ content: {
11114
+ "text/plain": components["schemas"]["ResultOfIReadOnlyListOfPositionOption"];
11115
+ "application/json": components["schemas"]["ResultOfIReadOnlyListOfPositionOption"];
11116
+ "text/json": components["schemas"]["ResultOfIReadOnlyListOfPositionOption"];
11117
+ };
11118
+ };
11119
+ };
11120
+ };
10855
11121
  Position_Get: {
10856
11122
  parameters: {
10857
11123
  query?: never;
@@ -11518,6 +11784,28 @@ export interface operations {
11518
11784
  };
11519
11785
  };
11520
11786
  };
11787
+ SysRole_Options: {
11788
+ parameters: {
11789
+ query?: never;
11790
+ header?: never;
11791
+ path?: never;
11792
+ cookie?: never;
11793
+ };
11794
+ requestBody?: never;
11795
+ responses: {
11796
+ /** @description OK */
11797
+ 200: {
11798
+ headers: {
11799
+ [name: string]: unknown;
11800
+ };
11801
+ content: {
11802
+ "text/plain": components["schemas"]["ResultOfIReadOnlyListOfRoleOption"];
11803
+ "application/json": components["schemas"]["ResultOfIReadOnlyListOfRoleOption"];
11804
+ "text/json": components["schemas"]["ResultOfIReadOnlyListOfRoleOption"];
11805
+ };
11806
+ };
11807
+ };
11808
+ };
11521
11809
  SysRole_Get: {
11522
11810
  parameters: {
11523
11811
  query?: never;
@@ -11898,6 +12186,37 @@ export interface operations {
11898
12186
  };
11899
12187
  };
11900
12188
  };
12189
+ User_Options: {
12190
+ parameters: {
12191
+ query?: {
12192
+ /** @description 姓名或账号(模糊) */
12193
+ Keyword?: string;
12194
+ /** @description 主属机构 Id(精确) */
12195
+ OrgId?: number | string;
12196
+ /** @description 页码(从 1 起) */
12197
+ Current?: number | string;
12198
+ /** @description 每页条数,上限同 `SmartAdmin:Api:MaxPageSize` */
12199
+ Size?: number | string;
12200
+ };
12201
+ header?: never;
12202
+ path?: never;
12203
+ cookie?: never;
12204
+ };
12205
+ requestBody?: never;
12206
+ responses: {
12207
+ /** @description OK */
12208
+ 200: {
12209
+ headers: {
12210
+ [name: string]: unknown;
12211
+ };
12212
+ content: {
12213
+ "text/plain": components["schemas"]["ResultOfPagedListOfUserOption"];
12214
+ "application/json": components["schemas"]["ResultOfPagedListOfUserOption"];
12215
+ "text/json": components["schemas"]["ResultOfPagedListOfUserOption"];
12216
+ };
12217
+ };
12218
+ };
12219
+ };
11901
12220
  User_Get: {
11902
12221
  parameters: {
11903
12222
  query?: never;
@@ -1,42 +1,54 @@
1
- import { defineComponent as c, ref as n, onMounted as s, computed as d, openBlock as f, createBlock as p, unref as m, mergeProps as v } from "vue";
2
- import { NTreeSelect as b } from "naive-ui";
3
- import { orgApi as h } from "../../api/index.js";
4
- import { collectSubtreeIds as x, buildTree as g } from "../../utils/tree.js";
5
- const O = /* @__PURE__ */ c({
1
+ import { defineComponent as f, ref as l, onMounted as p, computed as m, openBlock as v, createBlock as b, unref as r, mergeProps as h, createSlots as x, withCtx as y, createVNode as S } from "vue";
2
+ import { NTreeSelect as _, NEmpty as g } from "naive-ui";
3
+ import { useI18n as k } from "vue-i18n";
4
+ import { orgApi as w } from "../../api/index.js";
5
+ import { collectSubtreeIds as N, buildTree as O } from "../../utils/tree.js";
6
+ const T = /* @__PURE__ */ f({
6
7
  inheritAttrs: !1,
7
8
  __name: "index",
8
9
  props: {
9
10
  excludeSubtreeOf: {}
10
11
  },
11
- setup(a) {
12
- const r = a, e = n([]), l = n(!1);
13
- s(async () => {
14
- l.value = !0;
12
+ setup(c) {
13
+ const n = c, { t: s } = k(), e = l([]), t = l(!1), a = l(!1);
14
+ p(async () => {
15
+ t.value = !0;
15
16
  try {
16
- e.value = await h.list();
17
+ e.value = await w.options();
17
18
  } catch {
19
+ a.value = !0;
18
20
  } finally {
19
- l.value = !1;
21
+ t.value = !1;
20
22
  }
21
23
  });
22
- const u = d(() => {
23
- const t = r.excludeSubtreeOf == null ? e.value : (() => {
24
- const o = x(e.value, r.excludeSubtreeOf);
25
- return e.value.filter((i) => !o.has(i.id));
24
+ const u = m(() => {
25
+ const o = n.excludeSubtreeOf == null ? e.value : (() => {
26
+ const i = N(e.value, n.excludeSubtreeOf);
27
+ return e.value.filter((d) => !i.has(d.id));
26
28
  })();
27
- return g(t);
29
+ return O(o);
28
30
  });
29
- return (t, o) => (f(), p(m(b), v({
31
+ return (o, i) => (v(), b(r(_), h({
30
32
  options: u.value,
31
- loading: l.value,
33
+ loading: t.value,
32
34
  "key-field": "id",
33
35
  "label-field": "name",
34
36
  "children-field": "children",
35
37
  clearable: ""
36
- }, t.$attrs), null, 16, ["options", "loading"]));
38
+ }, o.$attrs), x({ _: 2 }, [
39
+ a.value ? {
40
+ name: "empty",
41
+ fn: y(() => [
42
+ S(r(g), {
43
+ description: r(s)("common.loadFailed")
44
+ }, null, 8, ["description"])
45
+ ]),
46
+ key: "0"
47
+ } : void 0
48
+ ]), 1040, ["options", "loading"]));
37
49
  }
38
50
  });
39
51
  export {
40
- O as default
52
+ T as default
41
53
  };
42
54
  //# sourceMappingURL=index.vue.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.vue.js","sources":["../../../src/components/OrgTreeSelect/index.vue"],"sourcesContent":["<script setup lang=\"ts\">\n// 机构树下拉:onMounted 拉 orgApi.list()(平铺)→ buildTree 拼树;value/placeholder/size… 一切经 $attrs 透传 n-tree-select。\n// excludeSubtreeOf:编辑机构选上级时剪掉自身子树(防把自己挂到自己后代下成环)——用户页传 null(不剪),机构页传 editingId。\nimport { computed, onMounted, ref } from 'vue'\nimport { NTreeSelect } from 'naive-ui'\nimport { orgApi } from '#/api'\nimport { buildTree, collectSubtreeIds } from '#/utils/tree'\nimport type { SysOrg } from '#/types/api'\n\ndefineOptions({ inheritAttrs: false })\nconst props = defineProps<{ excludeSubtreeOf?: number | null }>()\n\nconst flat = ref<SysOrg[]>([])\nconst loading = ref(false)\nonMounted(async () => {\n loading.value = true\n try {\n flat.value = await orgApi.list()\n } catch {\n // 静默留空:机构是配角,不打断主流程\n } finally {\n loading.value = false\n }\n})\n\nconst options = computed(() => {\n const rows =\n props.excludeSubtreeOf == null\n ? flat.value\n : (() => {\n const excluded = collectSubtreeIds(flat.value, props.excludeSubtreeOf!)\n return flat.value.filter(o => !excluded.has(o.id))\n })()\n return buildTree(rows)\n})\n</script>\n\n<template>\n <n-tree-select\n :options=\"options\"\n :loading=\"loading\"\n key-field=\"id\"\n label-field=\"name\"\n children-field=\"children\"\n clearable\n v-bind=\"$attrs\"\n />\n</template>\n"],"names":["props","__props","flat","ref","loading","onMounted","orgApi","options","computed","rows","excluded","collectSubtreeIds","o","buildTree","_openBlock","_createBlock","_unref","_mergeProps","$attrs"],"mappings":";;;;;;;;;;;AAUA,UAAMA,IAAQC,GAERC,IAAOC,EAAc,EAAE,GACvBC,IAAUD,EAAI,EAAK;AACzB,IAAAE,EAAU,YAAY;AACpB,MAAAD,EAAQ,QAAQ;AAChB,UAAI;AACF,QAAAF,EAAK,QAAQ,MAAMI,EAAO,KAAA;AAAA,MAC5B,QAAQ;AAAA,MAER,UAAA;AACE,QAAAF,EAAQ,QAAQ;AAAA,MAClB;AAAA,IACF,CAAC;AAED,UAAMG,IAAUC,EAAS,MAAM;AAC7B,YAAMC,IACJT,EAAM,oBAAoB,OACtBE,EAAK,SACJ,MAAM;AACL,cAAMQ,IAAWC,EAAkBT,EAAK,OAAOF,EAAM,gBAAiB;AACtE,eAAOE,EAAK,MAAM,OAAO,CAAAU,MAAK,CAACF,EAAS,IAAIE,EAAE,EAAE,CAAC;AAAA,MACnD,GAAA;AACN,aAAOC,EAAUJ,CAAI;AAAA,IACvB,CAAC;sBAICK,KAAAC,EAQEC,MARFC,EAQE;AAAA,MAPC,SAASV,EAAA;AAAA,MACT,SAASH,EAAA;AAAA,MACV,aAAU;AAAA,MACV,eAAY;AAAA,MACZ,kBAAe;AAAA,MACf,WAAA;AAAA,IAAA,GACQc,EAAAA,MAAM,GAAA,MAAA,IAAA,CAAA,WAAA,SAAA,CAAA;AAAA;;"}
1
+ {"version":3,"file":"index.vue.js","sources":["../../../src/components/OrgTreeSelect/index.vue"],"sourcesContent":["<script setup lang=\"ts\">\n// 机构树下拉:onMounted 拉 orgApi.options()(平铺,不占机构页权限码)→ buildTree 拼树;value/placeholder/size… 一切经 $attrs 透传 n-tree-select。\n// excludeSubtreeOf:编辑机构选上级时剪掉自身子树(防把自己挂到自己后代下成环)——用户页传 null(不剪),机构页传 editingId。\nimport { computed, onMounted, ref } from 'vue'\nimport { NEmpty, NTreeSelect } from 'naive-ui'\nimport { useI18n } from 'vue-i18n'\nimport { orgApi } from '#/api'\nimport { buildTree, collectSubtreeIds } from '#/utils/tree'\nimport type { OrgOption } from '#/types/api'\n\ndefineOptions({ inheritAttrs: false })\nconst props = defineProps<{ excludeSubtreeOf?: number | null }>()\n\nconst { t } = useI18n()\nconst flat = ref<OrgOption[]>([])\nconst loading = ref(false)\n// 失败不弹 message(本组件不依赖 message provider),但下拉空态要说明是加载失败,不能让人当成「没有机构」\nconst loadFailed = ref(false)\nonMounted(async () => {\n loading.value = true\n try {\n flat.value = await orgApi.options()\n } catch {\n loadFailed.value = true\n } finally {\n loading.value = false\n }\n})\n\nconst options = computed(() => {\n const rows =\n props.excludeSubtreeOf == null\n ? flat.value\n : (() => {\n const excluded = collectSubtreeIds(flat.value, props.excludeSubtreeOf!)\n return flat.value.filter(o => !excluded.has(o.id))\n })()\n return buildTree(rows)\n})\n</script>\n\n<template>\n <n-tree-select\n :options=\"options\"\n :loading=\"loading\"\n key-field=\"id\"\n label-field=\"name\"\n children-field=\"children\"\n clearable\n v-bind=\"$attrs\"\n >\n <template v-if=\"loadFailed\" #empty>\n <n-empty :description=\"t('common.loadFailed')\" />\n </template>\n </n-tree-select>\n</template>\n"],"names":["props","__props","t","useI18n","flat","ref","loading","loadFailed","onMounted","orgApi","options","computed","rows","excluded","collectSubtreeIds","o","buildTree","_openBlock","_createBlock","_unref","_mergeProps","$attrs","_createSlots","_createVNode","NEmpty"],"mappings":";;;;;;;;;;;;AAWA,UAAMA,IAAQC,GAER,EAAE,GAAAC,EAAA,IAAMC,EAAA,GACRC,IAAOC,EAAiB,EAAE,GAC1BC,IAAUD,EAAI,EAAK,GAEnBE,IAAaF,EAAI,EAAK;AAC5B,IAAAG,EAAU,YAAY;AACpB,MAAAF,EAAQ,QAAQ;AAChB,UAAI;AACF,QAAAF,EAAK,QAAQ,MAAMK,EAAO,QAAA;AAAA,MAC5B,QAAQ;AACN,QAAAF,EAAW,QAAQ;AAAA,MACrB,UAAA;AACE,QAAAD,EAAQ,QAAQ;AAAA,MAClB;AAAA,IACF,CAAC;AAED,UAAMI,IAAUC,EAAS,MAAM;AAC7B,YAAMC,IACJZ,EAAM,oBAAoB,OACtBI,EAAK,SACJ,MAAM;AACL,cAAMS,IAAWC,EAAkBV,EAAK,OAAOJ,EAAM,gBAAiB;AACtE,eAAOI,EAAK,MAAM,OAAO,CAAAW,MAAK,CAACF,EAAS,IAAIE,EAAE,EAAE,CAAC;AAAA,MACnD,GAAA;AACN,aAAOC,EAAUJ,CAAI;AAAA,IACvB,CAAC;sBAICK,KAAAC,EAYgBC,MAZhBC,EAYgB;AAAA,MAXb,SAASV,EAAA;AAAA,MACT,SAASJ,EAAA;AAAA,MACV,aAAU;AAAA,MACV,eAAY;AAAA,MACZ,kBAAe;AAAA,MACf,WAAA;AAAA,IAAA,GACQe,EAAAA,MAAM,GAAAC,EAAA,EAAA,GAAA,KAAA;AAAA,MAEEf,EAAA;cAAa;AAAA,cAC3B,MAAiD;AAAA,UAAjDgB,EAAiDJ,EAAAK,CAAA,GAAA;AAAA,YAAvC,aAAaL,EAAAjB,CAAA,EAAC,mBAAA;AAAA,UAAA;;;;;;;"}
@@ -1,23 +1,21 @@
1
- import { defineComponent as i, openBlock as p, createBlock as m, mergeProps as s } from "vue";
2
- import c from "../ApiSelect/index.vue.js";
3
- import { roleApi as l } from "../../api/index.js";
4
- const _ = /* @__PURE__ */ i({
1
+ import { defineComponent as a, openBlock as i, createBlock as s, mergeProps as p } from "vue";
2
+ import m from "../ApiSelect/index.vue.js";
3
+ import { roleApi as c } from "../../api/index.js";
4
+ const _ = /* @__PURE__ */ a({
5
5
  inheritAttrs: !1,
6
6
  __name: "index",
7
7
  props: {
8
8
  pageSize: { default: 100 }
9
9
  },
10
- setup(n) {
11
- const r = n;
12
- async function o(t) {
13
- const { items: a } = await l.page({
14
- page: 1,
15
- pageSize: r.pageSize,
16
- name: t || void 0
17
- });
18
- return a.filter((e) => e.enabled).map((e) => ({ label: e.name, value: e.id }));
10
+ setup(o) {
11
+ const r = o;
12
+ async function n() {
13
+ return (await c.options()).slice(0, r.pageSize).map((e) => ({ label: e.name, value: e.id }));
19
14
  }
20
- return (t, a) => (p(), m(c, s({ fetch: o }, t.$attrs), null, 16));
15
+ return (t, e) => (i(), s(m, p({
16
+ fetch: n,
17
+ remote: !1
18
+ }, t.$attrs), null, 16));
21
19
  }
22
20
  });
23
21
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"index.vue.js","sources":["../../../src/components/RoleSelect/index.vue"],"sourcesContent":["<script setup lang=\"ts\">\n// 角色选择器:基于 ApiSelect,fetch=roleApi.page(name 搜索)。只列启用角色,label=角色名,\n// value=角色 id。多选常用(用户分配角色);multiple/placeholder 等经 $attrs 透传。\nimport type { SelectOption } from 'naive-ui'\nimport ApiSelect from '#/components/ApiSelect/index.vue'\nimport { roleApi } from '#/api'\n\ndefineOptions({ inheritAttrs: false })\nconst props = withDefaults(defineProps<{ pageSize?: number }>(), { pageSize: 100 })\n\nasync function fetch(keyword: string): Promise<SelectOption[]> {\n const { items } = await roleApi.page({\n page: 1,\n pageSize: props.pageSize,\n name: keyword || undefined,\n })\n return items.filter(r => r.enabled).map(r => ({ label: r.name, value: r.id }))\n}\n</script>\n\n<template>\n <ApiSelect :fetch=\"fetch\" v-bind=\"$attrs\" />\n</template>\n"],"names":["props","__props","fetch","keyword","items","roleApi","r","_openBlock","_createBlock","ApiSelect","_mergeProps","$attrs"],"mappings":";;;;;;;;;;AAQA,UAAMA,IAAQC;AAEd,mBAAeC,EAAMC,GAA0C;AAC7D,YAAM,EAAE,OAAAC,EAAA,IAAU,MAAMC,EAAQ,KAAK;AAAA,QACnC,MAAM;AAAA,QACN,UAAUL,EAAM;AAAA,QAChB,MAAMG,KAAW;AAAA,MAAA,CAClB;AACD,aAAOC,EAAM,OAAO,CAAAE,MAAKA,EAAE,OAAO,EAAE,IAAI,CAAAA,OAAM,EAAE,OAAOA,EAAE,MAAM,OAAOA,EAAE,KAAK;AAAA,IAC/E;sBAIEC,EAAA,GAAAC,EAA4CC,GAA5CC,EAA4C,EAAhC,OAAAR,EAAA,GAAsBS,EAAAA,MAAM,GAAA,MAAA,EAAA;AAAA;;"}
1
+ {"version":3,"file":"index.vue.js","sources":["../../../src/components/RoleSelect/index.vue"],"sourcesContent":["<script setup lang=\"ts\">\n// 角色选择器:基于 ApiSelect,fetch=roleApi.options(不占角色页权限码)。只列启用角色,label=角色名,\n// value=角色 id。多选常用(用户分配角色);multiple/placeholder 等经 $attrs 透传。\n// options 不带搜索与分页:一次取回,pageSize 只限制下拉最多列出多少个,按名称搜索交给 n-select 本地过滤。\nimport type { SelectOption } from 'naive-ui'\nimport ApiSelect from '#/components/ApiSelect/index.vue'\nimport { roleApi } from '#/api'\n\ndefineOptions({ inheritAttrs: false })\nconst props = withDefaults(defineProps<{ pageSize?: number }>(), { pageSize: 100 })\n\nasync function fetch(): Promise<SelectOption[]> {\n const items = await roleApi.options()\n return items.slice(0, props.pageSize).map(r => ({ label: r.name, value: r.id }))\n}\n</script>\n\n<template>\n <ApiSelect :fetch=\"fetch\" :remote=\"false\" v-bind=\"$attrs\" />\n</template>\n"],"names":["props","__props","fetch","roleApi","r","_openBlock","_createBlock","ApiSelect","_mergeProps","$attrs"],"mappings":";;;;;;;;;;AASA,UAAMA,IAAQC;AAEd,mBAAeC,IAAiC;AAE9C,cADc,MAAMC,EAAQ,QAAA,GACf,MAAM,GAAGH,EAAM,QAAQ,EAAE,IAAI,CAAAI,OAAM,EAAE,OAAOA,EAAE,MAAM,OAAOA,EAAE,KAAK;AAAA,IACjF;sBAIEC,EAAA,GAAAC,EAA4DC,GAA5DC,EAA4D;AAAA,MAAhD,OAAAN;AAAA,MAAe,QAAQ;AAAA,IAAA,GAAeO,EAAAA,MAAM,GAAA,MAAA,EAAA;AAAA;;"}
@@ -1,8 +1,8 @@
1
1
  import o from "./index2.vue.js";
2
2
  /* empty css */
3
3
  import r from "../../_virtual/_plugin-vue_export-helper.js";
4
- const m = /* @__PURE__ */ r(o, [["__scopeId", "data-v-4f437906"]]);
4
+ const f = /* @__PURE__ */ r(o, [["__scopeId", "data-v-4c72fb5c"]]);
5
5
  export {
6
- m as default
6
+ f as default
7
7
  };
8
8
  //# sourceMappingURL=index.vue.js.map