@liujitcn/kratos-admin-system 0.0.28 → 0.0.29
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 +1 -1
- package/dist/package/declarations/src/api/system/base_i18n.d.ts +5 -5
- package/dist/package/declarations/src/components/DynamicI18nCell.vue.d.ts +16 -0
- package/dist/package/declarations/src/components/DynamicI18nEditor.vue.d.ts +20 -0
- package/dist/package/declarations/src/components/dynamicI18n.d.ts +38 -0
- package/dist/package/declarations/src/locales/generated.d.ts +52 -52
- package/dist/package/declarations/src/rpc/system/admin/v1/base_config.d.ts +3 -3
- package/dist/package/declarations/src/rpc/system/admin/v1/base_dict.d.ts +4 -4
- package/dist/package/declarations/src/rpc/system/admin/v1/base_i18n.d.ts +23 -23
- package/dist/package/declarations/src/rpc/system/admin/v1/base_menu.d.ts +2 -2
- package/dist/package/declarations/src/rpc/system/admin/v1/code_gen.d.ts +1 -1
- package/dist/package/src/api/system/base_i18n.ts +12 -12
- package/dist/package/src/components/{DynamicTranslationCell.vue → DynamicI18nCell.vue} +50 -50
- package/dist/package/src/components/{DynamicTranslationEditor.vue → DynamicI18nEditor.vue} +45 -45
- package/dist/package/src/components/{dynamicTranslation.ts → dynamicI18n.ts} +15 -15
- package/dist/package/src/locales/README.md +1 -1
- package/dist/package/src/locales/en-US.json +15 -15
- package/dist/package/src/locales/ja-JP.json +13 -13
- package/dist/package/src/locales/zh-CN.json +13 -13
- package/dist/package/src/locales/zh-TW.json +13 -13
- package/dist/package/src/rpc/system/admin/v1/base_config.ts +3 -3
- package/dist/package/src/rpc/system/admin/v1/base_dict.ts +4 -4
- package/dist/package/src/rpc/system/admin/v1/base_i18n.ts +23 -23
- package/dist/package/src/rpc/system/admin/v1/base_menu.ts +2 -2
- package/dist/package/src/rpc/system/admin/v1/code_gen.ts +1 -1
- package/dist/package/src/views/base/config/index.vue +38 -38
- package/dist/package/src/views/base/dict/index.vue +23 -23
- package/dist/package/src/views/base/dict/item.vue +25 -25
- package/dist/package/src/views/base/menu/index.vue +23 -23
- package/dist/package/src/views/tool/code-gen/code-preview/index.vue +9 -9
- package/dist/package/src/views/tool/code-gen/columns/index.vue +1 -1
- package/dist/package/src/views/tool/code-gen/components/CodeGenLocaleEditor.vue +8 -8
- package/dist/package/src/views/tool/code-gen/table/index.vue +7 -7
- package/package.json +2 -2
- package/dist/package/declarations/src/components/DynamicTranslationCell.vue.d.ts +0 -16
- package/dist/package/declarations/src/components/DynamicTranslationEditor.vue.d.ts +0 -20
- package/dist/package/declarations/src/components/dynamicTranslation.d.ts +0 -38
|
@@ -248,17 +248,17 @@
|
|
|
248
248
|
"system.base.user.message.confirm_delete_selected": "選択したユーザーを削除してもよろしいですか?",
|
|
249
249
|
"system.base.user.message.delete_success": "ユーザーは正常に削除されました",
|
|
250
250
|
"system.base.user.message.delete_canceled": "ユーザーの削除を取り消しました",
|
|
251
|
-
"system.base.
|
|
252
|
-
"system.base.
|
|
253
|
-
"system.base.
|
|
254
|
-
"system.base.
|
|
255
|
-
"system.base.
|
|
256
|
-
"system.base.
|
|
257
|
-
"system.base.
|
|
258
|
-
"system.base.
|
|
259
|
-
"system.base.
|
|
260
|
-
"system.base.
|
|
261
|
-
"system.base.
|
|
251
|
+
"system.base.i18n.field.i18ns": "多言語翻訳",
|
|
252
|
+
"system.base.i18n.field.name_i18ns": "名前の変換",
|
|
253
|
+
"system.base.i18n.field.value_i18ns": "値の変換",
|
|
254
|
+
"system.base.i18n.placeholder.text": "{language} の翻訳を入力してください",
|
|
255
|
+
"system.base.i18n.action.translate": "翻訳",
|
|
256
|
+
"system.base.i18n.action.batch_translate": "バッチ翻訳",
|
|
257
|
+
"system.base.i18n.message.translate_success": "{language} 翻訳が完了しました",
|
|
258
|
+
"system.base.i18n.message.translate_failed": "{language} 変換に失敗しました",
|
|
259
|
+
"system.base.i18n.message.batch_translate_success": "{count} 言語での翻訳が完了しました",
|
|
260
|
+
"system.base.i18n.message.batch_translate_partial": "{success} 言語の翻訳は完了し、{failed} 言語の翻訳は失敗しました",
|
|
261
|
+
"system.base.i18n.message.batch_translate_failed": "バッチ翻訳に失敗しました",
|
|
262
262
|
"system.base.menu.title.list": "メニューリスト",
|
|
263
263
|
"system.base.menu.action.create": "新しいメニュー",
|
|
264
264
|
"system.base.menu.action.edit": "メニューの変更",
|
|
@@ -626,7 +626,7 @@
|
|
|
626
626
|
"system.code.gen.validation.left_tree_parent_required": "左側のツリーの親フィールドを選択してください",
|
|
627
627
|
"system.code.gen.validation.left_tree_label_required": "左側のツリー表示フィールドを選択してください",
|
|
628
628
|
"system.code.gen.validation.left_tree_value_required": "左側のツリー値フィールドを選択してください",
|
|
629
|
-
"system.code.gen.i18n.field.
|
|
629
|
+
"system.code.gen.i18n.field.i18ns": "非メイン言語の説明",
|
|
630
630
|
"system.code.gen.i18n.action.edit_column": "非主言語フィールドの説明を編集する",
|
|
631
631
|
"system.code.gen.i18n.status.complete": "記入済み",
|
|
632
632
|
"system.code.gen.i18n.status.missing": "がありません",
|
|
@@ -881,7 +881,7 @@
|
|
|
881
881
|
"system.code.gen.preview.message.create_success": "が正常に追加されました",
|
|
882
882
|
"system.code.gen.preview.message.update_success": "は正常に変更されました",
|
|
883
883
|
"system.code.gen.preview.message.delete_success": "削除に成功しました",
|
|
884
|
-
"system.code.gen.preview.message.
|
|
884
|
+
"system.code.gen.preview.message.missing_i18ns": "は正式に生成する前に完了する必要があります: {items}",
|
|
885
885
|
"system.code.gen.preview.value.list_separator": "、",
|
|
886
886
|
"system.project.document.title.navigation": "プロジェクトドキュメントディレクトリ",
|
|
887
887
|
"system.project.document.placeholder.search": "検索項目またはパス",
|
|
@@ -248,17 +248,17 @@
|
|
|
248
248
|
"system.base.user.message.confirm_delete_selected": "确认删除已选中的用户吗?",
|
|
249
249
|
"system.base.user.message.delete_success": "删除用户成功",
|
|
250
250
|
"system.base.user.message.delete_canceled": "已取消删除用户",
|
|
251
|
-
"system.base.
|
|
252
|
-
"system.base.
|
|
253
|
-
"system.base.
|
|
254
|
-
"system.base.
|
|
255
|
-
"system.base.
|
|
256
|
-
"system.base.
|
|
257
|
-
"system.base.
|
|
258
|
-
"system.base.
|
|
259
|
-
"system.base.
|
|
260
|
-
"system.base.
|
|
261
|
-
"system.base.
|
|
251
|
+
"system.base.i18n.field.i18ns": "多语言翻译",
|
|
252
|
+
"system.base.i18n.field.name_i18ns": "名称翻译",
|
|
253
|
+
"system.base.i18n.field.value_i18ns": "值翻译",
|
|
254
|
+
"system.base.i18n.placeholder.text": "请输入{language}译文",
|
|
255
|
+
"system.base.i18n.action.translate": "翻译",
|
|
256
|
+
"system.base.i18n.action.batch_translate": "批量翻译",
|
|
257
|
+
"system.base.i18n.message.translate_success": "{language}翻译完成",
|
|
258
|
+
"system.base.i18n.message.translate_failed": "{language}翻译失败",
|
|
259
|
+
"system.base.i18n.message.batch_translate_success": "已完成 {count} 个语言的翻译",
|
|
260
|
+
"system.base.i18n.message.batch_translate_partial": "已完成 {success} 个语言的翻译,{failed} 个语言翻译失败",
|
|
261
|
+
"system.base.i18n.message.batch_translate_failed": "批量翻译失败",
|
|
262
262
|
"system.base.menu.title.list": "菜单列表",
|
|
263
263
|
"system.base.menu.action.create": "新增菜单",
|
|
264
264
|
"system.base.menu.action.edit": "修改菜单",
|
|
@@ -626,7 +626,7 @@
|
|
|
626
626
|
"system.code.gen.validation.left_tree_parent_required": "请选择左树父字段",
|
|
627
627
|
"system.code.gen.validation.left_tree_label_required": "请选择左树显示字段",
|
|
628
628
|
"system.code.gen.validation.left_tree_value_required": "请选择左树值字段",
|
|
629
|
-
"system.code.gen.i18n.field.
|
|
629
|
+
"system.code.gen.i18n.field.i18ns": "非主语言描述",
|
|
630
630
|
"system.code.gen.i18n.action.edit_column": "编辑非主语言字段描述",
|
|
631
631
|
"system.code.gen.i18n.status.complete": "已填写",
|
|
632
632
|
"system.code.gen.i18n.status.missing": "缺失",
|
|
@@ -881,7 +881,7 @@
|
|
|
881
881
|
"system.code.gen.preview.message.create_success": "新增成功",
|
|
882
882
|
"system.code.gen.preview.message.update_success": "修改成功",
|
|
883
883
|
"system.code.gen.preview.message.delete_success": "删除成功",
|
|
884
|
-
"system.code.gen.preview.message.
|
|
884
|
+
"system.code.gen.preview.message.missing_i18ns": "正式生成前还需补齐:{items}",
|
|
885
885
|
"system.code.gen.preview.value.list_separator": "、",
|
|
886
886
|
"system.project.document.title.navigation": "项目文档目录",
|
|
887
887
|
"system.project.document.placeholder.search": "搜索项目或路径",
|
|
@@ -248,17 +248,17 @@
|
|
|
248
248
|
"system.base.user.message.confirm_delete_selected": "確認刪除已選中的使用者嗎?",
|
|
249
249
|
"system.base.user.message.delete_success": "刪除使用者成功",
|
|
250
250
|
"system.base.user.message.delete_canceled": "已取消刪除使用者",
|
|
251
|
-
"system.base.
|
|
252
|
-
"system.base.
|
|
253
|
-
"system.base.
|
|
254
|
-
"system.base.
|
|
255
|
-
"system.base.
|
|
256
|
-
"system.base.
|
|
257
|
-
"system.base.
|
|
258
|
-
"system.base.
|
|
259
|
-
"system.base.
|
|
260
|
-
"system.base.
|
|
261
|
-
"system.base.
|
|
251
|
+
"system.base.i18n.field.i18ns": "多語言翻譯",
|
|
252
|
+
"system.base.i18n.field.name_i18ns": "名稱翻譯",
|
|
253
|
+
"system.base.i18n.field.value_i18ns": "值翻譯",
|
|
254
|
+
"system.base.i18n.placeholder.text": "請輸入{language}譯文",
|
|
255
|
+
"system.base.i18n.action.translate": "翻譯",
|
|
256
|
+
"system.base.i18n.action.batch_translate": "批量翻譯",
|
|
257
|
+
"system.base.i18n.message.translate_success": "{language}翻譯完成",
|
|
258
|
+
"system.base.i18n.message.translate_failed": "{language}翻譯失敗",
|
|
259
|
+
"system.base.i18n.message.batch_translate_success": "已完成 {count} 個語言的翻譯",
|
|
260
|
+
"system.base.i18n.message.batch_translate_partial": "已完成 {success} 個語言的翻譯,{failed} 個語言翻譯失敗",
|
|
261
|
+
"system.base.i18n.message.batch_translate_failed": "批量翻譯失敗",
|
|
262
262
|
"system.base.menu.title.list": "選單列表",
|
|
263
263
|
"system.base.menu.action.create": "新增選單",
|
|
264
264
|
"system.base.menu.action.edit": "修改選單",
|
|
@@ -626,7 +626,7 @@
|
|
|
626
626
|
"system.code.gen.validation.left_tree_parent_required": "請選擇左樹父欄位",
|
|
627
627
|
"system.code.gen.validation.left_tree_label_required": "請選擇左樹顯示欄位",
|
|
628
628
|
"system.code.gen.validation.left_tree_value_required": "請選擇左樹值欄位",
|
|
629
|
-
"system.code.gen.i18n.field.
|
|
629
|
+
"system.code.gen.i18n.field.i18ns": "非主語言描述",
|
|
630
630
|
"system.code.gen.i18n.action.edit_column": "編輯非主語言欄位描述",
|
|
631
631
|
"system.code.gen.i18n.status.complete": "已填寫",
|
|
632
632
|
"system.code.gen.i18n.status.missing": "缺失",
|
|
@@ -881,7 +881,7 @@
|
|
|
881
881
|
"system.code.gen.preview.message.create_success": "新增成功",
|
|
882
882
|
"system.code.gen.preview.message.update_success": "修改成功",
|
|
883
883
|
"system.code.gen.preview.message.delete_success": "刪除成功",
|
|
884
|
-
"system.code.gen.preview.message.
|
|
884
|
+
"system.code.gen.preview.message.missing_i18ns": "正式生成前還需補齊:{items}",
|
|
885
885
|
"system.code.gen.preview.value.list_separator": "、",
|
|
886
886
|
"system.project.document.title.navigation": "專案文件目錄",
|
|
887
887
|
"system.project.document.placeholder.search": "搜尋專案或路徑",
|
|
@@ -83,9 +83,9 @@ export interface BaseConfigForm {
|
|
|
83
83
|
/** 配置value */
|
|
84
84
|
value: string;
|
|
85
85
|
/** 配置名称多语言翻 */
|
|
86
|
-
|
|
86
|
+
name_i18ns: BaseI18n[];
|
|
87
87
|
/** 配置value文本/富文本配置值的多语言翻译 */
|
|
88
|
-
|
|
88
|
+
value_i18ns: BaseI18n[];
|
|
89
89
|
/** 状态 */
|
|
90
90
|
status: Status;
|
|
91
91
|
}
|
|
@@ -141,7 +141,7 @@ export interface BaseConfig {
|
|
|
141
141
|
/** 更新时间 */
|
|
142
142
|
updated_at: string;
|
|
143
143
|
/** 配置名称及文本/富文本配置值的多语言翻译 */
|
|
144
|
-
|
|
144
|
+
i18ns: BaseI18n[];
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
/** Admin系统配置服务 */
|
|
@@ -102,7 +102,7 @@ export interface BaseDictForm {
|
|
|
102
102
|
/** 字典名称 */
|
|
103
103
|
name: string;
|
|
104
104
|
/** 非主语言翻译 */
|
|
105
|
-
|
|
105
|
+
i18ns: BaseI18n[];
|
|
106
106
|
/** 状态 */
|
|
107
107
|
status: Status;
|
|
108
108
|
}
|
|
@@ -128,7 +128,7 @@ export interface BaseDictItemForm {
|
|
|
128
128
|
/** 排序 */
|
|
129
129
|
sort: number;
|
|
130
130
|
/** 非主语言翻译 */
|
|
131
|
-
|
|
131
|
+
i18ns: BaseI18n[];
|
|
132
132
|
/** 状态 */
|
|
133
133
|
status: Status;
|
|
134
134
|
}
|
|
@@ -200,7 +200,7 @@ export interface BaseDict {
|
|
|
200
200
|
/** 更新时间 */
|
|
201
201
|
updated_at: string;
|
|
202
202
|
/** 非主语言翻译 */
|
|
203
|
-
|
|
203
|
+
i18ns: BaseI18n[];
|
|
204
204
|
}
|
|
205
205
|
|
|
206
206
|
/** 字典项 */
|
|
@@ -224,7 +224,7 @@ export interface BaseDictItem {
|
|
|
224
224
|
/** 更新时间 */
|
|
225
225
|
updated_at: string;
|
|
226
226
|
/** 非主语言翻译 */
|
|
227
|
-
|
|
227
|
+
i18ns: BaseI18n[];
|
|
228
228
|
}
|
|
229
229
|
|
|
230
230
|
/** Admin字典服务 */
|
|
@@ -8,23 +8,23 @@
|
|
|
8
8
|
import type { Empty } from "../../../google/protobuf/empty";
|
|
9
9
|
|
|
10
10
|
/** 统一翻译表目标类型,和 base_i18n.target_type 的值一一对应。 */
|
|
11
|
-
export enum
|
|
12
|
-
/**
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
|
|
11
|
+
export enum I18nTargetType {
|
|
12
|
+
/** I18N_TARGET_TYPE_UNSPECIFIED - 未指定统一翻译表目标类型。 */
|
|
13
|
+
I18N_TARGET_TYPE_UNSPECIFIED = 0,
|
|
14
|
+
/** I18N_TARGET_TYPE_BASE_CONFIG_VALUE - 系统配置值。 */
|
|
15
|
+
I18N_TARGET_TYPE_BASE_CONFIG_VALUE = 1,
|
|
16
|
+
/** I18N_TARGET_TYPE_BASE_CONFIG_NAME - 系统配置名称。 */
|
|
17
|
+
I18N_TARGET_TYPE_BASE_CONFIG_NAME = 2,
|
|
18
|
+
/** I18N_TARGET_TYPE_BASE_DICT - 字典名称。 */
|
|
19
|
+
I18N_TARGET_TYPE_BASE_DICT = 3,
|
|
20
|
+
/** I18N_TARGET_TYPE_BASE_DICT_ITEM - 字典项标签。 */
|
|
21
|
+
I18N_TARGET_TYPE_BASE_DICT_ITEM = 4,
|
|
22
|
+
/** I18N_TARGET_TYPE_BASE_MENU - 菜单标题。 */
|
|
23
|
+
I18N_TARGET_TYPE_BASE_MENU = 5,
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
/** 翻译单个文本请求。 */
|
|
27
|
-
export interface
|
|
27
|
+
export interface DraftBaseI18nRequest {
|
|
28
28
|
/** 待翻译文本 */
|
|
29
29
|
source: string;
|
|
30
30
|
/** 目标语言区域,不传时翻译所有启用的非主语言 */
|
|
@@ -32,25 +32,25 @@ export interface DraftBaseTranslationRequest {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
/** 翻译单个文本响应。 */
|
|
35
|
-
export interface
|
|
35
|
+
export interface DraftBaseI18nResponse {
|
|
36
36
|
/** 翻译结果 */
|
|
37
|
-
|
|
37
|
+
i18ns: DraftBaseI18nItem[];
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
/** 翻译单个文本响应。 */
|
|
41
|
-
export interface
|
|
41
|
+
export interface DraftBaseI18nItem {
|
|
42
42
|
/** 目标语言区域 */
|
|
43
43
|
locale: string;
|
|
44
44
|
/** 翻译文本 */
|
|
45
|
-
|
|
45
|
+
i18n: string;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
/** 修改单个翻译信息请求。 */
|
|
49
|
-
export interface
|
|
49
|
+
export interface UpdateBaseI18nRequest {
|
|
50
50
|
/** 翻译记录ID,大于零时优先按ID更新;ID不存在时根据目标信息更新或新增 */
|
|
51
51
|
id: number;
|
|
52
52
|
/** 翻译目标类型,ID为零时用于查询或新增 */
|
|
53
|
-
target_type:
|
|
53
|
+
target_type: I18nTargetType;
|
|
54
54
|
/** 目标资源ID,ID为零时用于查询或新增 */
|
|
55
55
|
target_id: number;
|
|
56
56
|
/** 目标语言区域,ID为零时用于查询或新增 */
|
|
@@ -64,7 +64,7 @@ export interface BaseI18n {
|
|
|
64
64
|
/** 翻译记录ID */
|
|
65
65
|
id: number;
|
|
66
66
|
/** 翻译目标类型 */
|
|
67
|
-
target_type:
|
|
67
|
+
target_type: I18nTargetType;
|
|
68
68
|
/** 目标资源ID */
|
|
69
69
|
target_id: number;
|
|
70
70
|
/** 语言区域 */
|
|
@@ -84,7 +84,7 @@ export interface CodeGenLocaleConfig {
|
|
|
84
84
|
/** 国际化翻译信息服务。 */
|
|
85
85
|
export interface BaseI18nService {
|
|
86
86
|
/** 翻译单个文本。 */
|
|
87
|
-
|
|
87
|
+
DraftBaseI18n(request: DraftBaseI18nRequest): Promise<DraftBaseI18nResponse>;
|
|
88
88
|
/** 修改国际化翻译信息 */
|
|
89
|
-
|
|
89
|
+
UpdateBaseI18n(request: UpdateBaseI18nRequest): Promise<Empty>;
|
|
90
90
|
}
|
|
@@ -72,7 +72,7 @@ export interface BaseMenuForm {
|
|
|
72
72
|
/** 分配的API列表 */
|
|
73
73
|
api: string[];
|
|
74
74
|
/** 非主语言翻译 */
|
|
75
|
-
|
|
75
|
+
i18ns: BaseI18n[];
|
|
76
76
|
/** 排序 */
|
|
77
77
|
sort: number;
|
|
78
78
|
/** 状态 */
|
|
@@ -138,7 +138,7 @@ export interface BaseMenu {
|
|
|
138
138
|
/** 是否存在子节点 */
|
|
139
139
|
has_children: boolean;
|
|
140
140
|
/** 非主语言翻译 */
|
|
141
|
-
|
|
141
|
+
i18ns: BaseI18n[];
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
/** 菜单元信息 */
|
|
@@ -56,16 +56,16 @@
|
|
|
56
56
|
inline-prompt
|
|
57
57
|
/>
|
|
58
58
|
</template>
|
|
59
|
-
<template #
|
|
60
|
-
<
|
|
61
|
-
v-model="
|
|
59
|
+
<template #nameI18ns>
|
|
60
|
+
<DynamicI18nEditor
|
|
61
|
+
v-model="nameI18nValues"
|
|
62
62
|
:source="formData.name"
|
|
63
63
|
:maxlength="100"
|
|
64
64
|
/>
|
|
65
65
|
</template>
|
|
66
|
-
<template #
|
|
67
|
-
<
|
|
68
|
-
v-model="
|
|
66
|
+
<template #valueI18ns>
|
|
67
|
+
<DynamicI18nEditor
|
|
68
|
+
v-model="valueI18nValues"
|
|
69
69
|
:source="formData.value"
|
|
70
70
|
:maxlength="10000"
|
|
71
71
|
multiline
|
|
@@ -99,15 +99,15 @@ import type { BaseI18n } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1
|
|
|
99
99
|
import { BaseConfigSite } from "@liujitcn/kratos-admin-system/rpc/base/v1/config";
|
|
100
100
|
import { Status } from "@liujitcn/kratos-admin-system/rpc/common/v1/enum";
|
|
101
101
|
import { BaseConfigType } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_config";
|
|
102
|
-
import {
|
|
102
|
+
import { I18nTargetType } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_i18n";
|
|
103
103
|
import { buildPageRequest, normalizeSelectedIds } from "@liujitcn/kratos-admin-core/table";
|
|
104
104
|
import { t } from "@liujitcn/kratos-admin-core";
|
|
105
|
-
import
|
|
106
|
-
import
|
|
105
|
+
import DynamicI18nEditor from "@liujitcn/kratos-admin-system/components/DynamicI18nEditor.vue";
|
|
106
|
+
import DynamicI18nCell from "@liujitcn/kratos-admin-system/components/DynamicI18nCell.vue";
|
|
107
107
|
import {
|
|
108
108
|
getEditableLanguageOptions,
|
|
109
|
-
type
|
|
110
|
-
} from "@liujitcn/kratos-admin-system/components/
|
|
109
|
+
type DynamicI18nValue
|
|
110
|
+
} from "@liujitcn/kratos-admin-system/components/dynamicI18n";
|
|
111
111
|
|
|
112
112
|
/** 系统配置编辑表单状态,新增时枚举字段保持为空,避免把未知值 0 显示为下拉文本。 */
|
|
113
113
|
type BaseConfigFormState = Omit<BaseConfigForm, "site" | "type"> & {
|
|
@@ -147,16 +147,16 @@ const formData = reactive<BaseConfigFormState>({
|
|
|
147
147
|
/** 状态 */
|
|
148
148
|
status: Status.STATUS_ENABLE,
|
|
149
149
|
/** 配置名称非主语言翻译。 */
|
|
150
|
-
|
|
150
|
+
name_i18ns: [],
|
|
151
151
|
/** 配置文本或富文本值的非主语言翻译。 */
|
|
152
|
-
|
|
152
|
+
value_i18ns: []
|
|
153
153
|
});
|
|
154
154
|
|
|
155
155
|
/** 将配置值翻译记录转换为编辑器值,缺少记录时保留可编辑的空行。 */
|
|
156
|
-
function
|
|
157
|
-
const records = targetType ===
|
|
158
|
-
? formData.
|
|
159
|
-
: formData.
|
|
156
|
+
function normalizeConfigI18ns(targetType: I18nTargetType): DynamicI18nValue[] {
|
|
157
|
+
const records = targetType === I18nTargetType.I18N_TARGET_TYPE_BASE_CONFIG_NAME
|
|
158
|
+
? formData.name_i18ns
|
|
159
|
+
: formData.value_i18ns;
|
|
160
160
|
return getEditableLanguageOptions()
|
|
161
161
|
.map(item => item.value)
|
|
162
162
|
.map(locale => {
|
|
@@ -170,7 +170,7 @@ function normalizeConfigTranslations(targetType: TranslationTargetType): Dynamic
|
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
/** 保存指定目标类型的编辑器值,并保留其他字段的翻译。 */
|
|
173
|
-
function
|
|
173
|
+
function updateConfigI18ns(targetType: I18nTargetType, values: DynamicI18nValue[]) {
|
|
174
174
|
const next = values.map(
|
|
175
175
|
item =>
|
|
176
176
|
({
|
|
@@ -180,21 +180,21 @@ function updateConfigTranslations(targetType: TranslationTargetType, values: Dyn
|
|
|
180
180
|
name: item.text
|
|
181
181
|
}) as BaseI18n
|
|
182
182
|
);
|
|
183
|
-
if (targetType ===
|
|
184
|
-
formData.
|
|
183
|
+
if (targetType === I18nTargetType.I18N_TARGET_TYPE_BASE_CONFIG_NAME) {
|
|
184
|
+
formData.name_i18ns = next;
|
|
185
185
|
} else {
|
|
186
|
-
formData.
|
|
186
|
+
formData.value_i18ns = next;
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
-
const
|
|
191
|
-
get: () =>
|
|
192
|
-
set: values =>
|
|
190
|
+
const nameI18nValues = computed<DynamicI18nValue[]>({
|
|
191
|
+
get: () => normalizeConfigI18ns(I18nTargetType.I18N_TARGET_TYPE_BASE_CONFIG_NAME),
|
|
192
|
+
set: values => updateConfigI18ns(I18nTargetType.I18N_TARGET_TYPE_BASE_CONFIG_NAME, values)
|
|
193
193
|
});
|
|
194
194
|
|
|
195
|
-
const
|
|
196
|
-
get: () =>
|
|
197
|
-
set: values =>
|
|
195
|
+
const valueI18nValues = computed<DynamicI18nValue[]>({
|
|
196
|
+
get: () => normalizeConfigI18ns(I18nTargetType.I18N_TARGET_TYPE_BASE_CONFIG_VALUE),
|
|
197
|
+
set: values => updateConfigI18ns(I18nTargetType.I18N_TARGET_TYPE_BASE_CONFIG_VALUE, values)
|
|
198
198
|
});
|
|
199
199
|
|
|
200
200
|
const rules = computed(() => ({
|
|
@@ -334,17 +334,17 @@ const formFields = computed<ProFormField[]>(() => [
|
|
|
334
334
|
visible: model => model.type == BaseConfigType.BASE_CONFIG_TYPE_BOOLEAN
|
|
335
335
|
},
|
|
336
336
|
{
|
|
337
|
-
prop: "
|
|
338
|
-
label: t("system.base.
|
|
337
|
+
prop: "i18ns",
|
|
338
|
+
label: t("system.base.i18n.field.name_i18ns"),
|
|
339
339
|
component: "slot",
|
|
340
|
-
slotName: "
|
|
340
|
+
slotName: "nameI18ns",
|
|
341
341
|
colSpan: 24
|
|
342
342
|
},
|
|
343
343
|
{
|
|
344
|
-
prop: "
|
|
345
|
-
label: t("system.base.
|
|
344
|
+
prop: "i18ns",
|
|
345
|
+
label: t("system.base.i18n.field.value_i18ns"),
|
|
346
346
|
component: "slot",
|
|
347
|
-
slotName: "
|
|
347
|
+
slotName: "valueI18ns",
|
|
348
348
|
visible: model =>
|
|
349
349
|
model.type == BaseConfigType.BASE_CONFIG_TYPE_TEXT || model.type == BaseConfigType.BASE_CONFIG_TYPE_RICH_TEXT,
|
|
350
350
|
colSpan: 24
|
|
@@ -431,11 +431,11 @@ const columns = computed<ColumnProps[]>(() => [
|
|
|
431
431
|
|
|
432
432
|
/** 渲染系统配置名称翻译预览。 */
|
|
433
433
|
function renderConfigNameCell(row: BaseConfig) {
|
|
434
|
-
return h(
|
|
434
|
+
return h(DynamicI18nCell, {
|
|
435
435
|
source: row.name,
|
|
436
|
-
targetType:
|
|
436
|
+
targetType: I18nTargetType.I18N_TARGET_TYPE_BASE_CONFIG_NAME,
|
|
437
437
|
targetId: row.id,
|
|
438
|
-
|
|
438
|
+
i18ns: row.i18ns
|
|
439
439
|
});
|
|
440
440
|
}
|
|
441
441
|
|
|
@@ -573,8 +573,8 @@ function resetForm() {
|
|
|
573
573
|
formData.type = undefined;
|
|
574
574
|
formData.key = "";
|
|
575
575
|
formData.value = "";
|
|
576
|
-
formData.
|
|
577
|
-
formData.
|
|
576
|
+
formData.name_i18ns = [];
|
|
577
|
+
formData.value_i18ns = [];
|
|
578
578
|
formData.status = Status.STATUS_ENABLE;
|
|
579
579
|
}
|
|
580
580
|
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
@confirm="handleSubmit"
|
|
21
21
|
@close="handleCloseDialog"
|
|
22
22
|
>
|
|
23
|
-
<template #
|
|
24
|
-
<
|
|
25
|
-
v-model="
|
|
23
|
+
<template #i18ns>
|
|
24
|
+
<DynamicI18nEditor
|
|
25
|
+
v-model="i18nValues"
|
|
26
26
|
:source="formData.name"
|
|
27
27
|
:maxlength="50"
|
|
28
28
|
/>
|
|
@@ -50,17 +50,17 @@ import { loadEnabledBaseLanguages } from "@liujitcn/kratos-admin-system/api/syst
|
|
|
50
50
|
import type { BaseDict, BaseDictForm, PageBaseDictRequest } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_dict";
|
|
51
51
|
import router, { navigateTo } from "@liujitcn/kratos-admin-core/navigation";
|
|
52
52
|
import { Status } from "@liujitcn/kratos-admin-system/rpc/common/v1/enum";
|
|
53
|
-
import {
|
|
53
|
+
import { I18nTargetType } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_i18n";
|
|
54
54
|
import { buildPageRequest, normalizeSelectedIds } from "@liujitcn/kratos-admin-core/table";
|
|
55
55
|
import { t } from "@liujitcn/kratos-admin-core";
|
|
56
|
-
import
|
|
57
|
-
import
|
|
56
|
+
import DynamicI18nEditor from "@liujitcn/kratos-admin-system/components/DynamicI18nEditor.vue";
|
|
57
|
+
import DynamicI18nCell from "@liujitcn/kratos-admin-system/components/DynamicI18nCell.vue";
|
|
58
58
|
import {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
type
|
|
62
|
-
type
|
|
63
|
-
} from "@liujitcn/kratos-admin-system/components/
|
|
59
|
+
normalizeDynamicI18ns,
|
|
60
|
+
serializeDynamicI18ns,
|
|
61
|
+
type DynamicI18nRecord,
|
|
62
|
+
type DynamicI18nValue
|
|
63
|
+
} from "@liujitcn/kratos-admin-system/components/dynamicI18n";
|
|
64
64
|
|
|
65
65
|
defineOptions({
|
|
66
66
|
name: "BaseDict",
|
|
@@ -70,7 +70,7 @@ defineOptions({
|
|
|
70
70
|
const { BUTTONS } = useAuthButtons();
|
|
71
71
|
const proTable = ref<ProTableInstance>();
|
|
72
72
|
const formDialogRef = ref<InstanceType<typeof FormDialog>>();
|
|
73
|
-
const
|
|
73
|
+
const i18nValues = ref<DynamicI18nValue[]>(normalizeDynamicI18ns(undefined, "name"));
|
|
74
74
|
const dialog = reactive({
|
|
75
75
|
editing: false,
|
|
76
76
|
visible: false
|
|
@@ -84,7 +84,7 @@ const formData = reactive<BaseDictForm>({
|
|
|
84
84
|
/** 字典名称 */
|
|
85
85
|
name: "",
|
|
86
86
|
/** 非主语言翻译 */
|
|
87
|
-
|
|
87
|
+
i18ns: [],
|
|
88
88
|
/** 状态 */
|
|
89
89
|
status: Status.STATUS_ENABLE
|
|
90
90
|
});
|
|
@@ -134,18 +134,18 @@ const formFields = computed<ProFormField[]>(() => [
|
|
|
134
134
|
component: "input",
|
|
135
135
|
props: { placeholder: t("system.base.dict.placeholder.code") }
|
|
136
136
|
},
|
|
137
|
-
{ prop: "
|
|
137
|
+
{ prop: "i18ns", label: t("system.base.i18n.field.i18ns"), component: "slot", slotName: "i18ns" },
|
|
138
138
|
{ prop: "status", label: t("common.field.status"), component: "radio-group", options: statusOptions.value }
|
|
139
139
|
]);
|
|
140
140
|
|
|
141
141
|
/** 渲染字典名称翻译预览,并复用当前页面的编辑弹窗。 */
|
|
142
142
|
function renderDictNameCell(scope: RenderScope<BaseDict>) {
|
|
143
143
|
const row = scope.row;
|
|
144
|
-
return h(
|
|
144
|
+
return h(DynamicI18nCell, {
|
|
145
145
|
source: row.name,
|
|
146
|
-
targetType:
|
|
146
|
+
targetType: I18nTargetType.I18N_TARGET_TYPE_BASE_DICT,
|
|
147
147
|
targetId: row.id,
|
|
148
|
-
|
|
148
|
+
i18ns: row.i18ns
|
|
149
149
|
});
|
|
150
150
|
}
|
|
151
151
|
|
|
@@ -261,7 +261,7 @@ async function handleOpenDialog(dictId?: number) {
|
|
|
261
261
|
|
|
262
262
|
const data = await defBaseDictService.GetBaseDict({ id: dictId });
|
|
263
263
|
Object.assign(formData, data);
|
|
264
|
-
|
|
264
|
+
i18nValues.value = normalizeDynamicI18ns(data.i18ns as DynamicI18nRecord[], "name");
|
|
265
265
|
}
|
|
266
266
|
|
|
267
267
|
/**
|
|
@@ -281,9 +281,9 @@ function resetForm() {
|
|
|
281
281
|
formData.id = 0;
|
|
282
282
|
formData.code = "";
|
|
283
283
|
formData.name = "";
|
|
284
|
-
formData.
|
|
284
|
+
formData.i18ns = [];
|
|
285
285
|
formData.status = Status.STATUS_ENABLE;
|
|
286
|
-
|
|
286
|
+
i18nValues.value = normalizeDynamicI18ns(undefined, "name");
|
|
287
287
|
}
|
|
288
288
|
|
|
289
289
|
/**
|
|
@@ -294,9 +294,9 @@ function handleSubmit() {
|
|
|
294
294
|
if (!isValid) return;
|
|
295
295
|
|
|
296
296
|
const submitData = JSON.parse(JSON.stringify(formData)) as BaseDictForm;
|
|
297
|
-
submitData.
|
|
298
|
-
|
|
299
|
-
|
|
297
|
+
submitData.i18ns = serializeDynamicI18ns(
|
|
298
|
+
i18nValues.value,
|
|
299
|
+
I18nTargetType.I18N_TARGET_TYPE_BASE_DICT,
|
|
300
300
|
submitData.id
|
|
301
301
|
);
|
|
302
302
|
const request = submitData.id
|