Commit f7caed24 authored by 黄奎's avatar 黄奎

页面修改

parent 5b2427d1
...@@ -110,33 +110,40 @@ ...@@ -110,33 +110,40 @@
.showChild { .showChild {
display: block; display: block;
} }
.selectedCon{
height:380px; .selectedCon {
height: 380px;
overflow: auto; overflow: auto;
} }
.selectedCon ul{
margin:0; .selectedCon ul {
padding:0; margin: 0;
padding: 0;
} }
.selectedCon ul li { .selectedCon ul li {
height: 50px; height: 50px;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
padding:0 20px; padding: 0 20px;
margin-left:8px; margin-left: 8px;
} }
.selectedCon ul li i{
font-size:18px; .selectedCon ul li i {
font-size: 18px;
cursor: pointer; cursor: pointer;
display: none; display: none;
} }
.selectedCon ul li:hover i{
.selectedCon ul li:hover i {
display: block; display: block;
} }
.selectedCon ul li:hover{
.selectedCon ul li:hover {
background-color: #F7FAFC; background-color: #F7FAFC;
} }
.selectedCon::-webkit-scrollbar { .selectedCon::-webkit-scrollbar {
width: 3px; width: 3px;
height: 3px; height: 3px;
...@@ -156,6 +163,7 @@ ...@@ -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)); -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; background-color: #0ae;
} }
</style> </style>
<template> <template>
<q-dialog v-model="persistent" content-class="bg-grey-1" persistent transition-show="scale" transition-hide="scale"> <q-dialog v-model="persistent" content-class="bg-grey-1" persistent transition-show="scale" transition-hide="scale">
...@@ -204,7 +212,8 @@ ...@@ -204,7 +212,8 @@
<div class="manageTitl" style="display:flex;justify-content:space-between;"> <div class="manageTitl" style="display:flex;justify-content:space-between;">
<div style="padding-left:40px;">{{subItem.Name}}</div> <div style="padding-left:40px;">{{subItem.Name}}</div>
<div style="padding-right:35px;"> <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>
</div> </div>
</li> </li>
...@@ -222,7 +231,7 @@ ...@@ -222,7 +231,7 @@
<li v-for="(item,index) in checkedStu" :key="index"> <li v-for="(item,index) in checkedStu" :key="index">
<div>{{item.Name}}</div> <div>{{item.Name}}</div>
<div> <div>
<i class="iconfont icon-shanchu2" @click="delChecked(index)"></i> <i class="iconfont icon-shanchu2" @click="delChecked(item,index)"></i>
</div> </div>
</li> </li>
</ul> </ul>
...@@ -271,71 +280,50 @@ ...@@ -271,71 +280,50 @@
this.getClassStudentTree(); this.getClassStudentTree();
}, },
methods: { methods: {
//点击父级全选 //点击父级全选或取消
getFatherCheck(item){ getFatherCheck(item) {
if(item.IsCheck){ if (item && item.SubList && item.SubList.length > 0) {
item.SubList.forEach(y=>{ item.SubList.forEach(y => {
y.IsCheck=true; y.IsCheck = item.IsCheck;
})
}else{
item.SubList.forEach(y=>{
y.IsCheck=false;
}) })
} }
this.getCkedChild(); this.setStuChecked();
}, },
//点击子选项 //点击子节点选中或取消
getchildCheck(item,index,subItem){ getchildCheck(item) {
let num=0; let num = 0;
item.SubList.forEach(x=>{ if (item && item.SubList && item.SubList.length > 0) {
if(x.IsCheck){ item.SubList.forEach(x => {
if (x.IsCheck) {
num++ num++
} }
}) })
if(num==item.SubList.length){ if (num == item.SubList.length) {
item.IsCheck=true; item.IsCheck = true;
}else{ } else {
item.IsCheck=false; item.IsCheck = false;
} }
this.getCkedChild(); }
this.setStuChecked();
}, },
//删除选中名单 //删除选中名单
delChecked(index){ delChecked(item, index) {
this.checkedStu.splice(index,1); this.checkedStu.splice(index, 1);
this.getLeftChecked(); this.dataList.forEach(rootItem => {
}, if (rootItem.SubList && rootItem.SubList.length > 0) {
//删除后重新勾选左侧 var chooseClassId = 0;
getLeftChecked(){ rootItem.SubList.forEach(sItem => {
this.dataList.forEach(x=>{ if (sItem.GuestId == item.GuestId) {
let num=0; sItem.IsCheck = false;
x.SubList.forEach(y=>{ chooseClassId = sItem.ClassId
y.IsCheck=false;
this.checkedStu.forEach(z=>{
if(z.GuestId==y.GuestId){
y.IsCheck=true;
} }
}) })
if(y.IsCheck){ if (chooseClassId > 0 && chooseClassId == rootItem.ClassId) {
num++ rootItem.IsCheck = false;
} }
})
if(num==x.SubList.length){
x.IsCheck=true;
}else{
x.IsCheck=false;
} }
}) })
}, this.setStuChecked();
//装进右侧选中方法
getCkedChild(){
this.checkedStu=[];
this.dataList.forEach(x=>{
x.SubList.forEach(y=>{
if(y.IsCheck){
this.checkedStu.push(y);
}
})
})
}, },
//重新查询 //重新查询
research() { research() {
...@@ -349,40 +337,57 @@ ...@@ -349,40 +337,57 @@
this.dataList.forEach(x => { this.dataList.forEach(x => {
x.isShowChild = false; x.isShowChild = false;
}) })
if(this.sendStudent&&this.sendStudent.length>0){ this.initStuCheck();
this.checkedStu = this.sendStudent;
this.getLeftChecked();
}
console.log(this.checkedStu,'checkedStu');
} }
}) })
}, },
//关闭弹窗 //设置选中或取消选中
closeSaveForm() { setStuChecked() {
this.$emit('close')
},
handleCheckChange(checked) {
this.checkedStu = []; this.checkedStu = [];
var checkArray = this.$refs.classStuTree.getCheckedNodes(); if (this.dataList && this.dataList.length > 0) {
if (checkArray && checkArray.length > 0) { this.dataList.forEach(rootItem => {
checkArray.forEach(item => { if (rootItem.SubList && rootItem.SubList.length > 0) {
if (item.SubList && item.SubList.length > 0) {} else { rootItem.SubList.forEach(sItem => {
this.checkedStu.push(item); 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() { 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); this.$emit('success', this.checkedStu);
}, },
//点击父级 //点击父级
...@@ -391,6 +396,14 @@ ...@@ -391,6 +396,14 @@
this.$forceUpdate(); this.$forceUpdate();
} }
}, },
watch: {
sendStudent: {
handler(newValue) {
this.initStuCheck();
},
deep: true
},
}
} }
</script> </script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment