|
|
|
@ -70,11 +70,11 @@ async function open(device: IOfflineDevice | IOnlineDevice) {
@@ -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() {
@@ -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() {
@@ -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 |
|
|
|
|