Commit 81a03386 authored by gaochao's avatar gaochao

Merge branch 'master' of 115.28.80.125:softwarefactory/vueelementtemplate

parents a975ca5a 963b386d
<template> <template>
<!--:tableId="tableId"--> <!--:refers="judgeRefers"-->
<div> <div>
<hm-complex-form :schema="schema['HmUser']" <hm-complex-form :schema="schema['HmUser']"
:columns="showUserColumns" :columns="showUserColumns"
:buttons="showUserButtons" :buttons="showUserButtons"
:tableId="tableId"
:layout="layout" :layout="layout"
> :tips="tips"
:refers="userRefers">
</hm-complex-form> </hm-complex-form>
</div> </div>
</template> </template>
...@@ -25,34 +25,119 @@ ...@@ -25,34 +25,119 @@
}, },
data() { data() {
return { return {
// widgetType值 1:普通input 2:下拉框 (如果是下拉框 再传一个options表示下拉框选项)3:复选框 4:文本域 5:富文本 6:日期 7:单选框 // widgetType值 1:普通input 2:下拉框 (如果是下拉框 再传一个options表示下拉框选项)3:复选框 4:文本域 5:富文本 6:日期 7:单选框 8: 文件上传
showUserColumns: [ showUserColumns: [
{ name: '用户名称', codeCamel: 'username', widgetType: 1, disabled: true }, // 1普通input
{ name: '电子邮件', codeCamel: 'email', widgetType: 5, disabled: false }, { name: '选择类型', codeCamel: 'type', widgetType: 1, disabled: false,
{ name: '选择类型', codeCamel: 'type', widgetType: 2, multiple: false, change: this.inputChange
// rule: { required: true, message: '用户名不能为空', trigger: 'blur' }
// hide: true
// default: '默认值',
},
// 5富文本
{ name: '电子邮件', codeCamel: 'email', widgetType: 5, disabled: false,
change: this.inputChange, hide: false
// rule: [
// { required: true, message: '请输入邮箱地址', trigger: 'blur' },
// { type: 'email', message: '请输入正确的邮箱地址', trigger: 'blur,change' }
// ]
},
// 2下拉框
{ name: '用户名称', codeCamel: 'username', widgetType: 2, multiple: false,
change: this.inputChange, // default: [1], 如果开启多选,默认选中项用数组[1]、[1,2,3]
options: [ options: [
{ value: 0, label: '选项1' }, { value: '1', label: '企业' }, // 下拉框的label是选项文字,value是选中值
{ value: 1, label: '选项2' }, { value: '2', label: '代理商' },
{ value: 2, label: '选项3' }, { value: '3', label: '会员' },
{ value: 3, label: '选项4' }, { value: '4', label: '访客' }
{ value: 4, label: '选项5' }
] ]
}, },
{ name: '部门ID', codeCamel: 'departmentId', widgetType: 3, options: ['美女', '帅哥'] }, // 3多选 不支持默认值
{ codeCamel: 'password', widgetType: 4 }, { name: '部门ID', codeCamel: 'departmentId', widgetType: 3, options: ['美女', '帅哥'], change: this.inputChange },
{ name: '新建时间', codeCamel: 'createTime', widgetType: 6, dateType: 'datetime', dateFormate: 'yyyy-MM-dd HH:mm:ss' }, // 4密码
{ name: '登陆id', codeCamel: 'loginid', widgetType: 7, options: ['会员', '访客'] }, { name: '密码', codeCamel: 'password', widgetType: 4, change: this.inputChange },
{ name: '选择头像', codeCamel: 'avatar', widgetType: 8 } // 'password',
// 6日期
{ name: '新建时间', codeCamel: 'createTime', widgetType: 6, dateType: 'datetime',
dateFormate: 'yyyy-MM-dd HH:mm:ss', change: this.inputChange
// default: '2018-01-01 00:07:08'
},
// 7单选
{ name: '登陆id', codeCamel: 'loginid', widgetType: 7,
options: [
{ label: 1, value: '会员' }, // 单选的value是选项文字,label是选中值
{ label: 2, value: '访客' }
], // default: 1
change: this.inputChange },
// 8文件
{ name: '选择头像', codeCamel: 'avatar', widgetType: 8, url: '/api/upload' } // url是后台接口地址
],
showUserColumns2: [
// 1普通input
{ name: '用户名称', codeCamel: 'username', widgetType: 1 },
{ name: '部门ID', codeCamel: 'departmentId', widgetType: 1 },
{ name: '部门名称', codeCamel: 'departmentName', widgetType: 1 },
{ name: '密码', codeCamel: 'password', widgetType: 1 },
{ name: '电话', codeCamel: 'mobile', widgetType: 1 },
{ name: '电子邮件', codeCamel: 'email', widgetType: 1 },
{ name: '新建时间', codeCamel: 'createTime', widgetType: 1 },
{ name: '登陆id', codeCamel: 'loginid', widgetType: 1 }
], ],
userIncludes: {
'hm_user': {
includes: ['user_id']
}
},
// 主查外
userRefers: {
'cc_shift': {
includes: ['applicant_id']
}
},
// 要显示按钮 // 要显示按钮
showUserButtons: [ showUserButtons: [
{ text: '确定', type: 1, method: this.method1, beforeSubmit: this.processData }, { text: '确定', type: 1, method: this.method1, beforeSubmit: this.processData },
{ text: '重置', type: 2, method: this.method2 }, { text: '重置', type: 2, method: this.method2 },
{ text: '生成', method: this.method4 },
{ text: '取消', type: 3, method: this.method3 } { text: '取消', type: 3, method: this.method3 }
], ],
// showUserButtons: [] // showUserButtons: []
// 布局方式 // 布局方式
layout: { left: 6, middle: 12, right: 6 } layout: { left: 4, middle: 16, right: 4 },
// 自定义提示消息
tips: {
hidde: false, // 是否显示提示,默认false显示
newSuccess: { text: '发布成功' }, // 新建成功的提示
newError: { text: '发布失败' }, // 新建失败的提示
editSuccess: { text: '编辑成功' }, // 编辑成功的提示
editError: { text: '编辑失败' }, // 编辑失败的提示
otherError: { text: '填写有误,不可以提交' } // processData中取消提交的提示
},
// 各类型表单样式设置
formStyle: {
formOptions: {
labelWidth: '170px',
labelPosition: 'right'
},
datePicker: { style: { width: '60%' }},
input: { style: { width: '60%' }},
select: { style: { width: '60%' }},
textarea: {
style: { width: '60%' },
resize: 'none',
autosize: { minRows: 3, maxRows: 5 },
rows: 3
},
quillEdito: { style: { width: '65%' }}
},
// 'cc_option': {
// includes: ['ccSubjectId']
// }
judgeRefers: { // 主查外
'cc_hm_user': {
includes: ['applicantId']
}
}
} }
}, },
computed: { computed: {
...@@ -62,12 +147,18 @@ ...@@ -62,12 +147,18 @@
created() { created() {
this.schema = schema this.schema = schema
// console.log(this.schema) // console.log(this.schema)
this.tableId = '0e26566e953449a7a7500c34be39fd26' // this.tableId = '1efff63125954583b0ac5a9c252b9041'
this.tableId = 'b08d2220d2574bf2ac09ec4f470ed999'
}, },
methods: { methods: {
processData(object) { inputChange(val) {
console.log(object) // console.log(event)
return object console.log(val)
},
processData(object, isCancel) {
isCancel.cancelSubmit = false // 如果要取消提交,设为true
console.log(125, object)
return object // 将数据返回
}, },
method1() { method1() {
console.log('method1') console.log('method1')
...@@ -78,15 +169,8 @@ ...@@ -78,15 +169,8 @@
method3() { method3() {
console.log('method3') console.log('method3')
}, },
usernameValidate() { method4() {
console.log(1) console.log('method4')
// if (!value) {
// callback(new Error('请输入用户名'))
// } else if ((value.length < 2 || value.length > 10)) {
// callback(new Error('用户名长度在 2 到 10 个字符'))
// } else {
// callback()
// }
} }
} }
} }
......
...@@ -24,7 +24,11 @@ ...@@ -24,7 +24,11 @@
}, },
data() { data() {
return { return {
showUserColumns: ['mobile', 'loginid', 'username', 'email', 'createTime'], showUserColumns: [
{ name: '手机号', codeCamel: 'mobile', isSort: true },
{ name: '登录ID', codeCamel: 'loginid', isSort: true },
'username', 'email', { name: '创建时间', codeCamel: 'createTime', isSort: true, width: '130px' }
],
userFilters: [ userFilters: [
{ placeholder: '过滤手机号', 'mobile': { 'like': '' }, isShow: true }, { placeholder: '过滤手机号', 'mobile': { 'like': '' }, isShow: true },
{ placeholder: '过滤用户名', 'username': { 'equalTo': '' }, isShow: true }, { placeholder: '过滤用户名', 'username': { 'equalTo': '' }, isShow: true },
...@@ -51,7 +55,7 @@ ...@@ -51,7 +55,7 @@
sortItem: 'create_time', sortItem: 'create_time',
sortOrder: 'desc', sortOrder: 'desc',
changeValue: { changeValue: {
username: { 1: '是', 0: '否' } username: { 1: 'Hm-isChecked', 0: 'Hm-noChecked' }
}, },
newData: { newData: {
isShow: true, isShow: true,
...@@ -60,24 +64,33 @@ ...@@ -60,24 +64,33 @@
{ name: '登录ID', codeCamel: 'loginid', widgetType: 1 }, { name: '登录ID', codeCamel: 'loginid', widgetType: 1 },
{ name: '类型', codeCamel: 'type', widgetType: 1 } { name: '类型', codeCamel: 'type', widgetType: 1 }
], ],
showUserButtons: [],
formSchema: schema['HmUser'], formSchema: schema['HmUser'],
layout: { left: 0, middle: 24, right: 0 } layout: { left: 0, middle: 24, right: 0 },
tips: {},
formStyle: {}
}, },
editData: { editData: {
isShow: true, isShow: true,
showUserColumns: [{ name: '姓名', codeCamel: 'username', widgetType: 1 }], showUserColumns: [{ name: '姓名', codeCamel: 'username', widgetType: 1 }],
showUserButtons: [],
formSchema: schema['HmUser'], formSchema: schema['HmUser'],
layout: { left: 0, middle: 24, right: 0 } layout: { left: 0, middle: 24, right: 0 },
tips: {},
formStyle: {}
},
showDetail: {
isShow: true
}, },
showRefresh: true, showRefresh: true,
showExport: true, showExport: true,
showDeleteButton: true, showDeleteButton: true,
buttonGroup: false, buttonGroup: false,
showDetail: { showSelection: false,
isShow: true, showOverflowTooltip: true,
showColumns: ['mobile', 'loginid', 'username', 'email'] tableCurrentChange(value) {}
} // dataProcessing(value, params, definedOperate) {}, // 处理返回后的数据,必须return 处理后的数据
// dataProcessing(value) {} // 处理返回后的数据,必须return 处理后的数据 // promiseProcessing(value, params, definedOperate) {} // 处理返回后的数据,必须return Promise对象
} }
this.userDefined = { this.userDefined = {
definedParams(params, operate) { definedParams(params, operate) {
...@@ -86,8 +99,19 @@ ...@@ -86,8 +99,19 @@
definedOperate: [ definedOperate: [
{ type: 'select', label: '', placeholder: '类型', options: [{ label: '姓名', code: 'username' }, { label: '登录ID', code: 'loginid' }], value: '' }, { type: 'select', label: '', placeholder: '类型', options: [{ label: '姓名', code: 'username' }, { label: '登录ID', code: 'loginid' }], value: '' },
{ type: 'input', label: '', placeholder: '邮箱', code: 'email', value: '' }, { type: 'input', label: '', placeholder: '邮箱', code: 'email', value: '' },
{ type: 'datetime', label: '', placeholder: '创建时间', code: 'createTime', value: '' }, { type: 'datetime', label: '', placeholder: '创建时间', code: 'createTime', value: '' }
{ type: 'button', label: '搜索', icon: 'el-icon-search', func: this.dropDown }] ],
definedOperation: [{ label: '测试', func: this.dropDown }],
definedEdit() {
},
definedNew() {
},
definedDetail() {
}
// pretreatment() {}
} }
}, },
methods: { methods: {
...@@ -95,8 +119,8 @@ ...@@ -95,8 +119,8 @@
this.dialogFormVisible = false this.dialogFormVisible = false
console.log('method1') console.log('method1')
}, },
dropDown() { dropDown(value) {
console.log('输出一些东西') console.log('输出一些东西', value)
} }
} }
} }
......
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