Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
VueElementTemplate
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄瑜
VueElementTemplate
Commits
43fcb0e0
Commit
43fcb0e0
authored
Apr 04, 2018
by
gaochao
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of 115.28.80.125:softwarefactory/vueelementtemplate
parents
6c4d4262
501d8e99
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
360 additions
and
131 deletions
+360
-131
HmComplexForm.vue
src/views/haomo/components/forms/HmComplexForm.vue
+239
-33
index.vue
src/views/haomo/components/forms/index.vue
+56
-31
HmComplexTable.vue
src/views/haomo/components/tables/HmComplexTable.vue
+56
-66
index.vue
src/views/haomo/components/tables/index.vue
+9
-1
No files found.
src/views/haomo/components/forms/HmComplexForm.vue
View file @
43fcb0e0
This diff is collapsed.
Click to expand it.
src/views/haomo/components/forms/index.vue
View file @
43fcb0e0
<
template
>
<!--:refers="judgeRefers"-->
<div>
<hm-complex-form
:schema=
"schema['HmUser']"
:columns=
"showUserColumns"
:buttons=
"showUserButtons"
:layout=
"layout"
:tips=
"tips"
:refers=
"userRefers"
>
:refers=
"userRefers"
:foreignFormFields=
"foreignFormFields"
:relates=
"userRelates"
>
</hm-complex-form>
</div>
</
template
>
...
...
@@ -32,7 +33,7 @@
change
:
this
.
inputChange
// rule: { required: true, message: '用户名不能为空', trigger: 'blur' }
// hide: true
// default: '默认值',
// default: '默认值',
},
// 5富文本
{
name
:
'电子邮件'
,
codeCamel
:
'email'
,
widgetType
:
5
,
disabled
:
false
,
...
...
@@ -60,7 +61,7 @@
// 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'
// default: '2018-01-01 00:07:08'
},
// 7单选
{
name
:
'登陆id'
,
codeCamel
:
'loginid'
,
widgetType
:
7
,
...
...
@@ -72,38 +73,51 @@
// 8文件
{
name
:
'选择头像'
,
codeCamel
:
'avatar'
,
widgetType
:
8
,
url
:
'/api/upload'
}
// url是后台接口地址
],
// CcSubject示例
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
}
{
name
:
'题目'
,
codeCamel
:
'subject'
},
{
name
:
'题目类型'
,
codeCamel
:
'subjectType'
,
default
:
3
},
{
name
:
'A选项'
,
codeCamel
:
'description0'
,
code
:
'description'
,
serialNumber
:
'A'
,
widgetType
:
1
,
isForeign
:
true
},
{
name
:
'B选项'
,
codeCamel
:
'description1'
,
code
:
'description'
,
serialNumber
:
'B'
,
widgetType
:
1
,
isForeign
:
true
},
{
name
:
'正确选项'
,
codeCamel
:
'correct'
,
widgetType
:
1
,
isForeign
:
true
,
partProp
:
true
},
{
name
:
'试题详解'
,
codeCamel
:
'commentary'
,
widgetType
:
1
}
],
userIncludes
:
{
'hm_user'
:
{
includes
:
[
'user_id'
]
}
},
// 主查外
// schema['CcMenuResource'] + userRelates + showUserColumns3 理论学习示例
showUserColumns3
:
[
{
name
:
'标题'
,
codeCamel
:
'title'
,
widgetType
:
1
},
{
name
:
'封面图片'
,
codeCamel
:
'thumbnail'
,
widgetType
:
8
},
{
name
:
'视频'
,
codeCamel
:
'videoName'
,
widgetType
:
8
},
{
name
:
'简介'
,
codeCamel
:
'lntroduction'
,
widgetType
:
1
},
{
name
:
'内容'
,
codeCamel
:
'content'
,
widgetType
:
4
},
{
name
:
'发布人'
,
codeCamel
:
'publisher'
,
widgetType
:
1
}
],
// schema['CcSubject']+foreignFormFields+userRefers+showUserColumns2 判断题示例
// 第一个值为外键字段(codeCamel)
foreignFormFields
:
[
'ccSubjectId'
,
'description'
,
'correct'
,
'serialNumber'
],
// 主查外表 外键字段
userRefers
:
{
'cc_
shift
'
:
{
includes
:
[
'
applicant_i
d'
]
'cc_
option
'
:
{
includes
:
[
'
ccSubjectI
d'
]
}
},
// userIncludes: {
// 'hm_user': {
// includes: ['user_id']
// }
// },
// 要显示按钮
showUserButtons
:
[
{
text
:
'确定'
,
type
:
1
,
method
:
this
.
method1
,
beforeSubmit
:
this
.
processData
},
{
text
:
'重置'
,
type
:
2
,
method
:
this
.
method2
},
{
text
:
'生成'
,
method
:
this
.
method4
},
// { text: '预览', method: this.method5 },
// { text: '预览2', method: this.method5 },
{
text
:
'取消'
,
type
:
3
,
method
:
this
.
method3
}
],
// showUserButtons: []
// 布局方式
layout
:
{
left
:
4
,
middle
:
16
,
right
:
4
},
layout
:
{
left
:
2
,
middle
:
20
,
right
:
2
},
// 自定义提示消息
tips
:
{
hidde
:
false
,
// 是否显示提示,默认false显示
...
...
@@ -128,16 +142,22 @@
autosize
:
{
minRows
:
3
,
maxRows
:
5
},
rows
:
3
},
quillEdito
:
{
style
:
{
width
:
'65%'
}}
quillEdito
r
:
{
style
:
{
width
:
'65%'
}}
},
// 'cc_option': {
// includes: ['ccSubjectId']
// }
judgeRefers
:
{
// 主查外
'cc_hm_user'
:
{
includes
:
[
'applicantId'
]
// 关联表 本表即页面显示的要创建的表'CcMenuResource' 中间表'cc_menu_resource_associations'
// 间接关联表'cc_secondary_menu_dictionaries'
userRelates
:
[
// 间接关联表
{
indirectTable
:
'cc_secondary_menu_dictionaries'
,
// 下划线复数
// 过滤查询的条件
filters
:
{
'cc_secondary_menu_dictionary'
:
{
'name'
:
{
equalTo
:
'理论学习'
}}}
},
// 中间表
{
relateTable
:
'cc_menu_resource_associations'
,
relateKeys
:
[
'resourceId'
,
'menuId'
]
// 中间表与主表(本表)字段 与间接关联表对应字段
}
}
]
}
},
computed
:
{
...
...
@@ -169,7 +189,12 @@
method3
()
{
console
.
log
(
'method3'
)
},
method4
()
{
method4
(
formModel
)
{
console
.
log
(
formModel
)
console
.
log
(
'method4'
)
},
method5
(
formModel
)
{
console
.
log
(
formModel
)
console
.
log
(
'method4'
)
}
}
...
...
src/views/haomo/components/tables/HmComplexTable.vue
View file @
43fcb0e0
...
...
@@ -95,6 +95,7 @@
<el-button
class=
"filter-item"
type=
"primary"
v-waves
icon=
"el-icon-refresh"
v-if=
"isShowRefresh"
@
click=
"refreshList"
>
刷新
</el-button>
<el-button
class=
"filter-item"
type=
"primary"
v-waves
icon=
"el-icon-close"
v-if=
"multipleSelection.length"
@
click=
"BatchRemove"
>
批量删除
</el-button>
</span>
<hm-full-calendar
style=
"display: inline;margin-left: 10px;"
:schema=
"HmFullCalendar.calendarSchema"
:demoEvents=
"HmFullCalendar.demoEvents"
v-if=
"HmFullCalendar.calendarSchema"
></hm-full-calendar>
</el-form>
</div>
...
...
@@ -136,14 +137,13 @@
<!-- @TODO 补充详情弹窗 -->
<el-dialog
:title=
"dialogName"
:visible
.
sync=
"dialogFormVisible"
:close-on-click-modal=
"closeOnClickModal"
width=
"dialogWidth"
v-if=
"dialogFormVisible"
>
<hm-complex-form
:schema=
"formSchema"
:columns=
"showUserColumns"
:buttons=
"showUserButtons"
:layout=
"layout"
:tableId=
"tableId"
:tips=
"formTips"
:formStyle=
"formStyle"
ref=
"selectfood"
>
<hm-complex-form
:schema=
"HmComplexForm.formSchema"
:columns=
"HmComplexForm.showUserColumns"
:buttons=
"HmComplexForm.showUserButtons"
:layout=
"HmComplexForm.layout"
:tableId=
"HmComplexForm.tableId"
:tips=
"HmComplexForm.formTips"
:formStyle=
"HmComplexForm.formStyle"
>
</hm-complex-form>
</el-dialog>
...
...
@@ -160,6 +160,7 @@
import
*
as
excel
from
'@/vendor/Export2Excel'
import
{
Button
,
Table
,
TableColumn
,
Pagination
,
Loading
}
from
'element-ui'
import
HmComplexForm
from
'../forms/HmComplexForm.vue'
import
HmFullCalendar
from
'../calendar/HmFullCalendar.vue'
/**
* 毫末科技的表格组件.
...
...
@@ -178,7 +179,8 @@
'el-table'
:
Table
,
'el-table-column'
:
TableColumn
,
'el-pagination'
:
Pagination
,
'hm-complex-form'
:
HmComplexForm
'hm-complex-form'
:
HmComplexForm
,
'hm-full-calendar'
:
HmFullCalendar
},
// 混入公共对象
mixins
:
[],
...
...
@@ -361,14 +363,17 @@
isShowEditDataButton
:
false
,
// 是否显示编辑
isShowDeleteButton
:
false
,
// 是否显示删除
isShowExport
:
false
,
// 是否显示导出按钮
formSchema
:
{},
// form弹窗的Schema定义
showUserColumns
:
[],
// form弹窗的Columns定义
showUserButtons
:
[],
// from弹窗显示按钮,
layout
:
{
left
:
0
,
middle
:
24
,
right
:
0
},
// form弹窗的布局方式
tableId
:
''
,
formTips
:
''
,
formStyle
:
''
,
showOverflowTooltip
:
false
,
HmComplexForm
:
{
// 设置form组件
formSchema
:
{},
// form弹窗的Schema定义
showUserColumns
:
[],
// form弹窗的Columns定义
showUserButtons
:
[],
// from弹窗显示按钮,
layout
:
{
left
:
0
,
middle
:
24
,
right
:
0
},
// form弹窗的布局方式
tableId
:
''
,
formTips
:
''
,
formStyle
:
''
},
showOverflowTooltip
:
false
,
// 设置当内容过长被隐藏时显示 tooltip
HmFullCalendar
:
{},
//
isShowRefresh
:
false
,
buttonGroup
:
false
,
...
...
@@ -611,29 +616,29 @@
self
.
userDefined
.
definedDetail
(
true
,
data
)
return
false
}
self
.
tableId
=
''
self
.
HmComplexForm
.
tableId
=
''
if
(
type
===
'editData'
)
{
self
.
dialogName
=
'编辑'
if
(
self
.
options
.
editData
.
showUserButtons
)
{
self
.
showUserButtons
=
self
.
options
.
editData
.
showUserButtons
}
self
.
tableId
=
data
.
id
self
.
showUserColumns
=
self
.
options
.
editData
.
showUserColumns
self
.
formSchema
=
self
.
options
.
editData
.
formSchema
self
.
layout
=
self
.
options
.
editData
.
layout
self
.
formTips
=
self
.
options
.
editData
.
tips
self
.
formStyle
=
self
.
options
.
editData
.
formStyle
self
.
HmComplexForm
.
tableId
=
data
.
id
self
.
HmComplexForm
.
showUserColumns
=
self
.
options
.
editData
.
showUserColumns
self
.
HmComplexForm
.
formSchema
=
self
.
options
.
editData
.
formSchema
self
.
HmComplexForm
.
layout
=
self
.
options
.
editData
.
layout
self
.
HmComplexForm
.
formTips
=
self
.
options
.
editData
.
tips
self
.
HmComplexForm
.
formStyle
=
self
.
options
.
editData
.
formStyle
}
if
(
type
===
'newData'
)
{
self
.
dialogName
=
'新建'
if
(
self
.
options
.
newData
.
showUserButtons
)
{
self
.
showUserButtons
=
self
.
options
.
newData
.
showUserButtons
}
self
.
showUserColumns
=
self
.
options
.
newData
.
showUserColumns
self
.
formSchema
=
self
.
options
.
newData
.
formSchema
self
.
layout
=
self
.
options
.
newData
.
layout
self
.
formTips
=
self
.
options
.
newData
.
tips
self
.
formStyle
=
self
.
options
.
newData
.
formStyle
self
.
HmComplexForm
.
showUserColumns
=
self
.
options
.
newData
.
showUserColumns
self
.
HmComplexForm
.
formSchema
=
self
.
options
.
newData
.
formSchema
self
.
HmComplexForm
.
layout
=
self
.
options
.
newData
.
layout
self
.
HmComplexForm
.
formTips
=
self
.
options
.
newData
.
tips
self
.
HmComplexForm
.
formStyle
=
self
.
options
.
newData
.
formStyle
}
if
(
type
===
'detail'
)
{
self
.
dialogName
=
'详情'
...
...
@@ -641,12 +646,12 @@
if
(
self
.
options
.
detailData
.
showUserButtons
)
{
self
.
showUserButtons
=
self
.
options
.
detailData
.
showUserButtons
}
self
.
showUserColumns
=
self
.
options
.
showDetail
.
showUserColumns
self
.
formSchema
=
self
.
options
.
showDetail
.
formSchema
self
.
layout
=
self
.
options
.
showDetail
.
layout
self
.
formTips
=
self
.
options
.
showDetail
.
tips
self
.
formStyle
=
self
.
options
.
showDetail
.
formStyle
self
.
tableId
=
data
.
id
self
.
HmComplexForm
.
showUserColumns
=
self
.
options
.
showDetail
.
showUserColumns
self
.
HmComplexForm
.
formSchema
=
self
.
options
.
showDetail
.
formSchema
self
.
HmComplexForm
.
layout
=
self
.
options
.
showDetail
.
layout
self
.
HmComplexForm
.
formTips
=
self
.
options
.
showDetail
.
tips
self
.
HmComplexForm
.
formStyle
=
self
.
options
.
showDetail
.
formStyle
self
.
HmComplexForm
.
tableId
=
data
.
id
}
self
.
dialogFormVisible
=
true
...
...
@@ -676,29 +681,9 @@
// 删除一条数据
deleteData
(
data
)
{
const
self
=
this
self
.
$confirm
(
'此操作将永久删除该数据, 是否继续?'
,
'提示'
,
{
confirmButtonText
:
'确定'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
}).
then
(()
=>
{
request
(
self
.
schema
.
modelUnderscorePlural
+
'/'
+
data
.
id
+
'/delete'
,
{
method
:
'POST'
,
headers
:
{
'Content-Type'
:
'application/x-www-form-urlencoded;charset=UTF-8'
}
}).
then
(
data
=>
{
if
(
data
.
data
.
message
===
'delete success'
)
{
self
.
$message
({
message
:
data
.
data
.
message
,
type
:
'success'
})
self
.
getList
()
}
})
}).
catch
(()
=>
{
self
.
$message
({
message
:
'已取消删除'
,
type
:
'success'
})
})
const
params
=
{
ids
:
[
data
.
id
]
}
params
.
ids
=
JSON
.
stringify
(
params
.
ids
)
self
.
deleteDataRequest
(
params
)
},
refreshList
()
{
this
.
listQuery
=
{
...
...
@@ -715,15 +700,17 @@
// 批量删除
BatchRemove
()
{
const
self
=
this
const
datas
=
{
ids
:
[]
}
const
datas
=
{
ids
:
[]
}
if
(
!
self
.
multipleSelection
)
return
false
_
.
each
(
self
.
multipleSelection
,
function
(
item
,
index
)
{
datas
.
ids
.
push
(
item
.
id
)
})
datas
.
ids
=
JSON
.
stringify
(
datas
.
ids
)
self
.
$confirm
(
'此操作将永久删除该数据, 是否继续?'
,
'提示'
,
{
self
.
deleteDataRequest
(
datas
)
},
deleteDataRequest
(
data
)
{
const
self
=
this
self
.
$confirm
(
'此操作将永久删除数据, 是否继续?'
,
'提示'
,
{
confirmButtonText
:
'确定'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
...
...
@@ -731,12 +718,12 @@
request
(
self
.
schema
.
modelUnderscorePlural
+
'/delete/batch'
,
{
method
:
'POST'
,
headers
:
{
'Content-Type'
:
'application/x-www-form-urlencoded;charset=UTF-8'
},
data
:
data
s
,
data
:
data
,
transformRequest
:
param
}).
then
(
data
=>
{
if
(
data
.
data
.
message
===
'delete success'
)
{
}).
then
(
resp
=>
{
if
(
resp
.
data
.
message
===
'delete success'
)
{
self
.
$message
({
message
:
data
.
data
.
message
,
message
:
resp
.
data
.
message
,
type
:
'success'
})
self
.
getList
()
...
...
@@ -784,6 +771,9 @@
if
(
self
.
options
.
showOverflowTooltip
)
{
// 当内容过长被隐藏时显示 tooltip
self
.
showOverflowTooltip
=
self
.
options
.
showOverflowTooltip
}
if
(
self
.
options
.
HmFullCalendar
)
{
// 当内容过长被隐藏时显示 tooltip
self
.
HmFullCalendar
=
self
.
options
.
HmFullCalendar
}
},
handleSelectionChange
(
val
)
{
this
.
multipleSelection
=
val
...
...
src/views/haomo/components/tables/index.vue
View file @
43fcb0e0
...
...
@@ -82,11 +82,19 @@
showDetail
:
{
isShow
:
true
},
HmFullCalendar
:
{
calendarSchema
:
schema
[
'HmUser'
],
demoEvents
:
{
title
:
'username'
,
start
:
'createTime'
,
end
:
'lastUpdateTime'
}
},
showRefresh
:
true
,
showExport
:
true
,
showDeleteButton
:
true
,
buttonGroup
:
false
,
showSelection
:
fals
e
,
showSelection
:
tru
e
,
showOverflowTooltip
:
true
,
tableCurrentChange
(
value
)
{}
// dataProcessing(value, params, definedOperate) {}, // 处理返回后的数据,必须return 处理后的数据
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment