陶杰
2024-08-22 973662aeae3e7c788c14671d17c5962395141770
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
export const getSortConfig = function (id = 'sortBy') {
  return {
    label: '排序:',
    id,
    type: 'input-number',
    el: {
      precision: 0,
      min: 0,
    },
  }
}
 
export const getGoodsCategoryListConfig = (checkStrictly = false) => {
  return {
    label: '商品分类:',
    id: 'categoryId',
    type: 'bus-cascader',
    el: {
      otherInterfaceUri: 'flower/api/flower/category/tree',
      props: {
        label: 'name',
        value: 'id',
        emitPath: false,
        checkStrictly,
      },
      clearable: true,
      style: 'width:100%',
    },
  }
}
 
export const getGoodsListConfig = () => {
  return {
    label: '商品:',
    id: 'flowerId',
    type: 'bus-select',
    el: {
      interfaceUri: 'flower/api/flower/list',
      extraQuery: {
        current: 1,
        size: 50,
        status: 'UP',
      },
      props: {
        label: 'name',
        value: 'id',
        dataPath: 'records',
        queryKey: 'name',
      },
      filterable: true,
      remote: true,
      clearable: true,
      style: 'width:100%',
      filterOptions: (list) => {
        return list.map((item) => {
          item.name = [item.name, item.color, item.levelStr]
            .filter((i) => !!i)
            .join(' · ')
          if (item.supplierName) {
            item.name += `(${item.supplierName})`
          }
          return item
        })
      },
    },
  }
}