feat: 优化后台列表高度与分页容量

This commit is contained in:
Nixevol
2026-07-03 04:45:01 +08:00
parent 0e817c453e
commit 5c564e9f24
14 changed files with 227 additions and 94 deletions
+14 -17
View File
@@ -72,10 +72,12 @@
:data="rows"
:loading="loading"
:pagination="pagination"
class="table-fill"
flex-height
paginate-single-page
remote
:row-key="(r) => r.id"
v-model:checked-row-keys="checkedKeys"
@update:page="onPage"
/>
<n-modal v-model:show="genModal" preset="card" :title="t('pages.traceCode.generate')" style="width: 440px">
@@ -153,6 +155,7 @@ import { useAuthStore } from '@/stores/auth';
import { message, dialog } from '@/utils/feedback';
import { fmt, statusType } from '@/utils/format';
import { downloadFile } from '@/utils/download';
import { useTablePage } from '@/composables/useTablePage';
const props = defineProps<{
artworkId?: number;
@@ -175,18 +178,14 @@ const query = reactive<{
batchId: number | null;
status: string | null;
keyword: string;
page: number;
pageSize: number;
}>({
artworkId: fixedArtworkId.value,
groupId: null,
batchId: null,
status: null,
keyword: '',
page: 1,
pageSize: embedded.value ? 8 : 10,
});
const pagination = reactive({ page: 1, pageSize: query.pageSize, itemCount: 0 });
const { pagination, page, pageSize, resetPage, setPageResult } = useTablePage(load, embedded.value ? 20 : 20);
const statusOptions = Object.values(TraceCodeStatus).map((v) => ({ label: t(`common.status.${v}`), value: v }));
const batchOptions = ref<{ label: string; value: number }[]>([]);
@@ -290,24 +289,18 @@ async function load() {
batchId: query.batchId || undefined,
status: query.status || undefined,
keyword: query.keyword || undefined,
page: query.page,
pageSize: query.pageSize,
page: page.value,
pageSize: pageSize.value,
});
rows.value = res.list;
pagination.itemCount = res.total;
pagination.page = res.page;
setPageResult(res);
} finally {
loading.value = false;
}
}
function onSearch() {
query.page = 1;
load();
}
function onPage(p: number) {
query.page = p;
resetPage();
load();
}
@@ -452,7 +445,7 @@ watch(
query.artworkId = aid;
genForm.artworkId = aid;
query.batchId = null;
query.page = 1;
resetPage();
await loadBatches();
await load();
},
@@ -474,6 +467,10 @@ onMounted(async () => {
<style scoped>
.trace-code-panel {
min-width: 0;
flex: 1 1 auto;
min-height: 0;
display: flex;
flex-direction: column;
}
.panel-toolbar {
display: flex;