amis2/examples/components/Linkage/CRUD.jsx

176 lines
4.4 KiB
React
Raw Normal View History

2019-04-30 11:11:25 +08:00
export default {
2019-11-07 10:41:14 +08:00
title: '表单与列表之间的联动',
body: [
{
title: '',
type: 'form',
mode: 'inline',
target: 'list',
wrapWithPanel: false,
className: 'm-b',
body: [
2019-04-30 11:11:25 +08:00
{
type: 'input-text',
2019-11-07 10:41:14 +08:00
name: 'keywords',
placeholder: '通过关键字搜索',
clearable: true,
addOn: {
type: 'submit',
icon: 'fa fa-search',
level: 'primary'
}
}
]
},
{
type: 'crud',
name: 'list',
api: '/api/sample',
mode: 'list',
listItem: {
actions: [
{
type: 'button',
icon: 'fa fa-eye',
actionType: 'dialog',
dialog: {
title: '查看',
body: {
type: 'form',
body: [
2019-11-07 10:41:14 +08:00
{
type: 'static',
name: 'engine',
label: 'Engine'
},
{
type: 'divider'
},
{
type: 'static',
name: 'browser',
label: 'Browser'
},
{
type: 'divider'
},
{
type: 'static',
name: 'platform',
label: 'Platform(s)'
},
{
type: 'divider'
},
{
type: 'static',
name: 'version',
label: 'Engine version'
},
{
type: 'divider'
},
{
type: 'static',
name: 'grade',
label: 'CSS grade'
}
]
}
}
},
{
type: 'button',
icon: 'fa fa-pencil',
actionType: 'dialog',
dialog: {
title: '编辑',
body: {
type: 'form',
name: 'sample-edit-form',
api: '/api/sample/$id',
body: [
2019-11-07 10:41:14 +08:00
{
type: 'input-text',
2019-11-07 10:41:14 +08:00
name: 'engine',
label: 'Engine',
required: true
},
{
type: 'divider'
},
{
type: 'input-text',
2019-11-07 10:41:14 +08:00
name: 'browser',
label: 'Browser',
required: true
},
{
type: 'divider'
},
{
type: 'input-text',
2019-11-07 10:41:14 +08:00
name: 'platform',
label: 'Platform(s)',
required: true
},
{
type: 'divider'
},
{
type: 'input-text',
2019-11-07 10:41:14 +08:00
name: 'version',
label: 'Engine version'
},
{
type: 'divider'
},
{
type: 'input-text',
2019-11-07 10:41:14 +08:00
name: 'grade',
label: 'CSS grade'
}
2019-04-30 11:11:25 +08:00
]
2019-11-07 10:41:14 +08:00
}
}
},
{
type: 'button',
icon: 'fa fa-times text-danger',
actionType: 'ajax',
confirmText: '您确认要删除?',
api: 'delete:/api/sample/$id'
}
],
body: [
{
name: 'engine',
label: 'Rendering engine',
labelClassName: 'w-sm'
},
2020-09-16 21:44:01 +08:00
{
type: 'hbox',
columns: [
{
name: 'browser',
label: 'Browser',
labelClassName: 'w-sm'
},
{
name: 'platform',
label: 'Platform(s)',
labelClassName: 'w-sm'
}
]
},
2019-11-07 10:41:14 +08:00
{
name: 'version',
label: 'Engine version',
labelClassName: 'w-sm'
}
]
}
}
]
};