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