@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
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
<span class="api-doc-page__document-key">{{ document.key }}</span>
|
|
16
16
|
</button>
|
|
17
17
|
</div>
|
|
18
|
-
<el-empty v-else :image-size="56" description="
|
|
18
|
+
<el-empty v-else :image-size="56" :description="t('system.apiDoc.message.empty')" />
|
|
19
19
|
</el-card>
|
|
20
20
|
<el-card class="code-gen-sub-card api-doc-page__card" shadow="never">
|
|
21
21
|
<div ref="swaggerRootRef" class="api-doc-page__swagger" />
|
|
@@ -27,9 +27,10 @@
|
|
|
27
27
|
<script setup lang="ts">
|
|
28
28
|
import SwaggerUIBundle from "swagger-ui-dist/swagger-ui-bundle.js";
|
|
29
29
|
import "swagger-ui-dist/swagger-ui.css";
|
|
30
|
-
import { getRequestAccessToken } from "@liujitcn/kratos-admin-core/request";
|
|
30
|
+
import { getLocaleRequestHeaders, getRequestAccessToken } from "@liujitcn/kratos-admin-core/request";
|
|
31
31
|
import { defBaseApiService } from "@liujitcn/kratos-admin-system/api/system/base_api";
|
|
32
32
|
import type { OpenApiServiceOption } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_api";
|
|
33
|
+
import { t } from "@liujitcn/kratos-admin-core";
|
|
33
34
|
|
|
34
35
|
const swaggerRootRef = ref<HTMLElement>();
|
|
35
36
|
const loading = ref(true);
|
|
@@ -63,8 +64,11 @@ function initializeSwaggerUI(documentKey: string) {
|
|
|
63
64
|
if (accessToken) {
|
|
64
65
|
request.headers = {
|
|
65
66
|
...request.headers,
|
|
67
|
+
...getLocaleRequestHeaders(),
|
|
66
68
|
Authorization: accessToken
|
|
67
69
|
};
|
|
70
|
+
} else {
|
|
71
|
+
request.headers = { ...request.headers, ...getLocaleRequestHeaders() };
|
|
68
72
|
}
|
|
69
73
|
return request;
|
|
70
74
|
}
|
|
@@ -4,14 +4,18 @@
|
|
|
4
4
|
<el-card class="code-gen-sub-card" shadow="never">
|
|
5
5
|
<div v-if="BUTTONS['tool:code-gen-table:generate']" class="code-gen-toolbar">
|
|
6
6
|
<div class="code-gen-code-preview-actions">
|
|
7
|
-
<el-button :icon="Clock" :disabled="!progressTaskAvailable" @click="handleOpenProgress"
|
|
8
|
-
|
|
7
|
+
<el-button :icon="Clock" :disabled="!progressTaskAvailable" @click="handleOpenProgress">
|
|
8
|
+
{{ t("system.codegen.action.recentTask") }}
|
|
9
|
+
</el-button>
|
|
10
|
+
<el-button :icon="Promotion" type="primary" :loading="generating" @click="handleGenerate">
|
|
11
|
+
{{ t("system.codegen.action.generate") }}
|
|
12
|
+
</el-button>
|
|
9
13
|
</div>
|
|
10
14
|
</div>
|
|
11
15
|
|
|
12
16
|
<el-alert v-if="previewError" class="code-gen-code-preview-alert" :title="previewError" type="warning" :closable="false" />
|
|
13
17
|
<CodePreviewPane v-if="loading || files.length" class="code-gen-code-preview-table" :files="files" :loading="loading" />
|
|
14
|
-
<el-empty v-else class="code-gen-code-preview-empty" description="
|
|
18
|
+
<el-empty v-else class="code-gen-code-preview-empty" :description="t('system.codegen.preview.message.emptyFiles')" />
|
|
15
19
|
</el-card>
|
|
16
20
|
|
|
17
21
|
<CodeGenProgressDialog
|
|
@@ -28,6 +32,7 @@
|
|
|
28
32
|
import { computed, ref, watch } from "vue";
|
|
29
33
|
import { Clock, Promotion } from "@element-plus/icons-vue";
|
|
30
34
|
import { useRoute } from "vue-router";
|
|
35
|
+
import { t } from "@liujitcn/kratos-admin-core";
|
|
31
36
|
import { useAuthButtons } from "@liujitcn/kratos-admin-core/auth";
|
|
32
37
|
import { useTabsStore } from "@liujitcn/kratos-admin-core/stores/runtime";
|
|
33
38
|
import { defCodeGenService } from "@liujitcn/kratos-admin-system/api/system/code_gen";
|
|
@@ -55,6 +60,7 @@ const table = ref<CodeGenTableForm>();
|
|
|
55
60
|
const files = ref<CodeGenPreviewFile[]>([]);
|
|
56
61
|
const loading = ref(false);
|
|
57
62
|
const previewError = ref("");
|
|
63
|
+
const missingTranslations = ref<string[]>([]);
|
|
58
64
|
const progressTaskId = ref(typeof window === "undefined" ? "" : (window.sessionStorage.getItem(codeGenTaskStorageKey) ?? ""));
|
|
59
65
|
const progressDialogVisible = ref(
|
|
60
66
|
!!progressTaskId.value &&
|
|
@@ -72,7 +78,7 @@ const tableId = computed(() => {
|
|
|
72
78
|
});
|
|
73
79
|
|
|
74
80
|
/** 当前代码预览页标题。 */
|
|
75
|
-
const pageTitle = computed(() => table.value?.comment || table.value?.name || "
|
|
81
|
+
const pageTitle = computed(() => table.value?.comment || table.value?.name || t("system.codegen.preview.title.code"));
|
|
76
82
|
|
|
77
83
|
// 路由生成对象变化时重新载入对应代码预览。
|
|
78
84
|
watch(
|
|
@@ -88,6 +94,7 @@ async function loadCodePreview() {
|
|
|
88
94
|
table.value = undefined;
|
|
89
95
|
files.value = [];
|
|
90
96
|
previewError.value = "";
|
|
97
|
+
missingTranslations.value = [];
|
|
91
98
|
if (!tableId.value) return;
|
|
92
99
|
loading.value = true;
|
|
93
100
|
try {
|
|
@@ -96,10 +103,16 @@ async function loadCodePreview() {
|
|
|
96
103
|
try {
|
|
97
104
|
const preview = await defCodeGenService.PreviewCodeGen({ table_id: tableId.value, output_paths: undefined });
|
|
98
105
|
files.value = preview.files ?? [];
|
|
99
|
-
|
|
106
|
+
missingTranslations.value = preview.missing_translations ?? [];
|
|
107
|
+
if (missingTranslations.value.length) {
|
|
108
|
+
previewError.value = t("system.codegen.preview.message.missingTranslations", {
|
|
109
|
+
items: missingTranslations.value.join(t("system.codegen.preview.value.listSeparator"))
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
if (!files.value.length && !previewError.value) previewError.value = t("system.codegen.preview.message.noPreviewFiles");
|
|
100
113
|
} catch {
|
|
101
114
|
// 预览错误在页面内转成可操作提示,避免全局错误弹窗只显示“系统出错”。
|
|
102
|
-
previewError.value = "
|
|
115
|
+
previewError.value = t("system.codegen.preview.message.loadFailed");
|
|
103
116
|
}
|
|
104
117
|
syncWorkspaceTitle();
|
|
105
118
|
} finally {
|
|
@@ -109,7 +122,7 @@ async function loadCodePreview() {
|
|
|
109
122
|
|
|
110
123
|
/** 同步代码预览页签和浏览器标题。 */
|
|
111
124
|
function syncWorkspaceTitle() {
|
|
112
|
-
const title =
|
|
125
|
+
const title = t("system.codegen.preview.title.workspace", { table: pageTitle.value });
|
|
113
126
|
tabsStore.setTabsTitle(title);
|
|
114
127
|
document.title = `${title} - ${import.meta.env.VITE_GLOB_APP_TITLE}`;
|
|
115
128
|
}
|
|
@@ -118,15 +131,19 @@ function syncWorkspaceTitle() {
|
|
|
118
131
|
async function handleGenerate() {
|
|
119
132
|
if (!table.value) return;
|
|
120
133
|
if (table.value.status === codeGenStatusDisabled) {
|
|
121
|
-
ElMessage.warning(
|
|
134
|
+
ElMessage.warning(t("system.codegen.table.message.disabled", { name: table.value.name }));
|
|
122
135
|
return;
|
|
123
136
|
}
|
|
124
137
|
try {
|
|
125
|
-
await ElMessageBox.confirm(
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
138
|
+
await ElMessageBox.confirm(
|
|
139
|
+
t("system.codegen.table.dialog.generateOne", { name: table.value.name }),
|
|
140
|
+
t("common.title.notice"),
|
|
141
|
+
{
|
|
142
|
+
confirmButtonText: t("common.action.confirm"),
|
|
143
|
+
cancelButtonText: t("common.action.cancel"),
|
|
144
|
+
type: "warning"
|
|
145
|
+
}
|
|
146
|
+
);
|
|
130
147
|
} catch {
|
|
131
148
|
return;
|
|
132
149
|
}
|
|
@@ -177,7 +194,6 @@ function handleProgressUnavailable() {
|
|
|
177
194
|
window.sessionStorage.removeItem(codeGenProgressSelectedTableIdsStorageKey);
|
|
178
195
|
window.sessionStorage.removeItem(codeGenTaskStorageKey);
|
|
179
196
|
}
|
|
180
|
-
|
|
181
197
|
</script>
|
|
182
198
|
|
|
183
199
|
<style scoped lang="scss">
|