|
|
|
@ -50,12 +50,22 @@
|
|
|
|
|
<div class="w8">时间表:</div>
|
|
|
|
|
<div class="w80 flexonly" v-loading="timeloading">
|
|
|
|
|
<el-tag
|
|
|
|
|
v-if="timeProtocol == '65283'"
|
|
|
|
|
class="mr10 mt10"
|
|
|
|
|
size="mini"
|
|
|
|
|
v-for="(val, index) in this.shedulenr"
|
|
|
|
|
:key="index"
|
|
|
|
|
>{{ val.substring(0, val.lastIndexOf(":")) }}</el-tag
|
|
|
|
|
>{{ val.substring(val.length - 5) }}</el-tag
|
|
|
|
|
>
|
|
|
|
|
<el-tag
|
|
|
|
|
v-if="timeProtocol == '65286'"
|
|
|
|
|
class="mr10 mt10"
|
|
|
|
|
size="mini"
|
|
|
|
|
v-for="(val, index) in this.shedulenr"
|
|
|
|
|
:key="index"
|
|
|
|
|
>{{ $moment(val).format("HH:mm") }}</el-tag
|
|
|
|
|
>
|
|
|
|
|
<!-- {{ val.substring(val.length - 5) }} -->
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="rightTime" v-if="newshedulenr.length !== 0">
|
|
|
|
@ -65,11 +75,20 @@
|
|
|
|
|
>
|
|
|
|
|
<div class="w80 flexonly" v-loading="timeloading">
|
|
|
|
|
<el-tag
|
|
|
|
|
v-if="timeProtocol == '65283'"
|
|
|
|
|
class="mr10 mt10"
|
|
|
|
|
size="mini"
|
|
|
|
|
v-for="(val, index) in this.newshedulenr"
|
|
|
|
|
:key="index"
|
|
|
|
|
>{{ val.substring(val.length - 5) }}</el-tag
|
|
|
|
|
>
|
|
|
|
|
<el-tag
|
|
|
|
|
v-if="timeProtocol == '65286'"
|
|
|
|
|
class="mr10 mt10"
|
|
|
|
|
size="mini"
|
|
|
|
|
v-for="(val, index) in this.newshedulenr"
|
|
|
|
|
:key="index"
|
|
|
|
|
>{{ val.substring(0, val.lastIndexOf(":")) }}</el-tag
|
|
|
|
|
>{{ $moment(val).format("HH:mm") }}</el-tag
|
|
|
|
|
>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
@ -101,10 +120,10 @@
|
|
|
|
|
<el-table-column label="名称" show-overflow-tooltip>
|
|
|
|
|
<template slot-scope="scope">{{ scope.row.name }}</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="时间表类型" show-overflow-tooltip>
|
|
|
|
|
<!-- <el-table-column label="时间表类型" show-overflow-tooltip>
|
|
|
|
|
<template>按时间段</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="时间表规则">
|
|
|
|
|
</el-table-column> -->
|
|
|
|
|
<el-table-column label="时间表规则" width="360px">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<p
|
|
|
|
|
class="timeGz"
|
|
|
|
@ -200,8 +219,31 @@
|
|
|
|
|
v-for="(val, index) in scheduleInfo"
|
|
|
|
|
:key="index"
|
|
|
|
|
>
|
|
|
|
|
<span>{{ val.startTime }}</span> ~
|
|
|
|
|
<span>{{ val.endTime }}</span>
|
|
|
|
|
<span
|
|
|
|
|
>{{
|
|
|
|
|
new Date(val.startTime).getHours() < 10
|
|
|
|
|
? "0" + new Date(val.startTime).getHours()
|
|
|
|
|
: new Date(val.startTime).getHours()
|
|
|
|
|
}}:
|
|
|
|
|
{{
|
|
|
|
|
new Date(val.startTime).getMinutes() < 10
|
|
|
|
|
? "0" + new Date(val.startTime).getMinutes()
|
|
|
|
|
: new Date(val.startTime).getMinutes()
|
|
|
|
|
}}</span
|
|
|
|
|
>
|
|
|
|
|
~
|
|
|
|
|
<span
|
|
|
|
|
>{{
|
|
|
|
|
new Date(val.endTime).getHours() < 10
|
|
|
|
|
? "0" + new Date(val.endTime).getHours()
|
|
|
|
|
: new Date(val.endTime).getHours()
|
|
|
|
|
}}:
|
|
|
|
|
{{
|
|
|
|
|
new Date(val.endTime).getMinutes() < 10
|
|
|
|
|
? "0" + new Date(val.endTime).getMinutes()
|
|
|
|
|
: new Date(val.endTime).getMinutes()
|
|
|
|
|
}}</span
|
|
|
|
|
>
|
|
|
|
|
间隔:<b>{{ val.span }}分钟</b>
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
@ -262,6 +304,7 @@ import {
|
|
|
|
|
getCmaSchelduleUpload,
|
|
|
|
|
getTermStatus,
|
|
|
|
|
} from "@/utils/api/index";
|
|
|
|
|
import moment from "moment";
|
|
|
|
|
export default {
|
|
|
|
|
props: {
|
|
|
|
|
title: String,
|
|
|
|
@ -314,6 +357,7 @@ export default {
|
|
|
|
|
offsetnum: "",
|
|
|
|
|
setNum: Math.floor(Math.random() * 10),
|
|
|
|
|
compareloading: false,
|
|
|
|
|
timeProtocol: "",
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
mounted() {
|
|
|
|
@ -324,9 +368,11 @@ export default {
|
|
|
|
|
console.log(tab, event);
|
|
|
|
|
},
|
|
|
|
|
//获取单个设备通道
|
|
|
|
|
getSingleAccess(id, zzid) {
|
|
|
|
|
getSingleAccess(id, zzid, protocol) {
|
|
|
|
|
this.newcmdzzid = zzid;
|
|
|
|
|
this.selfacilityId = id;
|
|
|
|
|
this.timeProtocol = protocol;
|
|
|
|
|
console.log(this.timeProtocol);
|
|
|
|
|
getChannelListJoggle({ termid: id })
|
|
|
|
|
.then((res) => {
|
|
|
|
|
this.accesslist = res.data.list;
|
|
|
|
@ -340,10 +386,97 @@ export default {
|
|
|
|
|
terminalid: this.selfacilityId,
|
|
|
|
|
})
|
|
|
|
|
.then((res) => {
|
|
|
|
|
// this.$message.success("查询成功");
|
|
|
|
|
// this.shedulenr = res.data.list.join("; ")
|
|
|
|
|
this.shedulenr = res.data.list;
|
|
|
|
|
console.log(this.shedulenr);
|
|
|
|
|
//湖南规约
|
|
|
|
|
if (this.timeProtocol == "65283") {
|
|
|
|
|
console.log("1111111111111111111111111111111111111");
|
|
|
|
|
var hnarr = [];
|
|
|
|
|
for (var i = 0; i < this.shedulenr.length; i++) {
|
|
|
|
|
if (i % 3 == 0) {
|
|
|
|
|
var hnobj = {};
|
|
|
|
|
hnobj.span =
|
|
|
|
|
this.shedulenr[i].hour * 60 + this.shedulenr[i].minute;
|
|
|
|
|
console.log("时间间隔");
|
|
|
|
|
} else if (i % 3 == 1) {
|
|
|
|
|
console.log("开始时间");
|
|
|
|
|
console.log("a");
|
|
|
|
|
let timeDate = new Date();
|
|
|
|
|
timeDate.setHours(this.shedulenr[i].hour);
|
|
|
|
|
timeDate.setMinutes(this.shedulenr[i].minute);
|
|
|
|
|
console.log(timeDate);
|
|
|
|
|
hnobj.startTime = timeDate;
|
|
|
|
|
} else if (i % 3 == 2) {
|
|
|
|
|
console.log("结束时间");
|
|
|
|
|
hnobj.endTime =
|
|
|
|
|
this.shedulenr[i].hour + ":" + this.shedulenr[i].minute;
|
|
|
|
|
let timeDate = new Date();
|
|
|
|
|
timeDate.setHours(this.shedulenr[i].hour);
|
|
|
|
|
timeDate.setMinutes(this.shedulenr[i].minute);
|
|
|
|
|
// hnobj.endTime = c.toJSON();
|
|
|
|
|
let timeHour =
|
|
|
|
|
timeDate.getHours() < 10
|
|
|
|
|
? "0" + timeDate.getHours()
|
|
|
|
|
: timeDate.getHours();
|
|
|
|
|
let timeMinute =
|
|
|
|
|
timeDate.getMinutes() < 10
|
|
|
|
|
? "0" + timeDate.getMinutes()
|
|
|
|
|
: timeDate.getMinutes();
|
|
|
|
|
hnobj.endTime = timeDate;
|
|
|
|
|
hnarr.push(hnobj);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
console.log("222222222222222222");
|
|
|
|
|
console.log(hnarr);
|
|
|
|
|
console.log("22222222222222222222222");
|
|
|
|
|
let dayArr = [];
|
|
|
|
|
//根据开始时间结束时间生产数组
|
|
|
|
|
for (let k = 0; k < hnarr.length; k++) {
|
|
|
|
|
console.log(hnarr[k].startTime);
|
|
|
|
|
console.log(hnarr[k].endTime);
|
|
|
|
|
console.log(hnarr[k].span);
|
|
|
|
|
let startDay = hnarr[k].startTime;
|
|
|
|
|
let endDay = hnarr[k].endTime;
|
|
|
|
|
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(hnarr[k].span, "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);
|
|
|
|
|
this.shedulenr = dayArr;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//河南规约
|
|
|
|
|
if (this.timeProtocol == "65286") {
|
|
|
|
|
console.log("河南规约");
|
|
|
|
|
var hnarr = [];
|
|
|
|
|
for (var i = 0; i < this.shedulenr.length; i++) {
|
|
|
|
|
console.log(this.shedulenr[i].hour);
|
|
|
|
|
let timeDate = new Date();
|
|
|
|
|
timeDate.setHours(this.shedulenr[i].hour);
|
|
|
|
|
timeDate.setMinutes(this.shedulenr[i].minute);
|
|
|
|
|
|
|
|
|
|
console.log(timeDate);
|
|
|
|
|
hnarr.push(timeDate);
|
|
|
|
|
}
|
|
|
|
|
console.log(hnarr);
|
|
|
|
|
this.shedulenr = hnarr;
|
|
|
|
|
}
|
|
|
|
|
this.offsetnum = res.data.offset;
|
|
|
|
|
|
|
|
|
|
this.loading = false;
|
|
|
|
|
})
|
|
|
|
|
.catch((err) => {
|
|
|
|
@ -362,9 +495,95 @@ export default {
|
|
|
|
|
terminalid: this.selfacilityId,
|
|
|
|
|
})
|
|
|
|
|
.then((res) => {
|
|
|
|
|
// this.$message.success("查询成功");
|
|
|
|
|
// this.shedulenr = res.data.list.join("; ")
|
|
|
|
|
this.shedulenr = res.data.list;
|
|
|
|
|
console.log(this.shedulenr);
|
|
|
|
|
//湖南规约
|
|
|
|
|
if (this.timeProtocol == "65283") {
|
|
|
|
|
console.log("1111111111111111111111111111111111111");
|
|
|
|
|
var hnarr = [];
|
|
|
|
|
for (var i = 0; i < this.shedulenr.length; i++) {
|
|
|
|
|
if (i % 3 == 0) {
|
|
|
|
|
var hnobj = {};
|
|
|
|
|
hnobj.span =
|
|
|
|
|
this.shedulenr[i].hour * 60 + this.shedulenr[i].minute;
|
|
|
|
|
console.log("时间间隔");
|
|
|
|
|
} else if (i % 3 == 1) {
|
|
|
|
|
console.log("开始时间");
|
|
|
|
|
console.log("a");
|
|
|
|
|
let timeDate = new Date();
|
|
|
|
|
timeDate.setHours(this.shedulenr[i].hour);
|
|
|
|
|
timeDate.setMinutes(this.shedulenr[i].minute);
|
|
|
|
|
console.log(timeDate);
|
|
|
|
|
hnobj.startTime = timeDate;
|
|
|
|
|
} else if (i % 3 == 2) {
|
|
|
|
|
console.log("结束时间");
|
|
|
|
|
hnobj.endTime =
|
|
|
|
|
this.shedulenr[i].hour + ":" + this.shedulenr[i].minute;
|
|
|
|
|
let timeDate = new Date();
|
|
|
|
|
timeDate.setHours(this.shedulenr[i].hour);
|
|
|
|
|
timeDate.setMinutes(this.shedulenr[i].minute);
|
|
|
|
|
// hnobj.endTime = c.toJSON();
|
|
|
|
|
let timeHour =
|
|
|
|
|
timeDate.getHours() < 10
|
|
|
|
|
? "0" + timeDate.getHours()
|
|
|
|
|
: timeDate.getHours();
|
|
|
|
|
let timeMinute =
|
|
|
|
|
timeDate.getMinutes() < 10
|
|
|
|
|
? "0" + timeDate.getMinutes()
|
|
|
|
|
: timeDate.getMinutes();
|
|
|
|
|
hnobj.endTime = timeDate;
|
|
|
|
|
hnarr.push(hnobj);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
console.log("222222222222222222");
|
|
|
|
|
console.log(hnarr);
|
|
|
|
|
console.log("22222222222222222222222");
|
|
|
|
|
let dayArr = [];
|
|
|
|
|
//根据开始时间结束时间生产数组
|
|
|
|
|
for (let k = 0; k < hnarr.length; k++) {
|
|
|
|
|
console.log(hnarr[k].startTime);
|
|
|
|
|
console.log(hnarr[k].endTime);
|
|
|
|
|
console.log(hnarr[k].span);
|
|
|
|
|
let startDay = hnarr[k].startTime;
|
|
|
|
|
let endDay = hnarr[k].endTime;
|
|
|
|
|
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(hnarr[k].span, "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);
|
|
|
|
|
this.shedulenr = dayArr;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//河南规约
|
|
|
|
|
if (this.timeProtocol == "65286") {
|
|
|
|
|
console.log("河南规约");
|
|
|
|
|
var hnarr = [];
|
|
|
|
|
for (var i = 0; i < this.shedulenr.length; i++) {
|
|
|
|
|
console.log(this.shedulenr[i].hour);
|
|
|
|
|
let timeDate = new Date();
|
|
|
|
|
timeDate.setHours(this.shedulenr[i].hour);
|
|
|
|
|
timeDate.setMinutes(this.shedulenr[i].minute);
|
|
|
|
|
|
|
|
|
|
console.log(timeDate);
|
|
|
|
|
hnarr.push(timeDate);
|
|
|
|
|
}
|
|
|
|
|
console.log(hnarr);
|
|
|
|
|
this.shedulenr = hnarr;
|
|
|
|
|
}
|
|
|
|
|
this.offsetnum = res.data.offset;
|
|
|
|
|
this.loading = false;
|
|
|
|
|
})
|
|
|
|
@ -405,6 +624,99 @@ export default {
|
|
|
|
|
// this.shedulenr = res.data.list.join("; ")
|
|
|
|
|
this.compareloading = false;
|
|
|
|
|
this.newshedulenr = res.data.list;
|
|
|
|
|
//湖南规约
|
|
|
|
|
if (this.timeProtocol == "65283") {
|
|
|
|
|
console.log("湖南规约");
|
|
|
|
|
console.log("1111111111111111111111111111111111111");
|
|
|
|
|
var hnarr = [];
|
|
|
|
|
for (var i = 0; i < this.newshedulenr.length; i++) {
|
|
|
|
|
if (i % 3 == 0) {
|
|
|
|
|
var hnobj = {};
|
|
|
|
|
hnobj.span =
|
|
|
|
|
this.newshedulenr[i].hour * 60 +
|
|
|
|
|
this.newshedulenr[i].minute;
|
|
|
|
|
console.log("时间间隔");
|
|
|
|
|
} else if (i % 3 == 1) {
|
|
|
|
|
console.log("开始时间");
|
|
|
|
|
console.log("a");
|
|
|
|
|
let timeDate = new Date();
|
|
|
|
|
timeDate.setHours(this.newshedulenr[i].hour);
|
|
|
|
|
timeDate.setMinutes(this.newshedulenr[i].minute);
|
|
|
|
|
console.log(timeDate);
|
|
|
|
|
hnobj.startTime = timeDate;
|
|
|
|
|
} else if (i % 3 == 2) {
|
|
|
|
|
console.log("结束时间");
|
|
|
|
|
hnobj.endTime =
|
|
|
|
|
this.newshedulenr[i].hour +
|
|
|
|
|
":" +
|
|
|
|
|
this.newshedulenr[i].minute;
|
|
|
|
|
let timeDate = new Date();
|
|
|
|
|
timeDate.setHours(this.newshedulenr[i].hour);
|
|
|
|
|
timeDate.setMinutes(this.newshedulenr[i].minute);
|
|
|
|
|
// hnobj.endTime = c.toJSON();
|
|
|
|
|
let timeHour =
|
|
|
|
|
timeDate.getHours() < 10
|
|
|
|
|
? "0" + timeDate.getHours()
|
|
|
|
|
: timeDate.getHours();
|
|
|
|
|
let timeMinute =
|
|
|
|
|
timeDate.getMinutes() < 10
|
|
|
|
|
? "0" + timeDate.getMinutes()
|
|
|
|
|
: timeDate.getMinutes();
|
|
|
|
|
hnobj.endTime = timeDate;
|
|
|
|
|
hnarr.push(hnobj);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
console.log("222222222222222222");
|
|
|
|
|
console.log(hnarr);
|
|
|
|
|
console.log("22222222222222222222222");
|
|
|
|
|
let dayArr = [];
|
|
|
|
|
//根据开始时间结束时间生产数组
|
|
|
|
|
for (let k = 0; k < hnarr.length; k++) {
|
|
|
|
|
console.log(hnarr[k].startTime);
|
|
|
|
|
console.log(hnarr[k].endTime);
|
|
|
|
|
console.log(hnarr[k].span);
|
|
|
|
|
let startDay = hnarr[k].startTime;
|
|
|
|
|
let endDay = hnarr[k].endTime;
|
|
|
|
|
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(hnarr[k].span, "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);
|
|
|
|
|
this.newshedulenr = dayArr;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//河南规约
|
|
|
|
|
if (this.timeProtocol == "65286") {
|
|
|
|
|
console.log("河南规约");
|
|
|
|
|
var hnarr = [];
|
|
|
|
|
for (var i = 0; i < this.newshedulenr.length; i++) {
|
|
|
|
|
console.log(this.newshedulenr[i].hour);
|
|
|
|
|
let timeDate = new Date();
|
|
|
|
|
timeDate.setHours(this.newshedulenr[i].hour);
|
|
|
|
|
timeDate.setMinutes(this.newshedulenr[i].minute);
|
|
|
|
|
|
|
|
|
|
console.log(timeDate);
|
|
|
|
|
hnarr.push(timeDate);
|
|
|
|
|
}
|
|
|
|
|
console.log(hnarr);
|
|
|
|
|
this.newshedulenr = hnarr;
|
|
|
|
|
}
|
|
|
|
|
this.timernum = 0;
|
|
|
|
|
// this.$message.success("查询成功");
|
|
|
|
|
clearInterval(this.timer);
|
|
|
|
@ -537,11 +849,14 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
//设置-获取所有通道
|
|
|
|
|
handleSet(val) {
|
|
|
|
|
console.log(this.setNum);
|
|
|
|
|
var deviceOffsetnum = this.setNum;
|
|
|
|
|
this.loading = true;
|
|
|
|
|
this.scheduleid = val.id;
|
|
|
|
|
this.isShowset = true;
|
|
|
|
|
console.log(val);
|
|
|
|
|
this.scheduleInfo = val.list;
|
|
|
|
|
this.scheduleInfo = val.listTime;
|
|
|
|
|
console.log("1111111", deviceOffsetnum);
|
|
|
|
|
this.timeName = val.name;
|
|
|
|
|
getScheduleRulelAccessList({ termid: this.selfacilityId })
|
|
|
|
|
.then((res) => {
|
|
|
|
@ -556,6 +871,8 @@ export default {
|
|
|
|
|
zzname: this.listnr[0].list[0].list[0].name,
|
|
|
|
|
zzcmid: this.listnr[0].list[0].list[0].cmdid,
|
|
|
|
|
zzid: this.listnr[0].list[0].list[0].id,
|
|
|
|
|
zzprotocol: this.timeProtocol,
|
|
|
|
|
offsetNum: deviceOffsetnum,
|
|
|
|
|
};
|
|
|
|
|
this.zzchannel = this.listnr[0].list[0].list[0].list;
|
|
|
|
|
console.log(this.deviceListData);
|
|
|
|
@ -625,15 +942,149 @@ export default {
|
|
|
|
|
getTermStatus({ termId: this.deviceListData.zzid }).then((res) => {
|
|
|
|
|
console.log(res);
|
|
|
|
|
if (res.data.isonline) {
|
|
|
|
|
var ruleBox = [];
|
|
|
|
|
//循环装置
|
|
|
|
|
|
|
|
|
|
//循环时间规则
|
|
|
|
|
let timearr = [];
|
|
|
|
|
let dayArr = [];
|
|
|
|
|
console.log(this.scheduleInfo);
|
|
|
|
|
for (var j = 0; j < this.scheduleInfo.length; j++) {
|
|
|
|
|
var Stime = moment(this.scheduleInfo[j].startTime)
|
|
|
|
|
.add(this.deviceListData.offsetNum, "minute")
|
|
|
|
|
.format();
|
|
|
|
|
var Etime = moment(this.scheduleInfo[j].endTime)
|
|
|
|
|
.add(this.deviceListData.offsetNum, "minute")
|
|
|
|
|
.format();
|
|
|
|
|
var lastETime = moment(this.scheduleInfo[j].endTime).format();
|
|
|
|
|
var spanTime = this.scheduleInfo[j].span;
|
|
|
|
|
console.log(Stime, Etime, spanTime);
|
|
|
|
|
console.log(moment(this.scheduleInfo[j].endTime).hour());
|
|
|
|
|
//判断湖南规约
|
|
|
|
|
if (this.deviceListData.zzprotocol == "65283") {
|
|
|
|
|
console.log("湖南规约");
|
|
|
|
|
console.log(Stime, Etime);
|
|
|
|
|
console.log(typeof Stime);
|
|
|
|
|
console.log(
|
|
|
|
|
moment(this.scheduleInfo[j].endTime)
|
|
|
|
|
.add(this.deviceListData.offsetNum, "minute")
|
|
|
|
|
.hour()
|
|
|
|
|
);
|
|
|
|
|
console.log(
|
|
|
|
|
moment(this.scheduleInfo[j].endTime)
|
|
|
|
|
.add(this.deviceListData.offsetNum, "minute")
|
|
|
|
|
.minute()
|
|
|
|
|
);
|
|
|
|
|
if (moment().isSame(moment(Etime), "day")) {
|
|
|
|
|
//如果是同一天
|
|
|
|
|
timearr.push(
|
|
|
|
|
{
|
|
|
|
|
hour: Math.floor(this.scheduleInfo[j].span / 60),
|
|
|
|
|
minute: this.scheduleInfo[j].span % 60,
|
|
|
|
|
preset: 255,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
hour: moment(this.scheduleInfo[j].startTime)
|
|
|
|
|
.add(this.deviceListData.offsetNum, "minute")
|
|
|
|
|
.hour(),
|
|
|
|
|
minute: moment(this.scheduleInfo[j].startTime)
|
|
|
|
|
.add(this.deviceListData.offsetNum, "minute")
|
|
|
|
|
.minute(),
|
|
|
|
|
preset: 255,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
hour: moment(this.scheduleInfo[j].endTime)
|
|
|
|
|
.add(this.deviceListData.offsetNum, "minute")
|
|
|
|
|
.hour(),
|
|
|
|
|
minute: moment(this.scheduleInfo[j].endTime)
|
|
|
|
|
.add(this.deviceListData.offsetNum, "minute")
|
|
|
|
|
.minute(),
|
|
|
|
|
preset: 255,
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
timearr.push(
|
|
|
|
|
{
|
|
|
|
|
hour: Math.floor(this.scheduleInfo[j].span / 60),
|
|
|
|
|
minute: this.scheduleInfo[j].span % 60,
|
|
|
|
|
preset: 255,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
hour: moment(this.scheduleInfo[j].startTime)
|
|
|
|
|
.add(this.deviceListData.offsetNum, "minute")
|
|
|
|
|
.hour(),
|
|
|
|
|
minute: moment(this.scheduleInfo[j].startTime)
|
|
|
|
|
.add(this.deviceListData.offsetNum, "minute")
|
|
|
|
|
.minute(),
|
|
|
|
|
preset: 255,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
hour: moment(this.scheduleInfo[j].endTime).hour(),
|
|
|
|
|
minute: moment(this.scheduleInfo[j].endTime).minute(),
|
|
|
|
|
preset: 255,
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
console.log(timearr);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
////判断河南规约
|
|
|
|
|
if (this.deviceListData.zzprotocol == "65286") {
|
|
|
|
|
console.log("河南规约");
|
|
|
|
|
//偏移时间
|
|
|
|
|
//this.getDayArr(startDay, endDay);
|
|
|
|
|
let startDay = Stime;
|
|
|
|
|
let endDay = Etime;
|
|
|
|
|
var lastendDay = lastETime;
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// // 将结束日期的天放进数组
|
|
|
|
|
if (!moment().isSame(moment(endDay), "day")) {
|
|
|
|
|
dayArr.push(
|
|
|
|
|
this.$moment(new Date(lastETime)).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,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
// return dayArr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var parmsobj = {
|
|
|
|
|
termid: this.deviceListData.zzid,
|
|
|
|
|
channelid: this.checkList,
|
|
|
|
|
offset: this.deviceListData.offsetNum,
|
|
|
|
|
list: timearr,
|
|
|
|
|
};
|
|
|
|
|
console.log(parmsobj);
|
|
|
|
|
ruleBox.push(parmsobj);
|
|
|
|
|
|
|
|
|
|
console.log(ruleBox);
|
|
|
|
|
|
|
|
|
|
setScheduleRulel({
|
|
|
|
|
scheduleid: this.scheduleid,
|
|
|
|
|
list: [
|
|
|
|
|
{
|
|
|
|
|
termid: this.deviceListData.zzid,
|
|
|
|
|
channelidlist: [this.checkList],
|
|
|
|
|
offset: this.setNum,
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
list: ruleBox,
|
|
|
|
|
})
|
|
|
|
|
.then((res) => {
|
|
|
|
|
console.log(res);
|
|
|
|
@ -703,7 +1154,7 @@ export default {
|
|
|
|
|
closebtn() {
|
|
|
|
|
this.isShowset = false;
|
|
|
|
|
this.checkList = "";
|
|
|
|
|
this.setNum = Math.floor(Math.random() * 10);
|
|
|
|
|
// this.setNum = this.offsetnum;
|
|
|
|
|
this.deviceList();
|
|
|
|
|
|
|
|
|
|
clearInterval(this.timers);
|
|
|
|
|