@liujitcn/kratos-admin-system 0.0.49 → 0.0.50

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 (94) hide show
  1. package/README.md +44 -8
  2. package/dist/package/declarations/src/api/system/admin/v1/base_i18n_custom.d.ts +18 -0
  3. package/dist/package/declarations/src/api/system/admin/v1/base_tenant.d.ts +2 -2
  4. package/dist/package/declarations/src/api/system/admin/v1/base_tenant_project.d.ts +23 -0
  5. package/dist/package/declarations/src/api/system/admin/v1/base_tenant_project_grant.d.ts +16 -0
  6. package/dist/package/declarations/src/components/tenant-project/ProjectGrantDialog.vue.d.ts +8 -0
  7. package/dist/package/declarations/src/components/tenant-project/TenantProjectManager.vue.d.ts +29 -0
  8. package/dist/package/declarations/src/components/tenant-project/TenantProjectSelect.vue.d.ts +31 -0
  9. package/dist/package/declarations/src/components/tenant-project/TenantProjectText.vue.d.ts +19 -0
  10. package/dist/package/declarations/src/components/tenant-project/tenant-project-manager-data.d.ts +14 -0
  11. package/dist/package/declarations/src/components/tenant-project/tenant-project-manager.d.ts +40 -0
  12. package/dist/package/declarations/src/index.d.ts +2 -0
  13. package/dist/package/declarations/src/locales/generated.d.ts +172 -0
  14. package/dist/package/declarations/src/rpc/base/v1/config.d.ts +11 -0
  15. package/dist/package/declarations/src/rpc/system/admin/v1/base_i18n_custom.d.ts +105 -0
  16. package/dist/package/declarations/src/rpc/system/admin/v1/base_tenant.d.ts +10 -1
  17. package/dist/package/declarations/src/rpc/system/admin/v1/base_tenant_project.d.ts +141 -0
  18. package/dist/package/declarations/src/rpc/system/admin/v1/base_tenant_project_grant.d.ts +105 -0
  19. package/dist/package/declarations/src/views/ai/chat/components/SessionPanel.vue.d.ts +2 -2
  20. package/dist/package/declarations/src/views/base/i18n-custom/index.vue.d.ts +3 -0
  21. package/dist/package/declarations/src/views/base/project-grant/index.vue.d.ts +3 -0
  22. package/dist/package/declarations/src/views/base/tenant-project/index.vue.d.ts +3 -0
  23. package/dist/package/src/api/system/admin/v1/base_i18n_custom.ts +72 -0
  24. package/dist/package/src/api/system/admin/v1/base_tenant.ts +3 -2
  25. package/dist/package/src/api/system/admin/v1/base_tenant_project.ts +94 -0
  26. package/dist/package/src/api/system/admin/v1/base_tenant_project_grant.ts +63 -0
  27. package/dist/package/src/components/tenant-project/ProjectGrantDialog.vue +108 -0
  28. package/dist/package/src/components/tenant-project/TenantProjectManager.vue +452 -0
  29. package/dist/package/src/components/tenant-project/TenantProjectSelect.vue +83 -0
  30. package/dist/package/src/components/tenant-project/TenantProjectText.vue +37 -0
  31. package/dist/package/src/components/tenant-project/tenant-project-manager-data.ts +26 -0
  32. package/dist/package/src/components/tenant-project/tenant-project-manager.ts +48 -0
  33. package/dist/package/src/index.ts +12 -0
  34. package/dist/package/src/locales/README.md +1 -1
  35. package/dist/package/src/locales/en-US.json +45 -2
  36. package/dist/package/src/locales/ja-JP.json +45 -2
  37. package/dist/package/src/locales/zh-CN.json +45 -2
  38. package/dist/package/src/locales/zh-TW.json +45 -2
  39. package/dist/package/src/module.ts +3 -3
  40. package/dist/package/src/rpc/base/v1/config.ts +12 -0
  41. package/dist/package/src/rpc/system/admin/v1/base_i18n_custom.ts +126 -0
  42. package/dist/package/src/rpc/system/admin/v1/base_tenant.ts +11 -1
  43. package/dist/package/src/rpc/system/admin/v1/base_tenant_project.ts +166 -0
  44. package/dist/package/src/rpc/system/admin/v1/base_tenant_project_grant.ts +128 -0
  45. package/dist/package/src/views/ai/chat/components/XSender.vue +4 -3
  46. package/dist/package/src/views/base/api-log/index.vue +3 -3
  47. package/dist/package/src/views/base/config/index.vue +3 -3
  48. package/dist/package/src/views/base/data-access-log/index.vue +3 -3
  49. package/dist/package/src/views/base/dept/index.vue +10 -45
  50. package/dist/package/src/views/base/dict/index.vue +3 -3
  51. package/dist/package/src/views/base/dict/item.vue +3 -3
  52. package/dist/package/src/views/base/file/index.vue +12 -3
  53. package/dist/package/src/views/base/i18n-custom/index.vue +321 -0
  54. package/dist/package/src/views/base/job/index.vue +3 -3
  55. package/dist/package/src/views/base/login-log/index.vue +13 -4
  56. package/dist/package/src/views/base/login-policy/index.vue +97 -34
  57. package/dist/package/src/views/base/menu/index.vue +3 -3
  58. package/dist/package/src/views/base/message/index.vue +9 -32
  59. package/dist/package/src/views/base/message-category/index.vue +2 -4
  60. package/dist/package/src/views/base/oauth-client/index.vue +8 -42
  61. package/dist/package/src/views/base/online-session/index.vue +8 -27
  62. package/dist/package/src/views/base/operation-log/index.vue +3 -3
  63. package/dist/package/src/views/base/permission-log/index.vue +3 -3
  64. package/dist/package/src/views/base/policy-evaluation-log/index.vue +3 -3
  65. package/dist/package/src/views/base/post/index.vue +9 -42
  66. package/dist/package/src/views/base/project-grant/index.vue +336 -0
  67. package/dist/package/src/views/base/role/index.vue +13 -47
  68. package/dist/package/src/views/base/tenant/index.vue +163 -19
  69. package/dist/package/src/views/base/tenant-project/index.vue +12 -0
  70. package/dist/package/src/views/base/user/index.vue +30 -51
  71. package/dist/package/src/views/profile/components/login-log.vue +15 -2
  72. package/dist/package/src/views/profile/components/password.vue +1 -1
  73. package/dist/package/src/views/profile/components/security.vue +2 -2
  74. package/dist/package/src/views/tool/code-gen/components/CodeGenLocaleEditor.vue +2 -2
  75. package/dist/package/src/views/tool/code-gen/config.ts +2 -1
  76. package/package.json +2 -2
  77. /package/dist/package/declarations/src/components/{ChangePasswordForm.vue.d.ts → account/ChangePasswordForm.vue.d.ts} +0 -0
  78. /package/dist/package/declarations/src/components/{ForcedPasswordDialog.vue.d.ts → account/ForcedPasswordDialog.vue.d.ts} +0 -0
  79. /package/dist/package/declarations/src/components/{Ai.vue.d.ts → ai/Ai.vue.d.ts} +0 -0
  80. /package/dist/package/declarations/src/components/{DynamicI18nCell.vue.d.ts → i18n/DynamicI18nCell.vue.d.ts} +0 -0
  81. /package/dist/package/declarations/src/components/{DynamicI18nEditor.vue.d.ts → i18n/DynamicI18nEditor.vue.d.ts} +0 -0
  82. /package/dist/package/declarations/src/components/{dynamicI18n.d.ts → i18n/dynamicI18n.d.ts} +0 -0
  83. /package/dist/package/declarations/src/components/{LogTable.vue.d.ts → log/LogTable.vue.d.ts} +0 -0
  84. /package/dist/package/declarations/src/components/{log.d.ts → log/log.d.ts} +0 -0
  85. /package/dist/package/declarations/src/components/{Notification.vue.d.ts → notification/Notification.vue.d.ts} +0 -0
  86. /package/dist/package/src/components/{ChangePasswordForm.vue → account/ChangePasswordForm.vue} +0 -0
  87. /package/dist/package/src/components/{ForcedPasswordDialog.vue → account/ForcedPasswordDialog.vue} +0 -0
  88. /package/dist/package/src/components/{Ai.vue → ai/Ai.vue} +0 -0
  89. /package/dist/package/src/components/{DynamicI18nCell.vue → i18n/DynamicI18nCell.vue} +0 -0
  90. /package/dist/package/src/components/{DynamicI18nEditor.vue → i18n/DynamicI18nEditor.vue} +0 -0
  91. /package/dist/package/src/components/{dynamicI18n.ts → i18n/dynamicI18n.ts} +0 -0
  92. /package/dist/package/src/components/{LogTable.vue → log/LogTable.vue} +0 -0
  93. /package/dist/package/src/components/{log.ts → log/log.ts} +0 -0
  94. /package/dist/package/src/components/{Notification.vue → notification/Notification.vue} +0 -0
@@ -0,0 +1,166 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.11.8
4
+ // protoc unknown
5
+ // source: system/admin/v1/base_tenant_project.proto
6
+
7
+ /* eslint-disable */
8
+ import type { SelectOptionResponse } from "../../../common/v1/common";
9
+ import type { Status } from "../../../common/v1/enum";
10
+ import type { Empty } from "../../../google/protobuf/empty";
11
+
12
+ /** 项目选项查询条件 */
13
+ export interface OptionBaseTenantProjectRequest {
14
+ /** 租户ID */
15
+ tenant_id?: number | undefined;
16
+ }
17
+
18
+ /** 项目树查询条件 */
19
+ export interface TreeBaseTenantProjectRequest {
20
+ /** 项目编号或名称关键字 */
21
+ keyword: string;
22
+ }
23
+
24
+ /** 项目树响应 */
25
+ export interface TreeBaseTenantProjectResponse {
26
+ /** 租户项目树 */
27
+ list: TreeBaseTenantProjectResponse_Option[];
28
+ }
29
+
30
+ /** 项目树节点 */
31
+ export interface TreeBaseTenantProjectResponse_Option {
32
+ /** 节点值 */
33
+ value: string;
34
+ /** 节点名称 */
35
+ label: string;
36
+ /** 节点类型 */
37
+ type: string;
38
+ /** 租户ID */
39
+ tenant_id: number;
40
+ /** 项目ID */
41
+ project_id: number;
42
+ /** 是否禁用 */
43
+ disabled: boolean;
44
+ /** 子节点 */
45
+ children: TreeBaseTenantProjectResponse_Option[];
46
+ }
47
+
48
+ /** 项目分页查询条件 */
49
+ export interface PageBaseTenantProjectRequest {
50
+ /** 项目名称 */
51
+ name: string;
52
+ /** 项目编号 */
53
+ code: string;
54
+ /** 租户ID */
55
+ tenant_id?:
56
+ | number
57
+ | undefined;
58
+ /** 状态 */
59
+ status?:
60
+ | Status
61
+ | undefined;
62
+ /** 当前页码 */
63
+ page_num: number;
64
+ /** 每一页的行数 */
65
+ page_size: number;
66
+ }
67
+
68
+ /** 项目分页响应 */
69
+ export interface PageBaseTenantProjectResponse {
70
+ /** 分页数据 */
71
+ base_tenant_projects: BaseTenantProject[];
72
+ /** 总数 */
73
+ total: number;
74
+ }
75
+
76
+ /** 查询项目请求参数 */
77
+ export interface GetBaseTenantProjectRequest {
78
+ /** 项目ID */
79
+ id: number;
80
+ }
81
+
82
+ /** 项目表单 */
83
+ export interface BaseTenantProjectForm {
84
+ /** 项目ID */
85
+ id: number;
86
+ /** 租户ID */
87
+ tenant_id: number;
88
+ /** 项目编号 */
89
+ code: string;
90
+ /** 项目名称 */
91
+ name: string;
92
+ /** 状态 */
93
+ status: Status;
94
+ /** 显示顺序 */
95
+ sort: number;
96
+ /** 备注 */
97
+ remark: string;
98
+ }
99
+
100
+ /** 创建项目请求参数 */
101
+ export interface CreateBaseTenantProjectRequest {
102
+ /** 项目表单 */
103
+ base_tenant_project: BaseTenantProjectForm | undefined;
104
+ }
105
+
106
+ /** 更新项目请求参数 */
107
+ export interface UpdateBaseTenantProjectRequest {
108
+ /** 项目表单 */
109
+ base_tenant_project: BaseTenantProjectForm | undefined;
110
+ }
111
+
112
+ /** 删除项目请求参数 */
113
+ export interface DeleteBaseTenantProjectRequest {
114
+ /** 项目ID列表 */
115
+ id: string;
116
+ }
117
+
118
+ /** 设置项目状态请求参数 */
119
+ export interface SetBaseTenantProjectStatusRequest {
120
+ /** 项目ID */
121
+ id: number;
122
+ /** 状态 */
123
+ status: number;
124
+ }
125
+
126
+ /** 项目 */
127
+ export interface BaseTenantProject {
128
+ /** 项目ID */
129
+ id: number;
130
+ /** 租户ID */
131
+ tenant_id: number;
132
+ /** 项目编号 */
133
+ code: string;
134
+ /** 项目名称 */
135
+ name: string;
136
+ /** 状态 */
137
+ status: Status;
138
+ /** 显示顺序 */
139
+ sort: number;
140
+ /** 备注 */
141
+ remark: string;
142
+ /** 创建时间 */
143
+ created_at: string;
144
+ /** 更新时间 */
145
+ updated_at: string;
146
+ }
147
+
148
+ /** Admin项目管理服务 */
149
+ export interface BaseTenantProjectService {
150
+ /** 查询项目下拉选择 */
151
+ OptionBaseTenantProject(request: OptionBaseTenantProjectRequest): Promise<SelectOptionResponse>;
152
+ /** 查询当前账号可用的租户项目树 */
153
+ TreeBaseTenantProject(request: TreeBaseTenantProjectRequest): Promise<TreeBaseTenantProjectResponse>;
154
+ /** 查询项目分页列表 */
155
+ PageBaseTenantProject(request: PageBaseTenantProjectRequest): Promise<PageBaseTenantProjectResponse>;
156
+ /** 查询项目 */
157
+ GetBaseTenantProject(request: GetBaseTenantProjectRequest): Promise<BaseTenantProjectForm>;
158
+ /** 创建项目 */
159
+ CreateBaseTenantProject(request: CreateBaseTenantProjectRequest): Promise<Empty>;
160
+ /** 更新项目 */
161
+ UpdateBaseTenantProject(request: UpdateBaseTenantProjectRequest): Promise<Empty>;
162
+ /** 删除项目 */
163
+ DeleteBaseTenantProject(request: DeleteBaseTenantProjectRequest): Promise<Empty>;
164
+ /** 设置项目状态 */
165
+ SetBaseTenantProjectStatus(request: SetBaseTenantProjectStatusRequest): Promise<Empty>;
166
+ }
@@ -0,0 +1,128 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.11.8
4
+ // protoc unknown
5
+ // source: system/admin/v1/base_tenant_project_grant.proto
6
+
7
+ /* eslint-disable */
8
+ import type { Empty } from "../../../google/protobuf/empty";
9
+
10
+ /** BaseTenantProjectGrantSubjectType 项目授权主体类型。 */
11
+ export enum BaseTenantProjectGrantSubjectType {
12
+ /** BASE_TENANT_PROJECT_GRANT_SUBJECT_TYPE_UNSPECIFIED - 未指定 */
13
+ BASE_TENANT_PROJECT_GRANT_SUBJECT_TYPE_UNSPECIFIED = 0,
14
+ /** BASE_TENANT_PROJECT_GRANT_SUBJECT_TYPE_POST - 岗位 */
15
+ BASE_TENANT_PROJECT_GRANT_SUBJECT_TYPE_POST = 1,
16
+ /** BASE_TENANT_PROJECT_GRANT_SUBJECT_TYPE_ROLE - 角色 */
17
+ BASE_TENANT_PROJECT_GRANT_SUBJECT_TYPE_ROLE = 2,
18
+ /** BASE_TENANT_PROJECT_GRANT_SUBJECT_TYPE_DEPT - 部门 */
19
+ BASE_TENANT_PROJECT_GRANT_SUBJECT_TYPE_DEPT = 3,
20
+ /** BASE_TENANT_PROJECT_GRANT_SUBJECT_TYPE_USER - 用户 */
21
+ BASE_TENANT_PROJECT_GRANT_SUBJECT_TYPE_USER = 4,
22
+ }
23
+
24
+ /** 项目授权主体和目标租户查询条件。 */
25
+ export interface BaseTenantProjectGrantKey {
26
+ /** 授权目标租户ID */
27
+ tenant_id: number;
28
+ /** 授权主体类型 */
29
+ subject_type: BaseTenantProjectGrantSubjectType;
30
+ /** 授权主体ID */
31
+ subject_id: number;
32
+ }
33
+
34
+ /** 项目授权记录,project_id 为 [0] 时表示目标租户全部项目,空数组表示无权限。 */
35
+ export interface BaseTenantProjectGrant {
36
+ /** 授权目标租户ID */
37
+ tenant_id: number;
38
+ /** 授权主体类型 */
39
+ subject_type: BaseTenantProjectGrantSubjectType;
40
+ /** 授权主体ID */
41
+ subject_id: number;
42
+ /** 项目主键ID数字数组,[0]全部,[]无权限 */
43
+ project_id: number[];
44
+ /** 租户名称 */
45
+ tenant_name: string;
46
+ /** 授权主体名称 */
47
+ subject_name: string;
48
+ /** 授权主体编码 */
49
+ subject_code: string;
50
+ /** 授权项目名称列表 */
51
+ project_names: string[];
52
+ /** 项目授权联合主键展示值 */
53
+ grant_key: string;
54
+ }
55
+
56
+ /** 项目授权分页查询条件。 */
57
+ export interface PageBaseTenantProjectGrantRequest {
58
+ /** 授权目标租户ID */
59
+ tenant_id?:
60
+ | number
61
+ | undefined;
62
+ /** 授权主体类型 */
63
+ subject_type?:
64
+ | BaseTenantProjectGrantSubjectType
65
+ | undefined;
66
+ /** 授权主体ID */
67
+ subject_id?:
68
+ | number
69
+ | undefined;
70
+ /** 当前页码 */
71
+ page_num: number;
72
+ /** 每一页的行数 */
73
+ page_size: number;
74
+ }
75
+
76
+ /** 项目授权分页响应。 */
77
+ export interface PageBaseTenantProjectGrantResponse {
78
+ /** 项目授权列表 */
79
+ grants: BaseTenantProjectGrant[];
80
+ /** 总数 */
81
+ total: number;
82
+ }
83
+
84
+ /** 查询项目授权请求参数。 */
85
+ export interface GetBaseTenantProjectGrantRequest {
86
+ /** 授权目标租户ID */
87
+ tenant_id: number;
88
+ /** 授权主体类型 */
89
+ subject_type: BaseTenantProjectGrantSubjectType;
90
+ /** 授权主体ID */
91
+ subject_id: number;
92
+ }
93
+
94
+ /** 创建项目授权请求参数。 */
95
+ export interface CreateBaseTenantProjectGrantRequest {
96
+ /** 项目授权表单 */
97
+ base_tenant_project_grant: BaseTenantProjectGrant | undefined;
98
+ }
99
+
100
+ /** 更新项目授权请求参数。 */
101
+ export interface UpdateBaseTenantProjectGrantRequest {
102
+ /** 项目授权表单 */
103
+ base_tenant_project_grant: BaseTenantProjectGrant | undefined;
104
+ }
105
+
106
+ /** 删除项目授权请求参数。 */
107
+ export interface DeleteBaseTenantProjectGrantRequest {
108
+ /** 授权目标租户ID */
109
+ tenant_id: number;
110
+ /** 授权主体类型 */
111
+ subject_type: BaseTenantProjectGrantSubjectType;
112
+ /** 授权主体ID */
113
+ subject_id: number;
114
+ }
115
+
116
+ /** BaseTenantProjectGrantService 管理岗位、角色、部门和用户在目标租户下的项目授权。 */
117
+ export interface BaseTenantProjectGrantService {
118
+ /** 查询项目授权分页列表。 */
119
+ PageBaseTenantProjectGrant(request: PageBaseTenantProjectGrantRequest): Promise<PageBaseTenantProjectGrantResponse>;
120
+ /** 查询项目授权详情。 */
121
+ GetBaseTenantProjectGrant(request: GetBaseTenantProjectGrantRequest): Promise<BaseTenantProjectGrant>;
122
+ /** 新增项目授权。 */
123
+ CreateBaseTenantProjectGrant(request: CreateBaseTenantProjectGrantRequest): Promise<Empty>;
124
+ /** 更新项目授权,只修改项目范围,授权主体联合键不可变更。 */
125
+ UpdateBaseTenantProjectGrant(request: UpdateBaseTenantProjectGrantRequest): Promise<Empty>;
126
+ /** 删除项目授权。 */
127
+ DeleteBaseTenantProjectGrant(request: DeleteBaseTenantProjectGrantRequest): Promise<Empty>;
128
+ }
@@ -406,14 +406,15 @@ watch(
406
406
  }
407
407
  .agent-sender {
408
408
  :deep(.elx-x-sender) {
409
+ background: var(--admin-page-card-bg);
409
410
  border-radius: var(--admin-page-radius);
410
411
  box-shadow: none;
411
412
  }
412
413
  :deep(.elx-x-sender__content) {
413
414
  padding: 8px 10px 10px;
414
- background: var(--admin-page-card-bg);
415
- border: 1px solid var(--admin-page-card-border);
416
- border-radius: var(--admin-page-radius);
415
+ background: transparent;
416
+ border: 0;
417
+ border-radius: inherit;
417
418
  }
418
419
  :deep(.elx-x-sender__content--variant-updown) {
419
420
  gap: 10px;
@@ -6,9 +6,9 @@
6
6
  import { computed, ref } from "vue";
7
7
  import type { ColumnProps } from "@liujitcn/kratos-admin-core/components/ProTable/interface";
8
8
  import { t } from "@liujitcn/kratos-admin-core";
9
- import { formatLogDateTime } from "@liujitcn/kratos-admin-system/components/log";
9
+ import { formatLogDateTime } from "@liujitcn/kratos-admin-system/components/log/log";
10
10
  import { buildPageRequest } from "@liujitcn/kratos-admin-core/table";
11
- import LogTable, { type LogTableConfig } from "@liujitcn/kratos-admin-system/components/LogTable.vue";
11
+ import LogTable, { type LogTableConfig } from "@liujitcn/kratos-admin-system/components/log/LogTable.vue";
12
12
  import {
13
13
  createLogEnumOptions,
14
14
  formatLogBytes,
@@ -18,7 +18,7 @@ import {
18
18
  logDetailColumn,
19
19
  logEnumLabel,
20
20
  requestLogTrace
21
- } from "@liujitcn/kratos-admin-system/components/log";
21
+ } from "@liujitcn/kratos-admin-system/components/log/log";
22
22
  import { defBaseApiLogService } from "@liujitcn/kratos-admin-system/api/system/admin/v1/base_api_log";
23
23
  import { BaseLogResult } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_log";
24
24
  import type { BaseApiLog, PageBaseApiLogRequest } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_api_log";
@@ -137,13 +137,13 @@ import { BaseConfigType } from "@liujitcn/kratos-admin-system/rpc/system/admin/v
137
137
  import { I18nTargetType } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_i18n";
138
138
  import { buildPageRequest, normalizeSelectedIds } from "@liujitcn/kratos-admin-core/table";
139
139
  import { t } from "@liujitcn/kratos-admin-core";
140
- import DynamicI18nEditor from "@liujitcn/kratos-admin-system/components/DynamicI18nEditor.vue";
141
- import DynamicI18nCell from "@liujitcn/kratos-admin-system/components/DynamicI18nCell.vue";
140
+ import DynamicI18nEditor from "@liujitcn/kratos-admin-system/components/i18n/DynamicI18nEditor.vue";
141
+ import DynamicI18nCell from "@liujitcn/kratos-admin-system/components/i18n/DynamicI18nCell.vue";
142
142
  import {
143
143
  getEditableLanguageOptions,
144
144
  serializeDynamicI18ns,
145
145
  type DynamicI18nValue
146
- } from "@liujitcn/kratos-admin-system/components/dynamicI18n";
146
+ } from "@liujitcn/kratos-admin-system/components/i18n/dynamicI18n";
147
147
 
148
148
  /** 系统配置编辑表单状态,新增时枚举字段保持为空,避免把未知值 0 显示为下拉文本。 */
149
149
  type BaseConfigFormState = Omit<BaseConfigForm, "site" | "type"> & {
@@ -6,9 +6,9 @@
6
6
  import { computed, ref } from "vue";
7
7
  import type { ColumnProps } from "@liujitcn/kratos-admin-core/components/ProTable/interface";
8
8
  import { t } from "@liujitcn/kratos-admin-core";
9
- import { formatLogDateTime } from "@liujitcn/kratos-admin-system/components/log";
9
+ import { formatLogDateTime } from "@liujitcn/kratos-admin-system/components/log/log";
10
10
  import { buildPageRequest } from "@liujitcn/kratos-admin-core/table";
11
- import LogTable, { type LogTableConfig } from "@liujitcn/kratos-admin-system/components/LogTable.vue";
11
+ import LogTable, { type LogTableConfig } from "@liujitcn/kratos-admin-system/components/log/LogTable.vue";
12
12
  import {
13
13
  createLogEnumOptions,
14
14
  formatLogCount,
@@ -17,7 +17,7 @@ import {
17
17
  logDetailColumn,
18
18
  logEnumLabel,
19
19
  requestLogTrace
20
- } from "@liujitcn/kratos-admin-system/components/log";
20
+ } from "@liujitcn/kratos-admin-system/components/log/log";
21
21
  import { defBaseDataAccessLogService } from "@liujitcn/kratos-admin-system/api/system/admin/v1/base_data_access_log";
22
22
  import { BaseLogResult } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_log";
23
23
  import { BaseDataAccessType } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_data_access_log";
@@ -28,7 +28,7 @@
28
28
  </template>
29
29
 
30
30
  <script setup lang="ts">
31
- import { computed, reactive, ref } from "vue";
31
+ import { computed, onMounted, reactive, ref } from "vue";
32
32
  import { ElMessage, ElMessageBox } from "element-plus";
33
33
  import { CirclePlus, Delete, EditPen } from "@element-plus/icons-vue";
34
34
  import type { ColumnProps, HeaderActionProps, ProTableInstance } from "@liujitcn/kratos-admin-core/components/ProTable/interface";
@@ -37,13 +37,11 @@ import FormDialog from "@liujitcn/kratos-admin-core/components/Dialog/FormDialog
37
37
  import type { ProFormField, ProFormOption } from "@liujitcn/kratos-admin-core/components/ProForm/interface";
38
38
  import { useAuthButtons } from "@liujitcn/kratos-admin-core/auth";
39
39
  import { defBaseDeptService } from "@liujitcn/kratos-admin-system/api/system/admin/v1/base_dept";
40
- import { defBaseTenantService } from "@liujitcn/kratos-admin-system/api/system/admin/v1/base_tenant";
41
- import { useUserStore } from "@liujitcn/kratos-admin-core/stores/runtime";
42
40
  import type { BaseDept, BaseDeptForm } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_dept";
43
- import type { SelectOptionResponse_Option, TreeOptionResponse_Option } from "@liujitcn/kratos-admin-system/rpc/common/v1/common";
41
+ import type { TreeOptionResponse_Option } from "@liujitcn/kratos-admin-system/rpc/common/v1/common";
44
42
  import { Status } from "@liujitcn/kratos-admin-system/rpc/common/v1/enum";
45
43
  import { normalizeSelectedIds } from "@liujitcn/kratos-admin-core/table";
46
- import { DEFAULT_TENANT_CODE, requestTenantOptions } from "@liujitcn/kratos-admin-core/tenant";
44
+ import { useTenantScope } from "@liujitcn/kratos-admin-core/tenant";
47
45
  import { t } from "@liujitcn/kratos-admin-core";
48
46
 
49
47
  defineOptions({
@@ -58,7 +56,6 @@ type BaseDeptFormState = Omit<BaseDeptForm, "tenant_id"> & {
58
56
  };
59
57
 
60
58
  const { BUTTONS } = useAuthButtons();
61
- const userStore = useUserStore();
62
59
  const proTable = ref<ProTableInstance>();
63
60
  const formDialogRef = ref<InstanceType<typeof FormDialog>>();
64
61
 
@@ -68,7 +65,6 @@ const dialog = reactive({
68
65
  });
69
66
 
70
67
  const deptOptions = ref<TreeOptionResponse_Option[]>([]);
71
- const tenantOptions = ref<SelectOptionResponse_Option[]>([]);
72
68
  const currentTenantId = ref<number | undefined>();
73
69
  const statusOptions = computed<ProFormOption[]>(() => [
74
70
  { label: t("common.status.enabled"), value: Status.STATUS_ENABLE },
@@ -129,24 +125,14 @@ const rules = computed(() => ({
129
125
  ]
130
126
  }));
131
127
 
132
- /** 当前登录账号是否默认租户。 */
133
- const isDefaultTenant = computed(() => userStore.userInfo.tenant_code === DEFAULT_TENANT_CODE);
128
+ const { isDefaultTenant, tenantColumns, tenantFormField, toRequestTenantId, loadTenantOptions } = useTenantScope();
129
+ onMounted(() => {
130
+ if (isDefaultTenant.value) void loadTenantOptions();
131
+ });
134
132
 
135
133
  /** 部门表单字段配置。 */
136
134
  const formFields = computed<ProFormField[]>(() => [
137
- {
138
- prop: "tenant_id",
139
- label: t("common.field.tenant"),
140
- component: "select",
141
- props: {
142
- placeholder: t("common.placeholder.select"),
143
- filterable: true,
144
- disabled: Boolean(formData.id),
145
- onChange: handleFormTenantChange
146
- },
147
- visible: () => isDefaultTenant.value,
148
- options: tenantOptions.value
149
- },
135
+ tenantFormField({ label: t("common.field.tenant"), disabledOnEdit: true, props: { onChange: handleFormTenantChange } }),
150
136
  {
151
137
  prop: "parent_id",
152
138
  label: t("system.base.dept.field.parent"),
@@ -184,19 +170,7 @@ const formFields = computed<ProFormField[]>(() => [
184
170
  /** 部门树表格列配置。 */
185
171
  const columns = computed<ColumnProps[]>(() => [
186
172
  { type: "selection", width: 55 },
187
- ...(isDefaultTenant.value
188
- ? ([
189
- {
190
- prop: "tenant_id",
191
- label: t("common.field.tenant"),
192
- minWidth: 140,
193
- align: "left",
194
- showOverflowTooltip: true,
195
- search: { el: "select", key: "tenant_id", props: { filterable: true }, order: 1 },
196
- enum: requestTenantOptions
197
- }
198
- ] satisfies ColumnProps[])
199
- : []),
173
+ ...tenantColumns({ label: t("common.field.tenant"), order: 1 }),
200
174
  { prop: "name", label: t("system.base.dept.field.name"), minWidth: 140, align: "right", search: { el: "input" } },
201
175
  { prop: "remark", label: t("common.field.remark"), minWidth: 160, search: { el: "input" } },
202
176
  { prop: "sort", label: t("common.field.sort"), minWidth: 90, align: "right" },
@@ -334,7 +308,7 @@ async function loadDeptOptions() {
334
308
  return;
335
309
  }
336
310
  const optionBaseDeptResponse = await defBaseDeptService.OptionBaseDept({
337
- tenant_id: isDefaultTenant.value ? formData.tenant_id : undefined
311
+ tenant_id: toRequestTenantId(formData.tenant_id)
338
312
  });
339
313
  deptOptions.value = [
340
314
  {
@@ -347,15 +321,6 @@ async function loadDeptOptions() {
347
321
  ];
348
322
  }
349
323
 
350
- /**
351
- * 加载租户下拉选项。
352
- */
353
- async function loadTenantOptions() {
354
- if (!isDefaultTenant.value || tenantOptions.value.length) return;
355
- const response = await defBaseTenantService.OptionBaseTenant({ keyword: "" });
356
- tenantOptions.value = response.list ?? [];
357
- }
358
-
359
324
  /**
360
325
  * 切换表单租户时重新加载对应租户的上级部门树。
361
326
  */
@@ -49,14 +49,14 @@ import { Status } from "@liujitcn/kratos-admin-system/rpc/common/v1/enum";
49
49
  import { I18nTargetType } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_i18n";
50
50
  import { buildPageRequest, normalizeSelectedIds } from "@liujitcn/kratos-admin-core/table";
51
51
  import { t } from "@liujitcn/kratos-admin-core";
52
- import DynamicI18nEditor from "@liujitcn/kratos-admin-system/components/DynamicI18nEditor.vue";
53
- import DynamicI18nCell from "@liujitcn/kratos-admin-system/components/DynamicI18nCell.vue";
52
+ import DynamicI18nEditor from "@liujitcn/kratos-admin-system/components/i18n/DynamicI18nEditor.vue";
53
+ import DynamicI18nCell from "@liujitcn/kratos-admin-system/components/i18n/DynamicI18nCell.vue";
54
54
  import {
55
55
  normalizeDynamicI18ns,
56
56
  serializeDynamicI18ns,
57
57
  type DynamicI18nRecord,
58
58
  type DynamicI18nValue
59
- } from "@liujitcn/kratos-admin-system/components/dynamicI18n";
59
+ } from "@liujitcn/kratos-admin-system/components/i18n/dynamicI18n";
60
60
 
61
61
  defineOptions({
62
62
  name: "BaseDict",
@@ -68,14 +68,14 @@ import { Status } from "@liujitcn/kratos-admin-system/rpc/common/v1/enum";
68
68
  import { I18nTargetType } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_i18n";
69
69
  import { buildPageRequest, normalizeSelectedIds } from "@liujitcn/kratos-admin-core/table";
70
70
  import { t } from "@liujitcn/kratos-admin-core";
71
- import DynamicI18nEditor from "@liujitcn/kratos-admin-system/components/DynamicI18nEditor.vue";
72
- import DynamicI18nCell from "@liujitcn/kratos-admin-system/components/DynamicI18nCell.vue";
71
+ import DynamicI18nEditor from "@liujitcn/kratos-admin-system/components/i18n/DynamicI18nEditor.vue";
72
+ import DynamicI18nCell from "@liujitcn/kratos-admin-system/components/i18n/DynamicI18nCell.vue";
73
73
  import {
74
74
  normalizeDynamicI18ns,
75
75
  serializeDynamicI18ns,
76
76
  type DynamicI18nRecord,
77
77
  type DynamicI18nValue
78
- } from "@liujitcn/kratos-admin-system/components/dynamicI18n";
78
+ } from "@liujitcn/kratos-admin-system/components/i18n/dynamicI18n";
79
79
 
80
80
  defineOptions({
81
81
  name: "BaseDictItem",
@@ -77,13 +77,14 @@
77
77
  </template>
78
78
 
79
79
  <script setup lang="ts">
80
- import { computed, ref } from "vue";
80
+ import { computed, onMounted, ref } from "vue";
81
81
  import { Download, Delete, View } from "@element-plus/icons-vue";
82
82
  import ProTable from "@liujitcn/kratos-admin-core/components/ProTable";
83
83
  import ProDialog from "@liujitcn/kratos-admin-core/components/Dialog/ProDialog.vue";
84
84
  import type { ColumnProps, ProTableInstance } from "@liujitcn/kratos-admin-core/components/ProTable/interface";
85
85
  import { useAuthButtons } from "@liujitcn/kratos-admin-core/auth";
86
86
  import { buildPageRequest } from "@liujitcn/kratos-admin-core/table";
87
+ import { useTenantScope } from "@liujitcn/kratos-admin-core/tenant";
87
88
  import { t } from "@liujitcn/kratos-admin-core";
88
89
  import { defFileService } from "@liujitcn/kratos-admin-core/api/base/v1/file";
89
90
  import { defBaseFileService } from "@liujitcn/kratos-admin-system/api/system/admin/v1/base_file";
@@ -92,6 +93,7 @@ import type { BaseFile, PageBaseFileRequest } from "@liujitcn/kratos-admin-syste
92
93
  defineOptions({ name: "BaseFile", inheritAttrs: false });
93
94
 
94
95
  const { BUTTONS } = useAuthButtons();
96
+ const { isDefaultTenant, tenantColumns, toRequestTenantId, loadTenantOptions } = useTenantScope();
95
97
  const proTable = ref<ProTableInstance>();
96
98
  const detailVisible = ref(false);
97
99
  const detail = ref<BaseFile>();
@@ -106,13 +108,17 @@ type PreviewKind = "image" | "video" | "audio" | "pdf" | "text" | "unsupported";
106
108
 
107
109
  const previewKind = computed<PreviewKind>(() => (detail.value ? getPreviewKind(detail.value) : "unsupported"));
108
110
 
111
+ onMounted(() => {
112
+ if (isDefaultTenant.value) void loadTenantOptions();
113
+ });
114
+
109
115
  const columns = computed<ColumnProps[]>(() => [
110
116
  { prop: "file_name", label: t("system.base.file.field.name"), minWidth: 220, search: { el: "input" } },
111
117
  { prop: "extension", label: t("system.base.file.field.extension"), width: 100, search: { el: "input" } },
112
118
  { prop: "mime_type", label: t("system.base.file.field.mime"), minWidth: 180 },
113
119
  { prop: "size", label: t("system.base.file.field.size"), width: 120, align: "right", render: scope => formatFileSize((scope.row as BaseFile).size) },
114
120
  { prop: "content_hash", label: t("system.base.file.field.hash"), minWidth: 220 },
115
- { prop: "tenant_id", label: t("system.base.file.field.tenant"), width: 100, align: "left" },
121
+ ...tenantColumns({ label: t("system.base.file.field.tenant"), minWidth: 100 }),
116
122
  { prop: "created_at", align: "center", label: t("common.field.created_at"), minWidth: 180 },
117
123
  {
118
124
  prop: "operation",
@@ -141,7 +147,10 @@ const columns = computed<ColumnProps[]>(() => [
141
147
 
142
148
  /** 请求文件资产分页列表。 */
143
149
  async function requestBaseFileTable(params: PageBaseFileRequest) {
144
- const data = await defBaseFileService.PageBaseFile(buildPageRequest(params));
150
+ const data = await defBaseFileService.PageBaseFile({
151
+ ...buildPageRequest(params),
152
+ tenant_id: toRequestTenantId(params.tenant_id)
153
+ });
145
154
  return { data: { list: data.base_files ?? [], total: data.total } };
146
155
  }
147
156