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
72976fc9
Commit
72976fc9
authored
Apr 17, 2020
by
蒋勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d
parent
d0008eb6
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
225 additions
and
62 deletions
+225
-62
iview-admin/src/libs/util.js
+5
-0
iview-admin/src/store/index.js
+3
-1
iview-admin/src/store/module/app.js
+2
-1
iview-admin/src/store/module/meta.js
+6
-4
iview-admin/src/store/module/metainfo/dict.js
+13
-0
iview-admin/src/store/module/metainfo/userinfo.js
+60
-0
iview-admin/src/view/components/tables/forms/forms.vue
+128
-42
iview-admin/src/view/components/tables/tables.vue
+7
-14
iview-admin/vue.config.js
+1
-0
No files found.
iview-admin/src/libs/util.js
View file @
72976fc9
...
@@ -6,6 +6,11 @@ const { title, cookieExpires, useI18n } = config
...
@@ -6,6 +6,11 @@ const { title, cookieExpires, useI18n } = config
export
const
TOKEN_KEY
=
'token'
export
const
TOKEN_KEY
=
'token'
export
const
btnAuthFilter
=
(
metainfo
,
access
)
=>
{
console
.
log
(
"................................................."
,
metainfo
.
list
)
return
metainfo
}
export
const
setToken
=
(
token
)
=>
{
export
const
setToken
=
(
token
)
=>
{
Cookies
.
set
(
TOKEN_KEY
,
token
,
{
expires
:
cookieExpires
||
1
})
Cookies
.
set
(
TOKEN_KEY
,
token
,
{
expires
:
cookieExpires
||
1
})
}
}
...
...
iview-admin/src/store/index.js
View file @
72976fc9
...
@@ -3,6 +3,7 @@ import Vuex from 'vuex'
...
@@ -3,6 +3,7 @@ import Vuex from 'vuex'
import
user
from
'./module/user'
import
user
from
'./module/user'
import
app
from
'./module/app'
import
app
from
'./module/app'
import
meta
from
'./module/meta'
Vue
.
use
(
Vuex
)
Vue
.
use
(
Vuex
)
...
@@ -18,6 +19,7 @@ export default new Vuex.Store({
...
@@ -18,6 +19,7 @@ export default new Vuex.Store({
},
},
modules
:
{
modules
:
{
user
,
user
,
app
app
,
meta
}
}
})
})
iview-admin/src/store/module/app.js
View file @
72976fc9
import
{
import
{
btnAuthFilter
,
getBreadCrumbList
,
getBreadCrumbList
,
setTagNavListInLocalstorage
,
setTagNavListInLocalstorage
,
getMenuByRouter
,
getMenuByRouter
,
...
@@ -9,7 +10,7 @@ import {
...
@@ -9,7 +10,7 @@ import {
routeEqual
,
routeEqual
,
getRouteTitleHandled
,
getRouteTitleHandled
,
localSave
,
localSave
,
localRead
localRead
,
}
from
'@/libs/util'
}
from
'@/libs/util'
import
{
saveErrorLogger
}
from
'@/api/data'
import
{
saveErrorLogger
}
from
'@/api/data'
import
router
from
'@/router'
import
router
from
'@/router'
...
...
iview-admin/src/store/module/meta.js
View file @
72976fc9
import
{
setToken
,
getToken
}
from
'@/libs/util'
import
{
btnAuthFilter
,
setToken
,
getToken
}
from
'@/libs/util'
import
userinfo
from
"./metainfo/userinfo"
export
default
{
export
default
{
state
:
{
state
:
{
user_info
:
userinfo
,
dict_info
:
import
(
"./metainfo/dict"
)
},
},
mutations
:
{
mutations
:
{
setAvatar
(
state
,
avatarPath
)
{
setAvatar
(
state
,
avatarPath
)
{
state
.
avatarImgPath
=
avatarPath
state
.
avatarImgPath
=
avatarPath
},
},
},
},
getters
:
{
getters
:
{
messageUnreadCount
:
state
=>
state
.
messageUnreadList
.
length
,
user_info
:
(
state
,
getters
,
{
user
})
=>
btnAuthFilter
(
state
.
user_info
,
user
),
//定义一个函数添加权限控制逻辑
dict_info
:
state
=>
state
.
dict_info
},
},
actions
:
{
actions
:
{
// 登录
// 登录
...
...
iview-admin/src/store/module/metainfo/dict.js
0 → 100644
View file @
72976fc9
export
default
{
"app_type"
:
{
"api"
:
"API服务"
,
"web"
:
"PCWEB"
,
"app"
:
"移动APP"
,
"xcx"
:
"小程序"
,
"access"
:
"接入"
},
"data_priv"
:
{
"auth.role"
:
"角色"
,
"auth.user"
:
"用户"
},
"noticeType"
:
{
"sms"
:
"短信"
,
"email"
:
"邮件"
,
"wechat"
:
"微信"
},
"authType"
:
{
"add"
:
"新增"
,
"edit"
:
"编辑"
,
"delete"
:
"删除"
,
"export"
:
"导出"
,
"show"
:
"查看"
},
"opstatus"
:
{
"0"
:
"失败"
,
"1"
:
"成功"
},
"sex"
:
{
"male"
:
"男"
,
"female"
:
"女"
},
"configType"
:
{
"price"
:
"宝币兑换率"
,
"initGift"
:
"初次赠送"
,
"apiInitGift"
:
"API初次赠送"
,
"apiCallPrice"
:
"api调用价格"
},
"logLevel"
:
{
"debug"
:
0
,
"info"
:
1
,
"warn"
:
2
,
"error"
:
3
,
"fatal"
:
4
},
"msgType"
:
{
"sys"
:
"系统"
,
"single"
:
"单点"
,
"multi"
:
"群发"
},
"node_type"
:{
"org"
:
"组织"
,
"arc"
:
"文档"
}
}
\ No newline at end of file
iview-admin/src/store/module/metainfo/userinfo.js
0 → 100644
View file @
72976fc9
export
default
{
list
:
[
{
title
:
'Name'
,
key
:
'name'
,
sortable
:
true
},
{
title
:
'Email'
,
key
:
'email'
,
editable
:
true
},
{
title
:
'Create-Time'
,
key
:
'createTime'
},
{
title
:
'Handle'
,
key
:
'handle'
,
button
:
[
//这个数组中内容,需要按照权限字符串,在服务端构造
{
title
:
"删除"
,
type
:
"text"
,
icon
:
"md-trash"
,
key
:
"delete"
},
{
title
:
"编辑"
,
type
:
"text"
,
icon
:
""
,
key
:
"edit"
},
{
title
:
"启用"
,
type
:
"text"
,
icon
:
""
,
key
:
"enable"
},
]
}
],
"form"
:[
{
"title"
:
"控制信息"
,
ctls
:[
{
"type"
:
"switch"
,
"prop"
:
"isAdmin"
,
"acText"
:
"是管理员"
,
"inactText"
:
"否"
,
"placeHolder"
:
"请输入单次使用消耗的宝币数"
,
"style"
:
""
},
// {"type":"select","refModel":"pmproduct","isMulti":false,"label":"所属产品","prop":"pmproduct_id","labelField":"name","valueField":"id","style":""},
]
},
{
"title"
:
"基本信息"
,
ctls
:[
{
"type"
:
"input"
,
"label"
:
"账号"
,
"prop"
:
"userName"
,
"placeHolder"
:
"登录账号"
,
"style"
:
""
,
rules
:[
{
"required"
:
true
,
"message"
:
' '
,
"trigger"
:
'blur'
},]},
{
"type"
:
"input"
,
"label"
:
"昵称"
,
"prop"
:
"nickName"
,
"placeHolder"
:
"昵称"
,
"style"
:
""
,
rules
:[
{
"required"
:
true
,
"message"
:
' '
,
"trigger"
:
'blur'
},]},
{
"type"
:
"input"
,
"label"
:
"电话"
,
"prop"
:
"mobile"
,
"placeHolder"
:
"请输入电话"
,
"style"
:
""
,
rules
:[
{
"validator"
:
"validatex"
,
"trigger"
:
'blur'
},{
"required"
:
true
,
"message"
:
' '
,
"trigger"
:
'blur'
},]},
// {"type":"select","refModel":"auth.role","isMulti":true,"label":"角色","prop":"roles","labelField":"name","valueField":"id","style":""},
]
}
],
"search"
:[
{
"title"
:
"基本查询"
,
ctls
:[
{
"type"
:
"input"
,
"label"
:
"昵称"
,
"prop"
:
"nickName"
,
"placeHolder"
:
"请输入昵称"
,
"style"
:
""
},
]
},
],
"auth"
:{
"add"
:[
{
"icon"
:
"el-icon-plus"
,
"title"
:
"新增"
,
"type"
:
"default"
,
"key"
:
"new"
,
"isOnGrid"
:
true
},
{
"icon"
:
"el-icon-save"
,
"title"
:
"保存"
,
"type"
:
"default"
,
"key"
:
"save"
,
"isOnForm"
:
true
},
],
"edit"
:[
{
"icon"
:
"el-icon-edit"
,
"title"
:
"修改"
,
"type"
:
"default"
,
"key"
:
"edit"
,
"isInRow"
:
true
},
],
"delete"
:[
{
"icon"
:
"el-icon-remove"
,
"title"
:
"删除"
,
"type"
:
"default"
,
"key"
:
"delete"
,
"isInRow"
:
true
},
{
"icon"
:
"el-icon-edit"
,
"title"
:
"停用"
,
"type"
:
"default"
,
"key"
:
"stopUser"
,
"isInRow"
:
true
,
"boolProp"
:
"isEnabled"
,
"falseText"
:
"启用"
},
],
"common"
:[
{
"icon"
:
"el-icon-cancel"
,
"title"
:
"取消"
,
"type"
:
"default"
,
"key"
:
"cancel"
,
"isOnForm"
:
true
},
],
}
}
\ No newline at end of file
iview-admin/src/view/components/tables/forms/forms.vue
View file @
72976fc9
<
template
>
<
template
>
<div>
<div>
<Card>
<Card>
<Form
ref=
"formInline"
:model=
"formInline"
:rules=
"ruleInline"
inline
>
<div></div>
<FormItem
prop=
"user"
>
<Form
ref=
"formInline"
:model=
"formdata"
:rules=
"ruleInline"
>
<Input
type=
"text"
v-model=
"formInline.user"
placeholder=
"Username"
>
<template
v-for=
"group in forminfo"
>
<Icon
type=
"ios-person-outline"
slot=
"prepend"
></Icon>
<Divider
orientation=
"left"
:key=
"group.title"
>
{{
group
.
title
}}
</Divider>
</Input>
<Row
:key=
"'r'+group.title"
>
</FormItem>
<Col
:xs=
"2"
:sm=
"4"
:md=
"6"
:lg=
"8"
v-for=
"ctl in group.ctls"
:key=
"ctl.prop"
>
<FormItem
prop=
"password"
>
<FormItem
:label=
"ctl.label"
></FormItem>
<Input
type=
"password"
v-model=
"formInline.password"
placeholder=
"Password"
>
</Col>
<Icon
type=
"ios-lock-outline"
slot=
"prepend"
></Icon>
</Row>
</Input>
</
template
>
</FormItem>
</Form>
<FormItem>
<Button
type=
"primary"
@
click=
"handleSubmit('formInline')"
>
Signin
</Button>
</FormItem>
</Form>
</Card>
</Card>
</div>
</div>
</template>
</template>
<
script
>
<
script
>
// import { getTableData } from '@/api/data'
// import { getTableData } from '@/api/data'
export
default
{
export
default
{
name
:
'forms'
,
name
:
"forms"
,
components
:
{
components
:
{},
props
:
{
fminfo
:
{
type
:
Array
,
default
()
{
return
[];
}
},
refvalidatemethod
:{
type
:
Function
,
default
(){
return
(
rule
,
value
,
callback
)
=>
{
return
callback
()
}
}
}
},
},
data
()
{
data
()
{
return
{
return
{
columns
:
[
forminfo
:
[
{
title
:
'Name'
,
key
:
'name'
,
sortable
:
true
},
{
title
:
'Email'
,
key
:
'email'
,
editable
:
true
},
{
title
:
'Create-Time'
,
key
:
'createTime'
},
{
{
title
:
'Handle'
,
title
:
"控制信息"
,
key
:
'handle'
,
col
:
3
,
options
:
[
'delete'
],
ctls
:
[
button
:
[
{
{
title
:
"编辑"
,
type
:
"text"
,
icon
:
""
,
key
:
"edit"
},
type
:
"switch"
,
{
title
:
"启用"
,
type
:
"text"
,
icon
:
""
,
key
:
"enable"
},
prop
:
"isAdmin"
,
acText
:
"是管理员"
,
inactText
:
"否"
,
placeHolder
:
"请输入单次使用消耗的宝币数"
,
style
:
""
}
// {"type":"select","refModel":"pmproduct","isMulti":false,"label":"所属产品","prop":"pmproduct_id","labelField":"name","valueField":"id","style":""},
]
]
}
},
{
title
:
"基本信息"
,
col
:
3
,
ctls
:
[
{
type
:
"input"
,
label
:
"账号"
,
prop
:
"userName"
,
placeHolder
:
"登录账号"
,
style
:
""
,
rules
:
[{
required
:
true
,
message
:
" "
,
trigger
:
"blur"
}]
},
{
type
:
"input"
,
label
:
"昵称"
,
prop
:
"nickName"
,
placeHolder
:
"昵称"
,
style
:
""
,
rules
:
[{
required
:
true
,
message
:
" "
,
trigger
:
"blur"
}]
},
{
type
:
"input"
,
label
:
"电话"
,
prop
:
"mobile"
,
placeHolder
:
"请输入电话"
,
style
:
""
,
rules
:
[
{
validator
:
"validatex"
,
trigger
:
"blur"
},
{
required
:
true
,
message
:
" "
,
trigger
:
"blur"
}
]
}
// {"type":"select","refModel":"auth.role","isMulti":true,"label":"角色","prop":"roles","labelField":"name","valueField":"id","style":""},
]
}
],
],
tableData
:
[]
formModel
:
{},
metaRules
:{},
btninfos
:
[]
};
},
watch
:
{
fminfo
(
nf
,
of
)
{
this
.
forminfo
=
nf
;
this
.
forminfo
.
forEach
(
m
=>
{
if
(
!
m
||
!
m
.
ctls
)
{
return
;
}
m
.
ctls
.
forEach
(
ctl
=>
{
// this.$set(this.ctlVisable, ctl.prop, true);
if
(
ctl
.
rules
)
{
ctl
.
rules
.
forEach
(
r
=>
{
if
(
r
.
validator
)
{
r
.
validator
=
self
[
r
.
validator
];
}
});
this
.
metaRules
[
ctl
.
prop
]
=
ctl
.
rules
;
}
if
(
ctl
.
type
==
"select"
)
{
this
.
$set
(
this
.
formModel
,
ctl
.
prop
,
[]);
}
else
{
console
.
log
(
ctl
.
prop
);
if
(
ctl
.
type
==
"number"
)
{
this
.
$set
(
this
.
formModel
,
ctl
.
prop
,
0
);
}
else
{
this
.
$set
(
this
.
formModel
,
ctl
.
prop
,
""
);
}
}
});
});
}
}
},
},
methods
:
{
methods
:
{
handleDelete
(
params
)
{
handleDelete
(
params
)
{
console
.
log
(
params
)
console
.
log
(
params
)
;
},
},
exportExcel
()
{
exportExcel
()
{
this
.
$refs
.
tables
.
exportCsv
({
this
.
$refs
.
tables
.
exportCsv
({
filename
:
`table-
${(
new
Date
()).
valueOf
()}
.csv`
filename
:
`table-
${
new
Date
().
valueOf
()}
.csv`
})
});
}
},
validatex
(
rule
,
value
,
callback
){
if
(
this
.
refvalidatemethod
){
return
this
.
refvalidatemethod
(
rule
,
value
,
callback
);
}
else
{
return
callback
();
}
},
},
},
mounted
()
{
mounted
()
{
getTableData
().
then
(
res
=>
{
getTableData
().
then
(
res
=>
{
this
.
tableData
=
res
.
data
this
.
tableData
=
res
.
data
;
})
})
;
}
}
}
}
;
</
script
>
</
script
>
<
style
>
<
style
>
</
style
>
</
style
>
iview-admin/src/view/components/tables/tables.vue
View file @
72976fc9
...
@@ -15,22 +15,15 @@ export default {
...
@@ -15,22 +15,15 @@ export default {
components
:
{
components
:
{
Tables
Tables
},
},
props
:{
metaName
:
String
,
default
:
"user_info"
},
data
()
{
data
()
{
this
.
metaName
=
"user_info"
return
{
return
{
columns
:
[
{
title
:
'Name'
,
key
:
'name'
,
sortable
:
true
},
columns
:
this
.
metaName
?
this
.
$store
.
getters
[
this
.
metaName
][
"list"
]:[],
{
title
:
'Email'
,
key
:
'email'
,
editable
:
true
},
{
title
:
'Create-Time'
,
key
:
'createTime'
},
{
title
:
'Handle'
,
key
:
'handle'
,
button
:
[
//这个数组中内容,需要按照权限字符串,在服务端构造
{
title
:
"删除"
,
type
:
"text"
,
icon
:
"md-trash"
,
key
:
"delete"
},
{
title
:
"编辑"
,
type
:
"text"
,
icon
:
""
,
key
:
"edit"
},
{
title
:
"启用"
,
type
:
"text"
,
icon
:
""
,
key
:
"enable"
},
]
}
],
tableData
:
[]
tableData
:
[]
}
}
},
},
...
...
iview-admin/vue.config.js
View file @
72976fc9
...
@@ -40,4 +40,5 @@ module.exports = {
...
@@ -40,4 +40,5 @@ module.exports = {
// devServer: {
// devServer: {
// proxy: 'localhost:3000'
// proxy: 'localhost:3000'
// }
// }
}
}
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