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