king
2022-01-02 bde2916433c7830e2879e6524e32b9f6c8bd0bab
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
/**
 * @description Setting表单配置信息
 */
export default function (setting, subtype, buttons = [], cardType, columns) {
  let appType = sessionStorage.getItem('appType')
  let hasMenus = subtype === 'datacard' && cardType !== 'extendCard'
 
  let menulist = []
  let appmenulist = []
 
  if (appType) {
    appmenulist = sessionStorage.getItem('appMenus')
    if (appmenulist) {
      try {
        appmenulist = JSON.parse(appmenulist)
      } catch (e) {
        appmenulist = []
      }
    } else {
      appmenulist = []
    }
    if (appType === 'mob' && hasMenus) { // 数据卡可打开即时通信
      appmenulist.push({
        value: 'IM', label: '即时通信(系统页)'
      })
    }
  } else {
    menulist = sessionStorage.getItem('fstMenuList')
    if (menulist) {
      try {
        menulist = JSON.parse(menulist)
      } catch (e) {
        menulist = []
      }
    } else {
      menulist = []
    }
  }
 
  let ops = []
  if (hasMenus) {
    ops = [{value: 'menus', label: '菜单组'}]
  }
 
  const cardSettingForm = [
    {
      type: 'number',
      field: 'width',
      label: '卡片宽度',
      initval: setting.width || 24,
      tooltip: '栅格布局,每行等分为24列。',
      min: 1,
      max: 24,
      precision: 0,
      required: true
    },
    {
      type: 'radio',
      field: 'type',
      label: '卡片类型',
      initval: setting.type || 'simple',
      tooltip: '选择复式卡时,可配置鼠标悬浮时的显示信息。',
      required: false,
      options: [
        {value: 'simple', label: '单卡'},
        {value: 'multi', label: '复式卡'},
      ],
      controlFields: [
        {field: 'transform', values: ['multi']},
      ],
      forbid: appType === 'mob'
    },
    {
      type: 'select',
      field: 'transform',
      label: '过渡效果',
      initval: setting.transform || 'up',
      tooltip: '复式卡片鼠标悬浮信息的动画效果。',
      required: false,
      options: [
        {value: 'up', label: '向上滑动'},
        {value: 'down', label: '向下滑动'},
        {value: 'left', label: '向左滑动'},
        {value: 'right', label: '向右滑动'},
        {value: 'scale', label: '缩放'},
        {value: 'opacity', label: '透明度'},
        {value: 'rotateX', label: '纵向展开'},
        {value: 'rotateY', label: '横向展开'},
      ]
    },
    {
      type: 'text',
      field: 'primaryId',
      label: '静态主键值',
      initval: setting.primaryId || '',
      tooltip: '设置一个属性卡静态ID,向其他组件传递的指定静态ID值,主键为动态值时无效。',
      required: false,
      forbid: subtype !== 'propcard'
    },
    {
      type: !hasMenus ? 'radio' : 'select',
      field: 'click',
      label: '点击事件',
      initval: setting.click || '',
      tooltip: '当绑定点击事件时,卡片的切换功能将失效。',
      required: false,
      options: [
        {value: '', label: '无'},
        {value: 'menu', label: '菜单'},
        {value: 'link', label: '链接'},
        {value: 'button', label: '按钮'},
        ...ops
      ],
      controlFields: [
        {field: 'menu', values: ['menu']},
        {field: 'linkurl', values: ['link']},
        {field: 'open', values: ['menu', 'link', 'menus']},
        {field: 'joint', values: ['menu', 'link', 'menus']},
        {field: 'linkbtn', values: ['button']},
        {field: 'menuType', values: ['menus']},
      ]
    },
    {
      type: 'select',
      field: 'menuType',
      label: '菜单类型',
      initval: setting.menuType || '',
      required: true,
      options: columns,
    },
    {
      type: appType ? 'select' : 'cascader',
      field: 'menu',
      label: '关联菜单',
      initval: setting.menu || (appType ? '' : []),
      required: true,
      options: appType ? appmenulist : menulist,
    },
    {
      type: 'textarea',
      field: 'linkurl',
      label: '链接',
      initval: setting.linkurl || '',
      required: true,
      options: [],
      span: 24
    },
    {
      type: 'radio',
      field: 'open',
      label: '打开方式',
      initval: setting.open || 'blank',
      required: false,
      options: [
        {value: 'blank', label: '新窗口'},
        {value: 'self', label: '当前窗口'},
      ],
      forbid: appType !== 'pc'
    },
    {
      type: 'radio',
      field: 'joint',
      label: '参数拼接',
      initval: setting.joint || 'true',
      required: false,
      options: [
        {value: 'true', label: '是'},
        {value: 'false', label: '否'},
      ],
    },
    {
      type: 'select',
      field: 'linkbtn',
      label: '关联按钮',
      initval: setting.linkbtn || '',
      required: true,
      options: buttons
    },
    {
      type: 'radio',
      field: 'btnControl',
      label: '按钮控制',
      initval: setting.btnControl || 'show',
      tooltip: '可设置按钮显示规则,一直显示或鼠标悬浮时显示。',
      required: false,
      options: [
        {value: 'show', label: '正常显示'},
        {value: 'hover', label: '悬浮显示'},
      ],
      forbid: appType === 'mob'
    }
  ]
 
  return cardSettingForm