Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx-web
/
authority
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 377b7b15
authored
Sep 17, 2018
by
胡悦
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
完成删除选中
2 parents
8c46f021
4f5c5db0
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
151 additions
and
158 deletions
src/api/api.js
src/api/roleApi.js
src/api/userApi.js
src/base.js
src/common/common.js → src/common/commonConst.js
src/common/roleCommon.js → src/common/roleConst.js
src/common/userCommon.js → src/common/userConst.js
src/components/RoleCreate/src/main.vue
src/config/common.conf.js
src/time.js
src/views/customer/role/index.vue
src/views/customer/user/index.vue
src/api/api.js
View file @
377b7b1
import
{
import
{
roleTest
,
deleteRoleById
,
deleteRoleById
,
deleteUserRoleById
,
deleteUserRoleById
,
getRoleDetail
,
getRoleDetail
,
getRoleList
,
getRoleList
,
isRoleNameExit
,
//
isRoleNameExit,
addRole
,
saveRoleList
,
selectMenuTreeRoleId
,
selectMenuTreeRoleId
,
selectUserRoleByRoleId
,
selectUserRoleByRoleId
,
updateRole
updateRole
}
from
'./roleApi'
}
from
'./roleApi'
import
{
import
{
getUser
,
batcheDelUser
,
batcheDelUser
,
find
UserList
,
find
All
,
getUser
Info
,
getUser
,
getWithRoles
,
getWithRoles
,
operatUser
,
operatUser
,
updateUser
updateUser
...
@@ -41,21 +39,19 @@ import {
...
@@ -41,21 +39,19 @@ import {
export
{
export
{
// role接口
// role接口
roleTest
,
deleteRoleById
,
deleteRoleById
,
deleteUserRoleById
,
deleteUserRoleById
,
getRoleDetail
,
getRoleDetail
,
getRoleList
,
getRoleList
,
isRoleNameExit
,
//
isRoleNameExit,
addRole
,
saveRoleList
,
selectMenuTreeRoleId
,
selectMenuTreeRoleId
,
selectUserRoleByRoleId
,
selectUserRoleByRoleId
,
updateRole
,
updateRole
,
// user接口
// user接口
getUser
,
batcheDelUser
,
batcheDelUser
,
find
UserList
,
find
All
,
getUser
Info
,
getUser
,
getWithRoles
,
getWithRoles
,
operatUser
,
operatUser
,
updateUser
,
updateUser
,
...
...
src/api/roleApi.js
View file @
377b7b1
...
@@ -2,22 +2,16 @@ import {
...
@@ -2,22 +2,16 @@ import {
GlAxios
GlAxios
}
from
'glsx-vue-common'
}
from
'glsx-vue-common'
const
path
=
'role'
const
path
=
'role'
const
__sTest
=
`
${
path
}
/roleList`
const
__sDeleteRole
=
`
${
path
}
/deleteRoleById`
const
__sDeleteRole
=
`
${
path
}
/deleteRoleById`
const
__sDeleteUserRole
=
`
${
path
}
/deleteUserRoleById`
const
__sDeleteUserRole
=
`
${
path
}
/deleteUserRoleById`
const
__sGetRoleDetail
=
`
${
path
}
/getRoleDetail`
const
__sGetRoleDetail
=
`
${
path
}
/getRoleDetail`
const
__sGetRoleList
=
`
${
path
}
/getRoleList`
const
__sGetRoleList
=
`
${
path
}
/getRoleList`
const
__sIsRoleNameExit
=
`
${
path
}
/isRoleNameExit`
//
const __sIsRoleNameExit = `${path}/isRoleNameExit`
const
__s
AddRole
=
`
${
path
}
/saveRoleList`
const
__s
SaveRoleList
=
`
${
path
}
/saveRoleList`
const
__sSelectMenuTreeRoleId
=
`
${
path
}
/selectMenuTreeRoleId`
const
__sSelectMenuTreeRoleId
=
`
${
path
}
/selectMenuTreeRoleId`
const
__sSelectUserRole
=
`
${
path
}
/selectUserRoleByRoleId`
const
__sSelectUserRole
=
`
${
path
}
/selectUserRoleByRoleId`
const
__sUpdateRole
=
`
${
path
}
/updateRole`
const
__sUpdateRole
=
`
${
path
}
/updateRole`
const
roleTest
=
{
p
:
[
__sTest
],
req
:
params
=>
GlAxios
.
post
(
__sTest
,
params
)
}
const
deleteRoleById
=
{
const
deleteRoleById
=
{
p
:
[
__sDeleteRole
],
p
:
[
__sDeleteRole
],
req
:
params
=>
GlAxios
.
post
(
__sDeleteRole
,
params
)
req
:
params
=>
GlAxios
.
post
(
__sDeleteRole
,
params
)
...
@@ -38,15 +32,16 @@ const getRoleList = {
...
@@ -38,15 +32,16 @@ const getRoleList = {
req
:
params
=>
GlAxios
.
get
(
__sGetRoleList
,
{
params
})
req
:
params
=>
GlAxios
.
get
(
__sGetRoleList
,
{
params
})
}
}
const
isRoleNameExit
=
{
//
const isRoleNameExit = {
p
:
[
__sIsRoleNameExit
],
//
p: [__sIsRoleNameExit],
req
:
params
=>
GlAxios
.
get
(
__sIsRoleNameExit
,
{
params
})
//
req: params => GlAxios.get(__sIsRoleNameExit, { params })
}
//
}
const
addRole
=
{
const
saveRoleList
=
{
p
:
[
__s
AddRole
],
p
:
[
__s
SaveRoleList
],
req
:
params
=>
GlAxios
.
post
(
__s
AddRole
,
params
)
req
:
params
=>
GlAxios
.
post
(
__s
SaveRoleList
,
params
)
}
}
const
selectMenuTreeRoleId
=
{
const
selectMenuTreeRoleId
=
{
p
:
[
__sSelectMenuTreeRoleId
],
p
:
[
__sSelectMenuTreeRoleId
],
req
:
params
=>
GlAxios
.
get
(
__sSelectMenuTreeRoleId
,
{
params
})
req
:
params
=>
GlAxios
.
get
(
__sSelectMenuTreeRoleId
,
{
params
})
...
@@ -63,13 +58,12 @@ const updateRole = {
...
@@ -63,13 +58,12 @@ const updateRole = {
}
}
export
{
export
{
roleTest
,
deleteRoleById
,
deleteRoleById
,
deleteUserRoleById
,
deleteUserRoleById
,
getRoleDetail
,
getRoleDetail
,
getRoleList
,
getRoleList
,
isRoleNameExit
,
//
isRoleNameExit,
addRole
,
saveRoleList
,
selectMenuTreeRoleId
,
selectMenuTreeRoleId
,
selectUserRoleByRoleId
,
selectUserRoleByRoleId
,
updateRole
updateRole
...
...
src/api/userApi.js
View file @
377b7b1
...
@@ -2,7 +2,6 @@ import {
...
@@ -2,7 +2,6 @@ import {
GlAxios
GlAxios
}
from
'glsx-vue-common'
}
from
'glsx-vue-common'
const
path
=
'user'
const
path
=
'user'
const
__sUserTest
=
`role/userList`
const
__sBatcheDel
=
`
${
path
}
/batcheDel`
const
__sBatcheDel
=
`
${
path
}
/batcheDel`
const
__sFindAll
=
`
${
path
}
/findAll`
const
__sFindAll
=
`
${
path
}
/findAll`
const
__sGet
=
`
${
path
}
/get`
const
__sGet
=
`
${
path
}
/get`
...
@@ -10,22 +9,17 @@ const __sGetWithRoles = `${path}/getWithRoles`
...
@@ -10,22 +9,17 @@ const __sGetWithRoles = `${path}/getWithRoles`
const
__sOperatUser
=
`
${
path
}
/operatUser`
const
__sOperatUser
=
`
${
path
}
/operatUser`
const
__sUpdateUser
=
`
${
path
}
/updateUser`
const
__sUpdateUser
=
`
${
path
}
/updateUser`
const
getUser
=
{
p
:
[
__sUserTest
],
req
:
params
=>
GlAxios
.
post
(
__sUserTest
,
params
)
}
const
batcheDelUser
=
{
const
batcheDelUser
=
{
p
:
[
__sBatcheDel
],
p
:
[
__sBatcheDel
],
req
:
params
=>
GlAxios
.
post
(
__sBatcheDel
,
params
)
req
:
params
=>
GlAxios
.
post
(
__sBatcheDel
,
params
)
}
}
const
find
UserList
=
{
const
find
All
=
{
p
:
[
__sFindAll
],
p
:
[
__sFindAll
],
req
:
params
=>
GlAxios
.
get
(
__sFindAll
,
{
params
})
req
:
params
=>
GlAxios
.
get
(
__sFindAll
,
{
params
})
}
}
const
getUser
Info
=
{
const
getUser
=
{
p
:
[
__sGet
],
p
:
[
__sGet
],
req
:
params
=>
GlAxios
.
get
(
__sGet
,
{
params
})
req
:
params
=>
GlAxios
.
get
(
__sGet
,
{
params
})
}
}
...
@@ -46,10 +40,9 @@ const updateUser = {
...
@@ -46,10 +40,9 @@ const updateUser = {
}
}
export
{
export
{
getUser
,
batcheDelUser
,
batcheDelUser
,
find
UserList
,
find
All
,
getUser
Info
,
getUser
,
getWithRoles
,
getWithRoles
,
operatUser
,
operatUser
,
updateUser
updateUser
...
...
src/base.js
View file @
377b7b1
...
@@ -7,7 +7,6 @@ import GlsxVueCommon from 'glsx-vue-common'
...
@@ -7,7 +7,6 @@ import GlsxVueCommon from 'glsx-vue-common'
import
{
common
}
from
'@/config'
import
{
common
}
from
'@/config'
import
'./styles/role-user-common.scss'
import
'./styles/role-user-common.scss'
import
'./styles/index.scss'
import
'./styles/index.scss'
import
'./time.js'
// import _ from 'lodash'
// import _ from 'lodash'
import
{
Tree
}
from
'@/components'
import
{
Tree
}
from
'@/components'
Vue
.
use
(
GlsxVueComponents
)
Vue
.
use
(
GlsxVueComponents
)
...
...
src/common/common.js
→
src/common/common
Const
.js
View file @
377b7b1
import
{
roleCreateStructure
,
userRoleDetailColumn
,
userRoleDetailConsole
}
from
'./roleCo
mmon
'
import
{
roleCreateStructure
,
userRoleDetailColumn
,
userRoleDetailConsole
}
from
'./roleCo
nst
'
import
{
userDetailColumn
}
from
'./userCo
mmon
'
import
{
userDetailColumn
}
from
'./userCo
nst
'
export
{
export
{
roleCreateStructure
,
roleCreateStructure
,
...
...
src/common/roleCo
mmon
.js
→
src/common/roleCo
nst
.js
View file @
377b7b1
const
roleCreateStructure
=
{
const
roleCreateStructure
=
{
id
:
''
,
// id: Number
,
roleName
:
''
,
roleName
:
''
,
description
:
''
,
description
:
''
,
departName
:
''
,
departName
:
''
,
right
:
[]
,
right
:
Array
,
state
:
'启动'
,
state
:
1
,
createTime
:
''
createTime
:
''
}
}
...
...
src/common/userCo
mmon
.js
→
src/common/userCo
nst
.js
View file @
377b7b1
File moved
src/components/RoleCreate/src/main.vue
View file @
377b7b1
...
@@ -27,7 +27,8 @@
...
@@ -27,7 +27,8 @@
</
template
>
</
template
>
<
script
>
<
script
>
import
{
roleCreateStructure
}
from
'@/common/roleCommon'
import
{
roleCreateStructure
}
from
'@/common/commonConst'
import
{
saveRoleList
}
from
'@/api/api'
export
default
{
export
default
{
name
:
'RoleCreate'
,
name
:
'RoleCreate'
,
props
:
{
props
:
{
...
@@ -63,17 +64,28 @@ export default {
...
@@ -63,17 +64,28 @@ export default {
}
}
},
},
methods
:
{
methods
:
{
// isRoleNameExit
addRole
(
editData
)
{
saveRoleList
.
req
(
editData
).
then
((
data
)
=>
{
console
.
log
(
data
)
}).
catch
(
err
=>
{
console
.
log
(
err
)
})
},
handleCreateSubmit
(
formName
)
{
handleCreateSubmit
(
formName
)
{
const
editData
=
this
.
$deep_clone
(
this
.
createRuleForm
)
const
editData
=
this
.
$deep_clone
(
this
.
createRuleForm
)
// eidt:true;create:false
// eidt:true;create:false
const
flagEOrC
=
editData
.
id
// const flagEOrC = role.id === Number
this
.
$refs
[
formName
].
validate
((
valid
)
=>
{
// flagEOrC &&
if
(
valid
)
{
// const editData = { roleName: 'fhkdsajfakjfa' }
this
.
$emit
(
'createClose'
,
flagEOrC
,
editData
)
this
.
addRole
(
editData
)
}
else
{
// this.$refs[formName].validate((valid) => {
return
false
// if (valid) {
}
// this.$emit('createClose', flagEOrC, editData)
})
// } else {
// return false
// }
// })
},
},
handleCreateCancel
()
{
handleCreateCancel
()
{
this
.
$emit
(
'createClose'
)
this
.
$emit
(
'createClose'
)
...
...
src/config/common.conf.js
View file @
377b7b1
export
default
{
export
default
{
axios
:
{
axios
:
{
// baseURL: 'http://cas.dev.glsx.net/cas
/',
baseURL
:
'http://cas.dev.glsx.net/admin-operating-auth
/'
,
baseURL
:
'http://192.168.3.171:7300/mock/5b91805391b67469b43e2921/subsystem
'
,
// baseURL: 'http://192.168.3.171:7300/mock/5b91805391b67469b43e2921/subsystem/
',
whiteList
:
[
'
/role/deleteRoleById'
,
'/role/deleteUserRoleById'
,
'/role/getRoleDetail'
,
'/role/getRoleDetail'
,
'/role/getRoleList'
,
'/role/isRoleNameExit'
,
'/role/saveRoleList'
,
'/role/selectMenuTreeRoleId'
,
'/role/selectUserRoleByRoleId'
,
'/role/updateRole'
,
'role/userList'
,
'role/roleList
'
],
whiteList
:
[
'
role/deleteRoleById'
,
'role/deleteUserRoleById'
,
'role/getRoleDetail'
,
'role/getRoleDetail'
,
'role/getRoleList'
,
'role/isRoleNameExit'
,
'role/saveRoleList'
,
'role/selectMenuTreeRoleId'
,
'role/selectUserRoleByRoleId'
,
'role/updateRole'
,
'user/batcheDel'
,
'user/findAll'
,
'user/get'
,
'user/getWithRoles'
,
'user/operatUser'
,
'user/updateUser
'
],
timeout
:
15000
,
timeout
:
15000
,
result
:
{
result
:
{
data_key
:
'data'
,
// 返回值数据实体存放对象
data_key
:
'data'
,
// 返回值数据实体存放对象
...
...
src/time.js
deleted
100644 → 0
View file @
8c46f02
function
format
(
formatStr
)
{
const
date
=
this
var
zeroize
=
function
(
value
,
length
)
{
if
(
!
length
)
{
length
=
2
}
for
(
var
i
=
0
,
zeros
=
''
;
i
<
(
length
-
value
.
length
);
i
++
)
{
zeros
+=
'0'
}
return
zeros
+
value
}
return
formatStr
.
replace
(
/"
[^
"
]
*"|'
[^
'
]
*'|
\b(?:
d
{1,4}
|M
{1,4}
|yy
(?:
yy
)?
|
([
hHmstT
])\1?
|
[
lLZ
])\b
/g
,
function
(
$0
)
{
switch
(
$0
)
{
case
'd'
:
return
date
.
getDate
()
case
'dd'
:
return
zeroize
(
date
.
getDate
())
case
'ddd'
:
return
[
'Sun'
,
'Mon'
,
'Tue'
,
'Wed'
,
'Thr'
,
'Fri'
,
'Sat'
][
date
.
getDay
()]
case
'dddd'
:
return
[
'Sunday'
,
'Monday'
,
'Tuesday'
,
'Wednesday'
,
'Thursday'
,
'Friday'
,
'Saturday'
][
date
.
getDay
()]
case
'M'
:
return
date
.
getMonth
()
+
1
case
'MM'
:
return
zeroize
(
date
.
getMonth
()
+
1
)
case
'MMM'
:
return
[
'Jan'
,
'Feb'
,
'Mar'
,
'Apr'
,
'May'
,
'Jun'
,
'Jul'
,
'Aug'
,
'Sep'
,
'Oct'
,
'Nov'
,
'Dec'
][
date
.
getMonth
()]
case
'MMMM'
:
return
[
'January'
,
'February'
,
'March'
,
'April'
,
'May'
,
'June'
,
'July'
,
'August'
,
'September'
,
'October'
,
'November'
,
'December'
][
date
.
getMonth
()]
case
'yy'
:
return
date
.
getFullYear
().
substr
(
2
)
case
'yyyy'
:
return
date
.
getFullYear
()
case
'h'
:
return
date
.
getHours
()
%
12
||
12
case
'hh'
:
return
zeroize
(
date
.
getHours
()
%
12
||
12
)
case
'H'
:
return
date
.
getHours
()
case
'HH'
:
return
zeroize
(
date
.
getHours
())
case
'm'
:
return
date
.
getMinutes
()
case
'mm'
:
return
zeroize
(
date
.
getMinutes
())
case
's'
:
return
date
.
getSeconds
()
case
'ss'
:
return
zeroize
(
date
.
getSeconds
())
case
'l'
:
return
date
.
getMilliseconds
()
case
'll'
:
return
zeroize
(
date
.
getMilliseconds
())
case
'tt'
:
return
date
.
getHours
()
<
12
?
'am'
:
'pm'
case
'TT'
:
return
date
.
getHours
()
<
12
?
'AM'
:
'PM'
}
})
}
const
time
=
Date
time
.
prototype
.
format
=
format
src/views/customer/role/index.vue
View file @
377b7b1
...
@@ -10,16 +10,10 @@
...
@@ -10,16 +10,10 @@
<gl-button
class=
"control-tabledata-button"
size=
"small"
@
click=
"handleCreateOrEdit(roleParam, '新增角色')"
>
创建
</gl-button>
<gl-button
class=
"control-tabledata-button"
size=
"small"
@
click=
"handleCreateOrEdit(roleParam, '新增角色')"
>
创建
</gl-button>
<role-create
:createVisible=
"createVisible"
:roleParam=
"roleParam"
:createOrEditTitle=
"createOrEditTitle"
@
createClose=
"handleCreateClose"
></role-create>
<role-create
:createVisible=
"createVisible"
:roleParam=
"roleParam"
:createOrEditTitle=
"createOrEditTitle"
@
createClose=
"handleCreateClose"
></role-create>
<div
class=
"m-b8"
>
<div
class=
"m-b8"
>
<gl-table
:table=
"roleData"
></gl-table>
<transition>
<gl-pagination
<gl-table
:table=
"roleData"
></gl-table>
background
</transition>
@
size-change=
"handleSizeChange"
<gl-pagination
background
@
size-change=
"handleSizeChange"
@
current-change=
"handleCurrentChange"
:current-page=
"pageNum"
:page-sizes=
"[10,20,30,40]"
:page-size=
"pageSize"
layout=
"total, sizes, prev, pager, next, jumper"
:total=
"total"
>
@
current-change=
"handleCurrentChange"
:current-page=
"pagination.pageNum"
:page-sizes=
"[10,20,30,40]"
:page-size=
"pagination.pageSize"
layout=
"total, sizes, prev, pager, next, jumper"
:total=
"total"
>
</gl-pagination>
</gl-pagination>
<role-detail
:detailVisible=
"detailVisible"
:roleParam=
"roleParam"
@
detailClose=
"handleDetailClose"
></role-detail>
<role-detail
:detailVisible=
"detailVisible"
:roleParam=
"roleParam"
@
detailClose=
"handleDetailClose"
></role-detail>
<user-detail
:userDetailVisible=
"userDetailVisible"
:userDetailTitle=
"userDetailTitle"
@
userDetailClose=
"handleUserDetailClose"
:dataParam=
"[]"
:columnParam=
"columnParam"
:consoleParam=
"consoleParam"
></user-detail>
<user-detail
:userDetailVisible=
"userDetailVisible"
:userDetailTitle=
"userDetailTitle"
@
userDetailClose=
"handleUserDetailClose"
:dataParam=
"[]"
:columnParam=
"columnParam"
:consoleParam=
"consoleParam"
></user-detail>
...
@@ -30,11 +24,9 @@
...
@@ -30,11 +24,9 @@
<
script
>
<
script
>
import
{
RoleCreate
,
RoleDetail
,
UserDetail
}
from
'@/components/index'
import
{
RoleCreate
,
RoleDetail
,
UserDetail
}
from
'@/components/index'
// easy mock接口
// 接口
import
{
roleTest
}
from
'@/api/api'
import
{
getRoleList
}
from
'@/api/api'
// 后台接口
import
{
roleCreateStructure
,
userRoleDetailColumn
,
userRoleDetailConsole
}
from
'@/common/commonConst'
// import { getRoleList } from '@/api/api'
import
{
roleCreateStructure
,
userRoleDetailColumn
,
userRoleDetailConsole
}
from
'@/common/common'
export
default
{
export
default
{
name
:
'role'
,
name
:
'role'
,
components
:
{
components
:
{
...
@@ -54,11 +46,9 @@ export default {
...
@@ -54,11 +46,9 @@ export default {
createOrEditTitle
:
'新增角色'
,
createOrEditTitle
:
'新增角色'
,
userDetailTitle
:
'用户列表'
,
userDetailTitle
:
'用户列表'
,
// 分页所需参数-start
// 分页所需参数-start
total
:
100
,
total
:
10
,
pagination
:
{
pageNum
:
1
,
pageNum
:
1
,
pageSize
:
10
,
pageSize
:
10
},
// 分页所需参数-end
// 分页所需参数-end
roleData
:
{
roleData
:
{
border
:
true
,
border
:
true
,
...
@@ -113,18 +103,14 @@ export default {
...
@@ -113,18 +103,14 @@ export default {
}
}
},
},
mounted
()
{
mounted
()
{
roleTest
.
req
().
then
(
res
=>
{
this
.
getList
()
this
.
roleData
.
data
=
res
.
roleData
})
// 请求表格数据
// getRoleList.req(this.pagination).then(res => {
// console.log(res)
// this.total = res.total
// this.roleData.data = res.condition
// }).catch(err => {
// console.log(err)
// })
},
},
// search--------------------
// watch: {
// roleName(val) {
// !val
// }
// },
methods
:
{
methods
:
{
message
(
message
,
type
)
{
message
(
message
,
type
)
{
type
&&
this
.
$message
({
type
&&
this
.
$message
({
...
@@ -143,13 +129,34 @@ export default {
...
@@ -143,13 +129,34 @@ export default {
cancelButtonText
:
'取消'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
type
:
'warning'
}).
then
(()
=>
{
}).
then
(()
=>
{
this
.
roleData
.
data
.
splice
(
index
,
1
)
rows
.
splice
(
index
,
1
)
rows
.
splice
(
index
,
1
)
this
.
message
(
'删除成功'
,
'success'
)
this
.
message
(
'删除成功'
,
'success'
)
}).
catch
(()
=>
{
}).
catch
(()
=>
{
this
.
message
(
'取消删除'
)
this
.
message
(
'取消删除'
)
})
})
},
},
// 获取页面参数
getParams
()
{
return
{
// pageSize: this.pageSize,
// pageNum: this.pageNum,
roleName
:
this
.
roleName
}
},
// 接口请求-start---------------------------------------
// 获取展示数据,请求表格数据
getList
()
{
// 接口
const
params
=
this
.
getParams
()
getRoleList
.
req
(
params
).
then
(
res
=>
{
console
.
log
(
res
)
this
.
total
=
res
.
total
this
.
roleData
.
data
=
res
.
list
}).
catch
(
err
=>
{
console
.
log
(
err
)
})
},
// 接口请求-end---------------------------------------
// 新增用户到页面
// 新增用户到页面
aaaddRole
(
data
)
{
aaaddRole
(
data
)
{
// 后台获取----------------------
// 后台获取----------------------
...
@@ -171,13 +178,16 @@ export default {
...
@@ -171,13 +178,16 @@ export default {
},
},
// 调取接口相关函数
// 调取接口相关函数
handleSizeChange
(
val
)
{
handleSizeChange
(
val
)
{
this
.
pagination
.
pageSize
=
val
this
.
pageSize
=
val
this
.
getList
()
},
},
handleCurrentChange
(
val
)
{
handleCurrentChange
(
val
)
{
this
.
pagination
.
pageNum
=
val
this
.
pageNum
=
val
this
.
getList
()
},
},
handleSearchRoleName
()
{
handleSearchRoleName
()
{
this
.
roleName
=
''
this
.
getList
()
// this.roleName = ''
},
},
handleGetRoleDetail
(
params
)
{
handleGetRoleDetail
(
params
)
{
this
.
roleParam
=
params
this
.
roleParam
=
params
...
...
src/views/customer/user/index.vue
View file @
377b7b1
...
@@ -9,11 +9,13 @@
...
@@ -9,11 +9,13 @@
<div
class=
"default p-t15"
>
<div
class=
"default p-t15"
>
<div
class=
"control-tabledata-button"
>
<div
class=
"control-tabledata-button"
>
<gl-button
size=
"small"
@
click=
"createUser(editUser=
{})">新增用户
</gl-button>
<gl-button
size=
"small"
@
click=
"createUser(editUser=
{})">新增用户
</gl-button>
<gl-button
size=
"small"
@
click=
"toggle
Selection(this.toggle)
"
>
删除选中
</gl-button>
<gl-button
size=
"small"
@
click=
"toggle
RowSelection
"
>
删除选中
</gl-button>
<user-create
:dialogFormVisible=
"dialogFormVisible"
:editUser=
"editUser"
@
userFormData=
"handleUserFormData"
></user-create>
<user-create
:dialogFormVisible=
"dialogFormVisible"
:editUser=
"editUser"
@
userFormData=
"handleUserFormData"
></user-create>
</div>
</div>
<div
class=
"m-b8"
>
<div
class=
"m-b8"
>
<gl-table
:table=
"userData"
ref=
"multipleTable"
:pagination=
"pagination"
></gl-table>
<gl-table
:table=
"userData"
ref=
"multipleTable"
></gl-table>
<gl-pagination
background
@
size-change=
"handleSizeChange"
@
current-change=
"handleCurrentChange"
:current-page=
"pageNum"
:page-sizes=
"[10,20,30,40]"
:page-size=
"pageSize"
layout=
"total, sizes, prev, pager, next, jumper"
:total=
"total"
>
</gl-pagination>
<user-detail
:userDetailVisible=
"userDetailVisible"
:userDetailTitle=
"userDetailTitle"
@
userDetailClose=
"handleUserDetailClose"
:dataParam=
"[]"
:columnParam=
"columnParam"
:consoleParam=
"consoleParam"
></user-detail>
<user-detail
:userDetailVisible=
"userDetailVisible"
:userDetailTitle=
"userDetailTitle"
@
userDetailClose=
"handleUserDetailClose"
:dataParam=
"[]"
:columnParam=
"columnParam"
:consoleParam=
"consoleParam"
></user-detail>
</div>
</div>
</div>
</div>
...
@@ -22,8 +24,9 @@
...
@@ -22,8 +24,9 @@
<
script
>
<
script
>
import
{
UserCreate
,
UserDetail
}
from
'@/components/index'
import
{
UserCreate
,
UserDetail
}
from
'@/components/index'
import
{
getUser
}
from
'@/api/userApi'
// 接口
import
{
userDetailColumn
}
from
'@/common/common'
import
{
findAll
}
from
'@/api/api'
import
{
userDetailColumn
}
from
'@/common/commonConst'
export
default
{
export
default
{
name
:
'user'
,
name
:
'user'
,
components
:
{
components
:
{
...
@@ -33,11 +36,16 @@ export default {
...
@@ -33,11 +36,16 @@ export default {
data
()
{
data
()
{
return
{
return
{
userName
:
''
,
userName
:
''
,
toggle
:
{}
,
toggle
:
[]
,
dialogFormVisible
:
false
,
dialogFormVisible
:
false
,
editUser
:
{},
editUser
:
{},
userDetailVisible
:
false
,
userDetailVisible
:
false
,
userDetailTitle
:
'用户详情'
,
userDetailTitle
:
'用户详情'
,
// 分页所需参数-start
total
:
10
,
pageNum
:
1
,
pageSize
:
10
,
// 分页所需参数-end
columnParam
:
[],
columnParam
:
[],
consoleParam
:
[],
consoleParam
:
[],
userData
:
{
userData
:
{
...
@@ -107,23 +115,32 @@ export default {
...
@@ -107,23 +115,32 @@ export default {
},
},
selection
:
{},
selection
:
{},
multipleSelection
:
[]
multipleSelection
:
[]
},
pagination
:
{
show
:
true
,
layout
:
'total, sizes, prev, pager, next, jumper'
,
style
:
{
marginTop
:
'20px'
}
}
}
}
}
},
},
mounted
()
{
mounted
()
{
getUser
.
req
().
then
(
res
=>
{
this
.
findUserList
()
this
.
userData
.
data
=
res
.
userData
console
.
log
(
res
.
userData
)
})
},
},
methods
:
{
methods
:
{
// 获取所需字段
getParams
()
{
return
{
pageSize
:
this
.
pageSize
,
pageNum
:
this
.
pageNum
,
username
:
this
.
userName
}
},
// 接口请求-start
findUserList
()
{
const
params
=
this
.
getParams
()
findAll
.
req
(
params
).
then
(
res
=>
{
this
.
total
=
res
.
total
this
.
userData
.
data
=
res
.
list
}).
catch
(
err
=>
{
console
.
log
(
err
)
})
},
// 接口请求-end
message
(
message
,
type
)
{
message
(
message
,
type
)
{
type
&&
this
.
$message
({
type
&&
this
.
$message
({
showClose
:
true
,
showClose
:
true
,
...
@@ -178,22 +195,34 @@ export default {
...
@@ -178,22 +195,34 @@ export default {
console
.
log
(
createTime
)
console
.
log
(
createTime
)
return
createTime
return
createTime
},
},
handleSelectionChange
(
val
)
{
handleSelectionChange
(
val
,
row
)
{
// this.multipleSelection = val
// this.multipleSelection = val
alert
(
val
)
this
.
toggle
=
val
this
.
toggle
=
val
console
.
log
(
this
.
toggle
)
},
},
toggleSelection
(
rows
)
{
toggleRowSelection
()
{
if
(
rows
)
{
console
.
log
(
this
.
$refs
.
multipleTable
,
this
.
toggle
)
rows
.
forEach
(
row
=>
{
if
(
this
.
toggle
)
{
this
.
$refs
.
multipleTable
.
toggleRowSelection
(
row
)
this
.
toggle
.
forEach
(
row
=>
{
this
.
userData
.
data
.
splice
(
this
.
toggle
,
1
)
// this.$refs.multipleTable.$refs.table.toggleRowSelection(row)
})
})
}
else
{
}
else
{
this
.
$refs
.
multipleTable
.
clearSelection
()
//
this.$refs.multipleTable.clearSelection()
}
}
},
},
finduserName
()
{
finduserName
()
{
this
.
userName
=
''
// this.userName = ''
this
.
findUserList
()
},
// 调取接口相关函数
handleSizeChange
(
val
)
{
this
.
pageSize
=
val
this
.
findUserList
()
},
handleCurrentChange
(
val
)
{
this
.
pageNum
=
val
this
.
findUserList
()
},
},
delteSelected
(
val
)
{
delteSelected
(
val
)
{
console
.
log
(
val
)
console
.
log
(
val
)
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment