zhou zhou
昨天 aaf8a50511d77dbc209ca93bbba308c21179a8bc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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' })
}