Commit bf3ed7ac authored by 郜超's avatar 郜超

Merge branch 'master' of 115.28.80.125:softwarefactory/vueelementtemplate

parents 0767217a aad90771
......@@ -6,9 +6,7 @@
:layout="layout"
:tips="tips"
:funObject="funObject"
:refers="userRefers"
:foreignFormFields="foreignFormFields"
:relates="userRelates">
>
<!-- foreignFormFields 主查外的外表显示字段 和userRefers连用-->
<!-- :relates="userRelates" 中间表和间接关联表-->
<!-- :refers="userRefers" 主查外的外表和外键字段 和foreignFormFields;连用-->
......@@ -48,15 +46,16 @@
// ]
},
// 2下拉框
{ name: '用户名称', codeCamel: 'username', widgetType: 2, multiple: false,
change: this.inputChange, // default: [1], 如果开启多选,默认选中项用数组[1]、[1,2,3]
options: [
{ value: '1', label: '企业' }, // 下拉框的label是选项文字,value是选中值
{ value: '2', label: '代理商' },
{ value: '3', label: '会员' },
{ value: '4', label: '访客' }
]
},
// { name: '用户名称', codeCamel: 'username', widgetType: 2, multiple: false,
// change: this.selectChange, // default: [1], 如果开启多选,默认选中项用数组[1]、[1,2,3]
// allowCreate: true,
// options: [
// { value: '1', label: '企业' }, // 下拉框的label是选项文字,value是选中值
// { value: '2', label: '代理商' },
// { value: '3', label: '会员' },
// { value: '4', label: '访客' }
// ]
// },
// 3多选 不支持默认值
{ name: '部门ID', codeCamel: 'departmentId', widgetType: 3, options: ['美女', '帅哥'], change: this.inputChange },
// 4密码
......@@ -73,9 +72,11 @@
{ label: 1, value: '会员' }, // 单选的value是选项文字,label是选中值
{ label: 2, value: '访客' } // 如果数据库中存的数据类型是number,label值写number如1,如果为string,label值写string ,如'1'
], // default: 1
change: this.inputChange },
change: this.inputChange
},
// 8文件 change: this.uploadChange
{ name: '选择头像', codeCamel: 'avatar', widgetType: 8, url: '/api/upload', param: 'picture', accept: 'image/*' } // url是后台接口地址
{ name: '选择头像', codeCamel: 'avatar', widgetType: 8, url: '/api/upload', param: 'picture' }, // url是后台接口地址
{ name: '用户名称', codeCamel: 'username', widgetType: 8, url: '/api/upload', param: 'picture' } // url是后台接口地址
],
// CcSubject示例
showUserColumns2: [
......@@ -105,11 +106,12 @@
includes: ['ccSubjectId']
}
},
// userIncludes: {
// 'hm_user': {
// includes: ['user_id']
// }
// },
// 外查主
userIncludes: {
'hm_user': {
includes: ['user_id']
}
},
// 要显示按钮
showUserButtons: [
{ text: '确定', type: 1, method: this.method1, beforeSubmit: this.processData },
......@@ -120,7 +122,8 @@
{ text: '取消', type: 3, method: this.method3 }
],
funObject: {
beforeRender: this.beforeRender
beforeRender: this.beforeRender,
uploadFun: this.uploadFun
},
// showUserButtons: []
// 布局方式
......@@ -143,6 +146,7 @@
datePicker: { style: { width: '60%' }},
input: { style: { width: '60%' }},
select: { style: { width: '60%' }},
cascader: { style: { width: '60%' }},
textarea: {
style: { width: '60%' },
resize: 'none',
......@@ -179,10 +183,13 @@
},
methods: {
inputChange(val, formModel) {
console.log(val)
console.log(formModel)
// console.log(val)
// console.log(formModel)
// formModel.email = val.length
},
selectChange(val, formModel) {
console.log('下拉框change', val, formModel)
},
processData(object, isCancel) {
isCancel.cancelSubmit = false // 如果要取消提交,设为true
console.log(125, object)
......@@ -211,6 +218,12 @@
// console.log(111, data)
// console.log(112, formModel)
return formModel
},
uploadFun: function(response, formModel) {
// console.log(215, response)
// console.log(216, formModel)
// 修改其他表单的值
formModel.email = response.visitName
}
}
}
......
......@@ -147,8 +147,11 @@
:formStyle="HmComplexForm.formStyle"
:funObject="HmComplexForm.funObject"
:refers="HmComplexForm.formRefers"
:includes="HmComplexForm.formIncludes"
:foreignFormFields="HmComplexForm.foreignFormFields"
:relates="HmComplexForm.formRelates" >
:relates="HmComplexForm.formRelates"
:rules="HmComplexForm.rules"
v-on:formVisible='dialogClose'>
</hm-complex-form>
</el-dialog>
......@@ -394,15 +397,19 @@
formStyle: {},
funObject: {},
formRefers: {},
formIncludes: {},
foreignFormFields: [],
formRelates: []
formRelates: [],
rules: {
}
},
showOverflowTooltip: false, // 设置当内容过长被隐藏时显示 tooltip
HmFullCalendar: {}, //
isShowRefresh: false,
buttonGroup: false,
operationWidth: 0, // 操作栏的宽度
operationWidth: 20, // 操作栏的宽度
isShowDetail: false, // 是否显示详情按钮
definedOperate: [], // 自定义操作
......@@ -421,6 +428,21 @@
return ret
}
_.map(ret, function(item) {
_.forEach(item, function(value, key) {
if (value.lessThanOrEqualTo !== undefined && value.greaterThanOrEqualTo !== undefined &&
(value.greaterThanOrEqualTo === '' || value.greaterThanOrEqualTo === null) && (value.lessThanOrEqualTo === '' || value.lessThanOrEqualTo === null)) {
delete item[key]
}
if (value.greaterThanOrEqualTo !== undefined && (value.greaterThanOrEqualTo === '' || value.greaterThanOrEqualTo === null) && value.lessThanOrEqualTo) {
delete item[key].greaterThanOrEqualTo
}
if (value.lessThanOrEqualTo !== undefined && (value.lessThanOrEqualTo === '' || value.lessThanOrEqualTo === null) && value.greaterThanOrEqualTo) {
delete item[key].lessThanOrEqualTo
}
})
})
_.each(Object.keys(ret[self.schema['modelUnderscore']]), function(column) {
const operValue = ret[self.schema['modelUnderscore']][column]
if (Object.keys(operValue)[0] === 'like') {
......@@ -435,6 +457,7 @@
// this.validate()
const self = this
if (this.userDefined && this.userDefined.pretreatment) {
self.init()
self.userDefined.pretreatment().then(function() {
self.init()
self.getList()
......@@ -472,7 +495,7 @@
init() {
const self = this
self.operationWidth = 0
self.operationWidth = 20
// 处理要显示的列
if (!self.columns || !self.columns.length) {
_.each(self.schema['columns'], function(column) {
......@@ -534,7 +557,20 @@
self.definedOperate = self.userDefined.definedOperate
}
if (self.userDefined.definedOperation) {
self.operationWidth += 50 * self.userDefined.definedOperation.length
_.each(self.userDefined.definedOperation, function(item, index) {
_.each(item.label, function(value) {
if (!isNaN(Number(value))) {
self.operationWidth += 8 // 如果是数字+8
} else {
self.operationWidth += 13 // 如果是汉字加13
}
})
if (self.userDefined.definedOperation.length > 1 && index > 1) {
self.operationWidth += 13 // 每添加一条需加上margin
} else {
self.operationWidth += 5
}
})
self.definedOperation = self.userDefined.definedOperation
}
},
......@@ -664,6 +700,7 @@
formStyle: {},
funObject: {},
formRefers: {},
formIncludes: {},
foreignFormFields: [],
formRelates: []
}
......@@ -681,6 +718,7 @@
self.options.editData.formStyle ? self.HmComplexForm.formStyle = self.options.editData.formStyle : ''
self.options.editData.funObject ? self.HmComplexForm.funObject = self.options.editData.funObject : ''
self.options.editData.formRefers ? self.HmComplexForm.formRefers = self.options.editData.formRefers : ''
self.options.editData.formIncludes ? self.HmComplexForm.formIncludes = self.options.editData.formIncludes : ''
self.options.editData.foreignFormFields ? self.HmComplexForm.foreignFormFields = self.options.editData.foreignFormFields : ''
self.options.editData.formRelates ? self.HmComplexForm.formRelates = self.options.editData.formRelates : ''
}
......@@ -696,6 +734,7 @@
self.options.newData.formStyle ? self.HmComplexForm.formStyle = self.options.newData.formStyle : ''
self.options.newData.funObject ? self.HmComplexForm.funObject = self.options.newData.funObject : ''
self.options.newData.formRefers ? self.HmComplexForm.formRefers = self.options.newData.formRefers : ''
self.options.newData.formIncludes ? self.HmComplexForm.formIncludes = self.options.newData.formIncludes : ''
self.options.newData.foreignFormFields ? self.HmComplexForm.foreignFormFields = self.options.newData.foreignFormFields : ''
self.options.newData.formRelates ? self.HmComplexForm.formRelates = self.options.newData.formRelates : ''
}
......@@ -712,9 +751,15 @@
self.options.showDetail.formStyle ? self.HmComplexForm.formStyle = self.options.showDetail.formStyle : ''
self.options.showDetail.funObject ? self.HmComplexForm.funObject = self.options.showDetail.funObject : ''
self.options.showDetail.formRefers ? self.HmComplexForm.formRefers = self.options.showDetail.formRefers : ''
self.options.showDetail.formIncludes ? self.HmComplexForm.formIncludes = self.options.showDetail.formIncludes : ''
self.options.showDetail.foreignFormFields ? self.HmComplexForm.foreignFormFields = self.options.showDetail.foreignFormFields : ''
self.options.showDetail.formRelates ? self.HmComplexForm.formRelates = self.options.showDetail.formRelates : ''
self.HmComplexForm.tableId = data.id
// wk 2018年05月09日11:57:06
if (self.options.showDetail.funCallback) {
self.options.showDetail.funCallback(data)
}
}
self.dialogFormVisible = true
......@@ -797,7 +842,7 @@
}).then(resp => {
if (resp.data.message === 'delete success') {
self.$message({
message: resp.data.message,
message: '删除成功',
type: 'success'
})
self.getList()
......@@ -820,7 +865,7 @@
}
if (self.options.editData && self.options.editData.isShow) { // 判断是否显示编辑按钮
self.isShowEditDataButton = self.options.editData.isShow
self.operationWidth += 50
self.operationWidth += 30
}
if (self.options.showRefresh) { // 判断是否显示刷新按钮
self.isShowRefresh = self.options.showRefresh
......@@ -839,14 +884,14 @@
}
if (self.options.showDeleteButton) { // 判断是否显示删除按钮
self.isShowDeleteButton = self.options.showDeleteButton
self.operationWidth += 50
self.operationWidth += 30
}
if (self.options.buttonGroup) { // 设置按钮是否以按钮组呈现
self.buttonGroup = self.options.buttonGroup
}
if (self.options.showDetail && self.options.showDetail.isShow) { // 设置按钮是否以按钮组呈现
self.isShowDetail = self.options.showDetail.isShow
self.operationWidth += 50
self.operationWidth += 30
}
if (self.options.showSelection) { // 设置是否显示多选
self.isShowSelection = self.options.showSelection
......@@ -930,6 +975,10 @@
},
getFilterOperTwin(filter) {
return Object.keys(filter[this.getFilterColumn(filter)])[1]
},
dialogClose() {
this.dialogFormVisible = false
this.getList()
}
}
}
......
......@@ -32,7 +32,7 @@
userFilters: [
{ placeholder: '过滤手机号', 'mobile': { 'like': '' }, isShow: true },
{ placeholder: '过滤用户名', 'username': { 'equalTo': '' }, isShow: true },
{ placeholder: ['安全级别大于', '安全级别小于'], 'create_time': { 'greaterThanOrEqualTo': '', 'lessThanOrEqualTo': '' }, isShow: true }
{ placeholder: ['安全级别大于', '安全级别小于'], 'security_level': { 'greaterThanOrEqualTo': '', 'lessThanOrEqualTo': '' }, isShow: true }
],
userIncludes: {
'hm_user': {
......
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