betterform
v1.4.0
Published
ant design form packaging
Downloads
1
Readme
btform
let radiogroup1 = [<Radio key='1' value='download'>下载</Radio>,<Radio key='2' value='jump'>浏览器打开</Radio>]
let radiogroup2 = [<Radio key='1' value={0}>不推荐</Radio>,<Radio key='2' value={1}>推荐</Radio>]
let radiogroup3 = [<Radio key='1' value={0|'0'}>禁用</Radio>,<Radio key='2' value={1}>不禁用</Radio>]
let creatData = {
verification_cb : (data) => {
if(_item.add){
data.software_id = id
callApi(`v1/tools-recommends`,'POST',data).then(res => {
self.getList()
this.setState({
visible: false
});
message.success('添加成功')
})
}else {
callApi(`v1/tools-recommends/${_item.id}`,'put',data).then(res => {
let _index = list.findIndex((item) => {
return item.id === res.id
});
list[_index] = res
this.setState({
visible: false,
list
});
message.success('编辑成功')
})
}
},
data: [
{
label:'名称',
gFDid:'name',
hasFeedback:true,
gFDdata:{rules: [
{ required: true, message: '请输入您推荐的工具名称!' },
],
initialValue: _item.name ? _item.name : ''
},
tagName:'Input',
tagData:{},
child:null
},
{
label:'图片',
gFDid:'image',
hasFeedback:true,
gFDdata:{rules: [
{ required: true, message: '请输入您的图片地址!' },
],
initialValue: _item.image ? _item.image : ''
},
tagName:'Input',
tagData:{},
child:null
},
{
label:'url',
gFDid:'url',
hasFeedback:true,
gFDdata:{rules: [
{ required: true, message: '请输入您的下载地址!' },
],
initialValue: _item.url ? _item.url : ''
},
tagName:'Input',
tagData:{},
child:null
},
{
label:'打开方式',
gFDid:'jump_type',
gFDdata:{rules: [
{ required: true },
],
initialValue: _item.jump_type ? _item.jump_type : 'download'
},
tagName:'RadioGroup',
tagData:{},
child:radiogroup1
},
{
label:'排序',
gFDid:'sort',
extra:'倒序,数字大的靠前',
gFDdata:{
initialValue: _item.sort ? _item.sort : ''
},
tagName:'Input',
tagData:{},
child:null,
formItemLayout:{
labelCol: { span: 4 },
wrapperCol: { span: 16 } }
},
{
label:'描述',
gFDid:'describe',
gFDdata:{
initialValue: _item.describe ? _item.describe : ''
},
tagName:'Input',
tagData:{},
child:null
},
{
label:'推荐图标',
gFDid:'top_icon',
gFDdata:{
initialValue: _item.top_icon ? _item.top_icon : ''
},
tagName:'Input',
tagData:{},
child:null
},
{
label:'是否推荐',
gFDid:'recommend',
gFDdata:{rules: [
{ required: true },
],
initialValue: _item.recommend != undefined ? _item.recommend : 1
},
tagName:'RadioGroup',
tagData:{},
child:radiogroup2
},
{
label:'事件',
gFDid:'timeRange',
gFDdata:{rules: [
{ required: true },
],
initialValue: []
},
tagName:'RangePicker',
tagData:{format:{dateFormat},allowClear:false},
child:null
},
{
label:'是否禁用',
gFDid:'status',
gFDdata:{rules: [
{ required: true },
],
initialValue: _item.status != undefined ? _item.status : 1
},
tagName:'RadioGroup',
tagData:{},
child:radiogroup3
},
{
tagName:'Button',
tagData:{type:'primary',htmlType:'submit'},
child:'提交'
}
],
formItemLayout: {
labelCol: { span: 4 },
wrapperCol: { span: 16 },
layout="inline"
},
addElement: [<Button type="primary" onClick={this.add.bind(this,{})} style={{marginBottom:'8px'}}>支持插入自定义元素</Button>]
}