liu
20 小时以前 ea9d117374e44d9eac0309ea2687b439f89b07b4
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
import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
 
import { getSimpleUserList } from '#/api/system/user';
 
/** 列表的搜索表单 */
export function useGridFormSchema(): VbenFormSchema[] {
  return [
    {
      fieldName: 'bizName',
      label: '业务类型',
      component: 'Input',
      componentProps: {
        allowClear: true,
        placeholder: '请输入业务类型名称',
      },
    },
    {
      fieldName: 'approvalEnabled',
      label: '是否启用',
      component: 'Select',
      componentProps: {
        allowClear: true,
        options: [
          { label: '已启用', value: true },
          { label: '未启用', value: false },
        ],
        placeholder: '请选择是否启用',
      },
    },
  ];
}
 
/** 列表的字段 */
export function useGridColumns(): VxeTableGridOptions['columns'] {
  return [
    { field: 'bizName', title: '业务类型', minWidth: 160 },
    { field: 'bizType', title: '业务编码', minWidth: 200 },
    {
      field: 'approvalEnabled',
      title: '是否启用审批',
      width: 120,
      align: 'center',
      slots: { default: 'approvalEnabled' },
    },
    {
      field: 'userNames',
      title: '审批人',
      minWidth: 200,
      slots: { default: 'userNames' },
    },
    { field: 'remark', title: '备注', minWidth: 200 },
    { title: '操作', width: 140, fixed: 'right', slots: { default: 'actions' } },
  ];
}
 
/** 配置表单:业务类型 + 启用开关 + 审批人 */
export function useConfigFormSchema(): VbenFormSchema[] {
  return [
    {
      fieldName: 'bizName',
      label: '业务类型',
      component: 'Input',
      componentProps: {
        disabled: true,
      },
    },
    {
      fieldName: 'bizType',
      label: '业务编码',
      component: 'Input',
      componentProps: {
        disabled: true,
      },
    },
    {
      fieldName: 'approvalEnabled',
      label: '启用审批',
      component: 'Switch',
      defaultValue: false,
      componentProps: {
        checkedChildren: '启用',
        unCheckedChildren: '停用',
      },
      help: '停用后该业务类型将无法提交审核',
    },
    {
      fieldName: 'userIds',
      label: '审批人',
      component: 'ApiSelect',
      componentProps: {
        api: getSimpleUserList,
        labelField: 'nickname',
        valueField: 'id',
        mode: 'multiple',
        allowClear: true,
        placeholder: '请选择审批人',
      },
      help: '可配置多个审批人,多个审批人之间为「或签」,即任意一人审核通过即为通过',
    },
    {
      fieldName: 'remark',
      label: '备注',
      component: 'Textarea',
      componentProps: {
        rows: 3,
        placeholder: '请输入备注',
      },
    },
  ];
}