diff --git a/src/views/components/carouselChart.vue b/src/views/components/carouselChart.vue index aeb294c..c11ceaf 100644 --- a/src/views/components/carouselChart.vue +++ b/src/views/components/carouselChart.vue @@ -282,30 +282,20 @@ export default { }, created() {}, methods: { - downLoadPic(url, name) { - const image = new Image(); - image.setAttribute("crossOrigin", "anonymous"); - image.src = url; - image.onload = () => { - 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(); + async downLoadPic(path, name) { + const imgUrl = path; + const response = await fetch(imgUrl); + const blob = await response.blob(); + // 创建下载链接 + const url = window.URL.createObjectURL(blob); + const link = document.createElement("a"); + link.href = url; + link.download = name; + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); + // 释放 Blob URL + window.URL.revokeObjectURL(url); }, // showbigpicPath(data) { // console.log(data); @@ -626,6 +616,7 @@ export default { bottom: 16px; color: #fff; z-index: 5; + opacity: 0; &:hover { background: rgba(0, 0, 0, 0.9); color: #169e8c; @@ -636,6 +627,10 @@ export default { opacity: 1; transition: all 0.5s ease-in; } + .downBtn { + opacity: 1; + transition: all 0.5s ease-in; + } } .bigimg { width: 100%; diff --git a/src/views/components/carouselChartmore.vue b/src/views/components/carouselChartmore.vue new file mode 100644 index 0000000..9b0b9e9 --- /dev/null +++ b/src/views/components/carouselChartmore.vue @@ -0,0 +1,902 @@ + + + + + + + 下载图片 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{ $moment(item.photoTime).format("HH:mm:ss") }} + + + ( + + {{ $moment(item.recvTime).format("HH:mm:ss") }} + + ) + --{{ + item.alias !== null && item.alias !== "" + ? item.alias + : item.channelName + }} + + + + + + + + + {{ $moment(item.photoTime).format("HH:mm:ss") }} + + + ( + + {{ $moment(item.recvTime).format("HH:mm:ss") }} + + ) + --{{ + item.alias !== null && item.alias !== "" + ? item.alias + : item.channelName + }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/views/realTimeMonitor/components/morePicPreveiw.vue b/src/views/realTimeMonitor/components/morePicPreveiw.vue new file mode 100644 index 0000000..1187742 --- /dev/null +++ b/src/views/realTimeMonitor/components/morePicPreveiw.vue @@ -0,0 +1,125 @@ + + + + + + {{ deviceData.linename }} - {{ deviceData.towername }} - ({{ + deviceData.alias !== null && deviceData.alias !== "" + ? deviceData.alias + : deviceData.channnelname + }}) + + + + + + + + + + + + + + diff --git a/src/views/realTimeMonitor/index.vue b/src/views/realTimeMonitor/index.vue index 46b17be..64df7f1 100644 --- a/src/views/realTimeMonitor/index.vue +++ b/src/views/realTimeMonitor/index.vue @@ -298,6 +298,7 @@ + @@ -319,6 +320,7 @@ import carouselChart from "../components/carouselChart.vue"; import setschedule from "./components/setschedule.vue"; import infoDialog from "./components/infoDialog.vue"; import gpsPosition from "./components/gpsPosition.vue"; +import morePicPreveiw from "./components/morePicPreveiw.vue"; import { number } from "echarts"; export default { components: { @@ -327,6 +329,7 @@ export default { setschedule, infoDialog, gpsPosition, + morePicPreveiw, }, data() { return { @@ -442,6 +445,7 @@ export default { console.log("电压"); this.type = 1; //this.getPicList(data.id, this.type); + this.$refs.previewRef.getPicList(data.id, this.type, this.page); } else if (data.bsManufacturer) { this.LineFlag = true; @@ -510,34 +514,34 @@ export default { this.totalNum = res.data.totalNum; this.currentData = JSON.parse(localStorage.getItem("currentData")); console.log(this.currentData); - if (this.lineTreeData[0].list[0].list.length > 0) { + // if (this.lineTreeData[0].list[0].list.length > 0) { + console.log("diyici"); + if ( + this.currentData !== null && + Object.keys(this.currentData).length !== 0 + ) { + console.log("aaa"); + this.currentNodekey = this.currentData.id; + this.handleNodeClick(this.currentData); + } else { console.log("diyici"); - if ( - this.currentData !== null && - Object.keys(this.currentData).length !== 0 - ) { - console.log("aaa"); - this.currentNodekey = this.currentData.id; - this.handleNodeClick(this.currentData); - } else { - console.log("diyici"); - this.selectData = this.lineTreeData[0]; //第一个选中的数据 - this.currentNodekey = this.lineTreeData[0].id; //第一个数据 - this.type = 1; - this.newCurrentId = this.lineTreeData[0].id; - this.previewData = this.lineTreeData[0]; //预览图数据 - this.channelId = this.currentNodekey; - this.$refs.previewRef.getPicList( - this.currentNodekey, - this.type, - this.page - ); - } - - this.$nextTick(() => { - this.$refs.tree.setCurrentKey(this.currentNodekey); //一定要加这个选中了否则样式没有出来 - }); + this.selectData = this.lineTreeData[0]; //第一个选中的数据 + this.currentNodekey = this.lineTreeData[0].id; //第一个数据 + this.type = 1; + this.newCurrentId = this.lineTreeData[0].id; + this.previewData = this.lineTreeData[0]; //预览图数据 + this.channelId = this.currentNodekey; + this.$refs.previewRef.getPicList( + this.currentNodekey, + this.type, + this.page + ); } + + this.$nextTick(() => { + this.$refs.tree.setCurrentKey(this.currentNodekey); //一定要加这个选中了否则样式没有出来 + }); + // } // if (this.zzradio == -1) { // this.lineTreeData = this.lineTreeData; // } else if (this.zzradio == 1) { @@ -690,62 +694,61 @@ export default { jumpTowerPic(data) { console.log("我是从子组件过来的数据"); console.log(data); - this.LineFlag = false; - this.towerFlag = true; - this.zzCmdid = data.cmdid; - this.towertitle = data.towername; - this.zztermId = data.termid; - this.selectChannelValue = data.channnelname; - this.$refs.tree.setCurrentKey(this.zztermId); //一定要加这个选中了否则样式没有出来 - this.selectedRegion(this.zztermId); - if (data.photoTime == "" || data.photoTime == null) { - this.getDateTime(); - } else { - this.dateValue = data.photoTime; - } - console.log(this.selectChannelValue); - // this.getChannelList(this.zztermId); - getChannelByTermidJoggle({ termid: this.zztermId }) - .then((res) => { - console.log(res); - this.channelList = res.data.list; - console.log(this.channelList); - this.channelOption = []; - this.channelList.forEach((item) => { - this.channelOption.push({ - label: item.channelname, - value: item.channelid, - termid: item.termId, - alias: item.alias, - }); - }); // 选择通道一通道二select框 - console.log(this.channelOption); - this.channelListOption = []; - this.channelListOption.push({ - label: "全部", - value: -1, - termid: "", - alias: "", - }); - this.channelList.forEach((item) => { - this.channelListOption.push({ - label: item.channelname, - value: item.channelid, - termid: item.termId, - alias: item.alias, - }); - }); - this.selectChannelValue = data.channnelname; - this.getTerminalPhotoList( - data.channelid, - this.dateValue, - this.zztermId - ); //获取图片列表是传当前设备的 id 和termid - }) - .catch((err) => { - console.log(err); //代码错误、请求失败捕获 - }); - //this.getTerminalPhotoList(data.channelid, this.dateValue, this.zztermId); + this.$refs.morePicPreveiw_ref.display(data); + // this.LineFlag = false; + // this.towerFlag = true; + // this.zzCmdid = data.cmdid; + // this.towertitle = data.towername; + // this.zztermId = data.termid; + // this.selectChannelValue = data.channnelname; + // this.$refs.tree.setCurrentKey(this.zztermId); //一定要加这个选中了否则样式没有出来 + // this.selectedRegion(this.zztermId); + // if (data.photoTime == "" || data.photoTime == null) { + // this.getDateTime(); + // } else { + // this.dateValue = data.photoTime; + // } + // console.log(this.selectChannelValue); + // getChannelByTermidJoggle({ termid: this.zztermId }) + // .then((res) => { + // console.log(res); + // this.channelList = res.data.list; + // console.log(this.channelList); + // this.channelOption = []; + // this.channelList.forEach((item) => { + // this.channelOption.push({ + // label: item.channelname, + // value: item.channelid, + // termid: item.termId, + // alias: item.alias, + // }); + // }); // 选择通道一通道二select框 + // console.log(this.channelOption); + // this.channelListOption = []; + // this.channelListOption.push({ + // label: "全部", + // value: -1, + // termid: "", + // alias: "", + // }); + // this.channelList.forEach((item) => { + // this.channelListOption.push({ + // label: item.channelname, + // value: item.channelid, + // termid: item.termId, + // alias: item.alias, + // }); + // }); + // this.selectChannelValue = data.channnelname; + // this.getTerminalPhotoList( + // data.channelid, + // this.dateValue, + // this.zztermId + // ); //获取图片列表是传当前设备的 id 和termid + // }) + // .catch((err) => { + // console.log(err); //代码错误、请求失败捕获 + // }); }, selectedRegion(id) { console.log("滚动到选中定位的位置"); diff --git a/vue.config.js b/vue.config.js index 31ee2c5..040028d 100644 --- a/vue.config.js +++ b/vue.config.js @@ -30,7 +30,7 @@ module.exports = defineConfig({ "/api": { //表示拦截以/api开头的请求路径 target: "http://47.96.238.157:8093", //阿里云服务器环境 - // target: "http://180.166.218.222:40080", //dell + //target: "http://180.166.218.222:40080", //dell changOrigin: true, //是否开启跨域 pathRewrite: { "^/api": "", //重写api,把api变成空字符,因为我们真正请求的路径是没有api的
+ + {{ $moment(item.photoTime).format("HH:mm:ss") }} + + + ( + + {{ $moment(item.recvTime).format("HH:mm:ss") }} + + ) + --{{ + item.alias !== null && item.alias !== "" + ? item.alias + : item.channelName + }} +
+ {{ deviceData.linename }} - {{ deviceData.towername }} - ({{ + deviceData.alias !== null && deviceData.alias !== "" + ? deviceData.alias + : deviceData.channnelname + }}) +