@liujitcn/kratos-admin-system 0.0.29 → 0.0.31
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.
- package/README.md +18 -1
- package/dist/package/declarations/src/api/base/notification.d.ts +24 -0
- package/dist/package/declarations/src/api/system/base_audit_log.d.ts +55 -0
- package/dist/package/declarations/src/api/system/base_dashboard.d.ts +14 -0
- package/dist/package/declarations/src/api/system/base_file.d.ts +13 -0
- package/dist/package/declarations/src/api/system/base_login_policy.d.ts +10 -0
- package/dist/package/declarations/src/api/system/base_message.d.ts +24 -0
- package/dist/package/declarations/src/api/system/base_message_category.d.ts +21 -0
- package/dist/package/declarations/src/api/system/base_session.d.ts +11 -0
- package/dist/package/declarations/src/api/system/oauth_client.d.ts +24 -0
- package/dist/package/declarations/src/components/AuditLogTable.vue.d.ts +45 -0
- package/dist/package/declarations/src/components/auditLog.d.ts +9 -0
- package/dist/package/declarations/src/locales/generated.d.ts +1312 -16
- package/dist/package/declarations/src/rpc/base/v1/login.d.ts +149 -0
- package/dist/package/declarations/src/rpc/base/v1/notification.d.ts +281 -0
- package/dist/package/declarations/src/rpc/base/v1/oauth.d.ts +25 -0
- package/dist/package/declarations/src/rpc/base/v1/oauth_client.d.ts +23 -0
- package/dist/package/declarations/src/rpc/system/admin/v1/base_audit_log.d.ts +640 -0
- package/dist/package/declarations/src/rpc/system/admin/v1/base_dashboard.d.ts +60 -0
- package/dist/package/declarations/src/rpc/system/admin/v1/base_file.d.ts +73 -0
- package/dist/package/declarations/src/rpc/system/admin/v1/base_i18n.d.ts +10 -6
- package/dist/package/declarations/src/rpc/system/admin/v1/base_job.d.ts +5 -0
- package/dist/package/declarations/src/rpc/system/admin/v1/base_login_policy.d.ts +51 -0
- package/dist/package/declarations/src/rpc/system/admin/v1/base_message.d.ts +193 -0
- package/dist/package/declarations/src/rpc/system/admin/v1/base_message_category.d.ts +125 -0
- package/dist/package/declarations/src/rpc/system/admin/v1/base_session.d.ts +33 -0
- package/dist/package/declarations/src/rpc/system/admin/v1/base_user.d.ts +3 -3
- package/dist/package/declarations/src/rpc/system/admin/v1/oauth_client.d.ts +145 -0
- package/dist/package/declarations/src/views/base/api-log/index.vue.d.ts +3 -0
- package/dist/package/declarations/src/views/base/dashboard/index.vue.d.ts +3 -0
- package/dist/package/declarations/src/views/base/data-access-log/index.vue.d.ts +3 -0
- package/dist/package/declarations/src/views/base/file/index.vue.d.ts +3 -0
- package/dist/package/declarations/src/views/base/login-log/index.vue.d.ts +3 -0
- package/dist/package/declarations/src/views/base/login-policy/index.vue.d.ts +3 -0
- package/dist/package/declarations/src/views/base/message/index.vue.d.ts +3 -0
- package/dist/package/declarations/src/views/base/message-category/index.vue.d.ts +3 -0
- package/dist/package/declarations/src/views/base/oauth-client/index.vue.d.ts +3 -0
- package/dist/package/declarations/src/views/base/operation-log/index.vue.d.ts +3 -0
- package/dist/package/declarations/src/views/base/permission-log/index.vue.d.ts +3 -0
- package/dist/package/declarations/src/views/base/policy-evaluation-log/index.vue.d.ts +3 -0
- package/dist/package/declarations/src/views/message/inbox/index.vue.d.ts +3 -0
- package/dist/package/declarations/src/views/profile/components/session.vue.d.ts +3 -0
- package/dist/package/src/api/base/notification.ts +69 -0
- package/dist/package/src/api/base/sse.ts +4 -4
- package/dist/package/src/api/system/auth.ts +1 -0
- package/dist/package/src/api/system/base_audit_log.ts +168 -0
- package/dist/package/src/api/system/base_dashboard.ts +55 -0
- package/dist/package/src/api/system/base_file.ts +43 -0
- package/dist/package/src/api/system/base_login_policy.ts +32 -0
- package/dist/package/src/api/system/base_message.ts +70 -0
- package/dist/package/src/api/system/base_message_category.ts +57 -0
- package/dist/package/src/api/system/base_session.ts +33 -0
- package/dist/package/src/api/system/oauth_client.ts +102 -0
- package/dist/package/src/components/AuditLogTable.vue +105 -0
- package/dist/package/src/components/Notification.vue +196 -0
- package/dist/package/src/components/auditLog.ts +46 -0
- package/dist/package/src/locales/README.md +4 -2
- package/dist/package/src/locales/en-US.json +334 -10
- package/dist/package/src/locales/ja-JP.json +338 -14
- package/dist/package/src/locales/zh-CN.json +334 -10
- package/dist/package/src/locales/zh-TW.json +337 -13
- package/dist/package/src/module.ts +5 -2
- package/dist/package/src/rpc/base/v1/login.ts +172 -0
- package/dist/package/src/rpc/base/v1/notification.ts +315 -0
- package/dist/package/src/rpc/base/v1/oauth.ts +25 -0
- package/dist/package/src/rpc/base/v1/oauth_client.ts +33 -0
- package/dist/package/src/rpc/system/admin/v1/base_audit_log.ts +737 -0
- package/dist/package/src/rpc/system/admin/v1/base_dashboard.ts +81 -0
- package/dist/package/src/rpc/system/admin/v1/base_file.ts +88 -0
- package/dist/package/src/rpc/system/admin/v1/base_i18n.ts +10 -6
- package/dist/package/src/rpc/system/admin/v1/base_job.ts +5 -0
- package/dist/package/src/rpc/system/admin/v1/base_login_policy.ts +63 -0
- package/dist/package/src/rpc/system/admin/v1/base_message.ts +236 -0
- package/dist/package/src/rpc/system/admin/v1/base_message_category.ts +149 -0
- package/dist/package/src/rpc/system/admin/v1/base_session.ts +44 -0
- package/dist/package/src/rpc/system/admin/v1/base_user.ts +3 -3
- package/dist/package/src/rpc/system/admin/v1/oauth_client.ts +174 -0
- package/dist/package/src/views/ai/chat/components/ChatPanel.vue +2 -2
- package/dist/package/src/views/ai/chat/message.ts +7 -3
- package/dist/package/src/views/base/api-log/index.vue +83 -0
- package/dist/package/src/views/base/config/index.vue +3 -3
- package/dist/package/src/views/base/dashboard/index.vue +200 -0
- package/dist/package/src/views/base/data-access-log/index.vue +84 -0
- package/dist/package/src/views/base/dict/index.vue +2 -2
- package/dist/package/src/views/base/dict/item.vue +2 -2
- package/dist/package/src/views/base/file/index.vue +119 -0
- package/dist/package/src/views/base/job/index.vue +62 -7
- package/dist/package/src/views/base/language/index.vue +2 -1
- package/dist/package/src/views/base/login-log/index.vue +92 -0
- package/dist/package/src/views/base/login-policy/index.vue +219 -0
- package/dist/package/src/views/base/menu/index.vue +2 -2
- package/dist/package/src/views/base/message/index.vue +582 -0
- package/dist/package/src/views/base/message-category/index.vue +356 -0
- package/dist/package/src/views/base/oauth-client/index.vue +411 -0
- package/dist/package/src/views/base/operation-log/index.vue +82 -0
- package/dist/package/src/views/base/permission-log/index.vue +85 -0
- package/dist/package/src/views/base/policy-evaluation-log/index.vue +82 -0
- package/dist/package/src/views/message/inbox/index.vue +249 -0
- package/dist/package/src/views/profile/components/base.vue +6 -5
- package/dist/package/src/views/profile/components/password.vue +2 -2
- package/dist/package/src/views/profile/components/security.vue +475 -62
- package/dist/package/src/views/profile/components/session.vue +153 -0
- package/dist/package/src/views/profile/index.vue +35 -22
- package/dist/package/src/views/tool/code-gen/config.ts +1 -0
- package/dist/package/src/views/tool/ops-monitoring/index.vue +25 -21
- package/package.json +2 -2
- package/dist/package/declarations/src/api/system/base_log.d.ts +0 -9
- package/dist/package/declarations/src/rpc/system/admin/v1/base_log.d.ts +0 -87
- package/dist/package/src/api/system/base_log.ts +0 -32
- package/dist/package/src/rpc/system/admin/v1/base_log.ts +0 -101
- package/dist/package/src/views/base/log/index.vue +0 -339
- /package/dist/package/declarations/src/{views/base/log/index.vue.d.ts → components/Notification.vue.d.ts} +0 -0
|
@@ -0,0 +1,44 @@
|
|
|
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_session.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import type { Empty } from "../../../google/protobuf/empty";
|
|
9
|
+
|
|
10
|
+
/** 查询当前会话请求参数。 */
|
|
11
|
+
export interface GetCurrentBaseSessionRequest {
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** 撤销全部会话请求参数。 */
|
|
15
|
+
export interface RevokeAllBaseSessionsRequest {
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** 当前会话信息。 */
|
|
19
|
+
export interface BaseSession {
|
|
20
|
+
/** 用户ID */
|
|
21
|
+
user_id: number;
|
|
22
|
+
/** 用户账号 */
|
|
23
|
+
user_name: string;
|
|
24
|
+
/** 租户编码 */
|
|
25
|
+
tenant_code: string;
|
|
26
|
+
/** 客户端IP */
|
|
27
|
+
client_ip: string;
|
|
28
|
+
/** 登录设备 */
|
|
29
|
+
device: string;
|
|
30
|
+
/** 用户代理 */
|
|
31
|
+
user_agent: string;
|
|
32
|
+
/** 签发时间 */
|
|
33
|
+
issued_at: string;
|
|
34
|
+
/** 令牌有效期(秒) */
|
|
35
|
+
expires_in: number;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** Admin会话管理服务。 */
|
|
39
|
+
export interface BaseSessionService {
|
|
40
|
+
/** 查询当前用户会话。 */
|
|
41
|
+
GetCurrentBaseSession(request: GetCurrentBaseSessionRequest): Promise<BaseSession>;
|
|
42
|
+
/** 撤销当前用户全部会话。 */
|
|
43
|
+
RevokeAllBaseSessions(request: RevokeAllBaseSessionsRequest): Promise<Empty>;
|
|
44
|
+
}
|
|
@@ -224,13 +224,13 @@ export interface SummaryBaseUserRequest {
|
|
|
224
224
|
export interface SummaryBaseUserResponse {
|
|
225
225
|
/** 用户总数 */
|
|
226
226
|
total: number;
|
|
227
|
-
/**
|
|
227
|
+
/** 用户注册时间维度汇总 */
|
|
228
228
|
summaries: BaseUserSummaryItem[];
|
|
229
229
|
}
|
|
230
230
|
|
|
231
|
-
/**
|
|
231
|
+
/** 用户注册时间维度汇总项 */
|
|
232
232
|
export interface BaseUserSummaryItem {
|
|
233
|
-
/**
|
|
233
|
+
/** 统计周期值:按周统计时1至7依次表示星期一至星期日,按月统计时表示日期1至31,按年统计时表示月份1至12 */
|
|
234
234
|
key: number;
|
|
235
235
|
/** 用户数 */
|
|
236
236
|
count: number;
|
|
@@ -0,0 +1,174 @@
|
|
|
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/oauth_client.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import type { Status } from "../../../common/v1/enum";
|
|
9
|
+
import type { Empty } from "../../../google/protobuf/empty";
|
|
10
|
+
import type { BaseApi } from "./base_api";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* OauthClientCryptoType 定义开放授权客户端请求和响应使用的加密算法。
|
|
14
|
+
* 生产环境仅允许具备完整性保护的 AES-GCM 或 SM4-GCM,历史 3DES 值已禁用。
|
|
15
|
+
*/
|
|
16
|
+
export enum OauthClientCryptoType {
|
|
17
|
+
OAUTH_CLIENT_CRYPTO_TYPE_UNSPECIFIED = 0,
|
|
18
|
+
OAUTH_CLIENT_CRYPTO_TYPE_SM4 = 1,
|
|
19
|
+
OAUTH_CLIENT_CRYPTO_TYPE_AES = 2,
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** 可授权 API 选项查询条件。 */
|
|
23
|
+
export interface OptionOauthClientApiRequest {
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** 可授权 API 选项响应。 */
|
|
27
|
+
export interface OptionOauthClientApiResponse {
|
|
28
|
+
/** 可授权的开发接口列表 */
|
|
29
|
+
base_apis: BaseApi[];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** 开放授权客户端分页查询条件。 */
|
|
33
|
+
export interface PageOauthClientRequest {
|
|
34
|
+
/** 客户端名称 */
|
|
35
|
+
client_name?:
|
|
36
|
+
| string
|
|
37
|
+
| undefined;
|
|
38
|
+
/** 客户端状态 */
|
|
39
|
+
status?:
|
|
40
|
+
| Status
|
|
41
|
+
| undefined;
|
|
42
|
+
/** 绑定租户ID */
|
|
43
|
+
tenant_id?:
|
|
44
|
+
| number
|
|
45
|
+
| undefined;
|
|
46
|
+
/** 页码 */
|
|
47
|
+
page_num: number;
|
|
48
|
+
/** 每页数量 */
|
|
49
|
+
page_size: number;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** 开放授权客户端分页响应。 */
|
|
53
|
+
export interface PageOauthClientResponse {
|
|
54
|
+
/** 客户端列表 */
|
|
55
|
+
oauth_clients: OauthClient[];
|
|
56
|
+
/** 总数 */
|
|
57
|
+
total: number;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** 开放授权客户端查询条件。 */
|
|
61
|
+
export interface GetOauthClientRequest {
|
|
62
|
+
/** 客户端ID */
|
|
63
|
+
id: number;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** 开放授权客户端凭据查询条件。 */
|
|
67
|
+
export interface GetOauthClientCredentialsRequest {
|
|
68
|
+
/** 客户端ID */
|
|
69
|
+
id: number;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** 开放授权客户端凭据轮换条件。 */
|
|
73
|
+
export interface RotateOauthClientCredentialsRequest {
|
|
74
|
+
/** 客户端ID */
|
|
75
|
+
id: number;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** 创建开放授权客户端请求。 */
|
|
79
|
+
export interface CreateOauthClientRequest {
|
|
80
|
+
/** 客户端表单 */
|
|
81
|
+
oauth_client: OauthClientForm | undefined;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** 更新开放授权客户端请求。 */
|
|
85
|
+
export interface UpdateOauthClientRequest {
|
|
86
|
+
/** 客户端表单 */
|
|
87
|
+
oauth_client: OauthClientForm | undefined;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** 删除开放授权客户端请求。 */
|
|
91
|
+
export interface DeleteOauthClientRequest {
|
|
92
|
+
/** 客户端ID列表 */
|
|
93
|
+
id: string;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** 设置开放授权客户端状态请求。 */
|
|
97
|
+
export interface SetOauthClientStatusRequest {
|
|
98
|
+
/** 客户端ID */
|
|
99
|
+
id: number;
|
|
100
|
+
/** 状态 */
|
|
101
|
+
status: Status;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** 开放授权客户端表单。 */
|
|
105
|
+
export interface OauthClientForm {
|
|
106
|
+
/** 客户端ID */
|
|
107
|
+
id: number;
|
|
108
|
+
/** 绑定租户ID */
|
|
109
|
+
tenant_id: number;
|
|
110
|
+
/** 客户端名称 */
|
|
111
|
+
client_name: string;
|
|
112
|
+
/** 协议加密类型 */
|
|
113
|
+
crypto_type: OauthClientCryptoType;
|
|
114
|
+
/** IP白名单 */
|
|
115
|
+
ip_whitelist: string;
|
|
116
|
+
/** 允许访问的 API operation 列表 */
|
|
117
|
+
api: string[];
|
|
118
|
+
/** 状态 */
|
|
119
|
+
status: Status;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** 开放授权客户端非敏感信息。 */
|
|
123
|
+
export interface OauthClient {
|
|
124
|
+
/** 客户端ID */
|
|
125
|
+
id: number;
|
|
126
|
+
/** 客户端标识 */
|
|
127
|
+
client_id: string;
|
|
128
|
+
/** 客户端名称 */
|
|
129
|
+
client_name: string;
|
|
130
|
+
/** 绑定租户ID */
|
|
131
|
+
tenant_id: number;
|
|
132
|
+
/** 协议加密类型 */
|
|
133
|
+
crypto_type: OauthClientCryptoType;
|
|
134
|
+
/** IP白名单 */
|
|
135
|
+
ip_whitelist: string;
|
|
136
|
+
/** 允许访问的 API operation 列表 */
|
|
137
|
+
api: string[];
|
|
138
|
+
/** 状态 */
|
|
139
|
+
status: Status;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/** 开放授权客户端凭据元数据;敏感密钥字段始终为空,仅保留协议类型和客户端标识。 */
|
|
143
|
+
export interface OauthClientCredentials {
|
|
144
|
+
/** 客户端标识 */
|
|
145
|
+
client_id: string;
|
|
146
|
+
/** 客户端密钥 */
|
|
147
|
+
client_secret: string;
|
|
148
|
+
/** 协议加密类型 */
|
|
149
|
+
crypto_type: OauthClientCryptoType;
|
|
150
|
+
/** 协议加密密钥 */
|
|
151
|
+
crypto_key: string;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/** 开放授权客户端管理服务。 */
|
|
155
|
+
export interface OauthClientService {
|
|
156
|
+
/** 查询可授权的开发接口选项。 */
|
|
157
|
+
OptionOauthClientApi(request: OptionOauthClientApiRequest): Promise<OptionOauthClientApiResponse>;
|
|
158
|
+
/** 分页查询开放授权客户端。 */
|
|
159
|
+
PageOauthClient(request: PageOauthClientRequest): Promise<PageOauthClientResponse>;
|
|
160
|
+
/** 查询开放授权客户端详情。 */
|
|
161
|
+
GetOauthClient(request: GetOauthClientRequest): Promise<OauthClientForm>;
|
|
162
|
+
/** 查询客户端凭据元数据;客户端密钥和协议密钥不会通过接口回传。 */
|
|
163
|
+
GetOauthClientCredentials(request: GetOauthClientCredentialsRequest): Promise<OauthClientCredentials>;
|
|
164
|
+
/** 轮换客户端密钥并一次性返回新凭据。 */
|
|
165
|
+
RotateOauthClientCredentials(request: RotateOauthClientCredentialsRequest): Promise<OauthClientCredentials>;
|
|
166
|
+
/** 创建开放授权客户端。 */
|
|
167
|
+
CreateOauthClient(request: CreateOauthClientRequest): Promise<Empty>;
|
|
168
|
+
/** 更新开放授权客户端。 */
|
|
169
|
+
UpdateOauthClient(request: UpdateOauthClientRequest): Promise<Empty>;
|
|
170
|
+
/** 删除开放授权客户端。 */
|
|
171
|
+
DeleteOauthClient(request: DeleteOauthClientRequest): Promise<Empty>;
|
|
172
|
+
/** 设置开放授权客户端状态。 */
|
|
173
|
+
SetOauthClientStatus(request: SetOauthClientStatusRequest): Promise<Empty>;
|
|
174
|
+
}
|
|
@@ -115,11 +115,11 @@
|
|
|
115
115
|
</template>
|
|
116
116
|
<div class="agent-message-tool-payload">
|
|
117
117
|
<section class="agent-message-tool-payload__section">
|
|
118
|
-
<div class="agent-message-tool-payload__label">
|
|
118
|
+
<div class="agent-message-tool-payload__label">{{ t("system.ai.chat.field.request_payload") }}</div>
|
|
119
119
|
<pre>{{ formatToolRequest(tool) }}</pre>
|
|
120
120
|
</section>
|
|
121
121
|
<section class="agent-message-tool-payload__section">
|
|
122
|
-
<div class="agent-message-tool-payload__label">
|
|
122
|
+
<div class="agent-message-tool-payload__label">{{ t("system.ai.chat.field.response_payload") }}</div>
|
|
123
123
|
<pre>{{ formatToolResponse(tool) }}</pre>
|
|
124
124
|
</section>
|
|
125
125
|
</div>
|
|
@@ -9,13 +9,12 @@ import {
|
|
|
9
9
|
import type { AiAction } from "@liujitcn/kratos-admin-system/rpc/base/v1/ai_message";
|
|
10
10
|
import { AiMessageStatus } from "@liujitcn/kratos-admin-system/rpc/base/v1/ai_session";
|
|
11
11
|
import { Terminal } from "@liujitcn/kratos-admin-system/rpc/base/v1/ai_tool";
|
|
12
|
-
import { t } from "@liujitcn/kratos-admin-core";
|
|
12
|
+
import { getLocaleText, SUPPORTED_LOCALES, t } from "@liujitcn/kratos-admin-core";
|
|
13
13
|
import type { AiStreamPayload, AIFlowBlock, ChatMessageItem, ReplySourceTag } from "./types";
|
|
14
14
|
|
|
15
15
|
const THINKING_MESSAGE_ID_PREFIX = "ai-thinking";
|
|
16
16
|
const LOCAL_USER_MESSAGE_ID_PREFIX = "ai-user-local";
|
|
17
17
|
const PENDING_STREAM_MESSAGE_ID = "pending";
|
|
18
|
-
const DEFAULT_SESSION_TITLES = new Set(["新对话", "新對話", "New conversation"]);
|
|
19
18
|
const thinkingMessageContent = () => t("system.ai.chat.message.thinking");
|
|
20
19
|
|
|
21
20
|
/** 生成流式消息分组键,确保同一轮回复只更新当前占位气泡。 */
|
|
@@ -55,12 +54,17 @@ export function normalizeSession(session?: Partial<AiSession> | null): AiSession
|
|
|
55
54
|
/** 将服务端生成的默认会话文案切换到当前语言,兼容历史数据。 */
|
|
56
55
|
function resolveSessionText(value: unknown, fallbackWhenEmpty: boolean) {
|
|
57
56
|
const text = String(value ?? "");
|
|
58
|
-
if ((fallbackWhenEmpty && !text) ||
|
|
57
|
+
if ((fallbackWhenEmpty && !text) || isDefaultSessionTitle(text)) {
|
|
59
58
|
return t("system.ai.chat.value.new_conversation");
|
|
60
59
|
}
|
|
61
60
|
return text;
|
|
62
61
|
}
|
|
63
62
|
|
|
63
|
+
/** 判断文本是否为任一已打包语言的默认会话标题。 */
|
|
64
|
+
function isDefaultSessionTitle(value: string) {
|
|
65
|
+
return SUPPORTED_LOCALES.some(locale => getLocaleText(locale, "system.ai.chat.value.new_conversation") === value);
|
|
66
|
+
}
|
|
67
|
+
|
|
64
68
|
/** 将会话列表收敛成可安全渲染的数组。 */
|
|
65
69
|
export function normalizeSessionList(list?: AiSession[] | null) {
|
|
66
70
|
if (!Array.isArray(list)) return [];
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<AuditLogTable ref="page" :config="config" />
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script setup lang="ts">
|
|
6
|
+
import { computed, ref } from "vue";
|
|
7
|
+
import type { ColumnProps } from "@liujitcn/kratos-admin-core/components/ProTable/interface";
|
|
8
|
+
import { t } from "@liujitcn/kratos-admin-core";
|
|
9
|
+
import { buildPageRequest } from "@liujitcn/kratos-admin-core/table";
|
|
10
|
+
import AuditLogTable, { type AuditLogTableConfig } from "@liujitcn/kratos-admin-system/components/AuditLogTable.vue";
|
|
11
|
+
import { auditDateSearch, auditDetailColumn, auditEnumLabel, createAuditEnumOptions } from "@liujitcn/kratos-admin-system/components/auditLog";
|
|
12
|
+
import { defBaseApiLogService } from "@liujitcn/kratos-admin-system/api/system/base_audit_log";
|
|
13
|
+
import { BaseAuditResult } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_audit_log";
|
|
14
|
+
import type { BaseApiLog, PageBaseApiLogRequest } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_audit_log";
|
|
15
|
+
|
|
16
|
+
defineOptions({ name: "BaseApiLog", inheritAttrs: false });
|
|
17
|
+
|
|
18
|
+
const page = ref<InstanceType<typeof AuditLogTable>>();
|
|
19
|
+
const resultOptions = computed(() =>
|
|
20
|
+
createAuditEnumOptions([
|
|
21
|
+
[BaseAuditResult.BASE_AUDIT_RESULT_SUCCESS, t("system.base.audit.result.success")],
|
|
22
|
+
[BaseAuditResult.BASE_AUDIT_RESULT_FAILURE, t("system.base.audit.result.failure")],
|
|
23
|
+
[BaseAuditResult.BASE_AUDIT_RESULT_ERROR, t("system.base.audit.result.error")]
|
|
24
|
+
])
|
|
25
|
+
);
|
|
26
|
+
const columns = computed<ColumnProps[]>(() => [
|
|
27
|
+
{ prop: "operation", label: t("system.base.audit.field.operation"), minWidth: 320, search: { el: "input" } },
|
|
28
|
+
{ prop: "method", label: t("system.base.audit.field.method"), minWidth: 90 },
|
|
29
|
+
{ prop: "status_code", label: t("system.base.audit.field.status_code"), minWidth: 100 },
|
|
30
|
+
{
|
|
31
|
+
prop: "result",
|
|
32
|
+
label: t("system.base.audit.field.result"),
|
|
33
|
+
minWidth: 110,
|
|
34
|
+
search: { el: "select", enum: resultOptions.value },
|
|
35
|
+
render: scope => auditEnumLabel(resultOptions.value, (scope.row as BaseApiLog).result)
|
|
36
|
+
},
|
|
37
|
+
{ prop: "latency_ms", label: t("system.base.audit.field.latency_ms"), minWidth: 110 },
|
|
38
|
+
{ prop: "user_name", label: t("system.base.audit.field.user_name"), minWidth: 130 },
|
|
39
|
+
{ prop: "occurred_at", label: t("system.base.audit.field.occurred_at"), minWidth: 190, search: auditDateSearch(t) },
|
|
40
|
+
auditDetailColumn(t("common.action.view"), id => page.value?.handleOpenDialog(id))
|
|
41
|
+
]);
|
|
42
|
+
|
|
43
|
+
const config = computed<AuditLogTableConfig>(() => ({
|
|
44
|
+
columns: columns.value,
|
|
45
|
+
detailTitle: t("system.base.audit.api.title.detail"),
|
|
46
|
+
closeText: t("common.action.close"),
|
|
47
|
+
detailFields: [
|
|
48
|
+
{ key: "id", label: t("system.base.audit.field.id") },
|
|
49
|
+
{ key: "tenant_id", label: t("system.base.audit.field.tenant_id") },
|
|
50
|
+
{ key: "tenant_code", label: t("system.base.audit.field.tenant_code") },
|
|
51
|
+
{ key: "user_id", label: t("system.base.audit.field.user_id") },
|
|
52
|
+
{ key: "user_name", label: t("system.base.audit.field.user_name") },
|
|
53
|
+
{ key: "service_name", label: t("system.base.audit.field.service_name") },
|
|
54
|
+
{ key: "operation", label: t("system.base.audit.field.operation"), span: 2 },
|
|
55
|
+
{ key: "method", label: t("system.base.audit.field.method") },
|
|
56
|
+
{ key: "path", label: t("system.base.audit.field.path"), span: 2 },
|
|
57
|
+
{ key: "status_code", label: t("system.base.audit.field.status_code") },
|
|
58
|
+
{ key: "result", label: t("system.base.audit.field.result") },
|
|
59
|
+
{ key: "reason_code", label: t("system.base.audit.field.reason_code") },
|
|
60
|
+
{ key: "reason", label: t("system.base.audit.field.reason"), span: 2 },
|
|
61
|
+
{ key: "latency_ms", label: t("system.base.audit.field.latency_ms") },
|
|
62
|
+
{ key: "request_size", label: t("system.base.audit.field.request_size") },
|
|
63
|
+
{ key: "response_size", label: t("system.base.audit.field.response_size") },
|
|
64
|
+
{ key: "client_ip", label: t("system.base.audit.field.client_ip") },
|
|
65
|
+
{ key: "user_agent", label: t("system.base.audit.field.user_agent"), span: 2 },
|
|
66
|
+
{ key: "request_id", label: t("system.base.audit.field.request_id") },
|
|
67
|
+
{ key: "trace_id", label: t("system.base.audit.field.trace_id") },
|
|
68
|
+
{ key: "occurred_at", label: t("system.base.audit.field.occurred_at") },
|
|
69
|
+
{ key: "created_at", label: t("system.base.audit.field.created_at") }
|
|
70
|
+
],
|
|
71
|
+
request: requestTable,
|
|
72
|
+
get: getDetail
|
|
73
|
+
}));
|
|
74
|
+
|
|
75
|
+
async function requestTable(params: Record<string, unknown>) {
|
|
76
|
+
const response = await defBaseApiLogService.PageBaseApiLog(buildPageRequest(params as unknown as PageBaseApiLogRequest));
|
|
77
|
+
return { list: response.base_api_logs as unknown as Record<string, unknown>[], total: response.total };
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
async function getDetail(id: number) {
|
|
81
|
+
return (await defBaseApiLogService.GetBaseApiLog({ id })) as unknown as Record<string, unknown>;
|
|
82
|
+
}
|
|
83
|
+
</script>
|
|
@@ -78,8 +78,6 @@
|
|
|
78
78
|
<script setup lang="ts">
|
|
79
79
|
import { computed, h, reactive, ref } from "vue";
|
|
80
80
|
import { useDebounceFn } from "@vueuse/core";
|
|
81
|
-
import { ElImage, ElMessage, ElMessageBox, ElTag, ElTooltip } from "element-plus";
|
|
82
|
-
import { CirclePlus, Delete, EditPen, RefreshLeft } from "@element-plus/icons-vue";
|
|
83
81
|
import type { ColumnProps, HeaderActionProps, ProTableInstance } from "@liujitcn/kratos-admin-core/components/ProTable/interface";
|
|
84
82
|
import ProTable from "@liujitcn/kratos-admin-core/components/ProTable";
|
|
85
83
|
import FormDialog from "@liujitcn/kratos-admin-core/components/Dialog/FormDialog.vue";
|
|
@@ -259,7 +257,9 @@ const statusOptions = computed<ProFormOption[]>(() => [
|
|
|
259
257
|
|
|
260
258
|
/** 字典类系统配置与字典编码的映射关系。 */
|
|
261
259
|
const BASE_CONFIG_DICT_CODE_MAP: Record<string, string> = {
|
|
262
|
-
captchaType: "captcha_type"
|
|
260
|
+
captchaType: "captcha_type",
|
|
261
|
+
securityMfaPolicy: "security_mfa_policy",
|
|
262
|
+
securityMfaMethod: "mfa_method"
|
|
263
263
|
};
|
|
264
264
|
|
|
265
265
|
/** 当前字典类配置对应的字典编码,未配置映射时允许退回手动输入。 */
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<main class="dashboard-page">
|
|
3
|
+
<header class="dashboard-header">
|
|
4
|
+
<div>
|
|
5
|
+
<h1>{{ t("system.dashboard.title") }}</h1>
|
|
6
|
+
<p>{{ t("system.dashboard.updated_at", { time: updatedAt }) }}</p>
|
|
7
|
+
</div>
|
|
8
|
+
<el-button :loading="loading" @click="loadDashboard">
|
|
9
|
+
<el-icon><Refresh /></el-icon>
|
|
10
|
+
{{ t("core.table.refresh") }}
|
|
11
|
+
</el-button>
|
|
12
|
+
</header>
|
|
13
|
+
|
|
14
|
+
<el-skeleton v-if="loading && !overview" :rows="3" animated />
|
|
15
|
+
<template v-else>
|
|
16
|
+
<section class="metric-grid" :aria-label="t('system.dashboard.overview')">
|
|
17
|
+
<el-card v-for="metric in metrics" :key="metric.key" shadow="never" class="metric-card">
|
|
18
|
+
<span class="metric-label">{{ metric.label }}</span>
|
|
19
|
+
<strong class="metric-value">{{ metric.value }}</strong>
|
|
20
|
+
</el-card>
|
|
21
|
+
</section>
|
|
22
|
+
|
|
23
|
+
<section class="chart-grid">
|
|
24
|
+
<el-card shadow="never" class="chart-card chart-card-wide">
|
|
25
|
+
<template #header>{{ t("system.dashboard.login_trend") }}</template>
|
|
26
|
+
<div class="chart-wrap"><ECharts :option="loginTrendOption" height="320" /></div>
|
|
27
|
+
</el-card>
|
|
28
|
+
<el-card shadow="never" class="chart-card">
|
|
29
|
+
<template #header>{{ t("system.dashboard.login_distribution") }}</template>
|
|
30
|
+
<div class="chart-wrap"><ECharts :option="loginDistributionOption" height="320" /></div>
|
|
31
|
+
</el-card>
|
|
32
|
+
<el-card shadow="never" class="chart-card">
|
|
33
|
+
<template #header>{{ t("system.dashboard.operation_distribution") }}</template>
|
|
34
|
+
<div class="chart-wrap"><ECharts :option="operationDistributionOption" height="320" /></div>
|
|
35
|
+
</el-card>
|
|
36
|
+
</section>
|
|
37
|
+
</template>
|
|
38
|
+
</main>
|
|
39
|
+
</template>
|
|
40
|
+
|
|
41
|
+
<script setup lang="ts">
|
|
42
|
+
import { computed, onMounted, ref } from "vue";
|
|
43
|
+
import ECharts from "@liujitcn/kratos-admin-core/components/ECharts/index.vue";
|
|
44
|
+
import { defBaseDashboardService } from "@liujitcn/kratos-admin-system/api/system/base_dashboard";
|
|
45
|
+
import type {
|
|
46
|
+
BaseDashboardDistributionItem,
|
|
47
|
+
BaseDashboardOverview,
|
|
48
|
+
BaseDashboardTrendPoint
|
|
49
|
+
} from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_dashboard";
|
|
50
|
+
import { t } from "@liujitcn/kratos-admin-core";
|
|
51
|
+
|
|
52
|
+
const loading = ref(false);
|
|
53
|
+
const overview = ref<BaseDashboardOverview>();
|
|
54
|
+
const trend = ref<BaseDashboardTrendPoint[]>([]);
|
|
55
|
+
const loginDistribution = ref<BaseDashboardDistributionItem[]>([]);
|
|
56
|
+
const operationDistribution = ref<BaseDashboardDistributionItem[]>([]);
|
|
57
|
+
const updatedAt = ref("");
|
|
58
|
+
|
|
59
|
+
const metrics = computed(() => [
|
|
60
|
+
{ key: "users", label: t("system.dashboard.users"), value: overview.value?.user_count ?? 0 },
|
|
61
|
+
{ key: "roles", label: t("system.dashboard.roles"), value: overview.value?.role_count ?? 0 },
|
|
62
|
+
{ key: "logins", label: t("system.dashboard.today_logins"), value: overview.value?.today_login_count ?? 0 },
|
|
63
|
+
{ key: "operations", label: t("system.dashboard.today_operations"), value: overview.value?.today_operation_count ?? 0 }
|
|
64
|
+
]);
|
|
65
|
+
|
|
66
|
+
const loginTrendOption = computed(() => ({
|
|
67
|
+
tooltip: { trigger: "axis" as const },
|
|
68
|
+
grid: { left: 40, right: 20, top: 24, bottom: 32 },
|
|
69
|
+
xAxis: { type: "category" as const, boundaryGap: false, data: trend.value.map((item) => item.date) },
|
|
70
|
+
yAxis: { type: "value" as const, minInterval: 1 },
|
|
71
|
+
series: [{ type: "line" as const, smooth: true, data: trend.value.map((item) => item.count), areaStyle: {} }]
|
|
72
|
+
}));
|
|
73
|
+
|
|
74
|
+
const loginDistributionOption = computed(() => distributionOption(loginDistribution.value));
|
|
75
|
+
const operationDistributionOption = computed(() => distributionOption(operationDistribution.value));
|
|
76
|
+
|
|
77
|
+
async function loadDashboard() {
|
|
78
|
+
loading.value = true;
|
|
79
|
+
try {
|
|
80
|
+
const [overviewResponse, trendResponse, loginResponse, operationResponse] = await Promise.all([
|
|
81
|
+
defBaseDashboardService.GetBaseDashboardOverview({}),
|
|
82
|
+
defBaseDashboardService.GetBaseDashboardLoginTrend({ days: 7 }),
|
|
83
|
+
defBaseDashboardService.GetBaseDashboardLoginDistribution({}),
|
|
84
|
+
defBaseDashboardService.GetBaseDashboardOperationDistribution({})
|
|
85
|
+
]);
|
|
86
|
+
overview.value = overviewResponse;
|
|
87
|
+
trend.value = trendResponse.points ?? [];
|
|
88
|
+
loginDistribution.value = loginResponse.items ?? [];
|
|
89
|
+
operationDistribution.value = operationResponse.items ?? [];
|
|
90
|
+
updatedAt.value = new Date().toLocaleString();
|
|
91
|
+
} catch {
|
|
92
|
+
ElMessage.error(t("system.dashboard.load_failed"));
|
|
93
|
+
} finally {
|
|
94
|
+
loading.value = false;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** 将审计技术枚举名转换为当前语言的展示文案。 */
|
|
99
|
+
function distributionItemLabel(label: string) {
|
|
100
|
+
const mappings = [
|
|
101
|
+
["BASE_OPERATION_ACTION_", "system.base.audit.operation_action."],
|
|
102
|
+
["BASE_AUDIT_RESULT_", "system.base.audit.result."]
|
|
103
|
+
];
|
|
104
|
+
const mapping = mappings.find(([prefix]) => label.startsWith(prefix));
|
|
105
|
+
if (!mapping) return label;
|
|
106
|
+
const value = label.slice(mapping[0].length).toLowerCase();
|
|
107
|
+
return value === "unspecified" ? t("common.message.unknown") : t(`${mapping[1]}${value}`);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** 创建使用本地化图例的分布图配置。 */
|
|
111
|
+
function distributionOption(items: BaseDashboardDistributionItem[]) {
|
|
112
|
+
return {
|
|
113
|
+
tooltip: { trigger: "item" as const },
|
|
114
|
+
legend: { bottom: 0, type: "scroll" as const },
|
|
115
|
+
series: [{ type: "pie" as const, radius: ["38%", "68%"] as [string, string], center: ["50%", "45%"] as [string, string], data: items.map((item) => ({ name: distributionItemLabel(item.label), value: item.count })) }]
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
onMounted(loadDashboard);
|
|
120
|
+
</script>
|
|
121
|
+
|
|
122
|
+
<style scoped>
|
|
123
|
+
.dashboard-page {
|
|
124
|
+
padding: 20px;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.dashboard-header {
|
|
128
|
+
display: flex;
|
|
129
|
+
align-items: center;
|
|
130
|
+
justify-content: space-between;
|
|
131
|
+
gap: 16px;
|
|
132
|
+
margin-bottom: 20px;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.dashboard-header h1 {
|
|
136
|
+
margin: 0;
|
|
137
|
+
color: var(--el-text-color-primary);
|
|
138
|
+
font-size: 22px;
|
|
139
|
+
font-weight: 600;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.dashboard-header p {
|
|
143
|
+
margin: 6px 0 0;
|
|
144
|
+
color: var(--el-text-color-secondary);
|
|
145
|
+
font-size: 13px;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.metric-grid,
|
|
149
|
+
.chart-grid {
|
|
150
|
+
display: grid;
|
|
151
|
+
gap: 16px;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.metric-grid {
|
|
155
|
+
grid-template-columns: repeat(4, minmax(0, 1fr));
|
|
156
|
+
margin-bottom: 16px;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.metric-card :deep(.el-card__body) {
|
|
160
|
+
display: flex;
|
|
161
|
+
flex-direction: column;
|
|
162
|
+
gap: 10px;
|
|
163
|
+
min-height: 92px;
|
|
164
|
+
justify-content: center;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.metric-label {
|
|
168
|
+
color: var(--el-text-color-secondary);
|
|
169
|
+
font-size: 13px;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.metric-value {
|
|
173
|
+
color: var(--el-text-color-primary);
|
|
174
|
+
font-size: 28px;
|
|
175
|
+
line-height: 1;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.chart-grid {
|
|
179
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.chart-card-wide {
|
|
183
|
+
grid-column: 1 / -1;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.chart-wrap {
|
|
187
|
+
height: 320px;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
@media (max-width: 960px) {
|
|
191
|
+
.metric-grid,
|
|
192
|
+
.chart-grid {
|
|
193
|
+
grid-template-columns: 1fr;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.chart-card-wide {
|
|
197
|
+
grid-column: auto;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
</style>
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<AuditLogTable ref="page" :config="config" />
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script setup lang="ts">
|
|
6
|
+
import { computed, ref } from "vue";
|
|
7
|
+
import type { ColumnProps } from "@liujitcn/kratos-admin-core/components/ProTable/interface";
|
|
8
|
+
import { t } from "@liujitcn/kratos-admin-core";
|
|
9
|
+
import { buildPageRequest } from "@liujitcn/kratos-admin-core/table";
|
|
10
|
+
import AuditLogTable, { type AuditLogTableConfig } from "@liujitcn/kratos-admin-system/components/AuditLogTable.vue";
|
|
11
|
+
import { auditDateSearch, auditDetailColumn, auditEnumLabel, createAuditEnumOptions } from "@liujitcn/kratos-admin-system/components/auditLog";
|
|
12
|
+
import { defBaseDataAccessLogService } from "@liujitcn/kratos-admin-system/api/system/base_audit_log";
|
|
13
|
+
import { BaseAuditResult, BaseDataAccessType } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_audit_log";
|
|
14
|
+
import type { BaseDataAccessLog, PageBaseDataAccessLogRequest } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_audit_log";
|
|
15
|
+
|
|
16
|
+
defineOptions({ name: "BaseDataAccessLog", inheritAttrs: false });
|
|
17
|
+
|
|
18
|
+
const page = ref<InstanceType<typeof AuditLogTable>>();
|
|
19
|
+
const resultOptions = computed(() => createAuditEnumOptions([
|
|
20
|
+
[BaseAuditResult.BASE_AUDIT_RESULT_SUCCESS, t("system.base.audit.result.success")],
|
|
21
|
+
[BaseAuditResult.BASE_AUDIT_RESULT_FAILURE, t("system.base.audit.result.failure")],
|
|
22
|
+
[BaseAuditResult.BASE_AUDIT_RESULT_ERROR, t("system.base.audit.result.error")]
|
|
23
|
+
]));
|
|
24
|
+
const accessTypeOptions = computed(() => createAuditEnumOptions([
|
|
25
|
+
[BaseDataAccessType.BASE_DATA_ACCESS_TYPE_LIST, t("system.base.audit.access_type.list")],
|
|
26
|
+
[BaseDataAccessType.BASE_DATA_ACCESS_TYPE_DETAIL, t("system.base.audit.access_type.detail")],
|
|
27
|
+
[BaseDataAccessType.BASE_DATA_ACCESS_TYPE_QUERY, t("system.base.audit.access_type.query")],
|
|
28
|
+
[BaseDataAccessType.BASE_DATA_ACCESS_TYPE_EXPORT, t("system.base.audit.access_type.export")],
|
|
29
|
+
[BaseDataAccessType.BASE_DATA_ACCESS_TYPE_DOWNLOAD, t("system.base.audit.access_type.download")],
|
|
30
|
+
[BaseDataAccessType.BASE_DATA_ACCESS_TYPE_IMPORT, t("system.base.audit.access_type.import")]
|
|
31
|
+
]));
|
|
32
|
+
const columns = computed<ColumnProps[]>(() => [
|
|
33
|
+
{ prop: "resource_type", label: t("system.base.audit.field.resource_type"), minWidth: 150, search: { el: "input" } },
|
|
34
|
+
{ prop: "table_name", label: t("system.base.audit.field.table_name"), minWidth: 150 },
|
|
35
|
+
{ prop: "access_type", label: t("system.base.audit.field.access_type"), minWidth: 120, search: { el: "select", enum: accessTypeOptions.value }, render: scope => auditEnumLabel(accessTypeOptions.value, (scope.row as BaseDataAccessLog).access_type) },
|
|
36
|
+
{ prop: "affected_rows", label: t("system.base.audit.field.affected_rows"), minWidth: 110 },
|
|
37
|
+
{ prop: "sensitive", label: t("system.base.audit.field.sensitive"), minWidth: 110, search: { el: "switch" }, render: scope => (scope.row as BaseDataAccessLog).sensitive ? t("common.value.yes") : t("common.value.no") },
|
|
38
|
+
{ prop: "result", label: t("system.base.audit.field.result"), minWidth: 110, search: { el: "select", enum: resultOptions.value }, render: scope => auditEnumLabel(resultOptions.value, (scope.row as BaseDataAccessLog).result) },
|
|
39
|
+
{ prop: "occurred_at", label: t("system.base.audit.field.occurred_at"), minWidth: 190, search: auditDateSearch(t) },
|
|
40
|
+
auditDetailColumn(t("common.action.view"), id => page.value?.handleOpenDialog(id))
|
|
41
|
+
]);
|
|
42
|
+
|
|
43
|
+
const config = computed<AuditLogTableConfig>(() => ({
|
|
44
|
+
columns: columns.value,
|
|
45
|
+
detailTitle: t("system.base.audit.data_access.title.detail"),
|
|
46
|
+
closeText: t("common.action.close"),
|
|
47
|
+
detailFields: [
|
|
48
|
+
{ key: "id", label: t("system.base.audit.field.id") },
|
|
49
|
+
{ key: "tenant_id", label: t("system.base.audit.field.tenant_id") },
|
|
50
|
+
{ key: "tenant_code", label: t("system.base.audit.field.tenant_code") },
|
|
51
|
+
{ key: "user_id", label: t("system.base.audit.field.user_id") },
|
|
52
|
+
{ key: "user_name", label: t("system.base.audit.field.user_name") },
|
|
53
|
+
{ key: "resource_type", label: t("system.base.audit.field.resource_type") },
|
|
54
|
+
{ key: "resource_id", label: t("system.base.audit.field.resource_id") },
|
|
55
|
+
{ key: "access_type", label: t("system.base.audit.field.access_type") },
|
|
56
|
+
{ key: "data_source", label: t("system.base.audit.field.data_source") },
|
|
57
|
+
{ key: "table_name", label: t("system.base.audit.field.table_name") },
|
|
58
|
+
{ key: "field_scope", label: t("system.base.audit.field.field_scope"), span: 2, code: true },
|
|
59
|
+
{ key: "data_scope", label: t("system.base.audit.field.data_scope") },
|
|
60
|
+
{ key: "affected_rows", label: t("system.base.audit.field.affected_rows") },
|
|
61
|
+
{ key: "sensitive", label: t("system.base.audit.field.sensitive") },
|
|
62
|
+
{ key: "sql_digest", label: t("system.base.audit.field.sql_digest") },
|
|
63
|
+
{ key: "sql_text", label: t("system.base.audit.field.sql_text"), span: 2, code: true },
|
|
64
|
+
{ key: "result", label: t("system.base.audit.field.result") },
|
|
65
|
+
{ key: "reason_code", label: t("system.base.audit.field.reason_code") },
|
|
66
|
+
{ key: "latency_ms", label: t("system.base.audit.field.latency_ms") },
|
|
67
|
+
{ key: "request_id", label: t("system.base.audit.field.request_id") },
|
|
68
|
+
{ key: "trace_id", label: t("system.base.audit.field.trace_id") },
|
|
69
|
+
{ key: "occurred_at", label: t("system.base.audit.field.occurred_at") },
|
|
70
|
+
{ key: "created_at", label: t("system.base.audit.field.created_at") }
|
|
71
|
+
],
|
|
72
|
+
request: requestTable,
|
|
73
|
+
get: getDetail
|
|
74
|
+
}));
|
|
75
|
+
|
|
76
|
+
async function requestTable(params: Record<string, unknown>) {
|
|
77
|
+
const response = await defBaseDataAccessLogService.PageBaseDataAccessLog(buildPageRequest(params as unknown as PageBaseDataAccessLogRequest));
|
|
78
|
+
return { list: response.base_data_access_logs as unknown as Record<string, unknown>[], total: response.total };
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
async function getDetail(id: number) {
|
|
82
|
+
return (await defBaseDataAccessLogService.GetBaseDataAccessLog({ id })) as unknown as Record<string, unknown>;
|
|
83
|
+
}
|
|
84
|
+
</script>
|