fix: 优化后台体验与导出日志交互

This commit is contained in:
Nixevol
2026-07-05 00:04:35 +08:00
parent 935375a904
commit 4122897725
44 changed files with 798 additions and 221 deletions
+10 -12
View File
@@ -3,7 +3,7 @@
<div class="page-toolbar outbound-toolbar">
<div class="section-title">出库批量导入</div>
<div class="spacer" />
<n-button @click="downloadTemplate">
<n-button :title="'下载模板包'" @click="downloadTemplate">
<template #icon><n-icon :component="DownloadOutline" /></template>
下载模板包
</n-button>
@@ -20,10 +20,6 @@
</n-upload>
</div>
<n-alert type="info" :show-icon="true" class="section-alert">
ZIP 内需要包含 1 个 xlsx 文件和 images 文件夹;xlsx 中出库实况图路径填写 images/xxx.jpg,多张用英文分号分隔。
</n-alert>
<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" />
@@ -68,6 +64,7 @@
remote
:scroll-x="1480"
:row-key="(r) => r.id"
@update:sorter="onSorterChange"
/>
<div class="table-pagination">
<n-pagination v-bind="pagination" :disabled="loading" />
@@ -87,6 +84,7 @@ import { downloadFile } from '@/utils/download';
import { fmt, statusType } from '@/utils/format';
import { useTablePage } from '@/composables/useTablePage';
import { openMediaViewer } from '@/composables/openMediaViewer';
import { useRemoteSort } from '@/utils/tableSort';
const auth = useAuthStore();
const rows = ref<any[]>([]);
@@ -101,6 +99,10 @@ const progressPercent = ref(0);
const busy = computed(() => previewing.value || committing.value);
const canCommit = computed(() => session.value?.status === 'READY' && Number(session.value?.invalidCount || 0) === 0);
const { pagination, page, pageSize, resetPage, setPageResult } = useTablePage(loadRows, 20);
const { sortProps, onSorterChange, sortParams } = useRemoteSort(() => {
resetPage();
return loadRows();
});
const columns = computed<DataTableColumns<any>>(() => [
{ title: '行号', key: 'rowNo', width: 80, align: 'center' },
@@ -111,9 +113,9 @@ const columns = computed<DataTableColumns<any>>(() => [
align: 'center',
render: (row) => h(NTag, { size: 'small', type: row.status === 'VALID' || row.status === 'IMPORTED' ? 'success' : 'error' }, { default: () => row.status }),
},
{ title: '追溯短码', key: 'shortCode', minWidth: 150, align: 'center', ellipsis: { tooltip: true } },
{ 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) },
{ title: '出库时间', key: 'outTime', width: 170, align: 'center', render: (row) => fmt(row.outTime || row.preview?.outTime), ...sortProps('outTime') },
{
title: '出库实况图',
key: 'images',
@@ -252,7 +254,7 @@ async function loadRows() {
}
loading.value = true;
try {
const res: any = await outboundApi.rows(sessionId.value, { page: page.value, pageSize: pageSize.value });
const res: any = await outboundApi.rows(sessionId.value, { page: page.value, pageSize: pageSize.value, ...sortParams() });
rows.value = res.list;
setPageResult(res);
} finally {
@@ -276,10 +278,6 @@ async function loadRows() {
font-weight: 600;
white-space: nowrap;
}
.section-alert {
margin-bottom: 12px;
flex: 0 0 auto;
}
.summary-card {
margin-bottom: 12px;
flex: 0 0 auto;