Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
明托
/
glsx-oss-account
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit b576806e
authored
Aug 20, 2021
by
胡悦
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
提交账户权限
1 parent
e6b5b58c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
72 deletions
src/views/customer/account/add/index.vue
src/views/customer/account/add/index.vue
View file @
b576806
...
...
@@ -35,7 +35,6 @@
v-model=
"accountRuleForm.requestList"
value-key=
"dictValue"
@
change=
"authChange"
@
visible-change=
"authVisibleChange"
:size=
"btn_size"
multiple
placeholder=
"请选择"
...
...
@@ -95,9 +94,10 @@
show-checkbox
node-key="id"
default-expand-all
:check-strictly="true"
:expand-on-click-node="false"
:render-content="renderContent"
@
node-expand="nodeExpand
"
@
check="getCurrentNode
"
>
</el-tree>
</el-card>
...
...
@@ -142,7 +142,8 @@ export default {
responseList
:
[],
changeList
:
[],
lastList
:
[],
checkStrictly
:
true
checkStrictly
:
true
,
flag
:
true
}
},
mounted
()
{
...
...
@@ -177,20 +178,17 @@ export default {
getAllId
(
data
,
arr
=
[])
{
if
(
data
)
{
data
.
forEach
(
item
=>
{
arr
.
push
(
item
.
id
)
if
(
item
.
children
&&
item
.
children
.
length
!=
0
)
{
item
.
children
.
forEach
(
i
=>
{
this
.
getAllId
(
i
.
children
)
arr
.
push
(
i
.
id
)
this
.
getAllId
(
i
.
children
,
arr
)
})
}
arr
.
push
(
item
.
id
)
})
}
return
arr
},
// 展开节点
nodeExpand
(
a
,
node
,
c
)
{
},
addStyle
()
{
const
nodes
=
document
.
getElementsByClassName
(
'fun-tree-node'
)
for
(
let
i
=
0
;
i
<
nodes
.
length
;
i
++
)
{
...
...
@@ -198,53 +196,6 @@ export default {
parentNode
.
style
.
float
=
'left'
}
},
authVisibleChange
(
val
)
{
// if (!val && this.accountRuleForm.requestList.length !== 0) {
// this.activeName = this.accountRuleForm.requestList[0].dictLabel
// // const arr = this.accountRuleForm.requestList
// // const productId = arr.map(item => item.dictValue)
// const productId = []
// const arr = this.accountRuleForm.requestList.map(item => item.dictValue)
// arr.forEach(item => {
// if (!this.changeList.includes(item)) {
// productId.push(item)
// }
// })
// const params = { productId }
// console.log(productId)
// // { productId, accountTypeId: 1 }
// if (this.$Common.getParams().id) params.accountTypeId = this.$Common.getParams().id
// accountApi.findProductById(params).then(res => {
// if (res.code == '0') {
// this.changeList = arr
// this.treeData.push(_.cloneDeep(res.data[0]))
// // this.treeData = _.cloneDeep(res.data)
// if (this.$Common.getParams().id && this.responseList.length != 0) {
// // 编辑
// this.$nextTick(() => {
// this.responseList.forEach((item, index) => {
// if (this.$refs[`tree${index}`][0]) {
// this.$refs[`tree${index}`][0].setCheckedKeys(item.idList)
// // this.$refs[`tree${index}`][0].setCheckedKeys([98])
// }
// })
// this.addStyle()
// })
// } else {
// // 新增
// this.$nextTick(() => {
// this.treeData.forEach((i, idx) => {
// if (this.$refs[`tree${idx}`][0]) { // 可能被删除了
// this.$refs[`tree${idx}`][0].setCheckedKeys(this.getAllId(i.children))
// }
// })
// this.addStyle()
// })
// }
// }
// })
// }
},
authChange
(
val
)
{
console
.
log
(
val
)
if
(
val
.
length
!=
0
)
{
...
...
@@ -258,14 +209,12 @@ export default {
if
(
this
.
accountParams
.
id
)
params
.
accountTypeId
=
this
.
accountParams
.
id
accountApi
.
findProductById
(
params
).
then
(
res
=>
{
if
(
res
.
code
==
'0'
)
{
// this.changeList = arr
this
.
treeData
.
push
(
_
.
cloneDeep
(
res
.
data
[
0
]))
// if (this.responseList.length != 0) {
// 新增默认全选
const
len
=
this
.
treeData
.
length
-
1
console
.
log
(
len
,
this
.
$refs
[
`tree
${
len
}
`
],
this
.
treeData
[
len
].
children
)
this
.
$nextTick
(()
=>
{
this
.
$refs
[
`tree
${
len
}
`
][
0
].
setCheckedNodes
(
this
.
treeData
[
len
].
children
)
// this.$refs[`tree${len}`][0].setCheckedNodes(this.treeData[len].children)
this
.
$refs
[
`tree
${
len
}
`
][
0
].
setCheckedKeys
(
this
.
getAllId
(
this
.
treeData
[
len
].
children
))
})
// }
}
...
...
@@ -273,28 +222,29 @@ export default {
}
else
{
// 删除
const
arr
=
val
.
map
(
item
=>
item
.
dictValue
)
console
.
log
(
this
.
lastList
,
arr
,
'shanchu'
)
for
(
let
i
=
0
;
i
<
this
.
lastList
.
length
;
i
++
)
{
console
.
log
(
arr
.
includes
(
this
.
lastList
[
i
].
dictValue
),
this
.
treeData
[
i
])
if
(
!
arr
.
includes
(
this
.
lastList
[
i
].
dictValue
))
{
this
.
treeData
.
splice
(
i
,
1
)
break
}
}
this
.
lastList
=
val
console
.
log
(
this
.
treeData
)
}
}
else
{
this
.
treeData
=
[]
}
},
getCurrentNode
(
data
)
{
console
.
log
(
data
)
},
btnClick
(
type
,
index
)
{
switch
(
type
)
{
case
'allTree'
:
this
.
$refs
[
`tree
${
index
}
`
][
0
].
setCheckedNodes
(
this
.
treeData
[
index
].
children
)
// this.$refs[`tree${index}`][0].setCheckedNodes(this.treeData[index].children)
this
.
$refs
[
`tree
${
index
}
`
][
0
].
setCheckedKeys
(
this
.
getAllId
(
this
.
treeData
[
index
].
children
))
break
case
'cancelAllTree'
:
this
.
$refs
[
`tree
${
index
}
`
][
0
].
setChecked
Node
s
([])
this
.
$refs
[
`tree
${
index
}
`
][
0
].
setChecked
Key
s
([])
break
// eslint-disable-next-line no-case-declarations
case
'resetTree'
:
...
...
@@ -336,6 +286,10 @@ export default {
const
requestList
=
this
.
getRequestList
()
this
.
$refs
.
accountRuleForm
.
validate
(
valid
=>
{
if
(
valid
)
{
if
(
!
this
.
flag
)
{
this
.
notice
.
errorTips
(
'有节点的父节点未选中'
)
return
}
const
params
=
{
accounttypeName
:
this
.
accountRuleForm
.
accounttypeName
,
requestList
,
...
...
@@ -369,15 +323,26 @@ export default {
getRequestList
()
{
const
requestList
=
[]
console
.
log
(
this
.
accountRuleForm
.
requestList
)
this
.
flag
=
true
this
.
accountRuleForm
.
requestList
.
forEach
((
item
,
index
)
=>
{
const
checkedNodes
=
this
.
$refs
[
`tree
${
index
}
`
][
0
].
getCheckedNodes
()
const
halfCheckedNodes
=
this
.
$refs
[
`tree
${
index
}
`
][
0
].
getHalfCheckedNodes
()
const
nodes
=
checkedNodes
.
concat
(
halfCheckedNodes
)
console
.
log
(
nodes
)
const
checkedKeys
=
this
.
$refs
[
`tree
${
index
}
`
][
0
].
getCheckedKeys
()
// const halfCheckedNodes = this.$refs[`tree${index}`][0].getHalfCheckedNodes()
// const nodes = checkedNodes
// .concat(halfCheckedNodes)
checkedNodes
.
forEach
(
i
=>
{
if
(
i
.
parentId
)
{
if
(
!
checkedKeys
.
includes
(
i
.
parentId
))
{
this
.
flag
=
false
return
false
}
}
})
if
(
!
this
.
flag
)
return
const
menuIdList
=
checkedNodes
.
filter
(
item
=>
item
.
logo
===
'menu'
).
map
(
i
=>
i
.
id
)
// 全选菜单idlist
const
partSelectList
=
halfCheckedNodes
.
filter
(
item
=>
item
.
logo
===
'menu'
).
map
(
i
=>
i
.
id
)
// 半选菜单idlist
const
functionIdList
=
n
odes
.
filter
(
item
=>
item
.
logo
===
'function'
)
const
functionValueIdLists
=
n
odes
.
filter
(
item
=>
item
.
logo
===
'functionValue'
)
//
const partSelectList = halfCheckedNodes.filter(item => item.logo === 'menu').map(i => i.id) // 半选菜单idlist
const
functionIdList
=
checkedN
odes
.
filter
(
item
=>
item
.
logo
===
'function'
)
const
functionValueIdLists
=
checkedN
odes
.
filter
(
item
=>
item
.
logo
===
'functionValue'
)
var
list
=
[]
/** { menuId, id, functionValue} */
if
(
functionValueIdLists
.
length
!==
0
)
{
...
...
@@ -406,7 +371,7 @@ export default {
const
obj
=
{
productId
:
item
.
dictValue
,
menuIdList
:
menuIdList
,
partSelectList
:
partSelectList
,
partSelectList
:
[]
,
functionIdList
:
list
}
requestList
.
push
(
obj
)
...
...
@@ -441,7 +406,6 @@ export default {
requestList
:
requestList
}
if
(
requestList
.
length
!=
0
)
{
// this.authVisibleChange(false)
this
.
activeName
=
requestList
[
0
].
dictLabel
const
productId
=
requestList
.
map
(
item
=>
item
.
dictValue
)
const
params
=
{
productId
}
...
...
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