From caa1b83cc800d620c24436968f8dff54da197aca Mon Sep 17 00:00:00 2001 From: liufumingren Date: Fri, 4 Sep 2026 02:32:38 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=BA=93=E5=AD=98=E6=8A=A5=E8=A1=A8):=20?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=94=B9=E6=9C=8D=E5=8A=A1=E7=AB=AF=E5=88=86?= =?UTF-8?q?=E9=A1=B5=E5=B9=B6=E6=8C=89=E5=85=B6=E4=BB=96=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E4=BC=A0=20pagination/sort=EF=BC=9B=E5=AF=BC=E5=87=BA=E8=AF=AD?= =?UTF-8?q?=E4=B9=89=E4=BF=AE=E6=AD=A3=E4=B8=BA=20item=3D=E5=90=AB?= =?UTF-8?q?=E9=94=81=E5=AE=9A=E3=80=81=E4=B8=8D=E4=BC=A0=3D=E4=BB=85?= =?UTF-8?q?=E5=87=BA=E5=85=A5=E5=BA=93=EF=BC=8C=E6=96=B0=E5=A2=9E=E5=AF=BC?= =?UTF-8?q?=E5=87=BA=E9=80=89=E4=B8=AD(=E4=BB=85=E5=87=BA=E5=85=A5?= =?UTF-8?q?=E5=BA=93/=E5=85=A8=E9=83=A8=E5=90=AB=E9=94=81=E5=AE=9A)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/stock.report/stock.report.ts | 28 +++- src/views/storage/report/index.vue | 191 ++++++++++++++++++--------- src/views/storage/report/store.vue | 190 +++++++++++++++++--------- 3 files changed, 284 insertions(+), 125 deletions(-) diff --git a/src/api/stock.report/stock.report.ts b/src/api/stock.report/stock.report.ts index 05a20a26..93ab4ffc 100644 --- a/src/api/stock.report/stock.report.ts +++ b/src/api/stock.report/stock.report.ts @@ -22,6 +22,15 @@ export type StockReportListItem = { [key: string]: unknown } +export interface StockReportPagination { + page?: number + pageSize?: number + total?: number + totalPages?: number + hasPrevious?: boolean + hasNext?: boolean +} + export interface StockReportSearchBody { where?: { start_time?: string | Date @@ -33,15 +42,24 @@ export interface StockReportSearchBody { } sort?: { sortField?: 'begin_total' | 'inbound_total' | 'outbound_total' | 'end_total' - sort_field?: 'begin_total' | 'inbound_total' | 'outbound_total' | 'end_total' sortOrder?: 'ASC' | 'DESC' | 'asc' | 'desc' - sort_order?: 'ASC' | 'DESC' | 'asc' | 'desc' + } + pagination?: { + page?: number + pageSize?: number } } +/** + * stock.report.export / exportStore 导出语义(与订单模块的 waybill/item 含义不同): + * - export_mode='item':变更记录 sheet 含 LOCK(锁定/解锁)记录,即「全部」 + * - 不传 export_mode:变更记录 sheet 仅出入库等变动(不含 LOCK) + * 参数位置 data.export_mode(兼容驼峰 data.exportMode),export/exportStore 均支持。 + * 注意:无论哪种模式,「汇总」+「变更记录」两个 sheet 都会生成。 + */ export interface StockReportExportBody extends StockReportSearchBody { - export_mode?: 'waybill' | 'item' - exportMode?: 'waybill' | 'item' + export_mode?: 'item' + exportMode?: 'item' } export interface StockReportExportTaskResponse { @@ -78,8 +96,10 @@ export interface StockReportSearchResult { message?: string data?: { list?: StockReportListItem[] + pagination?: StockReportPagination } list?: StockReportListItem[] + pagination?: StockReportPagination } /** 不传或传 `{}` 表示无业务参数(与页面首次打开一致) */ diff --git a/src/views/storage/report/index.vue b/src/views/storage/report/index.vue index 62573c03..b783f68c 100644 --- a/src/views/storage/report/index.vue +++ b/src/views/storage/report/index.vue @@ -17,13 +17,15 @@
刷新 - + 字段设置 {{ detailVisible ? '隐藏详情' : '显示详情' }} -
@@ -41,9 +43,11 @@ :table-size="tableSize" :pagination="pagination" :show-index="true" + show-selection :loading="loading" :query-time="queryTime" @current-change="handleRowClick" + @selection-change="handleSelectionChange" @sort-change="handleSortChange" @page-change="handlePageChange" @page-size-change="handlePageSizeChange" @@ -111,6 +115,7 @@ import dayjs from 'dayjs' import ScanBox from '@/components/ScanBox/index.vue' import UpperTable from '@/components/UpperTable/index.vue' import ExportModeDropdown from '@/components/ExportModeDropdown.vue' +import type { ExportDropdownItem } from '@/components/ExportModeDropdown.vue' import AsyncExportProgressDialog from '@/components/AsyncExportProgressDialog.vue' import { useAsyncExportTask } from '@/composables/useAsyncExportTask' import { @@ -182,6 +187,7 @@ const { exportProgressPercent, exportProgressStatus, exportStatusLabel, + submitExportTask, submitExportTaskWithMode, resumeExportTaskFromStorage, hasPendingExportTask @@ -191,7 +197,6 @@ const { queryProgress: (params) => getExportTaskProgress(params) }) -const fullList = ref([]) const list = ref([]) const columns = ref(buildReportTableColumns([])) @@ -208,7 +213,7 @@ const currentSort = reactive<{ prop: string; order: '' | 'ascending' | 'descendi const selectedRid = ref(null) const currentConditionRaw = ref({}) -const selectedRow = computed(() => fullList.value.find((r) => r.__rid === selectedRid.value) || null) +const selectedRow = computed(() => list.value.find((r) => r.__rid === selectedRid.value) || null) const detailKeys = computed(() => { if (!selectedRow.value) return [] @@ -216,17 +221,6 @@ const detailKeys = computed(() => { return sortReportDetailKeys(keys) }) -const sumInbound = computed(() => - fullList.value.reduce((a, r) => a + Number((r as any).inbound_total ?? 0), 0) -) -const sumOutbound = computed(() => - fullList.value.reduce((a, r) => a + Number((r as any).outbound_total ?? 0), 0) -) - -function formatNumber(n: number) { - return Number.isFinite(n) ? n.toLocaleString('zh-CN') : '--' -} - function fieldLabel(key: string) { return reportFieldLabels[key] || key } @@ -253,13 +247,6 @@ function isWideKey(key: string) { return detailValue(key).length > 80 } -function extractReportList(res: any): any[] { - if (!res) return [] - if (res.data != null && Array.isArray(res.data.list)) return res.data.list - if (Array.isArray(res.list)) return res.list - return [] -} - function withRowIds(rows: any[]) { return rows.map((row, idx) => ({ ...row, @@ -267,27 +254,17 @@ function withRowIds(rows: any[]) { })) } -function applyClientPage() { - const total = fullList.value.length - pagination.total = total - const start = (pagination.currentPage - 1) * pagination.pageSize - list.value = fullList.value.slice(start, start + pagination.pageSize) -} - const SORTABLE_FIELDS = new Set(['begin_total', 'inbound_total', 'outbound_total', 'end_total']) +/** 排序参数(与其他列表接口一致:sort:{ sortField, sortOrder },如 stock.transaction.list) */ function buildSortPayload(): StockReportSearchBody['sort'] | undefined { if (!SORTABLE_FIELDS.has(currentSort.prop)) return undefined if (!currentSort.order) return undefined const sortOrder = currentSort.order === 'ascending' ? 'ASC' : 'DESC' - return { - sortField: currentSort.prop as any, - sort_field: currentSort.prop as any, - sortOrder, - sort_order: sortOrder - } + return { sortField: currentSort.prop as any, sortOrder } } +/** 查询与导出共用的业务条件(不含分页,导出走全量) */ function buildReportQueryPayload(): StockReportSearchBody { const where = normalizeScanConditionToReportWhere(currentConditionRaw.value) const sort = buildSortPayload() @@ -301,16 +278,71 @@ function buildReportQueryPayload(): StockReportSearchBody { return body } -async function handleExportWaybill() { +/** 列表查询请求体:在业务条件基础上附加分页参数 */ +function buildReportSearchPayload(): StockReportSearchBody { + const body = buildReportQueryPayload() + body.pagination = { page: pagination.currentPage, pageSize: pagination.pageSize } + return body +} + +/** 解析响应分页信息(兼容 res.data / res 两层结构) */ +function parseReportPagination(res: any) { + const payload = res?.data && typeof res.data === 'object' ? res.data : res + const pg = payload?.pagination && typeof payload.pagination === 'object' ? payload.pagination : {} + return { + page: Number(pg.page) > 0 ? Number(pg.page) : pagination.currentPage, + pageSize: Number(pg.pageSize) > 0 ? Number(pg.pageSize) : pagination.pageSize, + total: Number(pg.total) > 0 ? Number(pg.total) : 0 + } +} + +/** 表格勾选的行(用于「导出选中」) */ +const selectionRows = ref([]) + +function handleSelectionChange(rows: any[]) { + selectionRows.value = rows || [] +} + +/** 导出选项:全部=当前筛选条件下全部;选中=勾选行(stock_id in 叠加当前筛选)。mode 语义:item=含 LOCK;不传=仅出入库 */ +const exportDropdownItems: ExportDropdownItem[] = [ + { label: '仅出入库(不含锁定记录)', action: 'handleExportOnlyInOut' }, + { label: '全部(含锁定记录)', action: 'handleExportWithLock', divided: true }, + { label: '导出选中·仅出入库', action: 'handleExportSelectedOnlyInOut', divided: true }, + { label: '导出选中·全部(含锁定记录)', action: 'handleExportSelectedWithLock' } +] + +/** 勾选行的有效 stock_id(去重去空;后端数组即 in 匹配,参考 inventory 导出选中写法) */ +function collectSelectedStockIds(): number[] { + return Array.from( + new Set( + selectionRows.value + .map((row: any) => Number(row.stock_id)) + .filter((id: number) => Number.isFinite(id) && id > 0) + ) + ) +} + +/** 导出选中请求体:在 buildReportQueryPayload 的 where 基础上叠加 stock_id in */ +function buildSelectedExportPayload(): Record { + const stockIds = collectSelectedStockIds() + const body = buildReportQueryPayload() + const where: Record = body.where ? { ...body.where } : {} + where.stock_id = stockIds.length === 1 ? stockIds[0] : stockIds + return { ...body, where } +} + +/** 仅出入库:不传 export_mode,后端「变更记录」sheet 排除 LOCK,仅含出入库/移库等变动 */ +async function handleExportOnlyInOut() { if (hasPendingExportTask()) { ElMessage.warning('检测到未完成导出任务,请等待当前任务完成后再试') resumeExportTaskFromStorage() return } - await submitExportTaskWithMode(buildReportQueryPayload() as Record, 'waybill') + await submitExportTask(buildReportQueryPayload() as Record) } -async function handleExportItem() { +/** 全部:传 export_mode='item',后端「变更记录」sheet 含 LOCK(锁定/解锁)记录 */ +async function handleExportWithLock() { if (hasPendingExportTask()) { ElMessage.warning('检测到未完成导出任务,请等待当前任务完成后再试') resumeExportTaskFromStorage() @@ -319,12 +351,48 @@ async function handleExportItem() { await submitExportTaskWithMode(buildReportQueryPayload() as Record, 'item') } -function handleExportAction(action: string) { - if (action === 'handleExportItem') { - void handleExportItem() +/** 导出选中·仅出入库(不传 export_mode) */ +async function handleExportSelectedOnlyInOut() { + if (!collectSelectedStockIds().length) { + ElMessage.warning('请先在表格勾选要导出的记录') return } - void handleExportWaybill() + if (hasPendingExportTask()) { + ElMessage.warning('检测到未完成导出任务,请等待当前任务完成后再试') + resumeExportTaskFromStorage() + return + } + await submitExportTask(buildSelectedExportPayload()) +} + +/** 导出选中·全部(含锁定记录,export_mode='item') */ +async function handleExportSelectedWithLock() { + if (!collectSelectedStockIds().length) { + ElMessage.warning('请先在表格勾选要导出的记录') + return + } + if (hasPendingExportTask()) { + ElMessage.warning('检测到未完成导出任务,请等待当前任务完成后再试') + resumeExportTaskFromStorage() + return + } + await submitExportTaskWithMode(buildSelectedExportPayload(), 'item') +} + +function handleExportAction(action: string) { + if (action === 'handleExportWithLock') { + void handleExportWithLock() + return + } + if (action === 'handleExportSelectedOnlyInOut') { + void handleExportSelectedOnlyInOut() + return + } + if (action === 'handleExportSelectedWithLock') { + void handleExportSelectedWithLock() + return + } + void handleExportOnlyInOut() } async function loadFilterData() { @@ -373,30 +441,33 @@ async function loadData() { loading.value = true const started = Date.now() selectedRid.value = null - const body = buildReportQueryPayload() try { - const res: any = await searchInventoryReport( - Object.keys(body).length > 0 ? body : undefined - ) - if (res && (res.flag === 'success' || res.code === 200)) { - const raw = extractReportList(res) - fullList.value = withRowIds(raw) + const res: any = await searchInventoryReport(buildReportSearchPayload()) + const payload = res?.data && typeof res.data === 'object' ? res.data : res + const ok = + res?.flag === 'success' || + res?.code === 200 || + res?.code === 1 || + (payload && Array.isArray(payload.list)) + if (ok) { + const raw = Array.isArray(payload?.list) ? payload.list : [] + list.value = withRowIds(raw) columns.value = buildReportTableColumns(raw) - pagination.currentPage = 1 - applyClientPage() + const pg = parseReportPagination(res) + pagination.currentPage = pg.page + pagination.pageSize = pg.pageSize + pagination.total = pg.total queryTime.value = Date.now() - started - if (raw.length === 0) { + if (raw.length === 0 && pagination.total === 0) { ElMessage.info('当前条件下暂无数据') } } else { - fullList.value = [] list.value = [] columns.value = buildReportTableColumns([]) pagination.total = 0 - ElMessage.error(res?.message || '查询失败') + ElMessage.error(payload?.message || res?.message || '查询失败') } } catch (e: any) { - fullList.value = [] list.value = [] columns.value = buildReportTableColumns([]) pagination.total = 0 @@ -415,13 +486,13 @@ function handleSortChange({ prop, order }: { prop: string; order: '' | 'ascendin function handlePageChange(page: number) { pagination.currentPage = page - applyClientPage() + loadData() } function handlePageSizeChange(size: number) { pagination.pageSize = size pagination.currentPage = 1 - applyClientPage() + loadData() } function handleRowClick(row: any) { diff --git a/src/views/storage/report/store.vue b/src/views/storage/report/store.vue index adaa04f2..bdb8a10d 100644 --- a/src/views/storage/report/store.vue +++ b/src/views/storage/report/store.vue @@ -16,7 +16,13 @@
刷新 - + 字段设置 {{ detailVisible ? '隐藏详情' : '显示详情' }} @@ -24,12 +30,6 @@ v-model="warehouseFilterId" @change="handleWarehouseChange" /> - -
@@ -47,9 +47,11 @@ :table-size="tableSize" :pagination="pagination" :show-index="true" + show-selection :loading="loading" :query-time="queryTime" @current-change="handleRowClick" + @selection-change="handleSelectionChange" @sort-change="handleSortChange" @page-change="handlePageChange" @page-size-change="handlePageSizeChange" @@ -114,6 +116,7 @@ import dayjs from 'dayjs' import ScanBox from '@/components/ScanBox/index.vue' import UpperTable from '@/components/UpperTable/index.vue' import ExportModeDropdown from '@/components/ExportModeDropdown.vue' +import type { ExportDropdownItem } from '@/components/ExportModeDropdown.vue' import WarehouseSelect from '@/components/WarehouseSelect.vue' import AsyncExportProgressDialog from '@/components/AsyncExportProgressDialog.vue' import { useAsyncExportTask } from '@/composables/useAsyncExportTask' @@ -189,6 +192,7 @@ const { exportProgressPercent, exportProgressStatus, exportStatusLabel, + submitExportTask, submitExportTaskWithMode, resumeExportTaskFromStorage, hasPendingExportTask @@ -198,7 +202,6 @@ const { queryProgress: (params) => getExportTaskProgress(params) }) -const fullList = ref([]) const list = ref([]) /** 货主侧不显示的列 */ @@ -225,7 +228,7 @@ const currentConditionRaw = ref({}) /** toolbar 全部仓库筛选值(独立于 scan-box 条件,空值=全部仓库) */ const warehouseFilterId = ref(null) -const selectedRow = computed(() => fullList.value.find((r) => r.__rid === selectedRid.value) || null) +const selectedRow = computed(() => list.value.find((r) => r.__rid === selectedRid.value) || null) const detailKeys = computed(() => { if (!selectedRow.value) return [] @@ -233,17 +236,6 @@ const detailKeys = computed(() => { return sortReportDetailKeys(keys) }) -const sumInbound = computed(() => - fullList.value.reduce((a, r) => a + Number((r as any).inbound_total ?? 0), 0) -) -const sumOutbound = computed(() => - fullList.value.reduce((a, r) => a + Number((r as any).outbound_total ?? 0), 0) -) - -function formatNumber(n: number) { - return Number.isFinite(n) ? n.toLocaleString('zh-CN') : '--' -} - function fieldLabel(key: string) { return reportFieldLabels[key] || key } @@ -270,13 +262,6 @@ function isWideKey(key: string) { return detailValue(key).length > 80 } -function extractReportList(res: any): any[] { - if (!res) return [] - if (res.data != null && Array.isArray(res.data.list)) return res.data.list - if (Array.isArray(res.list)) return res.list - return [] -} - function withRowIds(rows: any[]) { return rows.map((row, idx) => ({ ...row, @@ -284,25 +269,14 @@ function withRowIds(rows: any[]) { })) } -function applyClientPage() { - const total = fullList.value.length - pagination.total = total - const start = (pagination.currentPage - 1) * pagination.pageSize - list.value = fullList.value.slice(start, start + pagination.pageSize) -} - const SORTABLE_FIELDS = new Set(['begin_total', 'inbound_total', 'outbound_total', 'end_total']) +/** 排序参数(与其他列表接口一致:sort:{ sortField, sortOrder },如 stock.transaction.list) */ function buildSortPayload(): StockReportSearchBody['sort'] | undefined { if (!SORTABLE_FIELDS.has(currentSort.prop)) return undefined if (!currentSort.order) return undefined const sortOrder = currentSort.order === 'ascending' ? 'ASC' : 'DESC' - return { - sortField: currentSort.prop as any, - sort_field: currentSort.prop as any, - sortOrder, - sort_order: sortOrder - } + return { sortField: currentSort.prop as any, sortOrder } } /** toolbar 全部仓库过滤:并入报表查询 where(直接值,与报表后端约定一致) */ @@ -332,16 +306,71 @@ function buildReportQueryPayload(): StockReportSearchBody { return body } -async function handleExportWaybill() { +/** 列表查询请求体:在业务条件基础上附加分页参数 */ +function buildReportSearchPayload(): StockReportSearchBody { + const body = buildReportQueryPayload() + body.pagination = { page: pagination.currentPage, pageSize: pagination.pageSize } + return body +} + +/** 解析响应分页信息(兼容 res.data / res 两层结构) */ +function parseReportPagination(res: any) { + const payload = res?.data && typeof res.data === 'object' ? res.data : res + const pg = payload?.pagination && typeof payload.pagination === 'object' ? payload.pagination : {} + return { + page: Number(pg.page) > 0 ? Number(pg.page) : pagination.currentPage, + pageSize: Number(pg.pageSize) > 0 ? Number(pg.pageSize) : pagination.pageSize, + total: Number(pg.total) > 0 ? Number(pg.total) : 0 + } +} + +/** 表格勾选的行(用于「导出选中」) */ +const selectionRows = ref([]) + +function handleSelectionChange(rows: any[]) { + selectionRows.value = rows || [] +} + +/** 导出选项:全部=当前筛选条件下全部;选中=勾选行(stock_id in 叠加当前筛选)。mode 语义:item=含 LOCK;不传=仅出入库 */ +const exportDropdownItems: ExportDropdownItem[] = [ + { label: '仅出入库(不含锁定记录)', action: 'handleExportOnlyInOut' }, + { label: '全部(含锁定记录)', action: 'handleExportWithLock', divided: true }, + { label: '导出选中·仅出入库', action: 'handleExportSelectedOnlyInOut', divided: true }, + { label: '导出选中·全部(含锁定记录)', action: 'handleExportSelectedWithLock' } +] + +/** 勾选行的有效 stock_id(去重去空;后端数组即 in 匹配,参考 inventory 导出选中写法) */ +function collectSelectedStockIds(): number[] { + return Array.from( + new Set( + selectionRows.value + .map((row: any) => Number(row.stock_id)) + .filter((id: number) => Number.isFinite(id) && id > 0) + ) + ) +} + +/** 导出选中请求体:在 buildReportQueryPayload 的 where 基础上叠加 stock_id in */ +function buildSelectedExportPayload(): Record { + const stockIds = collectSelectedStockIds() + const body = buildReportQueryPayload() + const where: Record = body.where ? { ...body.where } : {} + where.stock_id = stockIds.length === 1 ? stockIds[0] : stockIds + return { ...body, where } +} + +/** 仅出入库:不传 export_mode,后端「变更记录」sheet 排除 LOCK,仅含出入库/移库等变动 */ +async function handleExportOnlyInOut() { if (hasPendingExportTask()) { ElMessage.warning('检测到未完成导出任务,请等待当前任务完成后再试') resumeExportTaskFromStorage() return } - await submitExportTaskWithMode(buildReportQueryPayload() as Record, 'waybill') + await submitExportTask(buildReportQueryPayload() as Record) } -async function handleExportItem() { +/** 全部:传 export_mode='item',后端「变更记录」sheet 含 LOCK(锁定/解锁)记录 */ +async function handleExportWithLock() { if (hasPendingExportTask()) { ElMessage.warning('检测到未完成导出任务,请等待当前任务完成后再试') resumeExportTaskFromStorage() @@ -350,12 +379,48 @@ async function handleExportItem() { await submitExportTaskWithMode(buildReportQueryPayload() as Record, 'item') } -function handleExportAction(action: string) { - if (action === 'handleExportItem') { - void handleExportItem() +/** 导出选中·仅出入库(不传 export_mode) */ +async function handleExportSelectedOnlyInOut() { + if (!collectSelectedStockIds().length) { + ElMessage.warning('请先在表格勾选要导出的记录') return } - void handleExportWaybill() + if (hasPendingExportTask()) { + ElMessage.warning('检测到未完成导出任务,请等待当前任务完成后再试') + resumeExportTaskFromStorage() + return + } + await submitExportTask(buildSelectedExportPayload()) +} + +/** 导出选中·全部(含锁定记录,export_mode='item') */ +async function handleExportSelectedWithLock() { + if (!collectSelectedStockIds().length) { + ElMessage.warning('请先在表格勾选要导出的记录') + return + } + if (hasPendingExportTask()) { + ElMessage.warning('检测到未完成导出任务,请等待当前任务完成后再试') + resumeExportTaskFromStorage() + return + } + await submitExportTaskWithMode(buildSelectedExportPayload(), 'item') +} + +function handleExportAction(action: string) { + if (action === 'handleExportWithLock') { + void handleExportWithLock() + return + } + if (action === 'handleExportSelectedOnlyInOut') { + void handleExportSelectedOnlyInOut() + return + } + if (action === 'handleExportSelectedWithLock') { + void handleExportSelectedWithLock() + return + } + void handleExportOnlyInOut() } async function loadFilterData() { @@ -397,27 +462,30 @@ async function loadData() { loading.value = true const started = Date.now() selectedRid.value = null - const body = buildReportQueryPayload() try { - const res: any = await searchStoreReport( - Object.keys(body).length > 0 ? body : undefined - ) - if (res && (res.flag === 'success' || res.code === 200)) { - const raw = extractReportList(res) - fullList.value = withRowIds(raw) + const res: any = await searchStoreReport(buildReportSearchPayload()) + const payload = res?.data && typeof res.data === 'object' ? res.data : res + const ok = + res?.flag === 'success' || + res?.code === 200 || + res?.code === 1 || + (payload && Array.isArray(payload.list)) + if (ok) { + const raw = Array.isArray(payload?.list) ? payload.list : [] + list.value = withRowIds(raw) columns.value = buildStoreReportColumns(raw) - pagination.currentPage = 1 - applyClientPage() + const pg = parseReportPagination(res) + pagination.currentPage = pg.page + pagination.pageSize = pg.pageSize + pagination.total = pg.total queryTime.value = Date.now() - started } else { - fullList.value = [] list.value = [] columns.value = buildStoreReportColumns([]) pagination.total = 0 - ElMessage.error(res?.message || '查询失败') + ElMessage.error(payload?.message || res?.message || '查询失败') } } catch (e: any) { - fullList.value = [] list.value = [] columns.value = buildStoreReportColumns([]) pagination.total = 0 @@ -436,13 +504,13 @@ function handleSortChange({ prop, order }: { prop: string; order: '' | 'ascendin function handlePageChange(page: number) { pagination.currentPage = page - applyClientPage() + loadData() } function handlePageSizeChange(size: number) { pagination.pageSize = size pagination.currentPage = 1 - applyClientPage() + loadData() } function handleRowClick(row: any) {