king
2022-04-02 8436ec13ba28c0bc979be149ff1aa79eb6324fff
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
/**
 * @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'].includes(f.type) && f.hidden !== 'true' && f.readonly !== 'true') {
        fields.push(f)
      }
    })
  } else {
    group.fields.forEach(f => {
      if (f.field && ['select', 'link', 'text', 'number'].includes(f.type) && f.hidden !== 'true' && f.readonly !== 'true') {
        fields.push(f)
      }
    })
  }
 
  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: '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: '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: '隐藏'},
      ]
    },
    {
      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