Przeglądaj źródła

优化院区今日动态数据获取

xiongxing 15 godzin temu
rodzic
commit
ca01827568
3 zmienionych plików z 22 dodań i 6 usunięć
  1. 2 2
      .env
  2. 3 3
      src/layout/index.vue
  3. 17 1
      src/views/index/roomdetail.vue

+ 2 - 2
.env

@@ -4,10 +4,10 @@
 # VITE_API_URL='http://47.107.245.0:48080/'
 #VITE_API_URL='https://home.ynims.com/dataScreen/dataBigScreen/'
 VITE_API_URL='http://47.107.245.0:48080/'
-VITE_API_APP_URL='http://47.112.126.153:7060/'
+# VITE_API_APP_URL='http://47.112.126.153:7060/'
 # VITE_API_WSS_URL='ws://47.112.126.153:7061/ws/monitor/'
 VITE_API_WSS_URL='wss://home.ynims.com:6060/ws/monitor/'
-# VITE_API_APP_URL='https://home.ynims.com:6060'
+VITE_API_APP_URL='https://home.ynims.com:6060'
 
 
 

+ 3 - 3
src/layout/index.vue

@@ -337,7 +337,7 @@
 		heartbeatInterval = setInterval(() => {
 			if (socket.value && socket.value.readyState === WebSocket.OPEN) {
 				const success = sendMessage({
-					type: 'PING',
+					type: 'HEARTBEAT',
 					timestamp: Date.now(),
 					clientTime: Date.now()
 				});
@@ -349,7 +349,7 @@
 					}
 
 					heartbeatTimeout = setTimeout(() => {
-						addLog('心跳响应超时,连接可能已断开', 'error');
+						// addLog('心跳响应超时,连接可能已断开', 'error');
 						if (socket.value) {
 							socket.value.close(1000, '心跳超时');
 						}
@@ -451,7 +451,7 @@
 	       `
 				})
 			});
-			$bus.emit('roomDetails', 1);
+			$bus.emit('roomDetails', alertData);
 			// 重新获取信息
 			// overviewStatistics()
 			// <div>设备: ${alert.deviceId || '未知'}</div>

+ 17 - 1
src/views/index/roomdetail.vue

@@ -78,6 +78,7 @@
 
 	import { getHomeInfoHomeData } from '@/api/index/index.js';
 	import $bus from '@/utils/mitt.js';
+	import fetchApp from '@/axios/fetchApp.js';
 
 	const emit = defineEmits(['dow_map']);
 	const store = useMechanismStore();
@@ -117,11 +118,26 @@
 		$bus.on('roomDetails', data => {
 			console.log('监听全局emit预警事件data', data);
 			if (data) {
-				get_homemestfun();
+				getTodayData(data)
+				// get_homemestfun();
 			}
 		});
 	});
 
+	const getTodayData = async(data)=>{
+		if(data.data.organizationId != store.tenantId) return
+		try {
+			fetchApp.get('/v2/api/screen/getTodayData?tenantId=' + data.data.organizationId).then(res => {
+				if (res.code == 200) {
+					todayactivelist.value = res.data;
+				}
+			});
+		} catch (error) {
+			console.log('error', error);
+			message.error('暂无监控资源!');
+		}
+	}
+
 	const backpagefun = () => {
 		emit('dow_map', 1);
 		$router.push({