Skip to content

Commit e9be804

Browse files
committed
add MatrixSelect API DOC
1 parent 26339b2 commit e9be804

File tree

12 files changed

+341
-368
lines changed

12 files changed

+341
-368
lines changed

website/code/doc/matrixSelect.js

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
// 简单示例
2+
let simple = {};
3+
4+
const columns = Array.apply(null, new Array(24)).map((_, index) => {
5+
return {
6+
label: `${index}:00`
7+
};
8+
});
9+
10+
const rows = Array.apply(null, new Array(7)).map((_, index) => {
11+
return {
12+
label: `星期${index}`
13+
};
14+
});
15+
16+
const options = rows.map((row, rowIndex) => {
17+
return columns.map((column, columnIndex) => {
18+
return {
19+
value: `${rowIndex}-${columnIndex}`
20+
};
21+
});
22+
});
23+
24+
const field = {
25+
type: 'MatrixSelect',
26+
model: [],
27+
columns,
28+
rows,
29+
options,
30+
};
31+
32+
const model = {
33+
fruit: ['1', '2']
34+
};
35+
36+
simple.data = {
37+
field,
38+
model
39+
};
40+
41+
simple.code = `
42+
<script>
43+
export default {
44+
data() {
45+
return {
46+
field: ${JSON.stringify(field, null, 4, 4)},
47+
model: ${JSON.stringify(model)}
48+
};
49+
}
50+
methods: {
51+
handleFieldChange(model, value) {
52+
console.log(model, value);
53+
}
54+
}
55+
};
56+
<script>
57+
<template>
58+
<Form :model="model">
59+
<FieldGenerator
60+
:field="field"
61+
@on-field-change="handleFieldChange"
62+
/>
63+
</Form>
64+
</template>
65+
`;
66+
67+
export default {
68+
simple
69+
};

website/code/doc/select.js

Lines changed: 0 additions & 263 deletions
Original file line numberDiff line numberDiff line change
@@ -388,271 +388,8 @@ export default {
388388
</template>
389389
`;
390390

391-
export const columns = [
392-
{
393-
title: '姓名',
394-
key: 'name',
395-
width: 100
396-
},
397-
{
398-
title: '年龄',
399-
key: 'age',
400-
width: 90
401-
},
402-
{
403-
title: '性别',
404-
key: 'gender',
405-
width: 90
406-
},
407-
{
408-
title: '出生日期',
409-
key: 'birthday',
410-
width: 150
411-
},
412-
{
413-
title: '省',
414-
slot: 'province',
415-
width: 230,
416-
poptip: {
417-
title: '编辑地址',
418-
displayField: {
419-
type: 'Select',
420-
api: '/selectApi',
421-
model: 'province',
422-
inline: true,
423-
cache: true,
424-
disabled: true,
425-
width: 100,
426-
size: 'small'
427-
},
428-
formFields: [
429-
{
430-
type: 'Select',
431-
api: '/selectApi',
432-
model: 'province',
433-
inline: true,
434-
cache: true,
435-
width: 100
436-
},
437-
{
438-
type: 'Button',
439-
text: '保存',
440-
subtype: 'primary',
441-
size: 'small',
442-
action: {
443-
type: 'ajax',
444-
api: '/curdEdit'
445-
},
446-
apiParams: ['name', 'province'],
447-
inline: true
448-
},
449-
]
450-
}
451-
},
452-
{
453-
title: '城市',
454-
slot: 'city',
455-
width: 230,
456-
formFields: [
457-
{
458-
type: 'Select',
459-
api: '/selectApi',
460-
transfer: true,
461-
model: 'city',
462-
inline: true,
463-
cache: true,
464-
width: 100
465-
},
466-
{
467-
type: 'Button',
468-
text: '保存',
469-
subtype: 'primary',
470-
size: 'small',
471-
action: {
472-
type: 'ajax',
473-
api: '/curdEdit'
474-
},
475-
apiParams: ['name', 'province', 'city'],
476-
inline: true
477-
},
478-
]
479-
},
480-
{
481-
title: '地址',
482-
slot: 'address',
483-
width: 200,
484-
poptip: {
485-
title: '编辑地址',
486-
formFields: [
487-
{
488-
type: 'Input',
489-
model: 'address',
490-
placeholder: '请输入地址',
491-
rules: [
492-
{
493-
type: 'string',
494-
required: true,
495-
}
496-
],
497-
width: 250,
498-
inline: true
499-
},
500-
{
501-
type: 'Button',
502-
text: '保存',
503-
subtype: 'primary',
504-
size: 'small',
505-
action: {
506-
type: 'ajax',
507-
api: '/curdEdit'
508-
},
509-
apiParams: ['name', 'address', 'test'],
510-
inline: true
511-
},
512-
]
513-
}
514-
},
515-
{
516-
title: '用户状态',
517-
width: 100,
518-
slot: 'status',
519-
formFields: [
520-
{
521-
type: 'Tag',
522-
model: 'status',
523-
options: [
524-
{
525-
name: '正常',
526-
value: '1',
527-
color: 'primary'
528-
},
529-
{
530-
name: '黑用户',
531-
value: '2',
532-
color: 'error'
533-
}
534-
]
535-
},
536-
]
537-
},
538-
{
539-
title: '操作',
540-
slot: 'action',
541-
width: 300,
542-
formFields: [
543-
{
544-
type: 'Button',
545-
text: '编辑',
546-
subtype: 'primary',
547-
size: 'small',
548-
action: {
549-
type: 'event',
550-
name: 'editDialog'
551-
},
552-
inline: true
553-
},
554-
{
555-
type: 'Button',
556-
text: '判黑',
557-
subtype: 'primary',
558-
size: 'small',
559-
confirmPoptip: {
560-
title: '确认判黑?',
561-
placement: 'left'
562-
},
563-
action: {
564-
type: 'ajax',
565-
api: '/curdToBlack'
566-
},
567-
apiParams: ['name', 'status'],
568-
inline: true,
569-
hiddenOn: {
570-
status: [
571-
{
572-
type: 'enum',
573-
enum: ['2']
574-
}
575-
]
576-
}
577-
},
578-
{
579-
type: 'Button',
580-
text: '洗白',
581-
subtype: 'primary',
582-
size: 'small',
583-
confirmPoptip: {
584-
title: '确定洗白?',
585-
placement: 'left'
586-
},
587-
action: {
588-
type: 'ajax',
589-
api: '/curdToWhite'
590-
},
591-
apiParams: ['name', 'status'],
592-
inline: true,
593-
hiddenOn: {
594-
status: [
595-
{
596-
type: 'enum',
597-
enum: ['1']
598-
}
599-
]
600-
}
601-
},
602-
{
603-
type: 'Button',
604-
text: '删除',
605-
subtype: 'error',
606-
size: 'small',
607-
confirmPoptip: {
608-
title: '确定删除?',
609-
placement: 'left'
610-
},
611-
action: {
612-
type: 'ajax',
613-
api: '/curdDelete'
614-
},
615-
apiParams: ['name'],
616-
inline: true
617-
},
618-
{
619-
type: 'Button',
620-
model: 'detailRoute',
621-
text: '详情',
622-
subtype: 'primary',
623-
size: 'small',
624-
action: {
625-
type: 'route'
626-
},
627-
apiParams: ['name'],
628-
inline: true
629-
},
630-
]
631-
}
632-
];
633-
634-
export const data = [
635-
{
636-
name: '王小明',
637-
age: 18,
638-
gender: '男',
639-
birthday: '1999-2-21',
640-
province: 'Beijing',
641-
city: 'Beijing',
642-
address: '北京市朝阳区芍药居',
643-
status: '1',
644-
detailRoute: {
645-
path: '/home',
646-
query: {
647-
name: '王小明',
648-
}
649-
}
650-
}
651-
];
652391

653392
export default {
654-
columns,
655-
data,
656393
simple,
657394
api,
658395
multiple,

0 commit comments

Comments
 (0)