diff --git a/global.types/components.d.ts b/global.types/components.d.ts index e1252ea..b6c94ef 100644 --- a/global.types/components.d.ts +++ b/global.types/components.d.ts @@ -24,8 +24,6 @@ declare module 'vue' { ElDialog: typeof import('element-plus/es')['ElDialog'] ElDivider: typeof import('element-plus/es')['ElDivider'] ElDrawer: typeof import('element-plus/es')['ElDrawer'] - ElEmpt: typeof import('element-plus/es')['ElEmpt'] - ElEmpty: typeof import('element-plus/es')['ElEmpty'] ElHeader: typeof import('element-plus/es')['ElHeader'] ElInput: typeof import('element-plus/es')['ElInput'] ElMenu: typeof import('element-plus/es')['ElMenu'] diff --git a/src/App.vue b/src/App.vue index 91e3cb7..faaef9b 100644 --- a/src/App.vue +++ b/src/App.vue @@ -5,7 +5,7 @@ import zhCn from 'element-plus/dist/locale/zh-cn.mjs' import { ElNotification, type NotificationHandle } from 'element-plus' const worker = ZMQWorker.getInstance() const zmqStatus = ref('connected') - +const env = import.meta.env worker.setStatusCallback((status: string) => { zmqStatus.value = status as ZmqStatus }) @@ -21,23 +21,26 @@ onBeforeUnmount(() => { const notification = ref() watch(zmqStatus, status => { - if (status === 'disconnected') { - notification.value?.close() - notification.value = ElNotification({ - title: '通讯异常', - message: '请检查通讯连接', - type: 'error', - duration: 0, - }) - } else { - notification.value?.close() - notification.value = ElNotification({ - title: '通讯正常', - message: '通讯正常', - type: 'success', - duration: 3000, - }) + if (env.VITE_APP_ENV === 'local') { + if (status === 'disconnected') { + notification.value?.close() + notification.value = ElNotification({ + title: '通讯异常', + message: '请检查连接状态', + type: 'error', + duration: 0, + }) + } else { + notification.value?.close() + notification.value = ElNotification({ + title: '通讯正常', + message: '通讯正常', + type: 'success', + duration: 3000, + }) + } } + }) diff --git a/src/api/module/transfer/index.ts b/src/api/module/transfer/index.ts index 03fad17..5fd3f5e 100644 --- a/src/api/module/transfer/index.ts +++ b/src/api/module/transfer/index.ts @@ -1,12 +1,14 @@ import { globalServer } from '../index' -interface IGetDeviceDataParams { +export interface IGetDeviceDataParams { columns: string[] isLocal: boolean limit?: number offset?: number host?: string name: string + site_id?: string, // 云端必传 + device_id?: string,// 云端必传 } diff --git a/src/composables/useZMQJsonWorker.ts b/src/composables/useZMQJsonWorker.ts index 1f8da66..845a493 100644 --- a/src/composables/useZMQJsonWorker.ts +++ b/src/composables/useZMQJsonWorker.ts @@ -1,7 +1,7 @@ import { WorkerCMD, ZmqCMD, } from '@/utils/zmq' import type { ManualAction, PublishMsg, PubMsgData, SubMsgData, TimeoutMsg, ZmqMessage } from '@/utils/zmq' import webWorker from '@/utils/zmqJsonWorker?worker' - +const env = import.meta.env const defaultHost = import.meta.env.PROD ? window.location.hostname : '192.168.1.199' class ZMQJsonWorker { @@ -131,7 +131,7 @@ class ZMQJsonWorker { } else if (cmd === ZmqCMD.TIMEOUT) { this.handleTimeoutMessage(topic, msg); this.GC_pubReleaseTimeout(msg) - console.log('pubTimeoutHandlers=>', this.pubTimeoutHandlers) + // console.log('pubTimeoutHandlers=>', this.pubTimeoutHandlers) } } diff --git a/src/stores/transferData.ts b/src/stores/transferData.ts index c31c21a..c8d366a 100644 --- a/src/stores/transferData.ts +++ b/src/stores/transferData.ts @@ -44,7 +44,7 @@ export const useTransferDataStore = defineStore('transfer', () => { const device: IOnlineDevice = { clientIp: feedback[0], sn: sn, - stationName: feedback[2], + site_id: feedback[2], footprint: feedback[3] ?? '--', lastUpdated: Date.now(), status: '在线', // 初始状态为在线 diff --git a/src/utils/zmqJsonWorker.ts b/src/utils/zmqJsonWorker.ts index d57e3a0..ed05537 100644 --- a/src/utils/zmqJsonWorker.ts +++ b/src/utils/zmqJsonWorker.ts @@ -5,7 +5,7 @@ import { WorkerCMD, ZmqCMD, type PublishMsg, type PubMsgData, } from './zmq' const HEARTBEAT_TOPIC = 'HEARTBEAT' const HEARTBEAT_INTERVAL = 3000 const STATUS_CHECK_INTERVAL = 1000 -let messageTimeout = 5000 +let messageTimeout = 10000 let heartClient: ZmqClient | null, subClient: ZmqClient | null, pubClient: ZmqClient | null let subHost = '', pubHost = '' diff --git a/src/views/layout/index.vue b/src/views/layout/index.vue index d5e86a4..a3d0c3d 100644 --- a/src/views/layout/index.vue +++ b/src/views/layout/index.vue @@ -2,55 +2,31 @@
- - +