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
fa5ca4f0
Commit
fa5ca4f0
authored
Mar 12, 2018
by
杨柠瑞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
issues 11
parent
b885e337
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
82 additions
and
31 deletions
+82
-31
HmComplexTable.vue
src/views/haomo/components/tables/HmComplexTable.vue
+75
-24
index.vue
src/views/haomo/components/tables/index.vue
+1
-1
hm_org_schema.js
src/views/haomo/schemas/hm_org_schema.js
+6
-6
No files found.
src/views/haomo/components/tables/HmComplexTable.vue
View file @
fa5ca4f0
...
@@ -17,16 +17,19 @@
...
@@ -17,16 +17,19 @@
<el-button
class=
"filter-item"
type=
"primary"
:loading=
"downloadLoading"
v-waves
icon=
"el-icon-download"
@
click=
"handleDownload"
>
导出
</el-button>
<el-button
class=
"filter-item"
type=
"primary"
:loading=
"downloadLoading"
v-waves
icon=
"el-icon-download"
@
click=
"handleDownload"
>
导出
</el-button>
<el-button
class=
"filter-item"
type=
"primary"
v-waves
icon=
"el-icon-plus"
@
click=
"openDialog('newData')"
>
新建
</el-button>
<el-button
class=
"filter-item"
type=
"primary"
v-waves
icon=
"el-icon-plus"
@
click=
"openDialog('newData')"
>
新建
</el-button>
<el-button
class=
"filter-item"
type=
"primary"
v-waves
icon=
"el-icon-refresh"
@
click=
"refreshList"
>
刷新
</el-button>
<el-button
class=
"filter-item"
type=
"primary"
v-waves
icon=
"el-icon-refresh"
@
click=
"refreshList"
>
刷新
</el-button>
<el-button
class=
"filter-item"
type=
"primary"
v-waves
icon=
"el-icon-close"
@
click=
"BatchRemove"
v-if=
"multipleSelection.length"
>
批量删除
</el-button>
</div>
</div>
<!-- end 过滤 -->
<!-- end 过滤 -->
<!-- 表格 -->
<!-- 表格 -->
<el-table
:data=
"list"
v-loading=
"listLoading"
element-loading-text=
"给我一点时间"
border
fit
highlight-current-row
<el-table
:data=
"list"
v-loading=
"listLoading"
element-loading-text=
"给我一点时间"
border
fit
highlight-current-row
style=
"width: 100%"
>
style=
"width: 100%"
@
selection-change=
"handleSelectionChange"
>
<el-table-column
type=
"index"
:index=
"indexMethod"
></el-table-column>
<el-table-column
type=
"index"
:index=
"indexMethod"
label=
"序号"
width=
"50px"
></el-table-column>
<el-table-column
type=
"selection"
width=
"55"
>
</el-table-column>
<el-table-column
v-for=
"(column,index) in showColumns"
:key=
"index"
align=
"center"
:label=
"column.name"
>
<el-table-column
v-for=
"(column,index) in showColumns"
:key=
"index"
align=
"center"
:label=
"column.name"
>
<template
slot-scope=
"scope"
>
<template
slot-scope=
"scope"
>
<span>
{{
scope
.
row
[
column
.
code
]
}}
</span>
<span>
{{
scope
.
row
[
column
.
code
Camel
]
}}
</span>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
<el-table-column
fixed=
"right"
label=
"操作"
width=
"100"
>
<el-table-column
fixed=
"right"
label=
"操作"
width=
"100"
>
...
@@ -40,8 +43,8 @@
...
@@ -40,8 +43,8 @@
<!-- 翻页 -->
<!-- 翻页 -->
<div
class=
"pagination-container"
>
<div
class=
"pagination-container"
>
<el-pagination
background
@
size-change=
"handleSizeChange"
@
current-change=
"handleCurrentChange"
:current-page
.
sync=
"listQuery.page
_n
o"
<el-pagination
background
@
size-change=
"handleSizeChange"
@
current-change=
"handleCurrentChange"
:current-page
.
sync=
"listQuery.page
N
o"
:page-sizes=
"[10,20,50]"
:page-size=
"listQuery.page
_s
ize"
layout=
"total, sizes, prev, pager, next, jumper"
:total=
"total"
>
:page-sizes=
"[10,20,50]"
:page-size=
"listQuery.page
S
ize"
layout=
"total, sizes, prev, pager, next, jumper"
:total=
"total"
>
</el-pagination>
</el-pagination>
</div>
</div>
<!-- end翻页 -->
<!-- end翻页 -->
...
@@ -49,7 +52,7 @@
...
@@ -49,7 +52,7 @@
<!-- 弹窗 -->
<!-- 弹窗 -->
<!-- @TODO 补充弹窗 -->
<!-- @TODO 补充弹窗 -->
<el-dialog
title=
"收货地址
"
:visible
.
sync=
"dialogFormVisible"
:close-on-click-modal=
"closeOnClickModal"
width=
"dialogWidth"
>
<el-dialog
:title=
"dialogName
"
:visible
.
sync=
"dialogFormVisible"
:close-on-click-modal=
"closeOnClickModal"
width=
"dialogWidth"
>
<el-form>
<el-form>
<el-form-item
:label=
"dialog.name"
:label-width=
"formLabelWidth"
v-for=
"dialog in dialogForm"
>
<el-form-item
:label=
"dialog.name"
:label-width=
"formLabelWidth"
v-for=
"dialog in dialogForm"
>
<el-input
v-model=
"dialog.value"
auto-complete=
"off"
></el-input>
<el-input
v-model=
"dialog.value"
auto-complete=
"off"
></el-input>
...
@@ -133,7 +136,7 @@
...
@@ -133,7 +136,7 @@
* [
* [
* {
* {
* "name": "姓名",
* "name": "姓名",
* "code": "username",
* "code
Camel
": "username",
* "render": function(value){
* "render": function(value){
* return "<a href='value'></a>"
* return "<a href='value'></a>"
* }
* }
...
@@ -162,12 +165,12 @@
...
@@ -162,12 +165,12 @@
required
:
false
required
:
false
},
},
/**
/**
* 表格的选项,包括:page
_s
ize。完整的示例为:
* 表格的选项,包括:page
S
ize。完整的示例为:
* {
* {
* "page
_s
ize": 10, // 默认为10条数据/页
* "page
S
ize": 10, // 默认为10条数据/页
* "showExport": false, // 默认为不显示导出按钮
* "showExport": false, // 默认为不显示导出按钮
* "sort
_i
tem": "create_time", // 默认为create_time字段的desc排序
* "sort
I
tem": "create_time", // 默认为create_time字段的desc排序
* "sort
_o
rder": "desc",
* "sort
O
rder": "desc",
* "changeValue": { // 数据库字段转化显示,例如(0=否,1=是)
* "changeValue": { // 数据库字段转化显示,例如(0=否,1=是)
* username: {1: '是', 0: '否'}
* username: {1: '是', 0: '否'}
* }
* }
...
@@ -188,10 +191,10 @@
...
@@ -188,10 +191,10 @@
total
:
null
,
total
:
null
,
listLoading
:
true
,
listLoading
:
true
,
listQuery
:
{
listQuery
:
{
page
_n
o
:
1
,
page
N
o
:
1
,
page
_s
ize
:
20
,
page
S
ize
:
20
,
sort
_i
tem
:
'create_time'
,
sort
I
tem
:
'create_time'
,
sort
_o
rder
:
'desc'
,
sort
O
rder
:
'desc'
,
filters
:
{}
filters
:
{}
},
},
downloadLoading
:
false
,
downloadLoading
:
false
,
...
@@ -200,7 +203,9 @@
...
@@ -200,7 +203,9 @@
dialogType
:
''
,
// 弹窗的类型
dialogType
:
''
,
// 弹窗的类型
showColumns
:
[],
// 要显示的列数据
showColumns
:
[],
// 要显示的列数据
formLabelWidth
:
'120px'
,
formLabelWidth
:
'120px'
,
closeOnClickModal
:
false
closeOnClickModal
:
false
,
multipleSelection
:
[],
// 选择的数组
dialogName
:
''
}
}
},
},
computed
:
{
computed
:
{
...
@@ -234,7 +239,7 @@
...
@@ -234,7 +239,7 @@
},
},
methods
:
{
methods
:
{
indexMethod
(
index
)
{
indexMethod
(
index
)
{
return
this
.
listQuery
.
page
_size
*
(
this
.
listQuery
.
page_n
o
-
1
)
+
index
+
1
return
this
.
listQuery
.
page
Size
*
(
this
.
listQuery
.
pageN
o
-
1
)
+
index
+
1
},
},
validate
()
{
validate
()
{
const
self
=
this
const
self
=
this
...
@@ -338,10 +343,13 @@
...
@@ -338,10 +343,13 @@
self
.
dialogForm
=
_
.
cloneDeep
(
self
.
schema
.
columns
)
self
.
dialogForm
=
_
.
cloneDeep
(
self
.
schema
.
columns
)
if
(
type
===
'editData'
)
{
if
(
type
===
'editData'
)
{
self
.
dialogName
=
'编辑'
_
.
map
(
self
.
dialogForm
,
function
(
item
,
index
)
{
_
.
map
(
self
.
dialogForm
,
function
(
item
,
index
)
{
item
.
value
=
data
[
item
.
code
]
item
.
value
=
data
[
item
.
code
]
item
.
id
=
data
.
id
item
.
id
=
data
.
id
})
})
}
else
{
self
.
dialogName
=
'新建'
}
}
},
},
// 删除过滤条件为空的filter
// 删除过滤条件为空的filter
...
@@ -354,7 +362,7 @@
...
@@ -354,7 +362,7 @@
}
}
})
})
})
})
return
JSON
.
stringify
(
newFilters
[
Object
.
keys
(
newFilters
)])
===
'{}'
?
{}
:
newFilters
return
JSON
.
stringify
(
newFilters
[
Object
.
keys
(
newFilters
)])
===
'{}'
?
null
:
newFilters
},
},
// 弹框提交数据
// 弹框提交数据
submitDialog
()
{
submitDialog
()
{
...
@@ -415,25 +423,65 @@
...
@@ -415,25 +423,65 @@
},
},
refreshList
()
{
refreshList
()
{
this
.
listQuery
=
{
this
.
listQuery
=
{
page
_n
o
:
1
,
page
N
o
:
1
,
page
_s
ize
:
20
,
page
S
ize
:
20
,
sort
_i
tem
:
'create_time'
,
sort
I
tem
:
'create_time'
,
sort
_o
rder
:
'desc'
,
sort
O
rder
:
'desc'
,
filters
:
{}
filters
:
{}
}
}
this
.
init
()
this
.
init
()
this
.
getList
()
this
.
getList
()
},
},
// 批量删除
BatchRemove
()
{
const
self
=
this
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
(
'此操作将永久删除该数据, 是否继续?'
,
'提示'
,
{
confirmButtonText
:
'确定'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
}).
then
(()
=>
{
request
(
self
.
schema
.
modelUnderscorePlural
+
'/delete/batch'
,
{
method
:
'POST'
,
headers
:
{
'Content-Type'
:
'application/x-www-form-urlencoded;charset=UTF-8'
},
data
:
datas
,
transformRequest
:
param
}).
then
(
data
=>
{
if
(
data
.
data
.
message
===
'delete success'
)
{
self
.
$message
({
message
:
data
.
data
.
message
,
type
:
'success'
})
self
.
getList
()
}
})
}).
catch
(()
=>
{
self
.
$message
({
message
:
'已取消删除'
,
type
:
'success'
})
})
},
handleSelectionChange
(
val
)
{
this
.
multipleSelection
=
val
},
handleFilter
()
{
handleFilter
()
{
this
.
getList
()
this
.
getList
()
},
},
handleSizeChange
(
val
)
{
handleSizeChange
(
val
)
{
this
.
listQuery
.
page
_s
ize
=
val
this
.
listQuery
.
page
S
ize
=
val
this
.
getList
()
this
.
getList
()
},
},
handleCurrentChange
(
val
)
{
handleCurrentChange
(
val
)
{
this
.
listQuery
.
page
_n
o
=
val
this
.
listQuery
.
page
N
o
=
val
this
.
getList
()
this
.
getList
()
},
},
handleDelete
(
row
)
{
handleDelete
(
row
)
{
...
@@ -488,4 +536,7 @@
...
@@ -488,4 +536,7 @@
.hm-complex-table__filter-span
{
.hm-complex-table__filter-span
{
margin-right
:
5px
;
margin-right
:
5px
;
}
}
.el-table__body
tr
.current-row
>
td
{
background-color
:
#ecf5ff
;
}
</
style
>
</
style
>
src/views/haomo/components/tables/index.vue
View file @
fa5ca4f0
...
@@ -33,10 +33,10 @@
...
@@ -33,10 +33,10 @@
created
()
{
created
()
{
this
.
schema
=
schema
this
.
schema
=
schema
this
.
userOptions
=
{
this
.
userOptions
=
{
page_size
:
10
,
changeValue
:
{
changeValue
:
{
username
:
{
1
:
'是'
,
0
:
'否'
}
username
:
{
1
:
'是'
,
0
:
'否'
}
}
}
}
}
},
},
methods
:
{}
methods
:
{}
...
...
src/views/haomo/schemas/hm_org_schema.js
View file @
fa5ca4f0
...
@@ -3486,13 +3486,13 @@ const ModelSchema = {
...
@@ -3486,13 +3486,13 @@ const ModelSchema = {
}
}
]
]
},
},
'HmUser
3
'
:
{
'HmUser'
:
{
'model'
:
'HmUser3'
,
'model'
:
'HmUser3'
,
'modelPlural'
:
'HmUser
3S
'
,
'modelPlural'
:
'HmUser
s
'
,
'modelCamel'
:
'hmUser
3
'
,
'modelCamel'
:
'hmUser'
,
'modelCamelPlural'
:
'hmUser
3S
'
,
'modelCamelPlural'
:
'hmUser
s
'
,
'modelUnderscore'
:
'hm_user
3
'
,
'modelUnderscore'
:
'hm_user'
,
'modelUnderscorePlural'
:
'hm_user
3S
'
,
'modelUnderscorePlural'
:
'hm_user
s
'
,
'columns'
:
[
'columns'
:
[
{
{
'id'
:
'o449'
,
'id'
:
'o449'
,
...
...
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