feat: 统一后端分页查询与前端服务层适配
后端新增通用分页模块,为报销单、员工、预算、agent 资产等 端点统一接入分页参数和游标查询,优化 repository 层分页实 现,前端服务层适配分页响应结构,完善预算图表和全局样式, 优化侧边栏和企业选择器组件,引入 Element Plus 插件注册。
This commit is contained in:
@@ -60,6 +60,17 @@ function buildQuery(params = {}) {
|
||||
search.set('limit', String(params.limit))
|
||||
}
|
||||
|
||||
const page = params.page
|
||||
const pageSize = params.pageSize || params.page_size
|
||||
|
||||
if (page) {
|
||||
search.set('page', String(page))
|
||||
}
|
||||
|
||||
if (pageSize) {
|
||||
search.set('page_size', String(pageSize))
|
||||
}
|
||||
|
||||
if (params.version) {
|
||||
search.set('version', String(params.version))
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ function buildQuery(params = {}) {
|
||||
const search = new URLSearchParams()
|
||||
Object.entries(params || {}).forEach(([key, value]) => {
|
||||
if (typeof value === 'undefined' || value === null || value === '') return
|
||||
search.set(key, String(value))
|
||||
search.set(key === 'pageSize' ? 'page_size' : key, String(value))
|
||||
})
|
||||
const query = search.toString()
|
||||
return query ? `?${query}` : ''
|
||||
@@ -25,6 +25,7 @@ export function createBudgetAllocation(payload = {}) {
|
||||
})
|
||||
}
|
||||
|
||||
export function fetchBudgetTransactions(allocationId) {
|
||||
return apiRequest(`/budgets/allocations/${encodeURIComponent(String(allocationId || '').trim())}/transactions`)
|
||||
export function fetchBudgetTransactions(allocationId, params = {}) {
|
||||
const encodedId = encodeURIComponent(String(allocationId || '').trim())
|
||||
return apiRequest(`/budgets/allocations/${encodedId}/transactions${buildQuery(params)}`)
|
||||
}
|
||||
|
||||
@@ -11,6 +11,17 @@ function buildEmployeesQuery(params = {}) {
|
||||
search.set('keyword', params.keyword)
|
||||
}
|
||||
|
||||
const page = params.page
|
||||
const pageSize = params.pageSize || params.page_size
|
||||
|
||||
if (page) {
|
||||
search.set('page', String(page))
|
||||
}
|
||||
|
||||
if (pageSize) {
|
||||
search.set('page_size', String(pageSize))
|
||||
}
|
||||
|
||||
return search
|
||||
}
|
||||
|
||||
|
||||
@@ -1,15 +1,32 @@
|
||||
import { apiRequest } from './api.js'
|
||||
|
||||
export function fetchExpenseClaims() {
|
||||
return apiRequest('/reimbursements/claims')
|
||||
function buildListQuery(params = {}) {
|
||||
const search = new URLSearchParams()
|
||||
const page = params.page
|
||||
const pageSize = params.pageSize || params.page_size
|
||||
|
||||
if (page) {
|
||||
search.set('page', String(page))
|
||||
}
|
||||
|
||||
if (pageSize) {
|
||||
search.set('page_size', String(pageSize))
|
||||
}
|
||||
|
||||
const query = search.toString()
|
||||
return query ? `?${query}` : ''
|
||||
}
|
||||
|
||||
export function fetchApprovalExpenseClaims() {
|
||||
return apiRequest('/reimbursements/claims/approvals')
|
||||
export function fetchExpenseClaims(params = {}) {
|
||||
return apiRequest(`/reimbursements/claims${buildListQuery(params)}`)
|
||||
}
|
||||
|
||||
export function fetchArchivedExpenseClaims() {
|
||||
return apiRequest('/reimbursements/claims/archives')
|
||||
export function fetchApprovalExpenseClaims(params = {}) {
|
||||
return apiRequest(`/reimbursements/claims/approvals${buildListQuery(params)}`)
|
||||
}
|
||||
|
||||
export function fetchArchivedExpenseClaims(params = {}) {
|
||||
return apiRequest(`/reimbursements/claims/archives${buildListQuery(params)}`)
|
||||
}
|
||||
|
||||
export function fetchExpenseClaimDetail(claimId) {
|
||||
|
||||
Reference in New Issue
Block a user