amis/examples/components/Form/ConditionBuilder.jsx
liaoxuezhi 65ac422ed6
1.2.x 文档&示例配置调整 (#2064)
* 补充容错

* fix: form 中 name 关联顶层数据初始化失效

* 更新 examples

* 文档调整

* 删除多余的文档, 调整 schema

* schema 调整

* schema 调整

* control 类型容器 control 改成 body

* 修复一个选项加载的bug

* form 注册直接用 type
2021-06-07 10:09:55 +08:00

99 lines
2.2 KiB
JavaScript

export default {
title: '条件生成器',
body: [
{
type: 'form',
api: '/api/mock2/saveForm?waitSeconds=2',
title: '',
mode: 'horizontal',
horizontal: {
leftFixed: true
},
actions: [
{
label: '查看数据',
type: 'button',
actionType: 'dialog',
dialog: {
title: '数据',
body: '<pre>${conditions|json:2}</pre>'
}
}
],
body: [
{
type: 'condition-builder',
label: '条件组件',
name: 'conditions',
description:
'适合让用户自己拼查询条件,然后后端根据数据生成 query where',
fields: [
{
label: '文本',
type: 'text',
name: 'text'
},
{
label: '数字',
type: 'number',
name: 'number'
},
{
label: '布尔',
type: 'boolean',
name: 'boolean'
},
{
label: '选项',
type: 'select',
name: 'select',
options: [
{
label: 'A',
value: 'a'
},
{
label: 'B',
value: 'b'
},
{
label: 'C',
value: 'c'
},
{
label: 'D',
value: 'd'
},
{
label: 'E',
value: 'e'
}
]
},
{
label: '日期',
children: [
{
label: '日期',
type: 'date',
name: 'date'
},
{
label: '时间',
type: 'time',
name: 'time'
},
{
label: '日期时间',
type: 'datetime',
name: 'datetime'
}
]
}
]
}
]
}
]
};