feat(库存报表): 列表改服务端分页并按其他接口传 pagination/sort;导出语义修正为 item=含锁定、不传=仅出入库,新增导出选中(仅出入库/全部含锁定)

This commit is contained in:
liufumingren 2026-09-04 02:32:38 +08:00
parent e3f5c9ede5
commit caa1b83cc8
3 changed files with 284 additions and 125 deletions

View File

@ -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
}
/** 不传或传 `{}` 表示无业务参数(与页面首次打开一致) */

View File

@ -17,13 +17,15 @@
<div class="toolbar">
<div class="toolbar-left">
<el-button size="small" @click="loadData">刷新</el-button>
<ExportModeDropdown :loading="exportLoading" @action="handleExportAction" />
<ExportModeDropdown
:loading="exportLoading"
label="导出"
default-action="handleExportOnlyInOut"
:items="exportDropdownItems"
@action="handleExportAction"
/>
<el-button size="small" @click="openColumnConfigPanel">字段设置</el-button>
<el-button size="small" @click="toggleDetailVisible">{{ detailVisible ? '隐藏详情' : '显示详情' }}</el-button>
<template v-if="pagination.total > 0">
<el-tag size="small" effect="plain">入库合计 {{ formatNumber(sumInbound) }}</el-tag>
<el-tag size="small" effect="plain">出库合计 {{ formatNumber(sumOutbound) }}</el-tag>
</template>
</div>
</div>
@ -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<any[]>([])
const list = ref<any[]>([])
const columns = ref(buildReportTableColumns([]))
@ -208,7 +213,7 @@ const currentSort = reactive<{ prop: string; order: '' | 'ascending' | 'descendi
const selectedRid = ref<string | null>(null)
const currentConditionRaw = ref<any>({})
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<any[]>([])
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<string, unknown> {
const stockIds = collectSelectedStockIds()
const body = buildReportQueryPayload()
const where: Record<string, any> = 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<string, unknown>, 'waybill')
await submitExportTask(buildReportQueryPayload() as Record<string, unknown>)
}
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<string, unknown>, '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) {

View File

@ -16,7 +16,13 @@
<div class="toolbar">
<div class="toolbar-left">
<el-button size="small" type="primary" @click="loadData">刷新</el-button>
<ExportModeDropdown :loading="exportLoading" @action="handleExportAction" />
<ExportModeDropdown
:loading="exportLoading"
label="导出"
default-action="handleExportOnlyInOut"
:items="exportDropdownItems"
@action="handleExportAction"
/>
<el-button size="small" @click="openColumnConfigPanel">字段设置</el-button>
<el-button size="small" @click="toggleDetailVisible">{{ detailVisible ? '隐藏详情' : '显示详情' }}</el-button>
<el-divider direction="vertical" />
@ -24,12 +30,6 @@
v-model="warehouseFilterId"
@change="handleWarehouseChange"
/>
<!-- <span class="toolbar-title">库存报表</span>
<el-tag size="small" type="info">共 {{ pagination.total }} 条</el-tag> -->
<template v-if="pagination.total > 0">
<el-tag size="small" effect="plain">入库合计 {{ formatNumber(sumInbound) }}</el-tag>
<el-tag size="small" effect="plain">出库合计 {{ formatNumber(sumOutbound) }}</el-tag>
</template>
</div>
</div>
@ -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<any[]>([])
const list = ref<any[]>([])
/** 货主侧不显示的列 */
@ -225,7 +228,7 @@ const currentConditionRaw = ref<any>({})
/** toolbar 全部仓库筛选值(独立于 scan-box 条件,空值=全部仓库) */
const warehouseFilterId = ref<number | string | null>(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<any[]>([])
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<string, unknown> {
const stockIds = collectSelectedStockIds()
const body = buildReportQueryPayload()
const where: Record<string, any> = 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<string, unknown>, 'waybill')
await submitExportTask(buildReportQueryPayload() as Record<string, unknown>)
}
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<string, unknown>, '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) {