fix: 完善平台国际化覆盖

This commit is contained in:
Nixevol
2026-07-05 00:53:03 +08:00
parent 66d16a6524
commit 4d32a117e2
16 changed files with 295 additions and 111 deletions
+1
View File
@@ -130,6 +130,7 @@
- 追溯码导出 Excel 样式(2026-07-05):`TraceCodeService.exportCodes` 生成的 xlsx 中,表头和数据行统一垂直居中;“链接”列改为 Excel 超链接单元格(蓝色下划线,可单击跟踪链接)。导出仍为内存即时生成 ZIP,不落盘;已用真实接口导出并拆包检查 xlsx,确认存在 hyperlink 关系和 `vertical="center"` 样式。 - 追溯码导出 Excel 样式(2026-07-05):`TraceCodeService.exportCodes` 生成的 xlsx 中,表头和数据行统一垂直居中;“链接”列改为 Excel 超链接单元格(蓝色下划线,可单击跟踪链接)。导出仍为内存即时生成 ZIP,不落盘;已用真实接口导出并拆包检查 xlsx,确认存在 hyperlink 关系和 `vertical="center"` 样式。
- 备案信息配置(2026-07-05):系统设置新增 `filingInfo`,默认“备案信息待补充”,超管可在后台「系统设置 / 基础设置 / 平台信息」中维护。`GET /settings/public` 下发 `filingInfo` 给客户端;后台管理页脚和客户端首页/溯源详情页脚均从设置读取备案信息,后续修改备案号无需改源代码。 - 备案信息配置(2026-07-05):系统设置新增 `filingInfo`,默认“备案信息待补充”,超管可在后台「系统设置 / 基础设置 / 平台信息」中维护。`GET /settings/public` 下发 `filingInfo` 给客户端;后台管理页脚和客户端首页/溯源详情页脚均从设置读取备案信息,后续修改备案号无需改源代码。
- 系统图标配置(2026-07-05):系统设置新增 `appIconUrl`,默认使用前端内置 `/app-icon.svg`。默认 SVG 图标为蓝绿渐变底、盾牌和金色艺术器形/印章元素,无底部横线;后台左上角导航图标、后台登录页图标、客户端首页图标、客户端溯源页顶部图标和浏览器 favicon 均从该设置读取。后台设置页可上传自定义图片/SVG 图标,上传接口已放行 `image/svg+xml` 并按 `.svg` 存储;清空图标设置会回退默认内置图标。 - 系统图标配置(2026-07-05):系统设置新增 `appIconUrl`,默认使用前端内置 `/app-icon.svg`。默认 SVG 图标为蓝绿渐变底、盾牌和金色艺术器形/印章元素,无底部横线;后台左上角导航图标、后台登录页图标、客户端首页图标、客户端溯源页顶部图标和浏览器 favicon 均从该设置读取。后台设置页可上传自定义图片/SVG 图标,上传接口已放行 `image/svg+xml` 并按 `.svg` 存储;清空图标设置会回退默认内置图标。
- 国际化覆盖修复(2026-07-05):后台清理设置页、备份恢复、出库导入、退出确认、表头筛选等用户可见硬编码中文,统一迁入 `apps/admin/src/locales/zh-CN.json` / `en-US.json`;`renderTableFilterTitle` 使用当前 i18n 的“全部/筛选”。全局 `message/dialog/loadingBar` 的 `createDiscreteApi` 现在跟随当前语言、日期语言和主题,避免页面切英文但离散弹窗仍中文。请求拦截器新增错误码翻译优先级:后台接口返回 `code` 时优先使用 `common.errorCode.*`,英文界面下若后端未知 message 含中文则回退英文通用错误,避免中文业务异常直接出现在英文 UI。上传组件失败提示改为语言包文案。客户端首页语言切换按钮从 `SUPPORTED_LOCALES` 读取标签,客户端语言包中的语言名统一为“简体中文 / English”;隐私说明同步移除已废弃的“地区”记录口径。
## 当前代码基准与注意事项 ## 当前代码基准与注意事项
+16 -3
View File
@@ -19,6 +19,19 @@ const instance: AxiosInstance = axios.create({
timeout: 30000, timeout: 30000,
}); });
function resolveErrorMessage(body: any, fallbackKey = 'common.msg.networkError'): string {
if (body?.code !== undefined && body?.code !== null) {
const key = `common.errorCode.${body.code}`;
const translated = i18n.global.t(key);
if (translated !== key) return translated;
}
const rawMessage = body?.message;
if (typeof rawMessage === 'string' && (i18n.global.locale.value !== 'en-US' || !/[\u3400-\u9fff]/.test(rawMessage))) {
return rawMessage;
}
return i18n.global.t(fallbackKey);
}
instance.interceptors.request.use((config) => { instance.interceptors.request.use((config) => {
const token = getToken(); const token = getToken();
if (token) { if (token) {
@@ -39,7 +52,7 @@ instance.interceptors.response.use(
if (body.code === 0) { if (body.code === 0) {
return body.data; return body.data;
} }
message.error(body.message || i18n.global.t('common.msg.networkError')); message.error(resolveErrorMessage(body));
return Promise.reject(body); return Promise.reject(body);
} }
return body; return body;
@@ -49,12 +62,12 @@ instance.interceptors.response.use(
const body = error?.response?.data; const body = error?.response?.data;
if (status === 401) { if (status === 401) {
clearToken(); clearToken();
message.error(body?.message || i18n.global.t('common.msg.loginExpired')); message.error(resolveErrorMessage(body, 'common.msg.loginExpired'));
if (location.hash.indexOf('/login') === -1) { if (location.hash.indexOf('/login') === -1) {
location.hash = '#/login'; location.hash = '#/login';
} }
} else { } else {
message.error(body?.message || i18n.global.t('common.msg.networkError')); message.error(resolveErrorMessage(body));
} }
return Promise.reject(error); return Promise.reject(error);
}, },
@@ -1,19 +1,19 @@
<template> <template>
<div class="backup-panel"> <div class="backup-panel">
<div class="backup-toolbar"> <div class="backup-toolbar">
<n-button type="primary" :loading="creating" @click="createBackup">创建备份</n-button> <n-button type="primary" :loading="creating" @click="createBackup">{{ t('pages.backup.create') }}</n-button>
<n-upload :show-file-list="false" accept=".zip" :custom-request="previewRestore" :disabled="restoring"> <n-upload :show-file-list="false" accept=".zip" :custom-request="previewRestore" :disabled="restoring">
<n-button :loading="restoring">上传备份包预校验</n-button> <n-button :loading="restoring">{{ t('pages.backup.uploadPreview') }}</n-button>
</n-upload> </n-upload>
<n-button @click="load">刷新</n-button> <n-button @click="load">{{ t('common.action.refresh') }}</n-button>
</div> </div>
<n-alert v-if="restorePreviewResult" type="warning" class="restore-alert" :show-icon="true"> <n-alert v-if="restorePreviewResult" type="warning" class="restore-alert" :show-icon="true">
<div class="restore-content"> <div class="restore-content">
<span> <span>
已通过备份包预校验:{{ restorePreviewResult.manifest?.createdAt || '-' }}。恢复会整库覆盖当前系统,确认前会自动生成当前快照。 {{ t('pages.backup.previewPassed', { time: restorePreviewResult.manifest?.createdAt || '-' }) }}
</span> </span>
<n-button size="small" type="error" :loading="restoring" @click="commitRestore">确认恢复</n-button> <n-button size="small" type="error" :loading="restoring" @click="commitRestore">{{ t('pages.backup.confirmRestore') }}</n-button>
</div> </div>
</n-alert> </n-alert>
@@ -37,16 +37,19 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed, h, onMounted, reactive, ref } from 'vue'; import { computed, h, onMounted, reactive, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import type { UploadCustomRequestOptions } from 'naive-ui'; import type { UploadCustomRequestOptions } from 'naive-ui';
import { NButton, NDropdown, NIcon, NTag, type DataTableColumns, type DropdownOption } from 'naive-ui'; import { NButton, NIcon, NTag, type DataTableColumns } from 'naive-ui';
import { DownloadOutline, FilterOutline, TrashOutline } from '@vicons/ionicons5'; import { DownloadOutline, TrashOutline } from '@vicons/ionicons5';
import { backupApi } from '@/api'; import { backupApi } from '@/api';
import { dialog, message } from '@/utils/feedback'; import { dialog, message } from '@/utils/feedback';
import { downloadFile } from '@/utils/download'; import { downloadFile } from '@/utils/download';
import { fmt, statusType } from '@/utils/format'; import { fmt, statusType } from '@/utils/format';
import { useTablePage } from '@/composables/useTablePage'; import { useTablePage } from '@/composables/useTablePage';
import { useRemoteSort } from '@/utils/tableSort'; import { useRemoteSort } from '@/utils/tableSort';
import { renderTableFilterTitle } from '@/utils/tableFilter';
const { t } = useI18n();
const rows = ref<any[]>([]); const rows = ref<any[]>([]);
const loading = ref(false); const loading = ref(false);
const creating = ref(false); const creating = ref(false);
@@ -59,29 +62,30 @@ const { sortProps, onSorterChange, sortParams } = useRemoteSort(() => {
return load(); return load();
}); });
const statusOptions = ['PENDING', 'PROCESSING', 'SUCCESS', 'FAILED'].map((value) => ({ label: value, value })); const statusOptions = computed(() => ['PENDING', 'PROCESSING', 'SUCCESS', 'FAILED'].map((value) => ({ label: t(`common.status.${value}`), value })));
const modeOptions = ['BACKUP', 'RESTORE', 'SCHEDULED', 'AUTO_BEFORE_RESTORE'].map((value) => ({ label: value, value })); const modeOptions = computed(() => ['BACKUP', 'RESTORE', 'SCHEDULED', 'AUTO_BEFORE_RESTORE'].map((value) => ({ label: t(`pages.backup.mode.${value}`), value })));
const columns = computed<DataTableColumns<any>>(() => [ const columns = computed<DataTableColumns<any>>(() => [
{ title: '创建时间', key: 'createdAt', width: 170, align: 'center', render: (row) => fmt(row.createdAt), ...sortProps('createdAt') }, { title: t('common.label.createdAt'), key: 'createdAt', width: 170, align: 'center', render: (row) => fmt(row.createdAt), ...sortProps('createdAt') },
{ title: '文件名', key: 'fileName', minWidth: 360, ellipsis: { tooltip: true } }, { title: t('pages.backup.fileName'), key: 'fileName', minWidth: 360, ellipsis: { tooltip: true } },
{ {
title: () => renderFilterTitle('类型', query.mode, modeOptions, (value) => setFilter('mode', value)), title: () => renderTableFilterTitle(t('common.label.type'), query.mode, modeOptions.value, (value) => setFilter('mode', value ? String(value) : null)),
key: 'mode', key: 'mode',
width: 170, width: 170,
align: 'center', align: 'center',
render: (row) => t(`pages.backup.mode.${row.mode}`),
}, },
{ {
title: () => renderFilterTitle('状态', query.status, statusOptions, (value) => setFilter('status', value)), title: () => renderTableFilterTitle(t('common.label.status'), query.status, statusOptions.value, (value) => setFilter('status', value ? String(value) : null)),
key: 'status', key: 'status',
width: 130, width: 130,
align: 'center', align: 'center',
render: (row) => h(NTag, { size: 'small', type: statusType(row.status) }, { default: () => row.status }), render: (row) => h(NTag, { size: 'small', type: statusType(row.status) }, { default: () => t(`common.status.${row.status}`) }),
}, },
{ title: '大小', key: 'size', width: 120, align: 'center', render: (row) => formatSize(row.size) }, { title: t('pages.backup.size'), key: 'size', width: 120, align: 'center', render: (row) => formatSize(row.size) },
{ title: '错误', key: 'error', minWidth: 320, ellipsis: { tooltip: true }, render: (row) => row.error || '-' }, { title: t('pages.backup.error'), key: 'error', minWidth: 320, ellipsis: { tooltip: true }, render: (row) => row.error || '-' },
{ {
title: '操作', title: t('common.label.operation'),
key: 'ops', key: 'ops',
width: 110, width: 110,
align: 'center', align: 'center',
@@ -95,39 +99,20 @@ const columns = computed<DataTableColumns<any>>(() => [
circle: true, circle: true,
size: 'small', size: 'small',
disabled: row.status !== 'SUCCESS', disabled: row.status !== 'SUCCESS',
title: '下载', title: t('common.action.download'),
onClick: () => downloadBackup(row), onClick: () => downloadBackup(row),
}, },
{ icon: () => h(NIcon, null, { default: () => h(DownloadOutline) }) }, { icon: () => h(NIcon, null, { default: () => h(DownloadOutline) }) },
), ),
h( h(
NButton, NButton,
{ quaternary: true, circle: true, size: 'small', type: 'error', title: '删除', onClick: () => removeBackup(row) }, { quaternary: true, circle: true, size: 'small', type: 'error', title: t('common.action.delete'), onClick: () => removeBackup(row) },
{ icon: () => h(NIcon, null, { default: () => h(TrashOutline) }) }, { icon: () => h(NIcon, null, { default: () => h(TrashOutline) }) },
), ),
]), ]),
}, },
]); ]);
function renderFilterTitle(label: string, value: string | null, options: { label: string; value: string }[], onSelect: (value: string | null) => void) {
const dropdownOptions: DropdownOption[] = [{ label: '全部', key: '__all__' }, ...options.map((item) => ({ label: item.label, key: item.value }))];
return h('div', { class: 'filter-title' }, [
h('span', { class: 'filter-title-text' }, label),
h(
NDropdown,
{ trigger: 'click', options: dropdownOptions, onSelect: (key) => onSelect(key === '__all__' ? null : String(key)) },
{
default: () =>
h(
NButton,
{ quaternary: true, circle: true, size: 'tiny', class: ['filter-trigger', { active: !!value }], title: '筛选' },
{ icon: () => h(NIcon, null, { default: () => h(FilterOutline) }) },
),
},
),
]);
}
function setFilter(field: 'status' | 'mode', value: string | null) { function setFilter(field: 'status' | 'mode', value: string | null) {
query[field] = value; query[field] = value;
resetPage(); resetPage();
@@ -162,7 +147,7 @@ async function createBackup() {
creating.value = true; creating.value = true;
try { try {
await backupApi.create(); await backupApi.create();
message.success('备份已创建'); message.success(t('pages.backup.created'));
await load(); await load();
} finally { } finally {
creating.value = false; creating.value = false;
@@ -175,13 +160,13 @@ async function downloadBackup(row: any) {
function removeBackup(row: any) { function removeBackup(row: any) {
dialog.warning({ dialog.warning({
title: '删除备份', title: t('pages.backup.deleteTitle'),
content: '确认删除该备份记录和服务器上的备份包?', content: t('pages.backup.deleteConfirm'),
positiveText: '确认', positiveText: t('common.action.confirm'),
negativeText: '取消', negativeText: t('common.action.cancel'),
onPositiveClick: async () => { onPositiveClick: async () => {
await backupApi.remove(row.id); await backupApi.remove(row.id);
message.success('已删除'); message.success(t('common.msg.deleted'));
await load(); await load();
}, },
}); });
@@ -193,11 +178,11 @@ async function previewRestore({ file, onFinish, onError }: UploadCustomRequestOp
const fd = new FormData(); const fd = new FormData();
fd.append('file', file.file as File); fd.append('file', file.file as File);
restorePreviewResult.value = await backupApi.restorePreview(fd); restorePreviewResult.value = await backupApi.restorePreview(fd);
message.success('备份包预校验通过'); message.success(t('pages.backup.previewSuccess'));
await load(); await load();
onFinish(); onFinish();
} catch (e) { } catch {
message.error((e as Error)?.message || '预校验失败'); message.error(t('pages.backup.previewFailed'));
onError(); onError();
} finally { } finally {
restoring.value = false; restoring.value = false;
@@ -207,16 +192,16 @@ async function previewRestore({ file, onFinish, onError }: UploadCustomRequestOp
function commitRestore() { function commitRestore() {
if (!restorePreviewResult.value?.restoreId) return; if (!restorePreviewResult.value?.restoreId) return;
dialog.warning({ dialog.warning({
title: '确认恢复', title: t('pages.backup.restoreTitle'),
content: '恢复会覆盖当前数据库和上传文件。系统会先自动备份当前状态,确认继续?', content: t('pages.backup.restoreConfirm'),
positiveText: '确认恢复', positiveText: t('pages.backup.confirmRestore'),
negativeText: '取消', negativeText: t('common.action.cancel'),
onPositiveClick: async () => { onPositiveClick: async () => {
restoring.value = true; restoring.value = true;
try { try {
await backupApi.restoreCommit(restorePreviewResult.value.restoreId); await backupApi.restoreCommit(restorePreviewResult.value.restoreId);
restorePreviewResult.value = null; restorePreviewResult.value = null;
message.success('恢复完成,请重新检查数据'); message.success(t('pages.backup.restoreDone'));
await load(); await load();
} finally { } finally {
restoring.value = false; restoring.value = false;
+2 -2
View File
@@ -106,8 +106,8 @@ async function uploadOne(file: File) {
...list.value, ...list.value,
{ key: res.key, url: res.url, name: props.captionable ? '' : res.name, type }, { key: res.key, url: res.url, name: props.captionable ? '' : res.name, type },
]); ]);
} catch (err) { } catch {
message.error((err as Error)?.message || 'upload failed'); message.error(t('common.msg.uploadFailed'));
} finally { } finally {
uploading.value = uploading.value.filter((u) => u.id !== holder.id); uploading.value = uploading.value.filter((u) => u.id !== holder.id);
} }
+2 -2
View File
@@ -106,8 +106,8 @@ async function uploadOne(file: File) {
...items.value, ...items.value,
{ key: res.key, url: res.url, name: res.name || file.name, type: props.type }, { key: res.key, url: res.url, name: res.name || file.name, type: props.type },
]); ]);
} catch (err: any) { } catch {
message.error(err?.message || 'upload failed'); message.error(t('common.msg.uploadFailed'));
} finally { } finally {
uploading.value = uploading.value.filter((u) => u.id !== holder.id); uploading.value = uploading.value.filter((u) => u.id !== holder.id);
} }
+1 -1
View File
@@ -129,7 +129,7 @@ function onUser(key: string) {
} else if (key === 'logout') { } else if (key === 'logout') {
dialog.warning({ dialog.warning({
title: t('common.action.logout'), title: t('common.action.logout'),
content: '确定退出登录?', content: t('common.msg.logoutConfirm'),
positiveText: t('common.action.confirm'), positiveText: t('common.action.confirm'),
negativeText: t('common.action.cancel'), negativeText: t('common.action.cancel'),
onPositiveClick: () => { onPositiveClick: () => {
+84 -3
View File
@@ -29,7 +29,8 @@
"apply": "Apply", "apply": "Apply",
"open": "Open", "open": "Open",
"changePassword": "Change Password", "changePassword": "Change Password",
"logout": "Logout" "logout": "Logout",
"filter": "Filter"
}, },
"label": { "label": {
"keyword": "Keyword", "keyword": "Keyword",
@@ -118,7 +119,38 @@
"loginExpired": "Session expired, please log in again", "loginExpired": "Session expired, please log in again",
"networkError": "Network error, please try again", "networkError": "Network error, please try again",
"noData": "No data", "noData": "No data",
"maxReached": "Up to {n} files" "maxReached": "Up to {n} files",
"uploadFailed": "Upload failed",
"logoutConfirm": "Are you sure you want to log out?"
},
"errorCode": {
"1000": "Invalid request",
"1001": "Not logged in or session expired",
"1002": "You do not have permission",
"1003": "Resource not found",
"1004": "Validation failed",
"1005": "Internal server error",
"1006": "Too many requests. Please try again later.",
"2001": "Incorrect username or password",
"2002": "Session expired. Please log in again.",
"2003": "This account has been disabled",
"2004": "Current password is incorrect",
"2005": "Username already exists",
"3001": "Template not found",
"3002": "Template is in use and cannot be deleted",
"3003": "Artwork not found",
"3004": "Trace code not found",
"3005": "Trace code is invalid",
"3006": "Trace code has been disabled",
"3007": "Trace code status is abnormal",
"3008": "Trace code is already bound to an artwork",
"3009": "Import file parsing failed",
"3010": "File type is not supported",
"3011": "File exceeds the size limit",
"3012": "Certificate not found",
"3013": "Task not found",
"3014": "Batch not found",
"3015": "Artwork file has business data and cannot be deleted"
}, },
"lang": { "zh": "Simplified Chinese", "en": "English" } "lang": { "zh": "Simplified Chinese", "en": "English" }
}, },
@@ -289,6 +321,7 @@
"assignGroup": "Assign group" "assignGroup": "Assign group"
}, },
"outbound": { "outbound": {
"batchImportTitle": "Outbound Batch Import",
"import": "Batch Import", "import": "Batch Import",
"outTime": "Outbound Time", "outTime": "Outbound Time",
"outImage": "Outbound Photo", "outImage": "Outbound Photo",
@@ -314,7 +347,21 @@
"errorReason": "Error", "errorReason": "Error",
"previewReady": "Preview parsed", "previewReady": "Preview parsed",
"uploadFailed": "Upload failed", "uploadFailed": "Upload failed",
"importDone": "Import completed" "importDone": "Import completed",
"rowStatus": {
"VALID": "Valid",
"INVALID": "Invalid",
"IMPORTED": "Imported",
"FAILED": "Failed"
},
"sessionStatus": {
"PARSING": "Parsing",
"READY": "Ready",
"IMPORTING": "Importing",
"IMPORTED": "Imported",
"FAILED": "Failed",
"EXPIRED": "Expired"
}
}, },
"blockchain": { "blockchain": {
"title": "Blockchain Attestation", "title": "Blockchain Attestation",
@@ -346,6 +393,10 @@
"lastLoginAt": "Last Login" "lastLoginAt": "Last Login"
}, },
"settings": { "settings": {
"baseSettings": "Basic Settings",
"platformInfo": "Platform Info",
"logAndDisplay": "Logs & Display",
"backupPolicy": "Backup Policy",
"appName": "Platform Name", "appName": "Platform Name",
"appIcon": "System Icon", "appIcon": "System Icon",
"logRetentionDays": "Query Log Retention (days)", "logRetentionDays": "Query Log Retention (days)",
@@ -354,6 +405,12 @@
"filingInfo": "Filing Info", "filingInfo": "Filing Info",
"carouselInterval": "Client Carousel Interval (s)", "carouselInterval": "Client Carousel Interval (s)",
"carouselIntervalHint": "Seconds each media stays; decimals allowed. 0 disables auto-advance (manual loop still works).", "carouselIntervalHint": "Seconds each media stays; decimals allowed. 0 disables auto-advance (manual loop still works).",
"backupEnabled": "Enable Scheduled Backup",
"backupSchedule": "Backup Schedule",
"backupRetentionDays": "Backup Retention Days",
"backupRetentionCount": "Max Backup Count",
"scheduleDaily": "Daily",
"scheduleWeekly": "Weekly",
"saved": "Settings saved" "saved": "Settings saved"
}, },
"profile": { "profile": {
@@ -402,6 +459,30 @@
"restore": "Restore backup", "restore": "Restore backup",
"upload": "Upload file" "upload": "Upload file"
} }
},
"backup": {
"title": "Backup & Restore",
"create": "Create Backup",
"uploadPreview": "Upload Backup for Pre-check",
"previewPassed": "Backup package passed pre-check: {time}. Restore will overwrite the current system; a snapshot will be created before confirmation.",
"confirmRestore": "Confirm Restore",
"fileName": "File Name",
"size": "Size",
"error": "Error",
"created": "Backup created",
"deleteTitle": "Delete Backup",
"deleteConfirm": "Delete this backup record and the backup package on the server?",
"previewSuccess": "Backup package pre-check passed",
"previewFailed": "Pre-check failed",
"restoreTitle": "Confirm Restore",
"restoreConfirm": "Restore will overwrite the current database and uploaded files. The system will create a backup first. Continue?",
"restoreDone": "Restore completed. Please check the data again.",
"mode": {
"BACKUP": "Manual Backup",
"RESTORE": "Restore",
"SCHEDULED": "Scheduled Backup",
"AUTO_BEFORE_RESTORE": "Auto Snapshot Before Restore"
}
} }
} }
} }
+84 -3
View File
@@ -29,7 +29,8 @@
"apply": "应用", "apply": "应用",
"open": "打开", "open": "打开",
"changePassword": "修改密码", "changePassword": "修改密码",
"logout": "退出登录" "logout": "退出登录",
"filter": "筛选"
}, },
"label": { "label": {
"keyword": "关键词", "keyword": "关键词",
@@ -118,7 +119,38 @@
"loginExpired": "登录已过期,请重新登录", "loginExpired": "登录已过期,请重新登录",
"networkError": "网络异常,请稍后再试", "networkError": "网络异常,请稍后再试",
"noData": "暂无数据", "noData": "暂无数据",
"maxReached": "最多上传 {n} 个" "maxReached": "最多上传 {n} 个",
"uploadFailed": "上传失败",
"logoutConfirm": "确定退出登录?"
},
"errorCode": {
"1000": "请求参数有误",
"1001": "未登录或登录已过期",
"1002": "没有操作权限",
"1003": "资源不存在",
"1004": "数据校验失败",
"1005": "服务器内部错误",
"1006": "请求过于频繁,请稍后再试",
"2001": "用户名或密码错误",
"2002": "登录已过期,请重新登录",
"2003": "账号已被停用",
"2004": "原密码不正确",
"2005": "用户名已存在",
"3001": "模板不存在",
"3002": "模板已被使用,无法删除",
"3003": "艺术品不存在",
"3004": "追溯码不存在",
"3005": "追溯码无效",
"3006": "追溯码已停用",
"3007": "追溯码状态异常",
"3008": "追溯码已绑定作品",
"3009": "导入文件解析失败",
"3010": "不支持的文件类型",
"3011": "文件超出大小限制",
"3012": "认证文件不存在",
"3013": "任务不存在",
"3014": "批次不存在",
"3015": "艺术品档案已有业务数据,无法删除"
}, },
"lang": { "zh": "简体中文", "en": "English" } "lang": { "zh": "简体中文", "en": "English" }
}, },
@@ -289,6 +321,7 @@
"assignGroup": "设为分组" "assignGroup": "设为分组"
}, },
"outbound": { "outbound": {
"batchImportTitle": "出库批量导入",
"import": "批量导入", "import": "批量导入",
"outTime": "出库时间", "outTime": "出库时间",
"outImage": "出库实况图", "outImage": "出库实况图",
@@ -314,7 +347,21 @@
"errorReason": "错误原因", "errorReason": "错误原因",
"previewReady": "预览解析完成", "previewReady": "预览解析完成",
"uploadFailed": "上传失败", "uploadFailed": "上传失败",
"importDone": "导入完成" "importDone": "导入完成",
"rowStatus": {
"VALID": "有效",
"INVALID": "无效",
"IMPORTED": "已导入",
"FAILED": "失败"
},
"sessionStatus": {
"PARSING": "解析中",
"READY": "待导入",
"IMPORTING": "导入中",
"IMPORTED": "已导入",
"FAILED": "失败",
"EXPIRED": "已过期"
}
}, },
"blockchain": { "blockchain": {
"title": "区块链存证", "title": "区块链存证",
@@ -346,6 +393,10 @@
"lastLoginAt": "最近登录" "lastLoginAt": "最近登录"
}, },
"settings": { "settings": {
"baseSettings": "基础设置",
"platformInfo": "平台信息",
"logAndDisplay": "日志与展示",
"backupPolicy": "备份策略",
"appName": "平台名称", "appName": "平台名称",
"appIcon": "系统图标", "appIcon": "系统图标",
"logRetentionDays": "查询日志保留天数", "logRetentionDays": "查询日志保留天数",
@@ -354,6 +405,12 @@
"filingInfo": "备案信息", "filingInfo": "备案信息",
"carouselInterval": "客户端轮播间隔(秒)", "carouselInterval": "客户端轮播间隔(秒)",
"carouselIntervalHint": "每张媒体停留秒数,支持小数;填 0 则不自动切换(仍可手动循环切换)", "carouselIntervalHint": "每张媒体停留秒数,支持小数;填 0 则不自动切换(仍可手动循环切换)",
"backupEnabled": "启用定时备份",
"backupSchedule": "备份周期",
"backupRetentionDays": "备份保留天数",
"backupRetentionCount": "最多保留备份数量",
"scheduleDaily": "每天",
"scheduleWeekly": "每周",
"saved": "设置已保存" "saved": "设置已保存"
}, },
"profile": { "profile": {
@@ -402,6 +459,30 @@
"restore": "恢复备份", "restore": "恢复备份",
"upload": "上传文件" "upload": "上传文件"
} }
},
"backup": {
"title": "备份与恢复",
"create": "创建备份",
"uploadPreview": "上传备份包预校验",
"previewPassed": "已通过备份包预校验:{time}。恢复会整库覆盖当前系统,确认前会自动生成当前快照。",
"confirmRestore": "确认恢复",
"fileName": "文件名",
"size": "大小",
"error": "错误",
"created": "备份已创建",
"deleteTitle": "删除备份",
"deleteConfirm": "确认删除该备份记录和服务器上的备份包?",
"previewSuccess": "备份包预校验通过",
"previewFailed": "预校验失败",
"restoreTitle": "确认恢复",
"restoreConfirm": "恢复会覆盖当前数据库和上传文件。系统会先自动备份当前状态,确认继续?",
"restoreDone": "恢复完成,请重新检查数据",
"mode": {
"BACKUP": "手动备份",
"RESTORE": "恢复",
"SCHEDULED": "定时备份",
"AUTO_BEFORE_RESTORE": "恢复前自动快照"
}
} }
} }
} }
+14 -2
View File
@@ -1,9 +1,21 @@
import { createDiscreteApi } from 'naive-ui'; import { computed } from 'vue';
import { createDiscreteApi, darkTheme, dateEnUS, dateZhCN, enUS, zhCN } from 'naive-ui';
import { i18n } from '@/locales';
import { themeOverrides } from '@/theme'; import { themeOverrides } from '@/theme';
import { useTheme } from '@/composables/useTheme';
// 全局可用的消息/对话框/加载条(含在 setup 之外,如 axios 拦截器) // 全局可用的消息/对话框/加载条(含在 setup 之外,如 axios 拦截器)
const { isDark } = useTheme();
const { message, dialog, loadingBar } = createDiscreteApi(['message', 'dialog', 'loadingBar'], { const { message, dialog, loadingBar } = createDiscreteApi(['message', 'dialog', 'loadingBar'], {
configProviderProps: { themeOverrides }, configProviderProps: computed(() => {
const isEnglish = i18n.global.locale.value === 'en-US';
return {
theme: isDark.value ? darkTheme : null,
themeOverrides,
locale: isEnglish ? enUS : zhCN,
dateLocale: isEnglish ? dateEnUS : dateZhCN,
};
}),
}); });
export { message, dialog, loadingBar }; export { message, dialog, loadingBar };
+3 -2
View File
@@ -1,6 +1,7 @@
import { h } from 'vue'; import { h } from 'vue';
import { NButton, NDropdown, NIcon, type DropdownOption } from 'naive-ui'; import { NButton, NDropdown, NIcon, type DropdownOption } from 'naive-ui';
import { FilterOutline } from '@vicons/ionicons5'; import { FilterOutline } from '@vicons/ionicons5';
import { i18n } from '@/locales';
export interface TableFilterOption { export interface TableFilterOption {
label: string; label: string;
@@ -12,7 +13,7 @@ export function renderTableFilterTitle(
value: string | number | null | undefined, value: string | number | null | undefined,
options: TableFilterOption[], options: TableFilterOption[],
onSelect: (value: string | number | null) => void, onSelect: (value: string | number | null) => void,
allLabel = '全部', allLabel = i18n.global.t('common.label.all'),
) { ) {
const active = value !== null && value !== undefined && value !== ''; const active = value !== null && value !== undefined && value !== '';
const dropdownOptions: DropdownOption[] = [ const dropdownOptions: DropdownOption[] = [
@@ -32,7 +33,7 @@ export function renderTableFilterTitle(
default: () => default: () =>
h( h(
NButton, NButton,
{ quaternary: true, circle: true, size: 'tiny', class: ['filter-trigger', { active }], title: '筛选' }, { quaternary: true, circle: true, size: 'tiny', class: ['filter-trigger', { active }], title: i18n.global.t('common.action.filter') },
{ icon: () => h(NIcon, null, { default: () => h(FilterOutline) }) }, { icon: () => h(NIcon, null, { default: () => h(FilterOutline) }) },
), ),
}, },
+33 -23
View File
@@ -1,11 +1,11 @@
<template> <template>
<div class="page table-page outbound-page"> <div class="page table-page outbound-page">
<div class="page-toolbar outbound-toolbar"> <div class="page-toolbar outbound-toolbar">
<div class="section-title">出库批量导入</div> <div class="section-title">{{ t('pages.outbound.batchImportTitle') }}</div>
<div class="spacer" /> <div class="spacer" />
<n-button :title="'下载模板包'" @click="downloadTemplate"> <n-button :title="t('pages.outbound.downloadZipTemplate')" @click="downloadTemplate">
<template #icon><n-icon :component="DownloadOutline" /></template> <template #icon><n-icon :component="DownloadOutline" /></template>
下载模板包 {{ t('pages.outbound.downloadZipTemplate') }}
</n-button> </n-button>
<n-upload <n-upload
:show-file-list="false" :show-file-list="false"
@@ -15,21 +15,21 @@
> >
<n-button type="primary" :loading="previewing"> <n-button type="primary" :loading="previewing">
<template #icon><n-icon :component="CloudUploadOutline" /></template> <template #icon><n-icon :component="CloudUploadOutline" /></template>
上传并预览 {{ t('pages.outbound.uploadZipPreview') }}
</n-button> </n-button>
</n-upload> </n-upload>
</div> </div>
<n-card v-if="session" embedded class="summary-card" :bordered="false"> <n-card v-if="session" embedded class="summary-card" :bordered="false">
<n-space align="center" size="large" wrap> <n-space align="center" size="large" wrap>
<n-statistic label="总行数" :value="session.total || 0" /> <n-statistic :label="t('pages.outbound.totalRows')" :value="session.total || 0" />
<n-statistic label="有效行"> <n-statistic :label="t('pages.outbound.validRows')">
<span class="success-text">{{ session.validCount || 0 }}</span> <span class="success-text">{{ session.validCount || 0 }}</span>
</n-statistic> </n-statistic>
<n-statistic label="错误行"> <n-statistic :label="t('pages.outbound.invalidRows')">
<span class="danger-text">{{ session.invalidCount || 0 }}</span> <span class="danger-text">{{ session.invalidCount || 0 }}</span>
</n-statistic> </n-statistic>
<n-tag :type="statusType(session.status)">{{ session.status }}</n-tag> <n-tag :type="statusType(session.status)">{{ sessionStatusLabel(session.status) }}</n-tag>
<n-progress <n-progress
v-if="busy" v-if="busy"
type="line" type="line"
@@ -44,11 +44,11 @@
:loading="committing" :loading="committing"
@click="commitImport" @click="commitImport"
> >
确认导入 {{ t('pages.outbound.confirmImport') }}
</n-button> </n-button>
<n-button v-if="result?.resultFileUrl" tag="a" :href="result.resultFileUrl" target="_blank"> <n-button v-if="result?.resultFileUrl" tag="a" :href="result.resultFileUrl" target="_blank">
<template #icon><n-icon :component="DownloadOutline" /></template> <template #icon><n-icon :component="DownloadOutline" /></template>
下载导入结果 {{ t('pages.outbound.downloadResult') }}
</n-button> </n-button>
</n-space> </n-space>
<n-text v-if="session.error" type="error" class="session-error">{{ session.error }}</n-text> <n-text v-if="session.error" type="error" class="session-error">{{ session.error }}</n-text>
@@ -74,6 +74,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed, h, ref } from 'vue'; import { computed, h, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import type { UploadCustomRequestOptions } from 'naive-ui'; import type { UploadCustomRequestOptions } from 'naive-ui';
import { NButton, NIcon, NImage, NTag, NText, type DataTableColumns } from 'naive-ui'; import { NButton, NIcon, NImage, NTag, NText, type DataTableColumns } from 'naive-ui';
import { CloudUploadOutline, DownloadOutline } from '@vicons/ionicons5'; import { CloudUploadOutline, DownloadOutline } from '@vicons/ionicons5';
@@ -86,6 +87,7 @@ import { useTablePage } from '@/composables/useTablePage';
import { openMediaViewer } from '@/composables/openMediaViewer'; import { openMediaViewer } from '@/composables/openMediaViewer';
import { useRemoteSort } from '@/utils/tableSort'; import { useRemoteSort } from '@/utils/tableSort';
const { t } = useI18n();
const auth = useAuthStore(); const auth = useAuthStore();
const rows = ref<any[]>([]); const rows = ref<any[]>([]);
const session = ref<any>(null); const session = ref<any>(null);
@@ -105,28 +107,28 @@ const { sortProps, onSorterChange, sortParams } = useRemoteSort(() => {
}); });
const columns = computed<DataTableColumns<any>>(() => [ const columns = computed<DataTableColumns<any>>(() => [
{ title: '行号', key: 'rowNo', width: 80, align: 'center' }, { title: t('pages.outbound.rowNo'), key: 'rowNo', width: 80, align: 'center' },
{ {
title: '状态', title: t('common.label.status'),
key: 'status', key: 'status',
width: 110, width: 110,
align: 'center', align: 'center',
render: (row) => h(NTag, { size: 'small', type: row.status === 'VALID' || row.status === 'IMPORTED' ? 'success' : 'error' }, { default: () => row.status }), render: (row) => h(NTag, { size: 'small', type: row.status === 'VALID' || row.status === 'IMPORTED' ? 'success' : 'error' }, { default: () => statusLabel(row.status) }),
}, },
{ title: '追溯码', key: 'shortCode', minWidth: 150, align: 'center', ellipsis: { tooltip: true } }, { title: t('pages.traceCode.shortCode'), key: 'shortCode', minWidth: 150, align: 'center', ellipsis: { tooltip: true } },
{ title: '批次编号', key: 'batchNo', minWidth: 180, align: 'center', ellipsis: { tooltip: true } }, { title: t('pages.traceCode.batchNo'), key: 'batchNo', minWidth: 180, align: 'center', ellipsis: { tooltip: true } },
{ title: '出库时间', key: 'outTime', width: 170, align: 'center', render: (row) => fmt(row.outTime || row.preview?.outTime), ...sortProps('outTime') }, { title: t('pages.outbound.outTime'), key: 'outTime', width: 170, align: 'center', render: (row) => fmt(row.outTime || row.preview?.outTime), ...sortProps('outTime') },
{ {
title: '出库实况图', title: t('pages.outbound.outImage'),
key: 'images', key: 'images',
width: 240, width: 240,
align: 'center', align: 'center',
render: (row) => renderImages(row), render: (row) => renderImages(row),
}, },
{ title: '上链哈希', key: 'txHash', minWidth: 260, ellipsis: { tooltip: true } }, { title: t('pages.blockchain.txHash'), key: 'txHash', minWidth: 260, ellipsis: { tooltip: true } },
{ title: '备注', key: 'remark', minWidth: 220, ellipsis: { tooltip: true } }, { title: t('common.label.remark'), key: 'remark', minWidth: 220, ellipsis: { tooltip: true } },
{ {
title: '错误原因', title: t('pages.outbound.errorReason'),
key: 'reason', key: 'reason',
minWidth: 300, minWidth: 300,
ellipsis: { tooltip: true }, ellipsis: { tooltip: true },
@@ -188,10 +190,10 @@ async function uploadPreview({ file, onFinish, onError }: UploadCustomRequestOpt
await refreshSession(); await refreshSession();
resetPage(); resetPage();
await loadRows(); await loadRows();
message.success('预览解析完成'); message.success(t('pages.outbound.previewReady'));
onFinish(); onFinish();
} catch (e) { } catch (e) {
message.error((e as Error)?.message || '上传失败'); message.error(t('pages.outbound.uploadFailed'));
onError(); onError();
} finally { } finally {
previewing.value = false; previewing.value = false;
@@ -210,7 +212,7 @@ async function commitImport() {
result.value = job; result.value = job;
await refreshSession(); await refreshSession();
await loadRows(); await loadRows();
message.success('导入完成'); message.success(t('pages.outbound.importDone'));
} finally { } finally {
committing.value = false; committing.value = false;
progressPercent.value = 0; progressPercent.value = 0;
@@ -261,6 +263,14 @@ async function loadRows() {
loading.value = false; loading.value = false;
} }
} }
function statusLabel(value?: string) {
return value ? t(`pages.outbound.rowStatus.${value}`) : '-';
}
function sessionStatusLabel(value?: string) {
return value ? t(`pages.outbound.sessionStatus.${value}`) : '-';
}
</script> </script>
<style scoped> <style scoped>
+11 -11
View File
@@ -2,11 +2,11 @@
<div class="page settings-page"> <div class="page settings-page">
<div class="settings-shell"> <div class="settings-shell">
<n-tabs type="line" animated class="settings-tabs"> <n-tabs type="line" animated class="settings-tabs">
<n-tab-pane name="base" tab="基础设置"> <n-tab-pane name="base" :tab="t('pages.settings.baseSettings')">
<div class="settings-base-pane"> <div class="settings-base-pane">
<n-form class="settings-form" label-placement="top"> <n-form class="settings-form" label-placement="top">
<section class="settings-section"> <section class="settings-section">
<div class="section-title">平台信息</div> <div class="section-title">{{ t('pages.settings.platformInfo') }}</div>
<div class="field-grid two"> <div class="field-grid two">
<n-form-item :label="t('pages.settings.appName')"> <n-form-item :label="t('pages.settings.appName')">
<n-input v-model:value="form.appName" class="control-wide" /> <n-input v-model:value="form.appName" class="control-wide" />
@@ -27,7 +27,7 @@
</section> </section>
<section class="settings-section"> <section class="settings-section">
<div class="section-title">日志与展示</div> <div class="section-title">{{ t('pages.settings.logAndDisplay') }}</div>
<div class="field-grid three"> <div class="field-grid three">
<n-form-item :label="t('pages.settings.logRetentionDays')"> <n-form-item :label="t('pages.settings.logRetentionDays')">
<n-input-number v-model:value="form.logRetentionDays" :min="1" class="control-short" /> <n-input-number v-model:value="form.logRetentionDays" :min="1" class="control-short" />
@@ -52,18 +52,18 @@
</section> </section>
<section class="settings-section"> <section class="settings-section">
<div class="section-title">备份策略</div> <div class="section-title">{{ t('pages.settings.backupPolicy') }}</div>
<div class="field-grid four"> <div class="field-grid four">
<n-form-item label="启用定时备份"> <n-form-item :label="t('pages.settings.backupEnabled')">
<div class="switch-field"><n-switch v-model:value="form.backupEnabled" /></div> <div class="switch-field"><n-switch v-model:value="form.backupEnabled" /></div>
</n-form-item> </n-form-item>
<n-form-item label="备份周期"> <n-form-item :label="t('pages.settings.backupSchedule')">
<n-select v-model:value="form.backupSchedule" :options="backupScheduleOptions" class="control-short" /> <n-select v-model:value="form.backupSchedule" :options="backupScheduleOptions" class="control-short" />
</n-form-item> </n-form-item>
<n-form-item label="备份保留天数"> <n-form-item :label="t('pages.settings.backupRetentionDays')">
<n-input-number v-model:value="form.backupRetentionDays" :min="1" class="control-short" /> <n-input-number v-model:value="form.backupRetentionDays" :min="1" class="control-short" />
</n-form-item> </n-form-item>
<n-form-item label="最多保留备份数量"> <n-form-item :label="t('pages.settings.backupRetentionCount')">
<n-input-number v-model:value="form.backupRetentionCount" :min="1" class="control-short" /> <n-input-number v-model:value="form.backupRetentionCount" :min="1" class="control-short" />
</n-form-item> </n-form-item>
</div> </div>
@@ -76,7 +76,7 @@
</div> </div>
</n-tab-pane> </n-tab-pane>
<n-tab-pane name="backup" tab="备份与恢复"> <n-tab-pane name="backup" :tab="t('pages.backup.title')">
<div class="settings-backup-pane"> <div class="settings-backup-pane">
<backup-restore-panel /> <backup-restore-panel />
</div> </div>
@@ -98,8 +98,8 @@ import { DEFAULT_APP_ICON_URL, resolveAppIcon, setFavicon } from '@/utils/appIco
const { t } = useI18n(); const { t } = useI18n();
const saving = ref(false); const saving = ref(false);
const backupScheduleOptions = [ const backupScheduleOptions = [
{ label: '每天', value: 'daily' }, { label: t('pages.settings.scheduleDaily'), value: 'daily' },
{ label: '每周', value: 'weekly' }, { label: t('pages.settings.scheduleWeekly'), value: 'weekly' },
]; ];
const form = reactive({ const form = reactive({
appName: '', appName: '',
+2 -2
View File
@@ -44,7 +44,7 @@
"viewFile": "View file" "viewFile": "View file"
}, },
"privacy": { "privacy": {
"note": "Privacy: for anti-counterfeit risk control and query statistics, this visit's necessary info (time, IP, region and device) is recorded." "note": "Privacy: for anti-counterfeit risk control and query statistics, this visit's necessary info (time, IP and device) is recorded."
}, },
"state": { "state": {
"loading": "Loading…", "loading": "Loading…",
@@ -64,5 +64,5 @@
"next": "Next" "next": "Next"
}, },
"artist": "Artist", "artist": "Artist",
"lang": { "zh": "中文", "en": "EN", "switch": "Switch language" } "lang": { "zh": "Simplified Chinese", "en": "English", "switch": "Switch language" }
} }
+1 -1
View File
@@ -6,7 +6,7 @@ const KEY = 'artveris_client_locale';
// 支持的语言列表(后续新增语言只需在此追加) // 支持的语言列表(后续新增语言只需在此追加)
export const SUPPORTED_LOCALES = [ export const SUPPORTED_LOCALES = [
{ value: 'zh-CN', label: '中文' }, { value: 'zh-CN', label: '简体中文' },
{ value: 'en-US', label: 'English' }, { value: 'en-US', label: 'English' },
]; ];
+2 -2
View File
@@ -44,7 +44,7 @@
"viewFile": "查看文件" "viewFile": "查看文件"
}, },
"privacy": { "privacy": {
"note": "隐私说明:为防伪风控与查询统计,系统会记录本次访问的必要信息(如访问时间、IP、地区与设备信息)。" "note": "隐私说明:为防伪风控与查询统计,系统会记录本次访问的必要信息(如访问时间、IP 与设备信息)。"
}, },
"state": { "state": {
"loading": "正在查询…", "loading": "正在查询…",
@@ -64,5 +64,5 @@
"next": "下一个" "next": "下一个"
}, },
"artist": "艺术家", "artist": "艺术家",
"lang": { "zh": "中文", "en": "EN", "switch": "切换语言" } "lang": { "zh": "简体中文", "en": "English", "switch": "切换语言" }
} }
+2 -2
View File
@@ -15,14 +15,14 @@
import { computed, onMounted, ref } from 'vue'; import { computed, onMounted, ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { fetchAppInfo } from '@/api'; import { fetchAppInfo } from '@/api';
import { setLocale } from '@/locales'; import { setLocale, SUPPORTED_LOCALES } from '@/locales';
import { resolveAppIcon, setFavicon } from '@/utils/appIcon'; import { resolveAppIcon, setFavicon } from '@/utils/appIcon';
const { t, locale } = useI18n(); const { t, locale } = useI18n();
const appName = ref(''); const appName = ref('');
const appIconUrl = ref(resolveAppIcon()); const appIconUrl = ref(resolveAppIcon());
const filingInfo = ref(''); const filingInfo = ref('');
const otherLangLabel = computed(() => (locale.value === 'zh-CN' ? 'EN' : '中文')); const otherLangLabel = computed(() => SUPPORTED_LOCALES.find((item) => item.value !== locale.value)?.label || 'English');
function toggleLang() { function toggleLang() {
setLocale(locale.value === 'zh-CN' ? 'en-US' : 'zh-CN'); setLocale(locale.value === 'zh-CN' ? 'en-US' : 'zh-CN');
} }