import request from '@/utils/http'
|
|
function normalizeText(value) {
|
return typeof value === 'string' ? value.trim() : value
|
}
|
|
export function buildStatisticCountPageParams(params = {}) {
|
const entries = Object.entries(params).filter(([key, value]) => {
|
if (['current', 'pageSize', 'size'].includes(key)) {
|
return false
|
}
|
if (value === undefined || value === null) {
|
return false
|
}
|
if (typeof value === 'string' && value.trim() === '') {
|
return false
|
}
|
return true
|
})
|
|
return {
|
current: params.current || 1,
|
pageSize: params.pageSize || params.size || 20,
|
...Object.fromEntries(entries.map(([key, value]) => [key, normalizeText(value)]))
|
}
|
}
|
|
export function fetchStatisticCountPage(params = {}) {
|
return request.post({
|
url: '/statistic/num/page',
|
params: buildStatisticCountPageParams(params)
|
})
|
}
|