Commit 6c582b00 authored by zhengke's avatar zhengke

修改

parent 370b8363
......@@ -20,7 +20,7 @@ export default {
</script>
<style>
@import url("//at.alicdn.com/t/font_2077629_ou0hmd4zmr8.css");
@import url("//at.alicdn.com/t/font_2077629_wob6liq2kxn.css");
.q-scrollarea__thumb {
z-index: 999999 !important;
}
......
<style>
.TreeCked {
margin: 20px 20px 0 20px;
color: #A8A8B3;
font-size: 14px;
}
.SendContent {
display: flex;
height: 450px;
}
.SendOne_Left {
width: 60%;
}
.SendOne_Right {
width: 40%;
}
.object_tit {
font-size: 14px;
color: #A8A8B3;
line-height: 35px;
margin-top: 12px;
overflow: hidden;
padding-right: 30px;
display: flex;
justify-content: space-between;
}
.object_tit span {
display: inline-block;
}
.objectList {
width: 100%;
height: 380px;
overflow: auto;
outline: none;
margin-right: 15px;
}
.objectList::-webkit-scrollbar {
width: 3px;
height: 3px;
background-color: #F5F5F5;
}
/*!*定义滚动条轨道 内阴影+圆角*!*/
.objectList::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
border-radius: 10px;
background-color: #F5F5F5;
}
/*!*定义滑块 内阴影+圆角*!*/
.objectList::-webkit-scrollbar-thumb {
border-radius: 10px;
-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;
}
.objectList ul {
padding: 0;
}
.objectList ul li {
list-style-type: none;
}
.objectList ul li div {
height: 40px;
line-height: 40px;
font-size: 14px;
cursor: pointer;
position: relative;
z-index: 3;
}
.objectList ul li a {
display: block;
padding-left: 16px;
width: 80%;
white-space: nowrap;
text-overflow: ellipsis;
-o-text-overflow: ellipsis;
overflow: hidden;
float: left;
height: 40px;
line-height: 40px;
font-size: 14px;
color: #181E33;
text-decoration: none;
}
.objectList ul li a i {
color: #cad5e6;
}
.manageTitl:hover {
background: #F7FAFC;
}
.stuChilden {
display: none;
overflow-y: auto;
}
.showChild {
display: block;
}
.selectedCon{
height:380px;
overflow: auto;
}
.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;
}
.selectedCon ul li i{
font-size:18px;
cursor: pointer;
display: none;
}
.selectedCon ul li:hover i{
display: block;
}
.selectedCon ul li:hover{
background-color: #F7FAFC;
}
.selectedCon::-webkit-scrollbar {
width: 3px;
height: 3px;
background-color: #F5F5F5;
}
/*!*定义滚动条轨道 内阴影+圆角*!*/
.selectedCon::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
border-radius: 10px;
background-color: #F5F5F5;
}
/*!*定义滑块 内阴影+圆角*!*/
.selectedCon::-webkit-scrollbar-thumb {
border-radius: 10px;
-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">
<q-card style="width: 850px;max-width:900px;">
<q-card style="width: 800px;max-width:900px;">
<q-card-section>
<div class="text-h6">选择学员</div>
</q-card-section>
......@@ -21,9 +180,58 @@
</div>
</div>
<q-card-section class="q-pt-none scroll" style="max-height: 50vh">
<el-tree :data="dataList" show-checkbox node-key="GuestId" ref="classStuTree" highlight-current
<!-- <el-tree :data="dataList" show-checkbox node-key="GuestId" @check-change="handleCheckChange" ref="classStuTree" highlight-current
:props="defaultProps">
</el-tree>
</el-tree> -->
<div class="SendContent">
<div class="SendOne_Left">
<div class="object_tit">
<span>班级/学生</span>
<span>全选</span>
</div>
<div class="objectList">
<ul>
<li v-for="(item,index) in dataList" :key="index">
<div class="manageTitl" @click="getChildShow(item)">
<a href="javascript:;" :title="item.Name">
<i class="iconfont icon-arrow-down" v-if="item.isShowChild"></i>
<i class="iconfont icon-arrow-right3" v-else></i>
{{item.Name}}
</a>
<span style="float:right;margin-right:35px;">
<el-checkbox v-model="item.IsCheck" @change="getFatherCheck(item)"></el-checkbox>
</span>
</div>
<ul class="stuChilden" :class="{'showChild':item.isShowChild}">
<li v-for="(subItem,subIndex) in item.SubList" :key="subIndex">
<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>
</div>
</div>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="SendOne_Right">
<div class="TreeCked">
已选 {{checkedStu.length}}
</div>
<div class="selectedCon">
<ul>
<li v-for="(item,index) in checkedStu" :key="index">
<div>{{item.Name}}</div>
<div>
<i class="iconfont icon-shanchu2" @click="delChecked(index)"></i>
</div>
</li>
</ul>
</div>
</div>
</div>
</q-card-section>
<q-separator />
<q-card-actions align="right" class="bg-white">
......@@ -38,6 +246,12 @@
queryClassStudentTree,
} from '../../api/course/class';
export default {
props: {
sendStudent: {
type: Array,
default: null
}
},
data() {
return {
persistent: true,
......@@ -52,12 +266,80 @@
}, //查询参数
loading: false, //表格加载进度条
dataList: [], //数据列表
checkedStu: [], //选中数据
checked: false
}
},
mounted() {
this.getClassStudentTree();
},
methods: {
//点击父级全选
getFatherCheck(item){
if(item.IsCheck){
item.SubList.forEach(y=>{
y.IsCheck=true;
})
}else{
item.SubList.forEach(y=>{
y.IsCheck=false;
})
}
this.getCkedChild();
},
//点击子选项
getchildCheck(item,index,subItem){
let num=0;
item.SubList.forEach(x=>{
if(x.IsCheck){
num++
}
})
if(num==item.SubList.length){
item.IsCheck=true;
}else{
item.IsCheck=false;
}
this.getCkedChild();
},
//删除选中名单
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;
}
})
if(y.IsCheck){
num++
}
})
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);
}
})
})
},
//重新查询
research() {
this.getClassStudentTree();
......@@ -67,6 +349,13 @@
queryClassStudentTree(this.msg).then(res => {
if (res.Code == 1) {
this.dataList = res.Data;
this.dataList.forEach(x => {
x.isShowChild = false;
})
if(this.sendStudent&&this.sendStudent.length>0){
this.checkedStu = this.sendStudent;
this.getLeftChecked();
}
}
})
},
......@@ -74,19 +363,35 @@
closeSaveForm() {
this.$emit('close')
},
//确认选择
sureQuestionBank() {
var tempArray = [];
handleCheckChange(checked) {
this.checkedStu = [];
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.checkedStu.push(item);
}
})
}
this.$emit('success', tempArray);
},
//确认选择
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);
},
//点击父级
getChildShow(item) {
item.isShowChild = !item.isShowChild;
this.$forceUpdate();
}
},
}
......
......@@ -231,7 +231,7 @@
<div class="row">
<q-btn color="accent" @click="setPublishExam" class="q-mr-md" label="发布考试"  />
</div>
<classstutreeForm v-if="isShowClassStu"  @close="closeClassStuForm"  @success="getClassStuList">
<classstutreeForm v-if="isShowClassStu" :sendStudent="sendStudent"  @close="closeClassStuForm"  @success="getClassStuList">
</classstutreeForm>
</div>
</template>
......@@ -282,6 +282,7 @@
},
isShowClassStu: false, //是否显示学员弹窗
sendStudent:[], //传送已选学生
}
},
created() {
......@@ -295,6 +296,23 @@
},
mounted() {
},
watch:{
"postMsg.StudentList":{
handler(val){
this.sendStudent = [];
val.forEach(x=>{
let obj={
ClassId:x.ClassId,
CourseId:x.CourseId,
GuestId:x.GuestId,
Name:x.GuestName,
OrderId:x.OrderId
}
this.sendStudent.push(obj);
})
}
}
},
methods: {
//删除发放对象
......@@ -305,7 +323,6 @@
queryExamPublish({
Id: this.postMsg.Id
}).then(res => {
console.log("res", res);
if (res.Code == 1) {
var tempData = res.Data;
if (tempData) {
......@@ -347,6 +364,7 @@
},
//获取选中的需要列表
getClassStuList(array) {
this.postMsg.StudentList=[];
if (array && array.length > 0) {
array.forEach(item => {
this.postMsg.StudentList.push({
......
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