@liujitcn/kratos-admin-system 0.0.21 → 0.0.24
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/dist/package/declarations/src/api/system/base_language.d.ts +5 -4
- package/dist/package/declarations/src/api/system/base_translation.d.ts +7 -4
- 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 +9 -32
- package/dist/package/declarations/src/components/DynamicTranslationEditor.vue.d.ts +3 -6
- package/dist/package/declarations/src/components/dynamicTranslation.d.ts +11 -17
- 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 -7
- package/dist/package/declarations/src/rpc/system/admin/v1/base_dict.d.ts +7 -77
- 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 +7 -2
- package/dist/package/declarations/src/rpc/system/admin/v1/base_menu.d.ts +5 -40
- 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 +54 -81
- 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 +11 -11
- package/dist/package/declarations/src/rpc/system/admin/v1/code_gen_table.d.ts +11 -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/tool/ops-monitoring/index.vue.d.ts +3 -0
- package/dist/package/src/api/base/ai_message.ts +2 -2
- package/dist/package/src/api/system/base_language.ts +13 -15
- package/dist/package/src/api/system/base_translation.ts +17 -6
- 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 +199 -126
- package/dist/package/src/components/DynamicTranslationEditor.vue +109 -78
- package/dist/package/src/components/dynamicTranslation.ts +11 -31
- package/dist/package/src/locales/README.md +7 -5
- package/dist/package/src/locales/en-US.json +876 -872
- package/dist/package/src/locales/es-ES.json +900 -895
- package/dist/package/src/locales/fr-FR.json +896 -891
- package/dist/package/src/locales/generated.ts +22 -0
- package/dist/package/src/locales/ja-JP.json +876 -872
- package/dist/package/src/locales/ko-KR.json +881 -876
- package/dist/package/src/locales/zh-CN.json +876 -872
- package/dist/package/src/locales/zh-TW.json +876 -871
- package/dist/package/src/module.ts +3 -17
- 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 -7
- package/dist/package/src/rpc/system/admin/v1/base_dict.ts +7 -79
- package/dist/package/src/rpc/system/admin/v1/base_job.ts +10 -1
- package/dist/package/src/rpc/system/admin/v1/base_language.ts +8 -2
- package/dist/package/src/rpc/system/admin/v1/base_menu.ts +5 -41
- 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 +54 -81
- package/dist/package/src/rpc/system/admin/v1/base_user.ts +12 -1
- package/dist/package/src/rpc/system/admin/v1/code_gen.ts +11 -11
- package/dist/package/src/rpc/system/admin/v1/code_gen_table.ts +12 -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/ChatPanel.vue +36 -36
- package/dist/package/src/views/ai/chat/components/SessionPanel.vue +6 -6
- package/dist/package/src/views/ai/chat/components/XSender.vue +20 -20
- package/dist/package/src/views/ai/chat/index.vue +33 -32
- package/dist/package/src/views/ai/chat/message.ts +16 -15
- package/dist/package/src/views/base/api/index.vue +55 -56
- package/dist/package/src/views/base/area/index.vue +18 -19
- package/dist/package/src/views/base/config/index.vue +143 -133
- package/dist/package/src/views/base/dept/index.vue +42 -43
- package/dist/package/src/views/base/dict/index.vue +49 -45
- package/dist/package/src/views/base/dict/item.vue +54 -49
- package/dist/package/src/views/base/job/index.vue +51 -52
- package/dist/package/src/views/base/job/log.vue +18 -18
- package/dist/package/src/views/{tool → base}/language/index.vue +51 -47
- package/dist/package/src/views/base/log/index.vue +40 -40
- package/dist/package/src/views/base/menu/index.vue +220 -177
- package/dist/package/src/views/base/migration/index.vue +24 -24
- package/dist/package/src/views/base/post/index.vue +42 -43
- package/dist/package/src/views/base/role/index.vue +54 -55
- package/dist/package/src/views/base/tenant/index.vue +42 -43
- package/dist/package/src/views/base/user/components/dept-tree.vue +1 -1
- package/dist/package/src/views/base/user/index.vue +69 -71
- package/dist/package/src/views/profile/components/base.vue +9 -9
- package/dist/package/src/views/profile/components/password.vue +19 -20
- package/dist/package/src/views/profile/components/security.vue +20 -20
- package/dist/package/src/views/profile/index.vue +3 -3
- package/dist/package/src/views/tool/api-doc/index.vue +1 -1
- package/dist/package/src/views/tool/code-gen/code-preview/index.vue +13 -13
- package/dist/package/src/views/tool/code-gen/columns/index.vue +89 -89
- package/dist/package/src/views/tool/code-gen/components/CodeGenLocaleEditor.vue +5 -5
- package/dist/package/src/views/tool/code-gen/components/CodeGenProgressDialog.vue +21 -21
- package/dist/package/src/views/tool/code-gen/components/CodePreviewPane.vue +5 -5
- package/dist/package/src/views/tool/code-gen/config.ts +60 -60
- package/dist/package/src/views/tool/code-gen/preview/data.ts +2 -2
- package/dist/package/src/views/tool/code-gen/preview/index.vue +30 -31
- package/dist/package/src/views/tool/code-gen/proto/index.vue +43 -43
- package/dist/package/src/views/tool/code-gen/table/index.vue +95 -95
- package/dist/package/src/views/tool/ops-monitoring/index.vue +1175 -0
- package/dist/package/src/views/tool/project-doc/index.vue +7 -7
- package/package.json +2 -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
- /package/dist/package/declarations/src/views/{tool → base}/language/index.vue.d.ts +0 -0
|
@@ -12,19 +12,18 @@
|
|
|
12
12
|
<FormDialog
|
|
13
13
|
v-model="dialog.visible"
|
|
14
14
|
ref="formDialogRef"
|
|
15
|
-
:title="t(dialog.editing ? 'system.
|
|
15
|
+
:title="t(dialog.editing ? 'system.base.dict.item.action.edit' : 'system.base.dict.item.action.create')"
|
|
16
16
|
width="820px"
|
|
17
17
|
:model="formData"
|
|
18
18
|
:fields="formFields"
|
|
19
19
|
:rules="rules"
|
|
20
|
-
label-width="100px"
|
|
21
20
|
@confirm="handleSubmit"
|
|
22
21
|
@close="handleCloseDialog"
|
|
23
22
|
>
|
|
24
23
|
<template #tagTypeField>
|
|
25
24
|
<div class="dict-item-tag-type">
|
|
26
25
|
<el-tag v-if="formData.tag_type" :type="formatTagType(formData.tag_type)" class="mr-2">
|
|
27
|
-
{{ formData.label || t("system.
|
|
26
|
+
{{ formData.label || t("system.base.dict.item.value.tag_preview") }}
|
|
28
27
|
</el-tag>
|
|
29
28
|
<el-radio-group v-model="formData.tag_type">
|
|
30
29
|
<el-radio value="success" border size="small">success</el-radio>
|
|
@@ -32,16 +31,14 @@
|
|
|
32
31
|
<el-radio value="info" border size="small">info</el-radio>
|
|
33
32
|
<el-radio value="primary" border size="small">primary</el-radio>
|
|
34
33
|
<el-radio value="danger" border size="small">danger</el-radio>
|
|
35
|
-
<el-radio value="" border size="small">{{ t("system.
|
|
34
|
+
<el-radio value="" border size="small">{{ t("system.base.dict.item.action.clear_tag") }}</el-radio>
|
|
36
35
|
</el-radio-group>
|
|
37
36
|
</div>
|
|
38
37
|
</template>
|
|
39
38
|
<template #translations>
|
|
40
39
|
<DynamicTranslationEditor
|
|
41
40
|
v-model="translationValues"
|
|
42
|
-
:
|
|
43
|
-
:resource-type="TranslationResourceType.TRANSLATION_RESOURCE_TYPE_DICT_ITEM"
|
|
44
|
-
:draft-enabled="configStore.translationDraftEnabled"
|
|
41
|
+
:source="formData.label"
|
|
45
42
|
:maxlength="100"
|
|
46
43
|
/>
|
|
47
44
|
</template>
|
|
@@ -72,9 +69,9 @@ import type {
|
|
|
72
69
|
PageBaseDictItemRequest
|
|
73
70
|
} from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_dict";
|
|
74
71
|
import { Status } from "@liujitcn/kratos-admin-system/rpc/common/v1/enum";
|
|
72
|
+
import { TranslationTargetType } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_translation";
|
|
75
73
|
import { buildPageRequest, normalizeSelectedIds } from "@liujitcn/kratos-admin-core/table";
|
|
76
74
|
import { t } from "@liujitcn/kratos-admin-core";
|
|
77
|
-
import { useConfigStore } from "@liujitcn/kratos-admin-core/stores/runtime";
|
|
78
75
|
import DynamicTranslationEditor from "@liujitcn/kratos-admin-system/components/DynamicTranslationEditor.vue";
|
|
79
76
|
import DynamicTranslationCell from "@liujitcn/kratos-admin-system/components/DynamicTranslationCell.vue";
|
|
80
77
|
import {
|
|
@@ -83,8 +80,6 @@ import {
|
|
|
83
80
|
type DynamicTranslationRecord,
|
|
84
81
|
type DynamicTranslationValue
|
|
85
82
|
} from "@liujitcn/kratos-admin-system/components/dynamicTranslation";
|
|
86
|
-
import { TranslationResourceType } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_translation";
|
|
87
|
-
import type { BaseDictItemTranslation } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_dict";
|
|
88
83
|
|
|
89
84
|
defineOptions({
|
|
90
85
|
name: "BaseDictItem",
|
|
@@ -93,7 +88,6 @@ defineOptions({
|
|
|
93
88
|
|
|
94
89
|
const route = useRoute();
|
|
95
90
|
const { BUTTONS } = useAuthButtons();
|
|
96
|
-
const configStore = useConfigStore();
|
|
97
91
|
const proTable = ref<ProTableInstance>();
|
|
98
92
|
const formDialogRef = ref<InstanceType<typeof FormDialog>>();
|
|
99
93
|
const translationValues = ref<DynamicTranslationValue[]>(normalizeDynamicTranslations(undefined, "label"));
|
|
@@ -125,20 +119,20 @@ const formData = reactive<BaseDictItemForm>({
|
|
|
125
119
|
});
|
|
126
120
|
|
|
127
121
|
const rules = computed(() => ({
|
|
128
|
-
value: [{ required: true, max: 50, message: t("system.
|
|
129
|
-
label: [{ required: true, max: 100, message: t("system.
|
|
122
|
+
value: [{ required: true, max: 50, message: t("system.base.dict.item.validation.value"), trigger: "blur" }],
|
|
123
|
+
label: [{ required: true, max: 100, message: t("system.base.dict.item.validation.label"), trigger: "blur" }],
|
|
130
124
|
tag_type: [
|
|
131
125
|
{
|
|
132
126
|
max: 50,
|
|
133
|
-
message: t("
|
|
127
|
+
message: t("common.validation.max_length", { field: t("system.base.dict.item.field.tag_type"), max: 50 }),
|
|
134
128
|
trigger: "blur"
|
|
135
129
|
}
|
|
136
130
|
],
|
|
137
|
-
sort: [{ required: true, message: t("
|
|
131
|
+
sort: [{ required: true, message: t("common.validation.sort_positive"), trigger: "blur" }],
|
|
138
132
|
status: [
|
|
139
133
|
{
|
|
140
134
|
required: true,
|
|
141
|
-
message: t("
|
|
135
|
+
message: t("common.validation.required_select", { field: t("common.field.status") }),
|
|
142
136
|
trigger: "change"
|
|
143
137
|
}
|
|
144
138
|
]
|
|
@@ -153,31 +147,31 @@ const statusOptions = computed<ProFormOption[]>(() => [
|
|
|
153
147
|
const formFields = computed<ProFormField[]>(() => [
|
|
154
148
|
{
|
|
155
149
|
prop: "label",
|
|
156
|
-
label: t("system.
|
|
150
|
+
label: t("system.base.dict.item.field.label"),
|
|
157
151
|
component: "input",
|
|
158
|
-
props: { placeholder: t("system.
|
|
152
|
+
props: { placeholder: t("system.base.dict.item.placeholder.label") }
|
|
159
153
|
},
|
|
160
154
|
{
|
|
161
155
|
prop: "value",
|
|
162
|
-
label: t("system.
|
|
156
|
+
label: t("system.base.dict.item.field.value"),
|
|
163
157
|
component: "input",
|
|
164
|
-
props: { placeholder: t("system.
|
|
158
|
+
props: { placeholder: t("system.base.dict.item.placeholder.value") }
|
|
165
159
|
},
|
|
166
160
|
{
|
|
167
161
|
prop: "translations",
|
|
168
|
-
label: t("system.translation.field.translations"),
|
|
162
|
+
label: t("system.base.translation.field.translations"),
|
|
169
163
|
component: "slot",
|
|
170
164
|
slotName: "translations",
|
|
171
165
|
colSpan: 24
|
|
172
166
|
},
|
|
173
167
|
{
|
|
174
168
|
prop: "sort",
|
|
175
|
-
label: t("
|
|
169
|
+
label: t("common.field.sort"),
|
|
176
170
|
component: "input-number",
|
|
177
171
|
props: { min: 1, precision: 0, step: 1, controlsPosition: "right", style: { width: "100%" } }
|
|
178
172
|
},
|
|
179
|
-
{ prop: "status", label: t("
|
|
180
|
-
{ prop: "tag_type", label: t("system.
|
|
173
|
+
{ prop: "status", label: t("common.field.status"), component: "radio-group", options: statusOptions.value },
|
|
174
|
+
{ prop: "tag_type", label: t("system.base.dict.item.field.tag_type"), component: "slot", slotName: "tagTypeField", colSpan: 24 }
|
|
181
175
|
]);
|
|
182
176
|
|
|
183
177
|
/**
|
|
@@ -194,7 +188,7 @@ function formatTagType(tag_type: string) {
|
|
|
194
188
|
* 渲染标签类型列,统一复用字典项标签的展示方式。
|
|
195
189
|
*/
|
|
196
190
|
function renderTagTypeCell(scope: RenderScope<BaseDictItem>) {
|
|
197
|
-
if (!scope.row.tag_type) return t("
|
|
191
|
+
if (!scope.row.tag_type) return t("common.value.none");
|
|
198
192
|
return h(
|
|
199
193
|
ElTag,
|
|
200
194
|
{
|
|
@@ -210,8 +204,9 @@ function renderDictItemLabelCell(scope: RenderScope<BaseDictItem>) {
|
|
|
210
204
|
const row = scope.row;
|
|
211
205
|
return h(DynamicTranslationCell, {
|
|
212
206
|
source: row.label,
|
|
213
|
-
|
|
214
|
-
|
|
207
|
+
targetType: TranslationTargetType.TRANSLATION_TARGET_TYPE_BASE_DICT_ITEM,
|
|
208
|
+
targetId: row.id,
|
|
209
|
+
translations: row.translations
|
|
215
210
|
});
|
|
216
211
|
}
|
|
217
212
|
|
|
@@ -220,23 +215,23 @@ const columns = computed<ColumnProps[]>(() => [
|
|
|
220
215
|
{ type: "selection", width: 55 },
|
|
221
216
|
{
|
|
222
217
|
prop: "label",
|
|
223
|
-
label: t("system.
|
|
218
|
+
label: t("system.base.dict.item.field.label"),
|
|
224
219
|
minWidth: 140,
|
|
225
220
|
search: { el: "input" },
|
|
226
221
|
showOverflowTooltip: false,
|
|
227
222
|
render: scope => renderDictItemLabelCell(scope as unknown as RenderScope<BaseDictItem>)
|
|
228
223
|
},
|
|
229
|
-
{ prop: "value", label: t("system.
|
|
230
|
-
{ prop: "sort", label: t("
|
|
224
|
+
{ prop: "value", label: t("system.base.dict.item.field.value"), minWidth: 140 },
|
|
225
|
+
{ prop: "sort", label: t("common.field.sort"), minWidth: 90, align: "right" },
|
|
231
226
|
{
|
|
232
227
|
prop: "tag_type",
|
|
233
|
-
label: t("system.
|
|
228
|
+
label: t("system.base.dict.item.field.tag_type"),
|
|
234
229
|
minWidth: 120,
|
|
235
230
|
render: scope => renderTagTypeCell(scope as unknown as RenderScope<BaseDictItem>)
|
|
236
231
|
},
|
|
237
232
|
{
|
|
238
233
|
prop: "status",
|
|
239
|
-
label: t("
|
|
234
|
+
label: t("common.field.status"),
|
|
240
235
|
minWidth: 100,
|
|
241
236
|
search: { el: "select" },
|
|
242
237
|
cellType: "status",
|
|
@@ -249,11 +244,11 @@ const columns = computed<ColumnProps[]>(() => [
|
|
|
249
244
|
beforeChange: scope => handleBeforeSetStatus(scope.row as BaseDictItem)
|
|
250
245
|
}
|
|
251
246
|
},
|
|
252
|
-
{ prop: "created_at", label: t("
|
|
253
|
-
{ prop: "updated_at", label: t("
|
|
247
|
+
{ prop: "created_at", label: t("common.field.created_at"), minWidth: 180 },
|
|
248
|
+
{ prop: "updated_at", label: t("common.field.updated_at"), minWidth: 180 },
|
|
254
249
|
{
|
|
255
250
|
prop: "operation",
|
|
256
|
-
label: t("
|
|
251
|
+
label: t("common.field.action"),
|
|
257
252
|
width: 180,
|
|
258
253
|
fixed: "right",
|
|
259
254
|
cellType: "actions",
|
|
@@ -372,12 +367,18 @@ function handleSubmit() {
|
|
|
372
367
|
|
|
373
368
|
formData.dict_id = dictId.value;
|
|
374
369
|
const submitData = JSON.parse(JSON.stringify(formData)) as BaseDictItemForm;
|
|
375
|
-
submitData.translations = serializeDynamicTranslations(
|
|
370
|
+
submitData.translations = serializeDynamicTranslations(
|
|
371
|
+
translationValues.value,
|
|
372
|
+
TranslationTargetType.TRANSLATION_TARGET_TYPE_BASE_DICT_ITEM,
|
|
373
|
+
submitData.id
|
|
374
|
+
);
|
|
376
375
|
const request = submitData.id
|
|
377
376
|
? defBaseDictService.UpdateBaseDictItem({ base_dict_item: submitData })
|
|
378
377
|
: defBaseDictService.CreateBaseDictItem({ base_dict_item: submitData });
|
|
379
378
|
request.then(() => {
|
|
380
|
-
ElMessage.success(
|
|
379
|
+
ElMessage.success(
|
|
380
|
+
t(submitData.id ? "system.base.dict.item.message.update_success" : "system.base.dict.item.message.create_success")
|
|
381
|
+
);
|
|
381
382
|
handleCloseDialog();
|
|
382
383
|
refreshTable();
|
|
383
384
|
});
|
|
@@ -392,13 +393,17 @@ async function handleBeforeSetStatus(row: BaseDictItem) {
|
|
|
392
393
|
const action = t(nextStatus === Status.ENABLE ? "common.status.enabled" : "common.status.disabled");
|
|
393
394
|
const itemName = row.label || row.value || `ID:${row.id}`;
|
|
394
395
|
try {
|
|
395
|
-
await ElMessageBox.confirm(
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
396
|
+
await ElMessageBox.confirm(
|
|
397
|
+
t("system.base.dict.item.message.confirm_status", { action, name: itemName }),
|
|
398
|
+
t("common.title.notice"),
|
|
399
|
+
{
|
|
400
|
+
confirmButtonText: t("common.action.confirm"),
|
|
401
|
+
cancelButtonText: t("common.action.cancel"),
|
|
402
|
+
type: "warning"
|
|
403
|
+
}
|
|
404
|
+
);
|
|
400
405
|
await defBaseDictService.SetBaseDictItemStatus({ id: row.id, status: nextStatus });
|
|
401
|
-
ElMessage.success(t("
|
|
406
|
+
ElMessage.success(t("common.message.status_success", { action }));
|
|
402
407
|
refreshTable();
|
|
403
408
|
return true;
|
|
404
409
|
} catch {
|
|
@@ -421,16 +426,16 @@ function handleDelete(selected?: number | string | Array<number | string> | Base
|
|
|
421
426
|
: normalizeSelectedIds(selected as number | string | Array<number | string>)
|
|
422
427
|
).join(",");
|
|
423
428
|
if (!dictItemIds) {
|
|
424
|
-
ElMessage.warning(t("
|
|
429
|
+
ElMessage.warning(t("common.message.select_delete_item"));
|
|
425
430
|
return;
|
|
426
431
|
}
|
|
427
432
|
|
|
428
433
|
const singleItemName = dictItemList[0]?.label || dictItemList[0]?.value || `ID:${dictItemList[0]?.id ?? ""}`;
|
|
429
434
|
const confirmMessage = dictItemList.length
|
|
430
435
|
? dictItemList.length === 1
|
|
431
|
-
? t("system.
|
|
432
|
-
: t("system.
|
|
433
|
-
: t("system.
|
|
436
|
+
? t("system.base.dict.item.message.confirm_delete_single", { name: singleItemName })
|
|
437
|
+
: t("system.base.dict.item.message.confirm_delete_batch", { count: dictItemList.length })
|
|
438
|
+
: t("system.base.dict.item.message.confirm_delete_selected");
|
|
434
439
|
|
|
435
440
|
ElMessageBox.confirm(confirmMessage, t("common.title.warning"), {
|
|
436
441
|
confirmButtonText: t("common.action.confirm"),
|
|
@@ -439,12 +444,12 @@ function handleDelete(selected?: number | string | Array<number | string> | Base
|
|
|
439
444
|
}).then(
|
|
440
445
|
() => {
|
|
441
446
|
defBaseDictService.DeleteBaseDictItem({ id: dictItemIds }).then(() => {
|
|
442
|
-
ElMessage.success(t("system.
|
|
447
|
+
ElMessage.success(t("system.base.dict.item.message.delete_success"));
|
|
443
448
|
refreshTable();
|
|
444
449
|
});
|
|
445
450
|
},
|
|
446
451
|
() => {
|
|
447
|
-
ElMessage.info(t("system.
|
|
452
|
+
ElMessage.info(t("system.base.dict.item.message.delete_canceled"));
|
|
448
453
|
}
|
|
449
454
|
);
|
|
450
455
|
}
|
|
@@ -6,12 +6,11 @@
|
|
|
6
6
|
<FormDialog
|
|
7
7
|
v-model="dialog.visible"
|
|
8
8
|
ref="formDialogRef"
|
|
9
|
-
:title="t(dialog.editing ? 'system.job.action.edit' : 'system.job.action.create')"
|
|
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
|
/>
|
|
@@ -77,34 +76,34 @@ const rules = computed(() => ({
|
|
|
77
76
|
name: [
|
|
78
77
|
{
|
|
79
78
|
required: true,
|
|
80
|
-
message: t("
|
|
79
|
+
message: t("common.validation.required_input", { field: t("system.base.job.field.name") }),
|
|
81
80
|
trigger: "blur"
|
|
82
81
|
},
|
|
83
|
-
{ max: 50, message: t("
|
|
82
|
+
{ max: 50, message: t("common.validation.max_length", { field: t("system.base.job.field.name"), max: 50 }), trigger: "blur" }
|
|
84
83
|
],
|
|
85
84
|
cron_expression: [
|
|
86
85
|
{
|
|
87
86
|
required: true,
|
|
88
|
-
message: t("
|
|
87
|
+
message: t("common.validation.required_input", { field: t("system.base.job.field.cron") }),
|
|
89
88
|
trigger: "blur"
|
|
90
89
|
},
|
|
91
|
-
{ max: 50, message: t("
|
|
90
|
+
{ max: 50, message: t("common.validation.max_length", { field: t("system.base.job.field.cron"), max: 50 }), trigger: "blur" }
|
|
92
91
|
],
|
|
93
92
|
invoke_target: [
|
|
94
93
|
{
|
|
95
94
|
required: true,
|
|
96
|
-
message: t("
|
|
95
|
+
message: t("common.validation.required_input", { field: t("system.base.job.field.invoke_target") }),
|
|
97
96
|
trigger: "blur"
|
|
98
97
|
},
|
|
99
98
|
{
|
|
100
99
|
max: 100,
|
|
101
|
-
message: t("
|
|
100
|
+
message: t("common.validation.max_length", { field: t("system.base.job.field.invoke_target"), max: 100 }),
|
|
102
101
|
trigger: "blur"
|
|
103
102
|
}
|
|
104
103
|
],
|
|
105
104
|
args: {
|
|
106
105
|
validator: (rule: unknown, value: BaseJobArgs[], callback: (error?: Error) => void) => {
|
|
107
|
-
if (value.some(arg => !arg.key)) callback(new Error(t("system.job.validation.
|
|
106
|
+
if (value.some(arg => !arg.key)) callback(new Error(t("system.base.job.validation.arg_key_required")));
|
|
108
107
|
else callback();
|
|
109
108
|
},
|
|
110
109
|
trigger: "blur"
|
|
@@ -112,7 +111,7 @@ const rules = computed(() => ({
|
|
|
112
111
|
status: [
|
|
113
112
|
{
|
|
114
113
|
required: true,
|
|
115
|
-
message: t("
|
|
114
|
+
message: t("common.validation.required_select", { field: t("common.field.status") }),
|
|
116
115
|
trigger: "blur"
|
|
117
116
|
}
|
|
118
117
|
]
|
|
@@ -196,7 +195,7 @@ function renderOperationCell(scope: RenderScope<BaseJob>) {
|
|
|
196
195
|
class: "job-action job-action--start",
|
|
197
196
|
onClick: () => handleStart(row.id, row.name)
|
|
198
197
|
},
|
|
199
|
-
() => t("system.job.action.start")
|
|
198
|
+
() => t("system.base.job.action.start")
|
|
200
199
|
)
|
|
201
200
|
);
|
|
202
201
|
}
|
|
@@ -213,7 +212,7 @@ function renderOperationCell(scope: RenderScope<BaseJob>) {
|
|
|
213
212
|
class: "job-action job-action--stop",
|
|
214
213
|
onClick: () => handleStop(row.id, row.name)
|
|
215
214
|
},
|
|
216
|
-
() => t("system.job.action.stop")
|
|
215
|
+
() => t("system.base.job.action.stop")
|
|
217
216
|
)
|
|
218
217
|
);
|
|
219
218
|
}
|
|
@@ -230,7 +229,7 @@ function renderOperationCell(scope: RenderScope<BaseJob>) {
|
|
|
230
229
|
class: "job-action job-action--exec",
|
|
231
230
|
onClick: () => handleExec(row.id, row.name)
|
|
232
231
|
},
|
|
233
|
-
() => t("system.job.action.execute")
|
|
232
|
+
() => t("system.base.job.action.execute")
|
|
234
233
|
)
|
|
235
234
|
);
|
|
236
235
|
}
|
|
@@ -247,7 +246,7 @@ function renderOperationCell(scope: RenderScope<BaseJob>) {
|
|
|
247
246
|
class: "job-action job-action--log",
|
|
248
247
|
onClick: () => handleOpenBaseJob(row.id, row.name)
|
|
249
248
|
},
|
|
250
|
-
() => t("system.job.action.log")
|
|
249
|
+
() => t("system.base.job.action.log")
|
|
251
250
|
)
|
|
252
251
|
);
|
|
253
252
|
}
|
|
@@ -267,51 +266,51 @@ function renderOperationCell(scope: RenderScope<BaseJob>) {
|
|
|
267
266
|
const formFields = computed<ProFormField[]>(() => [
|
|
268
267
|
{
|
|
269
268
|
prop: "name",
|
|
270
|
-
label: t("system.job.field.name"),
|
|
269
|
+
label: t("system.base.job.field.name"),
|
|
271
270
|
component: "input",
|
|
272
|
-
props: { placeholder: t("system.job.placeholder.name") }
|
|
271
|
+
props: { placeholder: t("system.base.job.placeholder.name") }
|
|
273
272
|
},
|
|
274
273
|
{
|
|
275
274
|
prop: "invoke_target",
|
|
276
|
-
label: t("system.job.field.
|
|
275
|
+
label: t("system.base.job.field.invoke_target"),
|
|
277
276
|
component: "input",
|
|
278
|
-
props: { placeholder: t("system.job.placeholder.
|
|
277
|
+
props: { placeholder: t("system.base.job.placeholder.invoke_target") }
|
|
279
278
|
},
|
|
280
279
|
{
|
|
281
280
|
prop: "cron_expression",
|
|
282
|
-
label: t("system.job.field.cron"),
|
|
281
|
+
label: t("system.base.job.field.cron"),
|
|
283
282
|
component: "cron-expression",
|
|
284
283
|
props: { placeholder: "0 0 0 * * *" }
|
|
285
284
|
},
|
|
286
285
|
{
|
|
287
286
|
prop: "args",
|
|
288
|
-
label: t("system.job.field.args"),
|
|
287
|
+
label: t("system.base.job.field.args"),
|
|
289
288
|
component: "kv-list",
|
|
290
289
|
props: {
|
|
291
|
-
keyInputProps: { placeholder: t("system.job.field.
|
|
292
|
-
valueInputProps: { placeholder: t("system.job.field.
|
|
293
|
-
addText: t("system.job.action.
|
|
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")
|
|
294
293
|
}
|
|
295
294
|
},
|
|
296
|
-
{ prop: "status", label: t("
|
|
295
|
+
{ prop: "status", label: t("common.field.status"), component: "radio-group", options: statusOptions.value }
|
|
297
296
|
]);
|
|
298
297
|
|
|
299
298
|
/** 定时任务表格列配置。 */
|
|
300
299
|
const columns = computed<ColumnProps[]>(() => [
|
|
301
300
|
{ type: "selection", width: 55 },
|
|
302
|
-
{ prop: "name", label: t("system.job.field.name"), minWidth: 140, search: { el: "input" } },
|
|
303
|
-
{ prop: "invoke_target", label: t("system.job.field.
|
|
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" } },
|
|
304
303
|
{
|
|
305
304
|
prop: "args",
|
|
306
|
-
label: t("system.job.field.
|
|
305
|
+
label: t("system.base.job.field.args_short"),
|
|
307
306
|
minWidth: 140,
|
|
308
307
|
render: scope => renderArgsCell(scope as unknown as RenderScope<BaseJob>)
|
|
309
308
|
},
|
|
310
|
-
{ prop: "cron_expression", label: t("system.job.field.cron"), minWidth: 150 },
|
|
311
|
-
{ prop: "entry_id", label: t("system.job.field.
|
|
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" },
|
|
312
311
|
{
|
|
313
312
|
prop: "status",
|
|
314
|
-
label: t("
|
|
313
|
+
label: t("common.field.status"),
|
|
315
314
|
minWidth: 100,
|
|
316
315
|
search: { el: "select" },
|
|
317
316
|
cellType: "status",
|
|
@@ -324,11 +323,11 @@ const columns = computed<ColumnProps[]>(() => [
|
|
|
324
323
|
beforeChange: scope => handleBeforeSetStatus(scope.row as BaseJob)
|
|
325
324
|
}
|
|
326
325
|
},
|
|
327
|
-
{ prop: "created_at", label: t("
|
|
328
|
-
{ prop: "updated_at", label: t("
|
|
326
|
+
{ prop: "created_at", label: t("common.field.created_at"), minWidth: 180 },
|
|
327
|
+
{ prop: "updated_at", label: t("common.field.updated_at"), minWidth: 180 },
|
|
329
328
|
{
|
|
330
329
|
prop: "operation",
|
|
331
|
-
label: t("
|
|
330
|
+
label: t("common.field.action"),
|
|
332
331
|
width: 380,
|
|
333
332
|
fixed: "right",
|
|
334
333
|
render: scope => renderOperationCell(scope as unknown as RenderScope<BaseJob>)
|
|
@@ -417,7 +416,7 @@ function handleSubmit() {
|
|
|
417
416
|
? defBaseJobService.UpdateBaseJob({ base_job: submitData })
|
|
418
417
|
: defBaseJobService.CreateBaseJob({ base_job: submitData });
|
|
419
418
|
request.then(() => {
|
|
420
|
-
ElMessage.success(t(submitData.id ? "system.job.message.
|
|
419
|
+
ElMessage.success(t(submitData.id ? "system.base.job.message.update_success" : "system.base.job.message.create_success"));
|
|
421
420
|
handleCloseDialog();
|
|
422
421
|
refreshTable();
|
|
423
422
|
});
|
|
@@ -432,13 +431,13 @@ async function handleBeforeSetStatus(row: BaseJob) {
|
|
|
432
431
|
const action = t(nextStatus === Status.ENABLE ? "common.status.enabled" : "common.status.disabled");
|
|
433
432
|
const jobName = row.name || row.invoke_target || `ID:${row.id}`;
|
|
434
433
|
try {
|
|
435
|
-
await ElMessageBox.confirm(t("system.job.message.
|
|
434
|
+
await ElMessageBox.confirm(t("system.base.job.message.confirm_status", { action, name: jobName }), t("common.title.notice"), {
|
|
436
435
|
confirmButtonText: t("common.action.confirm"),
|
|
437
436
|
cancelButtonText: t("common.action.cancel"),
|
|
438
437
|
type: "warning"
|
|
439
438
|
});
|
|
440
439
|
await defBaseJobService.SetBaseJobStatus({ id: row.id, status: nextStatus });
|
|
441
|
-
ElMessage.success(t("
|
|
440
|
+
ElMessage.success(t("common.message.status_success", { action }));
|
|
442
441
|
refreshTable();
|
|
443
442
|
return true;
|
|
444
443
|
} catch {
|
|
@@ -459,16 +458,16 @@ function handleDelete(selected?: number | string | Array<number | string> | Base
|
|
|
459
458
|
jobList.length ? jobList.map(item => item.id) : normalizeSelectedIds(selected as number | string | Array<number | string>)
|
|
460
459
|
).join(",");
|
|
461
460
|
if (!jobIds) {
|
|
462
|
-
ElMessage.warning(t("
|
|
461
|
+
ElMessage.warning(t("common.message.select_delete_item"));
|
|
463
462
|
return;
|
|
464
463
|
}
|
|
465
464
|
|
|
466
465
|
const singleJobName = jobList[0]?.name || jobList[0]?.invoke_target || `ID:${jobList[0]?.id ?? ""}`;
|
|
467
466
|
const confirmMessage = jobList.length
|
|
468
467
|
? jobList.length === 1
|
|
469
|
-
? t("system.job.message.
|
|
470
|
-
: t("system.job.message.
|
|
471
|
-
: t("system.job.message.
|
|
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");
|
|
472
471
|
|
|
473
472
|
ElMessageBox.confirm(confirmMessage, t("common.title.warning"), {
|
|
474
473
|
confirmButtonText: t("common.action.confirm"),
|
|
@@ -477,12 +476,12 @@ function handleDelete(selected?: number | string | Array<number | string> | Base
|
|
|
477
476
|
}).then(
|
|
478
477
|
() => {
|
|
479
478
|
defBaseJobService.DeleteBaseJob({ id: jobIds }).then(() => {
|
|
480
|
-
ElMessage.success(t("system.job.message.
|
|
479
|
+
ElMessage.success(t("system.base.job.message.delete_success"));
|
|
481
480
|
refreshTable();
|
|
482
481
|
});
|
|
483
482
|
},
|
|
484
483
|
() => {
|
|
485
|
-
ElMessage.info(t("system.job.message.
|
|
484
|
+
ElMessage.info(t("system.base.job.message.delete_canceled"));
|
|
486
485
|
}
|
|
487
486
|
);
|
|
488
487
|
}
|
|
@@ -491,19 +490,19 @@ function handleDelete(selected?: number | string | Array<number | string> | Base
|
|
|
491
490
|
* 启动定时任务。
|
|
492
491
|
*/
|
|
493
492
|
function handleStart(id: number, name: string) {
|
|
494
|
-
ElMessageBox.confirm(t("system.job.message.
|
|
493
|
+
ElMessageBox.confirm(t("system.base.job.message.confirm_start", { name }), t("common.title.warning"), {
|
|
495
494
|
confirmButtonText: t("common.action.confirm"),
|
|
496
495
|
cancelButtonText: t("common.action.cancel"),
|
|
497
496
|
type: "warning"
|
|
498
497
|
}).then(
|
|
499
498
|
() => {
|
|
500
499
|
defBaseJobService.StartBaseJob({ id }).then(() => {
|
|
501
|
-
ElMessage.success(t("system.job.message.
|
|
500
|
+
ElMessage.success(t("system.base.job.message.start_success"));
|
|
502
501
|
refreshTable();
|
|
503
502
|
});
|
|
504
503
|
},
|
|
505
504
|
() => {
|
|
506
|
-
ElMessage.info(t("system.job.message.
|
|
505
|
+
ElMessage.info(t("system.base.job.message.start_canceled"));
|
|
507
506
|
}
|
|
508
507
|
);
|
|
509
508
|
}
|
|
@@ -512,19 +511,19 @@ function handleStart(id: number, name: string) {
|
|
|
512
511
|
* 停止定时任务。
|
|
513
512
|
*/
|
|
514
513
|
function handleStop(id: number, name: string) {
|
|
515
|
-
ElMessageBox.confirm(t("system.job.message.
|
|
514
|
+
ElMessageBox.confirm(t("system.base.job.message.confirm_stop", { name }), t("common.title.warning"), {
|
|
516
515
|
confirmButtonText: t("common.action.confirm"),
|
|
517
516
|
cancelButtonText: t("common.action.cancel"),
|
|
518
517
|
type: "warning"
|
|
519
518
|
}).then(
|
|
520
519
|
() => {
|
|
521
520
|
defBaseJobService.StopBaseJob({ id }).then(() => {
|
|
522
|
-
ElMessage.success(t("system.job.message.
|
|
521
|
+
ElMessage.success(t("system.base.job.message.stop_success"));
|
|
523
522
|
refreshTable();
|
|
524
523
|
});
|
|
525
524
|
},
|
|
526
525
|
() => {
|
|
527
|
-
ElMessage.info(t("system.job.message.
|
|
526
|
+
ElMessage.info(t("system.base.job.message.stop_canceled"));
|
|
528
527
|
}
|
|
529
528
|
);
|
|
530
529
|
}
|
|
@@ -533,19 +532,19 @@ function handleStop(id: number, name: string) {
|
|
|
533
532
|
* 执行一次定时任务。
|
|
534
533
|
*/
|
|
535
534
|
function handleExec(id: number, name: string) {
|
|
536
|
-
ElMessageBox.confirm(t("system.job.message.
|
|
535
|
+
ElMessageBox.confirm(t("system.base.job.message.confirm_execute", { name }), t("common.title.warning"), {
|
|
537
536
|
confirmButtonText: t("common.action.confirm"),
|
|
538
537
|
cancelButtonText: t("common.action.cancel"),
|
|
539
538
|
type: "warning"
|
|
540
539
|
}).then(
|
|
541
540
|
() => {
|
|
542
541
|
defBaseJobService.ExecuteBaseJob({ id }).then(() => {
|
|
543
|
-
ElMessage.success(t("system.job.message.
|
|
542
|
+
ElMessage.success(t("system.base.job.message.execute_success"));
|
|
544
543
|
refreshTable();
|
|
545
544
|
});
|
|
546
545
|
},
|
|
547
546
|
() => {
|
|
548
|
-
ElMessage.info(t("system.job.message.
|
|
547
|
+
ElMessage.info(t("system.base.job.message.execute_canceled"));
|
|
549
548
|
}
|
|
550
549
|
);
|
|
551
550
|
}
|
|
@@ -554,7 +553,7 @@ function handleExec(id: number, name: string) {
|
|
|
554
553
|
* 打开定时任务日志页面。
|
|
555
554
|
*/
|
|
556
555
|
function handleOpenBaseJob(id: number, name: string) {
|
|
557
|
-
navigateTo(router, "/base/job/log", { jobId: id, title: t("system.job.title.log", { name }) });
|
|
556
|
+
navigateTo(router, "/base/job/log", { jobId: id, title: t("system.base.job.title.log", { name }) });
|
|
558
557
|
}
|
|
559
558
|
</script>
|
|
560
559
|
|