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
5ba274b8
Commit
5ba274b8
authored
Mar 09, 2018
by
杨柠瑞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
issues 13
parent
83220be5
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
2 deletions
+27
-2
HmComplexTable.vue
src/views/haomo/components/tables/HmComplexTable.vue
+19
-1
index.vue
src/views/haomo/components/tables/index.vue
+8
-1
No files found.
src/views/haomo/components/tables/HmComplexTable.vue
View file @
5ba274b8
...
...
@@ -167,7 +167,10 @@
* "page_size": 10, // 默认为10条数据/页
* "showExport": false, // 默认为不显示导出按钮
* "sort_item": "create_time", // 默认为create_time字段的desc排序
"sort_order": "desc"
* "sort_order": "desc",
* "changeValue": { // 数据库字段转化显示,例如(0=否,1=是)
* username: {1: '是', 0: '否'}
* }
* }
*/
options
:
{
...
...
@@ -307,11 +310,26 @@
request
(
self
.
schema
.
modelUnderscorePlural
,
{
params
:
params
}).
then
(
resp
=>
{
if
(
self
.
options
.
changeValue
)
{
resp
.
data
=
self
.
changeValue
(
resp
.
data
)
}
self
.
list
=
resp
.
data
self
.
total
=
parseInt
(
resp
.
headers
.
total
)
self
.
listLoading
=
false
})
},
// 数据库字段转化显示,例如(0=否,1=是)
changeValue
(
data
)
{
const
self
=
this
_
.
map
(
data
,
function
(
item
,
index
)
{
_
.
forEach
(
item
,
function
(
listValue
,
listKey
)
{
if
(
self
.
options
.
changeValue
[
listKey
]
&&
self
.
options
.
changeValue
[
listKey
][
listValue
])
{
item
[
listKey
]
=
self
.
options
.
changeValue
[
listKey
][
listValue
]
}
})
})
return
data
},
// 添加一条数据
openDialog
(
type
,
data
)
{
const
self
=
this
...
...
src/views/haomo/components/tables/index.vue
View file @
5ba274b8
...
...
@@ -2,7 +2,8 @@
<div
class=
"app-container calendar-list-container"
>
<hm-complex-table
:schema=
"schema['HmUser']"
:columns=
"showUserColumns"
:filters=
"userFilters"
></hm-complex-table>
:filters=
"userFilters"
:options=
"userOptions"
></hm-complex-table>
</div>
</
template
>
...
...
@@ -31,6 +32,12 @@
},
created
()
{
this
.
schema
=
schema
this
.
userOptions
=
{
page_size
:
10
,
changeValue
:
{
username
:
{
1
:
'是'
,
0
:
'否'
}
}
}
},
methods
:
{}
}
...
...
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