king
2022-01-17 92224e3d5e03f223bf2fb4b0eb88b74e790d8da9
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
/**
 * @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: '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: '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: 'radio',
      field: 'shortcut',
      label: '快捷方式',
      initval: wrap.shortcut || 'remember',
      tooltip: '账号密码登录时的快捷方式。',
      required: false,
      options: [
        {value: 'none', label: '无'},
        {value: 'remember', label: '记住密码'},
        {value: 'autologon', label: '自动登录'},
      ]
    },
    // {
    //   type: 'radio',
    //   field: 'protocol',
    //   label: '协议',
    //   initval: wrap.protocol || 'false',
    //   required: false,
    //   options: [
    //     {value: 'false', label: '无'},
    //     {value: 'true', label: '有'},
    //   ],
    //   controlFields: [
    //     {field: 'tip', values: ['true']},
    //     {field: 'groups', values: ['true']},
    //   ]
    // },
    // {
    //   type: 'text',
    //   field: 'tip',
    //   label: '提示文字',
    //   initval: wrap.tip || '我已阅读并同意',
    //   required: true
    // },
    // {
    //   type: 'table',
    //   field: 'groups',
    //   label: '协议组',
    //   initval: wrap.groups || [],
    //   required: true,
    //   span: 24,
    //   columns: [
    //     {
    //       title: '文本',
    //       dataIndex: 'label',
    //       inputType: 'input',
    //       editable: true,
    //       unique: true,
    //       required: true,
    //       width: '35%'
    //     },
    //     {
    //       title: '链接',
    //       dataIndex: 'link',
    //       inputType: 'input',
    //       editable: true,
    //       unique: true,
    //       required: true,
    //       width: '40%'
    //     },
    //   ]
    // }
  ]
 
  return wrapForm