From fd6f9318234a3f2ebcae2a74a1ba1b96636a44e8 Mon Sep 17 00:00:00 2001 From: betaqi <3188864257@qq.com> Date: Thu, 29 May 2025 10:46:40 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=82=B9=E4=BD=8D=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../stationData/components/deviceDrawer.vue | 88 +++++++++---------- src/views/stationData/transferData.vue | 2 +- 2 files changed, 44 insertions(+), 46 deletions(-) diff --git a/src/views/stationData/components/deviceDrawer.vue b/src/views/stationData/components/deviceDrawer.vue index d057599..a736c57 100644 --- a/src/views/stationData/components/deviceDrawer.vue +++ b/src/views/stationData/components/deviceDrawer.vue @@ -70,11 +70,11 @@ async function open(device: IOfflineDevice | IOnlineDevice) { curDevice.value = device await loadPointGroup() .then(async () => { - if (env.VITE_APP_ENV === 'local') { - props.isTransfer ? await loadDeviceDetails() : zmqImport(device as IOfflineDevice) - } else { + // if (env.VITE_APP_ENV === 'local') { + // props.isTransfer ? await loadDeviceDetails() : zmqImport(device as IOfflineDevice) + // } else { await loadDeviceDetails() - } + // } }) .catch(() => { message.error('获取点位组数据失败') @@ -160,11 +160,10 @@ async function loadChardData() { name: curGroupName.value as string } - if (env.VITE_APP_ENV !== 'local') { + if (env.VITE_APP_ENV !== 'local' || !props.isTransfer) { params.site_id = props.siteInfo!.name || '' params.device_id = curDevice.value?.sn || '' } - loading.value = true const res = await getDeviceDetails(params) @@ -204,45 +203,44 @@ async function loadChardData() { loading.value = false } -function zmqImport(device: IOfflineDevice) { - console.log('object') - if (!device.sn || !props.siteInfo!.name) { - message.error('未找到站点或设备') - return - } - const msg = getPubInitData<'import'>( - 'import', - ['', '', '', '', '', '', `${props.siteInfo!.name}/${device.sn}`], - 'yes' - ) - pubIdWithDevice.set(msg.id, { device, action: 'import' }) - worker.publish(postTransferTopic, msg, true, zmqTimeoutCb) - worker.subscribe(getTransferTopic, zmqImportCb, msg.id) -} - -function zmqImportCb(msg: PubMsgData) { - const { id, result } = msg - if (result !== 'progress') { - const { device, action } = pubIdWithDevice.get(id)! - if (result === 'success' && device && action === 'import') { - loadDeviceDetails() - pubIdWithDevice.delete(id) - } else { - message.error(`设备数据获取失败`) - fullscreenLoading.value?.close() - pubIdWithDevice.delete(id) - } - } -} - -function zmqTimeoutCb(msg: TimeoutMsg) { - const { device, action } = pubIdWithDevice.get(msg.timeoutId)! - if (device && action === 'import') { - message.error(`设备${device.sn},查询信息超时,请稍后重试`) - pubIdWithDevice.delete(msg.timeoutId) - fullscreenLoading.value?.close() - } -} +// function zmqImport(device: IOfflineDevice) { +// if (!device.sn || !props.siteInfo!.name) { +// message.error('未找到站点或设备') +// return +// } +// const msg = getPubInitData<'import'>( +// 'import', +// ['', '', '', '', '', '', `${props.siteInfo!.name}/${device.sn}`], +// 'yes' +// ) +// pubIdWithDevice.set(msg.id, { device, action: 'import' }) +// worker.publish(postTransferTopic, msg, true, zmqTimeoutCb) +// worker.subscribe(getTransferTopic, zmqImportCb, msg.id) +// } + +// function zmqImportCb(msg: PubMsgData) { +// const { id, result } = msg +// if (result !== 'progress') { +// const { device, action } = pubIdWithDevice.get(id)! +// if (result === 'success' && device && action === 'import') { +// loadDeviceDetails() +// pubIdWithDevice.delete(id) +// } else { +// message.error(`设备数据获取失败`) +// fullscreenLoading.value?.close() +// pubIdWithDevice.delete(id) +// } +// } +// } + +// function zmqTimeoutCb(msg: TimeoutMsg) { +// const { device, action } = pubIdWithDevice.get(msg.timeoutId)! +// if (device && action === 'import') { +// message.error(`设备${device.sn},查询信息超时,请稍后重试`) +// pubIdWithDevice.delete(msg.timeoutId) +// fullscreenLoading.value?.close() +// } +// } function handleBeforeClose(done: () => void) { isShowDrawer.value = false diff --git a/src/views/stationData/transferData.vue b/src/views/stationData/transferData.vue index 24b47e4..4ec4fb7 100644 --- a/src/views/stationData/transferData.vue +++ b/src/views/stationData/transferData.vue @@ -1,7 +1,7 @@