king
2024-06-01 4cc738e535d1a20701d206e12cf9de8cc5a01170
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
/**
 * @description Wrap表单配置信息
 */
export default function (wrap, columns) {
  let appType = sessionStorage.getItem('appType')
  let roleList = sessionStorage.getItem('sysRoles')
  let isprint = sessionStorage.getItem('MenuType') === 'billPrint'
  let ispop = sessionStorage.getItem('editMenuType') === 'popview'
  let menu = window.GLOB.customMenu
  let interfaces = []
 
  if (menu.interfaces) {
    menu.interfaces.forEach(item => {
      if (item.status === 'true') {
        interfaces.push({
          value: item.uuid,
          label: item.name,
          columns: JSON.parse(JSON.stringify(item.columns))
        })
      }
    })
  }
 
  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: '静态'},
        {value: 'public', label: '公共数据源'},
      ],
      controlFields: [
        {field: 'field', values: ['dynamic', 'public']},
        {field: 'empty', values: ['dynamic', 'public']},
        {field: 'publicId', values: ['public']},
        {field: 'encryption', values: ['dynamic', 'public']},
      ]
    },
    {
      type: 'select',
      field: 'publicId',
      label: '数据源',
      initval: wrap.publicId || '',
      required: true,
      options: interfaces,
      reset_source: true,
      callback: (record) => {
        if (!record.publicId) return
 
        let d = interfaces.filter(m => m.value === record.publicId)[0]
 
        if (!d || !d.columns) return
 
        return {
          field: d.columns
        }
      }
    },
    {
      type: 'select',
      field: 'field',
      label: '文本字段',
      initval: wrap.field || '',
      timestamp: new Date().getTime(),
      required: false,
      options: columns
    },
    {
      type: 'radio',
      field: 'encryption',
      label: '数据解码',
      initval: wrap.encryption || 'true',
      tooltip: '从数据源获取的数据是否需要解码。',
      required: false,
      options: [
        {value: 'true', label: '是'},
        {value: 'false', label: '否'},
      ]
    },
    {
      type: 'radio',
      field: 'empty',
      label: '空值隐藏',
      initval: wrap.empty || 'show',
      tooltip: '当查询数据为空时,隐藏该组件。',
      required: false,
      skip: true,
      options: [
        {value: 'show', label: '否'},
        {value: 'hidden', label: '是'},
      ],
    },
    {
      type: 'radio',
      field: 'firstTr',
      label: '表格首行',
      initval: wrap.firstTr || 'deep',
      tooltip: '富文本中table的首行背景颜色。',
      required: false,
      options: [
        {value: 'deep', label: '深色'},
        {value: 'light', label: '浅色'},
      ]
    },
    {
      type: 'radio',
      field: 'permission',
      label: '权限验证',
      initval: wrap.permission || 'false',
      required: false,
      options: [
        {value: 'true', label: '启用'},
        {value: 'false', label: '禁用'},
      ],
      forbid: !appType || ispop || isprint
    },
    {
      type: 'multiselect',
      field: 'blacklist',
      label: '黑名单',
      initval: wrap.blacklist || [],
      required: false,
      options: roleList,
      forbid: !!appType || isprint
    },
  ]
 
  return cardWrapForm