diff --git a/src/views/devicePhotoSchedule/components/adddeviceDialog.vue b/src/views/devicePhotoSchedule/components/adddeviceDialog.vue index 7ace0c5..fb39916 100644 --- a/src/views/devicePhotoSchedule/components/adddeviceDialog.vue +++ b/src/views/devicePhotoSchedule/components/adddeviceDialog.vue @@ -138,9 +138,10 @@ export default { this.$refs.formInfo.validate((valid) => { if (valid) { // delete this.ruleForm.time; + this.ruleForm.listTime.forEach((val) => { - this.$set(val, "startTime", val.time[0]); - this.$set(val, "endTime", val.time[1]); + 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])); @@ -148,9 +149,11 @@ export default { // 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), diff --git a/src/views/devicePhotoSchedule/components/setdevice.vue b/src/views/devicePhotoSchedule/components/setdevice.vue index 3e6a8b4..395b457 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" > +
+ 规约: + {{ data.protocol }} +
{}); }, - //// 给数组里的每一个对象都添加一个isEdit属性 + // 给数组里的每一个对象都添加一个isEdit属性 getChildren(data) { console.log(data); return data.map((item) => { @@ -224,14 +245,16 @@ export default { }, //时间表 sureSum() { - //console.log(this.termidArr); + console.log(this.ruleSchedule); + 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], + channelidlist: this.checkedAisle, offset: this.allCheckNode[i].offsetNum, + list: [], }; console.log(parmsobj); ruleBox.push(parmsobj); diff --git a/src/views/devicePhotoSchedule/index.vue b/src/views/devicePhotoSchedule/index.vue index 331330e..a4c6dea 100644 --- a/src/views/devicePhotoSchedule/index.vue +++ b/src/views/devicePhotoSchedule/index.vue @@ -37,9 +37,32 @@ v-for="(val, index) in scope.row.listTime" :key="index" > - {{ val.startTime }} + + {{ + 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 }} + {{ + 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 }}分钟

@@ -134,7 +157,7 @@ export default { // for (var i = 0; i < this.deviceTableData.list.length; i++) { // console.log(this.deviceTableData.list[i]); // } - // console.log(this.deviceTableData); + console.log(this.deviceTableData); for (var i = 0; i < this.deviceTableData.length; i++) { var arr = []; @@ -153,17 +176,55 @@ export default { // this.deviceTableData[i].list[k].hour + // ":" + // this.deviceTableData[i].list[k].minute; - obj.startTime = new Date().toISOString(); + // 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("2222222222222222222222222222"); - console.log(arr); - console.log("2222222222222222222222222222"); } console.log(this.deviceTableData[i].list[k]); } diff --git a/src/views/realTimeMonitor/components/setschedule.vue b/src/views/realTimeMonitor/components/setschedule.vue index 9bc62d9..309dd5a 100644 --- a/src/views/realTimeMonitor/components/setschedule.vue +++ b/src/views/realTimeMonitor/components/setschedule.vue @@ -92,7 +92,7 @@
- + @@ -259,6 +276,8 @@ export default { selaccess: "", //选中的通道 shedulenr: [], //查询的时间表 deviceTableData: [], //时间表-表格 + newList: [], + listTime: [], page: 1, // 当前页数 pageSize: 10, // 每页数量 total: 0, //总条数 @@ -416,10 +435,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) => {}); },