king
2024-04-18 8f78c97ffcde201e2a4d1ffa7ccb97a13f0f045d
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
/**
 * @description Wrap表单配置信息
 */
export default function (wrap, subtype) {
  let appType = sessionStorage.getItem('appType')
  let roleList = sessionStorage.getItem('sysRoles')
  let ispop = sessionStorage.getItem('editMenuType') === 'popview'
 
  if (roleList) {
    try {
      roleList = JSON.parse(roleList)
    } catch (e) {
      roleList = []
    }
  } else {
    roleList = []
  }
 
  const cardWrapForm = [
    {
      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: 'radio',
      field: 'datatype',
      label: '数据来源',
      initval: wrap.datatype || 'dynamic',
      tooltip: '选择静态值,无需配置数据源。',
      required: false,
      options: [
        {value: 'dynamic', label: '动态'},
        {value: 'static', label: '静态'},
      ],
      controlFields: [
        {field: 'empty', values: ['dynamic']},
      ],
      forbid: subtype !== 'propcard'
    },
    {
      type: 'radio',
      field: 'display',
      label: '显示模式',
      initval: wrap.display || 'normal',
      required: false,
      options: [
        {value: 'normal', label: '正常'},
        {value: 'modal', label: '弹窗'},
      ],
      controlFields: [
        {field: 'modalWidth', values: ['modal']},
        {field: 'modalContent', values: ['modal']},
        {field: 'code', values: ['modal']},
      ]
    },
    {
      type: 'radio',
      field: 'modalContent',
      label: '弹窗内容',
      initval: wrap.modalContent || 'message',
      tooltip: '使用系统更新时,如果返回值的ErrCode为-1,只会做系统配置更新不会显示弹窗。注:数据源使用同步查询时无效。',
      required: false,
      options: [
        {value: 'message', label: '消息提醒'},
        {value: 'update', label: '系统更新'},
      ]
    },
    {
      type: 'styleInput',
      field: 'height',
      label: '组件高度',
      initval: wrap.height || '',
      required: true,
      options: ['px', 'vh']
    },
    {
      type: 'styleInput',
      field: 'modalWidth',
      label: '弹窗宽度',
      initval: wrap.modalWidth || '300px',
      required: true,
      options: ['px', 'vw'],
      forbid: appType === 'mob'
    },
    {
      type: 'text',
      field: 'code',
      label: '消息编码',
      initval: wrap.code || '',
      tooltip: '用于记录消息是否已读的标识,如果不同页面中存在相同消息,可指定固定值。',
      required: false,
      rules: [{
        pattern: /^[0-9a-zA-Z_]*$/ig,
        message: '只允许包含数字、字母以及_。'
      }]
    },
    {
      type: 'radio',
      field: 'autoplay',
      label: '自动切换',
      initval: wrap.autoplay || 'false',
      required: false,
      options: [
        {value: 'false', label: '否'},
        {value: 'true', label: '是'}
      ],
      controlFields: [
        {field: 'speed', values: ['true']}
      ]
    },
    {
      type: 'number',
      field: 'speed',
      label: '时间间隔',
      initval: wrap.speed || 3,
      tooltip: '默认为3秒',
      min: 1,
      max: 100,
      precision: 0,
      required: false
    },
    {
      type: 'radio',
      field: 'dots',
      label: '指示点',
      initval: wrap.dots || 'true',
      required: false,
      options: [
        {value: 'true', label: '显示'},
        {value: 'false', label: '隐藏'},
      ]
    },
    {
      type: 'radio',
      field: 'vertical',
      label: '垂直显示',
      initval: wrap.vertical || 'false',
      required: false,
      options: [
        {value: 'true', label: '是'},
        {value: 'false', label: '否'},
      ],
      forbid: appType !== 'mob'
    },
    {
      type: 'radio',
      field: 'dotPosition',
      label: '指示点位置',
      initval: wrap.dotPosition || 'bottom',
      required: false,
      options: [
        {value: 'top', label: '上'},
        {value: 'bottom', label: '下'},
        {value: 'left', label: '左'},
        {value: 'right', label: '右'},
      ],
      forbid: appType === 'mob'
    },
    {
      type: 'radio',
      field: 'effect',
      label: '动画效果',
      initval: wrap.effect || 'scrollx',
      required: false,
      options: [
        {value: 'scrollx', label: '切换'},
        {value: 'fade', 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 || (!appType ? 'true' : 'false'),
      required: false,
      options: [
        {value: 'true', label: !appType ? '继承菜单' : '启用'},
        {value: 'false', label: '禁用'},
      ],
      forbid: ispop
    },
    {
      type: 'radio',
      field: 'cacheLocal',
      label: '本地缓存',
      initval: wrap.cacheLocal || 'true',
      required: false,
      options: [
        {value: 'true', label: '继承菜单'},
        {value: 'false', label: '禁用'},
      ],
      forbid: ispop
    },
    {
      type: 'multiselect',
      field: 'blacklist',
      label: '黑名单',
      initval: wrap.blacklist || [],
      required: false,
      options: roleList,
      forbid: !!appType
    },
  ]
 
  return cardWrapForm