king
2024-08-13 7bd04b1c21a59e8d79325f247bdb1726507b51fb
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
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
/**
 * @description 获取子菜单基本信息表单配置信息
 * @param {object} card      // 标签配置信息
 * @param {string} supMenu   // 上级菜单ID
 * @param {array}  menus     // 可选的上级菜单列表
 * @param {array}  equalTab  // 同级菜单IDs
 * @param {array}  equalTabs // 可选的同级菜单列表
 * @param {string} type      // 菜单类型,主表或树形结构
 */
export function getTabForm (card, supMenu, menus, equalTab, equalTabs, type) {
  return [
    {
      type: 'text',
      key: 'label',
      label: '标签名称',
      initVal: card.label || '',
      required: true
    },
    {
      type: 'select',
      key: 'linkTab',
      label: '关联标签',
      initVal: card.linkTab || '',
      required: false,
      options: []
    },
    {
      type: 'icon',
      key: 'icon',
      label: '图标',
      initVal: card.icon || '',
      required: false
    },
    {
      type: 'select',
      key: 'supMenu',
      label: '上级标签',
      initVal: supMenu,
      required: false,
      options: menus
    },
    {
      type: 'mutilselect',
      key: 'equalTab',
      label: '同级标签',
      tooltip: '如果子标签中含有刷新同级标签的按钮,在此处添加需要刷新的标签。',
      initVal: equalTab,
      required: false,
      options: equalTabs
    },
    // {
    //   type: 'text',
    //   key: 'foreignKey',
    //   label: '外键',
    //   tooltip: '外键旨在标签页中执行默认函数(添加)时,替换BID字段',
    //   initVal: card.foreignKey || '',
    //   required: false
    // },
    {
      type: 'number',
      key: 'level',
      label: '显示级别',
      tooltip: '标签显示控制,选择指定级别时显示标签,级别为空时始终显示。',
      initVal: card.level,
      min: 0,
      max: 10,
      required: false,
      forbid: type !== 'TreePage',
    },
    {
      type: 'radio',
      key: 'searchPass',
      label: '主表搜索',
      initVal: card.searchPass || 'false',
      tooltip: '使用主表搜索条件时,主表的搜索条件会传入子表中。',
      required: false,
      forbid: type !== 'CommonTable',
      options: [{
        value: 'true',
        text: '使用'
      }, {
        value: 'false',
        text: '不使用'
      }]
    }
  ]
}
 
/**
 * @description 获取卡片详情表单配置信息
 * @param {object}  card        // 标签配置信息
 * @param {array}   _columns    // 显示列
 * @param {string}  _type       // 类型,卡片的部位
 * @param {array}   _actions    // 按钮列表
 */
export function getCardDetailForm (card, _columns, _type, _actions = []) {
  let actions = ''
  if (_type === 'bottom') {
    actions = card.actions ? card.actions.map(cell => cell.value) : []
  } else if (_type === 'header') {
    _actions.unshift({
      value: '',
      text: '空'
    })
    actions = card.actions[0] ? card.actions[0].value : ''
  }
  return [
    {
      type: 'radio',
      key: 'datatype',
      label: '数据类型',
      initVal: card.datatype || 'dynamic',
      required: true,
      forbid: !['detail', 'header'].includes(_type),
      options: [{
        value: 'dynamic',
        text: '动态'
      }, {
        value: 'static',
        text: '静态'
      }]
    },
    {
      type: 'radio',
      key: 'type',
      label: '类型',
      initVal: card.type || 'picture',
      required: true,
      forbid: !['avatar'].includes(_type),
      options: [{
        value: 'picture',
        text: '图片'
      }, {
        value: 'icon',
        text: '图标'
      }]
    },
    {
      type: 'text',
      key: 'content',
      label: '内容',
      initVal: card.content || '',
      required: _type !== 'header',
      forbid: !['detail', 'header'].includes(_type),
    },
    {
      type: 'select',
      key: 'field',
      label: '字段',
      initVal: card.field || '',
      required: true,
      forbid: !['detail', 'header', 'avatar'].includes(_type),
      options: _columns
    },
    {
      type: 'number',
      key: 'fontSize',
      min: 12,
      max: 50,
      label: '字体大小',
      initVal: card.fontSize || 14,
      required: true,
      forbid: !['detail'].includes(_type)
    },
    {
      type: 'select',
      key: 'fontWeight',
      label: '字体粗细',
      initVal: card.fontWeight || 'normal',
      required: true,
      forbid: !['detail'].includes(_type),
      options: [{
        value: 'normal',
        text: '正常'
      }, {
        value: 'bold',
        text: 'bold'
      }, {
        value: 'bolder',
        text: 'bolder'
      }, {
        value: 'lighter',
        text: 'lighter'
      }, {
        value: '100',
        text: '100'
      }, {
        value: '200',
        text: '200'
      }, {
        value: '300',
        text: '300'
      }, {
        value: '400',
        text: '400'
      }, {
        value: '500',
        text: '500'
      }, {
        value: '600',
        text: '600'
      }, {
        value: '700',
        text: '700'
      }, {
        value: '800',
        text: '800'
      }, {
        value: '900',
        text: '900'
      }]
    },
    {
      type: 'number',
      key: 'width',
      min: 10,
      max: 100,
      precision: 1,
      label: '宽度(%)',
      initVal: card.width || 100,
      required: true,
      forbid: !['detail', 'avatar'].includes(_type)
    },
    {
      type: 'number',
      key: 'height',
      min: 1,
      max: 10,
      label: '高度(行)',
      initVal: card.height || 1,
      required: true,
      forbid: !['detail'].includes(_type)
    },
    {
      type: 'radio',
      key: 'radius',
      label: '圆角',
      initVal: card.radius || 'true',
      required: false,
      forbid: !['avatar'].includes(_type),
      options: [{
        value: 'true',
        text: '有'
      }, {
        value: 'false',
        text: '无'
      }]
    },
    {
      type: 'number',
      key: 'size',
      label: '字体大小',
      initVal: card.size || 28,
      min: 12,
      max: 500,
      required: false,
      hidden: true,
      forbid: !['avatar'].includes(_type)
    },
    {
      type: 'radio',
      key: 'align',
      label: '对齐',
      initVal: card.align || 'left',
      required: false,
      forbid: !['detail'].includes(_type),
      options: [{
        value: 'left',
        text: '左'
      }, {
        value: 'align-center',
        text: '居中'
      }, {
        value: 'align-right',
        text: '右'
      }]
    },
    {
      type: _type === 'bottom' ? 'multiselect' : 'select',
      key: 'actions',
      label: '按钮组',
      tooltip: '',
      initVal: actions,
      required: false,
      forbid: !['header', 'bottom'].includes(_type),
      options: _actions
    },
    {
      type: 'radio',
      key: 'show',
      label: '显示',
      initVal: card.show || 'icon',
      required: false,
      forbid: !['bottom', 'header'].includes(_type),
      options: [{
        value: 'icon',
        text: '图标'
      }, {
        value: 'text',
        text: '文字'
      }, {
        value: 'all',
        text: '全部'
      }]
    },
    {
      type: 'radio',
      key: 'display',
      label: '显示',
      initVal: card.display || 'inline',
      required: false,
      forbid: !['avatar'].includes(_type),
      options: [{
        value: 'block',
        text: '整行'
      }, {
        value: 'inline',
        text: '自动'
      }]
    },
  ]
}