import request from '@/utils/http'
|
|
function normalizeText(value) {
|
return typeof value === 'string' ? value.trim() : value
|
}
|
|
export function buildLocPreviewPageParams(params = {}) {
|
const condition = normalizeText(params.condition)
|
const code = normalizeText(params.code)
|
const barcode = normalizeText(params.barcode)
|
|
return {
|
current: params.current || 1,
|
pageSize: params.pageSize || params.size || 20,
|
...(condition ? { condition } : {}),
|
...(code ? { code } : {}),
|
...(barcode ? { barcode } : {})
|
}
|
}
|
|
export function buildLocPreviewItemsPageParams(params = {}) {
|
return {
|
current: params.current || 1,
|
pageSize: params.pageSize || params.size || 20,
|
...(params.locId !== undefined ? { locId: params.locId } : {})
|
}
|
}
|
|
export function fetchLocPreviewPage(params = {}) {
|
return request.post({
|
url: '/locPreview/page',
|
params: buildLocPreviewPageParams(params)
|
})
|
}
|
|
export function fetchLocPreviewDetail(id) {
|
return request.get({
|
url: `/locPreview/${id}`
|
})
|
}
|
|
export function fetchLocPreviewItemsPage(params = {}) {
|
return request.post({
|
url: '/locItem/page',
|
params: buildLocPreviewItemsPageParams(params)
|
})
|
}
|
|
export function fetchEnabledFields() {
|
return request.get({ url: '/fields/enable/list' })
|
}
|