From bca50c9ab5ca9eaca50408807e006436699a889d Mon Sep 17 00:00:00 2001 From: lau572 <1010031226@qq.com> Date: Mon, 25 Nov 2024 14:27:04 +0800 Subject: [PATCH] =?UTF-8?q?1.=E9=A6=96=E9=A1=B5=E5=AE=9E=E6=97=B6=E5=88=B7?= =?UTF-8?q?=E6=96=B0=202.=E6=91=84=E5=83=8F=E5=A4=B4=E6=8E=A7=E5=88=B6?= =?UTF-8?q?=E5=BC=B9=E7=AA=97=E7=9B=B8=E5=85=B3=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/VideoMulti/index.vue | 13 +- .../components/ConditionStatistics/index.vue | 24 ++-- .../components/FocusedMonitoring/index.vue | 126 ++++++++++-------- 3 files changed, 90 insertions(+), 73 deletions(-) diff --git a/ruoyi-ui/src/views/JiHeExpressway/components/VideoMulti/index.vue b/ruoyi-ui/src/views/JiHeExpressway/components/VideoMulti/index.vue index c3ef9b4f..4e9cb77a 100644 --- a/ruoyi-ui/src/views/JiHeExpressway/components/VideoMulti/index.vue +++ b/ruoyi-ui/src/views/JiHeExpressway/components/VideoMulti/index.vue @@ -12,7 +12,7 @@ " src="@screen/images/camera-control-icon.svg" width="18px" height="18px" style="cursor: pointer;background-color: #0d5f79;" /> - + @@ -35,7 +35,7 @@ export default { }, props: { - // + // facilityType:{ type: String, default:null @@ -74,18 +74,19 @@ export default { methods: { handleClose() { this.controlDialogVisible = false; - this.player?.destroy(); + // this.player?.destroy(); }, cameraChange() { console.log('chanage.======') + this.controlDialogVisible = false const changeItem = find(this.urls, { iotDeviceId: this.cameraId }); this.dialogData = { ...changeItem, parseOtherConfig: changeItem.otherConfig && JSON.parse(changeItem.otherConfig) }; this.player?.destroy(); const self = this; setTimeout(() => { - self.showVideo(); + self.showVideo(); }, 500); - + }, async playVideo() { this.player?.destroy(); @@ -208,7 +209,7 @@ export default { // -webkit-text-fill-color: transparent; } } - + .video-stream, img { height: 100%; diff --git a/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/ConditionStatistics/index.vue b/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/ConditionStatistics/index.vue index bd6318b5..3f7b1219 100644 --- a/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/ConditionStatistics/index.vue +++ b/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/ConditionStatistics/index.vue @@ -11,7 +11,7 @@
当前天气
济南市
- +
{{ cityWeather.temp }}
@@ -178,25 +178,25 @@ export default { // totalPassengerFlow 客车 typeSpecialVehicleFlow//特种车 typeTruckFlow 其他 let total = 0, p0 = 0, p1=0,p2=0,_p0 = 0, _p1=0,_p2=0; res1.data.forEach(x=>{ - total+=(x.totalPassengerFlow+x.typeTruckFlow+x.typeSpecialVehicleFlow) + total+=(x.totalPassengerFlow+x.typeTruckFlow+x.typeSpecialVehicleFlow) p0 += x.totalPassengerFlow p1 += x.typeSpecialVehicleFlow p2 += x.typeTruckFlow }) res3.data.forEach(x=>{ - total+=(x.totalPassengerFlow+x.typeTruckFlow+x.typeSpecialVehicleFlow) + total+=(x.totalPassengerFlow+x.typeTruckFlow+x.typeSpecialVehicleFlow) p0 += x.totalPassengerFlow p1 += x.typeSpecialVehicleFlow p2 += x.typeTruckFlow }) - + if(total > 0){ _p0 = parseFloat((p0/total*100).toFixed(1)) _p1 = parseFloat((p1/total*100).toFixed(1)) _p2 = parseFloat((p2/total*100).toFixed(1)) } - + this.p0 = p0; this.p1 = p1; this.p2 = p2; @@ -249,11 +249,17 @@ export default { } }, created() { - + }, mounted() { this.bind(); - } + // 设置定时器,每分钟刷新一次 + this.timer = setInterval(this.bind, 60 * 1000); + }, + + beforeDestroy() { + clearInterval(this.timer); // 清除定时器 + }, } @@ -322,7 +328,7 @@ export default { flex: 1; display: flex; flex-direction: column; - + } .box-content0{ background: linear-gradient(180deg, @@ -408,7 +414,7 @@ export default { .box-content1 { display: flex; justify-content: space-between; - + .box-content-l { width: 163px; height: 100%; diff --git a/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/FocusedMonitoring/index.vue b/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/FocusedMonitoring/index.vue index 0a34e16d..471181c6 100644 --- a/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/FocusedMonitoring/index.vue +++ b/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/FocusedMonitoring/index.vue @@ -68,61 +68,70 @@ export default { } }, created() { - // ================== - Promise.allSettled([ - // 交通事件, 施工路段 - request({ - url: `/business/trafficIncidents/getKeyData`, - method: "get", - }), - // 感知事件 - request({ - url: `/perceivedEvents/warning/warningTotal`, - method: "post", - data: {} - }), - request({ - url: `/business/device/abnormalDevice`, - method: "get", - data: {} - }), - // 首页天气预报 - request({url: '/weatherForecast/currentWeatherWarningInformationQuery', - method: 'post', - data: { - "roadId":"G003537", - "earlyWorningLevel":"1|2|3" - } - }), - ]) - .then(([trafficIncidents, perceiveEvent, abnormalDeviceNum, weatherForecast]) => { - if (trafficIncidents.status === 'fulfilled' && trafficIncidents.value.code == 200) { - const data = trafficIncidents.value.data; + this.initData() + // 设置定时器,每分钟刷新一次 + this.timer = setInterval(this.initData, 60 * 1000); + }, + beforeDestroy() { + clearInterval(this.timer); // 清除定时器 + }, - this.trafficIncidents = [ - data.processing || 0, - data.total || 0 - ]; + methods: { + initData(){ + Promise.allSettled([ + // 交通事件, 施工路段 + request({ + url: `/business/trafficIncidents/getKeyData`, + method: "get", + }), + // 感知事件 + request({ + url: `/perceivedEvents/warning/warningTotal`, + method: "post", + data: {} + }), + request({ + url: `/business/device/abnormalDevice`, + method: "get", + data: {} + }), + // 首页天气预报 + request({url: '/weatherForecast/currentWeatherWarningInformationQuery', + method: 'post', + data: { + "roadId":"G003537", + "earlyWorningLevel":"1|2|3" + } + }), + ]) + .then(([trafficIncidents, perceiveEvent, abnormalDeviceNum, weatherForecast]) => { + if (trafficIncidents.status === 'fulfilled' && trafficIncidents.value.code == 200) { + const data = trafficIncidents.value.data; - this.constructionSection = data.construction || 0 - } + this.trafficIncidents = [ + data.processing || 0, + data.total || 0 + ]; - if (perceiveEvent.status === 'fulfilled' && perceiveEvent.value.code == 200) { - const data = perceiveEvent.value.data; + this.constructionSection = data.construction || 0 + } - this.perceiveEvent = data.number || 0; - } - if (abnormalDeviceNum.status === 'fulfilled' && abnormalDeviceNum.value.code == 200) { - const data = abnormalDeviceNum.value.data; - this.abnormalDeviceNum = data || 0; - } - if (weatherForecast && weatherForecast.status === 'fulfilled' && weatherForecast.value.code == 200) { - const data = weatherForecast.value.data; - this.weatherForecast = data.length; - } - }) - //-----当前在途车辆 - request({ + if (perceiveEvent.status === 'fulfilled' && perceiveEvent.value.code == 200) { + const data = perceiveEvent.value.data; + + this.perceiveEvent = data.number || 0; + } + if (abnormalDeviceNum.status === 'fulfilled' && abnormalDeviceNum.value.code == 200) { + const data = abnormalDeviceNum.value.data; + this.abnormalDeviceNum = data || 0; + } + if (weatherForecast && weatherForecast.status === 'fulfilled' && weatherForecast.value.code == 200) { + const data = weatherForecast.value.data; + this.weatherForecast = data.length; + } + }) + //-----当前在途车辆 + request({ url: `/business/traffic-statistics/current/in-transit-vehicles`, method: "get", }).then((result) => { @@ -134,19 +143,19 @@ export default { this.transitVehicles = _count; }) - //-----日累计车流量 - request({ + //-----日累计车流量 + request({ url: `/business/traffic-statistics/history/trafficFlowAtToll`, method: "get", params: { startDate:moment().format('YYYY-MM-DD') - } - }).then((result) => { + } + }).then((result) => { if (result.code != 200) return Message.error(result?.msg); this.trafficVolume = result.data; - }) - //-----平均车速 - request({ + }) + //-----平均车速 + request({ url: `/business/traffic-statistics/current/average-speed`, method: "get", }).then((result) => { @@ -157,6 +166,7 @@ export default { this.averageSpeed = toDecimal(_count/result.data.length) } }) + } } }