Commit 147bdb4d authored by 王康's avatar 王康

form

parent 01d5922d
...@@ -5,11 +5,13 @@ ...@@ -5,11 +5,13 @@
:buttons="showUserButtons" :buttons="showUserButtons"
:layout="layout" :layout="layout"
:tips="tips" :tips="tips"
:funObject="funObject"
:refers="userRefers"
:foreignFormFields="foreignFormFields" :foreignFormFields="foreignFormFields"
:refers="userRefers"> :relates="userRelates">
<!-- foreignFormFields 主查外的外表显示字段 和userRefers连用--> <!-- foreignFormFields 主查外的外表显示字段 和userRefers连用-->
<!-- :relates="userRelates" 中间表和间接关联表--> <!-- :relates="userRelates" 中间表和间接关联表-->
<!-- :refers="userRefers" 主查外的外表和外键字段 和foreignFormFields;连用--> <!-- :refers="userRefers" 主查外的外表和外键字段 和foreignFormFields;连用-->
</hm-complex-form> </hm-complex-form>
</div> </div>
</template> </template>
...@@ -31,11 +33,11 @@ ...@@ -31,11 +33,11 @@
// widgetType值 1:普通input 2:下拉框 (如果是下拉框 再传一个options表示下拉框选项)3:复选框 4:文本域 5:富文本 6:日期 7:单选框 8: 文件上传 // widgetType值 1:普通input 2:下拉框 (如果是下拉框 再传一个options表示下拉框选项)3:复选框 4:文本域 5:富文本 6:日期 7:单选框 8: 文件上传
showUserColumns: [ showUserColumns: [
// 1普通input // 1普通input
{ name: '选择类型', codeCamel: 'type', widgetType: 1, disabled: true, { name: '选择类型', codeCamel: 'type', widgetType: 1, disabled: false,
change: this.inputChange, change: this.inputChange
// rule: { required: true, message: '用户名不能为空', trigger: 'blur' } // rule: { required: true, message: '用户名不能为空', trigger: 'blur' }
// hide: true // hide: true
default: '默认值' // default: '默认值',
}, },
// 5富文本 // 5富文本
{ name: '电子邮件', codeCamel: 'email', widgetType: 5, disabled: false, { name: '电子邮件', codeCamel: 'email', widgetType: 5, disabled: false,
...@@ -69,11 +71,11 @@ ...@@ -69,11 +71,11 @@
{ name: '登陆id', codeCamel: 'loginid', widgetType: 7, { name: '登陆id', codeCamel: 'loginid', widgetType: 7,
options: [ options: [
{ label: 1, value: '会员' }, // 单选的value是选项文字,label是选中值 { label: 1, value: '会员' }, // 单选的value是选项文字,label是选中值
{ label: 2, value: '访客' } { label: 2, value: '访客' } // 如果数据库中存的数据类型是number,label值写number如1,如果为string,label值写string ,如'1'
], // default: 1 ], // default: 1
change: this.inputChange }, change: this.inputChange },
// 8文件 // 8文件 change: this.uploadChange
{ name: '选择头像', codeCamel: 'avatar', widgetType: 8, url: '/api/upload', change: this.uploadChange } // url是后台接口地址 { name: '选择头像', codeCamel: 'avatar', widgetType: 8, url: '/api/upload' } // url是后台接口地址
], ],
// CcSubject示例 // CcSubject示例
showUserColumns2: [ showUserColumns2: [
...@@ -117,6 +119,9 @@ ...@@ -117,6 +119,9 @@
// { text: '预览2', method: this.method5 }, // { text: '预览2', method: this.method5 },
{ text: '取消', type: 3, method: this.method3 } { text: '取消', type: 3, method: this.method3 }
], ],
funObject: {
beforeRender: this.beforeRender
},
// showUserButtons: [] // showUserButtons: []
// 布局方式 // 布局方式
layout: { left: 2, middle: 20, right: 2 }, layout: { left: 2, middle: 20, right: 2 },
...@@ -183,14 +188,8 @@ ...@@ -183,14 +188,8 @@
console.log(125, object) console.log(125, object)
return object // 将数据返回 return object // 将数据返回
}, },
method1(formModel) { method1() {
// console.log('method1', formModel) console.log('method1')
// formModel.password = '1234'
// console.log('method1', formModel)
},
uploadChange(response, formModel) {
console.log(192, response)
console.log(192, formModel)
}, },
method2() { method2() {
console.log('method2') console.log('method2')
...@@ -199,13 +198,19 @@ ...@@ -199,13 +198,19 @@
console.log('method3') console.log('method3')
}, },
method4(formModel) { method4(formModel) {
console.log('method4', formModel) console.log(formModel)
formModel.password = 123 console.log('method4')
console.log('method4', formModel)
}, },
method5(formModel) { method5(formModel) {
console.log(formModel) console.log(formModel)
console.log('method4') console.log('method4')
},
beforeRender(data, formModel) {
// 数据处理
// do something...
// console.log(111, data)
// console.log(112, formModel)
return formModel
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment