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
f7caed24
Commit
f7caed24
authored
Aug 19, 2021
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
5b2427d1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
103 additions
and
90 deletions
+103
-90
classstutree-form.vue
src/components/exam/classstutree-form.vue
+103
-90
No files found.
src/components/exam/classstutree-form.vue
View file @
f7caed24
...
...
@@ -110,33 +110,40 @@
.showChild
{
display
:
block
;
}
.selectedCon
{
height
:
380px
;
.selectedCon
{
height
:
380px
;
overflow
:
auto
;
}
.selectedCon
ul
{
margin
:
0
;
padding
:
0
;
.selectedCon
ul
{
margin
:
0
;
padding
:
0
;
}
.selectedCon
ul
li
{
height
:
50px
;
display
:
flex
;
align-items
:
center
;
justify-content
:
space-between
;
padding
:
0
20px
;
margin-left
:
8px
;
padding
:
0
20px
;
margin-left
:
8px
;
}
.selectedCon
ul
li
i
{
font-size
:
18px
;
.selectedCon
ul
li
i
{
font-size
:
18px
;
cursor
:
pointer
;
display
:
none
;
}
.selectedCon
ul
li
:hover
i
{
.selectedCon
ul
li
:hover
i
{
display
:
block
;
}
.selectedCon
ul
li
:hover
{
.selectedCon
ul
li
:hover
{
background-color
:
#F7FAFC
;
}
.selectedCon
::-webkit-scrollbar
{
width
:
3px
;
height
:
3px
;
...
...
@@ -156,6 +163,7 @@
-webkit-box-shadow
:
-webkit-gradient
(
linear
,
0
0
,
0
100%
,
color-stop
(
.5
,
rgba
(
255
,
255
,
255
,
.2
)),
color-stop
(
.5
,
transparent
),
to
(
transparent
));
background-color
:
#0ae
;
}
</
style
>
<
template
>
<q-dialog
v-model=
"persistent"
content-class=
"bg-grey-1"
persistent
transition-show=
"scale"
transition-hide=
"scale"
>
...
...
@@ -204,7 +212,8 @@
<div
class=
"manageTitl"
style=
"display:flex;justify-content:space-between;"
>
<div
style=
"padding-left:40px;"
>
{{
subItem
.
Name
}}
</div>
<div
style=
"padding-right:35px;"
>
<el-checkbox
v-model=
"subItem.IsCheck"
@
change=
"getchildCheck(item,index,subItem)"
></el-checkbox>
<el-checkbox
v-model=
"subItem.IsCheck"
@
change=
"getchildCheck(item)"
>
</el-checkbox>
</div>
</div>
</li>
...
...
@@ -222,7 +231,7 @@
<li
v-for=
"(item,index) in checkedStu"
:key=
"index"
>
<div>
{{
item
.
Name
}}
</div>
<div>
<i
class=
"iconfont icon-shanchu2"
@
click=
"delChecked(index)"
></i>
<i
class=
"iconfont icon-shanchu2"
@
click=
"delChecked(i
tem,i
ndex)"
></i>
</div>
</li>
</ul>
...
...
@@ -271,71 +280,50 @@
this
.
getClassStudentTree
();
},
methods
:
{
//点击父级全选
getFatherCheck
(
item
){
if
(
item
.
IsCheck
){
item
.
SubList
.
forEach
(
y
=>
{
y
.
IsCheck
=
true
;
})
}
else
{
item
.
SubList
.
forEach
(
y
=>
{
y
.
IsCheck
=
false
;
//点击父级全选或取消
getFatherCheck
(
item
)
{
if
(
item
&&
item
.
SubList
&&
item
.
SubList
.
length
>
0
)
{
item
.
SubList
.
forEach
(
y
=>
{
y
.
IsCheck
=
item
.
IsCheck
;
})
}
this
.
getCkedChil
d
();
this
.
setStuChecke
d
();
},
//点击子选项
getchildCheck
(
item
,
index
,
subItem
){
let
num
=
0
;
item
.
SubList
.
forEach
(
x
=>
{
if
(
x
.
IsCheck
){
num
++
//点击子节点选中或取消
getchildCheck
(
item
)
{
let
num
=
0
;
if
(
item
&&
item
.
SubList
&&
item
.
SubList
.
length
>
0
)
{
item
.
SubList
.
forEach
(
x
=>
{
if
(
x
.
IsCheck
)
{
num
++
}
})
if
(
num
==
item
.
SubList
.
length
)
{
item
.
IsCheck
=
true
;
}
else
{
item
.
IsCheck
=
false
;
}
})
if
(
num
==
item
.
SubList
.
length
){
item
.
IsCheck
=
true
;
}
else
{
item
.
IsCheck
=
false
;
}
this
.
getCkedChil
d
();
this
.
setStuChecke
d
();
},
//删除选中名单
delChecked
(
index
){
this
.
checkedStu
.
splice
(
index
,
1
);
this
.
getLeftChecked
();
},
//删除后重新勾选左侧
getLeftChecked
(){
this
.
dataList
.
forEach
(
x
=>
{
let
num
=
0
;
x
.
SubList
.
forEach
(
y
=>
{
y
.
IsCheck
=
false
;
this
.
checkedStu
.
forEach
(
z
=>
{
if
(
z
.
GuestId
==
y
.
GuestId
){
y
.
IsCheck
=
true
;
delChecked
(
item
,
index
)
{
this
.
checkedStu
.
splice
(
index
,
1
);
this
.
dataList
.
forEach
(
rootItem
=>
{
if
(
rootItem
.
SubList
&&
rootItem
.
SubList
.
length
>
0
)
{
var
chooseClassId
=
0
;
rootItem
.
SubList
.
forEach
(
sItem
=>
{
if
(
sItem
.
GuestId
==
item
.
GuestId
)
{
sItem
.
IsCheck
=
false
;
chooseClassId
=
sItem
.
ClassId
}
})
if
(
y
.
IsCheck
)
{
num
++
if
(
chooseClassId
>
0
&&
chooseClassId
==
rootItem
.
ClassId
)
{
rootItem
.
IsCheck
=
false
;
}
})
if
(
num
==
x
.
SubList
.
length
){
x
.
IsCheck
=
true
;
}
else
{
x
.
IsCheck
=
false
;
}
})
},
//装进右侧选中方法
getCkedChild
(){
this
.
checkedStu
=
[];
this
.
dataList
.
forEach
(
x
=>
{
x
.
SubList
.
forEach
(
y
=>
{
if
(
y
.
IsCheck
){
this
.
checkedStu
.
push
(
y
);
}
})
})
this
.
setStuChecked
();
},
//重新查询
research
()
{
...
...
@@ -349,40 +337,57 @@
this
.
dataList
.
forEach
(
x
=>
{
x
.
isShowChild
=
false
;
})
if
(
this
.
sendStudent
&&
this
.
sendStudent
.
length
>
0
){
this
.
checkedStu
=
this
.
sendStudent
;
this
.
getLeftChecked
();
}
console
.
log
(
this
.
checkedStu
,
'checkedStu'
);
this
.
initStuCheck
();
}
})
},
//关闭弹窗
closeSaveForm
()
{
this
.
$emit
(
'close'
)
},
handleCheckChange
(
checked
)
{
//设置选中或取消选中
setStuChecked
()
{
this
.
checkedStu
=
[];
var
checkArray
=
this
.
$refs
.
classStuTree
.
getCheckedNodes
();
if
(
checkArray
&&
checkArray
.
length
>
0
)
{
checkArray
.
forEach
(
item
=>
{
if
(
item
.
SubList
&&
item
.
SubList
.
length
>
0
)
{}
else
{
this
.
checkedStu
.
push
(
item
);
if
(
this
.
dataList
&&
this
.
dataList
.
length
>
0
)
{
this
.
dataList
.
forEach
(
rootItem
=>
{
if
(
rootItem
.
SubList
&&
rootItem
.
SubList
.
length
>
0
)
{
rootItem
.
SubList
.
forEach
(
sItem
=>
{
if
(
sItem
.
IsCheck
)
{
this
.
checkedStu
.
push
(
sItem
);
}
})
}
})
}
},
//初始化选中
initStuCheck
()
{
if
(
this
.
sendStudent
)
{
if
(
this
.
sendStudent
&&
this
.
sendStudent
.
length
>
0
&&
this
.
dataList
&&
this
.
dataList
.
length
>
0
)
{
this
.
dataList
.
forEach
(
rootItem
=>
{
if
(
rootItem
.
SubList
&&
rootItem
.
SubList
.
length
>
0
)
{
var
num
=
0
;
rootItem
.
SubList
.
forEach
(
sItem
=>
{
this
.
sendStudent
.
forEach
(
item
=>
{
if
(
sItem
.
GuestId
==
item
.
GuestId
)
{
sItem
.
IsCheck
=
true
;
num
++
;
this
.
checkedStu
.
push
(
sItem
);
}
})
})
if
(
num
==
rootItem
.
SubList
.
length
)
{
rootItem
.
IsCheck
=
true
;
}
else
{
rootItem
.
IsCheck
=
false
;
}
}
})
}
}
},
//关闭弹窗
closeSaveForm
()
{
this
.
$emit
(
'close'
)
},
//确认选择
sureQuestionBank
()
{
// var tempArray = [];
// var checkArray = this.$refs.classStuTree.getCheckedNodes();
// if (checkArray && checkArray.length > 0) {
// checkArray.forEach(item => {
// if (item.SubList && item.SubList.length > 0) {} else {
// tempArray.push(item);
// }
// })
// }
this
.
$emit
(
'success'
,
this
.
checkedStu
);
},
//点击父级
...
...
@@ -391,6 +396,14 @@
this
.
$forceUpdate
();
}
},
watch
:
{
sendStudent
:
{
handler
(
newValue
)
{
this
.
initStuCheck
();
},
deep
:
true
},
}
}
</
script
>
...
...
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