king
2024-06-17 b6c7f588b831d6fa4eb23b50ec08ea0b263a0717
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
/**
 * @description Wrap表单配置信息
 */
export default function (group) {
  let appType = sessionStorage.getItem('appType')
  let fields = [{field: '', label: '空'}]
 
  if (appType === 'mob') {
    group.fields.forEach(f => {
      if (f.field && ['select', 'text', 'number', 'textarea'].includes(f.type) && f.hidden !== 'true' && f.readonly !== 'true') {
        fields.push(f)
      }
    })
  } else {
    group.fields.forEach(f => {
      if (f.field && ['select', 'link', 'text', 'number', 'textarea'].includes(f.type) && f.hidden !== 'true' && f.readonly !== 'true') {
        fields.push(f)
      }
    })
  }
 
  let buttons = []
 
  if (group.prevButton && group.prevButton.enable === 'true') {
    buttons.push('prevEnable')
  }
  if (!group.subButton.enable || group.subButton.enable === 'true') {
    buttons.push('subEnable')
  }
  if (group.nextButton && group.nextButton.enable === 'true') {
    buttons.push('nextEnable')
  }
 
  const groupForm = [
    {
      type: 'text',
      field: 'title',
      label: '标题',
      initval: group.setting.title || '',
      required: true
    },
    {
      type: 'text',
      field: 'status',
      label: '状态值',
      initval: group.setting.status || '',
      tooltip: '用于表单加载时的状态控制。',
      required: false,
      forbid: !group.prevButton
    },
    {
      type: 'select',
      field: 'focus',
      label: '初始焦点',
      initval: group.setting.focus || '',
      required: false,
      options: fields
    },
    {
      type: 'radio',
      field: 'cache',
      label: '选项查询',
      initval: group.setting.cache || 'true',
      tooltip: '需要通过数据源查询的选项,是否使用缓存。',
      required: false,
      options: [
        {value: 'true', label: '缓存'},
        {value: 'false', label: '实时'},
      ]
    },
    {
      type: 'radio',
      field: 'align',
      label: '表单排列',
      initval: group.setting.align || 'left_right',
      required: false,
      options: [
        {value: 'left_right', label: '左右'},
        {value: 'up_down', label: '上下'},
      ],
      forbid: appType === 'mob'
    },
    {
      type: 'radio',
      field: 'verticalSpace',
      label: '竖向间隙',
      initval: group.setting.verticalSpace || 'normal',
      tooltip: '正常间隙会预留出报错信息的位置,防止表单位置发生变化。',
      required: false,
      options: [
        {value: 'normal', label: '正常'},
        {value: 'middle', label: '中'},
        {value: 'small', label: '小'},
      ],
      forbid: appType === 'mob'
    },
    {
      type: 'checkbox',
      field: 'buttons',
      label: '按钮组',
      initval: buttons,
      tooltip: '上一步在第一组中不显示,跳过在最后一组不显示,注:除关闭功能外。',
      required: false,
      options: [
        {value: 'prevEnable', label: '上一步'},
        {value: 'subEnable', label: '提交'},
        {value: 'nextEnable', label: '跳过'},
      ],
      forbid: !group.prevButton
    },
    // {
    //   type: 'radio',
    //   field: 'prevEnable',
    //   label: '上一步',
    //   initval: group.prevButton ? group.prevButton.enable || 'false' : 'false',
    //   tooltip: '第一组不显示。注:除关闭功能外。',
    //   required: false,
    //   options: [
    //     {value: 'true', label: '显示'},
    //     {value: 'false', label: '隐藏'},
    //   ],
    //   forbid: !group.prevButton
    // },
    {
      type: 'radio',
      field: 'subEnable',
      label: '提交',
      initval: group.subButton.enable || 'true',
      required: false,
      options: [
        {value: 'true', label: '显示'},
        {value: 'false', label: '隐藏'},
      ],
      forbid: !!group.prevButton
    },
    // {
    //   type: 'radio',
    //   field: 'nextEnable',
    //   label: '跳过',
    //   initval: group.nextButton ? group.nextButton.enable || 'false' : 'false',
    //   tooltip: '最后一组不显示。注:除关闭功能外。',
    //   required: false,
    //   options: [
    //     {value: 'true', label: '显示'},
    //     {value: 'false', label: '隐藏'},
    //   ],
    //   forbid: !group.nextButton
    // },
  ]
 
  return groupForm