smart-admin-web 10.12.2 → 10.13.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.
@@ -1,5 +1,5 @@
1
1
  import { components } from './schema';
2
- import { AddUserInput, AddUserOutput, AiProviderAddInput, AiProviderPreset, AiProviderUpdateInput, AiProviderView, AiTestResult, AiUsageGroupBy, AiUsageSummary, AiUsageTrendPoint, ChunkInitOutput, ConfigInput, CronPreviewOutput, DashboardSummary, DataScopeType, DictItem, DictItemInput, DictTypeInput, DuplicateStrategy, FileUploadOutput, ImportCommitResult, ImportPreview, ImportRow, JobDashboard, JobHandlersOutput, JobInput, LastLoginInfo, LoginOutput, ModuleInput, ModuleRow, MyModulesOutput, MySessionItem, NoticeMineItem, NoticePublishInput, OnlineSessionItem, OrgInput, PermissionRouteItem, PositionInput, RoleInput, ServerInfoOutput, SysAiUsageLog, SysConfig, SysDictItem, SysDictType, SysExceptionLog, SysFile, SysJob, SysJobLog, SysLoginLog, SysNotice, SysOpLog, SysOrg, SysPosition, SysRole, SysRoleDataScope, UpdateUserInput, UserDetail, UserItem, UserProfile, UserShortcutItem, WorkbenchTodoSummary } from '../types/api';
2
+ import { AddUserInput, AddUserOutput, AiProviderAddInput, AiProviderPreset, AiProviderUpdateInput, AiProviderView, AiTestResult, AiUsageGroupBy, AiUsageSummary, AiUsageTrendPoint, ChunkInitOutput, ConfigInput, CronPreviewOutput, DashboardSummary, DataScopeType, DictItem, DictItemInput, DictTypeInput, DuplicateStrategy, FileUploadOutput, ImportCommitResult, ImportPreview, ImportRow, JobDashboard, JobHandlersOutput, JobInput, LastLoginInfo, LoginOutput, ModuleInput, ModuleRow, MyModulesOutput, MySessionItem, NoticeMineItem, NoticePublishInput, OnlineSessionItem, OrgInput, PermissionRouteItem, PositionInput, RoleInput, ServerInfoOutput, SysAiUsageLog, SysConfig, SysDictItem, SysDictType, SysExceptionLog, SysFile, SysJob, SysJobLog, SysLoginLog, SysNotice, SysOpLog, SysOrg, SysPosition, SysRole, SysRoleDataScope, SysTenant, TenantCreateInput, TenantInput, UpdateUserInput, UserDetail, UserItem, UserProfile, UserShortcutItem, WorkbenchTodoSummary } from '../types/api';
3
3
  import { MenuInput, MenuNode, MenuTreeNode } from '../types/menu';
4
4
  /** 业务错误(含后端 code / msgKey);视图 catch 后经 translateError 展示。 */
5
5
  export declare class ApiError extends Error {
@@ -732,4 +732,19 @@ export declare const aiUsageApi: {
732
732
  total: number;
733
733
  }>;
734
734
  };
735
+ export declare const tenantApi: {
736
+ page: (params: {
737
+ page: number;
738
+ pageSize: number;
739
+ name?: string;
740
+ sortField?: string;
741
+ sortOrder?: string;
742
+ }) => Promise<{
743
+ items: SysTenant[];
744
+ total: number;
745
+ }>;
746
+ add: (body: TenantCreateInput) => Promise<number>;
747
+ update: (id: number, body: TenantInput) => Promise<boolean>;
748
+ remove: (id: number) => Promise<boolean>;
749
+ };
735
750
  export {};
package/dist/api/index.js CHANGED
@@ -4,8 +4,8 @@ var y = (e, t, i) => P(e, typeof t != "symbol" ? t + "" : t, i);
4
4
  import { client as s, LONG_TIMEOUT_MS as l } from "./client.js";
5
5
  import { runtime as S } from "../lib/runtime.js";
6
6
  class u extends Error {
7
- constructor(i, o, n, p) {
8
- super(p ?? o ?? `Error ${i}`);
7
+ constructor(i, o, n, d) {
8
+ super(d ?? o ?? `Error ${i}`);
9
9
  y(this, "code");
10
10
  y(this, "msgKey");
11
11
  y(this, "args");
@@ -15,9 +15,9 @@ class u extends Error {
15
15
  function a(e) {
16
16
  const { data: t, error: i, response: o } = e;
17
17
  if (i != null) {
18
- const p = i;
19
- if (typeof p.code == "number")
20
- throw new u(p.code, p.msgKey, p.args, p.message);
18
+ const d = i;
19
+ if (typeof d.code == "number")
20
+ throw new u(d.code, d.msgKey, d.args, d.message);
21
21
  const h = i;
22
22
  throw new u(
23
23
  o.status,
@@ -46,7 +46,7 @@ const r = (e) => ({
46
46
  SortField: e.sortField,
47
47
  SortOrder: e.sortOrder
48
48
  }), f = (e) => !e || e.length !== 2 ? { start: void 0, end: void 0 } : { start: e[0] || void 0, end: e[1] ? `${e[1]} 23:59:59` : void 0 };
49
- function d(e) {
49
+ function p(e) {
50
50
  const t = a(e);
51
51
  return { items: t.items, total: t.total };
52
52
  }
@@ -56,9 +56,9 @@ async function m(e) {
56
56
  const h = i ?? {};
57
57
  throw typeof h.code == "number" ? new u(h.code, h.msgKey, h.args, h.message) : new u(o.status, void 0, void 0, o.statusText);
58
58
  }
59
- const n = t, p = o.headers.get("content-type") ?? "";
60
- if (p.includes("spreadsheet") || p.includes("octet-stream")) return n;
61
- if (p.includes("json") || p.includes("text/plain")) {
59
+ const n = t, d = o.headers.get("content-type") ?? "";
60
+ if (d.includes("spreadsheet") || d.includes("octet-stream")) return n;
61
+ if (d.includes("json") || d.includes("text/plain")) {
62
62
  const h = JSON.parse(await n.text());
63
63
  if (typeof h.code == "number" && h.code !== 0)
64
64
  throw new u(h.code, h.msgKey, h.args, h.message);
@@ -152,7 +152,7 @@ const C = {
152
152
  list: () => s.GET("/api/v1/sys/mfa/high-sensitivity", {}).then((e) => a(e)),
153
153
  add: (e) => s.POST("/api/v1/sys/mfa/high-sensitivity", { body: e }).then((t) => a(t)),
154
154
  remove: (e) => s.DELETE("/api/v1/sys/mfa/high-sensitivity/{id}", { params: { path: { id: e } } }).then((t) => a(t))
155
- }, k = {
155
+ }, D = {
156
156
  /** 登录页可用的外部登录方式(启用的);空数组 = 不显 SSO 区。 */
157
157
  providers: () => s.GET("/api/v1/auth/external/providers", {}).then((e) => a(e)),
158
158
  /** 管理端全量列表(含已禁用);系统配置「第三方登录」Tab。 */
@@ -169,7 +169,7 @@ const C = {
169
169
  bindStart: (e) => s.POST("/api/v1/auth/external/{provider}/bind", { params: { path: { provider: e } } }).then((t) => a(t)),
170
170
  /** 解绑某 provider 的外部账号。 */
171
171
  unbind: (e) => s.DELETE("/api/v1/auth/external/{provider}/binding", { params: { path: { provider: e } } }).then((t) => a(t))
172
- }, D = {
172
+ }, k = {
173
173
  /** 工作台首页统计([ActiveSession]:任何登录用户可取,无需权限码)。 */
174
174
  summary: () => s.GET("/api/v1/dashboard/summary", {}).then((e) => a(e))
175
175
  }, L = {
@@ -215,7 +215,7 @@ const C = {
215
215
  SortOrder: e.sortOrder
216
216
  }
217
217
  }
218
- }).then((t) => d(t)),
218
+ }).then((t) => p(t)),
219
219
  /** 用户详情(含 roleIds,编辑回显 + 提交时原样带回避免清空角色)。 */
220
220
  detail: (e) => s.GET("/api/v1/sys/user/{id}", { params: { path: { id: e } } }).then((t) => a(t)),
221
221
  /** 新增用户;返回新 Id + 实际生效的初始口令(留空 password 时后端随机生成,不接住就没人知道这个号的密码)。 */
@@ -304,7 +304,7 @@ const C = {
304
304
  SortOrder: e.sortOrder
305
305
  }
306
306
  }
307
- }).then((t) => d(t)),
307
+ }).then((t) => p(t)),
308
308
  add: (e) => s.POST("/api/v1/sys/position/add", { body: e }).then((t) => a(t)),
309
309
  update: (e, t) => s.PUT("/api/v1/sys/position/{id}", { params: { path: { id: e } }, body: t }).then((i) => a(i)),
310
310
  remove: (e) => s.DELETE("/api/v1/sys/position/{id}", { params: { path: { id: e } } }).then((t) => a(t))
@@ -312,7 +312,7 @@ const C = {
312
312
  /** 角色分页;搜索键 name → PascalCase Name。列表用 + 用户/授权页拉一大页当下拉源。 */
313
313
  page: (e) => s.GET("/api/v1/sys/role/page", {
314
314
  params: { query: { ...r(e), Name: e.name } }
315
- }).then((t) => d(t)),
315
+ }).then((t) => p(t)),
316
316
  add: (e) => s.POST("/api/v1/sys/role/add", { body: e }).then((t) => a(t)),
317
317
  update: (e, t) => s.PUT("/api/v1/sys/role/{id}", { params: { path: { id: e } }, body: t }).then((i) => a(i)),
318
318
  remove: (e) => s.DELETE("/api/v1/sys/role/{id}", { params: { path: { id: e } } }).then((t) => a(t)),
@@ -347,7 +347,7 @@ const C = {
347
347
  ExcludedGroupCodes: e.excludedGroupCodes
348
348
  }
349
349
  }
350
- }).then((t) => d(t)),
350
+ }).then((t) => p(t)),
351
351
  add: (e) => s.POST("/api/v1/sys/config", { body: e }).then((t) => a(t)),
352
352
  update: (e, t) => s.PUT("/api/v1/sys/config/{id}", { params: { path: { id: e } }, body: t }).then((i) => a(i)),
353
353
  remove: (e) => s.DELETE("/api/v1/sys/config/{id}", { params: { path: { id: e } } }).then((t) => a(t)),
@@ -390,7 +390,7 @@ const B = {
390
390
  ...v(e.createTime)
391
391
  }
392
392
  }
393
- }).then((t) => d(t)),
393
+ }).then((t) => p(t)),
394
394
  /** 清空登录日志(硬删,不可恢复)。 */
395
395
  loginClear: () => s.DELETE("/api/v1/sys/log/login", {}).then((e) => a(e)),
396
396
  /** 操作日志分页;操作名模糊 + 成败 + 操作人(精确)+ 接口路径(模糊)+ 时间范围——审计要能答"谁在什么时候干了什么"。 */
@@ -405,7 +405,7 @@ const B = {
405
405
  ...v(e.createTime)
406
406
  }
407
407
  }
408
- }).then((t) => d(t)),
408
+ }).then((t) => p(t)),
409
409
  /** 清空操作日志(硬删,不可恢复)。 */
410
410
  opClear: () => s.DELETE("/api/v1/sys/log/op", {}).then((e) => a(e)),
411
411
  /**
@@ -436,7 +436,7 @@ const B = {
436
436
  ...v(e.createTime)
437
437
  }
438
438
  }
439
- }).then((t) => d(t)),
439
+ }).then((t) => p(t)),
440
440
  /** 清空异常日志(硬删,不可恢复)。 */
441
441
  exceptionClear: () => s.DELETE("/api/v1/sys/log/exception", {}).then((e) => a(e))
442
442
  }, M = {
@@ -467,7 +467,7 @@ const B = {
467
467
  /** 字典类型分页;搜索键 code/name → PascalCase Code/Name 查询参。 */
468
468
  typePage: (e) => s.GET("/api/v1/sys/dict/type/page", {
469
469
  params: { query: { ...r(e), Code: e.code, Name: e.name } }
470
- }).then((t) => d(t)),
470
+ }).then((t) => p(t)),
471
471
  typeAdd: (e) => s.POST("/api/v1/sys/dict/type", { body: e }).then((t) => a(t)),
472
472
  typeUpdate: (e, t) => s.PUT("/api/v1/sys/dict/type/{id}", { params: { path: { id: e } }, body: t }).then((i) => a(i)),
473
473
  typeRemove: (e) => s.DELETE("/api/v1/sys/dict/type/{id}", { params: { path: { id: e } } }).then((t) => a(t)),
@@ -486,7 +486,7 @@ const B = {
486
486
  /** 文件分页;搜索键 originalName → 后端 FileName 模糊过滤。 */
487
487
  page: (e) => s.GET("/api/v1/sys/file/page", {
488
488
  params: { query: { ...r(e), FileName: e.originalName } }
489
- }).then((t) => d(t)),
489
+ }).then((t) => p(t)),
490
490
  /** 上传单个文件:bodySerializer 建 FormData(字段名 file),openapi-fetch 对 FormData 不注入 json header,浏览器自动补 boundary(client.ts 无需改)。 */
491
491
  upload: (e) => s.POST("/api/v1/sys/file/upload", {
492
492
  timeout: l,
@@ -517,15 +517,15 @@ const B = {
517
517
  timeout: l,
518
518
  body: { uploadId: e, index: t, chunk: i },
519
519
  bodySerializer: (o) => {
520
- const n = o, p = new FormData();
521
- return p.append("uploadId", n.uploadId), p.append("index", String(n.index)), p.append("chunk", n.chunk), p;
520
+ const n = o, d = new FormData();
521
+ return d.append("uploadId", n.uploadId), d.append("index", String(n.index)), d.append("chunk", n.chunk), d;
522
522
  }
523
523
  }).then((o) => a(o)),
524
524
  /** 完成:触发服务端合并 + 哈希校验 + 三道关 + 落库。 */
525
525
  chunkComplete: (e) => s.POST("/api/v1/sys/file/chunk/complete", { timeout: l, body: e }).then((t) => a(t))
526
526
  }, H = {
527
527
  /** 在线会话分页(只读)。后端仅支持按 UserId 过滤,这里不带业务搜索。 */
528
- online: (e) => s.GET("/api/v1/sys/session/online", { params: { query: r(e) } }).then((t) => d(t)),
528
+ online: (e) => s.GET("/api/v1/sys/session/online", { params: { query: r(e) } }).then((t) => p(t)),
529
529
  /** 强制下线:按 sessionId 踢会话。 */
530
530
  kick: (e) => s.DELETE("/api/v1/sys/session/{sessionId}", { params: { path: { sessionId: e } } }).then((t) => a(t))
531
531
  }, Q = {
@@ -533,14 +533,14 @@ const B = {
533
533
  /** 管理端分页(全量);搜索键 title/type → PascalCase 查询参。 */
534
534
  page: (e) => s.GET("/api/v1/sys/notice/page", {
535
535
  params: { query: { ...r(e), Title: e.title, Type: e.type } }
536
- }).then((t) => d(t)),
536
+ }).then((t) => p(t)),
537
537
  publish: (e) => s.POST("/api/v1/sys/notice", { body: e }).then((t) => a(t)),
538
538
  remove: (e) => s.DELETE("/api/v1/sys/notice/{id}", { params: { path: { id: e } } }).then((t) => a(t)),
539
539
  // ── 用户端(任何登录用户) ──
540
540
  /** 我的通知分页(含已读标记);onlyUnread 供"未读"页签用。 */
541
541
  mine: (e) => s.GET("/api/v1/sys/notice/mine", {
542
542
  params: { query: { ...r(e), OnlyUnread: e.onlyUnread } }
543
- }).then((t) => d(t)),
543
+ }).then((t) => p(t)),
544
544
  /** 当前用户未读通知数(顶栏角标轮询)。 */
545
545
  unreadCount: () => s.GET("/api/v1/sys/notice/unread-count", {}).then((e) => a(e)),
546
546
  markRead: (e) => s.PUT("/api/v1/sys/notice/{id}/read", { params: { path: { id: e } } }).then((t) => a(t)),
@@ -565,7 +565,7 @@ const B = {
565
565
  SortOrder: e.sortOrder
566
566
  }
567
567
  }
568
- }).then((t) => d(t)),
568
+ }).then((t) => p(t)),
569
569
  add: (e) => s.POST("/api/v1/sys/job", { body: e }).then((t) => a(t)),
570
570
  update: (e, t) => s.PUT("/api/v1/sys/job/{id}", { params: { path: { id: e } }, body: t }).then((i) => a(i)),
571
571
  remove: (e) => s.DELETE("/api/v1/sys/job/{id}", { params: { path: { id: e } } }).then((t) => a(t)),
@@ -596,7 +596,7 @@ const B = {
596
596
  StartTo: (i = e.startRange) != null && i[1] ? `${e.startRange[1]} 23:59:59` : void 0
597
597
  }
598
598
  }
599
- }).then((o) => d(o));
599
+ }).then((o) => p(o));
600
600
  },
601
601
  /** 终止一次执行(跨节点写终止旗标,目标节点最迟 KillPollSeconds 后停)。 */
602
602
  kill: (e) => s.POST("/api/v1/sys/job/log/{id}/kill", { params: { path: { id: e } } }).then((t) => a(t)),
@@ -607,7 +607,7 @@ const B = {
607
607
  }, Y = {
608
608
  page: (e) => (t) => s.GET("/api/v1/sys/recycle/{type}/page", {
609
609
  params: { path: { type: e }, query: r(t) }
610
- }).then((i) => d(i)),
610
+ }).then((i) => p(i)),
611
611
  restore: (e, t) => s.POST("/api/v1/sys/recycle/{type}/{id}/restore", { params: { path: { type: e, id: t } } }).then((i) => a(i)),
612
612
  purge: (e, t) => s.DELETE("/api/v1/sys/recycle/{type}/{id}", { params: { path: { type: e, id: t } } }).then((i) => a(i))
613
613
  }, Z = {
@@ -620,7 +620,7 @@ const B = {
620
620
  Enabled: e.enabled
621
621
  }
622
622
  }
623
- }).then((t) => d(t)),
623
+ }).then((t) => p(t)),
624
624
  get: (e) => s.GET("/api/v1/sys/ai/provider/{id}", { params: { path: { id: e } } }).then((t) => a(t)),
625
625
  /** 厂商预置清单(协议/BaseUrl/鉴权方式/起步模型),新增抽屉选预设用。 */
626
626
  presets: () => s.GET("/api/v1/sys/ai/provider/presets", {}).then((e) => a(e)),
@@ -674,7 +674,21 @@ const B = {
674
674
  Success: e.success
675
675
  }
676
676
  }
677
- }).then((t) => d(t))
677
+ }).then((t) => p(t))
678
+ }, te = {
679
+ page: (e) => s.GET("/api/v1/sys/tenant/page", {
680
+ params: {
681
+ query: {
682
+ ...r(e),
683
+ Name: e.name,
684
+ SortField: e.sortField,
685
+ SortOrder: e.sortOrder
686
+ }
687
+ }
688
+ }).then((t) => p(t)),
689
+ add: (e) => s.POST("/api/v1/sys/tenant/add", { body: e }).then((t) => a(t)),
690
+ update: (e, t) => s.PUT("/api/v1/sys/tenant/{id}", { params: { path: { id: e } }, body: t }).then((i) => a(i)),
691
+ remove: (e) => s.DELETE("/api/v1/sys/tenant/{id}", { params: { path: { id: e } } }).then((t) => a(t))
678
692
  };
679
693
  export {
680
694
  u as ApiError,
@@ -684,11 +698,11 @@ export {
684
698
  $ as cacheApi,
685
699
  U as callApi,
686
700
  z as configApi,
687
- D as dashboardApi,
701
+ k as dashboardApi,
688
702
  f as dayRange,
689
703
  V as dictAdminApi,
690
704
  J as dictApi,
691
- k as externalAuthApi,
705
+ D as externalAuthApi,
692
706
  _ as fileApi,
693
707
  q as highSensApi,
694
708
  X as jobApi,
@@ -708,7 +722,8 @@ export {
708
722
  Y as recycleApi,
709
723
  K as roleApi,
710
724
  H as sessionApi,
711
- d as toPage,
725
+ te as tenantApi,
726
+ p as toPage,
712
727
  T as toWireRows,
713
728
  a as unwrap,
714
729
  m as unwrapDownload,