@liujitcn/kratos-admin-system 0.0.20 → 0.0.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/README.md +51 -50
  2. package/dist/package/declarations/src/api/system/base_language.d.ts +52 -0
  3. package/dist/package/declarations/src/api/system/base_translation.d.ts +10 -0
  4. package/dist/package/declarations/src/api/system/code_gen_i18n.d.ts +8 -0
  5. package/dist/package/declarations/src/api/system/ops_monitoring.d.ts +19 -0
  6. package/dist/package/declarations/src/api/system/ops_monitoring_sse.d.ts +12 -0
  7. package/dist/package/declarations/src/components/DynamicTranslationCell.vue.d.ts +16 -0
  8. package/dist/package/declarations/src/components/DynamicTranslationEditor.vue.d.ts +20 -0
  9. package/dist/package/declarations/src/components/dynamicTranslation.d.ts +38 -0
  10. package/dist/package/declarations/src/locales/generated.d.ts +6536 -0
  11. package/dist/package/declarations/src/rpc/base/v1/ai_session.d.ts +12 -2
  12. package/dist/package/declarations/src/rpc/base/v1/ai_tool.d.ts +9 -1
  13. package/dist/package/declarations/src/rpc/base/v1/config.d.ts +35 -0
  14. package/dist/package/declarations/src/rpc/system/admin/v1/auth.d.ts +1 -1
  15. package/dist/package/declarations/src/rpc/system/admin/v1/base_config.d.ts +23 -2
  16. package/dist/package/declarations/src/rpc/system/admin/v1/base_dict.d.ts +9 -0
  17. package/dist/package/declarations/src/rpc/system/admin/v1/base_job.d.ts +9 -1
  18. package/dist/package/declarations/src/rpc/system/admin/v1/base_language.d.ts +119 -0
  19. package/dist/package/declarations/src/rpc/system/admin/v1/base_menu.d.ts +6 -1
  20. package/dist/package/declarations/src/rpc/system/admin/v1/base_migration.d.ts +6 -6
  21. package/dist/package/declarations/src/rpc/system/admin/v1/base_role.d.ts +13 -1
  22. package/dist/package/declarations/src/rpc/system/admin/v1/base_translation.d.ts +75 -0
  23. package/dist/package/declarations/src/rpc/system/admin/v1/base_user.d.ts +11 -1
  24. package/dist/package/declarations/src/rpc/system/admin/v1/code_gen.d.ts +13 -11
  25. package/dist/package/declarations/src/rpc/system/admin/v1/code_gen_column.d.ts +7 -0
  26. package/dist/package/declarations/src/rpc/system/admin/v1/code_gen_table.d.ts +24 -1
  27. package/dist/package/declarations/src/rpc/system/admin/v1/common.d.ts +13 -0
  28. package/dist/package/declarations/src/rpc/system/admin/v1/ops_monitoring.d.ts +222 -0
  29. package/dist/package/declarations/src/views/base/language/index.vue.d.ts +3 -0
  30. package/dist/package/declarations/src/views/tool/code-gen/components/CodeGenLocaleEditor.vue.d.ts +23 -0
  31. package/dist/package/declarations/src/views/tool/code-gen/config.d.ts +7 -7
  32. package/dist/package/declarations/src/views/tool/ops-monitoring/index.vue.d.ts +3 -0
  33. package/dist/package/src/api/base/ai_message.ts +7 -12
  34. package/dist/package/src/api/base/sse.ts +3 -1
  35. package/dist/package/src/api/system/base_language.ts +135 -0
  36. package/dist/package/src/api/system/base_translation.ts +33 -0
  37. package/dist/package/src/api/system/code_gen_column.ts +17 -3
  38. package/dist/package/src/api/system/code_gen_i18n.ts +18 -0
  39. package/dist/package/src/api/system/code_gen_table.ts +12 -4
  40. package/dist/package/src/api/system/ops_monitoring.ts +88 -0
  41. package/dist/package/src/api/system/ops_monitoring_sse.ts +49 -0
  42. package/dist/package/src/components/DynamicTranslationCell.vue +249 -0
  43. package/dist/package/src/components/DynamicTranslationEditor.vue +197 -0
  44. package/dist/package/src/components/dynamicTranslation.ts +66 -0
  45. package/dist/package/src/locales/README.md +30 -0
  46. package/dist/package/src/locales/en-US.json +933 -0
  47. package/dist/package/src/locales/es-ES.json +933 -0
  48. package/dist/package/src/locales/fr-FR.json +933 -0
  49. package/dist/package/src/locales/generated.ts +22 -0
  50. package/dist/package/src/locales/ja-JP.json +933 -0
  51. package/dist/package/src/locales/ko-KR.json +933 -0
  52. package/dist/package/src/locales/zh-CN.json +933 -0
  53. package/dist/package/src/locales/zh-TW.json +933 -0
  54. package/dist/package/src/module.ts +6 -2
  55. package/dist/package/src/rpc/base/v1/ai_session.ts +13 -2
  56. package/dist/package/src/rpc/base/v1/ai_tool.ts +10 -1
  57. package/dist/package/src/rpc/base/v1/config.ts +47 -0
  58. package/dist/package/src/rpc/system/admin/v1/auth.ts +1 -1
  59. package/dist/package/src/rpc/system/admin/v1/base_config.ts +24 -2
  60. package/dist/package/src/rpc/system/admin/v1/base_dict.ts +9 -0
  61. package/dist/package/src/rpc/system/admin/v1/base_job.ts +10 -1
  62. package/dist/package/src/rpc/system/admin/v1/base_language.ts +141 -0
  63. package/dist/package/src/rpc/system/admin/v1/base_menu.ts +6 -1
  64. package/dist/package/src/rpc/system/admin/v1/base_migration.ts +8 -8
  65. package/dist/package/src/rpc/system/admin/v1/base_role.ts +14 -1
  66. package/dist/package/src/rpc/system/admin/v1/base_translation.ts +90 -0
  67. package/dist/package/src/rpc/system/admin/v1/base_user.ts +12 -1
  68. package/dist/package/src/rpc/system/admin/v1/code_gen.ts +16 -12
  69. package/dist/package/src/rpc/system/admin/v1/code_gen_column.ts +8 -0
  70. package/dist/package/src/rpc/system/admin/v1/code_gen_table.ts +27 -1
  71. package/dist/package/src/rpc/system/admin/v1/common.ts +21 -0
  72. package/dist/package/src/rpc/system/admin/v1/ops_monitoring.ts +255 -0
  73. package/dist/package/src/views/ai/chat/components/AiMarkdown.vue +1 -6
  74. package/dist/package/src/views/ai/chat/components/ChatPanel.vue +75 -58
  75. package/dist/package/src/views/ai/chat/components/SessionPanel.vue +20 -9
  76. package/dist/package/src/views/ai/chat/components/XSender.vue +36 -23
  77. package/dist/package/src/views/ai/chat/index.vue +58 -41
  78. package/dist/package/src/views/ai/chat/message.ts +29 -27
  79. package/dist/package/src/views/base/api/index.vue +121 -84
  80. package/dist/package/src/views/base/area/index.vue +81 -32
  81. package/dist/package/src/views/base/config/index.vue +300 -96
  82. package/dist/package/src/views/base/dept/index.vue +110 -62
  83. package/dist/package/src/views/base/dict/index.vue +145 -62
  84. package/dist/package/src/views/base/dict/item.vue +155 -64
  85. package/dist/package/src/views/base/job/index.vue +134 -82
  86. package/dist/package/src/views/base/job/log.vue +24 -25
  87. package/dist/package/src/views/base/language/index.vue +260 -0
  88. package/dist/package/src/views/base/log/index.vue +68 -46
  89. package/dist/package/src/views/base/menu/index.vue +344 -200
  90. package/dist/package/src/views/base/migration/index.vue +49 -29
  91. package/dist/package/src/views/base/post/index.vue +128 -60
  92. package/dist/package/src/views/base/role/index.vue +145 -79
  93. package/dist/package/src/views/base/tenant/index.vue +132 -64
  94. package/dist/package/src/views/base/user/components/dept-tree.vue +2 -1
  95. package/dist/package/src/views/base/user/index.vue +194 -116
  96. package/dist/package/src/views/profile/components/base.vue +45 -28
  97. package/dist/package/src/views/profile/components/password.vue +45 -30
  98. package/dist/package/src/views/profile/components/security.vue +90 -54
  99. package/dist/package/src/views/profile/index.vue +10 -9
  100. package/dist/package/src/views/tool/api-doc/index.vue +6 -2
  101. package/dist/package/src/views/tool/code-gen/code-preview/index.vue +32 -16
  102. package/dist/package/src/views/tool/code-gen/columns/index.vue +382 -273
  103. package/dist/package/src/views/tool/code-gen/columns/option-copy.ts +1 -6
  104. package/dist/package/src/views/tool/code-gen/components/CodeGenLocaleEditor.vue +118 -0
  105. package/dist/package/src/views/tool/code-gen/components/CodeGenProgressDialog.vue +65 -36
  106. package/dist/package/src/views/tool/code-gen/components/CodePreviewPane.vue +8 -5
  107. package/dist/package/src/views/tool/code-gen/config.ts +116 -79
  108. package/dist/package/src/views/tool/code-gen/preview/data.ts +19 -17
  109. package/dist/package/src/views/tool/code-gen/preview/index.vue +96 -59
  110. package/dist/package/src/views/tool/code-gen/proto/index.vue +110 -62
  111. package/dist/package/src/views/tool/code-gen/table/index.vue +201 -121
  112. package/dist/package/src/views/tool/ops-monitoring/index.vue +1175 -0
  113. package/dist/package/src/views/tool/project-doc/index.vue +17 -15
  114. package/package.json +6 -2
  115. package/dist/package/declarations/src/rpc/base/v1/enum.d.ts +0 -43
  116. package/dist/package/declarations/src/rpc/system/common/v1/enum.d.ts +0 -67
  117. package/dist/package/src/rpc/base/v1/enum.ts +0 -54
  118. package/dist/package/src/rpc/system/common/v1/enum.ts +0 -80
@@ -3,28 +3,34 @@
3
3
  <div class="table-box">
4
4
  <ProTable ref="proTable" row-key="id" :columns="columns" :request-api="requestBaseApiTable" />
5
5
 
6
- <el-drawer v-model="detailDrawer.visible" title="API 详情" size="70%" @close="handleCloseDetail">
6
+ <el-drawer v-model="detailDrawer.visible" :title="t('system.base.api.title.detail')" size="70%" @close="handleCloseDetail">
7
7
  <el-descriptions v-if="detailData" :column="1" border>
8
- <el-descriptions-item label="工具名">{{ detailData.tool_name }}</el-descriptions-item>
9
- <el-descriptions-item label="工具提示词">
8
+ <el-descriptions-item :label="t('system.base.api.field.tool_name')">{{ detailData.tool_name }}</el-descriptions-item>
9
+ <el-descriptions-item :label="t('system.base.api.field.tool_prompts')">
10
10
  <div class="tool-prompts">
11
11
  <el-tag v-for="prompt in detailToolPrompts" :key="prompt" effect="plain">{{ prompt }}</el-tag>
12
12
  <span v-if="!detailToolPrompts.length">--</span>
13
13
  </div>
14
14
  </el-descriptions-item>
15
- <el-descriptions-item label="服务名">{{ detailData.service_name }}</el-descriptions-item>
16
- <el-descriptions-item label="服务描述">{{ detailData.service_desc }}</el-descriptions-item>
17
- <el-descriptions-item label="描述">{{ detailData.desc }}</el-descriptions-item>
18
- <el-descriptions-item label="操作方法">{{ detailData.operation }}</el-descriptions-item>
19
- <el-descriptions-item label="请求方法">{{ detailData.method }}</el-descriptions-item>
20
- <el-descriptions-item label="请求地址">{{ detailData.path }}</el-descriptions-item>
21
- <el-descriptions-item label="MCP工具">{{ formatStatus(detailData.mcp_status) }}</el-descriptions-item>
22
- <el-descriptions-item label="Agent工具">{{ formatStatus(detailData.agent_status) }}</el-descriptions-item>
15
+ <el-descriptions-item :label="t('system.base.api.field.service_name')">{{ detailData.service_name }}</el-descriptions-item>
16
+ <el-descriptions-item :label="t('system.base.api.field.service_description')">{{
17
+ detailData.service_desc
18
+ }}</el-descriptions-item>
19
+ <el-descriptions-item :label="t('system.base.api.field.description')">{{ detailData.desc }}</el-descriptions-item>
20
+ <el-descriptions-item :label="t('system.base.api.field.operation')">{{ detailData.operation }}</el-descriptions-item>
21
+ <el-descriptions-item :label="t('system.base.api.field.method')">{{ detailData.method }}</el-descriptions-item>
22
+ <el-descriptions-item :label="t('system.base.api.field.path')">{{ detailData.path }}</el-descriptions-item>
23
+ <el-descriptions-item :label="t('system.base.api.field.mcp_tool')">{{
24
+ formatStatus(detailData.mcp_status)
25
+ }}</el-descriptions-item>
26
+ <el-descriptions-item :label="t('system.base.api.field.agent_tool')">{{
27
+ formatStatus(detailData.agent_status)
28
+ }}</el-descriptions-item>
23
29
  </el-descriptions>
24
30
 
25
31
  <div v-if="detailDoc" class="api-doc">
26
32
  <section class="api-doc-section">
27
- <div class="api-doc-title">请求参数</div>
33
+ <div class="api-doc-title">{{ t("system.base.api.section.parameters") }}</div>
28
34
  <el-table
29
35
  v-if="detailParameters.length > 0"
30
36
  :data="detailParameters"
@@ -32,21 +38,26 @@
32
38
  default-expand-all
33
39
  :tree-props="{ children: 'children' }"
34
40
  >
35
- <el-table-column prop="path" label="字段" min-width="220" />
36
- <el-table-column prop="in" label="位置" width="90" />
37
- <el-table-column label="类型" min-width="180">
41
+ <el-table-column prop="path" :label="t('system.base.api.doc.field.name')" min-width="220" />
42
+ <el-table-column prop="in" :label="t('system.base.api.doc.field.location')" width="90" />
43
+ <el-table-column :label="t('system.base.api.doc.field.type')" min-width="180">
38
44
  <template #default="{ row }">{{ formatSchemaType(row) }}</template>
39
45
  </el-table-column>
40
- <el-table-column label="必填" width="80" align="center">
41
- <template #default="{ row }">{{ row.required ? "是" : "否" }}</template>
46
+ <el-table-column :label="t('system.base.api.doc.field.required')" width="80" align="center">
47
+ <template #default="{ row }">{{ t(row.required ? "common.value.yes" : "common.value.no") }}</template>
42
48
  </el-table-column>
43
- <el-table-column prop="description" label="说明" min-width="240" show-overflow-tooltip />
49
+ <el-table-column
50
+ prop="description"
51
+ :label="t('system.base.api.doc.field.description')"
52
+ min-width="240"
53
+ show-overflow-tooltip
54
+ />
44
55
  </el-table>
45
- <el-empty v-else description="无请求参数" :image-size="72" />
56
+ <el-empty v-else :description="t('system.base.api.message.no_parameters')" :image-size="72" />
46
57
  </section>
47
58
 
48
59
  <section class="api-doc-section">
49
- <div class="api-doc-title">请求体</div>
60
+ <div class="api-doc-title">{{ t("system.base.api.section.request_body") }}</div>
50
61
  <el-table
51
62
  v-if="requestBodyRows.length > 0"
52
63
  :data="requestBodyRows"
@@ -54,20 +65,25 @@
54
65
  default-expand-all
55
66
  :tree-props="{ children: 'children' }"
56
67
  >
57
- <el-table-column prop="path" label="字段" min-width="220" />
58
- <el-table-column label="类型" min-width="180">
68
+ <el-table-column prop="path" :label="t('system.base.api.doc.field.name')" min-width="220" />
69
+ <el-table-column :label="t('system.base.api.doc.field.type')" min-width="180">
59
70
  <template #default="{ row }">{{ formatSchemaType(row) }}</template>
60
71
  </el-table-column>
61
- <el-table-column label="必填" width="80" align="center">
62
- <template #default="{ row }">{{ row.required ? "是" : "否" }}</template>
72
+ <el-table-column :label="t('system.base.api.doc.field.required')" width="80" align="center">
73
+ <template #default="{ row }">{{ t(row.required ? "common.value.yes" : "common.value.no") }}</template>
63
74
  </el-table-column>
64
- <el-table-column prop="description" label="说明" min-width="240" show-overflow-tooltip />
75
+ <el-table-column
76
+ prop="description"
77
+ :label="t('system.base.api.doc.field.description')"
78
+ min-width="240"
79
+ show-overflow-tooltip
80
+ />
65
81
  </el-table>
66
- <el-empty v-else description="无请求体" :image-size="72" />
82
+ <el-empty v-else :description="t('system.base.api.message.no_request_body')" :image-size="72" />
67
83
  </section>
68
84
 
69
85
  <section class="api-doc-section">
70
- <div class="api-doc-title">返回值</div>
86
+ <div class="api-doc-title">{{ t("system.base.api.section.responses") }}</div>
71
87
  <el-collapse v-if="detailResponses.length > 0">
72
88
  <el-collapse-item v-for="response in detailResponses" :key="response.status" :name="response.status">
73
89
  <template #title>
@@ -80,16 +96,21 @@
80
96
  default-expand-all
81
97
  :tree-props="{ children: 'children' }"
82
98
  >
83
- <el-table-column prop="path" label="字段" min-width="220" />
84
- <el-table-column label="类型" min-width="180">
99
+ <el-table-column prop="path" :label="t('system.base.api.doc.field.name')" min-width="220" />
100
+ <el-table-column :label="t('system.base.api.doc.field.type')" min-width="180">
85
101
  <template #default="{ row }">{{ formatSchemaType(row) }}</template>
86
102
  </el-table-column>
87
- <el-table-column prop="description" label="说明" min-width="240" show-overflow-tooltip />
103
+ <el-table-column
104
+ prop="description"
105
+ :label="t('system.base.api.doc.field.description')"
106
+ min-width="240"
107
+ show-overflow-tooltip
108
+ />
88
109
  </el-table>
89
- <el-empty v-else description="无响应体" :image-size="72" />
110
+ <el-empty v-else :description="t('system.base.api.message.no_response_body')" :image-size="72" />
90
111
  </el-collapse-item>
91
112
  </el-collapse>
92
- <el-empty v-else description="无返回值" :image-size="72" />
113
+ <el-empty v-else :description="t('system.base.api.message.no_responses')" :image-size="72" />
93
114
  </section>
94
115
  </div>
95
116
  </el-drawer>
@@ -97,11 +118,10 @@
97
118
  <FormDialog
98
119
  v-model="editDialog.visible"
99
120
  ref="editDialogRef"
100
- title="编辑API"
121
+ :title="t('system.base.api.title.edit')"
101
122
  width="760px"
102
123
  :model="editForm"
103
124
  :fields="editFields"
104
- label-width="120px"
105
125
  @confirm="handleSubmitEdit"
106
126
  @close="handleCloseEditDialog"
107
127
  />
@@ -119,8 +139,15 @@ import type { ProFormField } from "@liujitcn/kratos-admin-core/components/ProFor
119
139
  import { useAuthButtons } from "@liujitcn/kratos-admin-core/auth";
120
140
  import { defBaseApiService } from "@liujitcn/kratos-admin-system/api/system/base_api";
121
141
  import { Status } from "@liujitcn/kratos-admin-system/rpc/common/v1/enum";
122
- import type { BaseApi, BaseApiDoc, BaseApiDocResponse, BaseApiDocSchema, PageBaseApiRequest } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_api";
142
+ import type {
143
+ BaseApi,
144
+ BaseApiDoc,
145
+ BaseApiDocResponse,
146
+ BaseApiDocSchema,
147
+ PageBaseApiRequest
148
+ } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_api";
123
149
  import { buildPageRequest } from "@liujitcn/kratos-admin-core/table";
150
+ import { t } from "@liujitcn/kratos-admin-core";
124
151
 
125
152
  defineOptions({
126
153
  name: "BaseApi",
@@ -157,95 +184,105 @@ const detailResponses = computed(() => detailDoc.value?.responses ?? []);
157
184
  const detailToolPrompts = computed(() => detailData.value?.tool_prompts ?? []);
158
185
 
159
186
  /** API 编辑表单字段配置。 */
160
- const editFields: ProFormField[] = [
187
+ const editFields = computed<ProFormField[]>(() => [
161
188
  {
162
189
  prop: "tool_name",
163
- label: "工具名",
190
+ label: t("system.base.api.field.tool_name"),
164
191
  component: "input",
165
192
  props: { disabled: true }
166
193
  },
167
194
  {
168
195
  prop: "tool_prompts",
169
- label: "工具提示词",
196
+ label: t("system.base.api.field.tool_prompts"),
170
197
  component: "dynamic-list",
171
- props: { inputProps: { placeholder: "请输入工具提示词" } }
198
+ props: { inputProps: { placeholder: t("system.base.api.placeholder.tool_prompt") } }
172
199
  },
173
200
  {
174
201
  prop: "mcp_status",
175
- label: "MCP工具状态",
202
+ label: t("system.base.api.field.mcp_status"),
176
203
  component: "switch",
177
- props: { activeValue: Status.ENABLE, inactiveValue: Status.DISABLE, activeText: "启用", inactiveText: "禁用" }
204
+ props: {
205
+ activeValue: Status.ENABLE,
206
+ inactiveValue: Status.DISABLE,
207
+ activeText: t("common.status.enabled"),
208
+ inactiveText: t("common.status.disabled")
209
+ }
178
210
  },
179
211
  {
180
212
  prop: "agent_status",
181
- label: "Agent工具状态",
213
+ label: t("system.base.api.field.agent_status"),
182
214
  component: "switch",
183
- props: { activeValue: Status.ENABLE, inactiveValue: Status.DISABLE, activeText: "启用", inactiveText: "禁用" }
215
+ props: {
216
+ activeValue: Status.ENABLE,
217
+ inactiveValue: Status.DISABLE,
218
+ activeText: t("common.status.enabled"),
219
+ inactiveText: t("common.status.disabled")
220
+ }
184
221
  }
185
- ];
222
+ ]);
186
223
 
187
- const statusOptions = [
188
- { label: "启用", value: Status.ENABLE },
189
- { label: "禁用", value: Status.DISABLE }
190
- ];
224
+ const statusOptions = computed(() => [
225
+ { label: t("common.status.enabled"), value: Status.ENABLE },
226
+ { label: t("common.status.disabled"), value: Status.DISABLE }
227
+ ]);
191
228
 
192
229
  /** API 表格列配置。 */
193
- const columns: ColumnProps[] = [
194
- { prop: "tool_name", label: "工具名", minWidth: 260, search: { el: "input" } },
230
+ const columns = computed<ColumnProps[]>(() => [
231
+ { prop: "tool_name", label: t("system.base.api.field.tool_name"), minWidth: 260, search: { el: "input" } },
195
232
  {
196
233
  prop: "tool_prompts",
197
- label: "工具提示词",
234
+ label: t("system.base.api.field.tool_prompts"),
198
235
  minWidth: 240,
199
236
  search: { el: "input", key: "tool_prompt" },
200
237
  render: scope => formatToolPrompts((scope.row as BaseApi).tool_prompts)
201
238
  },
202
- { prop: "service_name", label: "服务名", minWidth: 180, search: { el: "input" } },
203
- { prop: "service_desc", label: "服务描述", minWidth: 180, search: { el: "input" } },
204
- { prop: "desc", label: "描述", minWidth: 180, search: { el: "input" } },
205
- { prop: "operation", label: "操作方法", minWidth: 260, search: { el: "input" } },
206
- { prop: "method", label: "请求方法", width: 110, search: { el: "input" } },
207
- { prop: "path", label: "请求地址", minWidth: 260, search: { el: "input" } },
239
+ { prop: "service_name", label: t("system.base.api.field.service_name"), minWidth: 180, search: { el: "input" } },
240
+ { prop: "service_desc", label: t("system.base.api.field.service_description"), minWidth: 180, search: { el: "input" } },
241
+ { prop: "desc", label: t("system.base.api.field.description"), minWidth: 180, search: { el: "input" } },
242
+ { prop: "operation", label: t("system.base.api.field.operation"), minWidth: 260, search: { el: "input" } },
243
+ { prop: "method", label: t("system.base.api.field.method"), width: 110, search: { el: "input" } },
244
+ { prop: "path", label: t("system.base.api.field.path"), minWidth: 260, search: { el: "input" } },
208
245
  {
209
246
  prop: "mcp_status",
210
- label: "MCP工具状态",
247
+ label: t("system.base.api.field.mcp_status"),
211
248
  width: 120,
212
- enum: statusOptions,
249
+ enum: statusOptions.value,
213
250
  search: { el: "select" },
214
251
  cellType: "status",
215
252
  statusProps: {
216
253
  activeValue: Status.ENABLE,
217
254
  inactiveValue: Status.DISABLE,
218
- activeText: "启用",
219
- inactiveText: "禁用",
255
+ activeText: t("common.status.enabled"),
256
+ inactiveText: t("common.status.disabled"),
220
257
  disabled: () => !BUTTONS.value["base:api:mcp-status"],
221
258
  beforeChange: scope => handleBeforeSetMcpStatus(scope.row as BaseApi)
222
259
  }
223
260
  },
224
261
  {
225
262
  prop: "agent_status",
226
- label: "Agent工具状态",
263
+ label: t("system.base.api.field.agent_status"),
227
264
  width: 130,
228
- enum: statusOptions,
265
+ enum: statusOptions.value,
229
266
  search: { el: "select" },
230
267
  cellType: "status",
231
268
  statusProps: {
232
269
  activeValue: Status.ENABLE,
233
270
  inactiveValue: Status.DISABLE,
234
- activeText: "启用",
235
- inactiveText: "禁用",
271
+ activeText: t("common.status.enabled"),
272
+ inactiveText: t("common.status.disabled"),
236
273
  disabled: () => !BUTTONS.value["base:api:agent-status"],
237
274
  beforeChange: scope => handleBeforeSetAgentStatus(scope.row as BaseApi)
238
275
  }
239
276
  },
240
277
  {
241
278
  prop: "operation",
242
- label: "操作",
279
+ label: t("common.field.action"),
243
280
  width: 210,
244
281
  fixed: "right",
245
282
  cellType: "actions",
246
283
  actions: [
247
284
  {
248
- label: "编辑",
285
+ label: t("common.action.edit"),
249
286
  type: "primary",
250
287
  link: true,
251
288
  icon: EditPen,
@@ -253,7 +290,7 @@ const columns: ColumnProps[] = [
253
290
  onClick: scope => handleOpenEditDialog(scope.row as BaseApi)
254
291
  },
255
292
  {
256
- label: "详情",
293
+ label: t("common.action.view"),
257
294
  type: "primary",
258
295
  link: true,
259
296
  icon: View,
@@ -262,7 +299,7 @@ const columns: ColumnProps[] = [
262
299
  }
263
300
  ]
264
301
  }
265
- ];
302
+ ]);
266
303
 
267
304
  /**
268
305
  * 请求 API 分页列表,并由 ProTable 统一维护分页与搜索参数。
@@ -337,7 +374,7 @@ async function handleSubmitEdit() {
337
374
  mcp_status: editForm.mcp_status,
338
375
  agent_status: editForm.agent_status
339
376
  });
340
- ElMessage.success("保存成功");
377
+ ElMessage.success(t("system.base.api.message.save_success"));
341
378
  handleCloseEditDialog();
342
379
  refreshTable();
343
380
  }
@@ -347,16 +384,16 @@ async function handleSubmitEdit() {
347
384
  */
348
385
  async function handleBeforeSetMcpStatus(row: BaseApi) {
349
386
  const nextStatus = row.mcp_status === Status.ENABLE ? Status.DISABLE : Status.ENABLE;
350
- const text = nextStatus === Status.ENABLE ? "启用" : "禁用";
387
+ const action = t(nextStatus === Status.ENABLE ? "common.status.enabled" : "common.status.disabled");
351
388
  const apiName = row.desc || row.operation || `ID:${row.id}`;
352
389
  try {
353
- await ElMessageBox.confirm(`是否确定${text}该 API 的 MCP 工具能力?\nAPI:${apiName}`, "提示", {
354
- confirmButtonText: "确认",
355
- cancelButtonText: "取消",
390
+ await ElMessageBox.confirm(t("system.base.api.message.confirm_mcp_status", { action, api: apiName }), t("common.title.notice"), {
391
+ confirmButtonText: t("common.action.confirm"),
392
+ cancelButtonText: t("common.action.cancel"),
356
393
  type: "warning"
357
394
  });
358
395
  await defBaseApiService.SetBaseApiMcpStatus({ id: row.id, mcp_status: nextStatus });
359
- ElMessage.success(`${text}成功`);
396
+ ElMessage.success(t("common.message.status_success", { action }));
360
397
  refreshTable();
361
398
  return true;
362
399
  } catch {
@@ -369,16 +406,16 @@ async function handleBeforeSetMcpStatus(row: BaseApi) {
369
406
  */
370
407
  async function handleBeforeSetAgentStatus(row: BaseApi) {
371
408
  const nextStatus = row.agent_status === Status.ENABLE ? Status.DISABLE : Status.ENABLE;
372
- const text = nextStatus === Status.ENABLE ? "启用" : "禁用";
409
+ const action = t(nextStatus === Status.ENABLE ? "common.status.enabled" : "common.status.disabled");
373
410
  const apiName = row.desc || row.operation || `ID:${row.id}`;
374
411
  try {
375
- await ElMessageBox.confirm(`是否确定${text}该 API 的 Agent 工具能力?\nAPI:${apiName}`, "提示", {
376
- confirmButtonText: "确认",
377
- cancelButtonText: "取消",
412
+ await ElMessageBox.confirm(t("system.base.api.message.confirm_agent_status", { action, api: apiName }), t("common.title.notice"), {
413
+ confirmButtonText: t("common.action.confirm"),
414
+ cancelButtonText: t("common.action.cancel"),
378
415
  type: "warning"
379
416
  });
380
417
  await defBaseApiService.SetBaseApiAgentStatus({ id: row.id, agent_status: nextStatus });
381
- ElMessage.success(`${text}成功`);
418
+ ElMessage.success(t("common.message.status_success", { action }));
382
419
  refreshTable();
383
420
  return true;
384
421
  } catch {
@@ -391,16 +428,16 @@ async function handleBeforeSetAgentStatus(row: BaseApi) {
391
428
  */
392
429
  function formatToolPrompts(prompts: string[]) {
393
430
  if (!prompts?.length) return "--";
394
- return prompts.filter(Boolean).join(";");
431
+ return prompts.filter(Boolean).join(", ");
395
432
  }
396
433
 
397
434
  /**
398
435
  * 格式化 API 工具状态。
399
436
  */
400
437
  function formatStatus(status: Status) {
401
- if (status === Status.ENABLE) return "启用";
402
- if (status === Status.DISABLE) return "禁用";
403
- return "未知";
438
+ if (status === Status.ENABLE) return t("common.status.enabled");
439
+ if (status === Status.DISABLE) return t("common.status.disabled");
440
+ return t("common.value.unknown");
404
441
  }
405
442
 
406
443
  /**
@@ -17,12 +17,11 @@
17
17
  <FormDialog
18
18
  v-model="dialog.visible"
19
19
  ref="formDialogRef"
20
- :title="dialog.title"
20
+ :title="t(dialog.titleKey)"
21
21
  width="640px"
22
22
  :model="formData"
23
23
  :fields="formFields"
24
24
  :rules="rules"
25
- label-width="100px"
26
25
  @confirm="handleSubmit"
27
26
  @close="handleCloseDialog"
28
27
  />
@@ -44,6 +43,7 @@ import { defBaseAreaService } from "@liujitcn/kratos-admin-system/api/system/bas
44
43
  import type { TreeBaseAreaRequest, BaseArea, BaseAreaForm } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_area";
45
44
 
46
45
  import { normalizeSelectedIds } from "@liujitcn/kratos-admin-core/table";
46
+ import { t } from "@liujitcn/kratos-admin-core";
47
47
 
48
48
  defineOptions({
49
49
  name: "BaseArea",
@@ -55,7 +55,7 @@ const proTable = ref<ProTableInstance>();
55
55
  const formDialogRef = ref<InstanceType<typeof FormDialog>>();
56
56
 
57
57
  const dialog = reactive({
58
- title: "",
58
+ titleKey: "system.base.area.action.create",
59
59
  visible: false
60
60
  });
61
61
 
@@ -65,10 +65,27 @@ const formData = reactive<BaseAreaForm>({
65
65
  name: ""
66
66
  });
67
67
 
68
- const rules = reactive<FormRules>({
69
- parent_id: [{ required: true, message: "父级区域不能为空", trigger: "change" }],
70
- name: [{ required: true, message: "区域名称不能为空", trigger: "blur" }, { max: 50, message: "区域名称不能超过 50 个字符", trigger: "blur" }]
71
- });
68
+ const rules = computed<FormRules>(() => ({
69
+ parent_id: [
70
+ {
71
+ required: true,
72
+ message: t("common.validation.required_select", { field: t("system.base.area.field.parent") }),
73
+ trigger: "change"
74
+ }
75
+ ],
76
+ name: [
77
+ {
78
+ required: true,
79
+ message: t("common.validation.required_input", { field: t("system.base.area.field.name") }),
80
+ trigger: "blur"
81
+ },
82
+ {
83
+ max: 50,
84
+ message: t("common.validation.max_length", { field: t("system.base.area.field.name"), max: 50 }),
85
+ trigger: "blur"
86
+ }
87
+ ]
88
+ }));
72
89
  const parentIdFormOptions = ref<ProFormOption[]>([]);
73
90
 
74
91
  type GeneratedTreeOption = ProFormOption & {
@@ -85,34 +102,55 @@ function normalizeLazyTreeOptions(options: GeneratedTreeOption[] = []): ProFormO
85
102
  }
86
103
 
87
104
  /** 懒加载parentIdForm树形选项的子节点。 */
88
- async function loadParentIdFormTreeOptions(node: { level: number; value?: string | number; data?: { value?: string | number } }, resolve: (data: ProFormOption[]) => void) {
105
+ async function loadParentIdFormTreeOptions(
106
+ node: { level: number; value?: string | number; data?: { value?: string | number } },
107
+ resolve: (data: ProFormOption[]) => void
108
+ ) {
89
109
  const parentId = node.level === 0 ? 0 : Number(node.data?.value ?? node.value ?? 0);
90
- const response = await defBaseAreaService.OptionBaseArea({ "parent_id": parentId, lazy: true } as Parameters<typeof defBaseAreaService.OptionBaseArea>[0]);
110
+ const response = await defBaseAreaService.OptionBaseArea({ parent_id: parentId, lazy: true } as Parameters<
111
+ typeof defBaseAreaService.OptionBaseArea
112
+ >[0]);
91
113
  resolve(normalizeLazyTreeOptions((response.list ?? []) as GeneratedTreeOption[]));
92
114
  }
93
115
 
94
-
95
116
  void loadFormOptions();
96
117
 
97
118
  /** 行政区域表单字段配置。 */
98
119
  const formFields = computed<ProFormField[]>(() => [
99
- { prop: "parent_id", label: "父级区域", component: "tree-select", options: parentIdFormOptions.value, props: { lazy: true, load: loadParentIdFormTreeOptions, placeholder: "请选择", filterable: true, style: { width: "100%" } } },
100
- { prop: "name", label: "区域名称", component: "input", props: { placeholder: "请输入区域名称" } }
120
+ {
121
+ prop: "parent_id",
122
+ label: t("system.base.area.field.parent"),
123
+ component: "tree-select",
124
+ options: parentIdFormOptions.value,
125
+ props: {
126
+ lazy: true,
127
+ load: loadParentIdFormTreeOptions,
128
+ placeholder: t("common.placeholder.select"),
129
+ filterable: true,
130
+ style: { width: "100%" }
131
+ }
132
+ },
133
+ {
134
+ prop: "name",
135
+ label: t("system.base.area.field.name"),
136
+ component: "input",
137
+ props: { placeholder: t("common.validation.required_input", { field: t("system.base.area.field.name") }) }
138
+ }
101
139
  ]);
102
140
 
103
141
  /** 行政区域表格列配置。 */
104
142
  const columns = computed<ColumnProps[]>(() => [
105
143
  { type: "selection", width: 55 },
106
- { prop: "name", label: "区域名称", align: "left", search: { el: "input" } },
144
+ { prop: "name", label: t("system.base.area.field.name"), align: "left", search: { el: "input" } },
107
145
  {
108
146
  prop: "operation",
109
- label: "操作",
147
+ label: t("common.field.operation"),
110
148
  width: 150,
111
149
  fixed: "right",
112
150
  cellType: "actions",
113
151
  actions: [
114
152
  {
115
- label: "编辑",
153
+ label: t("common.action.edit"),
116
154
  type: "primary",
117
155
  link: true,
118
156
  icon: EditPen,
@@ -120,7 +158,7 @@ const columns = computed<ColumnProps[]>(() => [
120
158
  onClick: scope => handleOpenDialog((scope.row as BaseArea).id)
121
159
  },
122
160
  {
123
- label: "删除",
161
+ label: t("common.action.delete"),
124
162
  type: "danger",
125
163
  link: true,
126
164
  icon: Delete,
@@ -132,23 +170,23 @@ const columns = computed<ColumnProps[]>(() => [
132
170
  ]);
133
171
 
134
172
  /** 行政区域顶部按钮配置。 */
135
- const headerActions: HeaderActionProps[] = [
173
+ const headerActions = computed<HeaderActionProps[]>(() => [
136
174
  {
137
- label: "新增",
175
+ label: t("common.action.create"),
138
176
  type: "success",
139
177
  icon: CirclePlus,
140
178
  hidden: () => !BUTTONS.value["base:area:create"],
141
179
  onClick: () => handleOpenDialog()
142
180
  },
143
181
  {
144
- label: "删除",
182
+ label: t("common.action.delete"),
145
183
  type: "danger",
146
184
  icon: Delete,
147
185
  hidden: () => !BUTTONS.value["base:area:delete"],
148
186
  disabled: scope => !scope.selectedList.length,
149
187
  onClick: scope => handleDelete(scope.selectedList as BaseArea[])
150
188
  }
151
- ];
189
+ ]);
152
190
 
153
191
  /**
154
192
  * 请求行政区域列表,并适配 ProTable 固定列表字段。
@@ -166,7 +204,7 @@ async function loadAreaChildren(row: BaseArea, _treeNode: unknown, resolve: (dat
166
204
  const data = await defBaseAreaService.TreeBaseArea({ parent_id: row.id, lazy: true });
167
205
  resolve(data.base_areas ?? []);
168
206
  } catch {
169
- ElMessage.error("加载行政区域子节点失败");
207
+ ElMessage.error(t("common.message.load_children_failed", { resource: t("system.base.area.resource") }));
170
208
  resolve([]);
171
209
  }
172
210
  }
@@ -179,8 +217,15 @@ function refreshTable() {
179
217
  }
180
218
  /** 加载表单选择项。 */
181
219
  async function loadFormOptions() {
182
- const parentIdFormResponse = await defBaseAreaService.OptionBaseArea({ "parent_id": 0, lazy: true } as Parameters<typeof defBaseAreaService.OptionBaseArea>[0]);
183
- parentIdFormOptions.value = [{ label: "顶级节点", value: 0 }, ...normalizeLazyTreeOptions((parentIdFormResponse.list ?? []) as GeneratedTreeOption[]).filter(option => Number(option.value) !== 0)];
220
+ const parentIdFormResponse = await defBaseAreaService.OptionBaseArea({ parent_id: 0, lazy: true } as Parameters<
221
+ typeof defBaseAreaService.OptionBaseArea
222
+ >[0]);
223
+ parentIdFormOptions.value = [
224
+ { label: t("system.base.area.value.root"), value: 0 },
225
+ ...normalizeLazyTreeOptions((parentIdFormResponse.list ?? []) as GeneratedTreeOption[]).filter(
226
+ option => Number(option.value) !== 0
227
+ )
228
+ ];
184
229
  }
185
230
 
186
231
  /**
@@ -189,7 +234,7 @@ async function loadFormOptions() {
189
234
  async function handleOpenDialog(id?: number) {
190
235
  resetForm();
191
236
  await loadFormOptions();
192
- dialog.title = id ? "修改行政区域" : "新增行政区域";
237
+ dialog.titleKey = id ? "system.base.area.action.edit" : "system.base.area.action.create";
193
238
  dialog.visible = true;
194
239
  if (!id) return;
195
240
 
@@ -225,7 +270,11 @@ function handleSubmit() {
225
270
  ? defBaseAreaService.UpdateBaseArea({ id: payload.id, base_area: payload })
226
271
  : defBaseAreaService.CreateBaseArea({ base_area: payload });
227
272
  request.then(() => {
228
- ElMessage.success(payload.id ? "修改行政区域成功" : "新增行政区域成功");
273
+ ElMessage.success(
274
+ t(payload.id ? "common.message.update_success" : "common.message.create_success", {
275
+ resource: t("system.base.area.resource")
276
+ })
277
+ );
229
278
  handleCloseDialog();
230
279
  refreshTable();
231
280
  });
@@ -245,24 +294,24 @@ function handleDelete(selected?: number | string | Array<number | string> | Base
245
294
  rowList.length ? rowList.map(item => item.id) : normalizeSelectedIds(selected as number | string | Array<number | string>)
246
295
  ).join(",");
247
296
  if (!ids) {
248
- ElMessage.warning("请勾选删除项");
297
+ ElMessage.warning(t("common.message.select_delete_item"));
249
298
  return;
250
299
  }
251
300
 
252
- const confirmMessage = rowList.length === 1 ? "是否确定删除行政区域?" : "确认删除已选中的行政区域吗?";
253
- ElMessageBox.confirm(confirmMessage, "警告", {
254
- confirmButtonText: "确定",
255
- cancelButtonText: "取消",
301
+ const confirmMessage = t(rowList.length === 1 ? "system.base.area.message.delete_single" : "system.base.area.message.delete_batch");
302
+ ElMessageBox.confirm(confirmMessage, t("common.title.warning"), {
303
+ confirmButtonText: t("common.action.confirm"),
304
+ cancelButtonText: t("common.action.cancel"),
256
305
  type: "warning"
257
306
  }).then(
258
307
  () => {
259
308
  defBaseAreaService.DeleteBaseArea({ ids }).then(() => {
260
- ElMessage.success("删除行政区域成功");
309
+ ElMessage.success(t("common.message.delete_success", { resource: t("system.base.area.resource") }));
261
310
  refreshTable();
262
311
  });
263
312
  },
264
313
  () => {
265
- ElMessage.info("已取消删除行政区域");
314
+ ElMessage.info(t("common.dialog.cancel_delete", { resource: t("system.base.area.resource") }));
266
315
  }
267
316
  );
268
317
  }