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
f864d724
Commit
f864d724
authored
Mar 08, 2018
by
杨柠瑞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
issues19 && issues4
parent
ba67cb5e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
17 deletions
+28
-17
HmComplexTable.vue
src/views/haomo/components/tables/HmComplexTable.vue
+17
-6
index.vue
src/views/haomo/components/tables/index.vue
+4
-4
hm_org_schema.js
src/views/haomo/schemas/hm_org_schema.js
+7
-7
No files found.
src/views/haomo/components/tables/HmComplexTable.vue
View file @
f864d724
...
...
@@ -21,6 +21,7 @@
<!-- 表格 -->
<el-table
:data=
"list"
v-loading=
"listLoading"
element-loading-text=
"给我一点时间"
border
fit
highlight-current-row
style=
"width: 100%"
>
<el-table-column
type=
"index"
:index=
"indexMethod"
></el-table-column>
<el-table-column
v-for=
"(column,index) in showColumns"
:key=
"index"
align=
"center"
:label=
"column.name"
>
<template
slot-scope=
"scope"
>
<span>
{{
scope
.
row
[
column
.
code
]
}}
</span>
...
...
@@ -204,6 +205,9 @@
this
.
getList
()
},
methods
:
{
indexMethod
(
index
)
{
return
this
.
listQuery
.
page_size
*
(
this
.
listQuery
.
page_no
-
1
)
+
index
+
1
},
validate
()
{
const
self
=
this
// this.columns数组元素本身必须是string或者object. 且必须是schema中定义的列
...
...
@@ -234,24 +238,18 @@
self
.
$set
(
tmp
,
'code'
,
tmp
.
code
.
toLowerCase
())
self
.
showColumns
.
push
(
tmp
)
})
console
.
log
(
self
.
showColumns
)
}
else
{
self
.
showColumns
=
JSON
.
parse
(
JSON
.
stringify
(
self
.
columns
))
console
.
log
(
'1111111'
)
console
.
log
(
self
.
showColumns
)
// 将字符串对象进行替换处理
_
.
each
(
self
.
showColumns
,
function
(
column
,
index
)
{
if
(
typeof
column
===
'string'
)
{
// const tmp = _.keyBy(self.schema['columns'], 'code')[column.toUpperCase()]
// 王康 修改 2018年02月25日22:58:23
const
tmp
=
_
.
keyBy
(
self
.
schema
[
'columns'
],
'codeCamel'
)[
column
]
console
.
log
(
tmp
)
self
.
$set
(
tmp
,
'code'
,
tmp
.
code
.
toLowerCase
())
self
.
$set
(
self
.
showColumns
,
index
,
tmp
)
}
})
console
.
log
(
'2222222'
)
console
.
log
(
self
.
showColumns
)
}
// 处理过滤条件
...
...
@@ -279,6 +277,7 @@
// 处理过滤条件
const
params
=
JSON
.
parse
(
JSON
.
stringify
(
self
.
listQuery
))
params
.
filters
=
self
.
filterParams
params
.
filters
=
this
.
deleteFilter
(
params
.
filters
)
request
(
self
.
schema
.
modelUnderscorePlural
,
{
params
:
params
...
...
@@ -288,6 +287,18 @@
self
.
listLoading
=
false
})
},
// 删除过滤条件为空的filter
deleteFilter
(
filters
)
{
const
newFilters
=
filters
_
.
forEach
(
newFilters
,
function
(
columns
,
columnsKey
)
{
_
.
forEach
(
newFilters
[
columnsKey
],
function
(
column
,
columnKey
)
{
if
(
columns
[
columnKey
][
Object
.
keys
(
column
)]
===
'%%'
||
columns
[
columnKey
][
Object
.
keys
(
column
)]
===
''
||
columns
[
columnKey
][
Object
.
keys
(
column
)]
===
null
)
{
delete
(
columns
[
columnKey
])
}
})
})
return
JSON
.
stringify
(
newFilters
[
Object
.
keys
(
newFilters
)])
===
'{}'
?
{}
:
newFilters
},
handleFilter
()
{
this
.
getList
()
},
...
...
src/views/haomo/components/tables/index.vue
View file @
f864d724
...
...
@@ -3,8 +3,8 @@
<hm-complex-table
:schema=
"schema['HmUser']"
:columns=
"showUserColumns"
:filters=
"userFilters"
></hm-complex-table>
<
hm-complex-table
:schema=
"schema['Department']"
></hm-complex-table
>
<
hm-complex-table
:schema=
"schema['Role']"
></hm-complex-table
>
<
!--
<hm-complex-table
:schema=
"schema['Department']"
></hm-complex-table>
--
>
<
!--
<hm-complex-table
:schema=
"schema['Role']"
></hm-complex-table>
--
>
</div>
</
template
>
...
...
@@ -22,10 +22,10 @@
},
data
()
{
return
{
showUserColumns
:
[
'mobile'
,
'loginid'
],
showUserColumns
:
[
'mobile'
,
'loginid'
,
'username'
,
'email'
],
userFilters
:
[
{
placeholder
:
'过滤手机号'
,
'mobile'
:
{
'like'
:
''
}},
{
placeholder
:
'过滤
登录Id'
,
'loginid'
:
{
'like'
:
'3001
'
}}
{
placeholder
:
'过滤
用户名'
,
'username'
:
{
'equalTo'
:
'
'
}}
]
}
},
...
...
src/views/haomo/schemas/hm_org_schema.js
View file @
f864d724
...
...
@@ -2872,13 +2872,13 @@ const ModelSchema = {
}
]
},
'HmUser
2
'
:
{
'model'
:
'HmUser
2
'
,
'modelPlural'
:
'HmUser
2S
'
,
'modelCamel'
:
'hmUser
2
'
,
'modelCamelPlural'
:
'hmUser
2S
'
,
'modelUnderscore'
:
'hm_user
2
'
,
'modelUnderscorePlural'
:
'hm_user
2S
'
,
'HmUser'
:
{
'model'
:
'HmUser'
,
'modelPlural'
:
'HmUser
s
'
,
'modelCamel'
:
'hmUser'
,
'modelCamelPlural'
:
'hmUser
s
'
,
'modelUnderscore'
:
'hm_user'
,
'modelUnderscorePlural'
:
'hm_user
s
'
,
'columns'
:
[
{
'id'
:
'o329'
,
...
...
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