@liujitcn/kratos-admin-system 0.0.20 → 0.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -50
- package/dist/package/declarations/src/api/system/base_language.d.ts +52 -0
- package/dist/package/declarations/src/api/system/base_translation.d.ts +10 -0
- package/dist/package/declarations/src/api/system/code_gen_i18n.d.ts +8 -0
- package/dist/package/declarations/src/api/system/ops_monitoring.d.ts +19 -0
- package/dist/package/declarations/src/api/system/ops_monitoring_sse.d.ts +12 -0
- package/dist/package/declarations/src/components/DynamicTranslationCell.vue.d.ts +16 -0
- package/dist/package/declarations/src/components/DynamicTranslationEditor.vue.d.ts +20 -0
- package/dist/package/declarations/src/components/dynamicTranslation.d.ts +38 -0
- package/dist/package/declarations/src/locales/generated.d.ts +6536 -0
- package/dist/package/declarations/src/rpc/base/v1/ai_session.d.ts +12 -2
- package/dist/package/declarations/src/rpc/base/v1/ai_tool.d.ts +9 -1
- package/dist/package/declarations/src/rpc/base/v1/config.d.ts +35 -0
- package/dist/package/declarations/src/rpc/system/admin/v1/auth.d.ts +1 -1
- package/dist/package/declarations/src/rpc/system/admin/v1/base_config.d.ts +23 -2
- package/dist/package/declarations/src/rpc/system/admin/v1/base_dict.d.ts +9 -0
- package/dist/package/declarations/src/rpc/system/admin/v1/base_job.d.ts +9 -1
- package/dist/package/declarations/src/rpc/system/admin/v1/base_language.d.ts +119 -0
- package/dist/package/declarations/src/rpc/system/admin/v1/base_menu.d.ts +6 -1
- package/dist/package/declarations/src/rpc/system/admin/v1/base_migration.d.ts +6 -6
- package/dist/package/declarations/src/rpc/system/admin/v1/base_role.d.ts +13 -1
- package/dist/package/declarations/src/rpc/system/admin/v1/base_translation.d.ts +75 -0
- package/dist/package/declarations/src/rpc/system/admin/v1/base_user.d.ts +11 -1
- package/dist/package/declarations/src/rpc/system/admin/v1/code_gen.d.ts +13 -11
- package/dist/package/declarations/src/rpc/system/admin/v1/code_gen_column.d.ts +7 -0
- package/dist/package/declarations/src/rpc/system/admin/v1/code_gen_table.d.ts +24 -1
- package/dist/package/declarations/src/rpc/system/admin/v1/common.d.ts +13 -0
- package/dist/package/declarations/src/rpc/system/admin/v1/ops_monitoring.d.ts +222 -0
- package/dist/package/declarations/src/views/base/language/index.vue.d.ts +3 -0
- package/dist/package/declarations/src/views/tool/code-gen/components/CodeGenLocaleEditor.vue.d.ts +23 -0
- package/dist/package/declarations/src/views/tool/code-gen/config.d.ts +7 -7
- package/dist/package/declarations/src/views/tool/ops-monitoring/index.vue.d.ts +3 -0
- package/dist/package/src/api/base/ai_message.ts +7 -12
- package/dist/package/src/api/base/sse.ts +3 -1
- package/dist/package/src/api/system/base_language.ts +135 -0
- package/dist/package/src/api/system/base_translation.ts +33 -0
- package/dist/package/src/api/system/code_gen_column.ts +17 -3
- package/dist/package/src/api/system/code_gen_i18n.ts +18 -0
- package/dist/package/src/api/system/code_gen_table.ts +12 -4
- package/dist/package/src/api/system/ops_monitoring.ts +88 -0
- package/dist/package/src/api/system/ops_monitoring_sse.ts +49 -0
- package/dist/package/src/components/DynamicTranslationCell.vue +249 -0
- package/dist/package/src/components/DynamicTranslationEditor.vue +197 -0
- package/dist/package/src/components/dynamicTranslation.ts +66 -0
- package/dist/package/src/locales/README.md +30 -0
- package/dist/package/src/locales/en-US.json +933 -0
- package/dist/package/src/locales/es-ES.json +933 -0
- package/dist/package/src/locales/fr-FR.json +933 -0
- package/dist/package/src/locales/generated.ts +22 -0
- package/dist/package/src/locales/ja-JP.json +933 -0
- package/dist/package/src/locales/ko-KR.json +933 -0
- package/dist/package/src/locales/zh-CN.json +933 -0
- package/dist/package/src/locales/zh-TW.json +933 -0
- package/dist/package/src/module.ts +6 -2
- package/dist/package/src/rpc/base/v1/ai_session.ts +13 -2
- package/dist/package/src/rpc/base/v1/ai_tool.ts +10 -1
- package/dist/package/src/rpc/base/v1/config.ts +47 -0
- package/dist/package/src/rpc/system/admin/v1/auth.ts +1 -1
- package/dist/package/src/rpc/system/admin/v1/base_config.ts +24 -2
- package/dist/package/src/rpc/system/admin/v1/base_dict.ts +9 -0
- package/dist/package/src/rpc/system/admin/v1/base_job.ts +10 -1
- package/dist/package/src/rpc/system/admin/v1/base_language.ts +141 -0
- package/dist/package/src/rpc/system/admin/v1/base_menu.ts +6 -1
- package/dist/package/src/rpc/system/admin/v1/base_migration.ts +8 -8
- package/dist/package/src/rpc/system/admin/v1/base_role.ts +14 -1
- package/dist/package/src/rpc/system/admin/v1/base_translation.ts +90 -0
- package/dist/package/src/rpc/system/admin/v1/base_user.ts +12 -1
- package/dist/package/src/rpc/system/admin/v1/code_gen.ts +16 -12
- package/dist/package/src/rpc/system/admin/v1/code_gen_column.ts +8 -0
- package/dist/package/src/rpc/system/admin/v1/code_gen_table.ts +27 -1
- package/dist/package/src/rpc/system/admin/v1/common.ts +21 -0
- package/dist/package/src/rpc/system/admin/v1/ops_monitoring.ts +255 -0
- package/dist/package/src/views/ai/chat/components/AiMarkdown.vue +1 -6
- package/dist/package/src/views/ai/chat/components/ChatPanel.vue +75 -58
- package/dist/package/src/views/ai/chat/components/SessionPanel.vue +20 -9
- package/dist/package/src/views/ai/chat/components/XSender.vue +36 -23
- package/dist/package/src/views/ai/chat/index.vue +58 -41
- package/dist/package/src/views/ai/chat/message.ts +29 -27
- package/dist/package/src/views/base/api/index.vue +121 -84
- package/dist/package/src/views/base/area/index.vue +81 -32
- package/dist/package/src/views/base/config/index.vue +300 -96
- package/dist/package/src/views/base/dept/index.vue +110 -62
- package/dist/package/src/views/base/dict/index.vue +145 -62
- package/dist/package/src/views/base/dict/item.vue +155 -64
- package/dist/package/src/views/base/job/index.vue +134 -82
- package/dist/package/src/views/base/job/log.vue +24 -25
- package/dist/package/src/views/base/language/index.vue +260 -0
- package/dist/package/src/views/base/log/index.vue +68 -46
- package/dist/package/src/views/base/menu/index.vue +344 -200
- package/dist/package/src/views/base/migration/index.vue +49 -29
- package/dist/package/src/views/base/post/index.vue +128 -60
- package/dist/package/src/views/base/role/index.vue +145 -79
- package/dist/package/src/views/base/tenant/index.vue +132 -64
- package/dist/package/src/views/base/user/components/dept-tree.vue +2 -1
- package/dist/package/src/views/base/user/index.vue +194 -116
- package/dist/package/src/views/profile/components/base.vue +45 -28
- package/dist/package/src/views/profile/components/password.vue +45 -30
- package/dist/package/src/views/profile/components/security.vue +90 -54
- package/dist/package/src/views/profile/index.vue +10 -9
- package/dist/package/src/views/tool/api-doc/index.vue +6 -2
- package/dist/package/src/views/tool/code-gen/code-preview/index.vue +32 -16
- package/dist/package/src/views/tool/code-gen/columns/index.vue +382 -273
- package/dist/package/src/views/tool/code-gen/columns/option-copy.ts +1 -6
- package/dist/package/src/views/tool/code-gen/components/CodeGenLocaleEditor.vue +118 -0
- package/dist/package/src/views/tool/code-gen/components/CodeGenProgressDialog.vue +65 -36
- package/dist/package/src/views/tool/code-gen/components/CodePreviewPane.vue +8 -5
- package/dist/package/src/views/tool/code-gen/config.ts +116 -79
- package/dist/package/src/views/tool/code-gen/preview/data.ts +19 -17
- package/dist/package/src/views/tool/code-gen/preview/index.vue +96 -59
- package/dist/package/src/views/tool/code-gen/proto/index.vue +110 -62
- package/dist/package/src/views/tool/code-gen/table/index.vue +201 -121
- package/dist/package/src/views/tool/ops-monitoring/index.vue +1175 -0
- package/dist/package/src/views/tool/project-doc/index.vue +17 -15
- package/package.json +6 -2
- package/dist/package/declarations/src/rpc/base/v1/enum.d.ts +0 -43
- package/dist/package/declarations/src/rpc/system/common/v1/enum.d.ts +0 -67
- package/dist/package/src/rpc/base/v1/enum.ts +0 -54
- package/dist/package/src/rpc/system/common/v1/enum.ts +0 -80
|
@@ -12,32 +12,55 @@
|
|
|
12
12
|
<FormDialog
|
|
13
13
|
v-model="dialog.visible"
|
|
14
14
|
ref="formDialogRef"
|
|
15
|
-
:title="dialog.
|
|
16
|
-
width="
|
|
15
|
+
:title="t(dialog.editing ? 'system.base.dict.action.edit' : 'system.base.dict.action.create')"
|
|
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
|
+
>
|
|
23
|
+
<template #translations>
|
|
24
|
+
<DynamicTranslationEditor
|
|
25
|
+
v-model="translationValues"
|
|
26
|
+
:source="formData.name"
|
|
27
|
+
:maxlength="50"
|
|
28
|
+
/>
|
|
29
|
+
</template>
|
|
30
|
+
</FormDialog>
|
|
24
31
|
</div>
|
|
25
32
|
</template>
|
|
26
33
|
|
|
27
34
|
<script setup lang="ts">
|
|
28
|
-
import { computed, reactive, ref } from "vue";
|
|
35
|
+
import { computed, h, reactive, ref } from "vue";
|
|
29
36
|
import { ElMessage, ElMessageBox } from "element-plus";
|
|
30
37
|
import { CirclePlus, Delete, EditPen, List } from "@element-plus/icons-vue";
|
|
31
|
-
import type {
|
|
38
|
+
import type {
|
|
39
|
+
ColumnProps,
|
|
40
|
+
HeaderActionProps,
|
|
41
|
+
ProTableInstance,
|
|
42
|
+
RenderScope
|
|
43
|
+
} from "@liujitcn/kratos-admin-core/components/ProTable/interface";
|
|
32
44
|
import ProTable from "@liujitcn/kratos-admin-core/components/ProTable";
|
|
33
45
|
import FormDialog from "@liujitcn/kratos-admin-core/components/Dialog/FormDialog.vue";
|
|
34
46
|
import type { ProFormField, ProFormOption } from "@liujitcn/kratos-admin-core/components/ProForm/interface";
|
|
35
47
|
import { useAuthButtons } from "@liujitcn/kratos-admin-core/auth";
|
|
36
48
|
import { defBaseDictService } from "@liujitcn/kratos-admin-system/api/system/base_dict";
|
|
49
|
+
import { loadEnabledBaseLanguages } from "@liujitcn/kratos-admin-system/api/system/base_language";
|
|
37
50
|
import type { BaseDict, BaseDictForm, PageBaseDictRequest } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_dict";
|
|
38
51
|
import router, { navigateTo } from "@liujitcn/kratos-admin-core/navigation";
|
|
39
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";
|
|
40
54
|
import { buildPageRequest, normalizeSelectedIds } from "@liujitcn/kratos-admin-core/table";
|
|
55
|
+
import { t } from "@liujitcn/kratos-admin-core";
|
|
56
|
+
import DynamicTranslationEditor from "@liujitcn/kratos-admin-system/components/DynamicTranslationEditor.vue";
|
|
57
|
+
import DynamicTranslationCell from "@liujitcn/kratos-admin-system/components/DynamicTranslationCell.vue";
|
|
58
|
+
import {
|
|
59
|
+
normalizeDynamicTranslations,
|
|
60
|
+
serializeDynamicTranslations,
|
|
61
|
+
type DynamicTranslationRecord,
|
|
62
|
+
type DynamicTranslationValue
|
|
63
|
+
} from "@liujitcn/kratos-admin-system/components/dynamicTranslation";
|
|
41
64
|
|
|
42
65
|
defineOptions({
|
|
43
66
|
name: "BaseDict",
|
|
@@ -47,9 +70,9 @@ defineOptions({
|
|
|
47
70
|
const { BUTTONS } = useAuthButtons();
|
|
48
71
|
const proTable = ref<ProTableInstance>();
|
|
49
72
|
const formDialogRef = ref<InstanceType<typeof FormDialog>>();
|
|
50
|
-
|
|
73
|
+
const translationValues = ref<DynamicTranslationValue[]>(normalizeDynamicTranslations(undefined, "name"));
|
|
51
74
|
const dialog = reactive({
|
|
52
|
-
|
|
75
|
+
editing: false,
|
|
53
76
|
visible: false
|
|
54
77
|
});
|
|
55
78
|
|
|
@@ -60,65 +83,110 @@ const formData = reactive<BaseDictForm>({
|
|
|
60
83
|
code: "",
|
|
61
84
|
/** 字典名称 */
|
|
62
85
|
name: "",
|
|
86
|
+
/** 非主语言翻译 */
|
|
87
|
+
translations: [],
|
|
63
88
|
/** 状态 */
|
|
64
89
|
status: Status.ENABLE
|
|
65
90
|
});
|
|
66
91
|
|
|
67
92
|
const rules = computed(() => ({
|
|
68
93
|
name: [
|
|
69
|
-
{ required: true, message: "
|
|
70
|
-
{
|
|
94
|
+
{ required: true, message: t("system.base.dict.placeholder.name"), trigger: "blur" },
|
|
95
|
+
{
|
|
96
|
+
max: 50,
|
|
97
|
+
message: t("common.validation.max_length", { field: t("system.base.dict.field.name"), max: 50 }),
|
|
98
|
+
trigger: "blur"
|
|
99
|
+
}
|
|
71
100
|
],
|
|
72
101
|
code: [
|
|
73
|
-
{ required: true, message: "
|
|
74
|
-
{
|
|
102
|
+
{ required: true, message: t("system.base.dict.placeholder.code"), trigger: "blur" },
|
|
103
|
+
{
|
|
104
|
+
max: 50,
|
|
105
|
+
message: t("common.validation.max_length", { field: t("system.base.dict.field.code"), max: 50 }),
|
|
106
|
+
trigger: "blur"
|
|
107
|
+
}
|
|
75
108
|
],
|
|
76
|
-
status: [
|
|
109
|
+
status: [
|
|
110
|
+
{
|
|
111
|
+
required: true,
|
|
112
|
+
message: t("common.validation.required_select", { field: t("common.field.status") }),
|
|
113
|
+
trigger: "change"
|
|
114
|
+
}
|
|
115
|
+
]
|
|
77
116
|
}));
|
|
78
117
|
|
|
79
|
-
const statusOptions
|
|
80
|
-
{ label: "
|
|
81
|
-
{ label: "
|
|
82
|
-
];
|
|
118
|
+
const statusOptions = computed<ProFormOption[]>(() => [
|
|
119
|
+
{ label: t("common.status.enabled"), value: Status.ENABLE },
|
|
120
|
+
{ label: t("common.status.disabled"), value: Status.DISABLE }
|
|
121
|
+
]);
|
|
83
122
|
|
|
84
123
|
/** 字典表单字段配置。 */
|
|
85
|
-
const formFields
|
|
86
|
-
{
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
124
|
+
const formFields = computed<ProFormField[]>(() => [
|
|
125
|
+
{
|
|
126
|
+
prop: "name",
|
|
127
|
+
label: t("system.base.dict.field.name"),
|
|
128
|
+
component: "input",
|
|
129
|
+
props: { placeholder: t("system.base.dict.placeholder.name") }
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
prop: "code",
|
|
133
|
+
label: t("system.base.dict.field.code"),
|
|
134
|
+
component: "input",
|
|
135
|
+
props: { placeholder: t("system.base.dict.placeholder.code") }
|
|
136
|
+
},
|
|
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 }
|
|
139
|
+
]);
|
|
140
|
+
|
|
141
|
+
/** 渲染字典名称翻译预览,并复用当前页面的编辑弹窗。 */
|
|
142
|
+
function renderDictNameCell(scope: RenderScope<BaseDict>) {
|
|
143
|
+
const row = scope.row;
|
|
144
|
+
return h(DynamicTranslationCell, {
|
|
145
|
+
source: row.name,
|
|
146
|
+
targetType: TranslationTargetType.TRANSLATION_TARGET_TYPE_BASE_DICT,
|
|
147
|
+
targetId: row.id,
|
|
148
|
+
translations: row.translations
|
|
149
|
+
});
|
|
150
|
+
}
|
|
90
151
|
|
|
91
152
|
/** 字典表格列配置。 */
|
|
92
|
-
const columns
|
|
153
|
+
const columns = computed<ColumnProps[]>(() => [
|
|
93
154
|
{ type: "selection", width: 55 },
|
|
94
|
-
{
|
|
95
|
-
|
|
155
|
+
{
|
|
156
|
+
prop: "name",
|
|
157
|
+
label: t("system.base.dict.field.name"),
|
|
158
|
+
minWidth: 140,
|
|
159
|
+
search: { el: "input" },
|
|
160
|
+
showOverflowTooltip: false,
|
|
161
|
+
render: scope => renderDictNameCell(scope as unknown as RenderScope<BaseDict>)
|
|
162
|
+
},
|
|
163
|
+
{ prop: "code", label: t("system.base.dict.field.code"), minWidth: 160, search: { el: "input" } },
|
|
96
164
|
{
|
|
97
165
|
prop: "status",
|
|
98
|
-
label: "
|
|
166
|
+
label: t("common.field.status"),
|
|
99
167
|
minWidth: 100,
|
|
100
168
|
search: { el: "select" },
|
|
101
169
|
cellType: "status",
|
|
102
170
|
statusProps: {
|
|
103
171
|
activeValue: Status.ENABLE,
|
|
104
172
|
inactiveValue: Status.DISABLE,
|
|
105
|
-
activeText: "
|
|
106
|
-
inactiveText: "
|
|
173
|
+
activeText: t("common.status.enabled"),
|
|
174
|
+
inactiveText: t("common.status.disabled"),
|
|
107
175
|
disabled: () => !BUTTONS.value["base:dict:status"],
|
|
108
176
|
beforeChange: scope => handleBeforeSetStatus(scope.row as BaseDict)
|
|
109
177
|
}
|
|
110
178
|
},
|
|
111
|
-
{ prop: "created_at", label: "
|
|
112
|
-
{ prop: "updated_at", label: "
|
|
179
|
+
{ prop: "created_at", label: t("common.field.created_at"), minWidth: 180 },
|
|
180
|
+
{ prop: "updated_at", label: t("common.field.updated_at"), minWidth: 180 },
|
|
113
181
|
{
|
|
114
182
|
prop: "operation",
|
|
115
|
-
label: "
|
|
183
|
+
label: t("common.field.action"),
|
|
116
184
|
width: 240,
|
|
117
185
|
fixed: "right",
|
|
118
186
|
cellType: "actions",
|
|
119
187
|
actions: [
|
|
120
188
|
{
|
|
121
|
-
label: "
|
|
189
|
+
label: t("system.base.dict.action.items"),
|
|
122
190
|
type: "primary",
|
|
123
191
|
link: true,
|
|
124
192
|
icon: List,
|
|
@@ -126,7 +194,7 @@ const columns: ColumnProps[] = [
|
|
|
126
194
|
onClick: scope => handleOpenBaseDictItem(scope.row as BaseDict)
|
|
127
195
|
},
|
|
128
196
|
{
|
|
129
|
-
label: "
|
|
197
|
+
label: t("common.action.edit"),
|
|
130
198
|
type: "primary",
|
|
131
199
|
link: true,
|
|
132
200
|
icon: EditPen,
|
|
@@ -135,7 +203,7 @@ const columns: ColumnProps[] = [
|
|
|
135
203
|
onClick: (scope, params) => handleOpenDialog((params?.dictId as number | undefined) ?? (scope.row as BaseDict).id)
|
|
136
204
|
},
|
|
137
205
|
{
|
|
138
|
-
label: "
|
|
206
|
+
label: t("common.action.delete"),
|
|
139
207
|
type: "danger",
|
|
140
208
|
link: true,
|
|
141
209
|
icon: Delete,
|
|
@@ -144,31 +212,32 @@ const columns: ColumnProps[] = [
|
|
|
144
212
|
}
|
|
145
213
|
]
|
|
146
214
|
}
|
|
147
|
-
];
|
|
215
|
+
]);
|
|
148
216
|
|
|
149
217
|
/** 字典顶部按钮配置。 */
|
|
150
|
-
const headerActions
|
|
218
|
+
const headerActions = computed<HeaderActionProps[]>(() => [
|
|
151
219
|
{
|
|
152
|
-
label: "
|
|
220
|
+
label: t("common.action.create"),
|
|
153
221
|
type: "success",
|
|
154
222
|
icon: CirclePlus,
|
|
155
223
|
hidden: () => !BUTTONS.value["base:dict:create"],
|
|
156
224
|
onClick: () => handleOpenDialog()
|
|
157
225
|
},
|
|
158
226
|
{
|
|
159
|
-
label: "
|
|
227
|
+
label: t("common.action.delete"),
|
|
160
228
|
type: "danger",
|
|
161
229
|
icon: Delete,
|
|
162
230
|
hidden: () => !BUTTONS.value["base:dict:delete"],
|
|
163
231
|
disabled: scope => !scope.selectedList.length,
|
|
164
232
|
onClick: scope => handleDelete(scope.selectedList as BaseDict[])
|
|
165
233
|
}
|
|
166
|
-
];
|
|
234
|
+
]);
|
|
167
235
|
|
|
168
236
|
/**
|
|
169
237
|
* 请求字典列表,并由 ProTable 统一管理分页搜索。
|
|
170
238
|
*/
|
|
171
239
|
async function requestBaseDictTable(params: PageBaseDictRequest) {
|
|
240
|
+
await loadEnabledBaseLanguages();
|
|
172
241
|
const data = await defBaseDictService.PageBaseDict(buildPageRequest(params));
|
|
173
242
|
return { data: { list: data.base_dicts ?? [], total: data.total } };
|
|
174
243
|
}
|
|
@@ -183,15 +252,16 @@ function refreshTable() {
|
|
|
183
252
|
/**
|
|
184
253
|
* 打开字典编辑弹窗。
|
|
185
254
|
*/
|
|
186
|
-
function handleOpenDialog(dictId?: number) {
|
|
255
|
+
async function handleOpenDialog(dictId?: number) {
|
|
256
|
+
await loadEnabledBaseLanguages();
|
|
187
257
|
resetForm();
|
|
188
|
-
dialog.
|
|
258
|
+
dialog.editing = Boolean(dictId);
|
|
189
259
|
dialog.visible = true;
|
|
190
260
|
if (!dictId) return;
|
|
191
261
|
|
|
192
|
-
defBaseDictService.GetBaseDict({ id: dictId })
|
|
193
|
-
|
|
194
|
-
|
|
262
|
+
const data = await defBaseDictService.GetBaseDict({ id: dictId });
|
|
263
|
+
Object.assign(formData, data);
|
|
264
|
+
translationValues.value = normalizeDynamicTranslations(data.translations as DynamicTranslationRecord[], "name");
|
|
195
265
|
}
|
|
196
266
|
|
|
197
267
|
/**
|
|
@@ -211,7 +281,9 @@ function resetForm() {
|
|
|
211
281
|
formData.id = 0;
|
|
212
282
|
formData.code = "";
|
|
213
283
|
formData.name = "";
|
|
284
|
+
formData.translations = [];
|
|
214
285
|
formData.status = Status.ENABLE;
|
|
286
|
+
translationValues.value = normalizeDynamicTranslations(undefined, "name");
|
|
215
287
|
}
|
|
216
288
|
|
|
217
289
|
/**
|
|
@@ -222,11 +294,16 @@ function handleSubmit() {
|
|
|
222
294
|
if (!isValid) return;
|
|
223
295
|
|
|
224
296
|
const submitData = JSON.parse(JSON.stringify(formData)) as BaseDictForm;
|
|
297
|
+
submitData.translations = serializeDynamicTranslations(
|
|
298
|
+
translationValues.value,
|
|
299
|
+
TranslationTargetType.TRANSLATION_TARGET_TYPE_BASE_DICT,
|
|
300
|
+
submitData.id
|
|
301
|
+
);
|
|
225
302
|
const request = submitData.id
|
|
226
303
|
? defBaseDictService.UpdateBaseDict({ base_dict: submitData })
|
|
227
304
|
: defBaseDictService.CreateBaseDict({ base_dict: submitData });
|
|
228
305
|
request.then(() => {
|
|
229
|
-
ElMessage.success(submitData.id ? "
|
|
306
|
+
ElMessage.success(t(submitData.id ? "system.base.dict.message.update_success" : "system.base.dict.message.create_success"));
|
|
230
307
|
handleCloseDialog();
|
|
231
308
|
refreshTable();
|
|
232
309
|
});
|
|
@@ -238,16 +315,20 @@ function handleSubmit() {
|
|
|
238
315
|
*/
|
|
239
316
|
async function handleBeforeSetStatus(row: BaseDict) {
|
|
240
317
|
const nextStatus = row.status === Status.ENABLE ? Status.DISABLE : Status.ENABLE;
|
|
241
|
-
const
|
|
318
|
+
const action = t(nextStatus === Status.ENABLE ? "common.status.enabled" : "common.status.disabled");
|
|
242
319
|
const dictName = row.name || row.code || String(row.id);
|
|
243
320
|
try {
|
|
244
|
-
await ElMessageBox.confirm(
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
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
|
+
);
|
|
249
330
|
await defBaseDictService.SetBaseDictStatus({ id: row.id, status: nextStatus });
|
|
250
|
-
ElMessage.success(
|
|
331
|
+
ElMessage.success(t("common.message.status_success", { action }));
|
|
251
332
|
refreshTable();
|
|
252
333
|
return true;
|
|
253
334
|
} catch {
|
|
@@ -268,29 +349,31 @@ function handleDelete(selected?: number | string | Array<number | string> | Base
|
|
|
268
349
|
dictList.length ? dictList.map(item => item.id) : normalizeSelectedIds(selected as number | string | Array<number | string>)
|
|
269
350
|
).join(",");
|
|
270
351
|
if (!dictIds) {
|
|
271
|
-
ElMessage.warning("
|
|
352
|
+
ElMessage.warning(t("common.message.select_delete_item"));
|
|
272
353
|
return;
|
|
273
354
|
}
|
|
274
355
|
|
|
275
356
|
const confirmMessage = dictList.length
|
|
276
357
|
? dictList.length === 1
|
|
277
|
-
?
|
|
278
|
-
|
|
279
|
-
|
|
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");
|
|
280
363
|
|
|
281
|
-
ElMessageBox.confirm(confirmMessage, "
|
|
282
|
-
confirmButtonText: "
|
|
283
|
-
cancelButtonText: "
|
|
364
|
+
ElMessageBox.confirm(confirmMessage, t("common.title.warning"), {
|
|
365
|
+
confirmButtonText: t("common.action.confirm"),
|
|
366
|
+
cancelButtonText: t("common.action.cancel"),
|
|
284
367
|
type: "warning"
|
|
285
368
|
}).then(
|
|
286
369
|
() => {
|
|
287
370
|
defBaseDictService.DeleteBaseDict({ id: dictIds }).then(() => {
|
|
288
|
-
ElMessage.success("
|
|
371
|
+
ElMessage.success(t("system.base.dict.message.delete_success"));
|
|
289
372
|
refreshTable();
|
|
290
373
|
});
|
|
291
374
|
},
|
|
292
375
|
() => {
|
|
293
|
-
ElMessage.info("
|
|
376
|
+
ElMessage.info(t("system.base.dict.message.delete_canceled"));
|
|
294
377
|
}
|
|
295
378
|
);
|
|
296
379
|
}
|
|
@@ -299,6 +382,6 @@ function handleDelete(selected?: number | string | Array<number | string> | Base
|
|
|
299
382
|
* 打开字典数据页面。
|
|
300
383
|
*/
|
|
301
384
|
function handleOpenBaseDictItem(row: BaseDict) {
|
|
302
|
-
navigateTo(router, "/base/dict/item", { dictId: row.id, title:
|
|
385
|
+
navigateTo(router, "/base/dict/item", { dictId: row.id, title: t("system.base.dict.title.items", { name: row.name }) });
|
|
303
386
|
}
|
|
304
387
|
</script>
|