king
2024-08-25 ae170a9d58b4f91a225eada1dc83ed4a116b8d50
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
/**
 * @description Wrap表单配置信息
 */
export default function (wrap, columns) {
  let roleList = sessionStorage.getItem('sysRoles')
  let appType = sessionStorage.getItem('appType')
  let ispop = sessionStorage.getItem('editMenuType') === 'popview'
 
  if (roleList) {
    try {
      roleList = JSON.parse(roleList)
    } catch (e) {
      roleList = []
    }
  } else {
    roleList = []
  }
 
  const balconyWrapForm = [
    {
      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: 'direction',
      label: '轴线方向',
      initval: wrap.direction || 'vertical',
      required: false,
      options: [
        {value: 'vertical', label: '纵向'},
        {value: 'horizontal', label: '横向'},
      ],
      controlFields: [
        {field: 'mode', values: ['vertical']},
        {field: 'hmode', values: ['horizontal']},
        {field: 'label', values: ['vertical']},
        {field: 'iconSize', values: ['horizontal']},
        {field: 'dotSign', values: ['horizontal']},
      ]
    },
    {
      type: 'radio',
      field: 'mode',
      label: '轴线位置',
      initval: ['left', 'alternate', 'right'].includes(wrap.mode) ? wrap.mode : 'left',
      required: false,
      options: [
        {value: 'left', label: '左侧'},
        {value: 'alternate', label: '中间'},
        {value: 'right', label: '右侧'},
      ]
    },
    {
      type: 'radio',
      field: 'hmode',
      label: '轴线位置',
      initval: ['up', 'down'].includes(wrap.mode) ? wrap.mode : 'up',
      required: false,
      options: [
        {value: 'up', label: '上侧'},
        {value: 'down', label: '下侧'}
      ]
    },
    // {
    //   type: 'radio',
    //   field: 'reverse',
    //   label: '排序',
    //   initval: wrap.reverse || 'false',
    //   required: false,
    //   options: [
    //     {value: 'false', label: '正序'},
    //     {value: 'true', label: '倒序'},
    //   ]
    // },
    {
      type: 'color',
      field: 'color',
      label: '节点颜色',
      initval: wrap.color || '#1890ff',
      tooltip: '节点默认颜色。',
      required: false
    },
    {
      type: 'radio',
      field: 'line',
      label: '连线颜色',
      initval: wrap.line || '',
      required: false,
      options: [
        {value: '', label: '默认'},
        {value: 'system', label: '系统色'},
      ]
    },
    {
      type: 'radio',
      field: 'dotSign',
      label: '节点渲染',
      initval: wrap.dotSign || 'background',
      tooltip: '节点的渲染方式,在节点组中设置的颜色渲染图标还是渲染背景色。',
      required: false,
      options: [
        {value: 'background', label: '背景色'},
        {value: 'icon', label: '图标'},
      ]
    },
    {
      type: 'select',
      field: 'iconSize',
      label: '图标大小',
      initval: wrap.iconSize || '',
      tooltip: '图标可在节点组中添加。',
      required: false,
      options: [
        {value: '', label: '默认(14px)'},
        {value: 'size16', label: '16px'},
        {value: 'size18', label: '18px'},
        {value: 'size20', label: '20px'},
        {value: 'size22', label: '22px'},
        {value: 'size24', label: '24px'},
        {value: 'adaptive', label: '自适应'},
      ]
    },
    {
      type: 'select',
      field: 'label',
      label: '标签',
      initval: wrap.label || '',
      tooltip: '在内容对面单独展示。',
      required: false,
      options: columns,
      forbid: !appType
    },
    {
      type: 'select',
      field: 'node',
      label: '节点控制',
      initval: wrap.node || '',
      tooltip: '选择自定义节点的控制字段后,在节点组中添加节点样式。',
      required: false,
      options: columns
    },
    {
      type: 'radio',
      field: 'btnControl',
      label: '按钮控制',
      initval: wrap.btnControl || 'show',
      tooltip: '可设置按钮显示规则,始终显示或鼠标悬浮时显示。',
      required: false,
      options: [
        {value: 'show', label: '正常显示'},
        {value: 'hover', label: '悬浮显示'},
      ],
      forbid: appType === 'mob'
    },
    {
      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: 'radio',
      field: 'empty',
      label: '空值隐藏',
      initval: wrap.empty || 'show',
      tooltip: '当查询数据为空时,隐藏该组件。',
      required: false,
      options: [
        {value: 'show', label: '否'},
        {value: 'hidden', label: '是'},
      ],
    },
    {
      type: 'multiselect',
      field: 'blacklist',
      label: '黑名单',
      initval: wrap.blacklist || [],
      required: false,
      options: roleList,
      forbid: !!appType
    },
  ]
 
  return balconyWrapForm