|
|
@ -119,6 +119,7 @@ import {
|
|
|
|
getTermListByChannelJoggle,
|
|
|
|
getTermListByChannelJoggle,
|
|
|
|
getCmaSchelduleUpload,
|
|
|
|
getCmaSchelduleUpload,
|
|
|
|
} from "@/utils/api/index";
|
|
|
|
} from "@/utils/api/index";
|
|
|
|
|
|
|
|
import moment from "moment";
|
|
|
|
export default {
|
|
|
|
export default {
|
|
|
|
props: {
|
|
|
|
props: {
|
|
|
|
title: String,
|
|
|
|
title: String,
|
|
|
@ -168,6 +169,7 @@ export default {
|
|
|
|
flag: false,
|
|
|
|
flag: false,
|
|
|
|
sureloading: false,
|
|
|
|
sureloading: false,
|
|
|
|
showtag: false,
|
|
|
|
showtag: false,
|
|
|
|
|
|
|
|
checkOffset: "",
|
|
|
|
};
|
|
|
|
};
|
|
|
|
},
|
|
|
|
},
|
|
|
|
mounted() {},
|
|
|
|
mounted() {},
|
|
|
@ -177,6 +179,7 @@ export default {
|
|
|
|
console.log(val);
|
|
|
|
console.log(val);
|
|
|
|
this.selid = val.id;
|
|
|
|
this.selid = val.id;
|
|
|
|
this.ruleSchedule = val.listTime;
|
|
|
|
this.ruleSchedule = val.listTime;
|
|
|
|
|
|
|
|
console.log(this.ruleSchedule);
|
|
|
|
// console.log(this.ruleSchedule, "时间规则");
|
|
|
|
// console.log(this.ruleSchedule, "时间规则");
|
|
|
|
this.getlistnr();
|
|
|
|
this.getlistnr();
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -232,11 +235,34 @@ export default {
|
|
|
|
this.allCheckNode = this.$refs.tree.getCheckedNodes();
|
|
|
|
this.allCheckNode = this.$refs.tree.getCheckedNodes();
|
|
|
|
// console.log(this.allCheckNode);
|
|
|
|
// console.log(this.allCheckNode);
|
|
|
|
console.log(nodeObj);
|
|
|
|
console.log(nodeObj);
|
|
|
|
|
|
|
|
console.log(this.allCheckNode);
|
|
|
|
this.isactive = nodeObj.id;
|
|
|
|
this.isactive = nodeObj.id;
|
|
|
|
this.isCheck = this.$refs.tree.getCheckedNodes().indexOf(nodeObj) > -1;
|
|
|
|
this.isCheck = this.$refs.tree.getCheckedNodes().indexOf(nodeObj) > -1;
|
|
|
|
console.log(this.isCheck);
|
|
|
|
console.log(this.isCheck);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// //获取开始时间和结束时间的偏移量
|
|
|
|
|
|
|
|
// getruleSchedule() {
|
|
|
|
|
|
|
|
// for (var j = 0; j < this.allCheckNode.length; j++) {
|
|
|
|
|
|
|
|
// console.log(this.allCheckNode[j].offsetNum);
|
|
|
|
|
|
|
|
// for (var i = 0; i < this.ruleSchedule.length; i++) {
|
|
|
|
|
|
|
|
// console.log(typeof this.ruleSchedule[i].startTime);
|
|
|
|
|
|
|
|
// console.log(this.ruleSchedule[i].startTime);
|
|
|
|
|
|
|
|
// var Stime = moment(this.ruleSchedule[i].startTime).format("HH:mm");
|
|
|
|
|
|
|
|
// var Etime = moment(this.ruleSchedule[i].endTime).format("HH:mm");
|
|
|
|
|
|
|
|
// console.log(Stime, Etime);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// // this.ruleSchedule[i].startTime = new Date(
|
|
|
|
|
|
|
|
// // this.ruleSchedule[i].startTime
|
|
|
|
|
|
|
|
// // );
|
|
|
|
|
|
|
|
// // this.ruleSchedule[i].endTime = new Date(this.ruleSchedule[i].endTime);
|
|
|
|
|
|
|
|
// // console.log(this.ruleSchedule[i].startTime);
|
|
|
|
|
|
|
|
// // console.log(this.ruleSchedule[i].endTime);
|
|
|
|
|
|
|
|
// // moment().add(offsetSeconds, "seconds").toObject();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// // console.log(time);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// },
|
|
|
|
|
|
|
|
|
|
|
|
// 保存确定操作
|
|
|
|
// 保存确定操作
|
|
|
|
submitForm() {
|
|
|
|
submitForm() {
|
|
|
@ -249,25 +275,155 @@ export default {
|
|
|
|
console.log(this.checkedAisle);
|
|
|
|
console.log(this.checkedAisle);
|
|
|
|
|
|
|
|
|
|
|
|
var ruleBox = [];
|
|
|
|
var ruleBox = [];
|
|
|
|
|
|
|
|
//循环装置
|
|
|
|
for (var i = 0; i < this.allCheckNode.length; i++) {
|
|
|
|
for (var i = 0; i < this.allCheckNode.length; i++) {
|
|
|
|
console.log(this.allCheckNode[i].protocol);
|
|
|
|
console.log(this.allCheckNode[i].bsManufacturer);
|
|
|
|
|
|
|
|
if (
|
|
|
|
|
|
|
|
this.allCheckNode[i].bsManufacturer == null ||
|
|
|
|
|
|
|
|
this.allCheckNode[i].bsManufacturer == undefined
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
console.log(this.allCheckNode[i].offsetNum);
|
|
|
|
|
|
|
|
//循环时间规则
|
|
|
|
|
|
|
|
let timearr = [];
|
|
|
|
|
|
|
|
let dayArr = [];
|
|
|
|
|
|
|
|
for (var j = 0; j < this.ruleSchedule.length; j++) {
|
|
|
|
|
|
|
|
console.log(this.ruleSchedule);
|
|
|
|
|
|
|
|
console.log(this.ruleSchedule[j].startTime);
|
|
|
|
|
|
|
|
// var Stime = moment(this.ruleSchedule[j].startTime).format("HH:mm");
|
|
|
|
|
|
|
|
// var Etime = moment(this.ruleSchedule[j].endTime).format("HH:mm");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var Stime = moment(this.ruleSchedule[j].startTime)
|
|
|
|
|
|
|
|
.add(this.allCheckNode[i].offsetNum, "minute")
|
|
|
|
|
|
|
|
.format();
|
|
|
|
|
|
|
|
var Etime = moment(this.ruleSchedule[j].endTime)
|
|
|
|
|
|
|
|
.add(this.allCheckNode[i].offsetNum, "minute")
|
|
|
|
|
|
|
|
.format();
|
|
|
|
|
|
|
|
var spanTime = this.ruleSchedule[j].span;
|
|
|
|
|
|
|
|
console.log(spanTime);
|
|
|
|
|
|
|
|
console.log(moment(this.ruleSchedule[j].endTime).hour());
|
|
|
|
|
|
|
|
//判断湖南规约
|
|
|
|
|
|
|
|
if (this.allCheckNode[i].protocol == "65283") {
|
|
|
|
|
|
|
|
console.log("湖南规约");
|
|
|
|
|
|
|
|
console.log(Stime, Etime);
|
|
|
|
|
|
|
|
console.log(typeof Stime);
|
|
|
|
|
|
|
|
console.log(
|
|
|
|
|
|
|
|
moment(this.ruleSchedule[j].endTime)
|
|
|
|
|
|
|
|
.add(this.allCheckNode[i].offsetNum, "minute")
|
|
|
|
|
|
|
|
.hour()
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
console.log(
|
|
|
|
|
|
|
|
moment(this.ruleSchedule[j].endTime)
|
|
|
|
|
|
|
|
.add(this.allCheckNode[i].offsetNum, "minute")
|
|
|
|
|
|
|
|
.minute()
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//如果偏移之后的时间是第二天,那么不做偏移
|
|
|
|
|
|
|
|
console.log(moment().isSame(moment(Etime), "day"));
|
|
|
|
|
|
|
|
//判断是不是同一天
|
|
|
|
|
|
|
|
if (moment().isSame(moment(Etime), "day")) {
|
|
|
|
|
|
|
|
//如果是同一天
|
|
|
|
|
|
|
|
timearr.push(
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
hour: Math.floor(this.ruleSchedule[j].span / 60),
|
|
|
|
|
|
|
|
minute: this.ruleSchedule[j].span % 60,
|
|
|
|
|
|
|
|
preset: 255,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
hour: moment(this.ruleSchedule[j].startTime)
|
|
|
|
|
|
|
|
.add(this.allCheckNode[i].offsetNum, "minute")
|
|
|
|
|
|
|
|
.hour(),
|
|
|
|
|
|
|
|
minute: moment(this.ruleSchedule[j].startTime)
|
|
|
|
|
|
|
|
.add(this.allCheckNode[i].offsetNum, "minute")
|
|
|
|
|
|
|
|
.minute(),
|
|
|
|
|
|
|
|
preset: 255,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
hour: moment(this.ruleSchedule[j].endTime)
|
|
|
|
|
|
|
|
.add(this.allCheckNode[i].offsetNum, "minute")
|
|
|
|
|
|
|
|
.hour(),
|
|
|
|
|
|
|
|
minute: moment(this.ruleSchedule[j].endTime)
|
|
|
|
|
|
|
|
.add(this.allCheckNode[i].offsetNum, "minute")
|
|
|
|
|
|
|
|
.minute(),
|
|
|
|
|
|
|
|
preset: 255,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
timearr.push(
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
hour: Math.floor(this.ruleSchedule[j].span / 60),
|
|
|
|
|
|
|
|
minute: this.ruleSchedule[j].span % 60,
|
|
|
|
|
|
|
|
preset: 255,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
hour: moment(this.ruleSchedule[j].startTime)
|
|
|
|
|
|
|
|
.add(this.allCheckNode[i].offsetNum, "minute")
|
|
|
|
|
|
|
|
.hour(),
|
|
|
|
|
|
|
|
minute: moment(this.ruleSchedule[j].startTime)
|
|
|
|
|
|
|
|
.add(this.allCheckNode[i].offsetNum, "minute")
|
|
|
|
|
|
|
|
.minute(),
|
|
|
|
|
|
|
|
preset: 255,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
hour: moment(this.ruleSchedule[j].endTime).hour(),
|
|
|
|
|
|
|
|
minute: moment(this.ruleSchedule[j].endTime).minute(),
|
|
|
|
|
|
|
|
preset: 255,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log(timearr);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
////判断河南规约
|
|
|
|
|
|
|
|
if (this.allCheckNode[i].protocol == "65286") {
|
|
|
|
|
|
|
|
console.log("河南规约");
|
|
|
|
|
|
|
|
//偏移时间
|
|
|
|
|
|
|
|
//this.getDayArr(startDay, endDay);
|
|
|
|
|
|
|
|
let startDay = Stime;
|
|
|
|
|
|
|
|
let endDay = Etime;
|
|
|
|
|
|
|
|
console.log(startDay, endDay);
|
|
|
|
|
|
|
|
let startVal = this.$moment(new Date(startDay)).format(
|
|
|
|
|
|
|
|
"YYYY-MM-DD HH:mm"
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
console.log(startVal);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while (this.$moment(startVal).isBefore(endDay)) {
|
|
|
|
|
|
|
|
dayArr.push(startVal);
|
|
|
|
|
|
|
|
// 自增
|
|
|
|
|
|
|
|
startVal = this.$moment(new Date(startVal))
|
|
|
|
|
|
|
|
.add(spanTime, "minute")
|
|
|
|
|
|
|
|
.format("YYYY-MM-DD HH:mm");
|
|
|
|
|
|
|
|
console.log(startVal);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// // 将结束日期的天放进数组
|
|
|
|
|
|
|
|
dayArr.push(
|
|
|
|
|
|
|
|
this.$moment(new Date(endDay)).format("YYYY-MM-DD HH:mm")
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
console.log(dayArr);
|
|
|
|
|
|
|
|
for (var k = 0; k < dayArr.length; k++) {
|
|
|
|
|
|
|
|
//console.log(moment(dayArr[k]).hour());
|
|
|
|
|
|
|
|
timearr.push({
|
|
|
|
|
|
|
|
hour: moment(dayArr[k]).hour(),
|
|
|
|
|
|
|
|
minute: moment(dayArr[k]).minute(),
|
|
|
|
|
|
|
|
preset: 255,
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (this.allCheckNode[i].protocol == "65283") {
|
|
|
|
// return dayArr;
|
|
|
|
//湖南规约
|
|
|
|
}
|
|
|
|
this.getHnTime(this.allCheckNode[i]);
|
|
|
|
}
|
|
|
|
} else if (this.allCheckNode[i].protocol == "65286") {
|
|
|
|
|
|
|
|
//郑州规约
|
|
|
|
var parmsobj = {
|
|
|
|
this.getZzTime(this.allCheckNode[i]);
|
|
|
|
termid: this.allCheckNode[i].id,
|
|
|
|
|
|
|
|
channelid: this.checkedAisle,
|
|
|
|
|
|
|
|
offset: this.allCheckNode[i].offsetNum,
|
|
|
|
|
|
|
|
list: timearr,
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
console.log(parmsobj);
|
|
|
|
|
|
|
|
ruleBox.push(parmsobj);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var parmsobj = {
|
|
|
|
console.log(ruleBox);
|
|
|
|
termid: this.allCheckNode[i].id,
|
|
|
|
|
|
|
|
channelid: this.checkedAisle,
|
|
|
|
|
|
|
|
offset: this.allCheckNode[i].offsetNum,
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
console.log(parmsobj);
|
|
|
|
|
|
|
|
ruleBox.push(parmsobj);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
console.log(ruleBox);
|
|
|
|
|
|
|
|
setScheduleRulel({
|
|
|
|
setScheduleRulel({
|
|
|
|
list: ruleBox,
|
|
|
|
list: ruleBox,
|
|
|
|
scheduleid: this.selid,
|
|
|
|
scheduleid: this.selid,
|
|
|
@ -283,75 +439,19 @@ export default {
|
|
|
|
}, 3000);
|
|
|
|
}, 3000);
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.catch((err) => {
|
|
|
|
.catch((err) => {
|
|
|
|
this.$message({
|
|
|
|
// this.$message({
|
|
|
|
duration: 1500,
|
|
|
|
// duration: 1500,
|
|
|
|
showClose: true,
|
|
|
|
// showClose: true,
|
|
|
|
message: "添加失败",
|
|
|
|
// message: "添加失败",
|
|
|
|
type: "error",
|
|
|
|
// type: "error",
|
|
|
|
});
|
|
|
|
// });
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
//获取到时间规则,把时间规则转化为对应的规约格式
|
|
|
|
//获取到时间规则,把时间规则转化为对应的规约格式
|
|
|
|
//湖南规约
|
|
|
|
//湖南规约
|
|
|
|
getHnTime(val) {
|
|
|
|
getHnTime() {},
|
|
|
|
console.log("湖南");
|
|
|
|
|
|
|
|
console.log(val);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var numberoff = val.offsetNum;
|
|
|
|
|
|
|
|
console.log(numberoff);
|
|
|
|
|
|
|
|
console.log(this.ruleSchedule);
|
|
|
|
|
|
|
|
let arr = [];
|
|
|
|
|
|
|
|
for (var i = 0; i < this.ruleSchedule.length; i++) {
|
|
|
|
|
|
|
|
console.log(this.ruleSchedule[i].startTime);
|
|
|
|
|
|
|
|
console.log(this.ruleSchedule[i].endTime);
|
|
|
|
|
|
|
|
let sTime = new Date(this.ruleSchedule[i].startTime);
|
|
|
|
|
|
|
|
let eTime = new Date(this.ruleSchedule[i].endTime);
|
|
|
|
|
|
|
|
console.log(sTime, eTime);
|
|
|
|
|
|
|
|
arr.push(
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
hour: Math.floor(this.ruleSchedule[i].span / 60),
|
|
|
|
|
|
|
|
minute: this.ruleSchedule[i].span % 60,
|
|
|
|
|
|
|
|
preset: 255,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
hour: new Date(this.ruleSchedule[i].startTime).getHours(),
|
|
|
|
|
|
|
|
minute:
|
|
|
|
|
|
|
|
new Date(this.ruleSchedule[i].startTime).getMinutes() + numberoff,
|
|
|
|
|
|
|
|
preset: 255,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
hour: new Date(this.ruleSchedule[i].endTime).getHours(),
|
|
|
|
|
|
|
|
minute:
|
|
|
|
|
|
|
|
new Date(this.ruleSchedule[i].endTime).getMinutes() + numberoff,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
preset: 255,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
console.log(arr);
|
|
|
|
|
|
|
|
// arr.push(
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
// hour: Math.floor(this.ruleForm.listTime[i].span / 60),
|
|
|
|
|
|
|
|
// minute: this.ruleForm.listTime[i].span % 60,
|
|
|
|
|
|
|
|
// preset: 255,
|
|
|
|
|
|
|
|
// },
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
// hour: this.ruleForm.listTime[i].startTime.getHours(),
|
|
|
|
|
|
|
|
// minute: this.ruleForm.listTime[i].startTime.getMinutes(),
|
|
|
|
|
|
|
|
// preset: 255,
|
|
|
|
|
|
|
|
// },
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
// hour: this.ruleForm.listTime[i].endTime.getHours(),
|
|
|
|
|
|
|
|
// minute: this.ruleForm.listTime[i].endTime.getMinutes(),
|
|
|
|
|
|
|
|
// preset: 255,
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
//河南规约
|
|
|
|
//河南规约
|
|
|
|
getZzTime() {
|
|
|
|
getZzTime() {},
|
|
|
|
console.log("河南");
|
|
|
|
|
|
|
|
console.log(this.ruleSchedule);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
//根据requestid查询时间表下发状态
|
|
|
|
//根据requestid查询时间表下发状态
|
|
|
|
requestTime() {
|
|
|
|
requestTime() {
|
|
|
|
this.sureloading = true;
|
|
|
|
this.sureloading = true;
|
|
|
|