@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.titleKey, { resource: t('system.config.resource') })"
|
|
15
|
+
:title="t(dialog.titleKey, { resource: t('system.base.config.resource') })"
|
|
16
16
|
width="1200px"
|
|
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 #textValue>
|
|
25
24
|
<el-input
|
|
26
25
|
v-model="formData.value"
|
|
27
|
-
:placeholder="t('
|
|
26
|
+
:placeholder="t('common.validation.required_input', { field: t('system.base.config.field.value') })"
|
|
28
27
|
/>
|
|
29
28
|
</template>
|
|
30
29
|
<template #imageValue>
|
|
@@ -39,12 +38,12 @@
|
|
|
39
38
|
v-model="formData.value"
|
|
40
39
|
:code="dictValueCode"
|
|
41
40
|
code-type="string"
|
|
42
|
-
:placeholder="t('
|
|
41
|
+
:placeholder="t('common.validation.required_select', { field: t('system.base.config.field.value') })"
|
|
43
42
|
/>
|
|
44
43
|
<el-input
|
|
45
44
|
v-else
|
|
46
45
|
v-model="formData.value"
|
|
47
|
-
:placeholder="t('
|
|
46
|
+
:placeholder="t('common.validation.required_input', { field: t('system.base.config.field.value') })"
|
|
48
47
|
/>
|
|
49
48
|
</template>
|
|
50
49
|
<template #booleanValue>
|
|
@@ -60,20 +59,14 @@
|
|
|
60
59
|
<template #nameTranslations>
|
|
61
60
|
<DynamicTranslationEditor
|
|
62
61
|
v-model="nameTranslationValues"
|
|
63
|
-
:
|
|
64
|
-
:resource-type="TranslationResourceType.TRANSLATION_RESOURCE_TYPE_CONFIG"
|
|
65
|
-
:field="BaseConfigTranslationField.BASE_CONFIG_TRANSLATION_FIELD_NAME"
|
|
66
|
-
:draft-enabled="configStore.translationDraftEnabled"
|
|
62
|
+
:source="formData.name"
|
|
67
63
|
:maxlength="100"
|
|
68
64
|
/>
|
|
69
65
|
</template>
|
|
70
66
|
<template #valueTranslations>
|
|
71
67
|
<DynamicTranslationEditor
|
|
72
68
|
v-model="valueTranslationValues"
|
|
73
|
-
:
|
|
74
|
-
:resource-type="TranslationResourceType.TRANSLATION_RESOURCE_TYPE_CONFIG"
|
|
75
|
-
:field="BaseConfigTranslationField.BASE_CONFIG_TRANSLATION_FIELD_VALUE"
|
|
76
|
-
:draft-enabled="configStore.translationDraftEnabled"
|
|
69
|
+
:source="formData.value"
|
|
77
70
|
:maxlength="10000"
|
|
78
71
|
multiline
|
|
79
72
|
/>
|
|
@@ -102,21 +95,27 @@ import type {
|
|
|
102
95
|
BaseConfigForm,
|
|
103
96
|
PageBaseConfigRequest
|
|
104
97
|
} from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_config";
|
|
105
|
-
import type {
|
|
106
|
-
import { BaseConfigSite } from "@liujitcn/kratos-admin-system/rpc/base/v1/
|
|
98
|
+
import type { BaseTranslation } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_translation";
|
|
99
|
+
import { BaseConfigSite } from "@liujitcn/kratos-admin-system/rpc/base/v1/config";
|
|
107
100
|
import { Status } from "@liujitcn/kratos-admin-system/rpc/common/v1/enum";
|
|
108
|
-
import { BaseConfigType } from "@liujitcn/kratos-admin-system/rpc/system/
|
|
101
|
+
import { BaseConfigType } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_config";
|
|
102
|
+
import { TranslationTargetType } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_translation";
|
|
109
103
|
import { buildPageRequest, normalizeSelectedIds } from "@liujitcn/kratos-admin-core/table";
|
|
110
104
|
import { t } from "@liujitcn/kratos-admin-core";
|
|
111
|
-
import { useConfigStore } from "@liujitcn/kratos-admin-core/stores/runtime";
|
|
112
105
|
import DynamicTranslationEditor from "@liujitcn/kratos-admin-system/components/DynamicTranslationEditor.vue";
|
|
113
106
|
import DynamicTranslationCell from "@liujitcn/kratos-admin-system/components/DynamicTranslationCell.vue";
|
|
114
|
-
import { getEditableLanguageOptions, type DynamicTranslationValue } from "@liujitcn/kratos-admin-system/components/dynamicTranslation";
|
|
115
107
|
import {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
108
|
+
getEditableLanguageOptions,
|
|
109
|
+
type DynamicTranslationValue
|
|
110
|
+
} from "@liujitcn/kratos-admin-system/components/dynamicTranslation";
|
|
111
|
+
|
|
112
|
+
/** 系统配置编辑表单状态,新增时枚举字段保持为空,避免把未知值 0 显示为下拉文本。 */
|
|
113
|
+
type BaseConfigFormState = Omit<BaseConfigForm, "site" | "type"> & {
|
|
114
|
+
/** 配置位置。 */
|
|
115
|
+
site?: BaseConfigSite;
|
|
116
|
+
/** 配置类型。 */
|
|
117
|
+
type?: BaseConfigType;
|
|
118
|
+
};
|
|
120
119
|
|
|
121
120
|
defineOptions({
|
|
122
121
|
name: "BaseConfig",
|
|
@@ -124,132 +123,130 @@ defineOptions({
|
|
|
124
123
|
});
|
|
125
124
|
|
|
126
125
|
const { BUTTONS } = useAuthButtons();
|
|
127
|
-
const configStore = useConfigStore();
|
|
128
126
|
const proTable = ref<ProTableInstance>();
|
|
129
127
|
const formDialogRef = ref<InstanceType<typeof FormDialog>>();
|
|
130
128
|
|
|
131
129
|
const dialog = reactive({
|
|
132
|
-
titleKey: "
|
|
130
|
+
titleKey: "common.action.create_resource",
|
|
133
131
|
visible: false
|
|
134
132
|
});
|
|
135
133
|
|
|
136
|
-
const formData = reactive<
|
|
134
|
+
const formData = reactive<BaseConfigFormState>({
|
|
137
135
|
/** 配置ID */
|
|
138
136
|
id: 0,
|
|
139
137
|
/** 位置:枚举【BaseConfigSite】 */
|
|
140
|
-
site:
|
|
138
|
+
site: undefined,
|
|
141
139
|
/** 配置名称 */
|
|
142
140
|
name: "",
|
|
143
141
|
/** 配置类型:枚举【BaseConfigType】 */
|
|
144
|
-
type:
|
|
142
|
+
type: undefined,
|
|
145
143
|
/** 配置key */
|
|
146
144
|
key: "",
|
|
147
145
|
/** 配置value */
|
|
148
146
|
value: "",
|
|
149
147
|
/** 状态 */
|
|
150
148
|
status: Status.ENABLE,
|
|
151
|
-
/**
|
|
152
|
-
|
|
149
|
+
/** 配置名称非主语言翻译。 */
|
|
150
|
+
name_translations: [],
|
|
151
|
+
/** 配置文本或富文本值的非主语言翻译。 */
|
|
152
|
+
value_translations: []
|
|
153
153
|
});
|
|
154
154
|
|
|
155
|
-
/**
|
|
156
|
-
function normalizeConfigTranslations(
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
created_by: record?.created_by ?? 0,
|
|
171
|
-
updated_by: record?.updated_by ?? 0,
|
|
172
|
-
created_at: record?.created_at ?? "",
|
|
173
|
-
updated_at: record?.updated_at ?? "",
|
|
174
|
-
deleted_at: record?.deleted_at ?? 0
|
|
175
|
-
};
|
|
176
|
-
});
|
|
155
|
+
/** 将配置值翻译记录转换为编辑器值,缺少记录时保留可编辑的空行。 */
|
|
156
|
+
function normalizeConfigTranslations(targetType: TranslationTargetType): DynamicTranslationValue[] {
|
|
157
|
+
const records = targetType === TranslationTargetType.TRANSLATION_TARGET_TYPE_BASE_CONFIG_NAME
|
|
158
|
+
? formData.name_translations
|
|
159
|
+
: formData.value_translations;
|
|
160
|
+
return getEditableLanguageOptions()
|
|
161
|
+
.map(item => item.value)
|
|
162
|
+
.map(locale => {
|
|
163
|
+
const record = records?.find(item => item.locale === locale);
|
|
164
|
+
return {
|
|
165
|
+
id: record?.id ?? 0,
|
|
166
|
+
locale,
|
|
167
|
+
text: record?.name ?? ""
|
|
168
|
+
};
|
|
169
|
+
});
|
|
177
170
|
}
|
|
178
171
|
|
|
179
|
-
/**
|
|
180
|
-
function updateConfigTranslations(
|
|
181
|
-
const
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
172
|
+
/** 保存指定目标类型的编辑器值,并保留其他字段的翻译。 */
|
|
173
|
+
function updateConfigTranslations(targetType: TranslationTargetType, values: DynamicTranslationValue[]) {
|
|
174
|
+
const next = values.map(
|
|
175
|
+
item =>
|
|
176
|
+
({
|
|
177
|
+
...item,
|
|
178
|
+
target_type: targetType,
|
|
179
|
+
target_id: formData.id,
|
|
180
|
+
name: item.text
|
|
181
|
+
}) as BaseTranslation
|
|
189
182
|
);
|
|
190
|
-
|
|
183
|
+
if (targetType === TranslationTargetType.TRANSLATION_TARGET_TYPE_BASE_CONFIG_NAME) {
|
|
184
|
+
formData.name_translations = next;
|
|
185
|
+
} else {
|
|
186
|
+
formData.value_translations = next;
|
|
187
|
+
}
|
|
191
188
|
}
|
|
192
189
|
|
|
193
190
|
const nameTranslationValues = computed<DynamicTranslationValue[]>({
|
|
194
|
-
get: () => normalizeConfigTranslations(
|
|
195
|
-
set: values => updateConfigTranslations(
|
|
191
|
+
get: () => normalizeConfigTranslations(TranslationTargetType.TRANSLATION_TARGET_TYPE_BASE_CONFIG_NAME),
|
|
192
|
+
set: values => updateConfigTranslations(TranslationTargetType.TRANSLATION_TARGET_TYPE_BASE_CONFIG_NAME, values)
|
|
196
193
|
});
|
|
197
194
|
|
|
198
195
|
const valueTranslationValues = computed<DynamicTranslationValue[]>({
|
|
199
|
-
get: () => normalizeConfigTranslations(
|
|
200
|
-
set: values => updateConfigTranslations(
|
|
196
|
+
get: () => normalizeConfigTranslations(TranslationTargetType.TRANSLATION_TARGET_TYPE_BASE_CONFIG_VALUE),
|
|
197
|
+
set: values => updateConfigTranslations(TranslationTargetType.TRANSLATION_TARGET_TYPE_BASE_CONFIG_VALUE, values)
|
|
201
198
|
});
|
|
202
199
|
|
|
203
200
|
const rules = computed(() => ({
|
|
204
201
|
site: [
|
|
205
202
|
{
|
|
206
203
|
required: true,
|
|
207
|
-
message: t("
|
|
204
|
+
message: t("common.validation.required_select", { field: t("system.base.config.field.site") }),
|
|
208
205
|
trigger: "change"
|
|
209
206
|
}
|
|
210
207
|
],
|
|
211
208
|
name: [
|
|
212
209
|
{
|
|
213
210
|
required: true,
|
|
214
|
-
message: t("
|
|
211
|
+
message: t("common.validation.required_input", { field: t("system.base.config.field.name") }),
|
|
215
212
|
trigger: "blur"
|
|
216
213
|
},
|
|
217
214
|
{
|
|
218
215
|
max: 50,
|
|
219
|
-
message: t("
|
|
216
|
+
message: t("common.validation.max_length", { field: t("system.base.config.field.name"), max: 50 }),
|
|
220
217
|
trigger: "blur"
|
|
221
218
|
}
|
|
222
219
|
],
|
|
223
220
|
type: [
|
|
224
221
|
{
|
|
225
222
|
required: true,
|
|
226
|
-
message: t("
|
|
223
|
+
message: t("common.validation.required_select", { field: t("system.base.config.field.type") }),
|
|
227
224
|
trigger: "change"
|
|
228
225
|
}
|
|
229
226
|
],
|
|
230
227
|
key: [
|
|
231
228
|
{
|
|
232
229
|
required: true,
|
|
233
|
-
message: t("
|
|
230
|
+
message: t("common.validation.required_input", { field: t("system.base.config.field.key") }),
|
|
234
231
|
trigger: "blur"
|
|
235
232
|
},
|
|
236
233
|
{
|
|
237
234
|
max: 50,
|
|
238
|
-
message: t("
|
|
235
|
+
message: t("common.validation.max_length", { field: t("system.base.config.field.key"), max: 50 }),
|
|
239
236
|
trigger: "blur"
|
|
240
237
|
}
|
|
241
238
|
],
|
|
242
239
|
value: [
|
|
243
240
|
{
|
|
244
241
|
required: true,
|
|
245
|
-
message: t("
|
|
242
|
+
message: t("common.validation.required_input", { field: t("system.base.config.field.value") }),
|
|
246
243
|
trigger: "blur"
|
|
247
244
|
}
|
|
248
245
|
],
|
|
249
246
|
status: [
|
|
250
247
|
{
|
|
251
248
|
required: true,
|
|
252
|
-
message: t("
|
|
249
|
+
message: t("common.validation.required_select", { field: t("common.field.status") }),
|
|
253
250
|
trigger: "change"
|
|
254
251
|
}
|
|
255
252
|
]
|
|
@@ -272,111 +269,124 @@ const dictValueCode = computed(() => BASE_CONFIG_DICT_CODE_MAP[formData.key] ??
|
|
|
272
269
|
const formFields = computed<ProFormField[]>(() => [
|
|
273
270
|
{
|
|
274
271
|
prop: "name",
|
|
275
|
-
label: t("system.config.field.name"),
|
|
272
|
+
label: t("system.base.config.field.name"),
|
|
276
273
|
component: "input",
|
|
277
274
|
props: {
|
|
278
|
-
placeholder: t("
|
|
275
|
+
placeholder: t("common.validation.required_input", { field: t("system.base.config.field.name") }),
|
|
279
276
|
disabled: formData.id > 0
|
|
280
277
|
}
|
|
281
278
|
},
|
|
282
279
|
{
|
|
283
280
|
prop: "site",
|
|
284
|
-
label: t("system.config.field.site"),
|
|
281
|
+
label: t("system.base.config.field.site"),
|
|
285
282
|
component: "dict",
|
|
286
283
|
props: { code: "base_config_site", disabled: formData.id > 0 }
|
|
287
284
|
},
|
|
288
285
|
{
|
|
289
286
|
prop: "key",
|
|
290
|
-
label: t("system.config.field.key"),
|
|
287
|
+
label: t("system.base.config.field.key"),
|
|
291
288
|
component: "input",
|
|
292
289
|
props: {
|
|
293
|
-
placeholder: t("
|
|
290
|
+
placeholder: t("common.validation.required_input", { field: t("system.base.config.field.key") }),
|
|
294
291
|
disabled: formData.id > 0
|
|
295
292
|
}
|
|
296
293
|
},
|
|
297
294
|
{
|
|
298
295
|
prop: "type",
|
|
299
|
-
label: t("system.config.field.type"),
|
|
296
|
+
label: t("system.base.config.field.type"),
|
|
300
297
|
component: "dict",
|
|
301
298
|
props: { code: "base_config_type", disabled: formData.id > 0 }
|
|
302
299
|
},
|
|
303
300
|
{
|
|
304
301
|
prop: "value",
|
|
305
|
-
label: t("system.config.field.value"),
|
|
302
|
+
label: t("system.base.config.field.value"),
|
|
306
303
|
component: "slot",
|
|
307
304
|
slotName: "textValue",
|
|
308
|
-
visible: model => model.type == BaseConfigType.
|
|
305
|
+
visible: model => model.type == BaseConfigType.BASE_CONFIG_TYPE_TEXT
|
|
309
306
|
},
|
|
310
307
|
{
|
|
311
308
|
prop: "value",
|
|
312
|
-
label: t("system.config.field.value"),
|
|
309
|
+
label: t("system.base.config.field.value"),
|
|
313
310
|
component: "slot",
|
|
314
311
|
slotName: "imageValue",
|
|
315
|
-
visible: model => model.type == BaseConfigType.
|
|
312
|
+
visible: model => model.type == BaseConfigType.BASE_CONFIG_TYPE_IMAGE
|
|
316
313
|
},
|
|
317
314
|
{
|
|
318
315
|
prop: "value",
|
|
319
|
-
label: t("system.config.field.value"),
|
|
316
|
+
label: t("system.base.config.field.value"),
|
|
320
317
|
component: "slot",
|
|
321
318
|
slotName: "richTextValue",
|
|
322
|
-
visible: model => model.type == BaseConfigType.
|
|
319
|
+
visible: model => model.type == BaseConfigType.BASE_CONFIG_TYPE_RICH_TEXT,
|
|
323
320
|
colSpan: 24
|
|
324
321
|
},
|
|
325
322
|
{
|
|
326
323
|
prop: "value",
|
|
327
|
-
label: t("system.config.field.value"),
|
|
324
|
+
label: t("system.base.config.field.value"),
|
|
328
325
|
component: "slot",
|
|
329
326
|
slotName: "dictValue",
|
|
330
|
-
visible: model => model.type == BaseConfigType.
|
|
327
|
+
visible: model => model.type == BaseConfigType.BASE_CONFIG_TYPE_DICT
|
|
331
328
|
},
|
|
332
329
|
{
|
|
333
330
|
prop: "value",
|
|
334
|
-
label: t("system.config.field.value"),
|
|
331
|
+
label: t("system.base.config.field.value"),
|
|
335
332
|
component: "slot",
|
|
336
333
|
slotName: "booleanValue",
|
|
337
|
-
visible: model => model.type == BaseConfigType.
|
|
334
|
+
visible: model => model.type == BaseConfigType.BASE_CONFIG_TYPE_BOOLEAN
|
|
338
335
|
},
|
|
339
336
|
{
|
|
340
337
|
prop: "translations",
|
|
341
|
-
label: t("system.translation.field.
|
|
338
|
+
label: t("system.base.translation.field.name_translations"),
|
|
342
339
|
component: "slot",
|
|
343
340
|
slotName: "nameTranslations",
|
|
344
341
|
colSpan: 24
|
|
345
342
|
},
|
|
346
343
|
{
|
|
347
344
|
prop: "translations",
|
|
348
|
-
label: t("system.translation.field.
|
|
345
|
+
label: t("system.base.translation.field.value_translations"),
|
|
349
346
|
component: "slot",
|
|
350
347
|
slotName: "valueTranslations",
|
|
351
|
-
visible: model =>
|
|
348
|
+
visible: model =>
|
|
349
|
+
model.type == BaseConfigType.BASE_CONFIG_TYPE_TEXT || model.type == BaseConfigType.BASE_CONFIG_TYPE_RICH_TEXT,
|
|
352
350
|
colSpan: 24
|
|
353
351
|
},
|
|
354
|
-
{ prop: "status", label: t("
|
|
352
|
+
{ prop: "status", label: t("common.field.status"), component: "radio-group", options: statusOptions.value }
|
|
355
353
|
]);
|
|
356
354
|
|
|
357
355
|
/** 系统配置表格列配置。 */
|
|
358
356
|
const columns = computed<ColumnProps[]>(() => [
|
|
359
357
|
{ type: "selection", width: 55 },
|
|
360
|
-
{
|
|
358
|
+
{
|
|
359
|
+
prop: "site",
|
|
360
|
+
label: t("system.base.config.field.site"),
|
|
361
|
+
minWidth: 120,
|
|
362
|
+
dictCode: "base_config_site",
|
|
363
|
+
search: { el: "select" }
|
|
364
|
+
},
|
|
361
365
|
{
|
|
362
366
|
prop: "name",
|
|
363
|
-
label: t("system.config.field.name"),
|
|
367
|
+
label: t("system.base.config.field.name"),
|
|
364
368
|
minWidth: 140,
|
|
365
369
|
search: { el: "input" },
|
|
366
370
|
showOverflowTooltip: false,
|
|
367
371
|
render: scope => renderConfigNameCell(scope.row as BaseConfig)
|
|
368
372
|
},
|
|
369
|
-
{
|
|
373
|
+
{
|
|
374
|
+
prop: "type",
|
|
375
|
+
label: t("system.base.config.field.type"),
|
|
376
|
+
minWidth: 120,
|
|
377
|
+
dictCode: "base_config_type",
|
|
378
|
+
search: { el: "select" }
|
|
379
|
+
},
|
|
370
380
|
{
|
|
371
381
|
prop: "key",
|
|
372
|
-
label: t("system.config.field.key"),
|
|
382
|
+
label: t("system.base.config.field.key"),
|
|
373
383
|
minWidth: 160,
|
|
374
384
|
search: { el: "input" },
|
|
375
385
|
render: scope => renderConfigKeyCell(scope.row as BaseConfig)
|
|
376
386
|
},
|
|
377
387
|
{
|
|
378
388
|
prop: "status",
|
|
379
|
-
label: t("
|
|
389
|
+
label: t("common.field.status"),
|
|
380
390
|
minWidth: 100,
|
|
381
391
|
search: { el: "select" },
|
|
382
392
|
cellType: "status",
|
|
@@ -389,11 +399,11 @@ const columns = computed<ColumnProps[]>(() => [
|
|
|
389
399
|
beforeChange: scope => handleBeforeSetStatus(scope.row as BaseConfig)
|
|
390
400
|
}
|
|
391
401
|
},
|
|
392
|
-
{ prop: "created_at", label: t("
|
|
393
|
-
{ prop: "updated_at", label: t("
|
|
402
|
+
{ prop: "created_at", label: t("common.field.created_at"), minWidth: 180 },
|
|
403
|
+
{ prop: "updated_at", label: t("common.field.updated_at"), minWidth: 180 },
|
|
394
404
|
{
|
|
395
405
|
prop: "operation",
|
|
396
|
-
label: t("
|
|
406
|
+
label: t("common.field.operation"),
|
|
397
407
|
width: 150,
|
|
398
408
|
fixed: "right",
|
|
399
409
|
cellType: "actions",
|
|
@@ -419,14 +429,13 @@ const columns = computed<ColumnProps[]>(() => [
|
|
|
419
429
|
}
|
|
420
430
|
]);
|
|
421
431
|
|
|
422
|
-
/**
|
|
432
|
+
/** 渲染系统配置名称翻译预览。 */
|
|
423
433
|
function renderConfigNameCell(row: BaseConfig) {
|
|
424
434
|
return h(DynamicTranslationCell, {
|
|
425
435
|
source: row.name,
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
textField: "text"
|
|
436
|
+
targetType: TranslationTargetType.TRANSLATION_TARGET_TYPE_BASE_CONFIG_NAME,
|
|
437
|
+
targetId: row.id,
|
|
438
|
+
translations: row.translations
|
|
430
439
|
});
|
|
431
440
|
}
|
|
432
441
|
|
|
@@ -454,7 +463,7 @@ function renderConfigKeyCell(row: BaseConfig) {
|
|
|
454
463
|
* 根据配置类型渲染悬停预览内容。
|
|
455
464
|
*/
|
|
456
465
|
function renderConfigValuePreview(row: BaseConfig) {
|
|
457
|
-
if (row.type === BaseConfigType.
|
|
466
|
+
if (row.type === BaseConfigType.BASE_CONFIG_TYPE_IMAGE) {
|
|
458
467
|
return row.value
|
|
459
468
|
? h(ElImage, {
|
|
460
469
|
src: row.value,
|
|
@@ -463,15 +472,15 @@ function renderConfigValuePreview(row: BaseConfig) {
|
|
|
463
472
|
fit: "contain",
|
|
464
473
|
style: { width: "180px", height: "120px", borderRadius: "4px" }
|
|
465
474
|
})
|
|
466
|
-
: h("span", { class: "config-value-preview" }, t("system.config.message.
|
|
475
|
+
: h("span", { class: "config-value-preview" }, t("system.base.config.message.image_missing"));
|
|
467
476
|
}
|
|
468
477
|
|
|
469
|
-
if (row.type === BaseConfigType.
|
|
478
|
+
if (row.type === BaseConfigType.BASE_CONFIG_TYPE_BOOLEAN) {
|
|
470
479
|
const value = row.value === "true" ? "true" : "false";
|
|
471
480
|
return h(ElTag, { type: value === "true" ? "success" : "info" }, () => value);
|
|
472
481
|
}
|
|
473
482
|
|
|
474
|
-
if (row.type === BaseConfigType.
|
|
483
|
+
if (row.type === BaseConfigType.BASE_CONFIG_TYPE_DICT && BASE_CONFIG_DICT_CODE_MAP[row.key]) {
|
|
475
484
|
return h(DictLabel, {
|
|
476
485
|
code: BASE_CONFIG_DICT_CODE_MAP[row.key],
|
|
477
486
|
modelValue: row.value,
|
|
@@ -479,14 +488,14 @@ function renderConfigValuePreview(row: BaseConfig) {
|
|
|
479
488
|
});
|
|
480
489
|
}
|
|
481
490
|
|
|
482
|
-
if (row.type === BaseConfigType.
|
|
491
|
+
if (row.type === BaseConfigType.BASE_CONFIG_TYPE_RICH_TEXT) {
|
|
483
492
|
return row.value
|
|
484
493
|
? h("div", { class: "config-rich-text-preview", innerHTML: row.value })
|
|
485
|
-
: h("span", { class: "config-value-preview" }, t("system.config.message.
|
|
494
|
+
: h("span", { class: "config-value-preview" }, t("system.base.config.message.rich_text_missing"));
|
|
486
495
|
}
|
|
487
496
|
|
|
488
497
|
const value = row.value;
|
|
489
|
-
return h("span", { class: "config-value-preview" }, value || t("system.config.message.
|
|
498
|
+
return h("span", { class: "config-value-preview" }, value || t("system.base.config.message.value_missing"));
|
|
490
499
|
}
|
|
491
500
|
|
|
492
501
|
/** 系统配置顶部按钮配置。 */
|
|
@@ -507,7 +516,7 @@ const headerActions = computed<HeaderActionProps[]>(() => [
|
|
|
507
516
|
onClick: scope => handleDelete(scope.selectedList as BaseConfig[])
|
|
508
517
|
},
|
|
509
518
|
{
|
|
510
|
-
label: t("
|
|
519
|
+
label: t("common.action.refresh_cache"),
|
|
511
520
|
type: "primary",
|
|
512
521
|
icon: RefreshLeft,
|
|
513
522
|
hidden: () => !BUTTONS.value["base:config:refresh"],
|
|
@@ -537,7 +546,7 @@ function refreshTable() {
|
|
|
537
546
|
async function handleOpenDialog(configId?: number) {
|
|
538
547
|
await loadEnabledBaseLanguages();
|
|
539
548
|
resetForm();
|
|
540
|
-
dialog.titleKey = configId ? "
|
|
549
|
+
dialog.titleKey = configId ? "common.action.edit_resource" : "common.action.create_resource";
|
|
541
550
|
dialog.visible = true;
|
|
542
551
|
if (!configId) return;
|
|
543
552
|
|
|
@@ -559,12 +568,13 @@ function resetForm() {
|
|
|
559
568
|
formDialogRef.value?.resetFields();
|
|
560
569
|
formDialogRef.value?.clearValidate();
|
|
561
570
|
formData.id = 0;
|
|
562
|
-
formData.site =
|
|
571
|
+
formData.site = undefined;
|
|
563
572
|
formData.name = "";
|
|
564
|
-
formData.type =
|
|
573
|
+
formData.type = undefined;
|
|
565
574
|
formData.key = "";
|
|
566
575
|
formData.value = "";
|
|
567
|
-
formData.
|
|
576
|
+
formData.name_translations = [];
|
|
577
|
+
formData.value_translations = [];
|
|
568
578
|
formData.status = Status.ENABLE;
|
|
569
579
|
}
|
|
570
580
|
|
|
@@ -572,7 +582,7 @@ function resetForm() {
|
|
|
572
582
|
* 提交系统配置表单。
|
|
573
583
|
*/
|
|
574
584
|
function handleSubmit() {
|
|
575
|
-
if (formData.type === BaseConfigType.
|
|
585
|
+
if (formData.type === BaseConfigType.BASE_CONFIG_TYPE_BOOLEAN) {
|
|
576
586
|
formData.value = formData.value === "true" ? "true" : "false";
|
|
577
587
|
}
|
|
578
588
|
formDialogRef.value?.validate()?.then(valid => {
|
|
@@ -584,8 +594,8 @@ function handleSubmit() {
|
|
|
584
594
|
: defBaseConfigService.CreateBaseConfig({ base_config: submitData });
|
|
585
595
|
request.then(() => {
|
|
586
596
|
ElMessage.success(
|
|
587
|
-
t(submitData.id ? "
|
|
588
|
-
resource: t("system.config.resource")
|
|
597
|
+
t(submitData.id ? "common.message.update_success" : "common.message.create_success", {
|
|
598
|
+
resource: t("system.base.config.resource")
|
|
589
599
|
})
|
|
590
600
|
);
|
|
591
601
|
handleCloseDialog();
|
|
@@ -599,7 +609,7 @@ function handleSubmit() {
|
|
|
599
609
|
*/
|
|
600
610
|
const handleRefreshCache = useDebounceFn(() => {
|
|
601
611
|
defBaseConfigService.RefreshBaseConfigCache({}).then(() => {
|
|
602
|
-
ElMessage.success(t("
|
|
612
|
+
ElMessage.success(t("common.message.refresh_success"));
|
|
603
613
|
});
|
|
604
614
|
}, 1000);
|
|
605
615
|
|
|
@@ -612,10 +622,10 @@ async function handleBeforeSetStatus(row: BaseConfig) {
|
|
|
612
622
|
const configName = row.name || row.key || `ID:${row.id}`;
|
|
613
623
|
try {
|
|
614
624
|
await ElMessageBox.confirm(
|
|
615
|
-
t("
|
|
625
|
+
t("common.dialog.status_change", {
|
|
616
626
|
action: text,
|
|
617
|
-
resource: t("system.config.resource"),
|
|
618
|
-
field: t("system.config.field.name"),
|
|
627
|
+
resource: t("system.base.config.resource"),
|
|
628
|
+
field: t("system.base.config.field.name"),
|
|
619
629
|
value: configName
|
|
620
630
|
}),
|
|
621
631
|
t("common.title.notice"),
|
|
@@ -626,7 +636,7 @@ async function handleBeforeSetStatus(row: BaseConfig) {
|
|
|
626
636
|
}
|
|
627
637
|
);
|
|
628
638
|
await defBaseConfigService.SetBaseConfigStatus({ id: row.id, status: nextStatus });
|
|
629
|
-
ElMessage.success(t("
|
|
639
|
+
ElMessage.success(t("common.message.status_success", { action: text }));
|
|
630
640
|
refreshTable();
|
|
631
641
|
return true;
|
|
632
642
|
} catch {
|
|
@@ -649,15 +659,15 @@ function handleDelete(selected?: number | string | Array<number | string> | Base
|
|
|
649
659
|
: normalizeSelectedIds(selected as number | string | Array<number | string>)
|
|
650
660
|
).join(",");
|
|
651
661
|
if (!configIds) {
|
|
652
|
-
ElMessage.warning(t("
|
|
662
|
+
ElMessage.warning(t("common.message.select_delete_item"));
|
|
653
663
|
return;
|
|
654
664
|
}
|
|
655
665
|
|
|
656
666
|
const confirmMessage = configList.length
|
|
657
667
|
? configList.length === 1
|
|
658
|
-
? `${t("
|
|
659
|
-
: t("
|
|
660
|
-
: t("
|
|
668
|
+
? `${t("common.dialog.delete_single", { resource: t("system.base.config.resource") })}\n${t("common.dialog.resource_field", { field: t("system.base.config.field.name"), value: configList[0].name || configList[0].key || `ID:${configList[0].id}` })}`
|
|
669
|
+
: t("common.dialog.delete_batch", { count: configList.length, unit: "", resource: t("system.base.config.resource") })
|
|
670
|
+
: t("common.dialog.delete_selected", { resource: t("system.base.config.resource") });
|
|
661
671
|
|
|
662
672
|
ElMessageBox.confirm(confirmMessage, t("common.title.warning"), {
|
|
663
673
|
confirmButtonText: t("common.action.confirm"),
|
|
@@ -666,12 +676,12 @@ function handleDelete(selected?: number | string | Array<number | string> | Base
|
|
|
666
676
|
}).then(
|
|
667
677
|
() => {
|
|
668
678
|
defBaseConfigService.DeleteBaseConfig({ id: configIds }).then(() => {
|
|
669
|
-
ElMessage.success(t("
|
|
679
|
+
ElMessage.success(t("common.message.delete_success", { resource: t("system.base.config.resource") }));
|
|
670
680
|
refreshTable();
|
|
671
681
|
});
|
|
672
682
|
},
|
|
673
683
|
() => {
|
|
674
|
-
ElMessage.info(t("
|
|
684
|
+
ElMessage.info(t("common.dialog.cancel_delete", { resource: t("system.base.config.resource") }));
|
|
675
685
|
}
|
|
676
686
|
);
|
|
677
687
|
}
|