diff --git a/src/utils/api/index.js b/src/utils/api/index.js index 33bfed3..7163fa2 100644 --- a/src/utils/api/index.js +++ b/src/utils/api/index.js @@ -335,3 +335,12 @@ export function getAllTowerJoggle(data) { data, }); } + +//手动拍照获取最新图片 +export function getReturnedPhotoJoggle(data) { + return request({ + url: "/api/getReturnedPhoto", + method: "post", + data, + }); +} diff --git a/src/views/realTimeMonitor/index.vue b/src/views/realTimeMonitor/index.vue index e5babf7..b51c976 100644 --- a/src/views/realTimeMonitor/index.vue +++ b/src/views/realTimeMonitor/index.vue @@ -25,7 +25,9 @@ class="iconfont icon-video-camera" style="margin-right: 6px" > - {{ node.label }} + {{ + node.label + }} @@ -80,6 +82,10 @@ 手动拍照 + + 获取GPS位置 @@ -99,9 +105,9 @@ 关闭GPS - + > @@ -123,6 +129,7 @@ import { getTermGPSJoggle, setTermGPSJoggle, getLatestPhotoJoggle, + getReturnedPhotoJoggle, } from "@/utils/api/index"; import carouselChart from "../components/carouselChart.vue"; import setschedule from "./components/setschedule.vue"; @@ -139,6 +146,7 @@ export default { }, data() { return { + onlinestatus: "", //设备状态 showBigPic: true, defaultKey: "", lineTreeData: [], @@ -170,6 +178,10 @@ export default { label: "关闭", }, ], + newPicData: "", + timer: null, + i: 0, + newTermId: "", }; }, watch: { @@ -208,10 +220,16 @@ export default { .then((res) => { console.log(res); this.lineTreeData = res.data.list; + console.log(this.lineTreeData); console.log(this.lineTreeData[0].list[0].list); if (this.lineTreeData[0].list[0].list.length > 0) { this.currentNodekey = this.lineTreeData[0].list[0].list[0].id; //第一个数据 + this.newTermId = this.lineTreeData[0].list[0].list[0].id; + console.log(this.currentNodekey); + console.log("ssssssssssssssssss"); + console.log(this.newTermId); + console.log("ssssssssssssssssss"); this.cmdid = this.lineTreeData[0].list[0].list[0].cmdid; console.log(this.cmdid); this.$nextTick(() => { @@ -236,6 +254,11 @@ export default { } this.channelId = data.id; //获取当前点击的id this.cmdid = data.cmdid; + this.newTermId = data.id; //获取当前点击的id + + console.log("1111"); + console.log(this.newTermId, this.channelId); + console.log("1111"); this.channelValue = []; this.channelOption = []; this.getChannelList(this.channelId); //获取通道id接口 @@ -394,11 +417,53 @@ export default { type: "success", }); console.log(res); + this.newPicData = res.data; + console.log(this.newPicData); + console.log(this.newTermId); + this.timer = window.setInterval(() => { + this.newPicApi(); + this.i++; + }, 10000); }) .catch((err) => { console.log(err); //代码错误、请求失败捕获 }); }, + //获取最新图片 + newPicApi() { + getReturnedPhotoJoggle({ + photoTime: this.newPicData, + termId: this.newTermId, + }).then((res) => { + console.log(res.data); + console.log(this.i); + //console.log(this.newPicData, this.currentNodekey); + if (res.data == true && this.i < 10) { + console.log(res.data); + clearInterval(this.timer); + this.timer = null; + this.getTerminalPhotoList( + this.channelValue, + this.dateValue, + this.channelList[0].termId + ); + console.log("返回最新图片"); + } else if (res.data == false && this.i > 10) { + clearInterval(this.timer); + this.timer = null; + this.$message({ + message: "自动拍照暂无响应,请稍后再试!", + type: "warning", + }); + } + console.log("2222222222222222"); + }); + }, + stop() { + clearInterval(this.timer); + this.timer = null; + }, + //装置信息handleShowInfo handleShowInfo() { this.$refs.infodialog_ref.display(); @@ -409,6 +474,11 @@ export default { // // sessionStorage.setItem("keyPath", " realTimeSearch"); // }, }, + destroyed() { + //离开页面是销毁 + clearInterval(this.timer); + this.timer = null; + }, }; @@ -435,6 +505,9 @@ export default { height: 40px; font-size: 12px; } + .custom-tree-node { + color: #333; + } } .el-tree--highlight-current .el-tree-node.is-current @@ -442,6 +515,13 @@ export default { // 设置颜色 color: #fff; background: #2d8cf0; + .custom-tree-node { + color: #fff; + } + } + + .disconnect { + color: #d3d3d3; } } .picSetBox {