fix: 完善平台国际化覆盖
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
<template>
|
||||
<div class="page table-page outbound-page">
|
||||
<div class="page-toolbar outbound-toolbar">
|
||||
<div class="section-title">出库批量导入</div>
|
||||
<div class="section-title">{{ t('pages.outbound.batchImportTitle') }}</div>
|
||||
<div class="spacer" />
|
||||
<n-button :title="'下载模板包'" @click="downloadTemplate">
|
||||
<n-button :title="t('pages.outbound.downloadZipTemplate')" @click="downloadTemplate">
|
||||
<template #icon><n-icon :component="DownloadOutline" /></template>
|
||||
下载模板包
|
||||
{{ t('pages.outbound.downloadZipTemplate') }}
|
||||
</n-button>
|
||||
<n-upload
|
||||
:show-file-list="false"
|
||||
@@ -15,21 +15,21 @@
|
||||
>
|
||||
<n-button type="primary" :loading="previewing">
|
||||
<template #icon><n-icon :component="CloudUploadOutline" /></template>
|
||||
上传并预览
|
||||
{{ t('pages.outbound.uploadZipPreview') }}
|
||||
</n-button>
|
||||
</n-upload>
|
||||
</div>
|
||||
|
||||
<n-card v-if="session" embedded class="summary-card" :bordered="false">
|
||||
<n-space align="center" size="large" wrap>
|
||||
<n-statistic label="总行数" :value="session.total || 0" />
|
||||
<n-statistic label="有效行">
|
||||
<n-statistic :label="t('pages.outbound.totalRows')" :value="session.total || 0" />
|
||||
<n-statistic :label="t('pages.outbound.validRows')">
|
||||
<span class="success-text">{{ session.validCount || 0 }}</span>
|
||||
</n-statistic>
|
||||
<n-statistic label="错误行">
|
||||
<n-statistic :label="t('pages.outbound.invalidRows')">
|
||||
<span class="danger-text">{{ session.invalidCount || 0 }}</span>
|
||||
</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
|
||||
v-if="busy"
|
||||
type="line"
|
||||
@@ -44,11 +44,11 @@
|
||||
:loading="committing"
|
||||
@click="commitImport"
|
||||
>
|
||||
确认导入
|
||||
{{ t('pages.outbound.confirmImport') }}
|
||||
</n-button>
|
||||
<n-button v-if="result?.resultFileUrl" tag="a" :href="result.resultFileUrl" target="_blank">
|
||||
<template #icon><n-icon :component="DownloadOutline" /></template>
|
||||
下载导入结果
|
||||
{{ t('pages.outbound.downloadResult') }}
|
||||
</n-button>
|
||||
</n-space>
|
||||
<n-text v-if="session.error" type="error" class="session-error">{{ session.error }}</n-text>
|
||||
@@ -74,6 +74,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, h, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import type { UploadCustomRequestOptions } from 'naive-ui';
|
||||
import { NButton, NIcon, NImage, NTag, NText, type DataTableColumns } from 'naive-ui';
|
||||
import { CloudUploadOutline, DownloadOutline } from '@vicons/ionicons5';
|
||||
@@ -86,6 +87,7 @@ import { useTablePage } from '@/composables/useTablePage';
|
||||
import { openMediaViewer } from '@/composables/openMediaViewer';
|
||||
import { useRemoteSort } from '@/utils/tableSort';
|
||||
|
||||
const { t } = useI18n();
|
||||
const auth = useAuthStore();
|
||||
const rows = ref<any[]>([]);
|
||||
const session = ref<any>(null);
|
||||
@@ -105,28 +107,28 @@ const { sortProps, onSorterChange, sortParams } = useRemoteSort(() => {
|
||||
});
|
||||
|
||||
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',
|
||||
width: 110,
|
||||
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: '批次编号', 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.traceCode.shortCode'), key: 'shortCode', minWidth: 150, align: 'center', ellipsis: { tooltip: true } },
|
||||
{ title: t('pages.traceCode.batchNo'), key: 'batchNo', minWidth: 180, align: 'center', ellipsis: { tooltip: true } },
|
||||
{ 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',
|
||||
width: 240,
|
||||
align: 'center',
|
||||
render: (row) => renderImages(row),
|
||||
},
|
||||
{ title: '上链哈希', key: 'txHash', minWidth: 260, ellipsis: { tooltip: true } },
|
||||
{ title: '备注', key: 'remark', minWidth: 220, ellipsis: { tooltip: true } },
|
||||
{ title: t('pages.blockchain.txHash'), key: 'txHash', minWidth: 260, ellipsis: { tooltip: true } },
|
||||
{ title: t('common.label.remark'), key: 'remark', minWidth: 220, ellipsis: { tooltip: true } },
|
||||
{
|
||||
title: '错误原因',
|
||||
title: t('pages.outbound.errorReason'),
|
||||
key: 'reason',
|
||||
minWidth: 300,
|
||||
ellipsis: { tooltip: true },
|
||||
@@ -188,10 +190,10 @@ async function uploadPreview({ file, onFinish, onError }: UploadCustomRequestOpt
|
||||
await refreshSession();
|
||||
resetPage();
|
||||
await loadRows();
|
||||
message.success('预览解析完成');
|
||||
message.success(t('pages.outbound.previewReady'));
|
||||
onFinish();
|
||||
} catch (e) {
|
||||
message.error((e as Error)?.message || '上传失败');
|
||||
message.error(t('pages.outbound.uploadFailed'));
|
||||
onError();
|
||||
} finally {
|
||||
previewing.value = false;
|
||||
@@ -210,7 +212,7 @@ async function commitImport() {
|
||||
result.value = job;
|
||||
await refreshSession();
|
||||
await loadRows();
|
||||
message.success('导入完成');
|
||||
message.success(t('pages.outbound.importDone'));
|
||||
} finally {
|
||||
committing.value = false;
|
||||
progressPercent.value = 0;
|
||||
@@ -261,6 +263,14 @@ async function loadRows() {
|
||||
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>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
<div class="page settings-page">
|
||||
<div class="settings-shell">
|
||||
<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">
|
||||
<n-form class="settings-form" label-placement="top">
|
||||
<section class="settings-section">
|
||||
<div class="section-title">平台信息</div>
|
||||
<div class="section-title">{{ t('pages.settings.platformInfo') }}</div>
|
||||
<div class="field-grid two">
|
||||
<n-form-item :label="t('pages.settings.appName')">
|
||||
<n-input v-model:value="form.appName" class="control-wide" />
|
||||
@@ -27,7 +27,7 @@
|
||||
</section>
|
||||
|
||||
<section class="settings-section">
|
||||
<div class="section-title">日志与展示</div>
|
||||
<div class="section-title">{{ t('pages.settings.logAndDisplay') }}</div>
|
||||
<div class="field-grid three">
|
||||
<n-form-item :label="t('pages.settings.logRetentionDays')">
|
||||
<n-input-number v-model:value="form.logRetentionDays" :min="1" class="control-short" />
|
||||
@@ -52,18 +52,18 @@
|
||||
</section>
|
||||
|
||||
<section class="settings-section">
|
||||
<div class="section-title">备份策略</div>
|
||||
<div class="section-title">{{ t('pages.settings.backupPolicy') }}</div>
|
||||
<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>
|
||||
</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-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-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-form-item>
|
||||
</div>
|
||||
@@ -76,7 +76,7 @@
|
||||
</div>
|
||||
</n-tab-pane>
|
||||
|
||||
<n-tab-pane name="backup" tab="备份与恢复">
|
||||
<n-tab-pane name="backup" :tab="t('pages.backup.title')">
|
||||
<div class="settings-backup-pane">
|
||||
<backup-restore-panel />
|
||||
</div>
|
||||
@@ -98,8 +98,8 @@ import { DEFAULT_APP_ICON_URL, resolveAppIcon, setFavicon } from '@/utils/appIco
|
||||
const { t } = useI18n();
|
||||
const saving = ref(false);
|
||||
const backupScheduleOptions = [
|
||||
{ label: '每天', value: 'daily' },
|
||||
{ label: '每周', value: 'weekly' },
|
||||
{ label: t('pages.settings.scheduleDaily'), value: 'daily' },
|
||||
{ label: t('pages.settings.scheduleWeekly'), value: 'weekly' },
|
||||
];
|
||||
const form = reactive({
|
||||
appName: '',
|
||||
|
||||
Reference in New Issue
Block a user