@liujitcn/kratos-admin-system 0.0.21 → 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/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
|
@@ -16,12 +16,11 @@
|
|
|
16
16
|
<FormDialog
|
|
17
17
|
v-model="dialog.visible"
|
|
18
18
|
ref="formDialogRef"
|
|
19
|
-
:title="t(dialog.titleKey, { resource: t('system.dept.resource') })"
|
|
19
|
+
:title="t(dialog.titleKey, { resource: t('system.base.dept.resource') })"
|
|
20
20
|
width="600px"
|
|
21
21
|
:model="formData"
|
|
22
22
|
:fields="formFields"
|
|
23
23
|
:rules="rules"
|
|
24
|
-
label-width="90px"
|
|
25
24
|
@confirm="handleSubmit"
|
|
26
25
|
@close="handleCloseDialog"
|
|
27
26
|
/>
|
|
@@ -64,7 +63,7 @@ const proTable = ref<ProTableInstance>();
|
|
|
64
63
|
const formDialogRef = ref<InstanceType<typeof FormDialog>>();
|
|
65
64
|
|
|
66
65
|
const dialog = reactive({
|
|
67
|
-
titleKey: "
|
|
66
|
+
titleKey: "common.action.create_resource",
|
|
68
67
|
visible: false
|
|
69
68
|
});
|
|
70
69
|
|
|
@@ -97,34 +96,34 @@ const rules = computed(() => ({
|
|
|
97
96
|
tenant_id: [
|
|
98
97
|
{
|
|
99
98
|
required: true,
|
|
100
|
-
message: t("
|
|
99
|
+
message: t("common.validation.required_select", { field: t("common.field.tenant") }),
|
|
101
100
|
trigger: "change"
|
|
102
101
|
}
|
|
103
102
|
],
|
|
104
103
|
parent_id: [
|
|
105
104
|
{
|
|
106
105
|
required: true,
|
|
107
|
-
message: t("
|
|
106
|
+
message: t("common.validation.required_select", { field: t("system.base.dept.field.parent") }),
|
|
108
107
|
trigger: "change"
|
|
109
108
|
}
|
|
110
109
|
],
|
|
111
110
|
name: [
|
|
112
111
|
{
|
|
113
112
|
required: true,
|
|
114
|
-
message: t("
|
|
113
|
+
message: t("common.validation.required_input", { field: t("system.base.dept.field.name") }),
|
|
115
114
|
trigger: "blur"
|
|
116
115
|
},
|
|
117
116
|
{
|
|
118
117
|
max: 255,
|
|
119
|
-
message: t("
|
|
118
|
+
message: t("common.validation.max_length", { field: t("system.base.dept.field.name"), max: 255 }),
|
|
120
119
|
trigger: "blur"
|
|
121
120
|
}
|
|
122
121
|
],
|
|
123
|
-
sort: [{ required: true, type: "number", min: 1, message: t("
|
|
122
|
+
sort: [{ required: true, type: "number", min: 1, message: t("common.validation.sort_positive"), trigger: "blur" }],
|
|
124
123
|
status: [
|
|
125
124
|
{
|
|
126
125
|
required: true,
|
|
127
|
-
message: t("
|
|
126
|
+
message: t("common.validation.required_select", { field: t("common.field.status") }),
|
|
128
127
|
trigger: "change"
|
|
129
128
|
}
|
|
130
129
|
]
|
|
@@ -137,10 +136,10 @@ const isDefaultTenant = computed(() => userStore.userInfo.tenant_code === DEFAUL
|
|
|
137
136
|
const formFields = computed<ProFormField[]>(() => [
|
|
138
137
|
{
|
|
139
138
|
prop: "tenant_id",
|
|
140
|
-
label: t("
|
|
139
|
+
label: t("common.field.tenant"),
|
|
141
140
|
component: "select",
|
|
142
141
|
props: {
|
|
143
|
-
placeholder: t("
|
|
142
|
+
placeholder: t("common.validation.required_select", { field: t("common.field.tenant") }),
|
|
144
143
|
filterable: true,
|
|
145
144
|
disabled: Boolean(formData.id),
|
|
146
145
|
onChange: handleFormTenantChange
|
|
@@ -150,11 +149,11 @@ const formFields = computed<ProFormField[]>(() => [
|
|
|
150
149
|
},
|
|
151
150
|
{
|
|
152
151
|
prop: "parent_id",
|
|
153
|
-
label: t("system.dept.field.parent"),
|
|
152
|
+
label: t("system.base.dept.field.parent"),
|
|
154
153
|
component: "tree-select",
|
|
155
154
|
options: deptOptions.value,
|
|
156
155
|
props: {
|
|
157
|
-
placeholder: t("
|
|
156
|
+
placeholder: t("common.validation.required_select", { field: t("system.base.dept.field.parent") }),
|
|
158
157
|
filterable: true,
|
|
159
158
|
checkStrictly: true,
|
|
160
159
|
renderAfterExpand: false,
|
|
@@ -163,23 +162,23 @@ const formFields = computed<ProFormField[]>(() => [
|
|
|
163
162
|
},
|
|
164
163
|
{
|
|
165
164
|
prop: "name",
|
|
166
|
-
label: t("system.dept.field.name"),
|
|
165
|
+
label: t("system.base.dept.field.name"),
|
|
167
166
|
component: "input",
|
|
168
|
-
props: { placeholder: t("
|
|
167
|
+
props: { placeholder: t("common.validation.required_input", { field: t("system.base.dept.field.name") }) }
|
|
169
168
|
},
|
|
170
169
|
{
|
|
171
170
|
prop: "sort",
|
|
172
|
-
label: t("
|
|
171
|
+
label: t("common.field.sort"),
|
|
173
172
|
component: "input-number",
|
|
174
173
|
props: { min: 1, precision: 0, step: 1, controlsPosition: "right", style: { width: "100%" } }
|
|
175
174
|
},
|
|
176
175
|
{
|
|
177
176
|
prop: "remark",
|
|
178
|
-
label: t("
|
|
177
|
+
label: t("common.field.remark"),
|
|
179
178
|
component: "textarea",
|
|
180
|
-
props: { placeholder: t("
|
|
179
|
+
props: { placeholder: t("common.placeholder.remark") }
|
|
181
180
|
},
|
|
182
|
-
{ prop: "status", label: t("
|
|
181
|
+
{ prop: "status", label: t("common.field.status"), component: "radio-group", options: statusOptions.value }
|
|
183
182
|
]);
|
|
184
183
|
|
|
185
184
|
/** 部门树表格列配置。 */
|
|
@@ -189,7 +188,7 @@ const columns = computed<ColumnProps[]>(() => [
|
|
|
189
188
|
? ([
|
|
190
189
|
{
|
|
191
190
|
prop: "tenant_id",
|
|
192
|
-
label: t("
|
|
191
|
+
label: t("common.field.tenant"),
|
|
193
192
|
minWidth: 140,
|
|
194
193
|
showOverflowTooltip: true,
|
|
195
194
|
search: { el: "select", key: "tenant_id", props: { filterable: true }, order: 1 },
|
|
@@ -197,12 +196,12 @@ const columns = computed<ColumnProps[]>(() => [
|
|
|
197
196
|
}
|
|
198
197
|
] satisfies ColumnProps[])
|
|
199
198
|
: []),
|
|
200
|
-
{ prop: "name", label: t("system.dept.field.name"), minWidth: 140, align: "left", search: { el: "input" } },
|
|
201
|
-
{ prop: "remark", label: t("
|
|
202
|
-
{ prop: "sort", label: t("
|
|
199
|
+
{ prop: "name", label: t("system.base.dept.field.name"), minWidth: 140, align: "left", search: { el: "input" } },
|
|
200
|
+
{ prop: "remark", label: t("common.field.remark"), minWidth: 160, search: { el: "input" } },
|
|
201
|
+
{ prop: "sort", label: t("common.field.sort"), minWidth: 90, align: "right" },
|
|
203
202
|
{
|
|
204
203
|
prop: "status",
|
|
205
|
-
label: t("
|
|
204
|
+
label: t("common.field.status"),
|
|
206
205
|
minWidth: 100,
|
|
207
206
|
search: { el: "select" },
|
|
208
207
|
cellType: "status",
|
|
@@ -215,11 +214,11 @@ const columns = computed<ColumnProps[]>(() => [
|
|
|
215
214
|
beforeChange: scope => handleBeforeSetStatus(scope.row as BaseDept)
|
|
216
215
|
}
|
|
217
216
|
},
|
|
218
|
-
{ prop: "created_at", label: t("
|
|
219
|
-
{ prop: "updated_at", label: t("
|
|
217
|
+
{ prop: "created_at", label: t("common.field.created_at"), minWidth: 180 },
|
|
218
|
+
{ prop: "updated_at", label: t("common.field.updated_at"), minWidth: 180 },
|
|
220
219
|
{
|
|
221
220
|
prop: "operation",
|
|
222
|
-
label: t("
|
|
221
|
+
label: t("common.field.operation"),
|
|
223
222
|
width: 220,
|
|
224
223
|
fixed: "right",
|
|
225
224
|
cellType: "actions",
|
|
@@ -332,7 +331,7 @@ function refreshTable() {
|
|
|
332
331
|
async function loadDeptOptions() {
|
|
333
332
|
// 默认租户未选择目标租户时仅保留顶级部门,避免混入其他租户的部门树。
|
|
334
333
|
if (isDefaultTenant.value && !formData.tenant_id) {
|
|
335
|
-
deptOptions.value = [{ value: 0, label: t("system.dept.value.root"), disabled: false, has_children: true, children: [] }];
|
|
334
|
+
deptOptions.value = [{ value: 0, label: t("system.base.dept.value.root"), disabled: false, has_children: true, children: [] }];
|
|
336
335
|
return;
|
|
337
336
|
}
|
|
338
337
|
const optionBaseDeptResponse = await defBaseDeptService.OptionBaseDept({
|
|
@@ -341,7 +340,7 @@ async function loadDeptOptions() {
|
|
|
341
340
|
deptOptions.value = [
|
|
342
341
|
{
|
|
343
342
|
value: 0,
|
|
344
|
-
label: t("system.dept.value.root"),
|
|
343
|
+
label: t("system.base.dept.value.root"),
|
|
345
344
|
disabled: false,
|
|
346
345
|
has_children: true,
|
|
347
346
|
children: optionBaseDeptResponse.list
|
|
@@ -373,7 +372,7 @@ async function handleOpenDialog(parent_id?: number, deptId?: number, tenantId?:
|
|
|
373
372
|
resetForm();
|
|
374
373
|
await loadTenantOptions();
|
|
375
374
|
if (deptId) {
|
|
376
|
-
dialog.titleKey = "
|
|
375
|
+
dialog.titleKey = "common.action.edit_resource";
|
|
377
376
|
dialog.visible = true;
|
|
378
377
|
defBaseDeptService.GetBaseDept({ id: deptId }).then(async data => {
|
|
379
378
|
Object.assign(formData, data);
|
|
@@ -385,7 +384,7 @@ async function handleOpenDialog(parent_id?: number, deptId?: number, tenantId?:
|
|
|
385
384
|
// 从部门行新增子部门时,继承父部门租户并加载同租户上级部门树。
|
|
386
385
|
formData.tenant_id = tenantId;
|
|
387
386
|
await loadDeptOptions();
|
|
388
|
-
dialog.titleKey = "
|
|
387
|
+
dialog.titleKey = "common.action.create_resource";
|
|
389
388
|
dialog.visible = true;
|
|
390
389
|
formData.parent_id = parent_id ?? 0;
|
|
391
390
|
}
|
|
@@ -427,8 +426,8 @@ function handleSubmit() {
|
|
|
427
426
|
: defBaseDeptService.CreateBaseDept({ base_dept: submitData });
|
|
428
427
|
request.then(() => {
|
|
429
428
|
ElMessage.success(
|
|
430
|
-
t(submitData.id ? "
|
|
431
|
-
resource: t("system.dept.resource")
|
|
429
|
+
t(submitData.id ? "common.message.update_success" : "common.message.create_success", {
|
|
430
|
+
resource: t("system.base.dept.resource")
|
|
432
431
|
})
|
|
433
432
|
);
|
|
434
433
|
handleCloseDialog();
|
|
@@ -446,10 +445,10 @@ async function handleBeforeSetStatus(row: BaseDept) {
|
|
|
446
445
|
const deptName = row.name || `ID:${row.id}`;
|
|
447
446
|
try {
|
|
448
447
|
await ElMessageBox.confirm(
|
|
449
|
-
t("
|
|
448
|
+
t("common.dialog.status_change", {
|
|
450
449
|
action: text,
|
|
451
|
-
resource: t("system.dept.resource"),
|
|
452
|
-
field: t("system.dept.field.name"),
|
|
450
|
+
resource: t("system.base.dept.resource"),
|
|
451
|
+
field: t("system.base.dept.field.name"),
|
|
453
452
|
value: deptName
|
|
454
453
|
}),
|
|
455
454
|
t("common.title.notice"),
|
|
@@ -460,7 +459,7 @@ async function handleBeforeSetStatus(row: BaseDept) {
|
|
|
460
459
|
}
|
|
461
460
|
);
|
|
462
461
|
await defBaseDeptService.SetBaseDeptStatus({ id: row.id, status: nextStatus });
|
|
463
|
-
ElMessage.success(t("
|
|
462
|
+
ElMessage.success(t("common.message.status_success", { action: text }));
|
|
464
463
|
refreshTable();
|
|
465
464
|
return true;
|
|
466
465
|
} catch {
|
|
@@ -481,15 +480,15 @@ function handleDelete(selected?: number | string | Array<number | string> | Base
|
|
|
481
480
|
deptList.length ? deptList.map(item => item.id) : normalizeSelectedIds(selected as number | string | Array<number | string>)
|
|
482
481
|
).join(",");
|
|
483
482
|
if (!deptIds) {
|
|
484
|
-
ElMessage.warning(t("
|
|
483
|
+
ElMessage.warning(t("common.message.select_delete_item"));
|
|
485
484
|
return;
|
|
486
485
|
}
|
|
487
486
|
|
|
488
487
|
const confirmMessage = deptList.length
|
|
489
488
|
? deptList.length === 1
|
|
490
|
-
? `${t("
|
|
491
|
-
: t("
|
|
492
|
-
: t("
|
|
489
|
+
? `${t("common.dialog.delete_single", { resource: t("system.base.dept.resource") })}\n${t("common.dialog.resource_field", { field: t("system.base.dept.field.name"), value: deptList[0].name || `ID:${deptList[0].id}` })}`
|
|
490
|
+
: t("common.dialog.delete_batch", { count: deptList.length, unit: "", resource: t("system.base.dept.resource") })
|
|
491
|
+
: t("common.dialog.delete_selected", { resource: t("system.base.dept.resource") });
|
|
493
492
|
|
|
494
493
|
ElMessageBox.confirm(confirmMessage, t("common.title.warning"), {
|
|
495
494
|
confirmButtonText: t("common.action.confirm"),
|
|
@@ -498,12 +497,12 @@ function handleDelete(selected?: number | string | Array<number | string> | Base
|
|
|
498
497
|
}).then(
|
|
499
498
|
() => {
|
|
500
499
|
defBaseDeptService.DeleteBaseDept({ id: deptIds }).then(() => {
|
|
501
|
-
ElMessage.success(t("
|
|
500
|
+
ElMessage.success(t("common.message.delete_success", { resource: t("system.base.dept.resource") }));
|
|
502
501
|
refreshTable();
|
|
503
502
|
});
|
|
504
503
|
},
|
|
505
504
|
() => {
|
|
506
|
-
ElMessage.info(t("
|
|
505
|
+
ElMessage.info(t("common.dialog.cancel_delete", { resource: t("system.base.dept.resource") }));
|
|
507
506
|
}
|
|
508
507
|
);
|
|
509
508
|
}
|
|
@@ -12,21 +12,18 @@
|
|
|
12
12
|
<FormDialog
|
|
13
13
|
v-model="dialog.visible"
|
|
14
14
|
ref="formDialogRef"
|
|
15
|
-
:title="t(dialog.editing ? 'system.dict.action.edit' : 'system.dict.action.create')"
|
|
15
|
+
:title="t(dialog.editing ? 'system.base.dict.action.edit' : 'system.base.dict.action.create')"
|
|
16
16
|
width="700px"
|
|
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 #translations>
|
|
25
24
|
<DynamicTranslationEditor
|
|
26
25
|
v-model="translationValues"
|
|
27
|
-
:
|
|
28
|
-
:resource-type="TranslationResourceType.TRANSLATION_RESOURCE_TYPE_DICT"
|
|
29
|
-
:draft-enabled="configStore.translationDraftEnabled"
|
|
26
|
+
:source="formData.name"
|
|
30
27
|
:maxlength="50"
|
|
31
28
|
/>
|
|
32
29
|
</template>
|
|
@@ -53,9 +50,9 @@ import { loadEnabledBaseLanguages } from "@liujitcn/kratos-admin-system/api/syst
|
|
|
53
50
|
import type { BaseDict, BaseDictForm, PageBaseDictRequest } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_dict";
|
|
54
51
|
import router, { navigateTo } from "@liujitcn/kratos-admin-core/navigation";
|
|
55
52
|
import { Status } from "@liujitcn/kratos-admin-system/rpc/common/v1/enum";
|
|
53
|
+
import { TranslationTargetType } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_translation";
|
|
56
54
|
import { buildPageRequest, normalizeSelectedIds } from "@liujitcn/kratos-admin-core/table";
|
|
57
55
|
import { t } from "@liujitcn/kratos-admin-core";
|
|
58
|
-
import { useConfigStore } from "@liujitcn/kratos-admin-core/stores/runtime";
|
|
59
56
|
import DynamicTranslationEditor from "@liujitcn/kratos-admin-system/components/DynamicTranslationEditor.vue";
|
|
60
57
|
import DynamicTranslationCell from "@liujitcn/kratos-admin-system/components/DynamicTranslationCell.vue";
|
|
61
58
|
import {
|
|
@@ -64,8 +61,6 @@ import {
|
|
|
64
61
|
type DynamicTranslationRecord,
|
|
65
62
|
type DynamicTranslationValue
|
|
66
63
|
} from "@liujitcn/kratos-admin-system/components/dynamicTranslation";
|
|
67
|
-
import { TranslationResourceType } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_translation";
|
|
68
|
-
import type { BaseDictTranslation } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_dict";
|
|
69
64
|
|
|
70
65
|
defineOptions({
|
|
71
66
|
name: "BaseDict",
|
|
@@ -73,11 +68,9 @@ defineOptions({
|
|
|
73
68
|
});
|
|
74
69
|
|
|
75
70
|
const { BUTTONS } = useAuthButtons();
|
|
76
|
-
const configStore = useConfigStore();
|
|
77
71
|
const proTable = ref<ProTableInstance>();
|
|
78
72
|
const formDialogRef = ref<InstanceType<typeof FormDialog>>();
|
|
79
73
|
const translationValues = ref<DynamicTranslationValue[]>(normalizeDynamicTranslations(undefined, "name"));
|
|
80
|
-
|
|
81
74
|
const dialog = reactive({
|
|
82
75
|
editing: false,
|
|
83
76
|
visible: false
|
|
@@ -98,25 +91,25 @@ const formData = reactive<BaseDictForm>({
|
|
|
98
91
|
|
|
99
92
|
const rules = computed(() => ({
|
|
100
93
|
name: [
|
|
101
|
-
{ required: true, message: t("system.dict.placeholder.name"), trigger: "blur" },
|
|
94
|
+
{ required: true, message: t("system.base.dict.placeholder.name"), trigger: "blur" },
|
|
102
95
|
{
|
|
103
96
|
max: 50,
|
|
104
|
-
message: t("
|
|
97
|
+
message: t("common.validation.max_length", { field: t("system.base.dict.field.name"), max: 50 }),
|
|
105
98
|
trigger: "blur"
|
|
106
99
|
}
|
|
107
100
|
],
|
|
108
101
|
code: [
|
|
109
|
-
{ required: true, message: t("system.dict.placeholder.code"), trigger: "blur" },
|
|
102
|
+
{ required: true, message: t("system.base.dict.placeholder.code"), trigger: "blur" },
|
|
110
103
|
{
|
|
111
104
|
max: 50,
|
|
112
|
-
message: t("
|
|
105
|
+
message: t("common.validation.max_length", { field: t("system.base.dict.field.code"), max: 50 }),
|
|
113
106
|
trigger: "blur"
|
|
114
107
|
}
|
|
115
108
|
],
|
|
116
109
|
status: [
|
|
117
110
|
{
|
|
118
111
|
required: true,
|
|
119
|
-
message: t("
|
|
112
|
+
message: t("common.validation.required_select", { field: t("common.field.status") }),
|
|
120
113
|
trigger: "change"
|
|
121
114
|
}
|
|
122
115
|
]
|
|
@@ -131,18 +124,18 @@ const statusOptions = computed<ProFormOption[]>(() => [
|
|
|
131
124
|
const formFields = computed<ProFormField[]>(() => [
|
|
132
125
|
{
|
|
133
126
|
prop: "name",
|
|
134
|
-
label: t("system.dict.field.name"),
|
|
127
|
+
label: t("system.base.dict.field.name"),
|
|
135
128
|
component: "input",
|
|
136
|
-
props: { placeholder: t("system.dict.placeholder.name") }
|
|
129
|
+
props: { placeholder: t("system.base.dict.placeholder.name") }
|
|
137
130
|
},
|
|
138
131
|
{
|
|
139
132
|
prop: "code",
|
|
140
|
-
label: t("system.dict.field.code"),
|
|
133
|
+
label: t("system.base.dict.field.code"),
|
|
141
134
|
component: "input",
|
|
142
|
-
props: { placeholder: t("system.dict.placeholder.code") }
|
|
135
|
+
props: { placeholder: t("system.base.dict.placeholder.code") }
|
|
143
136
|
},
|
|
144
|
-
{ prop: "translations", label: t("system.translation.field.translations"), component: "slot", slotName: "translations" },
|
|
145
|
-
{ prop: "status", label: t("
|
|
137
|
+
{ prop: "translations", label: t("system.base.translation.field.translations"), component: "slot", slotName: "translations" },
|
|
138
|
+
{ prop: "status", label: t("common.field.status"), component: "radio-group", options: statusOptions.value }
|
|
146
139
|
]);
|
|
147
140
|
|
|
148
141
|
/** 渲染字典名称翻译预览,并复用当前页面的编辑弹窗。 */
|
|
@@ -150,8 +143,9 @@ function renderDictNameCell(scope: RenderScope<BaseDict>) {
|
|
|
150
143
|
const row = scope.row;
|
|
151
144
|
return h(DynamicTranslationCell, {
|
|
152
145
|
source: row.name,
|
|
153
|
-
|
|
154
|
-
|
|
146
|
+
targetType: TranslationTargetType.TRANSLATION_TARGET_TYPE_BASE_DICT,
|
|
147
|
+
targetId: row.id,
|
|
148
|
+
translations: row.translations
|
|
155
149
|
});
|
|
156
150
|
}
|
|
157
151
|
|
|
@@ -160,16 +154,16 @@ const columns = computed<ColumnProps[]>(() => [
|
|
|
160
154
|
{ type: "selection", width: 55 },
|
|
161
155
|
{
|
|
162
156
|
prop: "name",
|
|
163
|
-
label: t("system.dict.field.name"),
|
|
157
|
+
label: t("system.base.dict.field.name"),
|
|
164
158
|
minWidth: 140,
|
|
165
159
|
search: { el: "input" },
|
|
166
160
|
showOverflowTooltip: false,
|
|
167
161
|
render: scope => renderDictNameCell(scope as unknown as RenderScope<BaseDict>)
|
|
168
162
|
},
|
|
169
|
-
{ prop: "code", label: t("system.dict.field.code"), minWidth: 160, search: { el: "input" } },
|
|
163
|
+
{ prop: "code", label: t("system.base.dict.field.code"), minWidth: 160, search: { el: "input" } },
|
|
170
164
|
{
|
|
171
165
|
prop: "status",
|
|
172
|
-
label: t("
|
|
166
|
+
label: t("common.field.status"),
|
|
173
167
|
minWidth: 100,
|
|
174
168
|
search: { el: "select" },
|
|
175
169
|
cellType: "status",
|
|
@@ -182,17 +176,17 @@ const columns = computed<ColumnProps[]>(() => [
|
|
|
182
176
|
beforeChange: scope => handleBeforeSetStatus(scope.row as BaseDict)
|
|
183
177
|
}
|
|
184
178
|
},
|
|
185
|
-
{ prop: "created_at", label: t("
|
|
186
|
-
{ prop: "updated_at", label: t("
|
|
179
|
+
{ prop: "created_at", label: t("common.field.created_at"), minWidth: 180 },
|
|
180
|
+
{ prop: "updated_at", label: t("common.field.updated_at"), minWidth: 180 },
|
|
187
181
|
{
|
|
188
182
|
prop: "operation",
|
|
189
|
-
label: t("
|
|
183
|
+
label: t("common.field.action"),
|
|
190
184
|
width: 240,
|
|
191
185
|
fixed: "right",
|
|
192
186
|
cellType: "actions",
|
|
193
187
|
actions: [
|
|
194
188
|
{
|
|
195
|
-
label: t("system.dict.action.items"),
|
|
189
|
+
label: t("system.base.dict.action.items"),
|
|
196
190
|
type: "primary",
|
|
197
191
|
link: true,
|
|
198
192
|
icon: List,
|
|
@@ -300,12 +294,16 @@ function handleSubmit() {
|
|
|
300
294
|
if (!isValid) return;
|
|
301
295
|
|
|
302
296
|
const submitData = JSON.parse(JSON.stringify(formData)) as BaseDictForm;
|
|
303
|
-
submitData.translations = serializeDynamicTranslations(
|
|
297
|
+
submitData.translations = serializeDynamicTranslations(
|
|
298
|
+
translationValues.value,
|
|
299
|
+
TranslationTargetType.TRANSLATION_TARGET_TYPE_BASE_DICT,
|
|
300
|
+
submitData.id
|
|
301
|
+
);
|
|
304
302
|
const request = submitData.id
|
|
305
303
|
? defBaseDictService.UpdateBaseDict({ base_dict: submitData })
|
|
306
304
|
: defBaseDictService.CreateBaseDict({ base_dict: submitData });
|
|
307
305
|
request.then(() => {
|
|
308
|
-
ElMessage.success(t(submitData.id ? "system.dict.message.
|
|
306
|
+
ElMessage.success(t(submitData.id ? "system.base.dict.message.update_success" : "system.base.dict.message.create_success"));
|
|
309
307
|
handleCloseDialog();
|
|
310
308
|
refreshTable();
|
|
311
309
|
});
|
|
@@ -320,13 +318,17 @@ async function handleBeforeSetStatus(row: BaseDict) {
|
|
|
320
318
|
const action = t(nextStatus === Status.ENABLE ? "common.status.enabled" : "common.status.disabled");
|
|
321
319
|
const dictName = row.name || row.code || String(row.id);
|
|
322
320
|
try {
|
|
323
|
-
await ElMessageBox.confirm(
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
321
|
+
await ElMessageBox.confirm(
|
|
322
|
+
t("system.base.dict.message.confirm_status", { action, name: dictName }),
|
|
323
|
+
t("common.title.notice"),
|
|
324
|
+
{
|
|
325
|
+
confirmButtonText: t("common.action.confirm"),
|
|
326
|
+
cancelButtonText: t("common.action.cancel"),
|
|
327
|
+
type: "warning"
|
|
328
|
+
}
|
|
329
|
+
);
|
|
328
330
|
await defBaseDictService.SetBaseDictStatus({ id: row.id, status: nextStatus });
|
|
329
|
-
ElMessage.success(t("
|
|
331
|
+
ElMessage.success(t("common.message.status_success", { action }));
|
|
330
332
|
refreshTable();
|
|
331
333
|
return true;
|
|
332
334
|
} catch {
|
|
@@ -347,15 +349,17 @@ function handleDelete(selected?: number | string | Array<number | string> | Base
|
|
|
347
349
|
dictList.length ? dictList.map(item => item.id) : normalizeSelectedIds(selected as number | string | Array<number | string>)
|
|
348
350
|
).join(",");
|
|
349
351
|
if (!dictIds) {
|
|
350
|
-
ElMessage.warning(t("
|
|
352
|
+
ElMessage.warning(t("common.message.select_delete_item"));
|
|
351
353
|
return;
|
|
352
354
|
}
|
|
353
355
|
|
|
354
356
|
const confirmMessage = dictList.length
|
|
355
357
|
? dictList.length === 1
|
|
356
|
-
? t("system.dict.message.
|
|
357
|
-
|
|
358
|
-
|
|
358
|
+
? t("system.base.dict.message.confirm_delete_single", {
|
|
359
|
+
name: dictList[0].name || dictList[0].code || `ID:${dictList[0].id}`
|
|
360
|
+
})
|
|
361
|
+
: t("system.base.dict.message.confirm_delete_batch", { count: dictList.length })
|
|
362
|
+
: t("system.base.dict.message.confirm_delete_selected");
|
|
359
363
|
|
|
360
364
|
ElMessageBox.confirm(confirmMessage, t("common.title.warning"), {
|
|
361
365
|
confirmButtonText: t("common.action.confirm"),
|
|
@@ -364,12 +368,12 @@ function handleDelete(selected?: number | string | Array<number | string> | Base
|
|
|
364
368
|
}).then(
|
|
365
369
|
() => {
|
|
366
370
|
defBaseDictService.DeleteBaseDict({ id: dictIds }).then(() => {
|
|
367
|
-
ElMessage.success(t("system.dict.message.
|
|
371
|
+
ElMessage.success(t("system.base.dict.message.delete_success"));
|
|
368
372
|
refreshTable();
|
|
369
373
|
});
|
|
370
374
|
},
|
|
371
375
|
() => {
|
|
372
|
-
ElMessage.info(t("system.dict.message.
|
|
376
|
+
ElMessage.info(t("system.base.dict.message.delete_canceled"));
|
|
373
377
|
}
|
|
374
378
|
);
|
|
375
379
|
}
|
|
@@ -378,6 +382,6 @@ function handleDelete(selected?: number | string | Array<number | string> | Base
|
|
|
378
382
|
* 打开字典数据页面。
|
|
379
383
|
*/
|
|
380
384
|
function handleOpenBaseDictItem(row: BaseDict) {
|
|
381
|
-
navigateTo(router, "/base/dict/item", { dictId: row.id, title: t("system.dict.title.items", { name: row.name }) });
|
|
385
|
+
navigateTo(router, "/base/dict/item", { dictId: row.id, title: t("system.base.dict.title.items", { name: row.name }) });
|
|
382
386
|
}
|
|
383
387
|
</script>
|