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 1bf17f02
authored
Dec 06, 2018
by
胡悦
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
其他页面修改数据本页面重新请求接口
1 parent
748a4b95
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
91 additions
and
40 deletions
src/base.js
src/components/UserCreate/src/main.vue
src/views/customer/role/index.vue
src/views/customer/user/index.vue
src/base.js
View file @
1bf17f0
...
@@ -13,6 +13,7 @@ import VeeValidate, { Validator } from 'vee-validate'
...
@@ -13,6 +13,7 @@ import VeeValidate, { Validator } from 'vee-validate'
import
{
Tree
}
from
'@/components'
import
{
Tree
}
from
'@/components'
Vue
.
use
(
GlsxVueComponents
)
Vue
.
use
(
GlsxVueComponents
)
Vue
.
component
(
'tree'
,
Tree
)
Vue
.
component
(
'tree'
,
Tree
)
import
Theme
from
'@/common/theme'
const
config
=
{
const
config
=
{
errorBagName
:
'errorBags'
,
errorBagName
:
'errorBags'
,
...
@@ -22,26 +23,45 @@ Vue.use(VeeValidate, config)
...
@@ -22,26 +23,45 @@ Vue.use(VeeValidate, config)
Validator
.
localize
(
'zh_CN'
,
zh_CN
)
Validator
.
localize
(
'zh_CN'
,
zh_CN
)
Vue
.
prototype
.
$valid
=
Validator
Vue
.
prototype
.
$valid
=
Validator
var
mixin
=
{
var
mixin
=
{
data
()
{
return
{
connection
:
null
,
eventBus
:
null
}
},
beforeMount
()
{
this
.
eventBus
=
new
Vue
()
},
mounted
()
{
mounted
()
{
const
_this
=
this
const
_this
=
this
const
theme
=
new
this
.
$
Theme
()
const
theme
=
new
Theme
()
const
connection
=
this
.
$Penpal
.
connectToParent
({
this
.
connection
=
this
.
$Penpal
.
connectToParent
({
methods
:
{
methods
:
{
setTheme
(
color
)
{
setTheme
(
color
)
{
theme
.
change
(
color
)
theme
.
change
(
color
)
},
},
height
()
{
height
()
{
return
document
.
height
||
document
.
body
.
offsetHeight
// document.documentElement.clientHeight || document.body.clientHeight //
return
document
.
height
||
document
.
body
.
offsetHeight
// document.documentElement.clientHeight || document.body.clientHeight //
},
$$on
(
e
)
{
_this
.
eventBus
.
$emit
(
'event'
,
e
)
}
}
}
}
})
})
connection
.
promise
.
then
(
parent
=>
{
this
.
connection
.
promise
.
then
(
parent
=>
{
const
cfg
=
_this
.
$get_session_config
()
const
cfg
=
_this
.
$get_session_config
()
if
(
cfg
)
return
if
(
cfg
)
return
parent
.
getResources
().
then
(
config
=>
{
parent
.
getResources
().
then
(
config
=>
{
_this
.
$set_session_config
(
config
)
_this
.
$set_session_config
(
config
)
})
})
})
})
},
methods
:
{
C2P
(
_event
)
{
this
.
connection
.
promise
.
then
(
parent
=>
{
parent
.
$$emit
(
_event
)
})
}
}
}
}
}
const
URL
=
' http://192.168.3.171:7300/mock/5be17454f31545347559d499/config'
const
URL
=
' http://192.168.3.171:7300/mock/5be17454f31545347559d499/config'
...
...
src/components/UserCreate/src/main.vue
View file @
1bf17f0
...
@@ -248,7 +248,7 @@ export default {
...
@@ -248,7 +248,7 @@ export default {
// this.$refs[formName].validate(valid => {
// this.$refs[formName].validate(valid => {
this
.
userData
=
this
.
$deep_clone
(
this
.
userManageForm
)
this
.
userData
=
this
.
$deep_clone
(
this
.
userManageForm
)
// 如果密码为null 就不传密码的值
// 如果密码为null 就不传密码的值
!
this
.
userData
.
password
&&
delete
userForm
.
password
!
this
.
userData
.
password
&&
delete
this
.
userData
.
password
delete
this
.
userData
.
createTime
delete
this
.
userData
.
createTime
delete
this
.
userData
.
updateTime
delete
this
.
userData
.
updateTime
delete
this
.
userData
.
roleList
delete
this
.
userData
.
roleList
...
...
src/views/customer/role/index.vue
View file @
1bf17f0
...
@@ -305,10 +305,18 @@ export default {
...
@@ -305,10 +305,18 @@ export default {
handleCreateOrEdit
()
{
handleCreateOrEdit
()
{
this
.
roleParam
=
this
.
flagCOrE
?
this
.
$deep_clone
(
roleCreateStructure
)
:
this
.
roleParam
this
.
roleParam
=
this
.
flagCOrE
?
this
.
$deep_clone
(
roleCreateStructure
)
:
this
.
roleParam
this
.
roleParam
.
oldRoleName
=
this
.
roleParam
.
roleName
this
.
roleParam
.
oldRoleName
=
this
.
roleParam
.
roleName
findDepartTree
.
req
().
then
(
res
=>
{
this
.
departList
=
fn
(
res
,
'#'
)
if
(
this
.
departList
)
{
this
.
flagCOrE
?
this
.
createDialogVisible
()
:
this
.
getMenuTree
(
this
.
roleParam
.
id
,
this
.
editOrDetail
=
true
)
this
.
flagCOrE
?
this
.
createDialogVisible
()
:
this
.
getMenuTree
(
this
.
roleParam
.
id
,
this
.
editOrDetail
=
true
)
}
}).
catch
(
err
=>
{
notice
.
errorTips
(
err
)
})
},
},
// 关闭新增用户组件
// 关闭新增用户组件
handleCreateClose
(
data
)
{
handleCreateClose
(
data
)
{
this
.
departList
=
[]
if
(
!
data
)
{
if
(
!
data
)
{
this
.
emptyParam
()
this
.
emptyParam
()
return
false
return
false
...
...
src/views/customer/user/index.vue
View file @
1bf17f0
...
@@ -61,6 +61,7 @@ export default {
...
@@ -61,6 +61,7 @@ export default {
toggle
:
[],
toggle
:
[],
isEdit
:
true
,
isEdit
:
true
,
departList
:
[],
departList
:
[],
row
:
{},
dialogFormVisible
:
false
,
dialogFormVisible
:
false
,
userManageForm
:
this
.
$deep_clone
(
userForm
),
userManageForm
:
this
.
$deep_clone
(
userForm
),
userDetailVisible
:
false
,
userDetailVisible
:
false
,
...
@@ -131,14 +132,14 @@ export default {
...
@@ -131,14 +132,14 @@ export default {
button
:
[{
button
:
[{
label
:
'编辑'
,
label
:
'编辑'
,
type
:
'text'
,
type
:
'text'
,
callback
:
(
index
,
rows
)
=>
{
callback
:
(
index
)
=>
{
this
.
editUser
(
rows
[
index
]
)
this
.
editUser
(
index
)
}
}
},
{
},
{
label
:
'详细'
,
label
:
'详细'
,
type
:
'text'
,
type
:
'text'
,
callback
:
(
index
,
rows
)
=>
{
callback
:
(
index
,
rows
)
=>
{
this
.
handleGetUserDetail
(
index
,
rows
)
this
.
handleGetUserDetail
(
index
)
}
}
},
{
},
{
label
:
'禁用'
,
label
:
'禁用'
,
...
@@ -182,8 +183,6 @@ export default {
...
@@ -182,8 +183,6 @@ export default {
},
},
mounted
()
{
mounted
()
{
this
.
findUserList
()
this
.
findUserList
()
this
.
getRoleOptions
()
this
.
getdepartData
()
},
},
watch
:
{
watch
:
{
userName
(
val
)
{
userName
(
val
)
{
...
@@ -217,18 +216,18 @@ export default {
...
@@ -217,18 +216,18 @@ export default {
})
})
},
},
// 获取所有角色选项
// 获取所有角色选项
getRoleOptions
()
{
//
getRoleOptions() {
getRoleList
.
req
().
then
(
res
=>
{
//
getRoleList.req().then(res => {
userForm
.
roleList
=
res
.
list
//
userForm.roleList = res.list
})
//
})
},
//
},
// 获取部门树
// 获取部门树
getdepartData
()
{
//
getdepartData() {
findDepartTree
.
req
().
then
(
res
=>
{
//
findDepartTree.req().then(res => {
this
.
departList
=
res
//
this.departList = res
userForm
.
departList
=
fn
(
res
,
'#'
)
//
userForm.departList = fn(res, '#')
})
//
})
},
//
},
// 新增更新用户接口请求
// 新增更新用户接口请求
updateUser_Post
(
params
)
{
updateUser_Post
(
params
)
{
this
.
loading
=
true
this
.
loading
=
true
...
@@ -292,33 +291,39 @@ export default {
...
@@ -292,33 +291,39 @@ export default {
},
},
// 新增按钮
// 新增按钮
createUser
()
{
createUser
()
{
Promise
.
all
([
getRoleList
.
req
(),
findDepartTree
.
req
()]).
then
(
result
=>
{
userForm
.
departList
=
fn
(
result
[
1
],
'#'
)
userForm
.
roleList
=
result
[
0
].
list
this
.
userManageForm
=
this
.
$deep_clone
(
userForm
)
this
.
userManageForm
=
this
.
$deep_clone
(
userForm
)
})
this
.
handleUserFormVisible
()
this
.
handleUserFormVisible
()
this
.
isEdit
=
false
this
.
isEdit
=
false
},
},
// 编辑按钮
// 编辑按钮
editUser
(
row
)
{
editUser
(
index
)
{
row
.
password
=
''
const
params
=
this
.
getParams
()
// console.log(row)
delete
params
.
keyWork
row
.
oldUserName
=
row
.
username
Promise
.
all
([
findAll
.
req
(
params
),
getRoleList
.
req
(),
findDepartTree
.
req
()]).
then
(
result
=>
{
row
.
roleList
=
this
.
$deep_clone
(
userForm
.
roleList
)
this
.
row
=
result
[
0
].
list
[
index
]
row
.
departList
=
this
.
$deep_clone
(
userForm
.
departList
)
this
.
row
.
password
=
null
row
.
state
=
row
.
state
+
''
this
.
row
.
oldUserName
=
this
.
row
.
username
row
.
isadmin
=
row
.
isadmin
+
''
this
.
row
.
roleList
=
this
.
$deep_clone
(
result
[
1
].
list
)
this
.
departList
=
result
[
2
]
userForm
.
departList
=
fn
(
result
[
2
],
'#'
)
this
.
row
.
departList
=
this
.
$deep_clone
(
userForm
.
departList
)
this
.
departList
.
forEach
(
item
=>
{
this
.
departList
.
forEach
(
item
=>
{
if
(
item
.
id
===
row
.
departId
)
{
if
(
item
.
id
===
this
.
row
.
departId
)
{
row
.
departName
=
item
.
text
this
.
row
.
departName
=
item
.
text
}
}
})
})
Promise
.
all
([
findAll
,
getRoleList
]).
then
((
result
)
=>
{
if
(
this
.
row
.
roles
&&
typeof
(
this
.
row
.
roles
)
===
'string'
)
{
if
(
row
.
roles
&&
typeof
(
row
.
roles
)
===
'string'
)
{
this
.
row
.
roles
=
(
this
.
row
.
roles
+
''
).
split
(
','
).
map
(
role
=>
+
role
)
row
.
roles
=
(
row
.
roles
+
''
).
split
(
','
).
map
(
role
=>
+
role
)
}
else
if
(
this
.
row
.
roles
&&
typeof
(
this
.
row
.
roles
)
===
'object'
)
{
}
else
if
(
row
.
roles
&&
typeof
(
row
.
roles
)
===
'object'
)
{
this
.
row
.
roles
row
.
roles
}
else
{
}
else
{
row
.
roles
=
[]
this
.
row
.
roles
=
[]
}
}
this
.
userManageForm
=
this
.
$deep_clone
(
row
)
this
.
userManageForm
=
this
.
$deep_clone
(
this
.
row
)
})
})
this
.
handleUserFormVisible
()
this
.
handleUserFormVisible
()
this
.
isEdit
=
true
this
.
isEdit
=
true
...
@@ -389,13 +394,31 @@ export default {
...
@@ -389,13 +394,31 @@ export default {
return
nameArray
.
join
(
','
)
return
nameArray
.
join
(
','
)
},
},
// 详细操作
// 详细操作
handleGetUserDetail
(
index
,
rows
)
{
handleGetUserDetail
(
index
)
{
this
.
columnParam
=
userDetailColumn
this
.
columnParam
=
userDetailColumn
this
.
consoleParam
=
[]
this
.
consoleParam
=
[]
this
.
flagRoleOrUser
=
false
this
.
flagRoleOrUser
=
false
this
.
apiParam
=
this
.
$deep_clone
(
rows
[
index
])
const
params
=
this
.
getParams
()
this
.
apiParam
.
roles
=
this
.
findRolesName
(
this
.
apiParam
.
roles
)
delete
params
.
keyWork
Promise
.
all
([
findAll
.
req
(
params
),
getRoleList
.
req
()]).
then
(
result
=>
{
this
.
apiParam
=
this
.
$deep_clone
(
result
[
0
].
list
[
index
])
const
params
=
this
.
apiParam
.
roles
if
(
!
params
)
{
this
.
apiParam
.
roles
=
null
}
else
{
const
nameArray
=
[]
const
userRoles
=
(
typeof
(
params
)
===
'string'
)
?
params
.
split
(
','
)
:
params
userRoles
.
forEach
(
userItem
=>
{
result
[
1
].
list
.
forEach
(
item
=>
{
if
(
+
userItem
===
item
.
id
)
{
nameArray
.
push
(
item
.
roleName
)
}
})
})
this
.
apiParam
.
roles
=
nameArray
.
join
(
','
)
}
this
.
userDetailVisible
=
!
this
.
userDetailVisible
this
.
userDetailVisible
=
!
this
.
userDetailVisible
})
},
},
handleUserDetailClose
()
{
handleUserDetailClose
()
{
this
.
userDetailVisible
=
!
this
.
userDetailVisible
this
.
userDetailVisible
=
!
this
.
userDetailVisible
...
...
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