dev_cs
杨树明 5 years ago
parent 664777d571
commit 83c8080430

@ -1,6 +1,6 @@
import React, { Component } from 'react';
import { Modal , Radio , Table , Pagination , Select ,Divider ,Icon , Input } from "antd";
import { Modal , Radio , Table , Pagination , Select ,Divider ,Icon , Input,Checkbox } from "antd";
import {Link} from 'react-router-dom'
import axios from 'axios';
@ -87,6 +87,16 @@ const bindTableColumn=(that)=>{
}
})
}
if(course_groups&&course_groups.length===0){
columns.some((item,key)=> {
if (item.title === "分班") {
columns.splice(key, 1)
return true
}
}
)
}
return columns;
}
class GraduationAcross extends Component{
@ -211,6 +221,7 @@ class GraduationAcross extends Component{
// 下拉切换
changeSelect = (AcrossTeamIds) =>{
console.log(AcrossTeamIds)
this.setState({
AcrossTeamIds
})
@ -274,6 +285,7 @@ class GraduationAcross extends Component{
// 下拉搜索
changeSearchValue=(e)=>{
this.setState({
searchValue:e.target.value
})
@ -285,7 +297,32 @@ class GraduationAcross extends Component{
})
}
checkonChange=(e,list)=>{
let newlist=[]
// AcrossTeamIds
let {comment_status}=this.state;
if(e.target.checked===true){
if(comment_status===2){
list.map((item,key)=>{
newlist.push(String(item.user_id))
})
this.setState({
AcrossTeamIds:newlist
})
}else{
list.map((item,key)=>{
newlist.push(String(item.id))
})
this.setState({
AcrossTeamIds:newlist
})
}
}else{
this.setState({
AcrossTeamIds:undefined
})
}
}
render(){
let {
comment_status,
@ -331,9 +368,10 @@ class GraduationAcross extends Component{
}),
};
// 筛选下拉列表
const teacherList = searchValue ? teachers.filter(e=>e.user_name.indexOf(searchValue)>-1) : teachers;
const course_groupsList = searchValue ? course_groups.filter(e=>e.name.indexOf(searchValue)>-1) : course_groups;
const teacherList = searchValue ? teachers&&teachers.filter(e=>e.user_name.indexOf(searchValue)>-1) : teachers;
const course_groupsList = searchValue ? course_groups&&course_groups.filter(e=>e.name.indexOf(searchValue)>-1) : course_groups;
return(
<Modal
className={"AcrossModal"}
@ -347,7 +385,7 @@ class GraduationAcross extends Component{
{modalVisible===true?<style>
{
`
bady{
body{
overflow: hidden !important;
}
`
@ -407,6 +445,9 @@ class GraduationAcross extends Component{
white-space: nowrap;
text-overflow: ellipsis;
}
.pd8px{
padding: 8px;
}
`}
</style>
<div className="pt20 pl30 pr30 acrossHead">
@ -436,7 +477,7 @@ class GraduationAcross extends Component{
onFocus={()=>this.changeFlag(true)}
dropdownRender={menu => (
<div id="selectDropdown">
<div className="padding10-20">
{comment_status == 2 &&teachers&&teachers.length>10?<div className="padding10-20">
<Input
type='input'
value={searchValue}
@ -445,7 +486,19 @@ class GraduationAcross extends Component{
style={{height:"30px"}}
className="searchInput"
></Input>
</div>
</div>:""}
{comment_status != 2 &&course_groups&&course_groups.length>10?<div className="padding10-20">
<Input
type='input'
value={searchValue}
onChange={this.changeSearchValue}
placeholder='请输入名称搜索'
style={{height:"30px"}}
className="searchInput"
></Input>
</div>:""}
{comment_status == 2 &&teacherList&&teacherList.length>2? <Checkbox className={"pd8px"} onChange={(e)=>this.checkonChange(e,teacherList)}>全选</Checkbox>:""}
{comment_status != 2 &&course_groupsList&&course_groupsList.length>2? <Checkbox className={"pd8px"} onChange={(e)=>this.checkonChange(e,course_groupsList)}>全选</Checkbox>:""}
{menu}
<Divider style={{ margin: '4px 0 0' }} />
<div style={{ padding: '8px 12px', cursor: 'pointer' }}>

Loading…
Cancel
Save