+
+
下载图片
{
+ const canvas = document.createElement("canvas");
+ canvas.width = image.width;
+ canvas.height = image.height;
+ const ctx = canvas.getContext("2d");
+ ctx.drawImage(image, 0, 0, image.width, image.height);
+ canvas.toBlob((blob) => {
+ const url = URL.createObjectURL(blob);
+ this.download(url, name);
+ // 用完释放URL对象
+ URL.revokeObjectURL(url);
+ });
+ };
+ },
+ download(href, name) {
+ const eleLink = document.createElement("a");
+ eleLink.download = name;
+ eleLink.href = href;
+ eleLink.click();
+ eleLink.remove();
+ },
// showbigpicPath(data) {
// console.log(data);
// if (data.includes("!")) {
@@ -582,6 +618,19 @@ export default {
overflow: hidden;
margin-bottom: 4px;
position: relative;
+ .downBtn {
+ position: absolute;
+ background: rgba(0, 0, 0, 0.5);
+ border: none;
+ right: 8px;
+ bottom: 16px;
+ color: #fff;
+ z-index: 5;
+ &:hover {
+ background: rgba(0, 0, 0, 0.9);
+ color: #169e8c;
+ }
+ }
&:hover {
.arrow {
opacity: 1;
diff --git a/src/views/devicePhotoSchedule/components/adddeviceDialog copy.vue b/src/views/devicePhotoSchedule/components/adddeviceDialog copy.vue
new file mode 100644
index 0000000..d559381
--- /dev/null
+++ b/src/views/devicePhotoSchedule/components/adddeviceDialog copy.vue
@@ -0,0 +1,260 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/devicePhotoSchedule/components/adddeviceDialog.vue b/src/views/devicePhotoSchedule/components/adddeviceDialog.vue
index 717a4e4..fb39916 100644
--- a/src/views/devicePhotoSchedule/components/adddeviceDialog.vue
+++ b/src/views/devicePhotoSchedule/components/adddeviceDialog.vue
@@ -20,12 +20,12 @@
-
+
@@ -54,7 +56,7 @@
icon="el-icon-plus"
type="primary"
@click="addModule()"
- v-if="index + 1 == ruleForm.list.length"
+ v-if="index + 1 == ruleForm.listTime.length"
>
@@ -91,24 +93,25 @@ export default {
if (val == null) {
return (this.ruleForm = {
name: "",
- list: [
+ listTime: [
{
time: "",
span: "",
},
],
+ list: [],
remark: "",
});
}
//this.ruleForm = val;
this.ruleForm = JSON.parse(JSON.stringify(val));
- this.ruleForm.list.forEach((val) => {
+ this.ruleForm.listTime.forEach((val) => {
this.$set(val, "time", [val.startTime, val.endTime]);
});
},
addModule() {
//新增一行
- this.ruleForm.list.push({
+ this.ruleForm.listTime.push({
time: "",
span: "",
});
@@ -135,10 +138,42 @@ export default {
this.$refs.formInfo.validate((valid) => {
if (valid) {
// delete this.ruleForm.time;
- this.ruleForm.list.forEach((val) => {
- this.$set(val, "startTime", val.time[0]);
- this.$set(val, "endTime", val.time[1]);
+
+ this.ruleForm.listTime.forEach((val) => {
+ this.$set(val, "startTime", new Date(val.time[0]));
+ this.$set(val, "endTime", new Date(val.time[1]));
+ // console.log(val.time[0]);
+ // console.log(typeof val.time[0]);
+ // console.log(new Date(val.time[0]));
+ // console.log(new Date(val.time[1]));
+ // console.log(new Date(val.time[0]).getHours());
+ // console.log(new Date(val.time[0]).getMinutes());
});
+
+ let arr = [];
+ for (var i = 0; i < this.ruleForm.listTime.length; i++) {
+ console.log(this.ruleForm.listTime);
+
+ 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,
+ }
+ );
+ }
+ console.log(arr);
+ this.ruleForm.list = arr;
if (this.title == "新增") {
addScheduleRulel(this.ruleForm)
.then((res) => {
diff --git a/src/views/devicePhotoSchedule/components/setdevice.vue b/src/views/devicePhotoSchedule/components/setdevice.vue
index 3e6a8b4..cb1fc90 100644
--- a/src/views/devicePhotoSchedule/components/setdevice.vue
+++ b/src/views/devicePhotoSchedule/components/setdevice.vue
@@ -14,13 +14,29 @@
{{
- val.startTime.substring(0, val.startTime.lastIndexOf(":"))
+ 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()
}}
~
- {{
- val.endTime.substring(0, val.endTime.lastIndexOf(":"))
- }}
+ {{
+ 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()
+ }}
间隔:{{ val.span }}分钟
@@ -65,6 +81,10 @@
:max="9"
>
+
{});
},
- //// 给数组里的每一个对象都添加一个isEdit属性
+ // 给数组里的每一个对象都添加一个isEdit属性
getChildren(data) {
console.log(data);
return data.map((item) => {
@@ -211,10 +235,34 @@ export default {
this.allCheckNode = this.$refs.tree.getCheckedNodes();
// console.log(this.allCheckNode);
console.log(nodeObj);
+ console.log(this.allCheckNode);
this.isactive = nodeObj.id;
this.isCheck = this.$refs.tree.getCheckedNodes().indexOf(nodeObj) > -1;
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() {
@@ -224,19 +272,168 @@ export default {
},
//时间表
sureSum() {
- //console.log(this.termidArr);
console.log(this.checkedAisle);
+
var ruleBox = [];
+ //循环装置
for (var i = 0; i < this.allCheckNode.length; i++) {
- var parmsobj = {
- termid: this.allCheckNode[i].id,
- channelidlist: [this.checkedAisle],
- offset: this.allCheckNode[i].offsetNum,
- };
- console.log(parmsobj);
- ruleBox.push(parmsobj);
+ 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 lastETime = moment(this.ruleSchedule[j].endTime).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" ||
+ this.allCheckNode[i].protocol == "65282"
+ ) {
+ console.log("河南规约");
+ //偏移时间
+ //this.getDayArr(startDay, endDay);
+
+ let startDay = Stime;
+ let endDay = Etime;
+ var lastendDay = lastETime;
+ console.log(lastETime);
+ console.log(startDay, endDay);
+ let startVal = this.$moment(new Date(startDay)).format(
+ "YYYY-MM-DD HH:mm"
+ );
+ console.log(startVal);
+ console.log(moment().isSame(moment(endDay), "day"));
+ 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.allCheckNode[i].id,
+ channelid: this.checkedAisle,
+ offset: this.allCheckNode[i].offsetNum,
+ list: timearr,
+ };
+ console.log(parmsobj);
+ ruleBox.push(parmsobj);
+ }
+ console.log(ruleBox);
}
- console.log(ruleBox);
setScheduleRulel({
list: ruleBox,
scheduleid: this.selid,
@@ -252,14 +449,19 @@ export default {
}, 3000);
})
.catch((err) => {
- this.$message({
- duration: 1500,
- showClose: true,
- message: "添加失败",
- type: "error",
- });
+ // this.$message({
+ // duration: 1500,
+ // showClose: true,
+ // message: "添加失败",
+ // type: "error",
+ // });
});
},
+ //获取到时间规则,把时间规则转化为对应的规约格式
+ //湖南规约
+ getHnTime() {},
+ //河南规约
+ getZzTime() {},
//根据requestid查询时间表下发状态
requestTime() {
this.sureloading = true;
@@ -274,7 +476,6 @@ export default {
arr
) {
console.log(value, index, arr);
-
return value.status !== 1;
});
if (this.requestList.length == 0) {
diff --git a/src/views/devicePhotoSchedule/components/setdevicebak.vue b/src/views/devicePhotoSchedule/components/setdevicebak.vue
deleted file mode 100644
index d3255b3..0000000
--- a/src/views/devicePhotoSchedule/components/setdevicebak.vue
+++ /dev/null
@@ -1,386 +0,0 @@
-
-
-
-
时间表规则
-
-
-
- {{
- val.startTime.substring(0, val.startTime.lastIndexOf(":"))
- }}
- ~
- {{
- val.endTime.substring(0, val.endTime.lastIndexOf(":"))
- }}
- 间隔:{{ val.span }}分钟
-
-
-
设置通道
-
-
-
-
- {{ val.name }}
-
-
-
-
-
-
- {{ data.name }}
-
-
-
- {{ data.name }}
-
-
-
-
-
-
-
-
-
-
diff --git a/src/views/devicePhotoSchedule/index copy.vue b/src/views/devicePhotoSchedule/index copy.vue
new file mode 100644
index 0000000..40c3a2c
--- /dev/null
+++ b/src/views/devicePhotoSchedule/index copy.vue
@@ -0,0 +1,280 @@
+
+
+
+
+
diff --git a/src/views/devicePhotoSchedule/index.vue b/src/views/devicePhotoSchedule/index.vue
index 40c3a2c..a4c6dea 100644
--- a/src/views/devicePhotoSchedule/index.vue
+++ b/src/views/devicePhotoSchedule/index.vue
@@ -13,7 +13,7 @@
{{ scope.row.name }}
-
{{
- val.startTime.substring(0, val.startTime.lastIndexOf(":"))
+ 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()
}}
+
~
- {{
- val.endTime.substring(0, val.endTime.lastIndexOf(":"))
- }}
+ {{
+ 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()
+ }}
间隔:{{ val.span }}分钟
-
@@ -127,6 +129,8 @@ export default {
return {
title: "", //弹窗标题
deviceTableData: [],
+ newList: [],
+ listTime: [],
//multipleSelection: [], //获取当前选中
page: 1, // 当前页数
pageSize: 20, // 每页数量
@@ -146,9 +150,94 @@ export default {
pagesize: this.pageSize,
})
.then((res) => {
+ this.newList = [];
this.deviceTableData = res.data.list;
this.total = res.data.total;
this.loading = false;
+ // for (var i = 0; i < this.deviceTableData.list.length; i++) {
+ // console.log(this.deviceTableData.list[i]);
+ // }
+ console.log(this.deviceTableData);
+
+ for (var i = 0; i < this.deviceTableData.length; i++) {
+ var arr = [];
+ console.log(this.deviceTableData[i]);
+ for (var k = 0; k < this.deviceTableData[i].list.length; k++) {
+ if (k % 3 == 0) {
+ var obj = {};
+ obj.span =
+ this.deviceTableData[i].list[k].hour * 60 +
+ this.deviceTableData[i].list[k].minute;
+ console.log("时间间隔");
+ } else if (k % 3 == 1) {
+ console.log("开始时间");
+ console.log("a");
+ // obj.startTime =
+ // this.deviceTableData[i].list[k].hour +
+ // ":" +
+ // this.deviceTableData[i].list[k].minute;
+ // console.log(new Date());
+ let timeDate = new Date();
+ timeDate.setHours(this.deviceTableData[i].list[k].hour);
+ timeDate.setMinutes(this.deviceTableData[i].list[k].minute);
+ console.log(timeDate);
+ // console.log(new Date().getHours());
+ // console.log(
+ // new Date().setHours(this.deviceTableData[i].list[k].hour)
+ // );
+ // console.log(d.getHours() + ":" + d.getMinutes());
+ // if (timeDate.getHours() < 10) {
+ // console.log(timeDate.getHours());
+ // obj.startTime =
+ // "0" + timeDate.getHours() + ":" + timeDate.getMinutes();
+ // } else {
+
+ // }
+
+ // let timeHour =
+ // timeDate.getHours() < 10
+ // ? "0" + timeDate.getHours()
+ // : timeDate.getHours();
+ // let timeMinute =
+ // timeDate.getMinutes() < 10
+ // ? "0" + timeDate.getMinutes()
+ // : timeDate.getMinutes();
+ obj.startTime = timeDate.toUTCString();
+ } else if (k % 3 == 2) {
+ console.log("结束时间");
+ obj.endTime =
+ this.deviceTableData[i].list[k].hour +
+ ":" +
+ this.deviceTableData[i].list[k].minute;
+ let timeDate = new Date();
+ timeDate.setHours(this.deviceTableData[i].list[k].hour);
+ timeDate.setMinutes(this.deviceTableData[i].list[k].minute);
+ // obj.endTime = c.toJSON();
+ let timeHour =
+ timeDate.getHours() < 10
+ ? "0" + timeDate.getHours()
+ : timeDate.getHours();
+ let timeMinute =
+ timeDate.getMinutes() < 10
+ ? "0" + timeDate.getMinutes()
+ : timeDate.getMinutes();
+ //obj.startTime = timeHour + ":" + timeMinute;
+ // obj.endTime = timeHour + ":" + timeMinute;
+ obj.endTime = timeDate.toUTCString();
+ arr.push(obj);
+ }
+ console.log(this.deviceTableData[i].list[k]);
+ }
+ this.newList.push({
+ id: this.deviceTableData[i].id,
+ list: this.deviceTableData[i].list,
+ name: this.deviceTableData[i].name,
+ remark: this.deviceTableData[i].remark,
+ listTime: arr,
+ });
+ }
+ console.log("this.newList");
+ console.log(this.newList);
})
.catch((err) => {});
},
diff --git a/src/views/management/monitoringEquipment/photographicDevice/index.vue b/src/views/management/monitoringEquipment/photographicDevice/index.vue
index aca9db7..c62cc55 100644
--- a/src/views/management/monitoringEquipment/photographicDevice/index.vue
+++ b/src/views/management/monitoringEquipment/photographicDevice/index.vue
@@ -183,8 +183,7 @@
show-overflow-tooltip
min-width="90"
v-if="roleUser != 2"
- >
-
+ />
时间表:
{{ val.substring(0, val.lastIndexOf(":")) }}{{ val.substring(val.length - 5) }}
+ {{ $moment(val).format("HH:mm") }}
+
装置时间表:
-
(偏移时间{{ offsetnum }}分钟)
{{ val.substring(val.length - 5) }}
+ {{ val.substring(0, val.lastIndexOf(":")) }}{{ $moment(val).format("HH:mm") }}
@@ -92,7 +111,7 @@
{{ scope.row.name }}
-
+
+
{{
- val.startTime.substring(0, val.startTime.lastIndexOf(":"))
+ 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()
}}
+
~
- {{
- val.endTime.substring(0, val.endTime.lastIndexOf(":"))
- }}
+ {{
+ 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()
+ }}
间隔:{{ val.span }}分钟
@@ -183,8 +219,31 @@
v-for="(val, index) in scheduleInfo"
:key="index"
>
- {{ val.startTime }} ~
- {{ val.endTime }}
+ {{
+ 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()
+ }}
+ ~
+ {{
+ 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()
+ }}
间隔:{{ val.span }}分钟
@@ -245,6 +304,7 @@ import {
getCmaSchelduleUpload,
getTermStatus,
} from "@/utils/api/index";
+import moment from "moment";
export default {
props: {
title: String,
@@ -259,6 +319,8 @@ export default {
selaccess: "", //选中的通道
shedulenr: [], //查询的时间表
deviceTableData: [], //时间表-表格
+ newList: [],
+ listTime: [],
page: 1, // 当前页数
pageSize: 10, // 每页数量
total: 0, //总条数
@@ -295,6 +357,7 @@ export default {
offsetnum: "",
setNum: Math.floor(Math.random() * 10),
compareloading: false,
+ timeProtocol: "",
};
},
mounted() {
@@ -305,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;
@@ -321,10 +386,103 @@ export default {
terminalid: this.selfacilityId,
})
.then((res) => {
- // this.$message.success("查询成功");
- // this.shedulenr = res.data.list.join("; ")
this.shedulenr = res.data.list;
+ console.log(res.data.offset);
this.offsetnum = res.data.offset;
+ console.log(this.offsetnum);
+ console.log("aaaaa");
+ 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" ||
+ this.timeProtocol == "65282"
+ ) {
+ 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.loading = false;
})
.catch((err) => {
@@ -343,9 +501,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" || this.timeProtocol == "65282") {
+ 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;
})
@@ -386,6 +630,105 @@ export default {
// this.shedulenr = res.data.list.join("; ")
this.compareloading = false;
this.newshedulenr = res.data.list;
+ this.offsetnum = res.data.offset;
+ console.log("qqqqqqqqqqqqqqqqqqqqqq");
+ console.log(this.offsetnum);
+ //湖南规约
+ 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" ||
+ this.timeProtocol == "65282"
+ ) {
+ 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);
@@ -416,10 +759,98 @@ export default {
pagesize: this.pageSize,
})
.then((res) => {
+ // this.deviceTableData = res.data.list;
+ // this.total = res.data.total;
+ // console.log(this.deviceTableData);
+ // this.loading = false;
+ this.newList = [];
this.deviceTableData = res.data.list;
this.total = res.data.total;
- console.log(this.deviceTableData);
this.loading = false;
+ // for (var i = 0; i < this.deviceTableData.list.length; i++) {
+ // console.log(this.deviceTableData.list[i]);
+ // }
+ // console.log(this.deviceTableData);
+
+ for (var i = 0; i < this.deviceTableData.length; i++) {
+ var arr = [];
+ console.log(this.deviceTableData[i]);
+ for (var k = 0; k < this.deviceTableData[i].list.length; k++) {
+ if (k % 3 == 0) {
+ var obj = {};
+ obj.span =
+ this.deviceTableData[i].list[k].hour * 60 +
+ this.deviceTableData[i].list[k].minute;
+ console.log("时间间隔");
+ } else if (k % 3 == 1) {
+ console.log("开始时间");
+ console.log("a");
+ // obj.startTime =
+ // this.deviceTableData[i].list[k].hour +
+ // ":" +
+ // this.deviceTableData[i].list[k].minute;
+ // console.log(new Date());
+ let timeDate = new Date();
+ timeDate.setHours(this.deviceTableData[i].list[k].hour);
+ timeDate.setMinutes(this.deviceTableData[i].list[k].minute);
+ console.log(timeDate);
+ // console.log(new Date().getHours());
+ // console.log(
+ // new Date().setHours(this.deviceTableData[i].list[k].hour)
+ // );
+ // console.log(d.getHours() + ":" + d.getMinutes());
+ // if (timeDate.getHours() < 10) {
+ // console.log(timeDate.getHours());
+ // obj.startTime =
+ // "0" + timeDate.getHours() + ":" + timeDate.getMinutes();
+ // } else {
+
+ // }
+
+ // let timeHour =
+ // timeDate.getHours() < 10
+ // ? "0" + timeDate.getHours()
+ // : timeDate.getHours();
+ // let timeMinute =
+ // timeDate.getMinutes() < 10
+ // ? "0" + timeDate.getMinutes()
+ // : timeDate.getMinutes();
+ obj.startTime = timeDate.toUTCString();
+ } else if (k % 3 == 2) {
+ console.log("结束时间");
+ obj.endTime =
+ this.deviceTableData[i].list[k].hour +
+ ":" +
+ this.deviceTableData[i].list[k].minute;
+ let timeDate = new Date();
+ timeDate.setHours(this.deviceTableData[i].list[k].hour);
+ timeDate.setMinutes(this.deviceTableData[i].list[k].minute);
+ // obj.endTime = c.toJSON();
+ let timeHour =
+ timeDate.getHours() < 10
+ ? "0" + timeDate.getHours()
+ : timeDate.getHours();
+ let timeMinute =
+ timeDate.getMinutes() < 10
+ ? "0" + timeDate.getMinutes()
+ : timeDate.getMinutes();
+ //obj.startTime = timeHour + ":" + timeMinute;
+ // obj.endTime = timeHour + ":" + timeMinute;
+ obj.endTime = timeDate.toUTCString();
+ arr.push(obj);
+ }
+ console.log(this.deviceTableData[i].list[k]);
+ }
+ this.newList.push({
+ id: this.deviceTableData[i].id,
+ list: this.deviceTableData[i].list,
+ name: this.deviceTableData[i].name,
+ remark: this.deviceTableData[i].remark,
+ listTime: arr,
+ });
+ }
+ console.log("this.newList");
+ console.log(this.newList);
})
.catch((err) => {});
},
@@ -430,11 +861,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) => {
@@ -446,9 +880,14 @@ export default {
dyid: this.listnr[0].id,
xlname: this.listnr[0].list[0].name,
xlid: this.listnr[0].list[0].id,
- zzname: this.listnr[0].list[0].list[0].name,
+ zzname:
+ this.listnr[0].list[0].list[0].name == null
+ ? this.listnr[0].list[0].list[0].cmdid
+ : 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);
@@ -518,15 +957,152 @@ 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" ||
+ this.timeProtocol == "65282"
+ ) {
+ 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);
@@ -595,8 +1171,9 @@ export default {
},
closebtn() {
this.isShowset = false;
+ this.deviceListData = [];
this.checkList = "";
- this.setNum = Math.floor(Math.random() * 10);
+ // this.setNum = this.offsetnum;
this.deviceList();
clearInterval(this.timers);
@@ -654,12 +1231,14 @@ export default {
}
}
.timeShow {
- display: flex;
+ //display: flex;
.leftTime {
width: 50%;
+ float: left;
}
.rightTime {
width: 50%;
+ float: right;
position: relative;
.offtime {
position: absolute;
diff --git a/src/views/realTimeMonitor/index.vue b/src/views/realTimeMonitor/index.vue
index f0e212d..46b17be 100644
--- a/src/views/realTimeMonitor/index.vue
+++ b/src/views/realTimeMonitor/index.vue
@@ -20,6 +20,20 @@