1.调接口回来的所有数据时间取出来放新数组中,
let timeArr=[];
for(let i=0; i<this.remindTypeList.length;i++){
for(let k=0; k<this.remindTypeList[i].dicts.length;k++){
if(this.remindTypeList[i].remindType == 2){
timeArr.push(this.remindTypeList[i].dicts[k].label)
}
}
}
2.获取详情接口返回来的选中的时间数据,取出来的时间,所有的数据数组中是否存在当前详情取出来的数据
let newTimeArr=[];
for(let n=0; n<this.remindInfo.remindIntervalList.length;n++){
if(timeArr.indexOf(this.remindInfo.remindIntervalList[n]) == -1){
newTimeArr.push(this.remindInfo.remindIntervalList[n])
break;
}
}
1.取出来所有的数据,把自定义的格式塞进所有的数据中,然后再所有的数据和选中详情返回的数据对比,
showRemindText() {
this.showInfo.remindTimeText=[];
let timeArr=[];
for(let i=0; i<this.remindTypeList.length;i++){
for(let k=0; k<this.remindTypeList[i].dicts.length;k++){
if(this.remindTypeList[i].remindType == 2){
timeArr.push(this.remindTypeList[i].dicts[k].label)
}
}
}
let newTimeArr=[];
for(let n=0; n<this.remindInfo.remindIntervalList.length;n++){
if(timeArr.indexOf(this.remindInfo.remindIntervalList[n]) == -1){
newTimeArr.push(this.remindInfo.remindIntervalList[n])
break;
}
}
let date = parseInt(newTimeArr[0] / (24 * 60));
let hours = parseInt((newTimeArr[0] % (24 * 60)) / 60);
let minutes = (newTimeArr[0]% (24 * 60)) % 60;
let obj={
"dictName": "自定义",
"label": -1,
info:{
name:'提前',
day: date,
hours: hours,
minutes: minutes
},
};
for(let d=0; d<this.remindTypeList.length;d++){
if(this.remindTypeList[d].remindType==2){
this.remindTypeList[d].dicts.push(obj)
}
}
this.showInfo.remindTimeText=[];
for(let i=0;i<this.remindTypeList.length;i++) {
if(this.remindInfo.remindType==this.remindTypeList[i].remindType){
for(let j=0; j<this.remindInfo.remindIntervalList.length; j++){
for(let k=0; k<this.remindTypeList[i].dicts.length;k++){
if(this.remindTypeList[i].dicts[k].label==this.remindInfo.remindIntervalList[j]){
let obj = this.remindTypeList[i].dicts[k]
this.$set(obj,'checked',true)
if((this.remindInfo.remindType==this.remindTypeList[i].remindType)&&(this.remindInfo.remindType==0)&&(this.remindTypeList[i].remindType==0)){
this.$set(obj,'remindType',0)
}else if((this.remindInfo.remindType==this.remindTypeList[i].remindType)&&(this.remindInfo.remindType==1)&&(this.remindTypeList[i].remindType==1)){
this.$set(obj,'remindType',1)
}else{
this.$set(obj,'remindType',2)
}
this.showInfo.remindTimeText.push(obj);
break;
}
if(this.remindTypeList[i].dicts[k].label==-1){
let obj = this.remindTypeList[i].dicts[k]
this.$set(obj,'checked',true)
this.$set(obj,'remindType',2)
this.showInfo.remindTimeText.push(obj);
break;
}
}
}
}
}
},






网友评论