king
2021-12-15 d76045be1cd5a030ed68269246d7ae1956a5ff06
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
/**
 * @description Wrap表单配置信息
 */
export default function (wrap) {
  let appType = sessionStorage.getItem('appType')
  let menulist = sessionStorage.getItem('appMenus')
  if (menulist) {
    try {
      menulist = JSON.parse(menulist)
    } catch (e) {
      menulist = []
    }
  } else {
    menulist = []
  }
 
  let msgTemps = sessionStorage.getItem('msgTemplate')
 
  if (msgTemps) {
    try {
      msgTemps = JSON.parse(msgTemps)
      msgTemps = msgTemps.map(item => {
        item.value = item.ID
        item.label = item.SignName + ' - ' + item.TemplateCode
        return item
      })
    } catch (e) {
      msgTemps = []
    }
  } else {
    msgTemps = []
  }
 
  const wrapForm = [
    {
      type: 'text',
      field: 'name',
      label: '组件名称',
      initval: wrap.name || '',
      tooltip: '用于组件间的区分。',
      required: true
    },
    {
      type: 'checkbox',
      field: 'loginWays',
      label: '登录方式',
      initval: wrap.loginWays || [],
      required: true,
      options: [
        { label: '账号', value: 'uname_pwd' },
        { label: '短信', value: 'sms_vcode' },
        { label: '扫码', value: 'app_scan', disabled: appType === 'mob' },
      ],
      controlFields: [
        {field: 'tempId', values: ['sms_vcode']},
        {field: 'shortcut', values: ['uname_pwd']},
      ]
    },
    {
      type: 'number',
      field: 'width',
      label: '宽度',
      initval: wrap.width || 24,
      tooltip: '栅格布局,每行等分为24列。',
      min: 1,
      max: 24,
      precision: 0,
      required: true
    },
    {
      type: 'number',
      field: 'maxWidth',
      label: '最大宽度',
      initval: wrap.maxWidth || '',
      tooltip: '登录框的最大宽度值。',
      min: 100,
      max: 2000,
      precision: 0,
      required: false
    },
    {
      type: 'styleInput',
      field: 'height',
      label: '高度',
      initval: wrap.height || '',
      tooltip: '组件占用的最小高度,用于页面布局。',
      required: false,
      options: ['px', 'vh', 'vw', '%']
    },
    {
      type: 'radio',
      field: 'link',
      label: '链接',
      initval: wrap.link || 'menu',
      required: false,
      options: [
        {value: 'menu', label: '菜单'},
        {value: 'linkmenu', label: '关联菜单'},
      ],
      controlFields: [
        {field: 'linkmenu', values: ['linkmenu']}
      ]
    },
    {
      type: 'select',
      field: 'linkmenu',
      label: '关联菜单',
      initval: wrap.linkmenu || '',
      required: true,
      options: menulist
    },
    {
      type: 'select', // $验证码$  $mob$  $send_type$
      field: 'tempId',
      label: '短信模板',
      initval: wrap.tempId || '',
      tooltip: '短信模板可在 云系统->应用服务->开发者中心->短信模板 处添加。',
      required: true,
      options: msgTemps
    },
    {
      type: 'radio',
      field: 'shortcut',
      label: '快捷方式',
      initval: wrap.shortcut || 'remember',
      tooltip: '账号密码登录时的快捷方式。',
      required: false,
      options: [
        {value: 'none', label: '无'},
        {value: 'remember', label: '记住密码'},
        {value: 'autologon', label: '自动登录'},
      ]
    },
  ]
 
  return wrapForm