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
| import {schema2component} from './AMISRenderer';
|
| export default schema2component(
| {
| type: 'dialog',
| title: '新增页面',
| body: {
| type: 'form',
| controls: [
| {
| type: 'text',
| label: '名称',
| name: 'label',
| validations: {
| maxLength: 20
| },
| required: true,
| validate(values: any, value: string) {
| const exists = !!values.pages.filter(
| (item: any) => item.label === value
| ).length;
| return exists ? '当前名称已被占用,请换一个' : '';
| }
| }
|
| // {
| // type: 'text',
| // label: '路径',
| // name: 'path',
| // validations: {
| // isUrlPath: true
| // },
| // required: true,
| // validate(values: any, value: string) {
| // const exists = !!values.pages.filter(
| // (item: any) => item.path === value
| // ).length;
| // return exists ? '当前路径已被占用,请换一个' : '';
| // }
| // },
|
| // {
| // type: 'icon-picker',
| // label: '图标',
| // name: 'icon'
| // }
| ]
| }
| },
| ({onConfirm, pages, ...rest}: any) => {
| return {
| ...rest,
| data: {
| pages
| },
| onConfirm: (values: Array<any>) => onConfirm && onConfirm(values[0])
| };
| }
| );
|
|