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 c06fab7c
authored
Sep 28, 2018
by
cwq0219
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
部门-添加和编辑接口;验证
1 parent
25aab8fc
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
61 additions
and
40 deletions
src/common/roleConst.js
src/components/RightForm/src/main.vue
src/views/customer/department/index.vue
src/views/customer/role/index.vue
src/common/roleConst.js
View file @
c06fab7
...
@@ -29,7 +29,12 @@ const roleDataColumn = [{
...
@@ -29,7 +29,12 @@ const roleDataColumn = [{
}
}
},
{
},
{
label
:
'创建时间'
,
label
:
'创建时间'
,
prop
:
'createTime'
prop
:
'createTime'
,
formatter
:
(
cellValue
)
=>
{
if
(
cellValue
.
createTime
)
{
return
new
Date
(
cellValue
.
createTime
).
format
(
'yyyy-MM-dd HH:mm:ss'
)
}
}
}]
}]
const
userRoleDetailColumn
=
[{
const
userRoleDetailColumn
=
[{
...
...
src/components/RightForm/src/main.vue
View file @
c06fab7
...
@@ -26,7 +26,9 @@
...
@@ -26,7 +26,9 @@
v-model=
"value.form[i.value]"
v-model=
"value.form[i.value]"
:disabled=
"i.disabled"
>
:disabled=
"i.disabled"
>
</gl-input>
</gl-input>
<div
v-show=
"err && index === 0"
class=
"err"
>
{{
errText
}}
</div>
<div
v-show=
"err && index === 0"
class=
"err"
>
{{
textName
}}
</div>
<div
v-show=
"errExist && index === 0"
class=
"err"
>
{{
textExist
}}
</div>
<div
v-show=
"errIorder && index === 8"
class=
"err"
>
{{
textType
}}
</div>
</gl-form-item>
</gl-form-item>
<gl-form-item>
<gl-form-item>
<gl-button
type=
"primary"
@
click=
"submit"
>
{{
value
.
btnTxt
}}
</gl-button>
<gl-button
type=
"primary"
@
click=
"submit"
>
{{
value
.
btnTxt
}}
</gl-button>
...
@@ -48,14 +50,18 @@
...
@@ -48,14 +50,18 @@
</div>
</div>
</
template
>
</
template
>
<
script
type=
'text/ecmascript-6'
>
<
script
type=
'text/ecmascript-6'
>
import
{
delDepartment
,
delMenu
,
editMenu
,
addMenu
}
from
'@/api/api'
import
{
delDepartment
,
delMenu
,
editMenu
,
addMenu
,
updateDepartment
}
from
'@/api/api'
export
default
{
export
default
{
name
:
'rightForm'
,
name
:
'rightForm'
,
data
()
{
data
()
{
return
{
return
{
dialog
:
false
,
dialog
:
false
,
err
:
false
,
err
:
false
,
errText
:
this
.
isDepart
?
'请填写部门名称'
:
'请填写列表名称'
textName
:
this
.
isDepart
?
'请填写部门名称'
:
'请填写列表名称'
,
errExist
:
false
,
textExist
:
''
,
errIorder
:
false
,
textType
:
'请填写数字'
}
}
},
},
props
:
{
props
:
{
...
@@ -68,13 +74,29 @@ export default {
...
@@ -68,13 +74,29 @@ export default {
},
},
watch
:
{
watch
:
{
'value.form.urlName'
(
val
)
{
'value.form.urlName'
(
val
)
{
if
(
val
!==
''
)
this
.
err
=
false
if
(
val
!==
''
)
this
.
nameTip
()
},
},
'value.form.name'
(
val
)
{
'value.form.name'
(
val
)
{
if
(
val
!==
''
)
this
.
err
=
false
if
(
val
!==
''
)
this
.
nameTip
()
},
'value.form.iorder'
(
val
)
{
if
(
val
&&
!
parseInt
(
val
))
{
this
.
errIorder
=
true
}
else
{
this
.
errIorder
=
false
}
}
}
},
},
methods
:
{
methods
:
{
nameTip
()
{
this
.
err
=
false
this
.
errExist
=
false
this
.
textExist
=
''
},
nameExitTip
(
err
)
{
this
.
errExist
=
true
this
.
textExist
=
err
},
getMenuObj
(
obj
=
{})
{
getMenuObj
(
obj
=
{})
{
for
(
const
key
in
this
.
value
.
form
)
{
for
(
const
key
in
this
.
value
.
form
)
{
obj
[
key
]
=
this
.
value
.
form
[
key
]
obj
[
key
]
=
this
.
value
.
form
[
key
]
...
@@ -82,6 +104,19 @@ export default {
...
@@ -82,6 +104,19 @@ export default {
if
(
!
this
.
isDepart
)
delete
obj
.
name
if
(
!
this
.
isDepart
)
delete
obj
.
name
return
obj
return
obj
},
},
// 接口调用-start
addOrEditDepart
(
params
)
{
// console.log(obj)
// const params = this.getDepartParams()
console
.
log
(
params
)
updateDepartment
.
req
(
params
).
then
(
res
=>
{
this
.
Tip
(
true
)
console
.
log
(
res
)
}).
catch
(
err
=>
{
console
.
log
(
err
)
})
},
// 接口调用-end
// 删除
// 删除
delData
()
{
delData
()
{
const
obj
=
this
.
getMenuObj
()
const
obj
=
this
.
getMenuObj
()
...
@@ -131,9 +166,8 @@ export default {
...
@@ -131,9 +166,8 @@ export default {
const
treeData
=
this
.
value
.
allNode
const
treeData
=
this
.
value
.
allNode
if
(
this
.
value
.
form
[
this
.
form
[
0
].
value
]
!==
''
&&
this
.
value
.
form
[
this
.
form
[
0
].
value
]
!==
null
)
{
if
(
this
.
value
.
form
[
this
.
form
[
0
].
value
]
!==
''
&&
this
.
value
.
form
[
this
.
form
[
0
].
value
]
!==
null
)
{
const
obj
=
this
.
getMenuObj
()
const
obj
=
this
.
getMenuObj
()
// obj.updateTime = new Date().getTime()
obj
.
isHidden
=
this
.
value
.
form
.
isHidden
===
true
?
0
:
1
obj
.
isHidden
=
this
.
value
.
form
.
isHidden
===
true
?
0
:
1
console
.
log
(
obj
)
//
console.log(obj)
// 添加同级
// 添加同级
if
(
this
.
value
.
sublings
)
{
if
(
this
.
value
.
sublings
)
{
if
(
treeData
.
parent
===
'#'
)
{
if
(
treeData
.
parent
===
'#'
)
{
...
@@ -148,7 +182,7 @@ export default {
...
@@ -148,7 +182,7 @@ export default {
this
.
addData
(
obj
)
this
.
addData
(
obj
)
// 修改
// 修改
}
else
{
}
else
{
// obj.createTime = this.unix(this.value.form.createTime)
if
(
!
this
.
isDepart
)
{
editMenu
.
req
(
obj
).
then
(
res
=>
{
editMenu
.
req
(
obj
).
then
(
res
=>
{
console
.
log
(
res
)
console
.
log
(
res
)
this
.
Tip
(
true
)
this
.
Tip
(
true
)
...
@@ -156,6 +190,9 @@ export default {
...
@@ -156,6 +190,9 @@ export default {
console
.
log
(
err
)
console
.
log
(
err
)
this
.
Tip
(
false
)
this
.
Tip
(
false
)
})
})
}
else
{
this
.
addOrEditDepart
(
obj
)
}
}
}
}
else
{
}
else
{
this
.
err
=
true
this
.
err
=
true
...
@@ -167,19 +204,15 @@ export default {
...
@@ -167,19 +204,15 @@ export default {
return
new
Date
(
time
).
getTime
()
return
new
Date
(
time
).
getTime
()
},
},
addData
(
obj
)
{
addData
(
obj
)
{
// obj.createTime = new Date().getTime()
// const objPackge = { menu: obj }
// console.log(objPackge)
// delete obj.createTime
// delete obj.updateTime
if
(
!
this
.
isDepart
)
{
if
(
!
this
.
isDepart
)
{
addMenu
.
req
(
obj
).
then
(
res
=>
{
addMenu
.
req
(
obj
).
then
(
res
=>
{
console
.
log
(
res
)
this
.
Tip
(
true
)
this
.
Tip
(
true
)
}).
catch
(
err
=>
{
}).
catch
(
err
=>
{
console
.
log
(
err
)
this
.
nameExitTip
(
err
)
this
.
Tip
(
false
)
//
this.Tip(false)
})
})
}
else
{
this
.
addOrEditDepart
(
obj
)
}
}
},
},
Tip
(
val
)
{
Tip
(
val
)
{
...
...
src/views/customer/department/index.vue
View file @
c06fab7
...
@@ -59,8 +59,10 @@ export default {
...
@@ -59,8 +59,10 @@ export default {
this
.
department
.
push
=
false
this
.
department
.
push
=
false
this
.
department
.
form
.
upDepartment
=
node
.
level
===
1
?
'广联赛讯'
:
node
.
parent
.
data
[
props
.
label
]
this
.
department
.
form
.
upDepartment
=
node
.
level
===
1
?
'广联赛讯'
:
node
.
parent
.
data
[
props
.
label
]
getDepartTreeNode
.
req
({
id
:
data
.
id
}).
then
(
res
=>
{
getDepartTreeNode
.
req
({
id
:
data
.
id
}).
then
(
res
=>
{
this
.
department
.
form
.
id
=
res
.
id
this
.
department
.
form
.
name
=
res
.
name
this
.
department
.
form
.
name
=
res
.
name
this
.
department
.
form
.
iorder
=
res
.
iorder
this
.
department
.
form
.
iorder
=
res
.
iorder
this
.
department
.
form
.
parentId
=
res
.
parentId
}).
catch
(
err
=>
{
}).
catch
(
err
=>
{
console
.
log
(
err
)
console
.
log
(
err
)
})
})
...
...
src/views/customer/role/index.vue
View file @
c06fab7
...
@@ -106,14 +106,9 @@ export default {
...
@@ -106,14 +106,9 @@ export default {
},
},
methods
:
{
methods
:
{
message
(
message
,
type
)
{
message
(
message
,
type
)
{
type
&&
this
.
$message
({
this
.
$notify
({
showClose
:
true
,
type
:
type
,
type
:
type
,
message
:
message
title
:
message
})
!
type
&&
this
.
$message
({
showClose
:
true
,
message
:
message
})
})
},
},
confirmDeleteOrNot
(
index
,
rows
)
{
confirmDeleteOrNot
(
index
,
rows
)
{
...
@@ -125,7 +120,7 @@ export default {
...
@@ -125,7 +120,7 @@ export default {
// 删除角色,根据返回的code值来判断是否删除成功(已有拦截器)
// 删除角色,根据返回的code值来判断是否删除成功(已有拦截器)
this
.
deleteRole
(
rows
[
index
].
id
)
this
.
deleteRole
(
rows
[
index
].
id
)
}).
catch
(()
=>
{
}).
catch
(()
=>
{
this
.
message
(
'取消删除'
)
this
.
message
(
'取消删除'
,
'info'
)
})
})
},
},
// 获取页面参数
// 获取页面参数
...
@@ -162,21 +157,7 @@ export default {
...
@@ -162,21 +157,7 @@ export default {
// 获得角色的相关权限详细信息,并返回树形数据
// 获得角色的相关权限详细信息,并返回树形数据
getMenuTree
(
params
)
{
getMenuTree
(
params
)
{
selectMenuTreeRoleId
.
req
({
id
:
params
}).
then
(
res
=>
{
selectMenuTreeRoleId
.
req
({
id
:
params
}).
then
(
res
=>
{
// console.log(res)
// let count = 0
// res.forEach(item => {
// this.roleMenuTree.push(item.id)
// count = count + 1
// })
// console.log(`count = ${count}`)
// console.log(this.roleMenuTree)
// console.log(this.roleParam.rights)
this
.
roleMenuTree
=
res
this
.
roleMenuTree
=
res
// console.log(this.roleMenuTree)
// console.log('------------------------')
// console.log(this.roleMenuTree instanceof Array)
// console.log(this.roleParam.rights instanceof Array)
// this.editOrDetail && this.createDialogVisible()
this
.
deleteDialogVisible
()
this
.
deleteDialogVisible
()
}).
catch
(
err
=>
{
}).
catch
(
err
=>
{
console
.
log
(
err
)
console
.
log
(
err
)
...
@@ -268,7 +249,7 @@ export default {
...
@@ -268,7 +249,7 @@ export default {
this
.
roleParam
=
roleCreateStructure
this
.
roleParam
=
roleCreateStructure
if
(
!
data
)
{
if
(
!
data
)
{
this
.
createDialogVisible
()
this
.
createDialogVisible
()
this
.
message
(
this
.
flagCOrE
?
'取消创建角色'
:
'取消编辑角色'
)
this
.
message
(
this
.
flagCOrE
?
'取消创建角色'
:
'取消编辑角色'
,
'info'
)
return
false
return
false
}
}
// 将数据提交给后台,根据返回结果做判断
// 将数据提交给后台,根据返回结果做判断
...
...
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