|
|
|
@ -33,55 +33,113 @@ class OneSelfOrderModal extends Component{
|
|
|
|
|
super(props);
|
|
|
|
|
this.state={
|
|
|
|
|
group_ids:[],
|
|
|
|
|
endtime:""
|
|
|
|
|
endtime:"",
|
|
|
|
|
course_groups:undefined
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
componentDidMount() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(this.props.course_groups!=undefined&&this.props.course_groups.length!=0){
|
|
|
|
|
|
|
|
|
|
let arr=this.props.course_groups.map(item => item.id);
|
|
|
|
|
if(this.props.course_groups!=undefined) {
|
|
|
|
|
let arr = this.props.course_groups.map(item => item.id);
|
|
|
|
|
let newarr = [];
|
|
|
|
|
let course_groups = this.props.course_groups;
|
|
|
|
|
course_groups.map((item, key) => {
|
|
|
|
|
if (item.end_time === null) {
|
|
|
|
|
if(this.props.starttimesend===undefined){
|
|
|
|
|
item.end_time = moment(moment(handleDateString(this.props.staytime)).add(1, 'week')).format("YYYY-MM-DD HH:mm");
|
|
|
|
|
}else{
|
|
|
|
|
item.end_time = moment(handleDateString(this.props.starttimesend)).format("YYYY-MM-DD HH:mm");
|
|
|
|
|
}
|
|
|
|
|
newarr.push(item)
|
|
|
|
|
} else {
|
|
|
|
|
newarr.push(item)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
this.setState({
|
|
|
|
|
course_groups: newarr
|
|
|
|
|
})
|
|
|
|
|
this.shixunhomeworkedit(arr);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(this.props.starttimes===undefined||this.props.starttimes===""||this.props.starttimes===null){
|
|
|
|
|
if(this.props.starttimesend===undefined){
|
|
|
|
|
this.setState({
|
|
|
|
|
endtime:moment(moment(handleDateString(this.props.staytime)).add(1, 'week')).format("YYYY-MM-DD HH:mm")
|
|
|
|
|
})
|
|
|
|
|
}else{
|
|
|
|
|
this.setState({
|
|
|
|
|
endtime:moment(handleDateString(this.props.starttimesend)).format("YYYY-MM-DD HH:mm")
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
if(this.props.starttimesend===undefined){
|
|
|
|
|
this.setState({
|
|
|
|
|
endtime:moment(moment(handleDateString(this.props.staytime)).add(1, 'months')).format("YYYY-MM-DD HH:mm")
|
|
|
|
|
endtime:moment(moment(handleDateString(this.props.staytime)).add(1, 'week')).format("YYYY-MM-DD HH:mm")
|
|
|
|
|
})
|
|
|
|
|
}else{
|
|
|
|
|
this.setState({
|
|
|
|
|
endtime:moment(handleDateString(this.props.starttimes)).format("YYYY-MM-DD HH:mm")
|
|
|
|
|
endtime:moment(handleDateString(this.props.starttimesend)).format("YYYY-MM-DD HH:mm")
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
componentDidUpdate=(prevProps)=>{
|
|
|
|
|
// if(prevProps.visible!=this.props.visible){
|
|
|
|
|
//
|
|
|
|
|
// if(this.props.course_groups!=undefined){
|
|
|
|
|
// let arr=this.props.course_groups.map(item => item.id);
|
|
|
|
|
// this.shixunhomeworkedit(arr);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
if(prevProps.course_groups!=this.props.course_groups){
|
|
|
|
|
if(this.props.course_groups!=undefined){
|
|
|
|
|
let arr=this.props.course_groups.map(item => item.id);
|
|
|
|
|
let newarr=[];
|
|
|
|
|
let course_groups=this.props.course_groups;
|
|
|
|
|
course_groups.map((item,key)=>{
|
|
|
|
|
if(item.end_time===null){
|
|
|
|
|
if(this.props.starttimesend===undefined){
|
|
|
|
|
item.end_time = moment(moment(handleDateString(this.props.staytime)).add(1, 'week')).format("YYYY-MM-DD HH:mm");
|
|
|
|
|
}else{
|
|
|
|
|
item.end_time = moment(handleDateString(this.props.starttimesend)).format("YYYY-MM-DD HH:mm");
|
|
|
|
|
}
|
|
|
|
|
newarr.push(item)
|
|
|
|
|
}else{
|
|
|
|
|
newarr.push(item)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
this.setState({
|
|
|
|
|
course_groups:newarr
|
|
|
|
|
})
|
|
|
|
|
this.shixunhomeworkedit(arr);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(prevProps.starttimes!=this.props.starttimes){
|
|
|
|
|
|
|
|
|
|
if(this.props.starttimes===undefined||this.props.starttimes===""||this.props.starttimes===null){
|
|
|
|
|
if(this.props.starttimesend===undefined){
|
|
|
|
|
this.setState({
|
|
|
|
|
endtime:moment(moment(handleDateString(this.props.staytime)).add(1, 'months')).format("YYYY-MM-DD HH:mm")
|
|
|
|
|
endtime:moment(moment(handleDateString(this.props.staytime)).add(1, 'week')).format("YYYY-MM-DD HH:mm")
|
|
|
|
|
})
|
|
|
|
|
}else{
|
|
|
|
|
this.setState({
|
|
|
|
|
endtime:moment(handleDateString(this.props.starttimes)).format("YYYY-MM-DD HH:mm")
|
|
|
|
|
endtime:moment(handleDateString(this.props.starttimesend)).format("YYYY-MM-DD HH:mm")
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
if(this.props.starttimesend===undefined){
|
|
|
|
|
this.setState({
|
|
|
|
|
endtime:moment(moment(handleDateString(this.props.staytime)).add(1, 'week')).format("YYYY-MM-DD HH:mm")
|
|
|
|
|
})
|
|
|
|
|
}else{
|
|
|
|
|
this.setState({
|
|
|
|
|
endtime:moment(handleDateString(this.props.starttimesend)).format("YYYY-MM-DD HH:mm")
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//勾选实训
|
|
|
|
|
shixunhomeworkedit=(list)=>{
|
|
|
|
@ -101,22 +159,37 @@ class OneSelfOrderModal extends Component{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onChangeTimeendlist=(date, dateString,id)=>{
|
|
|
|
|
let {course_groups}=this.state;
|
|
|
|
|
let arr=course_groups;
|
|
|
|
|
|
|
|
|
|
arr.map((item,key)=>{
|
|
|
|
|
if(item.id===id){
|
|
|
|
|
item.end_time=dateString
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
course_groups:arr
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
propsSaves=(ds,endtime)=>{
|
|
|
|
|
let {course_groups}=this.state;
|
|
|
|
|
|
|
|
|
|
if(ds.length ===0&&endtime === ""){
|
|
|
|
|
if(this.props.typs=="end"){
|
|
|
|
|
this.props.Saves()
|
|
|
|
|
}else{
|
|
|
|
|
if(this.props.typs!="end"){
|
|
|
|
|
if(endtime === ""||endtime===undefined||endtime===null){
|
|
|
|
|
|
|
|
|
|
if(!endtime){
|
|
|
|
|
this.setState({
|
|
|
|
|
endtimetype:true,
|
|
|
|
|
endtimetypevalue:"截止时间不能为空"
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(moment(endtime,"YYYY-MM-DD HH:mm") <= moment(this.props.starttimes,"YYYY-MM-DD HH:mm")){
|
|
|
|
|
if(moment(endtime,"YYYY-MM-DD HH:mm") <= moment(this.props.starttime,"YYYY-MM-DD HH:mm")){
|
|
|
|
|
this.setState({
|
|
|
|
|
endtimetype:true,
|
|
|
|
|
endtimetypevalue:"必须晚于发布时间"
|
|
|
|
@ -124,25 +197,38 @@ class OneSelfOrderModal extends Component{
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(course_groups===undefined||course_groups.length===0){
|
|
|
|
|
this.props.Saves(ds,moment(handleDateString(endtime),"YYYY-MM-DD HH:mm").format("YYYY-MM-DD HH:mm"))
|
|
|
|
|
}else{
|
|
|
|
|
let arr=[]
|
|
|
|
|
ds.map((item,key)=>{
|
|
|
|
|
course_groups.map((items,key)=>{
|
|
|
|
|
if(item===items.id){
|
|
|
|
|
if(!items.end_time){
|
|
|
|
|
arr.push(moment(moment(handleDateString(this.props.staytime)).add(1, 'week')).format("YYYY-MM-DD HH:mm"))
|
|
|
|
|
}else{
|
|
|
|
|
arr.push(items.end_time)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.props.Saves(ds,arr)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
render(){
|
|
|
|
|
let {group_ids,endtime}=this.state;
|
|
|
|
|
let {course_groups}=this.props;
|
|
|
|
|
|
|
|
|
|
// console.log(this.props.starttimes)
|
|
|
|
|
// console.log(endtime)
|
|
|
|
|
// console.log(this.props.starttimes)
|
|
|
|
|
// console.log(this.state.endtime)
|
|
|
|
|
|
|
|
|
|
// console.log(this.props.starttime,this.props.endtime)
|
|
|
|
|
// TODO course_groups为空时的处理
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// let endtimelist=this.props.starttimes===undefined||this.props.starttimes===""?"":moment(handleDateString(endtime)).add(1,'months')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
render(){
|
|
|
|
|
let {group_ids,endtime,course_groups}=this.state;
|
|
|
|
|
|
|
|
|
|
// TODO course_groups为空时的处理
|
|
|
|
|
return(
|
|
|
|
|
<div>
|
|
|
|
|
{
|
|
|
|
@ -195,13 +281,13 @@ class OneSelfOrderModal extends Component{
|
|
|
|
|
|
|
|
|
|
{this.props.starttime===undefined||
|
|
|
|
|
this.props.starttime===""?""
|
|
|
|
|
: <p className="task-popup-text-center font-16 mt20">
|
|
|
|
|
: <p className="task-popup-text-center font-16 mt10 mb10">
|
|
|
|
|
<span className={"font-14 mr20 color979797"}>
|
|
|
|
|
<span className={"mr10"}>发布时间:</span>
|
|
|
|
|
{this.props.starttime}</span>
|
|
|
|
|
{this.props.modaltype===undefined||this.props.modaltype===2? <span className={"font-14 color979797"}>
|
|
|
|
|
{/*{this.props.endtime}*/}
|
|
|
|
|
<span className={"mr10"}>截止时间:</span>
|
|
|
|
|
<span className={"mr10"}>截止时间</span>
|
|
|
|
|
<DatePicker
|
|
|
|
|
dropdownClassName="hideDisable"
|
|
|
|
|
showTime={{ format: 'HH:mm' }}
|
|
|
|
@ -218,6 +304,7 @@ class OneSelfOrderModal extends Component{
|
|
|
|
|
className={ this.state.endtimetype===true?"noticeTip":""}
|
|
|
|
|
/>
|
|
|
|
|
{this.state.endtimetype===true?<div className={"color-red fr mr90 mt5"}>{this.state.endtimetypevalue}</div>:""}
|
|
|
|
|
<div className={"fr mr90 mt5"}>(仅支持半点和整点)</div>
|
|
|
|
|
</span>:""}
|
|
|
|
|
</p>}
|
|
|
|
|
{/* usingCheckBeforePost 为true的时候 全选所有分班 */}
|
|
|
|
@ -245,7 +332,7 @@ class OneSelfOrderModal extends Component{
|
|
|
|
|
<li style={{ width: '100%',padding: "0px 10px"}} className={"mb10"}>
|
|
|
|
|
<span style={{"float":"left","color":"#05101A"}} className="task-hide color-grey-name ml50">分班名称</span>
|
|
|
|
|
|
|
|
|
|
<span style={{"float":"right","color":"#05101A"}} className="task-hide color-grey-name mr70">截止时间</span>
|
|
|
|
|
<span style={{"float":"right","color":"#05101A"}} className="task-hide color-grey-name mr20">截止时间(仅支持半点和整点)</span>
|
|
|
|
|
</li>
|
|
|
|
|
</div>}
|
|
|
|
|
{this.props.modaltype===undefined||this.props.modaltype===2
|
|
|
|
@ -257,10 +344,10 @@ class OneSelfOrderModal extends Component{
|
|
|
|
|
|
|
|
|
|
{ <Checkbox.Group style={{ width: '100%' }} value={group_ids} onChange={this.shixunhomeworkedit}>
|
|
|
|
|
{
|
|
|
|
|
course_groups.map((item,key)=>{
|
|
|
|
|
course_groups===undefined?"":course_groups.map((item,key)=>{
|
|
|
|
|
|
|
|
|
|
return(
|
|
|
|
|
<div className="clearfix edu-txt-center lineh-40" key={key}>
|
|
|
|
|
<div className="clearfix edu-txt-center lineh-40 mb10" key={key}>
|
|
|
|
|
<li style={{ width: '100%',padding: "0px 10px"}} className={"mb10"}>
|
|
|
|
|
<Checkbox
|
|
|
|
|
className="task-hide edu-txt-left"
|
|
|
|
@ -279,10 +366,9 @@ class OneSelfOrderModal extends Component{
|
|
|
|
|
locale={locale}
|
|
|
|
|
format={dateFormat}
|
|
|
|
|
placeholder="请选择截止时间"
|
|
|
|
|
id={"endTime"}
|
|
|
|
|
width={"210px"}
|
|
|
|
|
value={item.end_time===null||item.end_time===""?"":moment(item.end_time, dateFormat)}
|
|
|
|
|
onChange={this.onChangeTimeend}
|
|
|
|
|
onChange={(e,data)=>this.onChangeTimeendlist(e,data,item.id)}
|
|
|
|
|
className={ this.state.endtimetype===true?"noticeTip fr":"fr"}
|
|
|
|
|
/>
|
|
|
|
|
</li>
|
|
|
|
|