@liujitcn/kratos-admin-system 0.0.20 → 0.0.21
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 +51 -0
- package/dist/package/declarations/src/api/system/base_translation.d.ts +7 -0
- package/dist/package/declarations/src/api/system/code_gen_i18n.d.ts +8 -0
- package/dist/package/declarations/src/components/DynamicTranslationCell.vue.d.ts +39 -0
- package/dist/package/declarations/src/components/DynamicTranslationEditor.vue.d.ts +23 -0
- package/dist/package/declarations/src/components/dynamicTranslation.d.ts +44 -0
- package/dist/package/declarations/src/rpc/system/admin/v1/base_config.d.ts +5 -0
- package/dist/package/declarations/src/rpc/system/admin/v1/base_dict.d.ts +79 -0
- package/dist/package/declarations/src/rpc/system/admin/v1/base_language.d.ts +114 -0
- package/dist/package/declarations/src/rpc/system/admin/v1/base_menu.d.ts +40 -0
- package/dist/package/declarations/src/rpc/system/admin/v1/base_translation.d.ts +102 -0
- package/dist/package/declarations/src/rpc/system/admin/v1/code_gen.d.ts +2 -0
- 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 +13 -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/language/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 +137 -0
- package/dist/package/src/api/system/base_translation.ts +22 -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/components/DynamicTranslationCell.vue +176 -0
- package/dist/package/src/components/DynamicTranslationEditor.vue +166 -0
- package/dist/package/src/components/dynamicTranslation.ts +86 -0
- package/dist/package/src/locales/README.md +28 -0
- package/dist/package/src/locales/en-US.json +929 -0
- package/dist/package/src/locales/es-ES.json +928 -0
- package/dist/package/src/locales/fr-FR.json +928 -0
- package/dist/package/src/locales/ja-JP.json +929 -0
- package/dist/package/src/locales/ko-KR.json +928 -0
- package/dist/package/src/locales/zh-CN.json +929 -0
- package/dist/package/src/locales/zh-TW.json +928 -0
- package/dist/package/src/module.ts +19 -1
- package/dist/package/src/rpc/system/admin/v1/base_config.ts +5 -0
- package/dist/package/src/rpc/system/admin/v1/base_dict.ts +81 -0
- package/dist/package/src/rpc/system/admin/v1/base_language.ts +135 -0
- package/dist/package/src/rpc/system/admin/v1/base_menu.ts +41 -0
- package/dist/package/src/rpc/system/admin/v1/base_translation.ts +117 -0
- package/dist/package/src/rpc/system/admin/v1/code_gen.ts +5 -1
- 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 +15 -0
- package/dist/package/src/views/ai/chat/components/AiMarkdown.vue +1 -6
- package/dist/package/src/views/ai/chat/components/ChatPanel.vue +70 -53
- 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 +55 -39
- package/dist/package/src/views/ai/chat/message.ts +18 -17
- package/dist/package/src/views/base/api/index.vue +121 -83
- package/dist/package/src/views/base/area/index.vue +81 -31
- package/dist/package/src/views/base/config/index.vue +272 -78
- package/dist/package/src/views/base/dept/index.vue +110 -61
- package/dist/package/src/views/base/dict/index.vue +137 -58
- package/dist/package/src/views/base/dict/item.vue +147 -61
- package/dist/package/src/views/base/job/index.vue +134 -81
- package/dist/package/src/views/base/job/log.vue +21 -22
- package/dist/package/src/views/base/log/index.vue +68 -46
- package/dist/package/src/views/base/menu/index.vue +257 -156
- package/dist/package/src/views/base/migration/index.vue +49 -29
- package/dist/package/src/views/base/post/index.vue +128 -59
- package/dist/package/src/views/base/role/index.vue +145 -78
- package/dist/package/src/views/base/tenant/index.vue +132 -63
- package/dist/package/src/views/base/user/components/dept-tree.vue +2 -1
- package/dist/package/src/views/base/user/index.vue +192 -112
- package/dist/package/src/views/profile/components/base.vue +44 -27
- package/dist/package/src/views/profile/components/password.vue +43 -27
- package/dist/package/src/views/profile/components/security.vue +89 -53
- 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 +30 -14
- 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 +114 -77
- 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 -58
- package/dist/package/src/views/tool/code-gen/proto/index.vue +110 -62
- package/dist/package/src/views/tool/code-gen/table/index.vue +197 -117
- package/dist/package/src/views/tool/language/index.vue +256 -0
- package/dist/package/src/views/tool/project-doc/index.vue +17 -15
- package/package.json +6 -2
|
@@ -14,19 +14,29 @@
|
|
|
14
14
|
<FormDialog
|
|
15
15
|
v-model="dialog.visible"
|
|
16
16
|
ref="formDialogRef"
|
|
17
|
-
:title="
|
|
17
|
+
:title="dialogTitle"
|
|
18
18
|
width="min(920px, calc(100vw - 32px))"
|
|
19
19
|
top="4vh"
|
|
20
20
|
:model="formData"
|
|
21
21
|
:fields="formFields"
|
|
22
|
-
:rules="
|
|
22
|
+
:rules="tableRules"
|
|
23
23
|
:confirm-loading="saving"
|
|
24
24
|
label-width="116px"
|
|
25
25
|
:gutter="16"
|
|
26
26
|
:col-span="12"
|
|
27
27
|
@confirm="handleSubmit"
|
|
28
28
|
@close="handleCloseDialog"
|
|
29
|
-
|
|
29
|
+
>
|
|
30
|
+
<template #tableI18nConfig>
|
|
31
|
+
<CodeGenLocaleEditor
|
|
32
|
+
:model-value="formData.i18n_config"
|
|
33
|
+
:source-comment="formData.comment"
|
|
34
|
+
:show-left-tree-comment="formData.page_type === 'left_tree'"
|
|
35
|
+
:source-left-tree-comment="formData.left_tree_config?.comment"
|
|
36
|
+
@update:model-value="value => (formData.i18n_config = value)"
|
|
37
|
+
/>
|
|
38
|
+
</template>
|
|
39
|
+
</FormDialog>
|
|
30
40
|
|
|
31
41
|
<CodeGenProgressDialog
|
|
32
42
|
v-model="progressDialogVisible"
|
|
@@ -41,7 +51,18 @@
|
|
|
41
51
|
<script setup lang="ts">
|
|
42
52
|
import { computed, nextTick, reactive, ref } from "vue";
|
|
43
53
|
import { useRouter } from "vue-router";
|
|
44
|
-
import {
|
|
54
|
+
import {
|
|
55
|
+
CirclePlus,
|
|
56
|
+
Clock,
|
|
57
|
+
Connection,
|
|
58
|
+
Delete,
|
|
59
|
+
Document,
|
|
60
|
+
EditPen,
|
|
61
|
+
Promotion,
|
|
62
|
+
RefreshRight,
|
|
63
|
+
SetUp,
|
|
64
|
+
View
|
|
65
|
+
} from "@element-plus/icons-vue";
|
|
45
66
|
import type { ColumnProps, HeaderActionProps, ProTableInstance } from "@liujitcn/kratos-admin-core/components/ProTable/interface";
|
|
46
67
|
import ProTable from "@liujitcn/kratos-admin-core/components/ProTable";
|
|
47
68
|
import FormDialog from "@liujitcn/kratos-admin-core/components/Dialog/FormDialog.vue";
|
|
@@ -63,7 +84,9 @@ import type { BaseMenu } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1
|
|
|
63
84
|
import type { OptionBaseDictResponse_BaseDictItem } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_dict";
|
|
64
85
|
import { BaseMenuType, CodeGenTableStatus } from "@liujitcn/kratos-admin-system/rpc/system/common/v1/enum";
|
|
65
86
|
import { buildPageRequest, normalizeSelectedIds } from "@liujitcn/kratos-admin-core/table";
|
|
87
|
+
import { t } from "@liujitcn/kratos-admin-core";
|
|
66
88
|
import CodeGenProgressDialog from "../components/CodeGenProgressDialog.vue";
|
|
89
|
+
import CodeGenLocaleEditor from "../components/CodeGenLocaleEditor.vue";
|
|
67
90
|
import {
|
|
68
91
|
codeGenPageTypeOptions,
|
|
69
92
|
codeGenTableRules,
|
|
@@ -117,12 +140,12 @@ const progressTaskAvailable = ref(!!progressTaskId.value);
|
|
|
117
140
|
const generating = ref(!!progressTaskId.value);
|
|
118
141
|
const progressSelectedTableIds = ref<Array<string | number>>(readProgressSelectedTableIds());
|
|
119
142
|
|
|
120
|
-
const dialog = reactive({
|
|
121
|
-
title: "",
|
|
122
|
-
visible: false
|
|
123
|
-
});
|
|
143
|
+
const dialog = reactive({ editing: false, visible: false });
|
|
124
144
|
|
|
125
145
|
const formData = reactive<CodeGenTableFormState>({ ...createDefaultCodeGenTableForm(), parent_menu_id: undefined });
|
|
146
|
+
const dialogTitle = computed(() => t(dialog.editing ? "system.codegen.table.title.edit" : "system.codegen.table.title.create"));
|
|
147
|
+
const tableRules = computed(() => codeGenTableRules());
|
|
148
|
+
const pageTypeOptions = computed(() => codeGenPageTypeOptions());
|
|
126
149
|
|
|
127
150
|
/** 当前业务表选择项。 */
|
|
128
151
|
const databaseTableOptions = computed<ProFormOption[]>(() =>
|
|
@@ -145,7 +168,11 @@ const leftTreeTableOptions = computed<ProFormOption[]>(() =>
|
|
|
145
168
|
const businessModuleOptions = computed<ProFormOption[]>(() => {
|
|
146
169
|
const options: ProFormOption[] = businessModuleItems.value.map(item => ({ label: item.label, value: item.value }));
|
|
147
170
|
if (formData.business_module && !options.some(item => item.value === formData.business_module)) {
|
|
148
|
-
options.push({
|
|
171
|
+
options.push({
|
|
172
|
+
label: t("system.codegen.table.value.disabledModule", { module: formData.business_module }),
|
|
173
|
+
value: formData.business_module,
|
|
174
|
+
disabled: true
|
|
175
|
+
});
|
|
149
176
|
}
|
|
150
177
|
return options;
|
|
151
178
|
});
|
|
@@ -161,13 +188,13 @@ const formFields = computed<ProFormField[]>(() => [
|
|
|
161
188
|
// 标签提示与当前生成器的实际读写逻辑保持一致,方便配置时判断影响范围。
|
|
162
189
|
{
|
|
163
190
|
prop: "name",
|
|
164
|
-
label: "
|
|
191
|
+
label: t("system.codegen.table.field.name"),
|
|
165
192
|
component: "select",
|
|
166
193
|
options: databaseTableOptions.value,
|
|
167
194
|
colSpan: 24,
|
|
168
|
-
labelTooltip: "
|
|
195
|
+
labelTooltip: t("system.codegen.table.tooltip.name"),
|
|
169
196
|
props: {
|
|
170
|
-
placeholder: "
|
|
197
|
+
placeholder: t("system.codegen.table.placeholder.databaseTable"),
|
|
171
198
|
clearable: true,
|
|
172
199
|
filterable: true,
|
|
173
200
|
style: { width: "100%" },
|
|
@@ -176,29 +203,36 @@ const formFields = computed<ProFormField[]>(() => [
|
|
|
176
203
|
},
|
|
177
204
|
{
|
|
178
205
|
prop: "comment",
|
|
179
|
-
label: "
|
|
206
|
+
label: t("system.codegen.table.field.comment"),
|
|
180
207
|
component: "input",
|
|
181
208
|
colSpan: 24,
|
|
182
|
-
labelTooltip: "
|
|
183
|
-
props: { placeholder: "
|
|
209
|
+
labelTooltip: t("system.codegen.table.tooltip.comment"),
|
|
210
|
+
props: { placeholder: t("system.codegen.table.placeholder.comment") }
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
prop: "i18n_config",
|
|
214
|
+
label: t("system.codegen.i18n.field.translations"),
|
|
215
|
+
component: "slot",
|
|
216
|
+
slotName: "tableI18nConfig",
|
|
217
|
+
colSpan: 24,
|
|
218
|
+
labelTooltip: t("system.codegen.i18n.tooltip.table")
|
|
184
219
|
},
|
|
185
220
|
{
|
|
186
221
|
prop: "business_module",
|
|
187
|
-
label: "
|
|
222
|
+
label: t("system.codegen.table.field.businessModule"),
|
|
188
223
|
component: "select",
|
|
189
224
|
options: businessModuleOptions.value,
|
|
190
|
-
labelTooltip: "
|
|
191
|
-
props: { placeholder: "
|
|
225
|
+
labelTooltip: t("system.codegen.table.tooltip.businessModule"),
|
|
226
|
+
props: { placeholder: t("system.codegen.table.placeholder.businessModule"), filterable: true, style: { width: "100%" } }
|
|
192
227
|
},
|
|
193
228
|
{
|
|
194
229
|
prop: "parent_menu_id",
|
|
195
|
-
label: "
|
|
230
|
+
label: t("system.codegen.table.field.parentMenu"),
|
|
196
231
|
component: "tree-select",
|
|
197
232
|
options: parentMenuOptions.value,
|
|
198
|
-
labelTooltip:
|
|
199
|
-
"选择一级模块目录或二级业务目录作为挂载点。仅当同时生成前端、开启“生成SQL”且页面接口完整时,生成流程才会同步页面菜单和按钮权限。",
|
|
233
|
+
labelTooltip: t("system.codegen.table.tooltip.parentMenu"),
|
|
200
234
|
props: {
|
|
201
|
-
placeholder: "
|
|
235
|
+
placeholder: t("system.codegen.table.placeholder.parentMenu"),
|
|
202
236
|
clearable: true,
|
|
203
237
|
filterable: true,
|
|
204
238
|
checkStrictly: true,
|
|
@@ -208,38 +242,48 @@ const formFields = computed<ProFormField[]>(() => [
|
|
|
208
242
|
},
|
|
209
243
|
{
|
|
210
244
|
prop: "page_type",
|
|
211
|
-
label: "
|
|
245
|
+
label: t("system.codegen.table.field.pageType"),
|
|
212
246
|
component: "segmented",
|
|
213
|
-
options:
|
|
214
|
-
labelTooltip: "
|
|
247
|
+
options: pageTypeOptions.value,
|
|
248
|
+
labelTooltip: t("system.codegen.table.tooltip.pageType"),
|
|
215
249
|
props: { onChange: handlePageTypeChange }
|
|
216
250
|
},
|
|
217
251
|
{
|
|
218
252
|
prop: "parent_column",
|
|
219
|
-
label: "
|
|
253
|
+
label: t("system.codegen.table.field.parentColumn"),
|
|
220
254
|
component: "select",
|
|
221
255
|
options: databaseColumnOptions.value,
|
|
222
|
-
labelTooltip: "
|
|
223
|
-
props: {
|
|
256
|
+
labelTooltip: t("system.codegen.table.tooltip.parentColumn"),
|
|
257
|
+
props: {
|
|
258
|
+
placeholder: t("system.codegen.table.placeholder.parentColumn"),
|
|
259
|
+
clearable: true,
|
|
260
|
+
filterable: true,
|
|
261
|
+
style: { width: "100%" }
|
|
262
|
+
},
|
|
224
263
|
visible: model => isCodeGenTreePageType(model.page_type)
|
|
225
264
|
},
|
|
226
265
|
{
|
|
227
266
|
prop: "tree_label_column",
|
|
228
|
-
label: "
|
|
267
|
+
label: t("system.codegen.table.field.treeLabelColumn"),
|
|
229
268
|
component: "select",
|
|
230
269
|
options: databaseColumnOptions.value,
|
|
231
|
-
labelTooltip: "
|
|
232
|
-
props: {
|
|
270
|
+
labelTooltip: t("system.codegen.table.tooltip.treeLabelColumn"),
|
|
271
|
+
props: {
|
|
272
|
+
placeholder: t("system.codegen.table.placeholder.treeLabelColumn"),
|
|
273
|
+
clearable: true,
|
|
274
|
+
filterable: true,
|
|
275
|
+
style: { width: "100%" }
|
|
276
|
+
},
|
|
233
277
|
visible: model => isCodeGenTreePageType(model.page_type)
|
|
234
278
|
},
|
|
235
279
|
{
|
|
236
280
|
prop: "left_tree_config.table_name",
|
|
237
|
-
label: "
|
|
281
|
+
label: t("system.codegen.table.field.leftTreeTable"),
|
|
238
282
|
component: "select",
|
|
239
283
|
options: leftTreeTableOptions.value,
|
|
240
|
-
labelTooltip: "
|
|
284
|
+
labelTooltip: t("system.codegen.table.tooltip.leftTreeTable"),
|
|
241
285
|
props: {
|
|
242
|
-
placeholder: "
|
|
286
|
+
placeholder: t("system.codegen.table.placeholder.leftTreeTable"),
|
|
243
287
|
clearable: true,
|
|
244
288
|
filterable: true,
|
|
245
289
|
style: { width: "100%" },
|
|
@@ -249,126 +293,158 @@ const formFields = computed<ProFormField[]>(() => [
|
|
|
249
293
|
},
|
|
250
294
|
{
|
|
251
295
|
prop: "left_tree_config.comment",
|
|
252
|
-
label: "
|
|
296
|
+
label: t("system.codegen.table.field.leftTreeComment"),
|
|
253
297
|
component: "input",
|
|
254
|
-
labelTooltip: "
|
|
255
|
-
props: { placeholder: "
|
|
298
|
+
labelTooltip: t("system.codegen.table.tooltip.leftTreeComment"),
|
|
299
|
+
props: { placeholder: t("system.codegen.table.placeholder.leftTreeComment") },
|
|
256
300
|
visible: model => model.page_type === "left_tree"
|
|
257
301
|
},
|
|
258
302
|
{
|
|
259
303
|
prop: "left_tree_config.filter_column",
|
|
260
|
-
label: "
|
|
261
|
-
labelTooltip: "
|
|
304
|
+
label: t("system.codegen.table.field.filterColumn"),
|
|
305
|
+
labelTooltip: t("system.codegen.table.tooltip.filterColumn"),
|
|
262
306
|
component: "select",
|
|
263
307
|
options: databaseColumnOptions.value,
|
|
264
|
-
props: {
|
|
308
|
+
props: {
|
|
309
|
+
placeholder: t("system.codegen.table.placeholder.filterColumn"),
|
|
310
|
+
clearable: true,
|
|
311
|
+
filterable: true,
|
|
312
|
+
style: { width: "100%" }
|
|
313
|
+
},
|
|
265
314
|
visible: model => model.page_type === "left_tree"
|
|
266
315
|
},
|
|
267
316
|
{
|
|
268
317
|
prop: "left_tree_config.parent_column",
|
|
269
|
-
label: "
|
|
318
|
+
label: t("system.codegen.table.field.leftTreeParentColumn"),
|
|
270
319
|
component: "select",
|
|
271
320
|
options: leftTreeColumnOptions.value,
|
|
272
|
-
labelTooltip: "
|
|
273
|
-
props: {
|
|
321
|
+
labelTooltip: t("system.codegen.table.tooltip.leftTreeParentColumn"),
|
|
322
|
+
props: {
|
|
323
|
+
placeholder: t("system.codegen.table.placeholder.leftTreeParentColumn"),
|
|
324
|
+
clearable: true,
|
|
325
|
+
filterable: true,
|
|
326
|
+
style: { width: "100%" }
|
|
327
|
+
},
|
|
274
328
|
visible: model => model.page_type === "left_tree"
|
|
275
329
|
},
|
|
276
330
|
{
|
|
277
331
|
prop: "left_tree_config.label_column",
|
|
278
|
-
label: "
|
|
332
|
+
label: t("system.codegen.table.field.leftTreeLabelColumn"),
|
|
279
333
|
component: "select",
|
|
280
334
|
options: leftTreeColumnOptions.value,
|
|
281
|
-
labelTooltip: "
|
|
282
|
-
props: {
|
|
335
|
+
labelTooltip: t("system.codegen.table.tooltip.leftTreeLabelColumn"),
|
|
336
|
+
props: {
|
|
337
|
+
placeholder: t("system.codegen.table.placeholder.leftTreeLabelColumn"),
|
|
338
|
+
clearable: true,
|
|
339
|
+
filterable: true,
|
|
340
|
+
style: { width: "100%" }
|
|
341
|
+
},
|
|
283
342
|
visible: model => model.page_type === "left_tree"
|
|
284
343
|
},
|
|
285
344
|
{
|
|
286
345
|
prop: "left_tree_config.value_column",
|
|
287
|
-
label: "
|
|
346
|
+
label: t("system.codegen.table.field.leftTreeValueColumn"),
|
|
288
347
|
component: "select",
|
|
289
348
|
options: leftTreeColumnOptions.value,
|
|
290
|
-
labelTooltip: "
|
|
291
|
-
props: {
|
|
349
|
+
labelTooltip: t("system.codegen.table.tooltip.leftTreeValueColumn"),
|
|
350
|
+
props: {
|
|
351
|
+
placeholder: t("system.codegen.table.placeholder.leftTreeValueColumn"),
|
|
352
|
+
clearable: true,
|
|
353
|
+
filterable: true,
|
|
354
|
+
style: { width: "100%" }
|
|
355
|
+
},
|
|
292
356
|
visible: model => model.page_type === "left_tree"
|
|
293
357
|
},
|
|
294
358
|
{
|
|
295
359
|
prop: "left_tree_config.lazy",
|
|
296
|
-
label: "
|
|
360
|
+
label: t("system.codegen.table.field.leftTreeLazy"),
|
|
297
361
|
component: "switch",
|
|
298
|
-
labelTooltip: "
|
|
299
|
-
props: { activeText: "
|
|
362
|
+
labelTooltip: t("system.codegen.table.tooltip.leftTreeLazy"),
|
|
363
|
+
props: { activeText: t("system.codegen.value.lazy"), inactiveText: t("system.codegen.value.eager") },
|
|
300
364
|
visible: model => model.page_type === "left_tree"
|
|
301
365
|
},
|
|
302
366
|
{
|
|
303
367
|
prop: "gen_backend",
|
|
304
|
-
label: "
|
|
368
|
+
label: t("system.codegen.table.field.genBackend"),
|
|
305
369
|
component: "switch",
|
|
306
|
-
labelTooltip: "
|
|
370
|
+
labelTooltip: t("system.codegen.table.tooltip.genBackend"),
|
|
307
371
|
// 三个生成开关始终从新行开始并排展示。
|
|
308
372
|
rowBreakBefore: true,
|
|
309
373
|
colSpan: 8,
|
|
310
|
-
props: { activeText: "
|
|
374
|
+
props: { activeText: t("system.codegen.value.generate"), inactiveText: t("system.codegen.value.skip") }
|
|
311
375
|
},
|
|
312
376
|
{
|
|
313
377
|
prop: "gen_frontend",
|
|
314
|
-
label: "
|
|
378
|
+
label: t("system.codegen.table.field.genFrontend"),
|
|
315
379
|
component: "switch",
|
|
316
|
-
labelTooltip: "
|
|
380
|
+
labelTooltip: t("system.codegen.table.tooltip.genFrontend"),
|
|
317
381
|
colSpan: 8,
|
|
318
|
-
props: { activeText: "
|
|
382
|
+
props: { activeText: t("system.codegen.value.generate"), inactiveText: t("system.codegen.value.skip") }
|
|
319
383
|
},
|
|
320
384
|
{
|
|
321
385
|
prop: "gen_sql",
|
|
322
|
-
label: "
|
|
386
|
+
label: t("system.codegen.table.field.genSql"),
|
|
323
387
|
component: "switch",
|
|
324
388
|
colSpan: 8,
|
|
325
|
-
labelTooltip: "
|
|
326
|
-
props: { activeText: "
|
|
389
|
+
labelTooltip: t("system.codegen.table.tooltip.genSql"),
|
|
390
|
+
props: { activeText: t("system.codegen.value.generate"), inactiveText: t("system.codegen.value.skip") }
|
|
327
391
|
},
|
|
328
392
|
{
|
|
329
393
|
prop: "status",
|
|
330
|
-
label: "
|
|
394
|
+
label: t("system.codegen.table.field.status"),
|
|
331
395
|
component: "dict",
|
|
332
396
|
colSpan: 24,
|
|
333
397
|
props: { code: "code_gen_table_status", codeType: "number", type: "radio" },
|
|
334
|
-
labelTooltip: "
|
|
398
|
+
labelTooltip: t("system.codegen.table.tooltip.status")
|
|
335
399
|
},
|
|
336
400
|
{
|
|
337
401
|
prop: "remark",
|
|
338
|
-
label: "
|
|
402
|
+
label: t("system.codegen.table.field.remark"),
|
|
339
403
|
component: "textarea",
|
|
340
404
|
colSpan: 24,
|
|
341
|
-
labelTooltip: "
|
|
342
|
-
props: { placeholder: "
|
|
405
|
+
labelTooltip: t("system.codegen.table.tooltip.remark"),
|
|
406
|
+
props: { placeholder: t("system.codegen.table.placeholder.remark"), rows: 3 }
|
|
343
407
|
}
|
|
344
408
|
]);
|
|
345
409
|
|
|
346
410
|
/** 代码生成表配置列表列。 */
|
|
347
|
-
const columns
|
|
411
|
+
const columns = computed<ColumnProps[]>(() => [
|
|
348
412
|
{ type: "selection", width: 55 },
|
|
349
|
-
{ prop: "name", label: "
|
|
350
|
-
{ prop: "comment", label: "
|
|
413
|
+
{ prop: "name", label: t("system.codegen.table.field.name"), minWidth: 160, search: { el: "input" } },
|
|
414
|
+
{ prop: "comment", label: t("system.codegen.table.field.comment"), minWidth: 160, showOverflowTooltip: true },
|
|
351
415
|
{
|
|
352
416
|
prop: "business_module",
|
|
353
|
-
label: "
|
|
417
|
+
label: t("system.codegen.table.field.businessModule"),
|
|
354
418
|
minWidth: 140,
|
|
355
419
|
dictCode: "business_module",
|
|
356
420
|
dictValueType: "string",
|
|
357
421
|
search: { el: "select" }
|
|
358
422
|
},
|
|
359
|
-
{
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
423
|
+
{
|
|
424
|
+
prop: "page_type",
|
|
425
|
+
label: t("system.codegen.table.field.pageType"),
|
|
426
|
+
minWidth: 120,
|
|
427
|
+
enum: pageTypeOptions.value,
|
|
428
|
+
search: { el: "select" }
|
|
429
|
+
},
|
|
430
|
+
{
|
|
431
|
+
prop: "status",
|
|
432
|
+
label: t("system.codegen.table.field.status"),
|
|
433
|
+
width: 100,
|
|
434
|
+
dictCode: "code_gen_table_status",
|
|
435
|
+
search: { el: "select" }
|
|
436
|
+
},
|
|
437
|
+
{ prop: "remark", label: t("system.codegen.table.field.remark"), minWidth: 180, showOverflowTooltip: true },
|
|
438
|
+
{ prop: "created_at", label: t("system.codegen.table.field.createdAt"), minWidth: 180 },
|
|
363
439
|
{
|
|
364
440
|
prop: "operation",
|
|
365
|
-
label: "
|
|
441
|
+
label: t("common.field.operation"),
|
|
366
442
|
width: 660,
|
|
367
443
|
fixed: "right",
|
|
368
444
|
cellType: "actions",
|
|
369
445
|
actions: [
|
|
370
446
|
{
|
|
371
|
-
label: "
|
|
447
|
+
label: t("system.codegen.table.action.columns"),
|
|
372
448
|
type: "success",
|
|
373
449
|
link: true,
|
|
374
450
|
icon: SetUp,
|
|
@@ -376,7 +452,7 @@ const columns: ColumnProps[] = [
|
|
|
376
452
|
onClick: scope => handleOpenColumnConfig((scope.row as CodeGenTable).id)
|
|
377
453
|
},
|
|
378
454
|
{
|
|
379
|
-
label: "
|
|
455
|
+
label: t("system.codegen.table.action.proto"),
|
|
380
456
|
type: "warning",
|
|
381
457
|
link: true,
|
|
382
458
|
icon: Connection,
|
|
@@ -384,7 +460,7 @@ const columns: ColumnProps[] = [
|
|
|
384
460
|
onClick: scope => handleOpenProtoConfig((scope.row as CodeGenTable).id)
|
|
385
461
|
},
|
|
386
462
|
{
|
|
387
|
-
label: "
|
|
463
|
+
label: t("system.codegen.table.action.pagePreview"),
|
|
388
464
|
type: "primary",
|
|
389
465
|
link: true,
|
|
390
466
|
icon: View,
|
|
@@ -392,7 +468,7 @@ const columns: ColumnProps[] = [
|
|
|
392
468
|
onClick: scope => handleOpenPreview((scope.row as CodeGenTable).id)
|
|
393
469
|
},
|
|
394
470
|
{
|
|
395
|
-
label: "
|
|
471
|
+
label: t("system.codegen.table.action.codePreview"),
|
|
396
472
|
type: "primary",
|
|
397
473
|
link: true,
|
|
398
474
|
icon: Document,
|
|
@@ -400,7 +476,7 @@ const columns: ColumnProps[] = [
|
|
|
400
476
|
onClick: scope => handleOpenCodePreview((scope.row as CodeGenTable).id)
|
|
401
477
|
},
|
|
402
478
|
{
|
|
403
|
-
label: "
|
|
479
|
+
label: t("system.codegen.action.generate"),
|
|
404
480
|
type: "success",
|
|
405
481
|
link: true,
|
|
406
482
|
icon: Promotion,
|
|
@@ -409,7 +485,7 @@ const columns: ColumnProps[] = [
|
|
|
409
485
|
onClick: scope => handleGenerate(scope.row as CodeGenTable)
|
|
410
486
|
},
|
|
411
487
|
{
|
|
412
|
-
label: "
|
|
488
|
+
label: t("system.codegen.action.restore"),
|
|
413
489
|
type: "warning",
|
|
414
490
|
link: true,
|
|
415
491
|
icon: RefreshRight,
|
|
@@ -418,7 +494,7 @@ const columns: ColumnProps[] = [
|
|
|
418
494
|
onClick: scope => handleRestore(scope.row as CodeGenTable)
|
|
419
495
|
},
|
|
420
496
|
{
|
|
421
|
-
label: "
|
|
497
|
+
label: t("common.action.edit"),
|
|
422
498
|
type: "primary",
|
|
423
499
|
link: true,
|
|
424
500
|
icon: EditPen,
|
|
@@ -426,7 +502,7 @@ const columns: ColumnProps[] = [
|
|
|
426
502
|
onClick: scope => handleOpenDialog((scope.row as CodeGenTable).id)
|
|
427
503
|
},
|
|
428
504
|
{
|
|
429
|
-
label: "
|
|
505
|
+
label: t("common.action.delete"),
|
|
430
506
|
type: "danger",
|
|
431
507
|
link: true,
|
|
432
508
|
icon: Delete,
|
|
@@ -435,7 +511,7 @@ const columns: ColumnProps[] = [
|
|
|
435
511
|
}
|
|
436
512
|
]
|
|
437
513
|
}
|
|
438
|
-
];
|
|
514
|
+
]);
|
|
439
515
|
|
|
440
516
|
/** 打开已经保存的代码生成页面预览。 */
|
|
441
517
|
async function handleOpenPreview(tableId: number) {
|
|
@@ -453,16 +529,16 @@ async function handleOpenProtoConfig(tableId: number) {
|
|
|
453
529
|
}
|
|
454
530
|
|
|
455
531
|
/** 代码生成表配置列表顶部操作。 */
|
|
456
|
-
const headerActions
|
|
532
|
+
const headerActions = computed<HeaderActionProps[]>(() => [
|
|
457
533
|
{
|
|
458
|
-
label: "
|
|
534
|
+
label: t("common.action.create"),
|
|
459
535
|
type: "success",
|
|
460
536
|
icon: CirclePlus,
|
|
461
537
|
hidden: () => !BUTTONS.value["tool:code-gen-table:create"],
|
|
462
538
|
onClick: () => handleOpenDialog()
|
|
463
539
|
},
|
|
464
540
|
{
|
|
465
|
-
label: "
|
|
541
|
+
label: t("system.codegen.action.batchGenerate"),
|
|
466
542
|
type: "primary",
|
|
467
543
|
icon: Promotion,
|
|
468
544
|
hidden: () => !BUTTONS.value["tool:code-gen-table:generate"],
|
|
@@ -470,7 +546,7 @@ const headerActions: HeaderActionProps[] = [
|
|
|
470
546
|
onClick: scope => handleGenerate(scope.selectedList as CodeGenTable[])
|
|
471
547
|
},
|
|
472
548
|
{
|
|
473
|
-
label: "
|
|
549
|
+
label: t("system.codegen.action.batchRestore"),
|
|
474
550
|
type: "warning",
|
|
475
551
|
icon: RefreshRight,
|
|
476
552
|
hidden: () => !BUTTONS.value["tool:code-gen-table:restore"],
|
|
@@ -478,21 +554,21 @@ const headerActions: HeaderActionProps[] = [
|
|
|
478
554
|
onClick: scope => handleRestore(scope.selectedList as CodeGenTable[])
|
|
479
555
|
},
|
|
480
556
|
{
|
|
481
|
-
label: "
|
|
557
|
+
label: t("system.codegen.action.recentTask"),
|
|
482
558
|
icon: Clock,
|
|
483
559
|
hidden: () => !BUTTONS.value["tool:code-gen-table:generate"],
|
|
484
560
|
disabled: () => !progressTaskAvailable.value,
|
|
485
561
|
onClick: handleOpenProgress
|
|
486
562
|
},
|
|
487
563
|
{
|
|
488
|
-
label: "
|
|
564
|
+
label: t("common.action.delete"),
|
|
489
565
|
type: "danger",
|
|
490
566
|
icon: Delete,
|
|
491
567
|
hidden: () => !BUTTONS.value["tool:code-gen-table:delete"],
|
|
492
568
|
disabled: scope => !scope.selectedList.length,
|
|
493
569
|
onClick: scope => handleDelete(scope.selectedList as CodeGenTable[])
|
|
494
570
|
}
|
|
495
|
-
];
|
|
571
|
+
]);
|
|
496
572
|
|
|
497
573
|
/** 打开已经保存的代码生成文件预览。 */
|
|
498
574
|
async function handleOpenCodePreview(tableId: number) {
|
|
@@ -503,19 +579,22 @@ async function handleOpenCodePreview(tableId: number) {
|
|
|
503
579
|
async function handleGenerate(selected: CodeGenGenerateTarget) {
|
|
504
580
|
const tables = Array.isArray(selected) ? selected : [selected];
|
|
505
581
|
if (!tables.length) {
|
|
506
|
-
ElMessage.warning("
|
|
582
|
+
ElMessage.warning(t("system.codegen.table.message.selectGenerate"));
|
|
507
583
|
return;
|
|
508
584
|
}
|
|
509
585
|
const disabledTable = tables.find(table => table.status === codeGenStatusDisabled);
|
|
510
586
|
if (disabledTable) {
|
|
511
|
-
ElMessage.warning(
|
|
587
|
+
ElMessage.warning(t("system.codegen.table.message.disabled", { name: disabledTable.name }));
|
|
512
588
|
return;
|
|
513
589
|
}
|
|
514
|
-
const message =
|
|
590
|
+
const message =
|
|
591
|
+
tables.length === 1
|
|
592
|
+
? t("system.codegen.table.dialog.generateOne", { name: tables[0].name })
|
|
593
|
+
: t("system.codegen.table.dialog.generateBatch", { count: tables.length });
|
|
515
594
|
try {
|
|
516
|
-
await ElMessageBox.confirm(message, "
|
|
517
|
-
confirmButtonText: "
|
|
518
|
-
cancelButtonText: "
|
|
595
|
+
await ElMessageBox.confirm(message, t("common.title.notice"), {
|
|
596
|
+
confirmButtonText: t("common.action.confirm"),
|
|
597
|
+
cancelButtonText: t("common.action.cancel"),
|
|
519
598
|
type: "warning"
|
|
520
599
|
});
|
|
521
600
|
} catch {
|
|
@@ -543,24 +622,24 @@ async function handleRestore(selected: CodeGenRestoreTarget) {
|
|
|
543
622
|
const tables = Array.isArray(selected) ? selected : [selected];
|
|
544
623
|
const restorableTables = tables.filter(table => table.restore_available);
|
|
545
624
|
if (!restorableTables.length) {
|
|
546
|
-
ElMessage.warning("
|
|
625
|
+
ElMessage.warning(t("system.codegen.table.message.selectRestore"));
|
|
547
626
|
return;
|
|
548
627
|
}
|
|
549
628
|
const message =
|
|
550
629
|
restorableTables.length === 1
|
|
551
|
-
?
|
|
552
|
-
:
|
|
630
|
+
? t("system.codegen.table.dialog.restoreOne", { name: restorableTables[0].name })
|
|
631
|
+
: t("system.codegen.table.dialog.restoreBatch", { count: restorableTables.length });
|
|
553
632
|
try {
|
|
554
|
-
await ElMessageBox.confirm(message, "
|
|
555
|
-
confirmButtonText: "
|
|
556
|
-
cancelButtonText: "
|
|
633
|
+
await ElMessageBox.confirm(message, t("common.title.warning"), {
|
|
634
|
+
confirmButtonText: t("system.codegen.action.confirmRestore"),
|
|
635
|
+
cancelButtonText: t("common.action.cancel"),
|
|
557
636
|
type: "warning"
|
|
558
637
|
});
|
|
559
638
|
} catch {
|
|
560
639
|
return;
|
|
561
640
|
}
|
|
562
641
|
await defCodeGenService.RestoreCodeGen({ table_ids: restorableTables.map(table => table.id) });
|
|
563
|
-
ElMessage.success("
|
|
642
|
+
ElMessage.success(t("system.codegen.table.message.restoreSuccess"));
|
|
564
643
|
progressSelectedTableIds.value = [];
|
|
565
644
|
proTable.value?.clearSelection();
|
|
566
645
|
refreshTable();
|
|
@@ -654,9 +733,7 @@ async function handleOpenDialog(tableId?: number) {
|
|
|
654
733
|
databaseTables.value.find(item => item.name === formData.left_tree_config?.table_name)?.comment ?? "";
|
|
655
734
|
}
|
|
656
735
|
await Promise.all([loadDatabaseColumns(databaseColumns, formData.name), loadLeftTreeDatabaseColumns()]);
|
|
657
|
-
dialog.
|
|
658
|
-
} else {
|
|
659
|
-
dialog.title = "新增代码生成表配置";
|
|
736
|
+
dialog.editing = true;
|
|
660
737
|
}
|
|
661
738
|
dialog.visible = true;
|
|
662
739
|
}
|
|
@@ -670,6 +747,7 @@ function handleCloseDialog() {
|
|
|
670
747
|
/** 重置弹窗表单和字段选项。 */
|
|
671
748
|
function resetForm() {
|
|
672
749
|
Object.assign(formData, { ...createDefaultCodeGenTableForm(), parent_menu_id: undefined });
|
|
750
|
+
dialog.editing = false;
|
|
673
751
|
databaseColumns.value = [];
|
|
674
752
|
leftTreeDatabaseColumns.value = [];
|
|
675
753
|
void nextTick(() => {
|
|
@@ -682,6 +760,7 @@ function resetForm() {
|
|
|
682
760
|
async function handleTableNameChange(tableName: string) {
|
|
683
761
|
const table = databaseTables.value.find(item => item.name === tableName);
|
|
684
762
|
formData.comment = table?.comment ?? "";
|
|
763
|
+
formData.i18n_config = new Map();
|
|
685
764
|
await loadDatabaseColumns(databaseColumns, tableName);
|
|
686
765
|
resetUnavailableTableColumns();
|
|
687
766
|
formData.parent_column = resolveDefaultColumn(databaseColumns.value, "parent_id");
|
|
@@ -722,10 +801,10 @@ async function handleSubmit() {
|
|
|
722
801
|
try {
|
|
723
802
|
if (formData.id) {
|
|
724
803
|
await defCodeGenTableService.UpdateCodeGenTable({ id: formData.id, code_gen_table: payload });
|
|
725
|
-
ElMessage.success("
|
|
804
|
+
ElMessage.success(t("system.codegen.table.message.updateSuccess"));
|
|
726
805
|
} else {
|
|
727
806
|
await defCodeGenTableService.CreateCodeGenTable({ code_gen_table: payload });
|
|
728
|
-
ElMessage.success("
|
|
807
|
+
ElMessage.success(t("system.codegen.table.message.createSuccess"));
|
|
729
808
|
}
|
|
730
809
|
handleCloseDialog();
|
|
731
810
|
refreshTable();
|
|
@@ -745,23 +824,25 @@ async function handleDelete(selected?: CodeGenDeleteTarget) {
|
|
|
745
824
|
tableList.length ? tableList.map(item => item.id) : normalizeSelectedIds(selected as number | string | Array<number | string>)
|
|
746
825
|
).join(",");
|
|
747
826
|
if (!tableIds) {
|
|
748
|
-
ElMessage.warning("
|
|
827
|
+
ElMessage.warning(t("system.codegen.table.message.selectDelete"));
|
|
749
828
|
return;
|
|
750
829
|
}
|
|
751
830
|
const confirmMessage =
|
|
752
|
-
tableList.length === 1
|
|
831
|
+
tableList.length === 1
|
|
832
|
+
? t("system.codegen.table.dialog.deleteOne", { name: tableList[0].name })
|
|
833
|
+
: t("system.codegen.table.dialog.deleteBatch", { count: tableList.length });
|
|
753
834
|
try {
|
|
754
|
-
await ElMessageBox.confirm(confirmMessage, "
|
|
755
|
-
confirmButtonText: "
|
|
756
|
-
cancelButtonText: "
|
|
835
|
+
await ElMessageBox.confirm(confirmMessage, t("common.title.warning"), {
|
|
836
|
+
confirmButtonText: t("common.action.confirm"),
|
|
837
|
+
cancelButtonText: t("common.action.cancel"),
|
|
757
838
|
type: "warning"
|
|
758
839
|
});
|
|
759
840
|
} catch {
|
|
760
|
-
ElMessage.info("
|
|
841
|
+
ElMessage.info(t("system.codegen.table.message.deleteCanceled"));
|
|
761
842
|
return;
|
|
762
843
|
}
|
|
763
844
|
await defCodeGenTableService.DeleteCodeGenTable({ ids: tableIds });
|
|
764
|
-
ElMessage.success("
|
|
845
|
+
ElMessage.success(t("system.codegen.table.message.deleteSuccess"));
|
|
765
846
|
refreshTable();
|
|
766
847
|
}
|
|
767
848
|
|
|
@@ -849,7 +930,6 @@ function ensureLeftTreeConfig() {
|
|
|
849
930
|
formData.left_tree_config ??= createDefaultCodeGenLeftTreeConfig();
|
|
850
931
|
return formData.left_tree_config;
|
|
851
932
|
}
|
|
852
|
-
|
|
853
933
|
</script>
|
|
854
934
|
|
|
855
935
|
<style scoped lang="scss">
|