2019-04-30 11:11:25 +08:00
|
|
|
export default {
|
2019-11-07 10:41:14 +08:00
|
|
|
title: '公式示例',
|
|
|
|
body: [
|
|
|
|
'<p>通过公式,可以动态的设置目标值。</p>',
|
|
|
|
{
|
|
|
|
type: 'form',
|
|
|
|
title: '自动应用',
|
|
|
|
api: '/api/mock2/form/saveForm',
|
2021-06-07 10:09:55 +08:00
|
|
|
body: [
|
2019-04-30 11:11:25 +08:00
|
|
|
{
|
2021-06-07 10:09:55 +08:00
|
|
|
type: 'input-number',
|
2019-11-07 10:41:14 +08:00
|
|
|
name: 'a',
|
|
|
|
label: 'A'
|
|
|
|
},
|
2019-04-30 11:11:25 +08:00
|
|
|
|
2019-11-07 10:41:14 +08:00
|
|
|
{
|
2021-06-07 10:09:55 +08:00
|
|
|
type: 'input-number',
|
2019-11-07 10:41:14 +08:00
|
|
|
name: 'b',
|
|
|
|
label: 'B'
|
|
|
|
},
|
2019-04-30 11:11:25 +08:00
|
|
|
|
2019-11-07 10:41:14 +08:00
|
|
|
{
|
2021-06-07 10:09:55 +08:00
|
|
|
type: 'input-number',
|
2019-11-07 10:41:14 +08:00
|
|
|
name: 'sum',
|
|
|
|
label: '和',
|
|
|
|
disabled: true,
|
|
|
|
description: '自动计算 A + B'
|
2019-04-30 11:11:25 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
2019-11-07 10:41:14 +08:00
|
|
|
type: 'formula',
|
|
|
|
name: 'sum',
|
|
|
|
value: 0,
|
|
|
|
formula: 'a + b'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
2019-04-30 11:11:25 +08:00
|
|
|
|
2019-11-07 10:41:14 +08:00
|
|
|
{
|
|
|
|
type: 'form',
|
|
|
|
title: '手动应用',
|
|
|
|
api: '/api/mock2/form/saveForm',
|
2021-06-07 10:09:55 +08:00
|
|
|
body: [
|
2019-11-07 10:41:14 +08:00
|
|
|
{
|
2021-06-07 10:09:55 +08:00
|
|
|
type: 'input-number',
|
2019-11-07 10:41:14 +08:00
|
|
|
name: 'a',
|
|
|
|
label: 'A'
|
|
|
|
},
|
2019-04-30 11:11:25 +08:00
|
|
|
|
2019-11-07 10:41:14 +08:00
|
|
|
{
|
2021-06-07 10:09:55 +08:00
|
|
|
type: 'input-number',
|
2019-11-07 10:41:14 +08:00
|
|
|
name: 'b',
|
|
|
|
label: 'B'
|
|
|
|
},
|
2019-04-30 11:11:25 +08:00
|
|
|
|
2019-11-07 10:41:14 +08:00
|
|
|
{
|
|
|
|
type: 'group',
|
2021-06-07 10:09:55 +08:00
|
|
|
body: [
|
2019-11-07 10:41:14 +08:00
|
|
|
{
|
2021-06-07 10:09:55 +08:00
|
|
|
type: 'input-number',
|
2019-11-07 10:41:14 +08:00
|
|
|
name: 'sum',
|
|
|
|
label: '和',
|
|
|
|
disabled: true,
|
|
|
|
columnClassName: 'col-sm-11'
|
|
|
|
},
|
2019-04-30 11:11:25 +08:00
|
|
|
|
2019-11-07 10:41:14 +08:00
|
|
|
{
|
|
|
|
type: 'button',
|
|
|
|
label: '计算',
|
|
|
|
columnClassName: 'col-sm-1 v-bottom',
|
|
|
|
target: 'theFormula'
|
|
|
|
}
|
|
|
|
]
|
2019-04-30 11:11:25 +08:00
|
|
|
},
|
|
|
|
|
2019-11-07 10:41:14 +08:00
|
|
|
{
|
|
|
|
type: 'formula',
|
|
|
|
name: 'sum',
|
|
|
|
id: 'theFormula',
|
|
|
|
value: 0,
|
|
|
|
formula: 'a + b',
|
|
|
|
initSet: false,
|
|
|
|
autoSet: false
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'form',
|
|
|
|
title: '条件应用',
|
|
|
|
api: '/api/mock2/form/saveForm',
|
2021-06-07 10:09:55 +08:00
|
|
|
body: [
|
2019-11-07 10:41:14 +08:00
|
|
|
{
|
|
|
|
type: 'radios',
|
|
|
|
name: 'radios',
|
|
|
|
inline: true,
|
|
|
|
label: 'radios',
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
label: 'a',
|
|
|
|
value: 'a'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'b',
|
|
|
|
value: 'b'
|
|
|
|
}
|
|
|
|
],
|
|
|
|
description: 'radios 变化会自动清空 B'
|
2019-04-30 11:11:25 +08:00
|
|
|
},
|
2019-11-07 10:41:14 +08:00
|
|
|
{
|
2021-06-07 10:09:55 +08:00
|
|
|
type: 'input-text',
|
2019-11-07 10:41:14 +08:00
|
|
|
name: 'b',
|
|
|
|
label: 'B'
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
type: 'formula',
|
|
|
|
name: 'b',
|
|
|
|
value: 'some string',
|
|
|
|
formula: "''",
|
|
|
|
condition: '${radios}',
|
|
|
|
initSet: false
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
};
|