|
|
|
@ -33,52 +33,111 @@ class OneSelfOrderModal extends Component{
|
|
|
|
|
super(props);
|
|
|
|
|
this.state={
|
|
|
|
|
group_ids:[],
|
|
|
|
|
endtime:""
|
|
|
|
|
endtime:"",
|
|
|
|
|
course_groups:undefined,
|
|
|
|
|
Checkboxtype:true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
componentDidMount() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(this.props.course_groups!=undefined&&this.props.course_groups.length!=0){
|
|
|
|
|
|
|
|
|
|
let arr=this.props.course_groups.map(item => item.id);
|
|
|
|
|
this.shixunhomeworkedit(arr);
|
|
|
|
|
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){
|
|
|
|
|
this.setState({
|
|
|
|
|
endtime:moment(moment(handleDateString(this.props.staytime)).add(1, 'months')).format("YYYY-MM-DD HH:mm")
|
|
|
|
|
})
|
|
|
|
|
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{
|
|
|
|
|
this.setState({
|
|
|
|
|
endtime:moment(handleDateString(this.props.starttimes)).format("YYYY-MM-DD HH:mm")
|
|
|
|
|
})
|
|
|
|
|
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")
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
|
this.shixunhomeworkedit(arr);
|
|
|
|
|
}
|
|
|
|
|
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){
|
|
|
|
|
this.setState({
|
|
|
|
|
endtime:moment(moment(handleDateString(this.props.staytime)).add(1, 'months')).format("YYYY-MM-DD HH:mm")
|
|
|
|
|
})
|
|
|
|
|
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{
|
|
|
|
|
this.setState({
|
|
|
|
|
endtime:moment(handleDateString(this.props.starttimes)).format("YYYY-MM-DD HH:mm")
|
|
|
|
|
})
|
|
|
|
|
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")
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -101,22 +160,38 @@ 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=date===null?"":moment(handleDateString(dateString)).format('YYYY-MM-DD HH:mm')
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
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(this.props.typs!="end"){
|
|
|
|
|
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,27 +199,79 @@ class OneSelfOrderModal extends Component{
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.props.Saves(ds,moment(handleDateString(endtime),"YYYY-MM-DD HH:mm").format("YYYY-MM-DD HH:mm"))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let type=false
|
|
|
|
|
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){
|
|
|
|
|
type=true
|
|
|
|
|
this.setState({
|
|
|
|
|
endtimetype:true,
|
|
|
|
|
endtimetypeid:items.id,
|
|
|
|
|
endtimetypevalue:"截止时间不能为空"
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
// arr.push(moment(moment(handleDateString(this.props.staytime)).add(1, 'week')).format("YYYY-MM-DD HH:mm"))
|
|
|
|
|
}else{
|
|
|
|
|
arr.push(items.end_time)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
if(type===false){
|
|
|
|
|
this.props.Saves(ds,arr)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
render(){
|
|
|
|
|
let {group_ids,endtime}=this.state;
|
|
|
|
|
let {course_groups}=this.props;
|
|
|
|
|
Checkboxtype=(e)=>{
|
|
|
|
|
|
|
|
|
|
// console.log(this.props.starttimes)
|
|
|
|
|
// console.log(endtime)
|
|
|
|
|
// console.log(this.props.starttimes)
|
|
|
|
|
// console.log(this.state.endtime)
|
|
|
|
|
let {course_groups}=this.state;
|
|
|
|
|
|
|
|
|
|
// console.log(this.props.starttime,this.props.endtime)
|
|
|
|
|
// TODO course_groups为空时的处理
|
|
|
|
|
let arr=[];
|
|
|
|
|
if(e.target.checked==true){
|
|
|
|
|
course_groups.map((item,key)=>{
|
|
|
|
|
arr.push(item.id)
|
|
|
|
|
})
|
|
|
|
|
}else{
|
|
|
|
|
arr=[]
|
|
|
|
|
}
|
|
|
|
|
this.setState({
|
|
|
|
|
Checkboxtype:e.target.checked,
|
|
|
|
|
group_ids:arr
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// let endtimelist=this.props.starttimes===undefined||this.props.starttimes===""?"":moment(handleDateString(endtime)).add(1,'months')
|
|
|
|
|
render(){
|
|
|
|
|
let {group_ids,endtime,course_groups}=this.state;
|
|
|
|
|
// console.log(course_groups)
|
|
|
|
|
// TODO course_groups为空时的处理
|
|
|
|
|
return(
|
|
|
|
|
<div>
|
|
|
|
|
<style>
|
|
|
|
|
{
|
|
|
|
|
`
|
|
|
|
|
.ant-input, .ant-input .ant-input-suffix{
|
|
|
|
|
background-color: #fff !important;
|
|
|
|
|
}
|
|
|
|
|
.width300{
|
|
|
|
|
width:300px;
|
|
|
|
|
display: inline-block;
|
|
|
|
|
}
|
|
|
|
|
`
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
{
|
|
|
|
|
this.props.OneSelftype===true?<style>
|
|
|
|
|
{
|
|
|
|
@ -186,22 +313,22 @@ class OneSelfOrderModal extends Component{
|
|
|
|
|
{this.props.Topval}
|
|
|
|
|
<span className={"color-blue underline"}>{this.props.Topvalright}</span>
|
|
|
|
|
</p>
|
|
|
|
|
<p className="task-popup-text-center font-16 mt10">
|
|
|
|
|
{this.props.Botvalleft===undefined?"":<span className={"colorFF6800"}>"{this.props.Botvalleft}"</span>}
|
|
|
|
|
{this.props.Botval}
|
|
|
|
|
</p>
|
|
|
|
|
{/*<p className="task-popup-text-center font-16 mt10">*/}
|
|
|
|
|
{/*{this.props.Botvalleft===undefined?"":<span className={"colorFF6800"}>"{this.props.Botvalleft}"</span>}*/}
|
|
|
|
|
{/*{this.props.Botval}*/}
|
|
|
|
|
{/*</p>*/}
|
|
|
|
|
</React.Fragment> }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{this.props.starttime===undefined||
|
|
|
|
|
this.props.starttime===""?""
|
|
|
|
|
: <p className="task-popup-text-center font-16 mt20">
|
|
|
|
|
<span className={"font-14 mr20 color979797"}>
|
|
|
|
|
<span className={"mr10"}>发布时间:</span>
|
|
|
|
|
{this.props.starttime}</span>
|
|
|
|
|
: <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 +345,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 +373,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,13 +385,13 @@ 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"
|
|
|
|
|
className="task-hide edu-txt-left width300"
|
|
|
|
|
name="shixun_homework[]"
|
|
|
|
|
value={item.id}
|
|
|
|
|
key={item.id}
|
|
|
|
@ -279,11 +407,10 @@ 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}
|
|
|
|
|
className={ this.state.endtimetype===true?"noticeTip fr":"fr"}
|
|
|
|
|
value={item.end_time===null||item.end_time===""?"":moment(handleDateString(item.end_time), dateFormat)}
|
|
|
|
|
onChange={(e,data)=>this.onChangeTimeendlist(e,data,item.id)}
|
|
|
|
|
className={ this.state.endtimetypeid===item.id&&this.state.endtimetype===true||moment(handleDateString(item.end_time),"YYYY-MM-DD HH:mm") <= moment(this.props.starttime,"YYYY-MM-DD HH:mm")?"noticeTip fr":"fr"}
|
|
|
|
|
/>
|
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
@ -297,6 +424,7 @@ class OneSelfOrderModal extends Component{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
<div className="clearfix mt30 edu-txt-center mb10">
|
|
|
|
|
<Checkbox className="fl ml10" checked={this.state.Checkboxtype} onChange={this.Checkboxtype}>全选</Checkbox>
|
|
|
|
|
<a className="task-btn color-white mr30" onClick={this.props.Cancel}>{this.props.Cancelname}</a>
|
|
|
|
|
<a className="task-btn task-btn-orange" onClick={()=>this.propsSaves(group_ids,this.state.endtime)}>{this.props.Savesname}</a>
|
|
|
|
|
</div>
|
|
|
|
|