@liujitcn/kratos-admin-core 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 +2 -2
- package/dist/package/declarations/src/api/base/language.d.ts +8 -0
- package/dist/package/declarations/src/components/Dialog/ProDialog.vue.d.ts +1 -0
- package/dist/package/declarations/src/components/Dict/index.vue.d.ts +4 -3
- package/dist/package/declarations/src/components/Dict/value.d.ts +11 -0
- package/dist/package/declarations/src/components/LocaleSwitch/index.vue.d.ts +3 -0
- package/dist/package/declarations/src/index.d.ts +2 -0
- package/dist/package/declarations/src/locales/generated.d.ts +3382 -0
- package/dist/package/declarations/src/locales/index.d.ts +53 -0
- package/dist/package/declarations/src/modules/index.d.ts +7 -2
- package/dist/package/declarations/src/request.d.ts +1 -0
- package/dist/package/declarations/src/routers/modules/staticRouter.d.ts +1 -0
- package/dist/package/declarations/src/rpc/base/v1/config.d.ts +13 -1
- package/dist/package/declarations/src/rpc/base/v1/language.d.ts +20 -0
- package/dist/package/declarations/src/rpc/base/v1/login.d.ts +13 -1
- package/dist/package/declarations/src/rpc/system/admin/v1/auth.d.ts +1 -1
- 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_translation.d.ts +75 -0
- package/dist/package/declarations/src/rpc/system/admin/v1/common.d.ts +13 -0
- package/dist/package/declarations/src/stores/interface/index.d.ts +2 -0
- package/dist/package/declarations/src/stores/modules/auth.d.ts +6 -6
- package/dist/package/declarations/src/stores/runtime.d.ts +1 -0
- package/dist/package/declarations/src/utils/dict.d.ts +2 -2
- package/dist/package/declarations/src/utils/index.d.ts +1 -1
- package/dist/package/declarations/src/utils/oauthProvider.d.ts +2 -0
- package/dist/package/declarations/src/utils/passwordCrypto.d.ts +1 -1
- package/dist/package/declarations/src/utils/passwordStrength.d.ts +0 -7
- package/dist/package/src/App.vue +5 -2
- package/dist/package/src/api/base/language.ts +20 -0
- package/dist/package/src/api/base/oauth.ts +0 -1
- package/dist/package/src/api/system/auth.ts +0 -1
- package/dist/package/src/bootstrap.ts +57 -2
- package/dist/package/src/components/CronExpression/index.vue +80 -82
- package/dist/package/src/components/Dialog/FormDialog.vue +10 -5
- package/dist/package/src/components/Dialog/ProDialog.vue +10 -4
- package/dist/package/src/components/Dict/index.vue +26 -9
- package/dist/package/src/components/Dict/value.ts +18 -0
- package/dist/package/src/components/ECharts/config/index.ts +6 -1
- package/dist/package/src/components/ErrorMessage/index.vue +3 -1
- package/dist/package/src/components/ImportExcel/index.vue +29 -18
- package/dist/package/src/components/LocaleSwitch/index.vue +28 -0
- package/dist/package/src/components/PasswordStrength/index.vue +8 -5
- package/dist/package/src/components/ProForm/components/DynamicList.vue +8 -3
- package/dist/package/src/components/ProForm/components/KvList.vue +14 -6
- package/dist/package/src/components/ProForm/index.vue +2 -2
- package/dist/package/src/components/ProTable/components/ColSetting.vue +7 -5
- package/dist/package/src/components/ProTable/components/TableColumn.vue +2 -1
- package/dist/package/src/components/ProTable/index.vue +36 -11
- package/dist/package/src/components/SearchForm/components/SearchFormItem.vue +9 -4
- package/dist/package/src/components/SearchForm/index.vue +6 -3
- package/dist/package/src/components/SelectFilter/index.vue +4 -1
- package/dist/package/src/components/SelectIcon/index.vue +8 -4
- package/dist/package/src/components/TreeFilter/index.vue +14 -6
- package/dist/package/src/components/Upload/File.vue +18 -13
- package/dist/package/src/components/Upload/Files.vue +22 -15
- package/dist/package/src/components/Upload/Img.vue +14 -11
- package/dist/package/src/components/Upload/Imgs.vue +15 -12
- package/dist/package/src/components/WangEditor/index.vue +12 -4
- package/dist/package/src/directives/modules/copy.ts +2 -1
- package/dist/package/src/hooks/useDownload.ts +3 -2
- package/dist/package/src/hooks/useHandleData.ts +5 -4
- package/dist/package/src/hooks/useTheme.ts +2 -1
- package/dist/package/src/hooks/useTime.ts +11 -2
- package/dist/package/src/index.ts +2 -0
- package/dist/package/src/layouts/components/Header/ToolBarRight.vue +2 -0
- package/dist/package/src/layouts/components/Header/components/AssemblySize.vue +8 -6
- package/dist/package/src/layouts/components/Header/components/Avatar.vue +11 -9
- package/dist/package/src/layouts/components/Header/components/Breadcrumb.vue +11 -3
- package/dist/package/src/layouts/components/Header/components/Fullscreen.vue +4 -2
- package/dist/package/src/layouts/components/Header/components/InfoDialog.vue +6 -3
- package/dist/package/src/layouts/components/Header/components/PasswordDialog.vue +6 -3
- package/dist/package/src/layouts/components/Header/components/SearchMenu.vue +5 -3
- package/dist/package/src/layouts/components/Header/components/ThemeSetting.vue +3 -1
- package/dist/package/src/layouts/components/Main/index.vue +1 -0
- package/dist/package/src/layouts/components/Tabs/components/MoreButton.vue +9 -7
- package/dist/package/src/layouts/components/Tabs/index.vue +15 -1
- package/dist/package/src/layouts/components/ThemeDrawer/index.vue +27 -24
- package/dist/package/src/locales/README.md +15 -0
- package/dist/package/src/locales/en-US.json +283 -0
- package/dist/package/src/locales/es-ES.json +283 -0
- package/dist/package/src/locales/fr-FR.json +283 -0
- package/dist/package/src/locales/generated.ts +57 -0
- package/dist/package/src/locales/index.ts +222 -0
- package/dist/package/src/locales/ja-JP.json +283 -0
- package/dist/package/src/locales/ko-KR.json +283 -0
- package/dist/package/src/locales/zh-CN.json +283 -0
- package/dist/package/src/locales/zh-TW.json +283 -0
- package/dist/package/src/modules/index.ts +7 -2
- package/dist/package/src/modules/kratosAdmin.ts +5 -1
- package/dist/package/src/request.ts +8 -1
- package/dist/package/src/routers/index.ts +4 -1
- package/dist/package/src/routers/modules/dynamicRouter.ts +5 -4
- package/dist/package/src/routers/modules/staticRouter.ts +8 -4
- package/dist/package/src/rpc/base/v1/config.ts +14 -1
- package/dist/package/src/rpc/base/v1/language.ts +31 -0
- package/dist/package/src/rpc/base/v1/login.ts +14 -1
- package/dist/package/src/rpc/system/admin/v1/auth.ts +1 -1
- package/dist/package/src/rpc/system/admin/v1/base_dict.ts +9 -0
- package/dist/package/src/rpc/system/admin/v1/base_translation.ts +90 -0
- package/dist/package/src/rpc/system/admin/v1/common.ts +21 -0
- package/dist/package/src/stores/interface/index.ts +2 -0
- package/dist/package/src/stores/modules/config.ts +7 -3
- package/dist/package/src/stores/modules/user.ts +2 -1
- package/dist/package/src/stores/runtime.ts +1 -0
- package/dist/package/src/styles/element.scss +2 -0
- package/dist/package/src/utils/color.ts +5 -4
- package/dist/package/src/utils/dict.ts +27 -4
- package/dist/package/src/utils/eleValidate.ts +3 -2
- package/dist/package/src/utils/errorHandler.ts +9 -8
- package/dist/package/src/utils/index.ts +9 -8
- package/dist/package/src/utils/oauthProvider.ts +15 -10
- package/dist/package/src/utils/passwordCrypto.ts +4 -3
- package/dist/package/src/utils/passwordStrength.ts +1 -16
- package/dist/package/src/utils/request.ts +13 -8
- package/dist/package/src/views/error/403.vue +3 -1
- package/dist/package/src/views/error/404.vue +3 -1
- package/dist/package/src/views/error/500.vue +3 -1
- package/dist/package/src/views/error/pending.vue +5 -2
- package/dist/package/src/views/login/components/LoginForm.vue +58 -29
- package/dist/package/src/views/login/index.scss +6 -0
- package/dist/package/src/views/login/index.vue +2 -0
- package/dist/package/types/generated/auto-imports.d.ts +129 -111
- package/dist/package/types/generated/components.d.ts +67 -67
- package/package.json +4 -2
- package/types/generated/auto-imports.d.ts +129 -111
- package/types/generated/components.d.ts +67 -67
- package/vite.config.ts +12 -0
- 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
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<el-dialog
|
|
2
|
+
<el-dialog
|
|
3
|
+
v-model="dialogVisible"
|
|
4
|
+
:title="t('core.upload.batch_add', { resource: parameter.title })"
|
|
5
|
+
:destroy-on-close="true"
|
|
6
|
+
width="580px"
|
|
7
|
+
draggable
|
|
8
|
+
>
|
|
3
9
|
<el-form class="drawer-multiColumn-form" label-width="100px">
|
|
4
|
-
<el-form-item label="
|
|
5
|
-
<el-button type="primary" :icon="Download" @click="downloadTemp">
|
|
10
|
+
<el-form-item :label="t('core.upload.template_download')">
|
|
11
|
+
<el-button type="primary" :icon="Download" @click="downloadTemp">{{ t("common.action.download") }}</el-button>
|
|
6
12
|
</el-form-item>
|
|
7
|
-
<el-form-item label="
|
|
13
|
+
<el-form-item :label="t('core.upload.file')">
|
|
8
14
|
<el-upload
|
|
9
15
|
action="#"
|
|
10
16
|
class="upload"
|
|
@@ -23,16 +29,18 @@
|
|
|
23
29
|
<el-icon class="el-icon--upload">
|
|
24
30
|
<upload-filled />
|
|
25
31
|
</el-icon>
|
|
26
|
-
<div class="el-upload__text"
|
|
32
|
+
<div class="el-upload__text">
|
|
33
|
+
{{ t("core.upload.drag_or_click") }}<em>{{ t("core.upload.click") }}</em>
|
|
34
|
+
</div>
|
|
27
35
|
</slot>
|
|
28
36
|
<template #tip>
|
|
29
37
|
<slot name="tip">
|
|
30
|
-
<div class="el-upload__tip"
|
|
38
|
+
<div class="el-upload__tip">{{ t("core.upload.excel_format", { size: parameter.fileSize ?? 5 }) }}</div>
|
|
31
39
|
</slot>
|
|
32
40
|
</template>
|
|
33
41
|
</el-upload>
|
|
34
42
|
</el-form-item>
|
|
35
|
-
<el-form-item label="
|
|
43
|
+
<el-form-item :label="t('core.upload.data_cover')">
|
|
36
44
|
<el-switch v-model="isCover" />
|
|
37
45
|
</el-form-item>
|
|
38
46
|
</el-form>
|
|
@@ -44,6 +52,9 @@ import { ref } from "vue";
|
|
|
44
52
|
import { useDownload } from "../../hooks/useDownload";
|
|
45
53
|
import { Download } from "@element-plus/icons-vue";
|
|
46
54
|
import { ElNotification, UploadRequestOptions, UploadRawFile } from "element-plus";
|
|
55
|
+
import { useLocaleStore } from "../../locales";
|
|
56
|
+
|
|
57
|
+
const { t } = useLocaleStore();
|
|
47
58
|
|
|
48
59
|
/** Excel 导入弹窗参数。 */
|
|
49
60
|
export interface ExcelParameterProps {
|
|
@@ -77,7 +88,7 @@ const acceptParams = (params: ExcelParameterProps) => {
|
|
|
77
88
|
// Excel 导入模板下载
|
|
78
89
|
const downloadTemp = () => {
|
|
79
90
|
if (!parameter.value.tempApi) return;
|
|
80
|
-
useDownload(parameter.value.tempApi,
|
|
91
|
+
useDownload(parameter.value.tempApi, t("core.upload.template", { resource: parameter.value.title }));
|
|
81
92
|
};
|
|
82
93
|
|
|
83
94
|
// 文件上传
|
|
@@ -99,15 +110,15 @@ const beforeExcelUpload = (file: UploadRawFile) => {
|
|
|
99
110
|
const fileSize = file.size / 1024 / 1024 < parameter.value.fileSize!;
|
|
100
111
|
if (!isExcel)
|
|
101
112
|
ElNotification({
|
|
102
|
-
title: "
|
|
103
|
-
message: "
|
|
113
|
+
title: t("common.title.warning"),
|
|
114
|
+
message: t("core.upload.file_format_invalid"),
|
|
104
115
|
type: "warning"
|
|
105
116
|
});
|
|
106
117
|
if (!fileSize)
|
|
107
118
|
setTimeout(() => {
|
|
108
119
|
ElNotification({
|
|
109
|
-
title: "
|
|
110
|
-
message:
|
|
120
|
+
title: t("common.title.warning"),
|
|
121
|
+
message: t("core.upload.file_size_exceeded", { size: parameter.value.fileSize ?? 5 }),
|
|
111
122
|
type: "warning"
|
|
112
123
|
});
|
|
113
124
|
}, 0);
|
|
@@ -117,8 +128,8 @@ const beforeExcelUpload = (file: UploadRawFile) => {
|
|
|
117
128
|
// 文件数超出提示
|
|
118
129
|
const handleExceed = () => {
|
|
119
130
|
ElNotification({
|
|
120
|
-
title: "
|
|
121
|
-
message: "
|
|
131
|
+
title: t("common.title.warning"),
|
|
132
|
+
message: t("core.upload.single_file_only"),
|
|
122
133
|
type: "warning"
|
|
123
134
|
});
|
|
124
135
|
};
|
|
@@ -126,8 +137,8 @@ const handleExceed = () => {
|
|
|
126
137
|
// 上传错误提示
|
|
127
138
|
const excelUploadError = () => {
|
|
128
139
|
ElNotification({
|
|
129
|
-
title: "
|
|
130
|
-
message:
|
|
140
|
+
title: t("common.title.warning"),
|
|
141
|
+
message: t("core.upload.batch_failed", { resource: parameter.value.title }),
|
|
131
142
|
type: "error"
|
|
132
143
|
});
|
|
133
144
|
};
|
|
@@ -135,8 +146,8 @@ const excelUploadError = () => {
|
|
|
135
146
|
// 上传成功提示
|
|
136
147
|
const excelUploadSuccess = () => {
|
|
137
148
|
ElNotification({
|
|
138
|
-
title: "
|
|
139
|
-
message:
|
|
149
|
+
title: t("common.title.notice"),
|
|
150
|
+
message: t("core.upload.batch_success", { resource: parameter.value.title }),
|
|
140
151
|
type: "success"
|
|
141
152
|
});
|
|
142
153
|
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-dropdown trigger="click" placement="bottom-end" @command="handleLocaleChange">
|
|
3
|
+
<Languages class="toolBar-icon" :size="20" :title="t('core.header.language')" />
|
|
4
|
+
<template #dropdown>
|
|
5
|
+
<el-dropdown-menu>
|
|
6
|
+
<el-dropdown-item v-for="item in localeOptions" :key="item.value" :command="item.value" :disabled="item.value === locale">
|
|
7
|
+
{{ item.label }}
|
|
8
|
+
</el-dropdown-item>
|
|
9
|
+
</el-dropdown-menu>
|
|
10
|
+
</template>
|
|
11
|
+
</el-dropdown>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script setup lang="ts">
|
|
15
|
+
import { computed } from "vue";
|
|
16
|
+
import { Languages } from "@lucide/vue";
|
|
17
|
+
import { type SupportedLocale, useLocaleStore } from "../../locales";
|
|
18
|
+
|
|
19
|
+
const { locale, setLocale, languageOptions, t } = useLocaleStore();
|
|
20
|
+
const localeOptions = computed(() => {
|
|
21
|
+
return languageOptions.value.map(item => ({ value: item.language_code, label: item.native_name }));
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
/** 切换管理端语言并刷新动态本地化数据。 */
|
|
25
|
+
function handleLocaleChange(value: SupportedLocale) {
|
|
26
|
+
void setLocale(value);
|
|
27
|
+
}
|
|
28
|
+
</script>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="password-strength">
|
|
3
3
|
<div class="password-strength__header">
|
|
4
|
-
<span
|
|
4
|
+
<span>{{ t("core.password.strength") }}</span>
|
|
5
5
|
<strong :class="`password-strength__label password-strength__label--${strength.level}`">
|
|
6
|
-
{{ strength.
|
|
6
|
+
{{ t(`core.password.strength.${strength.level}`) }}
|
|
7
7
|
</strong>
|
|
8
8
|
</div>
|
|
9
9
|
<div class="password-strength__bars">
|
|
@@ -17,13 +17,16 @@
|
|
|
17
17
|
}"
|
|
18
18
|
/>
|
|
19
19
|
</div>
|
|
20
|
-
<p class="password-strength__tip">{{ tip }}</p>
|
|
20
|
+
<p class="password-strength__tip">{{ tip || t("core.password.tip") }}</p>
|
|
21
21
|
</div>
|
|
22
22
|
</template>
|
|
23
23
|
|
|
24
24
|
<script setup lang="ts">
|
|
25
25
|
import { computed } from "vue";
|
|
26
|
-
import { getPasswordStrength
|
|
26
|
+
import { getPasswordStrength } from "../../utils/passwordStrength";
|
|
27
|
+
import { useLocaleStore } from "../../locales";
|
|
28
|
+
|
|
29
|
+
const { t } = useLocaleStore();
|
|
27
30
|
|
|
28
31
|
/** 密码强度组件属性。 */
|
|
29
32
|
interface PasswordStrengthProps {
|
|
@@ -35,7 +38,7 @@ interface PasswordStrengthProps {
|
|
|
35
38
|
|
|
36
39
|
const props = withDefaults(defineProps<PasswordStrengthProps>(), {
|
|
37
40
|
password: "",
|
|
38
|
-
tip:
|
|
41
|
+
tip: ""
|
|
39
42
|
});
|
|
40
43
|
|
|
41
44
|
/** 强度条固定为三段,保持所有页面一致。 */
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="dynamic-list">
|
|
3
3
|
<div v-for="(item, index) in modelValue" :key="index" class="dynamic-list__item">
|
|
4
|
-
<el-input v-model="modelValue[index]" v-bind="
|
|
4
|
+
<el-input v-model="modelValue[index]" v-bind="resolvedInputProps" />
|
|
5
5
|
<el-button :icon="Delete" circle type="danger" plain @click="handleRemove(index)" />
|
|
6
6
|
</div>
|
|
7
|
-
<el-button :icon="Plus" type="primary" plain @click="handleAdd"
|
|
7
|
+
<el-button :icon="Plus" type="primary" plain @click="handleAdd">{{ t("common.action.create") }}</el-button>
|
|
8
8
|
</div>
|
|
9
9
|
</template>
|
|
10
10
|
|
|
11
11
|
<script setup lang="ts" name="DynamicList">
|
|
12
12
|
import { computed } from "vue";
|
|
13
13
|
import { Delete, Plus } from "@element-plus/icons-vue";
|
|
14
|
+
import { useLocaleStore } from "../../../locales";
|
|
15
|
+
|
|
16
|
+
const { t } = useLocaleStore();
|
|
14
17
|
|
|
15
18
|
/** 动态字符串列表组件属性。 */
|
|
16
19
|
interface DynamicListProps {
|
|
@@ -20,9 +23,11 @@ interface DynamicListProps {
|
|
|
20
23
|
|
|
21
24
|
const props = withDefaults(defineProps<DynamicListProps>(), {
|
|
22
25
|
modelValue: () => [],
|
|
23
|
-
inputProps: () => ({
|
|
26
|
+
inputProps: () => ({})
|
|
24
27
|
});
|
|
25
28
|
|
|
29
|
+
const resolvedInputProps = computed(() => ({ placeholder: t("common.placeholder.input_content"), ...props.inputProps }));
|
|
30
|
+
|
|
26
31
|
const emit = defineEmits<{
|
|
27
32
|
"update:modelValue": [value: string[]];
|
|
28
33
|
}>();
|
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="kv-list">
|
|
3
3
|
<div v-for="(item, index) in modelValue" :key="index" class="kv-list__item">
|
|
4
|
-
<el-input v-model="item.key" v-bind="
|
|
5
|
-
<el-input v-model="item.value" v-bind="
|
|
4
|
+
<el-input v-model="item.key" v-bind="resolvedKeyInputProps" />
|
|
5
|
+
<el-input v-model="item.value" v-bind="resolvedValueInputProps" />
|
|
6
6
|
<el-button :icon="Delete" circle type="danger" plain @click="handleRemove(index)" />
|
|
7
7
|
</div>
|
|
8
|
-
<el-button :icon="Plus" type="primary" plain v-bind="addButtonProps" @click="handleAdd">
|
|
8
|
+
<el-button :icon="Plus" type="primary" plain v-bind="addButtonProps" @click="handleAdd">
|
|
9
|
+
{{ addText || t("common.action.create") }}
|
|
10
|
+
</el-button>
|
|
9
11
|
</div>
|
|
10
12
|
</template>
|
|
11
13
|
|
|
12
14
|
<script setup lang="ts" name="KvList">
|
|
13
15
|
import { computed } from "vue";
|
|
14
16
|
import { Delete, Plus } from "@element-plus/icons-vue";
|
|
17
|
+
import { useLocaleStore } from "../../../locales";
|
|
18
|
+
|
|
19
|
+
const { t } = useLocaleStore();
|
|
15
20
|
|
|
16
21
|
/** 键值对列表单项。 */
|
|
17
22
|
interface KvItem {
|
|
@@ -30,12 +35,15 @@ interface KvListProps {
|
|
|
30
35
|
|
|
31
36
|
const props = withDefaults(defineProps<KvListProps>(), {
|
|
32
37
|
modelValue: () => [],
|
|
33
|
-
keyInputProps: () => ({
|
|
34
|
-
valueInputProps: () => ({
|
|
35
|
-
addText: "
|
|
38
|
+
keyInputProps: () => ({}),
|
|
39
|
+
valueInputProps: () => ({}),
|
|
40
|
+
addText: "",
|
|
36
41
|
addButtonProps: () => ({})
|
|
37
42
|
});
|
|
38
43
|
|
|
44
|
+
const resolvedKeyInputProps = computed(() => ({ placeholder: t("common.field.parameter_name"), ...props.keyInputProps }));
|
|
45
|
+
const resolvedValueInputProps = computed(() => ({ placeholder: t("common.field.parameter_value"), ...props.valueInputProps }));
|
|
46
|
+
|
|
39
47
|
const emit = defineEmits<{
|
|
40
48
|
"update:modelValue": [value: KvItem[]];
|
|
41
49
|
}>();
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<el-row :gutter="gutter">
|
|
4
4
|
<template v-for="field in visibleFields" :key="field.prop">
|
|
5
5
|
<span v-if="field.rowBreakBefore" class="pro-form__row-break" aria-hidden="true" />
|
|
6
|
-
<el-col :span="field.colSpan ?? colSpan">
|
|
6
|
+
<el-col :span="field.colSpan ?? colSpan" :xs="24">
|
|
7
7
|
<el-form-item :label="field.label" :prop="field.prop" :rules="field.rules" v-bind="resolveFieldItemProps(field)">
|
|
8
8
|
<template v-if="field.labelTooltip" #label>
|
|
9
9
|
<div class="pro-form__label">
|
|
@@ -47,7 +47,7 @@ interface ProFormProps {
|
|
|
47
47
|
|
|
48
48
|
const props = withDefaults(defineProps<ProFormProps>(), {
|
|
49
49
|
rules: () => ({}),
|
|
50
|
-
labelWidth: "
|
|
50
|
+
labelWidth: "",
|
|
51
51
|
gutter: 20,
|
|
52
52
|
colSpan: 24
|
|
53
53
|
});
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<!-- 列设置 -->
|
|
3
|
-
<el-drawer v-model="drawerVisible" title="
|
|
3
|
+
<el-drawer v-model="drawerVisible" :title="t('core.table.column_setting')" size="450px">
|
|
4
4
|
<div class="table-main">
|
|
5
5
|
<el-table :data="colSetting" :border="true" row-key="prop" default-expand-all :tree-props="{ children: '_children' }">
|
|
6
|
-
<el-table-column prop="label" align="left" label="
|
|
7
|
-
<el-table-column v-slot="scope" prop="isShow" align="center" label="
|
|
6
|
+
<el-table-column prop="label" align="left" :label="t('core.table.column_name')" />
|
|
7
|
+
<el-table-column v-slot="scope" prop="isShow" align="center" :label="t('core.table.show')">
|
|
8
8
|
<el-switch v-model="scope.row.isShow"></el-switch>
|
|
9
9
|
</el-table-column>
|
|
10
|
-
<el-table-column v-slot="scope" prop="sortable" align="center" label="
|
|
10
|
+
<el-table-column v-slot="scope" prop="sortable" align="center" :label="t('core.table.sort')">
|
|
11
11
|
<el-switch v-model="scope.row.sortable"></el-switch>
|
|
12
12
|
</el-table-column>
|
|
13
13
|
<template #empty>
|
|
14
14
|
<div class="table-empty">
|
|
15
15
|
<img src="../../../assets/images/notData.png" alt="notData" />
|
|
16
|
-
<div
|
|
16
|
+
<div>{{ t("core.table.no_configurable_columns") }}</div>
|
|
17
17
|
</div>
|
|
18
18
|
</template>
|
|
19
19
|
</el-table>
|
|
@@ -24,10 +24,12 @@
|
|
|
24
24
|
<script setup lang="ts" name="ColSetting">
|
|
25
25
|
import { ref } from "vue";
|
|
26
26
|
import { ColumnProps } from "../../../components/ProTable/interface";
|
|
27
|
+
import { useLocaleStore } from "../../../locales";
|
|
27
28
|
|
|
28
29
|
defineProps<{ colSetting: ColumnProps[] }>();
|
|
29
30
|
|
|
30
31
|
const drawerVisible = ref<boolean>(false);
|
|
32
|
+
const { t } = useLocaleStore();
|
|
31
33
|
|
|
32
34
|
const openColSetting = () => {
|
|
33
35
|
drawerVisible.value = true;
|
|
@@ -10,6 +10,7 @@ import { ColumnProps, HeaderRenderScope, RenderScope, TableActionProps } from ".
|
|
|
10
10
|
import type { TableAlign } from "../../../utils/proTable";
|
|
11
11
|
import { filterEnum, formatValue, handleProp, handleRowAccordingToProp } from "../../../utils";
|
|
12
12
|
import { formatPrice } from "../../../utils/utils";
|
|
13
|
+
import { t } from "../../../locales";
|
|
13
14
|
|
|
14
15
|
const props = defineProps<{
|
|
15
16
|
column: ColumnProps;
|
|
@@ -119,7 +120,7 @@ const renderImageCell = (item: ColumnProps, scope: RenderScope<any>) => {
|
|
|
119
120
|
}
|
|
120
121
|
},
|
|
121
122
|
{
|
|
122
|
-
error: () => h(ElText, { type: "info", size: "small" }, () => "
|
|
123
|
+
error: () => h(ElText, { type: "info", size: "small" }, () => t("common.message.no_data"))
|
|
123
124
|
}
|
|
124
125
|
);
|
|
125
126
|
};
|
|
@@ -31,18 +31,22 @@
|
|
|
31
31
|
</div>
|
|
32
32
|
<div v-if="showToolButtonArea" class="header-button-ri">
|
|
33
33
|
<slot name="toolButton">
|
|
34
|
-
<el-tooltip
|
|
34
|
+
<el-tooltip
|
|
35
|
+
v-if="showTreeToggleButton"
|
|
36
|
+
:content="isTreeExpanded ? t('core.table.collapse_all') : t('core.table.expand_all')"
|
|
37
|
+
placement="top"
|
|
38
|
+
>
|
|
35
39
|
<el-button class="tool-button" :icon="isTreeExpanded ? Fold : Expand" circle @click="toggleTreeExpand" />
|
|
36
40
|
</el-tooltip>
|
|
37
|
-
<el-tooltip v-if="showToolButton('refresh')" content="
|
|
41
|
+
<el-tooltip v-if="showToolButton('refresh')" :content="t('core.table.refresh')" placement="top">
|
|
38
42
|
<el-button class="tool-button" :icon="Refresh" circle @click="handleToolRefresh" />
|
|
39
43
|
</el-tooltip>
|
|
40
|
-
<el-tooltip v-if="showToolButton('setting') && columns.length" content="
|
|
44
|
+
<el-tooltip v-if="showToolButton('setting') && columns.length" :content="t('core.table.column_setting')" placement="top">
|
|
41
45
|
<el-button class="tool-button" :icon="Operation" circle @click="openColSetting" />
|
|
42
46
|
</el-tooltip>
|
|
43
47
|
<el-tooltip
|
|
44
48
|
v-if="showToolButton('search') && searchColumns?.length"
|
|
45
|
-
:content="isShowSearch ? '
|
|
49
|
+
:content="isShowSearch ? t('core.table.hide_search') : t('core.table.show_search')"
|
|
46
50
|
placement="top"
|
|
47
51
|
>
|
|
48
52
|
<el-button class="tool-button" :icon="Search" circle @click="isShowSearch = !isShowSearch" />
|
|
@@ -104,7 +108,7 @@
|
|
|
104
108
|
<div class="table-empty">
|
|
105
109
|
<slot name="empty">
|
|
106
110
|
<img src="../../assets/images/notData.png" alt="notData" />
|
|
107
|
-
<div
|
|
111
|
+
<div>{{ t("common.message.no_data") }}</div>
|
|
108
112
|
</slot>
|
|
109
113
|
</div>
|
|
110
114
|
</template>
|
|
@@ -128,7 +132,14 @@ import { ref, watch, provide, onMounted, unref, computed, nextTick, useAttrs, us
|
|
|
128
132
|
import { ElTable } from "element-plus";
|
|
129
133
|
import { useTable } from "../../hooks/useTable";
|
|
130
134
|
import { useSelection } from "../../hooks/useSelection";
|
|
131
|
-
import {
|
|
135
|
+
import {
|
|
136
|
+
ColumnProps,
|
|
137
|
+
EnumProps,
|
|
138
|
+
HeaderActionProps,
|
|
139
|
+
HeaderActionScope,
|
|
140
|
+
ProTableProps,
|
|
141
|
+
TypeProps
|
|
142
|
+
} from "../../components/ProTable/interface";
|
|
132
143
|
import { Expand, Fold, Refresh, Operation, Search } from "@element-plus/icons-vue";
|
|
133
144
|
import { generateUUID, handleProp } from "../../utils";
|
|
134
145
|
import { resolveTableColumnAlign } from "../../utils/proTable";
|
|
@@ -137,6 +148,9 @@ import Pagination from "./components/Pagination.vue";
|
|
|
137
148
|
import ColSetting from "./components/ColSetting.vue";
|
|
138
149
|
import TableColumn from "./components/TableColumn.vue";
|
|
139
150
|
import Sortable from "sortablejs";
|
|
151
|
+
import { useLocaleStore } from "../../locales";
|
|
152
|
+
|
|
153
|
+
const { t } = useLocaleStore();
|
|
140
154
|
|
|
141
155
|
// 接受父组件参数,配置默认值
|
|
142
156
|
const props = withDefaults(defineProps<ProTableProps>(), {
|
|
@@ -208,8 +222,18 @@ const headerActionScope = computed<HeaderActionScope>(() => ({
|
|
|
208
222
|
}));
|
|
209
223
|
|
|
210
224
|
// 表格操作 Hooks
|
|
211
|
-
const {
|
|
212
|
-
|
|
225
|
+
const {
|
|
226
|
+
loading,
|
|
227
|
+
tableData,
|
|
228
|
+
pageable,
|
|
229
|
+
searchParam,
|
|
230
|
+
searchInitParam,
|
|
231
|
+
getTableList,
|
|
232
|
+
search,
|
|
233
|
+
reset,
|
|
234
|
+
handleSizeChange,
|
|
235
|
+
handleCurrentChange
|
|
236
|
+
} = useTable(props.requestApi, props.initParam, props.pagination, props.dataCallback, props.requestError);
|
|
213
237
|
|
|
214
238
|
// 清空选中数据列表
|
|
215
239
|
const clearSelection = () => tableRef.value!.clearSelection();
|
|
@@ -299,10 +323,11 @@ const setEnumMapValue = (prop: string | undefined, data: { [key: string]: any }[
|
|
|
299
323
|
* 根据状态开关配置自动生成搜索下拉枚举,避免状态列只配置开关后搜索框无选项。
|
|
300
324
|
*/
|
|
301
325
|
const buildStatusEnum = (column: ColumnProps): EnumProps[] => {
|
|
302
|
-
if (column.enum || column.dictCode || column.cellType !== "status" || column.search?.el !== "select" || !column.statusProps)
|
|
326
|
+
if (column.enum || column.dictCode || column.cellType !== "status" || column.search?.el !== "select" || !column.statusProps)
|
|
327
|
+
return [];
|
|
303
328
|
return [
|
|
304
|
-
{ label: column.statusProps.activeText ?? "
|
|
305
|
-
{ label: column.statusProps.inactiveText ?? "
|
|
329
|
+
{ label: column.statusProps.activeText ?? t("common.status.enabled"), value: column.statusProps.activeValue },
|
|
330
|
+
{ label: column.statusProps.inactiveText ?? t("common.status.disabled"), value: column.statusProps.inactiveValue }
|
|
306
331
|
];
|
|
307
332
|
};
|
|
308
333
|
|
|
@@ -49,6 +49,9 @@ import {
|
|
|
49
49
|
import Dict from "../../../components/Dict/index.vue";
|
|
50
50
|
import { handleProp } from "../../../utils";
|
|
51
51
|
import { ColumnProps, SearchType } from "../../../components/ProTable/interface";
|
|
52
|
+
import { useLocaleStore } from "../../../locales";
|
|
53
|
+
|
|
54
|
+
const { t } = useLocaleStore();
|
|
52
55
|
|
|
53
56
|
/** 单个搜索表单项组件属性。 */
|
|
54
57
|
interface SearchFormItem {
|
|
@@ -151,12 +154,14 @@ const placeholder = computed(() => {
|
|
|
151
154
|
const search = props.column.search;
|
|
152
155
|
if (["datetimerange", "daterange", "monthrange"].includes(search?.props?.type) || search?.props?.isRange) {
|
|
153
156
|
return {
|
|
154
|
-
rangeSeparator: search?.props?.rangeSeparator ?? "
|
|
155
|
-
startPlaceholder: search?.props?.startPlaceholder ?? "
|
|
156
|
-
endPlaceholder: search?.props?.endPlaceholder ?? "
|
|
157
|
+
rangeSeparator: search?.props?.rangeSeparator ?? "-",
|
|
158
|
+
startPlaceholder: search?.props?.startPlaceholder ?? t("common.field.start_time"),
|
|
159
|
+
endPlaceholder: search?.props?.endPlaceholder ?? t("common.field.end_time")
|
|
157
160
|
};
|
|
158
161
|
}
|
|
159
|
-
const placeholder =
|
|
162
|
+
const placeholder =
|
|
163
|
+
search?.props?.placeholder ??
|
|
164
|
+
(search?.el?.includes("input") ? t("common.placeholder.input") : t("common.placeholder.select"));
|
|
160
165
|
return { placeholder };
|
|
161
166
|
});
|
|
162
167
|
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
</GridItem>
|
|
19
19
|
<GridItem v-if="showOperation" suffix>
|
|
20
20
|
<div class="operation">
|
|
21
|
-
<el-button type="primary" :icon="Search" @click="search">
|
|
22
|
-
<el-button :icon="Delete" @click="reset">
|
|
21
|
+
<el-button type="primary" :icon="Search" @click="search">{{ t("common.action.search") }}</el-button>
|
|
22
|
+
<el-button :icon="Delete" @click="reset">{{ t("common.action.reset") }}</el-button>
|
|
23
23
|
<el-button v-if="showCollapse" type="primary" link class="search-isOpen" @click="collapsed = !collapsed">
|
|
24
|
-
{{ collapsed ? "
|
|
24
|
+
{{ collapsed ? t("common.action.expand") : t("common.action.collapse") }}
|
|
25
25
|
<el-icon class="el-icon--right">
|
|
26
26
|
<component :is="collapsed ? ArrowDown : ArrowUp"></component>
|
|
27
27
|
</el-icon>
|
|
@@ -40,6 +40,9 @@ import { Delete, Search, ArrowDown, ArrowUp } from "@element-plus/icons-vue";
|
|
|
40
40
|
import SearchFormItem from "./components/SearchFormItem.vue";
|
|
41
41
|
import Grid from "../../components/Grid/index.vue";
|
|
42
42
|
import GridItem from "../../components/Grid/components/GridItem.vue";
|
|
43
|
+
import { useLocaleStore } from "../../locales";
|
|
44
|
+
|
|
45
|
+
const { t } = useLocaleStore();
|
|
43
46
|
|
|
44
47
|
/** ProTable 搜索表单组件属性。 */
|
|
45
48
|
interface ProTableProps {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<div class="select-filter-item-title">
|
|
5
5
|
<span>{{ item.title }} :</span>
|
|
6
6
|
</div>
|
|
7
|
-
<span v-if="!item.options.length" class="select-filter-notData"
|
|
7
|
+
<span v-if="!item.options.length" class="select-filter-notData">{{ t("common.message.no_data") }}</span>
|
|
8
8
|
<el-scrollbar>
|
|
9
9
|
<ul class="select-filter-list">
|
|
10
10
|
<li
|
|
@@ -32,6 +32,9 @@
|
|
|
32
32
|
|
|
33
33
|
<script setup lang="ts" name="selectFilter">
|
|
34
34
|
import { ref, watch } from "vue";
|
|
35
|
+
import { useLocaleStore } from "../../locales";
|
|
36
|
+
|
|
37
|
+
const { t } = useLocaleStore();
|
|
35
38
|
|
|
36
39
|
/** 筛选项候选值。 */
|
|
37
40
|
interface OptionsProps {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
</template>
|
|
15
15
|
</el-input>
|
|
16
16
|
<el-dialog v-model="dialogVisible" :title="placeholder" top="50px" width="66%">
|
|
17
|
-
<el-input v-model="inputValue" placeholder="
|
|
17
|
+
<el-input v-model="inputValue" :placeholder="t('core.icon.search')" size="large" :prefix-icon="Icons.Search" />
|
|
18
18
|
<el-scrollbar v-if="Object.keys(iconsList).length">
|
|
19
19
|
<div class="icon-list">
|
|
20
20
|
<div v-for="item in iconsList" :key="item" class="icon-item" @click="selectIcon(item)">
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
</div>
|
|
24
24
|
</div>
|
|
25
25
|
</el-scrollbar>
|
|
26
|
-
<el-empty v-else description="
|
|
26
|
+
<el-empty v-else :description="t('core.icon.empty')" />
|
|
27
27
|
</el-dialog>
|
|
28
28
|
</div>
|
|
29
29
|
</template>
|
|
@@ -31,6 +31,9 @@
|
|
|
31
31
|
<script setup lang="ts" name="SelectIcon">
|
|
32
32
|
import { ref, computed, watch } from "vue";
|
|
33
33
|
import * as Icons from "@element-plus/icons-vue";
|
|
34
|
+
import { useLocaleStore } from "../../locales";
|
|
35
|
+
|
|
36
|
+
const { t } = useLocaleStore();
|
|
34
37
|
|
|
35
38
|
/** 图标选择器组件属性。 */
|
|
36
39
|
interface SelectIconProps {
|
|
@@ -42,10 +45,11 @@ interface SelectIconProps {
|
|
|
42
45
|
|
|
43
46
|
const props = withDefaults(defineProps<SelectIconProps>(), {
|
|
44
47
|
iconValue: "",
|
|
45
|
-
title: "
|
|
48
|
+
title: "",
|
|
46
49
|
clearable: true,
|
|
47
|
-
placeholder: "
|
|
50
|
+
placeholder: ""
|
|
48
51
|
});
|
|
52
|
+
const placeholder = computed(() => props.placeholder || t("core.icon.placeholder"));
|
|
49
53
|
|
|
50
54
|
// 重新接收一下,防止打包后 clearable 报错
|
|
51
55
|
const valueIcon = ref(props.iconValue);
|
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
{{ title }}
|
|
5
5
|
</h4>
|
|
6
6
|
<div class="search">
|
|
7
|
-
<el-input v-model="filterText" placeholder="
|
|
7
|
+
<el-input v-model="filterText" :placeholder="t('core.tree.filter_placeholder')" clearable />
|
|
8
8
|
<el-dropdown trigger="click">
|
|
9
9
|
<el-icon size="20"><More /></el-icon>
|
|
10
10
|
<template #dropdown>
|
|
11
11
|
<el-dropdown-menu>
|
|
12
|
-
<el-dropdown-item v-if="!multiple" @click="resetSelected"
|
|
13
|
-
<el-dropdown-item @click="toggleTreeNodes(true)"
|
|
14
|
-
<el-dropdown-item @click="toggleTreeNodes(false)"
|
|
12
|
+
<el-dropdown-item v-if="!multiple" @click="resetSelected">{{ t("core.tree.reset_selection") }}</el-dropdown-item>
|
|
13
|
+
<el-dropdown-item @click="toggleTreeNodes(true)">{{ t("core.table.expand_all") }}</el-dropdown-item>
|
|
14
|
+
<el-dropdown-item @click="toggleTreeNodes(false)">{{ t("core.table.collapse_all") }}</el-dropdown-item>
|
|
15
15
|
</el-dropdown-menu>
|
|
16
16
|
</template>
|
|
17
17
|
</el-dropdown>
|
|
@@ -51,6 +51,9 @@
|
|
|
51
51
|
<script setup lang="ts" name="TreeFilter">
|
|
52
52
|
import { ref, watch, onBeforeMount, nextTick } from "vue";
|
|
53
53
|
import { ElTree } from "element-plus";
|
|
54
|
+
import { useLocaleStore } from "../../locales";
|
|
55
|
+
|
|
56
|
+
const { locale, t } = useLocaleStore();
|
|
54
57
|
|
|
55
58
|
// 接收父组件参数并设置默认值
|
|
56
59
|
interface TreeFilterProps {
|
|
@@ -97,7 +100,7 @@ const normalizeLazyNodes = (nodes: { [key: string]: any }[] = []) =>
|
|
|
97
100
|
|
|
98
101
|
const updateTreeData = (data: { [key: string]: any }[]) => {
|
|
99
102
|
treeData.value = props.lazy ? normalizeLazyNodes(data) : data;
|
|
100
|
-
const allNode = { id: "", [props.label]: "
|
|
103
|
+
const allNode = { id: "", [props.label]: t("common.value.all"), isLeaf: true };
|
|
101
104
|
treeAllData.value = props.showAll ? [allNode, ...treeData.value] : treeData.value;
|
|
102
105
|
};
|
|
103
106
|
|
|
@@ -110,7 +113,10 @@ onBeforeMount(async () => {
|
|
|
110
113
|
}
|
|
111
114
|
});
|
|
112
115
|
|
|
113
|
-
const loadTreeNode = async (
|
|
116
|
+
const loadTreeNode = async (
|
|
117
|
+
node: { level: number; data?: { [key: string]: any } },
|
|
118
|
+
resolve: (data: { [key: string]: any }[]) => void
|
|
119
|
+
) => {
|
|
114
120
|
if (!props.requestApi) {
|
|
115
121
|
resolve([]);
|
|
116
122
|
return;
|
|
@@ -141,6 +147,8 @@ watch(
|
|
|
141
147
|
{ deep: true, immediate: true }
|
|
142
148
|
);
|
|
143
149
|
|
|
150
|
+
watch(locale, () => updateTreeData(treeData.value));
|
|
151
|
+
|
|
144
152
|
const filterText = ref("");
|
|
145
153
|
watch(filterText, val => {
|
|
146
154
|
treeRef.value!.filter(val);
|