king
2022-04-15 21d92eff0e23974d76e3e5a79ba50e3fc1c0b879
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
/**
 * @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: '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: 'syncModule', values: ['true']},
        {field: 'checkAll', 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
    },
    {
      type: 'multiselect',
      field: 'blacklist',
      label: '黑名单',
      initval: setting.blacklist || [],
      required: false,
      options: roleList,
      forbid: !!appType
    },
  ]
 
  return settingForm