king
2023-07-11 061e2388d84fc545d01175ed6793ce8dea0e7338
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
import MenuUtils from '@/utils/utils-custom.js'
 
/**
 * @description Wrap表单配置信息
 */
export default function (config) {
  let appType = sessionStorage.getItem('appType')
  let roleList = sessionStorage.getItem('sysRoles')
  let wrap = config.wrap
 
  if (roleList) {
    try {
      roleList = JSON.parse(roleList)
    } catch (e) {
      roleList = []
    }
  } else {
    roleList = []
  }
 
  let modules = []
  let menu = window.GLOB.customMenu
  modules = MenuUtils.getSupModules(menu.components, config.uuid, menu.interfaces)
 
  if (wrap.supModule && wrap.supModule.length > 0 && wrap.supModule[0] !== 'empty') {
    let has = MenuUtils.checkSupModules(modules, wrap.supModule.slice(-1)[0])
    if (!has) {
      wrap.supModule = ''
    }
  }
 
  const wrapForm = [
    {
      type: 'text',
      field: 'name',
      label: '组件名称',
      initval: wrap.name || '',
      tooltip: '用于组件间的区分。',
      required: true
    },
    {
      type: 'number',
      field: 'width',
      label: '宽度',
      initval: wrap.width || 24,
      tooltip: '栅格布局,每行等分为24列。',
      min: 1,
      max: 24,
      precision: 0,
      required: true
    },
    {
      type: 'radio',
      field: 'datatype',
      label: '数据来源',
      initval: wrap.datatype || 'static',
      tooltip: '初始值来源于数据源或表单默认值。',
      required: false,
      options: [
        {value: 'dynamic', label: '动态'},
        {value: 'static', label: '静态'},
      ],
      controlFields: [
        {field: 'empty', values: ['dynamic']},
        {field: 'supModule', values: ['static']},
      ]
    },
    {
      type: 'select',
      field: 'statusControl',
      label: '状态控制',
      initval: wrap.statusControl || '',
      tooltip: '表单加载时的状态,当字段值与表单组的状态值一致时,启用对应的表单组。',
      required: false,
      options: config.columns,
      forbid: config.subtype === 'tabform'
    },
    {
      type: 'radio',
      field: 'groupLabel',
      label: '分组名称',
      initval: wrap.groupLabel || 'show',
      tooltip: '加载时是否显示分组名称。',
      required: false,
      options: [
        {value: 'show', label: '显示'},
        {value: 'hidden', label: '隐藏'},
      ],
      // controlFields: [
      //   {field: 'labelSize', values: ['show']},
      // ]
    },
    // {
    //   type: 'number',
    //   field: 'labelSize',
    //   label: '名称大小',
    //   initval: wrap.labelSize || '',
    //   tooltip: '分组名称字体大小。',
    //   min: 12,
    //   max: 50,
    //   precision: 0,
    //   required: false
    // },
    {
      type: 'radio',
      field: 'tabtype',
      label: '分组风格',
      initval: wrap.tabtype || 'mktab',
      required: false,
      options: [
        {value: 'mktab', label: 'tab页'},
        {value: 'mkbtn', label: '按钮组'},
      ],
      forbid: config.subtype !== 'tabform'
    },
    {
      type: 'color',
      field: 'color',
      label: '颜色控制',
      initval: wrap.color || '#1890ff',
      tooltip: '完成后的颜色',
      required: false,
      forbid: config.subtype === 'tabform'
    },
    {
      type: 'radio',
      field: 'formStyle',
      label: '表单样式',
      initval: wrap.formStyle || '',
      required: false,
      options: [
        {value: '', label: '默认'},
        {value: 'shadow', label: '阴影'},
      ],
      forbid: appType !== 'mob'
    },
    {
      type: 'radio',
      field: 'goback',
      label: '空值返回',
      initval: wrap.goback || 'false',
      tooltip: '当查询数据为空时,返回上一界面。',
      required: false,
      options: [
        {value: 'true', label: '是'},
        {value: 'false', label: '否'},
      ],
      forbid: appType !== 'mob'
    },
    {
      type: 'radio',
      field: 'empty',
      label: '空值隐藏',
      initval: wrap.empty || 'show',
      tooltip: '当查询数据为空时,隐藏该组件。',
      required: false,
      skip: true,
      options: [
        {value: 'show', label: '否'},
        {value: 'hidden', label: '是'},
      ],
    },
    {
      type: 'radio',
      field: 'permission',
      label: '权限验证',
      initval: wrap.permission || 'false',
      required: false,
      options: [
        {value: 'true', label: '启用'},
        {value: 'false', label: '禁用'},
      ],
      forbid: !appType || sessionStorage.getItem('editMenuType') === 'popview'
    },
    {
      type: 'cascader',
      field: 'supModule',
      label: '上级组件',
      initval: wrap.supModule || [],
      required: false,
      options: modules,
      allowClear: true
    },
    {
      type: 'multiselect',
      field: 'blacklist',
      label: '黑名单',
      initval: wrap.blacklist || [],
      required: false,
      options: roleList,
      forbid: !!appType
    },
  ]
 
  return wrapForm