@liujitcn/kratos-admin-system 0.0.28 → 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 +19 -2
- 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_i18n.d.ts +5 -5
- 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/DynamicI18nCell.vue.d.ts +16 -0
- package/dist/package/declarations/src/components/DynamicI18nEditor.vue.d.ts +20 -0
- package/dist/package/declarations/src/components/auditLog.d.ts +9 -0
- package/dist/package/declarations/src/components/dynamicI18n.d.ts +38 -0
- package/dist/package/declarations/src/locales/generated.d.ts +1364 -68
- 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_config.d.ts +3 -3
- 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_dict.d.ts +4 -4
- 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 +27 -23
- 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_menu.d.ts +2 -2
- 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/code_gen.d.ts +1 -1
- 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_i18n.ts +12 -12
- 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/{DynamicTranslationCell.vue → DynamicI18nCell.vue} +50 -50
- package/dist/package/src/components/{DynamicTranslationEditor.vue → DynamicI18nEditor.vue} +45 -45
- package/dist/package/src/components/Notification.vue +196 -0
- package/dist/package/src/components/auditLog.ts +46 -0
- package/dist/package/src/components/{dynamicTranslation.ts → dynamicI18n.ts} +15 -15
- package/dist/package/src/locales/README.md +5 -3
- package/dist/package/src/locales/en-US.json +345 -21
- package/dist/package/src/locales/ja-JP.json +347 -23
- package/dist/package/src/locales/zh-CN.json +343 -19
- package/dist/package/src/locales/zh-TW.json +346 -22
- 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_config.ts +3 -3
- package/dist/package/src/rpc/system/admin/v1/base_dashboard.ts +81 -0
- package/dist/package/src/rpc/system/admin/v1/base_dict.ts +4 -4
- package/dist/package/src/rpc/system/admin/v1/base_file.ts +88 -0
- package/dist/package/src/rpc/system/admin/v1/base_i18n.ts +27 -23
- 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_menu.ts +2 -2
- 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/code_gen.ts +1 -1
- 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 +41 -41
- 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 +23 -23
- package/dist/package/src/views/base/dict/item.vue +25 -25
- 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 +23 -23
- 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/code-preview/index.vue +9 -9
- package/dist/package/src/views/tool/code-gen/columns/index.vue +1 -1
- package/dist/package/src/views/tool/code-gen/components/CodeGenLocaleEditor.vue +8 -8
- package/dist/package/src/views/tool/code-gen/config.ts +1 -0
- package/dist/package/src/views/tool/code-gen/table/index.vue +7 -7
- 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/components/DynamicTranslationCell.vue.d.ts +0 -16
- package/dist/package/declarations/src/components/DynamicTranslationEditor.vue.d.ts +0 -20
- package/dist/package/declarations/src/components/dynamicTranslation.d.ts +0 -38
- 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
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
</el-radio-group>
|
|
36
36
|
</div>
|
|
37
37
|
</template>
|
|
38
|
-
<template #
|
|
39
|
-
<
|
|
40
|
-
v-model="
|
|
38
|
+
<template #i18ns>
|
|
39
|
+
<DynamicI18nEditor
|
|
40
|
+
v-model="i18nValues"
|
|
41
41
|
:source="formData.label"
|
|
42
42
|
:maxlength="100"
|
|
43
43
|
/>
|
|
@@ -69,17 +69,17 @@ import type {
|
|
|
69
69
|
PageBaseDictItemRequest
|
|
70
70
|
} from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_dict";
|
|
71
71
|
import { Status } from "@liujitcn/kratos-admin-system/rpc/common/v1/enum";
|
|
72
|
-
import {
|
|
72
|
+
import { I18nTargetType } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_i18n";
|
|
73
73
|
import { buildPageRequest, normalizeSelectedIds } from "@liujitcn/kratos-admin-core/table";
|
|
74
74
|
import { t } from "@liujitcn/kratos-admin-core";
|
|
75
|
-
import
|
|
76
|
-
import
|
|
75
|
+
import DynamicI18nEditor from "@liujitcn/kratos-admin-system/components/DynamicI18nEditor.vue";
|
|
76
|
+
import DynamicI18nCell from "@liujitcn/kratos-admin-system/components/DynamicI18nCell.vue";
|
|
77
77
|
import {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
type
|
|
81
|
-
type
|
|
82
|
-
} from "@liujitcn/kratos-admin-system/components/
|
|
78
|
+
normalizeDynamicI18ns,
|
|
79
|
+
serializeDynamicI18ns,
|
|
80
|
+
type DynamicI18nRecord,
|
|
81
|
+
type DynamicI18nValue
|
|
82
|
+
} from "@liujitcn/kratos-admin-system/components/dynamicI18n";
|
|
83
83
|
|
|
84
84
|
defineOptions({
|
|
85
85
|
name: "BaseDictItem",
|
|
@@ -90,7 +90,7 @@ const route = useRoute();
|
|
|
90
90
|
const { BUTTONS } = useAuthButtons();
|
|
91
91
|
const proTable = ref<ProTableInstance>();
|
|
92
92
|
const formDialogRef = ref<InstanceType<typeof FormDialog>>();
|
|
93
|
-
const
|
|
93
|
+
const i18nValues = ref<DynamicI18nValue[]>(normalizeDynamicI18ns(undefined, "label"));
|
|
94
94
|
|
|
95
95
|
const dictId = ref(Number(route.query.dictId ?? 0));
|
|
96
96
|
|
|
@@ -109,7 +109,7 @@ const formData = reactive<BaseDictItemForm>({
|
|
|
109
109
|
/** 字典项标签 */
|
|
110
110
|
label: "",
|
|
111
111
|
/** 非主语言翻译 */
|
|
112
|
-
|
|
112
|
+
i18ns: [],
|
|
113
113
|
/** 标签类型 */
|
|
114
114
|
tag_type: "",
|
|
115
115
|
/** 排序 */
|
|
@@ -158,10 +158,10 @@ const formFields = computed<ProFormField[]>(() => [
|
|
|
158
158
|
props: { placeholder: t("system.base.dict.item.placeholder.value") }
|
|
159
159
|
},
|
|
160
160
|
{
|
|
161
|
-
prop: "
|
|
162
|
-
label: t("system.base.
|
|
161
|
+
prop: "i18ns",
|
|
162
|
+
label: t("system.base.i18n.field.i18ns"),
|
|
163
163
|
component: "slot",
|
|
164
|
-
slotName: "
|
|
164
|
+
slotName: "i18ns",
|
|
165
165
|
colSpan: 24
|
|
166
166
|
},
|
|
167
167
|
{
|
|
@@ -202,11 +202,11 @@ function renderTagTypeCell(scope: RenderScope<BaseDictItem>) {
|
|
|
202
202
|
/** 渲染字典项标签翻译预览,并复用当前页面的编辑弹窗。 */
|
|
203
203
|
function renderDictItemLabelCell(scope: RenderScope<BaseDictItem>) {
|
|
204
204
|
const row = scope.row;
|
|
205
|
-
return h(
|
|
205
|
+
return h(DynamicI18nCell, {
|
|
206
206
|
source: row.label,
|
|
207
|
-
targetType:
|
|
207
|
+
targetType: I18nTargetType.I18N_TARGET_TYPE_BASE_DICT_ITEM_LABEL,
|
|
208
208
|
targetId: row.id,
|
|
209
|
-
|
|
209
|
+
i18ns: row.i18ns
|
|
210
210
|
});
|
|
211
211
|
}
|
|
212
212
|
|
|
@@ -330,7 +330,7 @@ async function handleOpenDialog(dictItemId?: number) {
|
|
|
330
330
|
|
|
331
331
|
const data = await defBaseDictService.GetBaseDictItem({ id: dictItemId });
|
|
332
332
|
Object.assign(formData, data);
|
|
333
|
-
|
|
333
|
+
i18nValues.value = normalizeDynamicI18ns(data.i18ns as DynamicI18nRecord[], "label");
|
|
334
334
|
}
|
|
335
335
|
|
|
336
336
|
/**
|
|
@@ -351,11 +351,11 @@ function resetForm() {
|
|
|
351
351
|
formData.dict_id = dictId.value;
|
|
352
352
|
formData.value = "";
|
|
353
353
|
formData.label = "";
|
|
354
|
-
formData.
|
|
354
|
+
formData.i18ns = [];
|
|
355
355
|
formData.tag_type = "";
|
|
356
356
|
formData.sort = 1;
|
|
357
357
|
formData.status = Status.STATUS_ENABLE;
|
|
358
|
-
|
|
358
|
+
i18nValues.value = normalizeDynamicI18ns(undefined, "label");
|
|
359
359
|
}
|
|
360
360
|
|
|
361
361
|
/**
|
|
@@ -367,9 +367,9 @@ function handleSubmit() {
|
|
|
367
367
|
|
|
368
368
|
formData.dict_id = dictId.value;
|
|
369
369
|
const submitData = JSON.parse(JSON.stringify(formData)) as BaseDictItemForm;
|
|
370
|
-
submitData.
|
|
371
|
-
|
|
372
|
-
|
|
370
|
+
submitData.i18ns = serializeDynamicI18ns(
|
|
371
|
+
i18nValues.value,
|
|
372
|
+
I18nTargetType.I18N_TARGET_TYPE_BASE_DICT_ITEM_LABEL,
|
|
373
373
|
submitData.id
|
|
374
374
|
);
|
|
375
375
|
const request = submitData.id
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="table-box">
|
|
3
|
+
<ProTable
|
|
4
|
+
ref="proTable"
|
|
5
|
+
row-key="id"
|
|
6
|
+
:columns="columns"
|
|
7
|
+
:request-api="requestBaseFileTable"
|
|
8
|
+
/>
|
|
9
|
+
</div>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script setup lang="ts">
|
|
13
|
+
import { computed, h, ref } from "vue";
|
|
14
|
+
import ProTable from "@liujitcn/kratos-admin-core/components/ProTable";
|
|
15
|
+
import type { ColumnProps, ProTableInstance } from "@liujitcn/kratos-admin-core/components/ProTable/interface";
|
|
16
|
+
import { useAuthButtons } from "@liujitcn/kratos-admin-core/auth";
|
|
17
|
+
import { buildPageRequest } from "@liujitcn/kratos-admin-core/table";
|
|
18
|
+
import { t } from "@liujitcn/kratos-admin-core";
|
|
19
|
+
import { defBaseFileService } from "@liujitcn/kratos-admin-system/api/system/base_file";
|
|
20
|
+
import type { BaseFile, PageBaseFileRequest } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_file";
|
|
21
|
+
|
|
22
|
+
defineOptions({ name: "BaseFile", inheritAttrs: false });
|
|
23
|
+
|
|
24
|
+
const { BUTTONS } = useAuthButtons();
|
|
25
|
+
const proTable = ref<ProTableInstance>();
|
|
26
|
+
|
|
27
|
+
const columns = computed<ColumnProps[]>(() => [
|
|
28
|
+
{ prop: "file_name", label: t("system.base.file.field.name"), minWidth: 220, search: { el: "input" } },
|
|
29
|
+
{ prop: "extension", label: t("system.base.file.field.extension"), width: 100, search: { el: "input" } },
|
|
30
|
+
{ prop: "mime_type", label: t("system.base.file.field.mime"), minWidth: 180 },
|
|
31
|
+
{ prop: "size", label: t("system.base.file.field.size"), width: 120, render: scope => formatFileSize((scope.row as BaseFile).size) },
|
|
32
|
+
{ prop: "content_hash", label: t("system.base.file.field.hash"), minWidth: 220 },
|
|
33
|
+
{ prop: "tenant_id", label: t("system.base.file.field.tenant"), width: 100 },
|
|
34
|
+
{ prop: "created_at", label: t("common.field.created_at"), minWidth: 180 },
|
|
35
|
+
{
|
|
36
|
+
prop: "operation",
|
|
37
|
+
label: t("common.field.operation"),
|
|
38
|
+
width: 150,
|
|
39
|
+
fixed: "right",
|
|
40
|
+
cellType: "actions",
|
|
41
|
+
actions: [
|
|
42
|
+
{
|
|
43
|
+
label: t("common.action.view"),
|
|
44
|
+
type: "primary",
|
|
45
|
+
link: true,
|
|
46
|
+
icon: View,
|
|
47
|
+
hidden: () => !BUTTONS.value["base:file:info"],
|
|
48
|
+
onClick: scope => handleView(scope.row as BaseFile)
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
label: t("common.action.delete"),
|
|
52
|
+
type: "danger",
|
|
53
|
+
link: true,
|
|
54
|
+
icon: Delete,
|
|
55
|
+
hidden: () => !BUTTONS.value["base:file:delete"],
|
|
56
|
+
onClick: scope => handleDelete(scope.row as BaseFile)
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
]);
|
|
61
|
+
|
|
62
|
+
/** 请求文件资产分页列表。 */
|
|
63
|
+
async function requestBaseFileTable(params: PageBaseFileRequest) {
|
|
64
|
+
const data = await defBaseFileService.PageBaseFile(buildPageRequest(params));
|
|
65
|
+
return { data: { list: data.base_files ?? [], total: data.total } };
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** 查看文件资产详情。 */
|
|
69
|
+
async function handleView(row: BaseFile) {
|
|
70
|
+
const detail = await defBaseFileService.GetBaseFile({ id: row.id });
|
|
71
|
+
const lines = [
|
|
72
|
+
`${t("system.base.file.field.name")}:${detail.file_name}`,
|
|
73
|
+
`${t("system.base.file.field.path")}:${detail.file_directory}/${detail.save_file_name}`,
|
|
74
|
+
`${t("system.base.file.field.mime")}:${detail.mime_type}`,
|
|
75
|
+
`${t("system.base.file.field.size")}:${formatFileSize(detail.size)}`,
|
|
76
|
+
`${t("system.base.file.field.hash")}:${detail.content_hash}`,
|
|
77
|
+
`${t("system.base.file.field.url")}:${detail.link_url}`
|
|
78
|
+
];
|
|
79
|
+
await ElMessageBox.alert(h("pre", { class: "file-detail" }, lines.join("\n")), t("system.base.file.detail"), { dangerouslyUseHTMLString: false });
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** 删除文件资产。 */
|
|
83
|
+
async function handleDelete(row: BaseFile) {
|
|
84
|
+
try {
|
|
85
|
+
await ElMessageBox.confirm(
|
|
86
|
+
t("system.base.file.confirm_delete", { name: row.file_name }),
|
|
87
|
+
t("common.title.warning"),
|
|
88
|
+
{ type: "warning", confirmButtonText: t("common.action.confirm"), cancelButtonText: t("common.action.cancel") }
|
|
89
|
+
);
|
|
90
|
+
await defBaseFileService.DeleteBaseFile({ id: row.id });
|
|
91
|
+
ElMessage.success(t("common.message.delete_success", { resource: t("system.base.file.resource") }));
|
|
92
|
+
proTable.value?.getTableList();
|
|
93
|
+
} catch {
|
|
94
|
+
// 用户取消确认或接口失败时由请求层展示错误。
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function formatFileSize(size: number) {
|
|
99
|
+
if (!size) return "0 B";
|
|
100
|
+
const units = ["B", "KB", "MB", "GB"];
|
|
101
|
+
let value = size;
|
|
102
|
+
let index = 0;
|
|
103
|
+
while (value >= 1024 && index < units.length - 1) {
|
|
104
|
+
value /= 1024;
|
|
105
|
+
index += 1;
|
|
106
|
+
}
|
|
107
|
+
return `${value.toFixed(index === 0 ? 0 : 2)} ${units[index]}`;
|
|
108
|
+
}
|
|
109
|
+
</script>
|
|
110
|
+
|
|
111
|
+
<style scoped>
|
|
112
|
+
.file-detail {
|
|
113
|
+
max-width: 720px;
|
|
114
|
+
margin: 0;
|
|
115
|
+
overflow-wrap: anywhere;
|
|
116
|
+
white-space: pre-wrap;
|
|
117
|
+
text-align: left;
|
|
118
|
+
}
|
|
119
|
+
</style>
|
|
@@ -13,7 +13,15 @@
|
|
|
13
13
|
:rules="rules"
|
|
14
14
|
@confirm="handleSubmit"
|
|
15
15
|
@close="handleCloseDialog"
|
|
16
|
-
|
|
16
|
+
>
|
|
17
|
+
<template #i18ns>
|
|
18
|
+
<DynamicI18nEditor
|
|
19
|
+
v-model="i18nValues"
|
|
20
|
+
:source="formData.name"
|
|
21
|
+
:maxlength="50"
|
|
22
|
+
/>
|
|
23
|
+
</template>
|
|
24
|
+
</FormDialog>
|
|
17
25
|
</div>
|
|
18
26
|
</template>
|
|
19
27
|
|
|
@@ -32,6 +40,7 @@ import type { ProFormField, ProFormOption } from "@liujitcn/kratos-admin-core/co
|
|
|
32
40
|
import ProTable from "@liujitcn/kratos-admin-core/components/ProTable";
|
|
33
41
|
import { useAuthButtons } from "@liujitcn/kratos-admin-core/auth";
|
|
34
42
|
import { defBaseJobService } from "@liujitcn/kratos-admin-system/api/system/base_job";
|
|
43
|
+
import { loadEnabledBaseLanguages } from "@liujitcn/kratos-admin-system/api/system/base_language";
|
|
35
44
|
import type {
|
|
36
45
|
BaseJob,
|
|
37
46
|
BaseJobArgs,
|
|
@@ -40,8 +49,17 @@ import type {
|
|
|
40
49
|
} from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_job";
|
|
41
50
|
import router, { navigateTo } from "@liujitcn/kratos-admin-core/navigation";
|
|
42
51
|
import { Status } from "@liujitcn/kratos-admin-system/rpc/common/v1/enum";
|
|
52
|
+
import { I18nTargetType } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_i18n";
|
|
43
53
|
import { buildPageRequest, normalizeSelectedIds } from "@liujitcn/kratos-admin-core/table";
|
|
44
54
|
import { t } from "@liujitcn/kratos-admin-core";
|
|
55
|
+
import DynamicI18nCell from "@liujitcn/kratos-admin-system/components/DynamicI18nCell.vue";
|
|
56
|
+
import DynamicI18nEditor from "@liujitcn/kratos-admin-system/components/DynamicI18nEditor.vue";
|
|
57
|
+
import {
|
|
58
|
+
normalizeDynamicI18ns,
|
|
59
|
+
serializeDynamicI18ns,
|
|
60
|
+
type DynamicI18nRecord,
|
|
61
|
+
type DynamicI18nValue
|
|
62
|
+
} from "@liujitcn/kratos-admin-system/components/dynamicI18n";
|
|
45
63
|
|
|
46
64
|
defineOptions({
|
|
47
65
|
name: "BaseJob",
|
|
@@ -51,6 +69,7 @@ defineOptions({
|
|
|
51
69
|
const { BUTTONS } = useAuthButtons();
|
|
52
70
|
const proTable = ref<ProTableInstance>();
|
|
53
71
|
const formDialogRef = ref<InstanceType<typeof FormDialog>>();
|
|
72
|
+
const i18nValues = ref<DynamicI18nValue[]>(normalizeDynamicI18ns(undefined, "name"));
|
|
54
73
|
|
|
55
74
|
const dialog = reactive({
|
|
56
75
|
editing: false,
|
|
@@ -69,7 +88,9 @@ const formData = reactive<BaseJobForm>({
|
|
|
69
88
|
/** cron表达式 */
|
|
70
89
|
cron_expression: "",
|
|
71
90
|
/** 状态 */
|
|
72
|
-
status: Status.STATUS_ENABLE
|
|
91
|
+
status: Status.STATUS_ENABLE,
|
|
92
|
+
/** 定时任务名称多语言翻译。 */
|
|
93
|
+
i18ns: []
|
|
73
94
|
});
|
|
74
95
|
|
|
75
96
|
const rules = computed(() => ({
|
|
@@ -144,6 +165,17 @@ function renderArgsCell(scope: RenderScope<BaseJob>) {
|
|
|
144
165
|
);
|
|
145
166
|
}
|
|
146
167
|
|
|
168
|
+
/** 渲染定时任务名称翻译预览。 */
|
|
169
|
+
function renderJobNameCell(scope: RenderScope<BaseJob>) {
|
|
170
|
+
const row = scope.row;
|
|
171
|
+
return h(DynamicI18nCell, {
|
|
172
|
+
source: row.name,
|
|
173
|
+
targetType: I18nTargetType.I18N_TARGET_TYPE_BASE_JOB_NAME,
|
|
174
|
+
targetId: row.id,
|
|
175
|
+
i18ns: row.i18ns
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
|
|
147
179
|
/**
|
|
148
180
|
* 渲染定时任务操作列。
|
|
149
181
|
*/
|
|
@@ -270,6 +302,13 @@ const formFields = computed<ProFormField[]>(() => [
|
|
|
270
302
|
component: "input",
|
|
271
303
|
props: { placeholder: t("system.base.job.placeholder.name") }
|
|
272
304
|
},
|
|
305
|
+
{
|
|
306
|
+
prop: "i18ns",
|
|
307
|
+
label: t("system.base.i18n.field.i18ns"),
|
|
308
|
+
component: "slot",
|
|
309
|
+
slotName: "i18ns",
|
|
310
|
+
colSpan: 24
|
|
311
|
+
},
|
|
273
312
|
{
|
|
274
313
|
prop: "invoke_target",
|
|
275
314
|
label: t("system.base.job.field.invoke_target"),
|
|
@@ -298,7 +337,14 @@ const formFields = computed<ProFormField[]>(() => [
|
|
|
298
337
|
/** 定时任务表格列配置。 */
|
|
299
338
|
const columns = computed<ColumnProps[]>(() => [
|
|
300
339
|
{ type: "selection", width: 55 },
|
|
301
|
-
{
|
|
340
|
+
{
|
|
341
|
+
prop: "name",
|
|
342
|
+
label: t("system.base.job.field.name"),
|
|
343
|
+
minWidth: 140,
|
|
344
|
+
search: { el: "input" },
|
|
345
|
+
showOverflowTooltip: false,
|
|
346
|
+
render: scope => renderJobNameCell(scope as unknown as RenderScope<BaseJob>)
|
|
347
|
+
},
|
|
302
348
|
{ prop: "invoke_target", label: t("system.base.job.field.invoke_target"), minWidth: 180, search: { el: "input" } },
|
|
303
349
|
{
|
|
304
350
|
prop: "args",
|
|
@@ -357,6 +403,7 @@ const headerActions = computed<HeaderActionProps[]>(() => [
|
|
|
357
403
|
* 请求定时任务列表,并由 ProTable 统一维护分页与搜索参数。
|
|
358
404
|
*/
|
|
359
405
|
async function requestBaseJobTable(params: PageBaseJobRequest) {
|
|
406
|
+
await loadEnabledBaseLanguages();
|
|
360
407
|
const data = await defBaseJobService.PageBaseJob(buildPageRequest(params));
|
|
361
408
|
return { data: { list: data.base_jobs ?? [], total: data.total } };
|
|
362
409
|
}
|
|
@@ -371,15 +418,16 @@ function refreshTable() {
|
|
|
371
418
|
/**
|
|
372
419
|
* 打开定时任务弹窗。
|
|
373
420
|
*/
|
|
374
|
-
function handleOpenDialog(jobId?: number) {
|
|
421
|
+
async function handleOpenDialog(jobId?: number) {
|
|
422
|
+
await loadEnabledBaseLanguages();
|
|
375
423
|
resetForm();
|
|
376
424
|
dialog.editing = Boolean(jobId);
|
|
377
425
|
dialog.visible = true;
|
|
378
426
|
if (!jobId) return;
|
|
379
427
|
|
|
380
|
-
defBaseJobService.GetBaseJob({ id: jobId })
|
|
381
|
-
|
|
382
|
-
|
|
428
|
+
const data = await defBaseJobService.GetBaseJob({ id: jobId });
|
|
429
|
+
Object.assign(formData, data);
|
|
430
|
+
i18nValues.value = normalizeDynamicI18ns(data.i18ns as DynamicI18nRecord[], "name");
|
|
383
431
|
}
|
|
384
432
|
|
|
385
433
|
/**
|
|
@@ -402,6 +450,8 @@ function resetForm() {
|
|
|
402
450
|
formData.args = [];
|
|
403
451
|
formData.cron_expression = "";
|
|
404
452
|
formData.status = Status.STATUS_ENABLE;
|
|
453
|
+
formData.i18ns = [];
|
|
454
|
+
i18nValues.value = normalizeDynamicI18ns(undefined, "name");
|
|
405
455
|
}
|
|
406
456
|
|
|
407
457
|
/**
|
|
@@ -412,6 +462,11 @@ function handleSubmit() {
|
|
|
412
462
|
if (!valid) return;
|
|
413
463
|
|
|
414
464
|
const submitData = JSON.parse(JSON.stringify(formData)) as BaseJobForm;
|
|
465
|
+
submitData.i18ns = serializeDynamicI18ns(
|
|
466
|
+
i18nValues.value,
|
|
467
|
+
I18nTargetType.I18N_TARGET_TYPE_BASE_JOB_NAME,
|
|
468
|
+
submitData.id
|
|
469
|
+
);
|
|
415
470
|
const request = submitData.id
|
|
416
471
|
? defBaseJobService.UpdateBaseJob({ base_job: submitData })
|
|
417
472
|
: defBaseJobService.CreateBaseJob({ base_job: submitData });
|
|
@@ -138,7 +138,8 @@ const headerActions = computed<HeaderActionProps[]>(() => [
|
|
|
138
138
|
/** 请求语言分页列表。 */
|
|
139
139
|
async function requestBaseLanguageTable(params: PageBaseLanguageRequest) {
|
|
140
140
|
const data = await defBaseLanguageService.PageBaseLanguage(buildPageRequest(params));
|
|
141
|
-
|
|
141
|
+
const list = (data.base_languages ?? []).map(item => ({ ...item, is_primary: item.is_primary ?? false }));
|
|
142
|
+
return { data: { list, total: data.total } };
|
|
142
143
|
}
|
|
143
144
|
|
|
144
145
|
/** 打开语言编辑弹窗。 */
|
|
@@ -0,0 +1,92 @@
|
|
|
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 { defBaseLoginLogService } from "@liujitcn/kratos-admin-system/api/system/base_audit_log";
|
|
13
|
+
import { BaseAuditResult, BaseLoginLogType } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_audit_log";
|
|
14
|
+
import type { BaseLoginLog, PageBaseLoginLogRequest } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_audit_log";
|
|
15
|
+
|
|
16
|
+
defineOptions({ name: "BaseLoginLog", 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 loginTypeOptions = computed(() =>
|
|
27
|
+
createAuditEnumOptions([
|
|
28
|
+
[BaseLoginLogType.BASE_LOGIN_LOG_TYPE_PASSWORD, t("system.base.audit.login_type.password")],
|
|
29
|
+
[BaseLoginLogType.BASE_LOGIN_LOG_TYPE_OAUTH, t("system.base.audit.login_type.oauth")],
|
|
30
|
+
[BaseLoginLogType.BASE_LOGIN_LOG_TYPE_MFA, t("system.base.audit.login_type.mfa")],
|
|
31
|
+
[BaseLoginLogType.BASE_LOGIN_LOG_TYPE_TOKEN_REFRESH, t("system.base.audit.login_type.token_refresh")],
|
|
32
|
+
[BaseLoginLogType.BASE_LOGIN_LOG_TYPE_LOGOUT, t("system.base.audit.login_type.logout")]
|
|
33
|
+
])
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
const columns = computed<ColumnProps[]>(() => [
|
|
37
|
+
{ prop: "user_name", label: t("system.base.audit.field.user_name"), minWidth: 130 },
|
|
38
|
+
{ prop: "tenant_code", label: t("system.base.audit.field.tenant_code"), minWidth: 120 },
|
|
39
|
+
{
|
|
40
|
+
prop: "login_type",
|
|
41
|
+
label: t("system.base.audit.field.login_type"),
|
|
42
|
+
minWidth: 130,
|
|
43
|
+
search: { el: "select", enum: loginTypeOptions.value },
|
|
44
|
+
render: scope => auditEnumLabel(loginTypeOptions.value, (scope.row as BaseLoginLog).login_type)
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
prop: "result",
|
|
48
|
+
label: t("system.base.audit.field.result"),
|
|
49
|
+
minWidth: 110,
|
|
50
|
+
search: { el: "select", enum: resultOptions.value },
|
|
51
|
+
render: scope => auditEnumLabel(resultOptions.value, (scope.row as BaseLoginLog).result)
|
|
52
|
+
},
|
|
53
|
+
{ prop: "client_ip", label: t("system.base.audit.field.client_ip"), minWidth: 140 },
|
|
54
|
+
{ prop: "occurred_at", label: t("system.base.audit.field.occurred_at"), minWidth: 190, search: auditDateSearch(t) },
|
|
55
|
+
auditDetailColumn(t("common.action.view"), id => page.value?.handleOpenDialog(id))
|
|
56
|
+
]);
|
|
57
|
+
|
|
58
|
+
const config = computed<AuditLogTableConfig>(() => ({
|
|
59
|
+
columns: columns.value,
|
|
60
|
+
detailTitle: t("system.base.audit.login.title.detail"),
|
|
61
|
+
closeText: t("common.action.close"),
|
|
62
|
+
detailFields: [
|
|
63
|
+
{ key: "id", label: t("system.base.audit.field.id") },
|
|
64
|
+
{ key: "tenant_id", label: t("system.base.audit.field.tenant_id") },
|
|
65
|
+
{ key: "tenant_code", label: t("system.base.audit.field.tenant_code") },
|
|
66
|
+
{ key: "user_id", label: t("system.base.audit.field.user_id") },
|
|
67
|
+
{ key: "user_name", label: t("system.base.audit.field.user_name") },
|
|
68
|
+
{ key: "login_type", label: t("system.base.audit.field.login_type") },
|
|
69
|
+
{ key: "result", label: t("system.base.audit.field.result") },
|
|
70
|
+
{ key: "reason_code", label: t("system.base.audit.field.reason_code") },
|
|
71
|
+
{ key: "reason", label: t("system.base.audit.field.reason"), span: 2 },
|
|
72
|
+
{ key: "client_ip", label: t("system.base.audit.field.client_ip") },
|
|
73
|
+
{ key: "device_id", label: t("system.base.audit.field.device_id") },
|
|
74
|
+
{ key: "user_agent", label: t("system.base.audit.field.user_agent"), span: 2 },
|
|
75
|
+
{ key: "request_id", label: t("system.base.audit.field.request_id") },
|
|
76
|
+
{ key: "trace_id", label: t("system.base.audit.field.trace_id") },
|
|
77
|
+
{ key: "occurred_at", label: t("system.base.audit.field.occurred_at") },
|
|
78
|
+
{ key: "created_at", label: t("system.base.audit.field.created_at") }
|
|
79
|
+
],
|
|
80
|
+
request: requestTable,
|
|
81
|
+
get: getDetail
|
|
82
|
+
}));
|
|
83
|
+
|
|
84
|
+
async function requestTable(params: Record<string, unknown>) {
|
|
85
|
+
const response = await defBaseLoginLogService.PageBaseLoginLog(buildPageRequest(params as unknown as PageBaseLoginLogRequest));
|
|
86
|
+
return { list: response.base_login_logs as unknown as Record<string, unknown>[], total: response.total };
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
async function getDetail(id: number) {
|
|
90
|
+
return (await defBaseLoginLogService.GetBaseLoginLog({ id })) as unknown as Record<string, unknown>;
|
|
91
|
+
}
|
|
92
|
+
</script>
|