gaoluyang
15 小时以前 844dfdc256bfc567f9eaa007a7bc37dc120bffa8
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
 
import { getSupplierSimpleList } from '#/api/srm/supplier';
 
import { COMPOSITE_SCORE_CELLTAG, EVALUATION_GRADE_CELLTAG } from '../enums';
 
/** 新增/修改的表单 */
export function useFormSchema(): VbenFormSchema[] {
  return [
    {
      component: 'Input',
      fieldName: 'id',
      dependencies: {
        triggerFields: [''],
        show: () => false,
      },
    },
    {
      fieldName: 'supplierId',
      label: '供应商',
      component: 'ApiSelect',
      rules: 'required',
      componentProps: {
        placeholder: '请选择供应商',
        allowClear: true,
        showSearch: true,
        api: getSupplierSimpleList,
        labelField: 'name',
        valueField: 'id',
      },
    },
    {
      fieldName: 'evaluationPeriod',
      label: '评价周期',
      component: 'Input',
      rules: 'required',
      componentProps: { placeholder: '如 2024-Q1' },
    },
    {
      fieldName: 'qualityScore',
      label: '质量评分',
      component: 'InputNumber',
      rules: 'required',
      componentProps: { min: 0, max: 100, placeholder: '请输入质量评分' },
    },
    {
      fieldName: 'deliveryScore',
      label: '交付评分',
      component: 'InputNumber',
      rules: 'required',
      componentProps: { min: 0, max: 100, placeholder: '请输入交付评分' },
    },
    {
      fieldName: 'priceScore',
      label: '价格评分',
      component: 'InputNumber',
      rules: 'required',
      componentProps: { min: 0, max: 100, placeholder: '请输入价格评分' },
    },
    {
      fieldName: 'serviceScore',
      label: '服务评分',
      component: 'InputNumber',
      rules: 'required',
      componentProps: { min: 0, max: 100, placeholder: '请输入服务评分' },
    },
    {
      fieldName: 'remark',
      label: '评价说明',
      component: 'Textarea',
      componentProps: { placeholder: '请输入评价说明', rows: 3 },
      formItemClass: 'col-span-2',
    },
  ];
}
 
/** 搜索表单 */
export function useGridFormSchema(): VbenFormSchema[] {
  return [
    {
      fieldName: 'supplierId',
      label: '供应商',
      component: 'ApiSelect',
      componentProps: {
        placeholder: '请选择供应商',
        allowClear: true,
        showSearch: true,
        api: getSupplierSimpleList,
        labelField: 'name',
        valueField: 'id',
      },
    },
    {
      fieldName: 'evaluationPeriod',
      label: '评价周期',
      component: 'Input',
      componentProps: { placeholder: '请输入评价周期', allowClear: true },
    },
  ];
}
 
/** 表格列 */
export function useGridColumns(): VxeTableGridOptions['columns'] {
  return [
    { field: 'supplierName', title: '供应商', minWidth: 150 },
    { field: 'evaluationPeriod', title: '评价周期', minWidth: 120 },
    { field: 'qualityScore', title: '质量评分', minWidth: 100 },
    { field: 'deliveryScore', title: '交付评分', minWidth: 100 },
    { field: 'priceScore', title: '价格评分', minWidth: 100 },
    { field: 'serviceScore', title: '服务评分', minWidth: 100 },
    {
      field: 'compositeScore',
      title: '综合评分',
      minWidth: 120,
      cellRender: { name: 'CellTag', props: COMPOSITE_SCORE_CELLTAG },
    },
    {
      field: 'grade',
      title: '等级',
      minWidth: 80,
      cellRender: { name: 'CellTag', props: EVALUATION_GRADE_CELLTAG },
    },
    { field: 'createTime', title: '创建时间', minWidth: 160 },
    {
      title: '操作',
      width: 130,
      fixed: 'right',
      slots: { default: 'actions' },
    },
  ];
}