king
2024-04-05 f5130f2469384b423043a111223b518e78f43075
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
/**
 * @description Wrap表单配置信息
 */
export default function (setting) {
  let roleList = sessionStorage.getItem('sysRoles')
  let appType = sessionStorage.getItem('appType')
 
  if (roleList) {
    try {
      roleList = JSON.parse(roleList)
    } catch (e) {
      roleList = []
    }
  } else {
    roleList = []
  }
 
  const settingForm = [
    {
      type: 'text',
      field: 'title',
      label: '标题',
      initval: setting.title || '',
      required: false
    },
    {
      type: 'text',
      field: 'name',
      label: '组件名称',
      initval: setting.name || '',
      tooltip: '用于组件间的区分。',
      required: true
    },
    {
      type: 'number',
      field: 'width',
      label: '宽度',
      initval: setting.width || 24,
      tooltip: '栅格布局,每行等分为24列。',
      min: 1,
      max: 24,
      precision: 0,
      required: true
    },
    // {
    //   type: 'radio',
    //   field: 'print',
    //   label: '打印按钮',
    //   initval: setting.print || 'false',
    //   required: false,
    //   options: [
    //     {value: 'true', label: '显示'},
    //     {value: 'false', label: '隐藏'},
    //   ],
    //   controlFields: [
    //     {field: 'pageSize', values: ['true']},
    //     {field: 'pageLayout', values: ['true']},
    //     {field: 'hide', values: ['true']},
    //   ],
    //   forbid: appType === 'mob'
    // },
    // {
    //   type: 'radio',
    //   field: 'pageSize',
    //   label: '打印尺寸',
    //   initval: setting.pageSize || 'A4',
    //   required: true,
    //   options: [
    //     {value: 'A3', label: 'A3'},
    //     {value: 'A4', label: 'A4'},
    //     {value: 'A5', label: 'A5'},
    //   ],
    //   forbid: appType === 'mob'
    // },
    // {
    //   type: 'radio',
    //   field: 'pageLayout',
    //   label: '打印布局',
    //   initval: setting.pageLayout || 'vertical',
    //   required: true,
    //   options: [
    //     {value: 'vertical', label: '纵向'},
    //     {value: 'horizontal', label: '横向'},
    //   ],
    //   forbid: appType === 'mob'
    // },
    // {
    //   type: 'checkbox',
    //   field: 'hide',
    //   label: '隐藏元素',
    //   initval: setting.hide || [],
    //   tooltip: '执行打印时需要隐藏的页面元素。',
    //   required: false,
    //   options: [
    //     {value: 'search', label: '搜索'},
    //     {value: 'button', label: '按钮'},
    //   ],
    //   forbid: appType === 'mob'
    // },
    {
      type: 'radio',
      field: 'permission',
      label: '权限验证',
      initval: setting.permission || 'false',
      required: false,
      options: [
        {value: 'true', label: '启用'},
        {value: 'false', label: '禁用'},
      ],
      forbid: !appType || sessionStorage.getItem('editMenuType') === 'popview'
    },
    {
      type: 'radio',
      field: 'layout',
      label: '元素布局',
      initval: setting.layout || 'grid',
      tooltip: '分组中元素的排列方式',
      required: false,
      options: [
        {value: 'grid', label: '栅格布局'},
        {value: 'flex', label: '弹性布局'},
      ]
    },
    {
      type: 'radio',
      field: 'mergeAble',
      label: '展开/收起',
      initval: setting.mergeAble || 'false',
      tooltip: '启用时,组件右上角将出现展开/收起的图标,可将当前组件展开或收起。',
      required: false,
      options: [
        {value: 'true', label: '启用'},
        {value: 'false', label: '禁用'},
      ],
      controlFields: [
        {field: 'ctrlNumber', values: ['true']},
      ],
      forbid: appType === 'mob'
    },
    {
      type: 'number',
      field: 'ctrlNumber',
      label: '控制数',
      initval: setting.ctrlNumber || 1,
      tooltip: '当组件收起时,其后需要展开的组件数。',
      min: 1,
      max: 5,
      precision: 0,
      required: true,
      forbid: appType === 'mob'
    },
    {
      type: 'multiselect',
      field: 'blacklist',
      label: '黑名单',
      initval: setting.blacklist || [],
      required: false,
      options: roleList,
      forbid: !!appType
    },
  ]
 
  return settingForm