vendor: amis 6.13.0 base (fork root)
This commit is contained in:
118
examples/components/Services/Data.jsx
Normal file
118
examples/components/Services/Data.jsx
Normal file
@@ -0,0 +1,118 @@
|
||||
export default {
|
||||
type: 'page',
|
||||
title: '动态加载数据',
|
||||
body: [
|
||||
'<span class="text-danger">除了用 Page、CRUD、Form 或者 Wizard 能拉取数据外,还可以通过 Service 专门拉取数据,然后丢给其他类型的渲染器渲染。</span>',
|
||||
|
||||
{
|
||||
type: 'form',
|
||||
title: '条件输入',
|
||||
className: 'm-t',
|
||||
wrapWithPanel: false,
|
||||
target: 'service1',
|
||||
mode: 'inline',
|
||||
body: [
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'keywords',
|
||||
placeholder: '关键字',
|
||||
addOn: {
|
||||
type: 'button',
|
||||
icon: 'fa fa-search',
|
||||
actionType: 'submit',
|
||||
level: 'primary'
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
name: 'service1',
|
||||
type: 'service',
|
||||
className: 'm-t',
|
||||
api: '/api/mock2/service/data?keywords=${keywords}',
|
||||
body: [
|
||||
'当前关键字是 ${keywords},当前时间是: ${date|date:YYYY-MM-DD HH\\:mm}',
|
||||
|
||||
{
|
||||
type: 'table',
|
||||
className: 'm-t',
|
||||
source: '${table1}',
|
||||
columns: [
|
||||
{
|
||||
name: 'id',
|
||||
label: 'ID',
|
||||
type: 'text'
|
||||
},
|
||||
{
|
||||
name: 'text',
|
||||
label: '文本',
|
||||
type: 'text'
|
||||
},
|
||||
{
|
||||
type: 'image',
|
||||
label: '图片',
|
||||
name: 'image',
|
||||
popOver: {
|
||||
title: '查看大图',
|
||||
body:
|
||||
'<div class="w-xxl"><img class="w-full" src="${image}"/></div>'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'date',
|
||||
type: 'date',
|
||||
label: '日期'
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
type: 'table',
|
||||
source: '${table2}',
|
||||
columns: [
|
||||
{
|
||||
name: 'progress',
|
||||
label: '进度',
|
||||
type: 'progress'
|
||||
},
|
||||
{
|
||||
name: 'boolean',
|
||||
label: '状态',
|
||||
type: 'status'
|
||||
},
|
||||
{
|
||||
name: 'boolean',
|
||||
label: '开关',
|
||||
type: 'switch'
|
||||
// readOnly: false // 可以开启修改模式
|
||||
},
|
||||
{
|
||||
name: 'type',
|
||||
label: '映射',
|
||||
type: 'mapping',
|
||||
map: {
|
||||
'*': '其他:${type}',
|
||||
'1': "<span class='label label-info'>漂亮</span>",
|
||||
'2': "<span class='label label-success'>开心</span>",
|
||||
'3': "<span class='label label-danger'>惊吓</span>",
|
||||
'4': "<span class='label label-warning'>紧张</span>"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
name: 'list',
|
||||
type: 'list',
|
||||
label: 'List',
|
||||
placeholder: '-',
|
||||
listItem: {
|
||||
title: '${title}',
|
||||
subTitle: '${description}'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
70
examples/components/Services/Form.jsx
Normal file
70
examples/components/Services/Form.jsx
Normal file
@@ -0,0 +1,70 @@
|
||||
export default {
|
||||
type: 'page',
|
||||
title: '动态加载表单中的部分',
|
||||
body: [
|
||||
'<span class="text-danger">同样通过 <code>service</code>的<code>schemaApi</code> 来加载部分内容,当然也可以全部由它来加载</span>',
|
||||
|
||||
{
|
||||
type: 'form',
|
||||
panelClassName: 'Panel--info m-t',
|
||||
target: 'service1',
|
||||
mode: 'horizontal',
|
||||
api: '/api/mock2/form/saveForm?waitSeconds=1',
|
||||
body: [
|
||||
{
|
||||
type: 'fieldset',
|
||||
title: '基本信息',
|
||||
body: [
|
||||
{
|
||||
type: 'input-text',
|
||||
label: '字段一',
|
||||
name: 'filed1'
|
||||
},
|
||||
|
||||
{
|
||||
type: 'input-text',
|
||||
label: '字段二',
|
||||
name: 'filed2'
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
title: '其他信息',
|
||||
type: 'fieldset',
|
||||
body: [
|
||||
{
|
||||
name: 'tpl',
|
||||
type: 'select',
|
||||
label: '模板',
|
||||
inline: true,
|
||||
required: true,
|
||||
value: 'tpl1',
|
||||
options: [
|
||||
{
|
||||
label: '模板1',
|
||||
value: 'tpl1'
|
||||
},
|
||||
{
|
||||
label: '模板2',
|
||||
value: 'tpl2'
|
||||
},
|
||||
{
|
||||
label: '模板3',
|
||||
value: 'tpl3'
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
type: 'service',
|
||||
className: 'm-t',
|
||||
initFetchSchemaOn: 'data.tpl',
|
||||
schemaApi: '/api/mock2/service/form?tpl=$tpl'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
49
examples/components/Services/Schema.jsx
Normal file
49
examples/components/Services/Schema.jsx
Normal file
@@ -0,0 +1,49 @@
|
||||
export default {
|
||||
type: 'page',
|
||||
title: '动态加载页面',
|
||||
body: [
|
||||
'<span class="text-danger">可以通过 <code>service</code>的<code>schemaApi</code> 动态控制内容。</span>',
|
||||
|
||||
{
|
||||
type: 'form',
|
||||
title: '条件输入',
|
||||
panelClassName: 'panel-info m-t',
|
||||
target: 'service1',
|
||||
mode: 'inline',
|
||||
submitOnInit: true,
|
||||
body: [
|
||||
{
|
||||
label: '加载页面类型',
|
||||
required: true,
|
||||
type: 'button-group-select',
|
||||
submitOnChange: true,
|
||||
value: 'crud',
|
||||
name: 'type',
|
||||
options: [
|
||||
{
|
||||
label: 'Crud',
|
||||
value: 'crud'
|
||||
},
|
||||
|
||||
{
|
||||
label: 'Form',
|
||||
value: 'form'
|
||||
},
|
||||
|
||||
{
|
||||
label: 'Tabs',
|
||||
value: 'tabs'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'service1',
|
||||
type: 'service',
|
||||
className: 'm-t',
|
||||
initFetchSchema: false,
|
||||
schemaApi: '/api/mock2/service/schema?type=$type'
|
||||
}
|
||||
]
|
||||
};
|
||||
Reference in New Issue
Block a user