Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
confucius
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
罗超
confucius
Commits
f3135500
Commit
f3135500
authored
Sep 18, 2021
by
Mac
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
ff0cd97c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
104 additions
and
25 deletions
+104
-25
choiceapprovalorbranch.vue
...se/customer/CSChild/components/choiceapprovalorbranch.vue
+104
-25
No files found.
src/pages/enterprise/customer/CSChild/components/choiceapprovalorbranch.vue
View file @
f3135500
...
@@ -29,7 +29,7 @@
...
@@ -29,7 +29,7 @@
<q-card-section
class=
"row items-center q-pb-none "
>
<q-card-section
class=
"row items-center q-pb-none "
>
<div
class=
"text-h6"
>
选择企业成员
</div>
<div
class=
"text-h6"
>
选择企业成员
</div>
<q-space
/>
<q-space
/>
<q-btn
icon=
"close"
flat
round
dense
v-close-popup
/>
<q-btn
icon=
"close"
flat
round
dense
v-close-popup
@
click=
"closeEditOrder"
/>
</q-card-section>
</q-card-section>
<q-separator
/>
<q-separator
/>
<q-card-section
class=
"q-pt-none"
style=
"padding: 20px 0;"
>
<q-card-section
class=
"q-pt-none"
style=
"padding: 20px 0;"
>
...
@@ -47,7 +47,7 @@
...
@@ -47,7 +47,7 @@
<div
style=
"width: 300px; margin: 0 20px;"
>
<div
style=
"width: 300px; margin: 0 20px;"
>
<p
style=
"margin: 0 0 20px 0;"
>
已选:
</p>
<p
style=
"margin: 0 0 20px 0;"
>
已选:
</p>
<div
class=
"Approval_yxList"
>
<div
class=
"Approval_yxList"
>
<li
v-for=
"item in
showMember
"
>
{{
item
.
DeptName
}}
<li
v-for=
"item in
newList
"
>
{{
item
.
DeptName
}}
<i
@
click=
"mySetCheckedKeys(item.DeptId)"
<i
@
click=
"mySetCheckedKeys(item.DeptId)"
class=
"el-icon-circle-close showMemberIcon"
></i>
class=
"el-icon-circle-close showMemberIcon"
></i>
</li>
</li>
...
@@ -80,12 +80,12 @@
...
@@ -80,12 +80,12 @@
type
:
String
,
type
:
String
,
default
:
''
,
default
:
''
,
},
},
byval
:{
byval
:
{
type
:
Array
,
type
:
Array
,
default
:
[],
default
:
[],
},
},
cptype
:{
//1是列表上使用2 新增使用
cptype
:
{
//1是列表上使用2 新增使用
type
:
String
,
type
:
String
,
default
:
'1'
,
default
:
'1'
,
}
}
...
@@ -104,14 +104,16 @@
...
@@ -104,14 +104,16 @@
showMember
:
[],
showMember
:
[],
memberSetCheckedKeys
:
[],
memberSetCheckedKeys
:
[],
sysUserKeys
:
[],
sysUserKeys
:
[],
newList
:[]
newList
:
[]
}
}
},
},
created
()
{
created
()
{
if
(
this
.
byval
.
length
>
0
){
this
.
IsShow
=
true
if
(
this
.
byval
.
length
>
0
)
{
this
.
memberSetCheckedKeys
=
[];
this
.
memberSetCheckedKeys
=
[];
this
.
showMember
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
byval
))
this
.
showMember
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
byval
))
this
.
byval
.
forEach
(
x
=>
{
this
.
newList
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
byval
))
this
.
byval
.
forEach
(
x
=>
{
this
.
memberSetCheckedKeys
.
push
(
x
.
DeptId
)
this
.
memberSetCheckedKeys
.
push
(
x
.
DeptId
)
})
})
}
}
...
@@ -143,9 +145,9 @@
...
@@ -143,9 +145,9 @@
if
(
!
value
)
return
true
;
if
(
!
value
)
return
true
;
return
data
.
DeptName
.
indexOf
(
value
)
!==
-
1
;
return
data
.
DeptName
.
indexOf
(
value
)
!==
-
1
;
},
},
handleNodeChange
(
data
,
checked
)
{
handleNodeChange
(
data
,
checked
)
{
console
.
log
(
data
,
checked
)
//
console.log(data,checked)
data
.
IsCheck
=
checked
;
data
.
IsCheck
=
checked
;
if
(
data
.
DataType
==
2
&&
data
.
IsCheck
)
{
//是员工且选中
if
(
data
.
DataType
==
2
&&
data
.
IsCheck
)
{
//是员工且选中
let
isExsit
=
false
let
isExsit
=
false
...
@@ -156,11 +158,7 @@
...
@@ -156,11 +158,7 @@
}
}
})
})
if
(
!
isExsit
)
{
if
(
!
isExsit
)
{
this
.
showMember
.
push
({
this
.
showMember
.
push
(
data
)
DeptName
:
data
.
DeptName
,
DeptId
:
data
.
DeptId
,
DataType
:
data
.
DataType
})
this
.
memberSetCheckedKeys
.
push
(
data
.
DeptId
)
this
.
memberSetCheckedKeys
.
push
(
data
.
DeptId
)
}
}
}
else
if
(
data
.
DataType
==
2
&&
!
data
.
IsCheck
)
{
}
else
if
(
data
.
DataType
==
2
&&
!
data
.
IsCheck
)
{
...
@@ -175,6 +173,7 @@
...
@@ -175,6 +173,7 @@
if
(
data
.
DataType
!=
2
&&
data
.
IsCheck
)
{
if
(
data
.
DataType
!=
2
&&
data
.
IsCheck
)
{
if
(
this
.
memberSetCheckedKeys
.
findIndex
(
item
=>
item
===
data
.
DeptId
)
==
-
1
)
{
if
(
this
.
memberSetCheckedKeys
.
findIndex
(
item
=>
item
===
data
.
DeptId
)
==
-
1
)
{
this
.
memberSetCheckedKeys
.
push
(
data
.
DeptId
)
this
.
memberSetCheckedKeys
.
push
(
data
.
DeptId
)
this
.
showMember
.
push
(
data
)
}
}
}
else
if
(
data
.
DataType
==
2
&&
!
data
.
IsCheck
)
{
}
else
if
(
data
.
DataType
==
2
&&
!
data
.
IsCheck
)
{
if
(
this
.
memberSetCheckedKeys
.
findIndex
(
item
=>
item
===
data
.
DeptId
)
!=
-
1
)
{
if
(
this
.
memberSetCheckedKeys
.
findIndex
(
item
=>
item
===
data
.
DeptId
)
!=
-
1
)
{
...
@@ -183,20 +182,49 @@
...
@@ -183,20 +182,49 @@
this
.
memberSetCheckedKeys
.
splice
(
this
.
memberSetCheckedKeys
.
findIndex
(
item
=>
item
===
data
.
ParentId
),
1
)
this
.
memberSetCheckedKeys
.
splice
(
this
.
memberSetCheckedKeys
.
findIndex
(
item
=>
item
===
data
.
ParentId
),
1
)
}
}
}
}
}
else
if
(
data
.
DataType
!=
2
&&
!
data
.
IsCheck
)
{
if
(
this
.
memberSetCheckedKeys
.
findIndex
(
item
=>
item
===
data
.
DeptId
)
!=
-
1
)
{
this
.
showMember
.
splice
(
this
.
showMember
.
findIndex
(
item
=>
item
.
DeptId
===
data
.
DeptId
),
1
)
this
.
memberSetCheckedKeys
.
splice
(
this
.
memberSetCheckedKeys
.
findIndex
(
item
=>
item
===
data
.
DeptId
),
1
)
if
(
this
.
showMember
.
findIndex
(
item
=>
item
.
DeptId
===
data
.
ParentId
)
!=
-
1
)
{
this
.
memberSetCheckedKeys
.
splice
(
this
.
memberSetCheckedKeys
.
findIndex
(
item
=>
item
===
data
.
ParentId
),
1
)
}
}
}
}
},
},
btncheck
(){
//对数据的处理
btncheck
()
{
//对数据的处理
this
.
getdataprocess
()
this
.
newList
=
[]
// console.log(this.memberList)
this
.
memberList
.
forEach
(
x
=>
{
if
(
x
.
IsCheck
==
true
)
{
this
.
newList
.
push
(
x
)
}
else
{
this
.
getChildList
(
x
.
ChildList
)
}
})
// console.log(this.newList)
},
},
getdataprocess
(){
getChildList
(
ChildList
)
{
ChildList
.
forEach
(
x
=>
{
if
(
x
.
IsCheck
==
true
)
{
this
.
newList
.
push
(
x
)
}
else
{
this
.
getChildList
(
x
.
ChildList
)
}
})
},
},
getChildList
(
x
,
list
){
arrayUnique
(
arr
,
id
)
{
//数组去重
var
hash
=
{};
return
arr
.
reduce
(
function
(
item
,
next
)
{
hash
[
next
[
id
]]
?
''
:
hash
[
next
[
id
]]
=
true
&&
item
.
push
(
next
);
return
item
;
},
[]);
},
},
mySetCheckedKeys
(
id
)
{
mySetCheckedKeys
(
id
)
{
console
.
log
(
id
)
console
.
log
(
this
.
memberSetCheckedKeys
)
if
(
this
.
memberSetCheckedKeys
.
length
==
0
)
if
(
this
.
memberSetCheckedKeys
.
length
==
0
)
return
return
if
(
id
==
-
1
)
{
if
(
id
==
-
1
)
{
...
@@ -205,15 +233,66 @@
...
@@ -205,15 +233,66 @@
}
}
this
.
showMember
.
splice
(
this
.
showMember
.
findIndex
(
item
=>
item
.
DeptId
===
id
),
1
)
this
.
showMember
.
splice
(
this
.
showMember
.
findIndex
(
item
=>
item
.
DeptId
===
id
),
1
)
this
.
memberSetCheckedKeys
.
splice
(
this
.
memberSetCheckedKeys
.
findIndex
(
item
=>
item
===
id
),
1
)
this
.
memberSetCheckedKeys
.
splice
(
this
.
memberSetCheckedKeys
.
findIndex
(
item
=>
item
===
id
),
1
)
this
.
qudiaoziji
(
id
)
console
.
log
(
this
.
memberSetCheckedKeys
)
this
.
newList
.
splice
(
this
.
newList
.
findIndex
(
item
=>
item
.
DeptId
===
id
),
1
)
this
.
$refs
.
treeUser
.
setCheckedKeys
(
this
.
memberSetCheckedKeys
);
this
.
$refs
.
treeUser
.
setCheckedKeys
(
this
.
memberSetCheckedKeys
);
},
},
qudiaoziji
(
id
)
{
this
.
memberList
.
forEach
(
x
=>
{
if
(
x
.
DeptId
==
id
)
{
let
obj
=
[]
if
(
x
.
ChildList
&&
x
.
ChildList
.
length
>
0
)
{
x
.
ChildList
.
forEach
(
j
=>
{
obj
.
push
(
j
.
DeptId
)
})
this
.
memberSetCheckedKeys
=
this
.
arrayWeightRemoval
(
this
.
memberSetCheckedKeys
,
obj
)
}
}
else
{
this
.
qudiaoziji_t
(
x
.
ChildList
,
id
)
}
})
},
arrayWeightRemoval
(
array1
,
array2
)
{
//临时数组存放
var
tempArray1
=
[];
//临时数组1
var
tempArray2
=
[];
//临时数组2
for
(
var
i
=
0
;
i
<
array2
.
length
;
i
++
)
{
tempArray1
[
array2
[
i
]]
=
true
;
//将数array2 中的元素值作为tempArray1 中的键,值为true;
}
for
(
var
i
=
0
;
i
<
array1
.
length
;
i
++
)
{
if
(
!
tempArray1
[
array1
[
i
]])
{
tempArray2
.
push
(
array1
[
i
]);
//过滤array1 中与array2 相同的元素;
}
}
return
tempArray2
;
},
qudiaoziji_t
(
ChildList
,
id
)
{
ChildList
.
forEach
(
x
=>
{
if
(
x
.
DeptId
==
id
)
{
let
obj
=
[]
if
(
x
.
ChildList
&&
x
.
ChildList
.
length
>
0
)
{
x
.
ChildList
.
forEach
(
j
=>
{
obj
.
push
(
j
.
DeptId
)
})
this
.
memberSetCheckedKeys
=
this
.
arrayWeightRemoval
(
this
.
memberSetCheckedKeys
,
obj
)
}
}
else
{
this
.
qudiaoziji_t
(
x
.
ChildList
,
id
)
}
})
},
//关闭弹窗
//关闭弹窗
closeEditOrder
()
{
closeEditOrder
()
{
this
.
$emit
(
'close'
)
this
.
$emit
(
'close'
)
},
},
saveOrderInfo
()
{
saveOrderInfo
()
{
this
.
$emit
(
'success'
,
this
.
showMember
,
this
.
cptype
)
this
.
$emit
(
'success'
,
this
.
newList
,
this
.
cptype
)
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment