@liujitcn/kratos-admin-system 0.0.20 → 0.0.23
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 +51 -50
- package/dist/package/declarations/src/api/system/base_language.d.ts +52 -0
- package/dist/package/declarations/src/api/system/base_translation.d.ts +10 -0
- package/dist/package/declarations/src/api/system/code_gen_i18n.d.ts +8 -0
- package/dist/package/declarations/src/api/system/ops_monitoring.d.ts +19 -0
- package/dist/package/declarations/src/api/system/ops_monitoring_sse.d.ts +12 -0
- package/dist/package/declarations/src/components/DynamicTranslationCell.vue.d.ts +16 -0
- package/dist/package/declarations/src/components/DynamicTranslationEditor.vue.d.ts +20 -0
- package/dist/package/declarations/src/components/dynamicTranslation.d.ts +38 -0
- package/dist/package/declarations/src/locales/generated.d.ts +6536 -0
- package/dist/package/declarations/src/rpc/base/v1/ai_session.d.ts +12 -2
- package/dist/package/declarations/src/rpc/base/v1/ai_tool.d.ts +9 -1
- package/dist/package/declarations/src/rpc/base/v1/config.d.ts +35 -0
- package/dist/package/declarations/src/rpc/system/admin/v1/auth.d.ts +1 -1
- package/dist/package/declarations/src/rpc/system/admin/v1/base_config.d.ts +23 -2
- package/dist/package/declarations/src/rpc/system/admin/v1/base_dict.d.ts +9 -0
- package/dist/package/declarations/src/rpc/system/admin/v1/base_job.d.ts +9 -1
- package/dist/package/declarations/src/rpc/system/admin/v1/base_language.d.ts +119 -0
- package/dist/package/declarations/src/rpc/system/admin/v1/base_menu.d.ts +6 -1
- package/dist/package/declarations/src/rpc/system/admin/v1/base_migration.d.ts +6 -6
- package/dist/package/declarations/src/rpc/system/admin/v1/base_role.d.ts +13 -1
- package/dist/package/declarations/src/rpc/system/admin/v1/base_translation.d.ts +75 -0
- package/dist/package/declarations/src/rpc/system/admin/v1/base_user.d.ts +11 -1
- package/dist/package/declarations/src/rpc/system/admin/v1/code_gen.d.ts +13 -11
- package/dist/package/declarations/src/rpc/system/admin/v1/code_gen_column.d.ts +7 -0
- package/dist/package/declarations/src/rpc/system/admin/v1/code_gen_table.d.ts +24 -1
- package/dist/package/declarations/src/rpc/system/admin/v1/common.d.ts +13 -0
- package/dist/package/declarations/src/rpc/system/admin/v1/ops_monitoring.d.ts +222 -0
- package/dist/package/declarations/src/views/base/language/index.vue.d.ts +3 -0
- package/dist/package/declarations/src/views/tool/code-gen/components/CodeGenLocaleEditor.vue.d.ts +23 -0
- package/dist/package/declarations/src/views/tool/code-gen/config.d.ts +7 -7
- package/dist/package/declarations/src/views/tool/ops-monitoring/index.vue.d.ts +3 -0
- package/dist/package/src/api/base/ai_message.ts +7 -12
- package/dist/package/src/api/base/sse.ts +3 -1
- package/dist/package/src/api/system/base_language.ts +135 -0
- package/dist/package/src/api/system/base_translation.ts +33 -0
- package/dist/package/src/api/system/code_gen_column.ts +17 -3
- package/dist/package/src/api/system/code_gen_i18n.ts +18 -0
- package/dist/package/src/api/system/code_gen_table.ts +12 -4
- package/dist/package/src/api/system/ops_monitoring.ts +88 -0
- package/dist/package/src/api/system/ops_monitoring_sse.ts +49 -0
- package/dist/package/src/components/DynamicTranslationCell.vue +249 -0
- package/dist/package/src/components/DynamicTranslationEditor.vue +197 -0
- package/dist/package/src/components/dynamicTranslation.ts +66 -0
- package/dist/package/src/locales/README.md +30 -0
- package/dist/package/src/locales/en-US.json +933 -0
- package/dist/package/src/locales/es-ES.json +933 -0
- package/dist/package/src/locales/fr-FR.json +933 -0
- package/dist/package/src/locales/generated.ts +22 -0
- package/dist/package/src/locales/ja-JP.json +933 -0
- package/dist/package/src/locales/ko-KR.json +933 -0
- package/dist/package/src/locales/zh-CN.json +933 -0
- package/dist/package/src/locales/zh-TW.json +933 -0
- package/dist/package/src/module.ts +6 -2
- package/dist/package/src/rpc/base/v1/ai_session.ts +13 -2
- package/dist/package/src/rpc/base/v1/ai_tool.ts +10 -1
- package/dist/package/src/rpc/base/v1/config.ts +47 -0
- package/dist/package/src/rpc/system/admin/v1/auth.ts +1 -1
- package/dist/package/src/rpc/system/admin/v1/base_config.ts +24 -2
- package/dist/package/src/rpc/system/admin/v1/base_dict.ts +9 -0
- package/dist/package/src/rpc/system/admin/v1/base_job.ts +10 -1
- package/dist/package/src/rpc/system/admin/v1/base_language.ts +141 -0
- package/dist/package/src/rpc/system/admin/v1/base_menu.ts +6 -1
- package/dist/package/src/rpc/system/admin/v1/base_migration.ts +8 -8
- package/dist/package/src/rpc/system/admin/v1/base_role.ts +14 -1
- package/dist/package/src/rpc/system/admin/v1/base_translation.ts +90 -0
- package/dist/package/src/rpc/system/admin/v1/base_user.ts +12 -1
- package/dist/package/src/rpc/system/admin/v1/code_gen.ts +16 -12
- package/dist/package/src/rpc/system/admin/v1/code_gen_column.ts +8 -0
- package/dist/package/src/rpc/system/admin/v1/code_gen_table.ts +27 -1
- package/dist/package/src/rpc/system/admin/v1/common.ts +21 -0
- package/dist/package/src/rpc/system/admin/v1/ops_monitoring.ts +255 -0
- package/dist/package/src/views/ai/chat/components/AiMarkdown.vue +1 -6
- package/dist/package/src/views/ai/chat/components/ChatPanel.vue +75 -58
- package/dist/package/src/views/ai/chat/components/SessionPanel.vue +20 -9
- package/dist/package/src/views/ai/chat/components/XSender.vue +36 -23
- package/dist/package/src/views/ai/chat/index.vue +58 -41
- package/dist/package/src/views/ai/chat/message.ts +29 -27
- package/dist/package/src/views/base/api/index.vue +121 -84
- package/dist/package/src/views/base/area/index.vue +81 -32
- package/dist/package/src/views/base/config/index.vue +300 -96
- package/dist/package/src/views/base/dept/index.vue +110 -62
- package/dist/package/src/views/base/dict/index.vue +145 -62
- package/dist/package/src/views/base/dict/item.vue +155 -64
- package/dist/package/src/views/base/job/index.vue +134 -82
- package/dist/package/src/views/base/job/log.vue +24 -25
- package/dist/package/src/views/base/language/index.vue +260 -0
- package/dist/package/src/views/base/log/index.vue +68 -46
- package/dist/package/src/views/base/menu/index.vue +344 -200
- package/dist/package/src/views/base/migration/index.vue +49 -29
- package/dist/package/src/views/base/post/index.vue +128 -60
- package/dist/package/src/views/base/role/index.vue +145 -79
- package/dist/package/src/views/base/tenant/index.vue +132 -64
- package/dist/package/src/views/base/user/components/dept-tree.vue +2 -1
- package/dist/package/src/views/base/user/index.vue +194 -116
- package/dist/package/src/views/profile/components/base.vue +45 -28
- package/dist/package/src/views/profile/components/password.vue +45 -30
- package/dist/package/src/views/profile/components/security.vue +90 -54
- package/dist/package/src/views/profile/index.vue +10 -9
- package/dist/package/src/views/tool/api-doc/index.vue +6 -2
- package/dist/package/src/views/tool/code-gen/code-preview/index.vue +32 -16
- package/dist/package/src/views/tool/code-gen/columns/index.vue +382 -273
- package/dist/package/src/views/tool/code-gen/columns/option-copy.ts +1 -6
- package/dist/package/src/views/tool/code-gen/components/CodeGenLocaleEditor.vue +118 -0
- package/dist/package/src/views/tool/code-gen/components/CodeGenProgressDialog.vue +65 -36
- package/dist/package/src/views/tool/code-gen/components/CodePreviewPane.vue +8 -5
- package/dist/package/src/views/tool/code-gen/config.ts +116 -79
- package/dist/package/src/views/tool/code-gen/preview/data.ts +19 -17
- package/dist/package/src/views/tool/code-gen/preview/index.vue +96 -59
- package/dist/package/src/views/tool/code-gen/proto/index.vue +110 -62
- package/dist/package/src/views/tool/code-gen/table/index.vue +201 -121
- package/dist/package/src/views/tool/ops-monitoring/index.vue +1175 -0
- package/dist/package/src/views/tool/project-doc/index.vue +17 -15
- package/package.json +6 -2
- package/dist/package/declarations/src/rpc/base/v1/enum.d.ts +0 -43
- package/dist/package/declarations/src/rpc/system/common/v1/enum.d.ts +0 -67
- package/dist/package/src/rpc/base/v1/enum.ts +0 -54
- package/dist/package/src/rpc/system/common/v1/enum.ts +0 -80
|
@@ -6,12 +6,11 @@
|
|
|
6
6
|
<FormDialog
|
|
7
7
|
v-model="dialog.visible"
|
|
8
8
|
ref="formDialogRef"
|
|
9
|
-
:title="dialog.
|
|
9
|
+
:title="t(dialog.editing ? 'system.base.job.action.edit' : 'system.base.job.action.create')"
|
|
10
10
|
width="1000px"
|
|
11
11
|
:model="formData"
|
|
12
12
|
:fields="formFields"
|
|
13
13
|
:rules="rules"
|
|
14
|
-
label-width="150px"
|
|
15
14
|
@confirm="handleSubmit"
|
|
16
15
|
@close="handleCloseDialog"
|
|
17
16
|
/>
|
|
@@ -22,16 +21,27 @@
|
|
|
22
21
|
import { computed, h, reactive, ref, type VNode } from "vue";
|
|
23
22
|
import { ElButton, ElMessage, ElMessageBox, ElTag } from "element-plus";
|
|
24
23
|
import { CirclePlus, Delete, EditPen, Promotion, Tickets, VideoPause, VideoPlay } from "@element-plus/icons-vue";
|
|
25
|
-
import type {
|
|
24
|
+
import type {
|
|
25
|
+
ColumnProps,
|
|
26
|
+
HeaderActionProps,
|
|
27
|
+
ProTableInstance,
|
|
28
|
+
RenderScope
|
|
29
|
+
} from "@liujitcn/kratos-admin-core/components/ProTable/interface";
|
|
26
30
|
import FormDialog from "@liujitcn/kratos-admin-core/components/Dialog/FormDialog.vue";
|
|
27
31
|
import type { ProFormField, ProFormOption } from "@liujitcn/kratos-admin-core/components/ProForm/interface";
|
|
28
32
|
import ProTable from "@liujitcn/kratos-admin-core/components/ProTable";
|
|
29
33
|
import { useAuthButtons } from "@liujitcn/kratos-admin-core/auth";
|
|
30
34
|
import { defBaseJobService } from "@liujitcn/kratos-admin-system/api/system/base_job";
|
|
31
|
-
import type {
|
|
35
|
+
import type {
|
|
36
|
+
BaseJob,
|
|
37
|
+
BaseJobArgs,
|
|
38
|
+
BaseJobForm,
|
|
39
|
+
PageBaseJobRequest
|
|
40
|
+
} from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_job";
|
|
32
41
|
import router, { navigateTo } from "@liujitcn/kratos-admin-core/navigation";
|
|
33
42
|
import { Status } from "@liujitcn/kratos-admin-system/rpc/common/v1/enum";
|
|
34
43
|
import { buildPageRequest, normalizeSelectedIds } from "@liujitcn/kratos-admin-core/table";
|
|
44
|
+
import { t } from "@liujitcn/kratos-admin-core";
|
|
35
45
|
|
|
36
46
|
defineOptions({
|
|
37
47
|
name: "BaseJob",
|
|
@@ -43,7 +53,7 @@ const proTable = ref<ProTableInstance>();
|
|
|
43
53
|
const formDialogRef = ref<InstanceType<typeof FormDialog>>();
|
|
44
54
|
|
|
45
55
|
const dialog = reactive({
|
|
46
|
-
|
|
56
|
+
editing: false,
|
|
47
57
|
visible: false
|
|
48
58
|
});
|
|
49
59
|
|
|
@@ -64,31 +74,53 @@ const formData = reactive<BaseJobForm>({
|
|
|
64
74
|
|
|
65
75
|
const rules = computed(() => ({
|
|
66
76
|
name: [
|
|
67
|
-
{
|
|
68
|
-
|
|
77
|
+
{
|
|
78
|
+
required: true,
|
|
79
|
+
message: t("common.validation.required_input", { field: t("system.base.job.field.name") }),
|
|
80
|
+
trigger: "blur"
|
|
81
|
+
},
|
|
82
|
+
{ max: 50, message: t("common.validation.max_length", { field: t("system.base.job.field.name"), max: 50 }), trigger: "blur" }
|
|
69
83
|
],
|
|
70
84
|
cron_expression: [
|
|
71
|
-
{
|
|
72
|
-
|
|
85
|
+
{
|
|
86
|
+
required: true,
|
|
87
|
+
message: t("common.validation.required_input", { field: t("system.base.job.field.cron") }),
|
|
88
|
+
trigger: "blur"
|
|
89
|
+
},
|
|
90
|
+
{ max: 50, message: t("common.validation.max_length", { field: t("system.base.job.field.cron"), max: 50 }), trigger: "blur" }
|
|
73
91
|
],
|
|
74
92
|
invoke_target: [
|
|
75
|
-
{
|
|
76
|
-
|
|
93
|
+
{
|
|
94
|
+
required: true,
|
|
95
|
+
message: t("common.validation.required_input", { field: t("system.base.job.field.invoke_target") }),
|
|
96
|
+
trigger: "blur"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
max: 100,
|
|
100
|
+
message: t("common.validation.max_length", { field: t("system.base.job.field.invoke_target"), max: 100 }),
|
|
101
|
+
trigger: "blur"
|
|
102
|
+
}
|
|
77
103
|
],
|
|
78
104
|
args: {
|
|
79
105
|
validator: (rule: unknown, value: BaseJobArgs[], callback: (error?: Error) => void) => {
|
|
80
|
-
if (value.some(arg => !arg.key)) callback(new Error("
|
|
106
|
+
if (value.some(arg => !arg.key)) callback(new Error(t("system.base.job.validation.arg_key_required")));
|
|
81
107
|
else callback();
|
|
82
108
|
},
|
|
83
109
|
trigger: "blur"
|
|
84
110
|
},
|
|
85
|
-
status: [
|
|
111
|
+
status: [
|
|
112
|
+
{
|
|
113
|
+
required: true,
|
|
114
|
+
message: t("common.validation.required_select", { field: t("common.field.status") }),
|
|
115
|
+
trigger: "blur"
|
|
116
|
+
}
|
|
117
|
+
]
|
|
86
118
|
}));
|
|
87
119
|
|
|
88
|
-
const statusOptions
|
|
89
|
-
{ label: "
|
|
90
|
-
{ label: "
|
|
91
|
-
];
|
|
120
|
+
const statusOptions = computed<ProFormOption[]>(() => [
|
|
121
|
+
{ label: t("common.status.enabled"), value: Status.ENABLE },
|
|
122
|
+
{ label: t("common.status.disabled"), value: Status.DISABLE }
|
|
123
|
+
]);
|
|
92
124
|
|
|
93
125
|
/**
|
|
94
126
|
* 渲染任务参数标签,便于在列表中快速查看键值对。
|
|
@@ -130,7 +162,7 @@ function renderOperationCell(scope: RenderScope<BaseJob>) {
|
|
|
130
162
|
icon: EditPen,
|
|
131
163
|
onClick: () => handleOpenDialog(row.id)
|
|
132
164
|
},
|
|
133
|
-
() => "
|
|
165
|
+
() => t("common.action.edit")
|
|
134
166
|
)
|
|
135
167
|
);
|
|
136
168
|
}
|
|
@@ -146,7 +178,7 @@ function renderOperationCell(scope: RenderScope<BaseJob>) {
|
|
|
146
178
|
icon: Delete,
|
|
147
179
|
onClick: () => handleDelete(row)
|
|
148
180
|
},
|
|
149
|
-
() => "
|
|
181
|
+
() => t("common.action.delete")
|
|
150
182
|
)
|
|
151
183
|
);
|
|
152
184
|
}
|
|
@@ -163,7 +195,7 @@ function renderOperationCell(scope: RenderScope<BaseJob>) {
|
|
|
163
195
|
class: "job-action job-action--start",
|
|
164
196
|
onClick: () => handleStart(row.id, row.name)
|
|
165
197
|
},
|
|
166
|
-
() => "
|
|
198
|
+
() => t("system.base.job.action.start")
|
|
167
199
|
)
|
|
168
200
|
);
|
|
169
201
|
}
|
|
@@ -180,7 +212,7 @@ function renderOperationCell(scope: RenderScope<BaseJob>) {
|
|
|
180
212
|
class: "job-action job-action--stop",
|
|
181
213
|
onClick: () => handleStop(row.id, row.name)
|
|
182
214
|
},
|
|
183
|
-
() => "
|
|
215
|
+
() => t("system.base.job.action.stop")
|
|
184
216
|
)
|
|
185
217
|
);
|
|
186
218
|
}
|
|
@@ -197,7 +229,7 @@ function renderOperationCell(scope: RenderScope<BaseJob>) {
|
|
|
197
229
|
class: "job-action job-action--exec",
|
|
198
230
|
onClick: () => handleExec(row.id, row.name)
|
|
199
231
|
},
|
|
200
|
-
() => "
|
|
232
|
+
() => t("system.base.job.action.execute")
|
|
201
233
|
)
|
|
202
234
|
);
|
|
203
235
|
}
|
|
@@ -214,7 +246,7 @@ function renderOperationCell(scope: RenderScope<BaseJob>) {
|
|
|
214
246
|
class: "job-action job-action--log",
|
|
215
247
|
onClick: () => handleOpenBaseJob(row.id, row.name)
|
|
216
248
|
},
|
|
217
|
-
() => "
|
|
249
|
+
() => t("system.base.job.action.log")
|
|
218
250
|
)
|
|
219
251
|
);
|
|
220
252
|
}
|
|
@@ -231,75 +263,95 @@ function renderOperationCell(scope: RenderScope<BaseJob>) {
|
|
|
231
263
|
}
|
|
232
264
|
|
|
233
265
|
/** 定时任务表单字段配置。 */
|
|
234
|
-
const formFields
|
|
235
|
-
{
|
|
236
|
-
|
|
237
|
-
|
|
266
|
+
const formFields = computed<ProFormField[]>(() => [
|
|
267
|
+
{
|
|
268
|
+
prop: "name",
|
|
269
|
+
label: t("system.base.job.field.name"),
|
|
270
|
+
component: "input",
|
|
271
|
+
props: { placeholder: t("system.base.job.placeholder.name") }
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
prop: "invoke_target",
|
|
275
|
+
label: t("system.base.job.field.invoke_target"),
|
|
276
|
+
component: "input",
|
|
277
|
+
props: { placeholder: t("system.base.job.placeholder.invoke_target") }
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
prop: "cron_expression",
|
|
281
|
+
label: t("system.base.job.field.cron"),
|
|
282
|
+
component: "cron-expression",
|
|
283
|
+
props: { placeholder: "0 0 0 * * *" }
|
|
284
|
+
},
|
|
238
285
|
{
|
|
239
286
|
prop: "args",
|
|
240
|
-
label: "
|
|
287
|
+
label: t("system.base.job.field.args"),
|
|
241
288
|
component: "kv-list",
|
|
242
289
|
props: {
|
|
243
|
-
keyInputProps: { placeholder: "
|
|
244
|
-
valueInputProps: { placeholder: "
|
|
245
|
-
addText: "
|
|
290
|
+
keyInputProps: { placeholder: t("system.base.job.field.arg_key") },
|
|
291
|
+
valueInputProps: { placeholder: t("system.base.job.field.arg_value") },
|
|
292
|
+
addText: t("system.base.job.action.add_arg")
|
|
246
293
|
}
|
|
247
294
|
},
|
|
248
|
-
{ prop: "status", label: "
|
|
249
|
-
];
|
|
295
|
+
{ prop: "status", label: t("common.field.status"), component: "radio-group", options: statusOptions.value }
|
|
296
|
+
]);
|
|
250
297
|
|
|
251
298
|
/** 定时任务表格列配置。 */
|
|
252
|
-
const columns
|
|
299
|
+
const columns = computed<ColumnProps[]>(() => [
|
|
253
300
|
{ type: "selection", width: 55 },
|
|
254
|
-
{ prop: "name", label: "
|
|
255
|
-
{ prop: "invoke_target", label: "
|
|
256
|
-
{
|
|
257
|
-
|
|
258
|
-
|
|
301
|
+
{ prop: "name", label: t("system.base.job.field.name"), minWidth: 140, search: { el: "input" } },
|
|
302
|
+
{ prop: "invoke_target", label: t("system.base.job.field.invoke_target"), minWidth: 180, search: { el: "input" } },
|
|
303
|
+
{
|
|
304
|
+
prop: "args",
|
|
305
|
+
label: t("system.base.job.field.args_short"),
|
|
306
|
+
minWidth: 140,
|
|
307
|
+
render: scope => renderArgsCell(scope as unknown as RenderScope<BaseJob>)
|
|
308
|
+
},
|
|
309
|
+
{ prop: "cron_expression", label: t("system.base.job.field.cron"), minWidth: 150 },
|
|
310
|
+
{ prop: "entry_id", label: t("system.base.job.field.entry_id"), minWidth: 100, align: "right" },
|
|
259
311
|
{
|
|
260
312
|
prop: "status",
|
|
261
|
-
label: "
|
|
313
|
+
label: t("common.field.status"),
|
|
262
314
|
minWidth: 100,
|
|
263
315
|
search: { el: "select" },
|
|
264
316
|
cellType: "status",
|
|
265
317
|
statusProps: {
|
|
266
318
|
activeValue: Status.ENABLE,
|
|
267
319
|
inactiveValue: Status.DISABLE,
|
|
268
|
-
activeText: "
|
|
269
|
-
inactiveText: "
|
|
320
|
+
activeText: t("common.status.enabled"),
|
|
321
|
+
inactiveText: t("common.status.disabled"),
|
|
270
322
|
disabled: scope => (scope.row as BaseJob).entry_id === 0 || !BUTTONS.value["base:job:status"],
|
|
271
323
|
beforeChange: scope => handleBeforeSetStatus(scope.row as BaseJob)
|
|
272
324
|
}
|
|
273
325
|
},
|
|
274
|
-
{ prop: "created_at", label: "
|
|
275
|
-
{ prop: "updated_at", label: "
|
|
326
|
+
{ prop: "created_at", label: t("common.field.created_at"), minWidth: 180 },
|
|
327
|
+
{ prop: "updated_at", label: t("common.field.updated_at"), minWidth: 180 },
|
|
276
328
|
{
|
|
277
329
|
prop: "operation",
|
|
278
|
-
label: "
|
|
330
|
+
label: t("common.field.action"),
|
|
279
331
|
width: 380,
|
|
280
332
|
fixed: "right",
|
|
281
333
|
render: scope => renderOperationCell(scope as unknown as RenderScope<BaseJob>)
|
|
282
334
|
}
|
|
283
|
-
];
|
|
335
|
+
]);
|
|
284
336
|
|
|
285
337
|
/** 定时任务顶部按钮配置。 */
|
|
286
|
-
const headerActions
|
|
338
|
+
const headerActions = computed<HeaderActionProps[]>(() => [
|
|
287
339
|
{
|
|
288
|
-
label: "
|
|
340
|
+
label: t("common.action.create"),
|
|
289
341
|
type: "success",
|
|
290
342
|
icon: CirclePlus,
|
|
291
343
|
hidden: () => !BUTTONS.value["base:job:create"],
|
|
292
344
|
onClick: () => handleOpenDialog()
|
|
293
345
|
},
|
|
294
346
|
{
|
|
295
|
-
label: "
|
|
347
|
+
label: t("common.action.delete"),
|
|
296
348
|
type: "danger",
|
|
297
349
|
icon: Delete,
|
|
298
350
|
hidden: () => !BUTTONS.value["base:job:delete"],
|
|
299
351
|
disabled: scope => !scope.selectedList.length,
|
|
300
352
|
onClick: scope => handleDelete(scope.selectedList as BaseJob[])
|
|
301
353
|
}
|
|
302
|
-
];
|
|
354
|
+
]);
|
|
303
355
|
|
|
304
356
|
/**
|
|
305
357
|
* 请求定时任务列表,并由 ProTable 统一维护分页与搜索参数。
|
|
@@ -321,7 +373,7 @@ function refreshTable() {
|
|
|
321
373
|
*/
|
|
322
374
|
function handleOpenDialog(jobId?: number) {
|
|
323
375
|
resetForm();
|
|
324
|
-
dialog.
|
|
376
|
+
dialog.editing = Boolean(jobId);
|
|
325
377
|
dialog.visible = true;
|
|
326
378
|
if (!jobId) return;
|
|
327
379
|
|
|
@@ -364,7 +416,7 @@ function handleSubmit() {
|
|
|
364
416
|
? defBaseJobService.UpdateBaseJob({ base_job: submitData })
|
|
365
417
|
: defBaseJobService.CreateBaseJob({ base_job: submitData });
|
|
366
418
|
request.then(() => {
|
|
367
|
-
ElMessage.success(submitData.id ? "
|
|
419
|
+
ElMessage.success(t(submitData.id ? "system.base.job.message.update_success" : "system.base.job.message.create_success"));
|
|
368
420
|
handleCloseDialog();
|
|
369
421
|
refreshTable();
|
|
370
422
|
});
|
|
@@ -376,16 +428,16 @@ function handleSubmit() {
|
|
|
376
428
|
*/
|
|
377
429
|
async function handleBeforeSetStatus(row: BaseJob) {
|
|
378
430
|
const nextStatus = row.status === Status.ENABLE ? Status.DISABLE : Status.ENABLE;
|
|
379
|
-
const
|
|
431
|
+
const action = t(nextStatus === Status.ENABLE ? "common.status.enabled" : "common.status.disabled");
|
|
380
432
|
const jobName = row.name || row.invoke_target || `ID:${row.id}`;
|
|
381
433
|
try {
|
|
382
|
-
await ElMessageBox.confirm(
|
|
383
|
-
confirmButtonText: "
|
|
384
|
-
cancelButtonText: "
|
|
434
|
+
await ElMessageBox.confirm(t("system.base.job.message.confirm_status", { action, name: jobName }), t("common.title.notice"), {
|
|
435
|
+
confirmButtonText: t("common.action.confirm"),
|
|
436
|
+
cancelButtonText: t("common.action.cancel"),
|
|
385
437
|
type: "warning"
|
|
386
438
|
});
|
|
387
439
|
await defBaseJobService.SetBaseJobStatus({ id: row.id, status: nextStatus });
|
|
388
|
-
ElMessage.success(
|
|
440
|
+
ElMessage.success(t("common.message.status_success", { action }));
|
|
389
441
|
refreshTable();
|
|
390
442
|
return true;
|
|
391
443
|
} catch {
|
|
@@ -406,30 +458,30 @@ function handleDelete(selected?: number | string | Array<number | string> | Base
|
|
|
406
458
|
jobList.length ? jobList.map(item => item.id) : normalizeSelectedIds(selected as number | string | Array<number | string>)
|
|
407
459
|
).join(",");
|
|
408
460
|
if (!jobIds) {
|
|
409
|
-
ElMessage.warning("
|
|
461
|
+
ElMessage.warning(t("common.message.select_delete_item"));
|
|
410
462
|
return;
|
|
411
463
|
}
|
|
412
464
|
|
|
413
465
|
const singleJobName = jobList[0]?.name || jobList[0]?.invoke_target || `ID:${jobList[0]?.id ?? ""}`;
|
|
414
466
|
const confirmMessage = jobList.length
|
|
415
467
|
? jobList.length === 1
|
|
416
|
-
?
|
|
417
|
-
:
|
|
418
|
-
: "
|
|
468
|
+
? t("system.base.job.message.confirm_delete_single", { name: singleJobName })
|
|
469
|
+
: t("system.base.job.message.confirm_delete_batch", { count: jobList.length })
|
|
470
|
+
: t("system.base.job.message.confirm_delete_selected");
|
|
419
471
|
|
|
420
|
-
ElMessageBox.confirm(confirmMessage, "
|
|
421
|
-
confirmButtonText: "
|
|
422
|
-
cancelButtonText: "
|
|
472
|
+
ElMessageBox.confirm(confirmMessage, t("common.title.warning"), {
|
|
473
|
+
confirmButtonText: t("common.action.confirm"),
|
|
474
|
+
cancelButtonText: t("common.action.cancel"),
|
|
423
475
|
type: "warning"
|
|
424
476
|
}).then(
|
|
425
477
|
() => {
|
|
426
478
|
defBaseJobService.DeleteBaseJob({ id: jobIds }).then(() => {
|
|
427
|
-
ElMessage.success("
|
|
479
|
+
ElMessage.success(t("system.base.job.message.delete_success"));
|
|
428
480
|
refreshTable();
|
|
429
481
|
});
|
|
430
482
|
},
|
|
431
483
|
() => {
|
|
432
|
-
ElMessage.info("
|
|
484
|
+
ElMessage.info(t("system.base.job.message.delete_canceled"));
|
|
433
485
|
}
|
|
434
486
|
);
|
|
435
487
|
}
|
|
@@ -438,19 +490,19 @@ function handleDelete(selected?: number | string | Array<number | string> | Base
|
|
|
438
490
|
* 启动定时任务。
|
|
439
491
|
*/
|
|
440
492
|
function handleStart(id: number, name: string) {
|
|
441
|
-
ElMessageBox.confirm(
|
|
442
|
-
confirmButtonText: "
|
|
443
|
-
cancelButtonText: "
|
|
493
|
+
ElMessageBox.confirm(t("system.base.job.message.confirm_start", { name }), t("common.title.warning"), {
|
|
494
|
+
confirmButtonText: t("common.action.confirm"),
|
|
495
|
+
cancelButtonText: t("common.action.cancel"),
|
|
444
496
|
type: "warning"
|
|
445
497
|
}).then(
|
|
446
498
|
() => {
|
|
447
499
|
defBaseJobService.StartBaseJob({ id }).then(() => {
|
|
448
|
-
ElMessage.success("
|
|
500
|
+
ElMessage.success(t("system.base.job.message.start_success"));
|
|
449
501
|
refreshTable();
|
|
450
502
|
});
|
|
451
503
|
},
|
|
452
504
|
() => {
|
|
453
|
-
ElMessage.info("
|
|
505
|
+
ElMessage.info(t("system.base.job.message.start_canceled"));
|
|
454
506
|
}
|
|
455
507
|
);
|
|
456
508
|
}
|
|
@@ -459,19 +511,19 @@ function handleStart(id: number, name: string) {
|
|
|
459
511
|
* 停止定时任务。
|
|
460
512
|
*/
|
|
461
513
|
function handleStop(id: number, name: string) {
|
|
462
|
-
ElMessageBox.confirm(
|
|
463
|
-
confirmButtonText: "
|
|
464
|
-
cancelButtonText: "
|
|
514
|
+
ElMessageBox.confirm(t("system.base.job.message.confirm_stop", { name }), t("common.title.warning"), {
|
|
515
|
+
confirmButtonText: t("common.action.confirm"),
|
|
516
|
+
cancelButtonText: t("common.action.cancel"),
|
|
465
517
|
type: "warning"
|
|
466
518
|
}).then(
|
|
467
519
|
() => {
|
|
468
520
|
defBaseJobService.StopBaseJob({ id }).then(() => {
|
|
469
|
-
ElMessage.success("
|
|
521
|
+
ElMessage.success(t("system.base.job.message.stop_success"));
|
|
470
522
|
refreshTable();
|
|
471
523
|
});
|
|
472
524
|
},
|
|
473
525
|
() => {
|
|
474
|
-
ElMessage.info("
|
|
526
|
+
ElMessage.info(t("system.base.job.message.stop_canceled"));
|
|
475
527
|
}
|
|
476
528
|
);
|
|
477
529
|
}
|
|
@@ -480,19 +532,19 @@ function handleStop(id: number, name: string) {
|
|
|
480
532
|
* 执行一次定时任务。
|
|
481
533
|
*/
|
|
482
534
|
function handleExec(id: number, name: string) {
|
|
483
|
-
ElMessageBox.confirm(
|
|
484
|
-
confirmButtonText: "
|
|
485
|
-
cancelButtonText: "
|
|
535
|
+
ElMessageBox.confirm(t("system.base.job.message.confirm_execute", { name }), t("common.title.warning"), {
|
|
536
|
+
confirmButtonText: t("common.action.confirm"),
|
|
537
|
+
cancelButtonText: t("common.action.cancel"),
|
|
486
538
|
type: "warning"
|
|
487
539
|
}).then(
|
|
488
540
|
() => {
|
|
489
541
|
defBaseJobService.ExecuteBaseJob({ id }).then(() => {
|
|
490
|
-
ElMessage.success("
|
|
542
|
+
ElMessage.success(t("system.base.job.message.execute_success"));
|
|
491
543
|
refreshTable();
|
|
492
544
|
});
|
|
493
545
|
},
|
|
494
546
|
() => {
|
|
495
|
-
ElMessage.info("
|
|
547
|
+
ElMessage.info(t("system.base.job.message.execute_canceled"));
|
|
496
548
|
}
|
|
497
549
|
);
|
|
498
550
|
}
|
|
@@ -501,7 +553,7 @@ function handleExec(id: number, name: string) {
|
|
|
501
553
|
* 打开定时任务日志页面。
|
|
502
554
|
*/
|
|
503
555
|
function handleOpenBaseJob(id: number, name: string) {
|
|
504
|
-
navigateTo(router, "/base/job/log", { jobId: id, title:
|
|
556
|
+
navigateTo(router, "/base/job/log", { jobId: id, title: t("system.base.job.title.log", { name }) });
|
|
505
557
|
}
|
|
506
558
|
</script>
|
|
507
559
|
|
|
@@ -2,28 +2,28 @@
|
|
|
2
2
|
<div class="table-box">
|
|
3
3
|
<ProTable ref="proTable" row-key="id" :columns="columns" :request-api="requestBaseJobLogTable" />
|
|
4
4
|
|
|
5
|
-
<ProDialog v-model="dialog.visible" :title="
|
|
5
|
+
<ProDialog v-model="dialog.visible" :title="t('system.base.job.log.title.detail')" width="1200px" @close="handleCloseDialog">
|
|
6
6
|
<div class="detail-container">
|
|
7
|
-
<el-descriptions title="
|
|
8
|
-
<el-descriptions-item label="
|
|
7
|
+
<el-descriptions :title="t('system.base.job.log.section.basic')" border :column="2">
|
|
8
|
+
<el-descriptions-item :label="t('common.field.status')">
|
|
9
9
|
<DictLabel v-model="detail.status" code="base_job_log_status" />
|
|
10
10
|
</el-descriptions-item>
|
|
11
|
-
<el-descriptions-item label="
|
|
12
|
-
<el-descriptions-item label="
|
|
11
|
+
<el-descriptions-item :label="t('system.base.job.log.field.process_time')">{{ detail.process_time }}</el-descriptions-item>
|
|
12
|
+
<el-descriptions-item :label="t('system.base.job.log.field.execute_time')">{{ detail.execute_time }}</el-descriptions-item>
|
|
13
13
|
</el-descriptions>
|
|
14
14
|
|
|
15
|
-
<el-descriptions title="
|
|
16
|
-
<el-descriptions-item label="
|
|
15
|
+
<el-descriptions :title="t('system.base.job.log.section.execution')" border :column="1" class="mt-4">
|
|
16
|
+
<el-descriptions-item :label="t('system.base.job.log.field.input')">
|
|
17
17
|
<pre class="code-block">{{ formatJson(detail.input) }}</pre>
|
|
18
18
|
</el-descriptions-item>
|
|
19
|
-
<el-descriptions-item label="
|
|
19
|
+
<el-descriptions-item :label="t('system.base.job.log.field.output')">
|
|
20
20
|
<pre class="code-block">{{ formatJson(detail.output) }}</pre>
|
|
21
21
|
</el-descriptions-item>
|
|
22
22
|
</el-descriptions>
|
|
23
23
|
|
|
24
24
|
<el-alert
|
|
25
|
-
v-if="detail.status === BaseJobLogStatus.
|
|
26
|
-
title="
|
|
25
|
+
v-if="detail.status === BaseJobLogStatus.BASE_JOB_LOG_STATUS_FAIL"
|
|
26
|
+
:title="t('system.base.job.log.field.error')"
|
|
27
27
|
type="error"
|
|
28
28
|
:description="detail.error"
|
|
29
29
|
class="mt-4"
|
|
@@ -32,14 +32,14 @@
|
|
|
32
32
|
</div>
|
|
33
33
|
|
|
34
34
|
<template #footer>
|
|
35
|
-
<el-button @click="handleCloseDialog"
|
|
35
|
+
<el-button @click="handleCloseDialog">{{ t("common.action.close") }}</el-button>
|
|
36
36
|
</template>
|
|
37
37
|
</ProDialog>
|
|
38
38
|
</div>
|
|
39
39
|
</template>
|
|
40
40
|
|
|
41
41
|
<script setup lang="ts">
|
|
42
|
-
import { reactive, ref, watch } from "vue";
|
|
42
|
+
import { computed, reactive, ref, watch } from "vue";
|
|
43
43
|
import { useRoute } from "vue-router";
|
|
44
44
|
import { InfoFilled } from "@element-plus/icons-vue";
|
|
45
45
|
import type { ColumnProps, ProTableInstance } from "@liujitcn/kratos-admin-core/components/ProTable/interface";
|
|
@@ -49,7 +49,8 @@ import { defBaseJobService } from "@liujitcn/kratos-admin-system/api/system/base
|
|
|
49
49
|
import { buildPageRequest } from "@liujitcn/kratos-admin-core/table";
|
|
50
50
|
import { formatJson } from "@liujitcn/kratos-admin-core/format";
|
|
51
51
|
import type { BaseJobLog, PageBaseJobLogRequest } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_job";
|
|
52
|
-
import { BaseJobLogStatus } from "@liujitcn/kratos-admin-system/rpc/system/
|
|
52
|
+
import { BaseJobLogStatus } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_job";
|
|
53
|
+
import { t } from "@liujitcn/kratos-admin-core";
|
|
53
54
|
|
|
54
55
|
defineOptions({
|
|
55
56
|
name: "BaseJobLog",
|
|
@@ -61,7 +62,6 @@ const proTable = ref<ProTableInstance>();
|
|
|
61
62
|
const jobId = ref(Number(route.query.jobId ?? 0));
|
|
62
63
|
|
|
63
64
|
const dialog = reactive({
|
|
64
|
-
title: "",
|
|
65
65
|
visible: false
|
|
66
66
|
});
|
|
67
67
|
|
|
@@ -79,7 +79,7 @@ function createDefaultDetail(): BaseJobLog {
|
|
|
79
79
|
/** 错误信息 */
|
|
80
80
|
error: "",
|
|
81
81
|
/** 状态 */
|
|
82
|
-
status: BaseJobLogStatus.
|
|
82
|
+
status: BaseJobLogStatus.BASE_JOB_LOG_STATUS_UNSPECIFIED,
|
|
83
83
|
/** 消耗时间 */
|
|
84
84
|
process_time: "",
|
|
85
85
|
/** 执行时间 */
|
|
@@ -90,17 +90,17 @@ function createDefaultDetail(): BaseJobLog {
|
|
|
90
90
|
const detail = reactive<BaseJobLog>(createDefaultDetail());
|
|
91
91
|
|
|
92
92
|
/** 定时任务日志表格列配置。 */
|
|
93
|
-
const columns
|
|
93
|
+
const columns = computed<ColumnProps[]>(() => [
|
|
94
94
|
{
|
|
95
95
|
prop: "status",
|
|
96
|
-
label: "
|
|
96
|
+
label: t("common.field.status"),
|
|
97
97
|
minWidth: 120,
|
|
98
98
|
dictCode: "base_job_log_status",
|
|
99
99
|
search: { el: "select" }
|
|
100
100
|
},
|
|
101
101
|
{
|
|
102
102
|
prop: "execute_time",
|
|
103
|
-
label: "
|
|
103
|
+
label: t("system.base.job.log.field.execute_time"),
|
|
104
104
|
minWidth: 180,
|
|
105
105
|
search: {
|
|
106
106
|
el: "date-picker",
|
|
@@ -109,22 +109,22 @@ const columns: ColumnProps[] = [
|
|
|
109
109
|
editable: false,
|
|
110
110
|
class: "!w-[240px]",
|
|
111
111
|
rangeSeparator: "~",
|
|
112
|
-
startPlaceholder: "
|
|
113
|
-
endPlaceholder: "
|
|
112
|
+
startPlaceholder: t("common.placeholder.start_date"),
|
|
113
|
+
endPlaceholder: t("common.placeholder.end_date"),
|
|
114
114
|
valueFormat: "YYYY-MM-DD"
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
},
|
|
118
|
-
{ prop: "process_time", label: "
|
|
118
|
+
{ prop: "process_time", label: t("system.base.job.log.field.process_time_ms"), minWidth: 130, align: "right" },
|
|
119
119
|
{
|
|
120
120
|
prop: "detailAction",
|
|
121
|
-
label: "
|
|
121
|
+
label: t("common.field.action"),
|
|
122
122
|
width: 100,
|
|
123
123
|
fixed: "right",
|
|
124
124
|
cellType: "actions",
|
|
125
125
|
actions: [
|
|
126
126
|
{
|
|
127
|
-
label: "
|
|
127
|
+
label: t("common.action.view"),
|
|
128
128
|
type: "primary",
|
|
129
129
|
link: true,
|
|
130
130
|
icon: InfoFilled,
|
|
@@ -132,7 +132,7 @@ const columns: ColumnProps[] = [
|
|
|
132
132
|
}
|
|
133
133
|
]
|
|
134
134
|
}
|
|
135
|
-
];
|
|
135
|
+
]);
|
|
136
136
|
|
|
137
137
|
watch(
|
|
138
138
|
() => route.query.jobId,
|
|
@@ -155,7 +155,6 @@ async function requestBaseJobLogTable(params: PageBaseJobLogRequest) {
|
|
|
155
155
|
*/
|
|
156
156
|
function handleOpenDialog(logId?: number) {
|
|
157
157
|
resetDetail();
|
|
158
|
-
dialog.title = "定时任务日志详情";
|
|
159
158
|
dialog.visible = true;
|
|
160
159
|
if (!logId) return;
|
|
161
160
|
|