Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
a4b89b0b
Commit
a4b89b0b
authored
Apr 20, 2020
by
蒋勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d
parent
56837163
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
95 additions
and
40 deletions
+95
-40
iview-admin/src/components/tables/tables.vue
+18
-10
iview-admin/src/libs/util.js
+17
-2
iview-admin/src/store/module/metainfo/userinfo.js
+5
-4
iview-admin/src/view/components/tables/forms/childs/rediogroups.vue
+1
-1
iview-admin/src/view/components/tables/tables.vue
+54
-23
No files found.
iview-admin/src/components/tables/tables.vue
View file @
a4b89b0b
...
@@ -2,8 +2,8 @@
...
@@ -2,8 +2,8 @@
<div>
<div>
<div
v-if=
"searchable && searchPlace === 'top'"
class=
"search-con search-con-top"
>
<div
v-if=
"searchable && searchPlace === 'top'"
class=
"search-con search-con-top"
>
<Select
v-model=
"searchKey"
class=
"search-col"
>
<Select
v-model=
"searchKey"
class=
"search-col"
>
<Option
<Option
v-for=
"item in
columns"
v-for=
"item in
searchcols"
v-if=
"item.key !== 'handle'"
v-if=
"item.key !== 'handle'"
:value=
"item.key"
:value=
"item.key"
:key=
"`search-col-$
{item.key}`"
:key=
"`search-col-$
{item.key}`"
...
@@ -54,7 +54,7 @@
...
@@ -54,7 +54,7 @@
<div
v-if=
"searchable && searchPlace === 'bottom'"
class=
"search-con search-con-top"
>
<div
v-if=
"searchable && searchPlace === 'bottom'"
class=
"search-con search-con-top"
>
<Select
v-model=
"searchKey"
class=
"search-col"
>
<Select
v-model=
"searchKey"
class=
"search-col"
>
<Option
<Option
v-for=
"item in
column
s"
v-for=
"item in
searchcol
s"
v-if=
"item.key !== 'handle'"
v-if=
"item.key !== 'handle'"
:value=
"item.key"
:value=
"item.key"
:key=
"`search-col-$
{item.key}`"
:key=
"`search-col-$
{item.key}`"
...
@@ -271,19 +271,22 @@ export default {
...
@@ -271,19 +271,22 @@ export default {
},
},
setDefaultSearchKey
()
{
setDefaultSearchKey
()
{
this
.
searchKey
=
this
.
searchKey
=
this
.
column
s
[
0
].
key
!==
"handle"
this
.
searchcol
s
[
0
].
key
!==
"handle"
?
this
.
column
s
[
0
].
key
?
this
.
searchcol
s
[
0
].
key
:
this
.
column
s
.
length
>
1
:
this
.
searchcol
s
.
length
>
1
?
this
.
column
s
[
1
].
key
?
this
.
searchcol
s
[
1
].
key
:
""
;
:
""
;
},
},
handleClear
(
e
)
{
handleClear
(
e
)
{
if
(
e
.
target
.
value
===
""
)
this
.
insideTableData
=
this
.
value
;
if
(
e
.
target
.
value
===
""
)
this
.
insideTableData
=
this
.
value
;
},
},
handleSearch
()
{
handleSearch
()
{
this
.
insideTableData
=
this
.
value
.
filter
(
// this.insideTableData = this.value.filter(
item
=>
item
[
this
.
searchKey
].
indexOf
(
this
.
searchValue
)
>
-
1
// item => item[this.searchKey].indexOf(this.searchValue) > -1
);
// );
let
eobj
=
{};
eobj
[
this
.
searchKey
]
=
this
.
searchValue
this
.
$emit
(
"on-rapid-query"
,
eobj
)
},
},
handleTableData
()
{
handleTableData
()
{
this
.
insideTableData
=
this
.
value
.
map
((
item
,
index
)
=>
{
this
.
insideTableData
=
this
.
value
.
map
((
item
,
index
)
=>
{
...
@@ -343,6 +346,11 @@ export default {
...
@@ -343,6 +346,11 @@ export default {
this
.
handleColumns
(
this
.
columns
);
this
.
handleColumns
(
this
.
columns
);
this
.
setDefaultSearchKey
();
this
.
setDefaultSearchKey
();
this
.
handleTableData
();
this
.
handleTableData
();
},
computed
:{
searchcols
:
function
(){
return
this
.
columns
?
this
.
columns
.
filter
(
item
=>
item
.
insearch
):[]
}
}
}
};
};
</
script
>
</
script
>
iview-admin/src/libs/util.js
View file @
a4b89b0b
...
@@ -6,8 +6,23 @@ const { title, cookieExpires, useI18n } = config
...
@@ -6,8 +6,23 @@ const { title, cookieExpires, useI18n } = config
export
const
TOKEN_KEY
=
'token'
export
const
TOKEN_KEY
=
'token'
export
const
btnAuthFilter
=
(
metainfo
,
access
)
=>
{
export
const
btnAuthFilter
=
(
metainfo
,
user
)
=>
{
console
.
log
(
"................................................."
,
metainfo
.
list
)
// console.log(".................................................",metainfo.list)
// let authbtns=[]
// let keyswithauth=Object.keys(metainfo.auths).filter(authname=>{
// let hasAuth=user.access.some(authitem=>{
// return authitem.auths.indexOf(authname)>=0
// })
// return hasAuth
// })
// if(keyswithauth){
// keyswithauth.forEach(k=>{
// metainfo.auths[k].forEach(bt=>{
// authbtns.push(bt)
// })
// })
// }
// metainfo.auths=authbtns
return
metainfo
return
metainfo
}
}
...
...
iview-admin/src/store/module/metainfo/userinfo.js
View file @
a4b89b0b
export
default
{
export
default
{
bizCode
:
"userinfo"
,
name
:
"用户信息维护"
,
name
:
"用户信息维护"
,
list
:
[
list
:
[
{
title
:
'
Name'
,
key
:
'name'
,
sortable
:
true
},
{
title
:
'
姓名'
,
key
:
'name'
,
sortable
:
true
,
insearch
:
true
},
{
title
:
'
Email'
,
key
:
'email'
,
editable
:
true
},
{
title
:
'
邮件'
,
key
:
'email'
,
editable
:
true
,
insearch
:
true
},
{
title
:
'
Create-Time
'
,
key
:
'createTime'
},
{
title
:
'
创建时间
'
,
key
:
'createTime'
},
{
{
title
:
'Handle'
,
title
:
'Handle'
,
key
:
'handle'
,
key
:
'handle'
,
...
@@ -48,7 +49,7 @@ export default {
...
@@ -48,7 +49,7 @@ export default {
]
]
},
},
],
],
"auth"
:{
"auth
s
"
:{
"add"
:[
"add"
:[
{
"icon"
:
"el-icon-plus"
,
"title"
:
"新增"
,
"type"
:
"default"
,
"key"
:
"new"
,
"isOnGrid"
:
true
},
{
"icon"
:
"el-icon-plus"
,
"title"
:
"新增"
,
"type"
:
"default"
,
"key"
:
"new"
,
"isOnGrid"
:
true
},
{
"icon"
:
"el-icon-save"
,
"title"
:
"保存"
,
"type"
:
"default"
,
"key"
:
"save"
,
"isOnForm"
:
true
},
{
"icon"
:
"el-icon-save"
,
"title"
:
"保存"
,
"type"
:
"default"
,
"key"
:
"save"
,
"isOnForm"
:
true
},
...
...
iview-admin/src/view/components/tables/forms/childs/rediogroups.vue
View file @
a4b89b0b
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
<
script
>
<
script
>
import
{
refQuery
}
from
"@/api/meta"
;
import
{
refQuery
}
from
"@/api/meta"
;
export
default
{
export
default
{
name
:
"r
e
diogroups"
,
name
:
"r
a
diogroups"
,
components
:
{},
components
:
{},
model
:
{
model
:
{
prop
:
"value"
,
prop
:
"value"
,
...
...
iview-admin/src/view/components/tables/tables.vue
View file @
a4b89b0b
<
template
>
<
template
>
<div>
<div>
<Card>
<Card>
<tables
ref=
"tables"
editable
searchable
search-place=
"top"
v-model=
"tableData"
:columns=
"columns"
@
on-exec=
"doexec"
/>
<tables
ref=
"tables"
editable
searchable
search-place=
"top"
v-model=
"tableData"
:columns=
"columns"
@
on-rapid-query=
"doquery"
@
on-exec=
"doexec"
/>
<Button
style=
"margin: 10px 0;"
type=
"primary"
@
click=
"exportExcel"
>
导出为Csv文件
</Button>
<Button
style=
"margin: 10px 0;"
type=
"primary"
@
click=
"exportExcel"
>
导出为Csv文件
</Button>
<Forms
:fminfo=
"forminfo"
></Forms>
<Forms
:fminfo=
"forminfo"
></Forms>
</Card>
</Card>
...
@@ -9,45 +18,67 @@
...
@@ -9,45 +18,67 @@
</
template
>
</
template
>
<
script
>
<
script
>
import
Tables
from
'_c/tables'
import
Tables
from
"_c/tables"
;
import
Forms
from
'./forms/forms'
import
Forms
from
"./forms/forms"
;
import
{
getTableData
}
from
'@/api/data'
import
{
getTableData
}
from
"@/api/data"
;
export
default
{
export
default
{
name
:
'tables_page'
,
name
:
"tables_page"
,
components
:
{
components
:
{
Tables
,
Tables
,
Forms
Forms
},
},
props
:{
props
:
{
metaName
:
String
,
metaName
:
String
,
default
:
"user_info"
default
:
"user_info"
},
},
data
()
{
data
()
{
this
.
metaName
=
"user_info"
this
.
metaName
=
"user_info"
;
return
{
return
{
forminfo
:
this
.
metaName
?
this
.
$store
.
getters
[
this
.
metaName
][
"form"
]:{},
forminfo
:
this
.
metaName
?
this
.
$store
.
getters
[
this
.
metaName
][
"form"
]
:
{},
columns
:
this
.
metaName
?
this
.
$store
.
getters
[
this
.
metaName
][
"list"
]:[],
columns
:
this
.
metaName
?
this
.
$store
.
getters
[
this
.
metaName
][
"list"
]
:
[],
authbtns
:
this
.
metaName
?
this
.
$store
.
getters
[
this
.
metaName
][
"auths"
]
:
[],
tableData
:
[]
tableData
:
[]
}
}
;
},
},
methods
:
{
methods
:
{
doexec
(
key
,
row
)
{
doexec
(
key
,
row
)
{
console
.
log
(
key
,
row
)
console
.
log
(
key
,
row
);
},
doquery
(
q
)
{
console
.
log
(
q
);
},
},
exportExcel
()
{
exportExcel
()
{
this
.
$refs
.
tables
.
exportCsv
({
this
.
$refs
.
tables
.
exportCsv
({
filename
:
`table-
${
(
new
Date
()
).
valueOf
()}
.csv`
filename
:
`table-
${
new
Date
(
).
valueOf
()}
.csv`
})
})
;
}
}
},
},
mounted
()
{
mounted
()
{
getTableData
().
then
(
res
=>
{
getTableData
().
then
(
res
=>
{
this
.
tableData
=
res
.
data
this
.
tableData
=
res
.
data
;
})
});
},
computed
:
{
formbtns
()
{
return
this
.
authbtns
.
filter
(
bt
=>
{
return
bt
.
isOnForm
;
});
},
onlistbtns
()
{
return
this
.
authbtns
.
filter
(
bt
=>
{
return
bt
.
isOnGrid
;
});
},
inrowbtns
()
{
return
this
.
authbtns
.
filter
(
bt
=>
{
return
bt
.
isInRow
;
});
}
}
}
}
}
;
</
script
>
</
script
>
<
style
>
<
style
>
</
style
>
</
style
>
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