king
2025-05-13 1a176e4bdba485301385caac1a29102e598d25cc
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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
/**
 * @description Wrap表单配置信息
 */
export default function (wrap, columns = []) {
  let roleList = sessionStorage.getItem('sysRoles')
  let appType = sessionStorage.getItem('appType')
 
  if (roleList) {
    try {
      roleList = JSON.parse(roleList)
    } catch (e) {
      roleList = []
    }
  } else {
    roleList = []
  }
 
  const wrapForm = [
    {
      type: 'text',
      field: 'title',
      label: '标题',
      initval: wrap.title || '',
      required: false
    },
    {
      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: 'number',
      field: 'height',
      label: '最大高度',
      initval: wrap.height || '',
      tooltip: '表格内容区的最大高度(不包含表头),空值时高度自适应。注:小于等于100大于0时为高度的百分比,小于0时为窗口高度减去此值。',
      min: -1000,
      max: 3000,
      precision: 0,
      required: false
    },
    {
      type: 'select',
      field: 'commit',
      label: '数据提交',
      initval: wrap.commit || 'all',
      tooltip: '设置为修改项时,在失去焦点且不存在必填项为空时触发提交。设置为修改项(全)时,在点击提交按钮时触发提交。设置为勾选项时,只提交选中的数据,未选中数据时不可提交。',
      required: false,
      options: [
        {value: 'all', label: '全部'},
        {value: 'change', label: '修改项'},
        {value: 'amend', label: '修改项(全)'},
        {value: 'check', label: '勾选项'},
      ],
      reset_source: true,
      callback: (record) => {
        return {
          tableType: [
            {value: '', label: '不可选', disabled: record.commit === 'check'},
            {value: 'radio', label: '单选'},
            {value: 'checkbox', label: '多选'},
          ]
        }
      }
    },
    {
      type: 'radio',
      field: 'editType',
      label: '编辑模式',
      initval: wrap.editType || 'simple',
      tooltip: '可编辑表单是否全部放开。',
      required: false,
      options: [
        {value: 'simple', label: '单项'},
        {value: 'multi', label: '整体'},
      ]
    },
    // {
    //   type: 'radio',
    //   field: 'cache',
    //   label: '缓存',
    //   initval: wrap.cache || 'true',
    //   tooltip: '对于使用数据源的下拉菜单,下拉选项是否缓存到本地。',
    //   required: false,
    //   options: [
    //     {value: 'true', label: '使用'},
    //     {value: 'false', label: '不使用'},
    //   ]
    // },
    {
      type: 'radio',
      field: 'tableType',
      label: '表格属性',
      initval: wrap.tableType || '',
      required: false,
      timestamp: new Date().getTime(),
      options: [
        {value: '', label: '不可选', disabled: wrap.commit === 'check'},
        {value: 'radio', label: '单选'},
        {value: 'checkbox', label: '多选'},
      ]
    },
    {
      type: 'radio',
      field: 'size',
      label: '表格大小',
      initval: wrap.size || 'middle',
      tooltip: '表格的内边距,从大到小依次递减。',
      required: false,
      options: [
        {value: 'default', label: '大'},
        {value: 'middle', label: '中'},
        {value: 'small', label: '小'},
        // {value: 'mini', label: '迷你'},
      ]
    },
    {
      type: 'radio',
      field: 'searchSize',
      label: '搜索样式',
      initval: wrap.searchSize === 'middle' ? '' : wrap.searchSize || '',
      required: false,
      options: [
        {value: '', label: '默认'},
        {value: 'small', label: '小间距'},
        {value: 'updown', label: '上下排列'},
      ],
    },
    {
      type: 'radio',
      field: 'parity',
      label: '奇偶异色',
      initval: wrap.parity || 'false',
      required: false,
      options: [
        {value: 'true', label: '启用'},
        {value: 'false', label: '禁用'},
      ]
    },
    {
      type: 'radio',
      field: 'bordered',
      label: '边框',
      initval: wrap.bordered || 'true',
      required: false,
      options: [
        {value: 'true', label: '有'},
        {value: 'false', label: '无'},
      ]
    },
    {
      type: 'radio',
      field: 'tableHeader',
      label: '表头',
      initval: wrap.tableHeader || 'show',
      required: false,
      options: [
        {value: 'show', label: '显示'},
        {value: 'hidden', label: '隐藏'},
      ]
    },
    {
      type: 'radio',
      field: 'mode',
      label: '模式',
      initval: wrap.mode || 'default',
      required: false,
      options: [
        {value: 'default', label: '常规'},
        {value: 'ghost', label: '透明'},
      ]
    },
    {
      type: 'color',
      field: 'borderColor',
      label: '边框颜色',
      initval: wrap.borderColor || '#e8e8e8',
      tooltip: '默认值 #e8e8e8。',
      required: false
    },
    {
      type: 'radio',
      field: 'vertical',
      label: '垂直对齐',
      initval: wrap.vertical || 'middle',
      tooltip: '单元格的垂直对齐方式。',
      required: false,
      options: [
        {value: 'top', label: '向上'},
        {value: 'middle', label: '居中'},
        {value: 'bottom', label: '向下'},
      ]
    },
    {
      type: 'radio',
      field: 'permission',
      label: '权限验证',
      initval: wrap.permission || (!appType ? 'true' : 'false'),
      required: false,
      options: [
        {value: 'true', label: !appType ? '继承菜单' : '启用'},
        {value: 'false', label: '禁用'},
      ],
      forbid: sessionStorage.getItem('editMenuType') === 'popview'
    },
    {
      type: 'radio',
      field: 'empty',
      label: '空值隐藏',
      initval: wrap.empty || 'show',
      tooltip: '当查询数据为空时,隐藏该组件。',
      required: false,
      options: [
        {value: 'show', label: '否'},
        {value: 'hidden', label: '是'},
      ],
      controlFields: [
        {field: 'empSign', values: ['show']},
      ]
    },
    {
      type: 'radio',
      field: 'empSign',
      label: '空值图标',
      initval: wrap.empSign || 'show',
      tooltip: '当查询数据为空时,是否显示空值提示图标。',
      required: false,
      options: [
        {value: 'show', label: '显示'},
        {value: 'hidden', label: '隐藏'},
      ],
    },
    {
      type: 'select',
      field: 'tipField',
      label: '信息提示',
      initval: wrap.tipField || '',
      tooltip: '鼠标悬浮于行上方时的提示信息。',
      required: false,
      allowClear: true,
      joint: true,
      options: columns
    },
    {
      type: 'number',
      field: 'maxPageSize',
      label: '每页最大数',
      initval: wrap.maxPageSize || '',
      tooltip: '分页时每页可显示的最大数量。',
      min: 10,
      max: 500,
      precision: 0,
      required: false
    },
    {
      type: 'multiselect',
      field: 'blacklist',
      label: '黑名单',
      initval: wrap.blacklist || [],
      required: false,
      options: roleList,
      forbid: !!appType
    },
  ]
 
  return wrapForm