@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.
- package/README.md +51 -50
- package/dist/package/declarations/src/api/system/base_language.d.ts +52 -0
- package/dist/package/declarations/src/api/system/base_translation.d.ts +10 -0
- package/dist/package/declarations/src/api/system/code_gen_i18n.d.ts +8 -0
- package/dist/package/declarations/src/api/system/ops_monitoring.d.ts +19 -0
- package/dist/package/declarations/src/api/system/ops_monitoring_sse.d.ts +12 -0
- package/dist/package/declarations/src/components/DynamicTranslationCell.vue.d.ts +16 -0
- package/dist/package/declarations/src/components/DynamicTranslationEditor.vue.d.ts +20 -0
- package/dist/package/declarations/src/components/dynamicTranslation.d.ts +38 -0
- package/dist/package/declarations/src/locales/generated.d.ts +6536 -0
- package/dist/package/declarations/src/rpc/base/v1/ai_session.d.ts +12 -2
- package/dist/package/declarations/src/rpc/base/v1/ai_tool.d.ts +9 -1
- package/dist/package/declarations/src/rpc/base/v1/config.d.ts +35 -0
- package/dist/package/declarations/src/rpc/system/admin/v1/auth.d.ts +1 -1
- package/dist/package/declarations/src/rpc/system/admin/v1/base_config.d.ts +23 -2
- package/dist/package/declarations/src/rpc/system/admin/v1/base_dict.d.ts +9 -0
- package/dist/package/declarations/src/rpc/system/admin/v1/base_job.d.ts +9 -1
- package/dist/package/declarations/src/rpc/system/admin/v1/base_language.d.ts +119 -0
- package/dist/package/declarations/src/rpc/system/admin/v1/base_menu.d.ts +6 -1
- package/dist/package/declarations/src/rpc/system/admin/v1/base_migration.d.ts +6 -6
- package/dist/package/declarations/src/rpc/system/admin/v1/base_role.d.ts +13 -1
- package/dist/package/declarations/src/rpc/system/admin/v1/base_translation.d.ts +75 -0
- package/dist/package/declarations/src/rpc/system/admin/v1/base_user.d.ts +11 -1
- package/dist/package/declarations/src/rpc/system/admin/v1/code_gen.d.ts +13 -11
- 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 +24 -1
- package/dist/package/declarations/src/rpc/system/admin/v1/common.d.ts +13 -0
- package/dist/package/declarations/src/rpc/system/admin/v1/ops_monitoring.d.ts +222 -0
- package/dist/package/declarations/src/views/base/language/index.vue.d.ts +3 -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/ops-monitoring/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 +135 -0
- package/dist/package/src/api/system/base_translation.ts +33 -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/api/system/ops_monitoring.ts +88 -0
- package/dist/package/src/api/system/ops_monitoring_sse.ts +49 -0
- package/dist/package/src/components/DynamicTranslationCell.vue +249 -0
- package/dist/package/src/components/DynamicTranslationEditor.vue +197 -0
- package/dist/package/src/components/dynamicTranslation.ts +66 -0
- package/dist/package/src/locales/README.md +30 -0
- package/dist/package/src/locales/en-US.json +933 -0
- package/dist/package/src/locales/es-ES.json +933 -0
- package/dist/package/src/locales/fr-FR.json +933 -0
- package/dist/package/src/locales/generated.ts +22 -0
- package/dist/package/src/locales/ja-JP.json +933 -0
- package/dist/package/src/locales/ko-KR.json +933 -0
- package/dist/package/src/locales/zh-CN.json +933 -0
- package/dist/package/src/locales/zh-TW.json +933 -0
- package/dist/package/src/module.ts +6 -2
- package/dist/package/src/rpc/base/v1/ai_session.ts +13 -2
- package/dist/package/src/rpc/base/v1/ai_tool.ts +10 -1
- package/dist/package/src/rpc/base/v1/config.ts +47 -0
- package/dist/package/src/rpc/system/admin/v1/auth.ts +1 -1
- package/dist/package/src/rpc/system/admin/v1/base_config.ts +24 -2
- package/dist/package/src/rpc/system/admin/v1/base_dict.ts +9 -0
- package/dist/package/src/rpc/system/admin/v1/base_job.ts +10 -1
- package/dist/package/src/rpc/system/admin/v1/base_language.ts +141 -0
- package/dist/package/src/rpc/system/admin/v1/base_menu.ts +6 -1
- package/dist/package/src/rpc/system/admin/v1/base_migration.ts +8 -8
- package/dist/package/src/rpc/system/admin/v1/base_role.ts +14 -1
- package/dist/package/src/rpc/system/admin/v1/base_translation.ts +90 -0
- package/dist/package/src/rpc/system/admin/v1/base_user.ts +12 -1
- package/dist/package/src/rpc/system/admin/v1/code_gen.ts +16 -12
- 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 +27 -1
- package/dist/package/src/rpc/system/admin/v1/common.ts +21 -0
- package/dist/package/src/rpc/system/admin/v1/ops_monitoring.ts +255 -0
- package/dist/package/src/views/ai/chat/components/AiMarkdown.vue +1 -6
- package/dist/package/src/views/ai/chat/components/ChatPanel.vue +75 -58
- 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 +58 -41
- package/dist/package/src/views/ai/chat/message.ts +29 -27
- package/dist/package/src/views/base/api/index.vue +121 -84
- package/dist/package/src/views/base/area/index.vue +81 -32
- package/dist/package/src/views/base/config/index.vue +300 -96
- package/dist/package/src/views/base/dept/index.vue +110 -62
- package/dist/package/src/views/base/dict/index.vue +145 -62
- package/dist/package/src/views/base/dict/item.vue +155 -64
- package/dist/package/src/views/base/job/index.vue +134 -82
- package/dist/package/src/views/base/job/log.vue +24 -25
- package/dist/package/src/views/base/language/index.vue +260 -0
- package/dist/package/src/views/base/log/index.vue +68 -46
- package/dist/package/src/views/base/menu/index.vue +344 -200
- package/dist/package/src/views/base/migration/index.vue +49 -29
- package/dist/package/src/views/base/post/index.vue +128 -60
- package/dist/package/src/views/base/role/index.vue +145 -79
- package/dist/package/src/views/base/tenant/index.vue +132 -64
- package/dist/package/src/views/base/user/components/dept-tree.vue +2 -1
- package/dist/package/src/views/base/user/index.vue +194 -116
- package/dist/package/src/views/profile/components/base.vue +45 -28
- package/dist/package/src/views/profile/components/password.vue +45 -30
- package/dist/package/src/views/profile/components/security.vue +90 -54
- 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 +32 -16
- 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 +116 -79
- 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 -59
- package/dist/package/src/views/tool/code-gen/proto/index.vue +110 -62
- package/dist/package/src/views/tool/code-gen/table/index.vue +201 -121
- package/dist/package/src/views/tool/ops-monitoring/index.vue +1175 -0
- package/dist/package/src/views/tool/project-doc/index.vue +17 -15
- package/package.json +6 -2
- package/dist/package/declarations/src/rpc/base/v1/enum.d.ts +0 -43
- package/dist/package/declarations/src/rpc/system/common/v1/enum.d.ts +0 -67
- package/dist/package/src/rpc/base/v1/enum.ts +0 -54
- package/dist/package/src/rpc/system/common/v1/enum.ts +0 -80
|
@@ -3,26 +3,41 @@
|
|
|
3
3
|
<div v-loading="loading" class="table-box migration-page">
|
|
4
4
|
<main class="migration-content">
|
|
5
5
|
<el-form class="migration-filters" :model="filters" inline @submit.prevent="handleSearch">
|
|
6
|
-
<el-form-item label="
|
|
7
|
-
<el-input
|
|
6
|
+
<el-form-item :label="t('system.base.migration.field.module')">
|
|
7
|
+
<el-input
|
|
8
|
+
v-model="filters.module"
|
|
9
|
+
clearable
|
|
10
|
+
:placeholder="t('system.base.migration.placeholder.module')"
|
|
11
|
+
@keyup.enter="handleSearch"
|
|
12
|
+
/>
|
|
8
13
|
</el-form-item>
|
|
9
|
-
<el-form-item label="
|
|
10
|
-
<el-input
|
|
14
|
+
<el-form-item :label="t('system.base.migration.field.data_source')">
|
|
15
|
+
<el-input
|
|
16
|
+
v-model="filters.data_source"
|
|
17
|
+
clearable
|
|
18
|
+
:placeholder="t('system.base.migration.placeholder.data_source')"
|
|
19
|
+
@keyup.enter="handleSearch"
|
|
20
|
+
/>
|
|
11
21
|
</el-form-item>
|
|
12
|
-
<el-form-item label="
|
|
13
|
-
<el-input
|
|
22
|
+
<el-form-item :label="t('system.base.migration.field.version')">
|
|
23
|
+
<el-input
|
|
24
|
+
v-model="filters.version"
|
|
25
|
+
clearable
|
|
26
|
+
:placeholder="t('system.base.migration.placeholder.version')"
|
|
27
|
+
@keyup.enter="handleSearch"
|
|
28
|
+
/>
|
|
14
29
|
</el-form-item>
|
|
15
30
|
<el-form-item class="migration-filters__actions">
|
|
16
|
-
<el-button type="primary" :icon="Search" native-type="submit"
|
|
17
|
-
<el-button :icon="Refresh" @click="handleReset"
|
|
31
|
+
<el-button type="primary" :icon="Search" native-type="submit">{{ t("common.action.search") }}</el-button>
|
|
32
|
+
<el-button :icon="Refresh" @click="handleReset">{{ t("common.action.reset") }}</el-button>
|
|
18
33
|
</el-form-item>
|
|
19
34
|
</el-form>
|
|
20
35
|
|
|
21
|
-
<el-empty v-if="!loading && !histories.length" description="
|
|
36
|
+
<el-empty v-if="!loading && !histories.length" :description="t('system.base.migration.message.empty_history')" />
|
|
22
37
|
|
|
23
|
-
<section v-else class="migration-workspace" aria-label="
|
|
38
|
+
<section v-else class="migration-workspace" :aria-label="t('system.base.migration.title.history')">
|
|
24
39
|
<aside class="migration-list-panel">
|
|
25
|
-
<div class="migration-list-scroll" role="listbox" aria-label="
|
|
40
|
+
<div class="migration-list-scroll" role="listbox" :aria-label="t('system.base.migration.title.list')">
|
|
26
41
|
<button
|
|
27
42
|
v-for="history in histories"
|
|
28
43
|
:key="history.id"
|
|
@@ -36,14 +51,14 @@
|
|
|
36
51
|
<strong>{{ history.version }}</strong>
|
|
37
52
|
</div>
|
|
38
53
|
<div class="migration-list-item__data-source">
|
|
39
|
-
{{ history.module || "
|
|
54
|
+
{{ history.module || t("system.base.migration.value.default_module") }} · {{ history.data_source || "default" }}
|
|
40
55
|
</div>
|
|
41
56
|
<time :datetime="history.created_at">{{ formatDate(history.created_at) }}</time>
|
|
42
57
|
</button>
|
|
43
58
|
</div>
|
|
44
59
|
|
|
45
60
|
<div v-if="pageable.total > pageable.page_size" class="migration-pagination">
|
|
46
|
-
<span class="migration-pagination__total"
|
|
61
|
+
<span class="migration-pagination__total">{{ t("system.base.migration.message.total", { total: pageable.total }) }}</span>
|
|
47
62
|
<el-pagination
|
|
48
63
|
background
|
|
49
64
|
small
|
|
@@ -65,7 +80,8 @@
|
|
|
65
80
|
<header class="detail-header">
|
|
66
81
|
<div class="detail-header__title">
|
|
67
82
|
<span class="detail-header__data-source">
|
|
68
|
-
{{ selectedMigration.module || "
|
|
83
|
+
{{ selectedMigration.module || t("system.base.migration.value.default_module") }} ·
|
|
84
|
+
{{ selectedMigration.data_source || "default" }}
|
|
69
85
|
</span>
|
|
70
86
|
<div class="detail-header__version">
|
|
71
87
|
<h2>{{ selectedMigration.version }}</h2>
|
|
@@ -81,7 +97,7 @@
|
|
|
81
97
|
<section v-if="selectedMigration.description" class="detail-section">
|
|
82
98
|
<div class="detail-section__title">
|
|
83
99
|
<el-icon><Document /></el-icon>
|
|
84
|
-
<span
|
|
100
|
+
<span>{{ t("system.base.migration.section.description") }}</span>
|
|
85
101
|
</div>
|
|
86
102
|
<MarkdownPreview
|
|
87
103
|
class="migration-markdown"
|
|
@@ -94,26 +110,26 @@
|
|
|
94
110
|
<section v-if="selectedMigration.up_sql || selectedMigration.down_sql" class="detail-section">
|
|
95
111
|
<div class="detail-section__title">
|
|
96
112
|
<el-icon><Files /></el-icon>
|
|
97
|
-
<span>
|
|
113
|
+
<span>{{ t("system.base.migration.section.sql") }}</span>
|
|
98
114
|
</div>
|
|
99
115
|
<el-collapse class="release-sql">
|
|
100
116
|
<el-collapse-item v-if="selectedMigration.up_sql" name="up">
|
|
101
117
|
<template #title>
|
|
102
118
|
<span class="sql-title">
|
|
103
119
|
<el-icon><DocumentAdd /></el-icon>
|
|
104
|
-
<span
|
|
120
|
+
<span>{{ t("system.base.migration.field.up_script") }}</span>
|
|
105
121
|
<code>up.sql</code>
|
|
106
122
|
</span>
|
|
107
123
|
</template>
|
|
108
124
|
<div class="sql-panel">
|
|
109
125
|
<pre class="sql-code"><code>{{ selectedMigration.up_sql }}</code></pre>
|
|
110
|
-
<el-tooltip content="
|
|
126
|
+
<el-tooltip :content="t('system.base.migration.action.copy_up_script')" placement="top">
|
|
111
127
|
<el-button
|
|
112
128
|
class="sql-copy"
|
|
113
129
|
text
|
|
114
130
|
circle
|
|
115
131
|
:icon="CopyDocument"
|
|
116
|
-
aria-label="
|
|
132
|
+
:aria-label="t('system.base.migration.action.copy_up_script')"
|
|
117
133
|
@click.stop="copySql(selectedMigration.up_sql)"
|
|
118
134
|
/>
|
|
119
135
|
</el-tooltip>
|
|
@@ -123,19 +139,19 @@
|
|
|
123
139
|
<template #title>
|
|
124
140
|
<span class="sql-title">
|
|
125
141
|
<el-icon><DocumentRemove /></el-icon>
|
|
126
|
-
<span
|
|
142
|
+
<span>{{ t("system.base.migration.field.down_script") }}</span>
|
|
127
143
|
<code>down.sql</code>
|
|
128
144
|
</span>
|
|
129
145
|
</template>
|
|
130
146
|
<div class="sql-panel">
|
|
131
147
|
<pre class="sql-code"><code>{{ selectedMigration.down_sql }}</code></pre>
|
|
132
|
-
<el-tooltip content="
|
|
148
|
+
<el-tooltip :content="t('system.base.migration.action.copy_down_script')" placement="top">
|
|
133
149
|
<el-button
|
|
134
150
|
class="sql-copy"
|
|
135
151
|
text
|
|
136
152
|
circle
|
|
137
153
|
:icon="CopyDocument"
|
|
138
|
-
aria-label="
|
|
154
|
+
:aria-label="t('system.base.migration.action.copy_down_script')"
|
|
139
155
|
@click.stop="copySql(selectedMigration.down_sql)"
|
|
140
156
|
/>
|
|
141
157
|
</el-tooltip>
|
|
@@ -146,15 +162,14 @@
|
|
|
146
162
|
|
|
147
163
|
<div v-if="!hasDetailContent" class="detail-empty">
|
|
148
164
|
<el-icon><Document /></el-icon>
|
|
149
|
-
<span
|
|
165
|
+
<span>{{ t("system.base.migration.message.empty_detail") }}</span>
|
|
150
166
|
</div>
|
|
151
167
|
</template>
|
|
152
168
|
</div>
|
|
153
169
|
</template>
|
|
154
|
-
<el-empty v-else description="
|
|
170
|
+
<el-empty v-else :description="t('system.base.migration.message.select_record')" />
|
|
155
171
|
</section>
|
|
156
172
|
</section>
|
|
157
|
-
|
|
158
173
|
</main>
|
|
159
174
|
</div>
|
|
160
175
|
</template>
|
|
@@ -166,7 +181,12 @@ import MarkdownPreview from "@liujitcn/kratos-admin-core/components/MarkdownPrev
|
|
|
166
181
|
import { useGlobalStore } from "@liujitcn/kratos-admin-core/stores/runtime";
|
|
167
182
|
import { buildPageRequest } from "@liujitcn/kratos-admin-core/table";
|
|
168
183
|
import { defBaseMigrationService } from "@liujitcn/kratos-admin-system/api/system/base_migration";
|
|
169
|
-
import type {
|
|
184
|
+
import type {
|
|
185
|
+
BaseMigration,
|
|
186
|
+
BaseMigrationListItem,
|
|
187
|
+
PageBaseMigrationRequest
|
|
188
|
+
} from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_migration";
|
|
189
|
+
import { getCurrentLocale, t } from "@liujitcn/kratos-admin-core";
|
|
170
190
|
|
|
171
191
|
defineOptions({
|
|
172
192
|
name: "BaseMigration",
|
|
@@ -296,9 +316,9 @@ function handleCurrentPageChange(page: number) {
|
|
|
296
316
|
async function copySql(sql: string) {
|
|
297
317
|
try {
|
|
298
318
|
await navigator.clipboard.writeText(sql);
|
|
299
|
-
ElMessage.success("
|
|
319
|
+
ElMessage.success(t("system.base.migration.message.copy_success"));
|
|
300
320
|
} catch {
|
|
301
|
-
ElMessage.error("
|
|
321
|
+
ElMessage.error(t("system.base.migration.message.copy_failed"));
|
|
302
322
|
}
|
|
303
323
|
}
|
|
304
324
|
|
|
@@ -309,7 +329,7 @@ function formatDate(value: string) {
|
|
|
309
329
|
if (!value) return "--";
|
|
310
330
|
const date = new Date(value.replace(" ", "T"));
|
|
311
331
|
if (Number.isNaN(date.getTime())) return value;
|
|
312
|
-
return new Intl.DateTimeFormat(
|
|
332
|
+
return new Intl.DateTimeFormat(getCurrentLocale(), {
|
|
313
333
|
year: "numeric",
|
|
314
334
|
month: "short",
|
|
315
335
|
day: "numeric"
|
|
@@ -12,12 +12,11 @@
|
|
|
12
12
|
<FormDialog
|
|
13
13
|
v-model="dialog.visible"
|
|
14
14
|
ref="formDialogRef"
|
|
15
|
-
:title="dialog.
|
|
15
|
+
:title="t(dialog.titleKey, { resource: t('system.base.post.resource') })"
|
|
16
16
|
width="560px"
|
|
17
17
|
:model="formData"
|
|
18
18
|
:fields="formFields"
|
|
19
19
|
:rules="rules"
|
|
20
|
-
label-width="90px"
|
|
21
20
|
@confirm="handleSubmit"
|
|
22
21
|
@close="handleCloseDialog"
|
|
23
22
|
/>
|
|
@@ -41,6 +40,7 @@ import { Status } from "@liujitcn/kratos-admin-system/rpc/common/v1/enum";
|
|
|
41
40
|
import { buildPageRequest, normalizeSelectedIds } from "@liujitcn/kratos-admin-core/table";
|
|
42
41
|
import { DEFAULT_TENANT_CODE, requestTenantOptions } from "@liujitcn/kratos-admin-core/tenant";
|
|
43
42
|
import { useUserStore } from "@liujitcn/kratos-admin-core/stores/runtime";
|
|
43
|
+
import { t } from "@liujitcn/kratos-admin-core";
|
|
44
44
|
|
|
45
45
|
defineOptions({
|
|
46
46
|
name: "BasePost",
|
|
@@ -59,14 +59,14 @@ const proTable = ref<ProTableInstance>();
|
|
|
59
59
|
const formDialogRef = ref<InstanceType<typeof FormDialog>>();
|
|
60
60
|
|
|
61
61
|
const dialog = reactive({
|
|
62
|
-
|
|
62
|
+
titleKey: "common.action.create_resource",
|
|
63
63
|
visible: false
|
|
64
64
|
});
|
|
65
65
|
const tenantOptions = ref<SelectOptionResponse_Option[]>([]);
|
|
66
|
-
const statusOptions
|
|
67
|
-
{ label: "
|
|
68
|
-
{ label: "
|
|
69
|
-
];
|
|
66
|
+
const statusOptions = computed<ProFormOption[]>(() => [
|
|
67
|
+
{ label: t("common.status.enabled"), value: Status.ENABLE },
|
|
68
|
+
{ label: t("common.status.disabled"), value: Status.DISABLE }
|
|
69
|
+
]);
|
|
70
70
|
const formData = reactive<BasePostFormState>({
|
|
71
71
|
/** 岗位ID。 */
|
|
72
72
|
id: 0,
|
|
@@ -83,20 +83,54 @@ const formData = reactive<BasePostFormState>({
|
|
|
83
83
|
/** 备注。 */
|
|
84
84
|
remark: ""
|
|
85
85
|
});
|
|
86
|
-
const rules =
|
|
87
|
-
tenant_id: [
|
|
86
|
+
const rules = computed(() => ({
|
|
87
|
+
tenant_id: [
|
|
88
|
+
{
|
|
89
|
+
required: true,
|
|
90
|
+
message: t("common.validation.required_select", { field: t("common.field.tenant") }),
|
|
91
|
+
trigger: "change"
|
|
92
|
+
}
|
|
93
|
+
],
|
|
88
94
|
name: [
|
|
89
|
-
{
|
|
90
|
-
|
|
95
|
+
{
|
|
96
|
+
required: true,
|
|
97
|
+
message: t("common.validation.required_input", { field: t("system.base.post.field.name") }),
|
|
98
|
+
trigger: "blur"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
max: 30,
|
|
102
|
+
message: t("common.validation.max_length", { field: t("system.base.post.field.name"), max: 30 }),
|
|
103
|
+
trigger: "blur"
|
|
104
|
+
}
|
|
91
105
|
],
|
|
92
106
|
code: [
|
|
93
|
-
{
|
|
94
|
-
|
|
107
|
+
{
|
|
108
|
+
required: true,
|
|
109
|
+
message: t("common.validation.required_input", { field: t("system.base.post.field.code") }),
|
|
110
|
+
trigger: "blur"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
max: 20,
|
|
114
|
+
message: t("common.validation.max_length", { field: t("system.base.post.field.code"), max: 20 }),
|
|
115
|
+
trigger: "blur"
|
|
116
|
+
}
|
|
95
117
|
],
|
|
96
|
-
sort: [{ required: true, type: "number", min: 1, message: "
|
|
97
|
-
status: [
|
|
98
|
-
|
|
99
|
-
|
|
118
|
+
sort: [{ required: true, type: "number", min: 1, message: t("common.validation.sort_positive"), trigger: "blur" }],
|
|
119
|
+
status: [
|
|
120
|
+
{
|
|
121
|
+
required: true,
|
|
122
|
+
message: t("common.validation.required_select", { field: t("common.field.status") }),
|
|
123
|
+
trigger: "change"
|
|
124
|
+
}
|
|
125
|
+
],
|
|
126
|
+
remark: [
|
|
127
|
+
{
|
|
128
|
+
max: 500,
|
|
129
|
+
message: t("common.validation.max_length", { field: t("common.field.remark"), max: 500 }),
|
|
130
|
+
trigger: "blur"
|
|
131
|
+
}
|
|
132
|
+
]
|
|
133
|
+
}));
|
|
100
134
|
|
|
101
135
|
/** 当前登录账号是否默认租户。 */
|
|
102
136
|
const isDefaultTenant = computed(() => userStore.userInfo.tenant_code === DEFAULT_TENANT_CODE);
|
|
@@ -105,22 +139,41 @@ const isDefaultTenant = computed(() => userStore.userInfo.tenant_code === DEFAUL
|
|
|
105
139
|
const formFields = computed<ProFormField[]>(() => [
|
|
106
140
|
{
|
|
107
141
|
prop: "tenant_id",
|
|
108
|
-
label: "
|
|
142
|
+
label: t("common.field.tenant"),
|
|
109
143
|
component: "select",
|
|
110
|
-
props: {
|
|
144
|
+
props: {
|
|
145
|
+
placeholder: t("common.validation.required_select", { field: t("common.field.tenant") }),
|
|
146
|
+
filterable: true,
|
|
147
|
+
disabled: Boolean(formData.id)
|
|
148
|
+
},
|
|
111
149
|
visible: () => isDefaultTenant.value,
|
|
112
150
|
options: tenantOptions.value
|
|
113
151
|
},
|
|
114
|
-
{
|
|
115
|
-
|
|
152
|
+
{
|
|
153
|
+
prop: "name",
|
|
154
|
+
label: t("system.base.post.field.name"),
|
|
155
|
+
component: "input",
|
|
156
|
+
props: { placeholder: t("common.validation.required_input", { field: t("system.base.post.field.name") }) }
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
prop: "code",
|
|
160
|
+
label: t("system.base.post.field.code"),
|
|
161
|
+
component: "input",
|
|
162
|
+
props: { placeholder: t("common.validation.required_input", { field: t("system.base.post.field.code") }) }
|
|
163
|
+
},
|
|
116
164
|
{
|
|
117
165
|
prop: "sort",
|
|
118
|
-
label: "
|
|
166
|
+
label: t("common.field.sort"),
|
|
119
167
|
component: "input-number",
|
|
120
168
|
props: { min: 1, precision: 0, step: 1, controlsPosition: "right", style: { width: "100%" } }
|
|
121
169
|
},
|
|
122
|
-
{ prop: "status", label: "
|
|
123
|
-
{
|
|
170
|
+
{ prop: "status", label: t("common.field.status"), component: "radio-group", options: statusOptions.value },
|
|
171
|
+
{
|
|
172
|
+
prop: "remark",
|
|
173
|
+
label: t("common.field.remark"),
|
|
174
|
+
component: "textarea",
|
|
175
|
+
props: { placeholder: t("common.placeholder.remark") }
|
|
176
|
+
}
|
|
124
177
|
]);
|
|
125
178
|
|
|
126
179
|
/** 岗位表格列配置。 */
|
|
@@ -130,7 +183,7 @@ const columns = computed<ColumnProps[]>(() => [
|
|
|
130
183
|
? ([
|
|
131
184
|
{
|
|
132
185
|
prop: "tenant_id",
|
|
133
|
-
label: "
|
|
186
|
+
label: t("common.field.tenant"),
|
|
134
187
|
minWidth: 140,
|
|
135
188
|
showOverflowTooltip: true,
|
|
136
189
|
search: { el: "select", key: "tenant_id", props: { filterable: true }, order: 1 },
|
|
@@ -138,36 +191,36 @@ const columns = computed<ColumnProps[]>(() => [
|
|
|
138
191
|
}
|
|
139
192
|
] satisfies ColumnProps[])
|
|
140
193
|
: []),
|
|
141
|
-
{ prop: "name", label: "
|
|
142
|
-
{ prop: "code", label: "
|
|
143
|
-
{ prop: "sort", label: "
|
|
194
|
+
{ prop: "name", label: t("system.base.post.field.name"), minWidth: 140, search: { el: "input" } },
|
|
195
|
+
{ prop: "code", label: t("system.base.post.field.code"), minWidth: 140, search: { el: "input" } },
|
|
196
|
+
{ prop: "sort", label: t("common.field.sort"), minWidth: 90, align: "right" },
|
|
144
197
|
{
|
|
145
198
|
prop: "status",
|
|
146
|
-
label: "
|
|
199
|
+
label: t("common.field.status"),
|
|
147
200
|
minWidth: 100,
|
|
148
201
|
search: { el: "select" },
|
|
149
202
|
cellType: "status",
|
|
150
203
|
statusProps: {
|
|
151
204
|
activeValue: Status.ENABLE,
|
|
152
205
|
inactiveValue: Status.DISABLE,
|
|
153
|
-
activeText: "
|
|
154
|
-
inactiveText: "
|
|
206
|
+
activeText: t("common.status.enabled"),
|
|
207
|
+
inactiveText: t("common.status.disabled"),
|
|
155
208
|
disabled: () => !BUTTONS.value["base:post:status"],
|
|
156
209
|
beforeChange: scope => handleBeforeSetStatus(scope.row as BasePost)
|
|
157
210
|
}
|
|
158
211
|
},
|
|
159
|
-
{ prop: "remark", label: "
|
|
160
|
-
{ prop: "created_at", label: "
|
|
161
|
-
{ prop: "updated_at", label: "
|
|
212
|
+
{ prop: "remark", label: t("common.field.remark"), minWidth: 160 },
|
|
213
|
+
{ prop: "created_at", label: t("common.field.created_at"), minWidth: 180 },
|
|
214
|
+
{ prop: "updated_at", label: t("common.field.updated_at"), minWidth: 180 },
|
|
162
215
|
{
|
|
163
216
|
prop: "operation",
|
|
164
|
-
label: "
|
|
217
|
+
label: t("common.field.operation"),
|
|
165
218
|
width: 180,
|
|
166
219
|
fixed: "right",
|
|
167
220
|
cellType: "actions",
|
|
168
221
|
actions: [
|
|
169
222
|
{
|
|
170
|
-
label: "
|
|
223
|
+
label: t("common.action.edit"),
|
|
171
224
|
type: "primary",
|
|
172
225
|
link: true,
|
|
173
226
|
icon: EditPen,
|
|
@@ -176,7 +229,7 @@ const columns = computed<ColumnProps[]>(() => [
|
|
|
176
229
|
onClick: (scope, params) => handleOpenDialog((params?.postId as number | undefined) ?? (scope.row as BasePost).id)
|
|
177
230
|
},
|
|
178
231
|
{
|
|
179
|
-
label: "
|
|
232
|
+
label: t("common.action.delete"),
|
|
180
233
|
type: "danger",
|
|
181
234
|
link: true,
|
|
182
235
|
icon: Delete,
|
|
@@ -188,23 +241,23 @@ const columns = computed<ColumnProps[]>(() => [
|
|
|
188
241
|
]);
|
|
189
242
|
|
|
190
243
|
/** 岗位顶部按钮配置。 */
|
|
191
|
-
const headerActions
|
|
244
|
+
const headerActions = computed<HeaderActionProps[]>(() => [
|
|
192
245
|
{
|
|
193
|
-
label: "
|
|
246
|
+
label: t("common.action.create"),
|
|
194
247
|
type: "success",
|
|
195
248
|
icon: CirclePlus,
|
|
196
249
|
hidden: () => !BUTTONS.value["base:post:create"],
|
|
197
250
|
onClick: () => handleOpenDialog()
|
|
198
251
|
},
|
|
199
252
|
{
|
|
200
|
-
label: "
|
|
253
|
+
label: t("common.action.delete"),
|
|
201
254
|
type: "danger",
|
|
202
255
|
icon: Delete,
|
|
203
256
|
hidden: () => !BUTTONS.value["base:post:delete"],
|
|
204
257
|
disabled: scope => !scope.selectedList.length,
|
|
205
258
|
onClick: scope => handleDelete(scope.selectedList as BasePost[])
|
|
206
259
|
}
|
|
207
|
-
];
|
|
260
|
+
]);
|
|
208
261
|
|
|
209
262
|
/** 请求岗位分页列表。 */
|
|
210
263
|
async function requestBasePostTable(params: PageBasePostRequest) {
|
|
@@ -231,7 +284,7 @@ async function loadTenantOptions() {
|
|
|
231
284
|
async function handleOpenDialog(id?: number) {
|
|
232
285
|
resetForm();
|
|
233
286
|
await loadTenantOptions();
|
|
234
|
-
dialog.
|
|
287
|
+
dialog.titleKey = id ? "common.action.edit_resource" : "common.action.create_resource";
|
|
235
288
|
dialog.visible = true;
|
|
236
289
|
if (id) Object.assign(formData, await defBasePostService.GetBasePost({ id }));
|
|
237
290
|
}
|
|
@@ -264,7 +317,11 @@ function handleSubmit() {
|
|
|
264
317
|
? defBasePostService.UpdateBasePost({ base_post: submitData })
|
|
265
318
|
: defBasePostService.CreateBasePost({ base_post: submitData });
|
|
266
319
|
request.then(() => {
|
|
267
|
-
ElMessage.success(
|
|
320
|
+
ElMessage.success(
|
|
321
|
+
t(submitData.id ? "common.message.update_success" : "common.message.create_success", {
|
|
322
|
+
resource: t("system.base.post.resource")
|
|
323
|
+
})
|
|
324
|
+
);
|
|
268
325
|
handleCloseDialog();
|
|
269
326
|
refreshTable();
|
|
270
327
|
});
|
|
@@ -274,15 +331,24 @@ function handleSubmit() {
|
|
|
274
331
|
/** 在岗位状态切换前确认并提交。 */
|
|
275
332
|
async function handleBeforeSetStatus(row: BasePost) {
|
|
276
333
|
const nextStatus = row.status === Status.ENABLE ? Status.DISABLE : Status.ENABLE;
|
|
277
|
-
const text = nextStatus === Status.ENABLE ? "
|
|
334
|
+
const text = t(nextStatus === Status.ENABLE ? "common.status.enabled" : "common.status.disabled");
|
|
278
335
|
try {
|
|
279
|
-
await ElMessageBox.confirm(
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
336
|
+
await ElMessageBox.confirm(
|
|
337
|
+
t("common.dialog.status_change", {
|
|
338
|
+
action: text,
|
|
339
|
+
resource: t("system.base.post.resource"),
|
|
340
|
+
field: t("system.base.post.field.name"),
|
|
341
|
+
value: row.name || row.code || `ID:${row.id}`
|
|
342
|
+
}),
|
|
343
|
+
t("common.title.notice"),
|
|
344
|
+
{
|
|
345
|
+
confirmButtonText: t("common.action.confirm"),
|
|
346
|
+
cancelButtonText: t("common.action.cancel"),
|
|
347
|
+
type: "warning"
|
|
348
|
+
}
|
|
349
|
+
);
|
|
284
350
|
await defBasePostService.SetBasePostStatus({ id: row.id, status: nextStatus });
|
|
285
|
-
ElMessage.success(
|
|
351
|
+
ElMessage.success(t("common.message.status_success", { action: text }));
|
|
286
352
|
refreshTable();
|
|
287
353
|
return true;
|
|
288
354
|
} catch {
|
|
@@ -297,28 +363,30 @@ function handleDelete(selected?: number | string | Array<number | string> | Base
|
|
|
297
363
|
: selected && typeof selected === "object"
|
|
298
364
|
? [selected as BasePost]
|
|
299
365
|
: [];
|
|
300
|
-
const postIds = (
|
|
366
|
+
const postIds = (
|
|
367
|
+
postList.length ? postList.map(item => item.id) : normalizeSelectedIds(selected as number | string | Array<number | string>)
|
|
368
|
+
).join(",");
|
|
301
369
|
if (!postIds) {
|
|
302
|
-
ElMessage.warning("
|
|
370
|
+
ElMessage.warning(t("common.message.select_delete_item"));
|
|
303
371
|
return;
|
|
304
372
|
}
|
|
305
373
|
const confirmMessage =
|
|
306
374
|
postList.length === 1
|
|
307
|
-
?
|
|
375
|
+
? `${t("common.dialog.delete_single", { resource: t("system.base.post.resource") })}\n${t("common.dialog.resource_field", { field: t("system.base.post.field.name"), value: postList[0].name || postList[0].code || `ID:${postList[0].id}` })}`
|
|
308
376
|
: postList.length > 1
|
|
309
|
-
?
|
|
310
|
-
: "
|
|
311
|
-
ElMessageBox.confirm(confirmMessage, "
|
|
312
|
-
confirmButtonText: "
|
|
313
|
-
cancelButtonText: "
|
|
377
|
+
? t("common.dialog.delete_batch", { count: postList.length, unit: "", resource: t("system.base.post.resource") })
|
|
378
|
+
: t("common.dialog.delete_selected", { resource: t("system.base.post.resource") });
|
|
379
|
+
ElMessageBox.confirm(confirmMessage, t("common.title.warning"), {
|
|
380
|
+
confirmButtonText: t("common.action.confirm"),
|
|
381
|
+
cancelButtonText: t("common.action.cancel"),
|
|
314
382
|
type: "warning"
|
|
315
383
|
}).then(
|
|
316
384
|
() =>
|
|
317
385
|
defBasePostService.DeleteBasePost({ id: postIds }).then(() => {
|
|
318
|
-
ElMessage.success("
|
|
386
|
+
ElMessage.success(t("common.message.delete_success", { resource: t("system.base.post.resource") }));
|
|
319
387
|
refreshTable();
|
|
320
388
|
}),
|
|
321
|
-
() => ElMessage.info("
|
|
389
|
+
() => ElMessage.info(t("common.dialog.cancel_delete", { resource: t("system.base.post.resource") }))
|
|
322
390
|
);
|
|
323
391
|
}
|
|
324
392
|
</script>
|