|
|
|
@ -164,7 +164,7 @@
@@ -164,7 +164,7 @@
|
|
|
|
|
</div> |
|
|
|
|
<div class="transfer-log-wrap h-490 flex-col"> |
|
|
|
|
<div class="text-16px font-500">迁移日志</div> |
|
|
|
|
<el-scrollbar class="flex-1"> |
|
|
|
|
<el-scrollbar class="flex-1" ref="transferLogScrollbar"> |
|
|
|
|
<div v-for="i in curTransferLog" :class="i.status === 'failed' ? 'text-red-500' : ''" |
|
|
|
|
class="text-gray-600"> |
|
|
|
|
{{ i.msg }} |
|
|
|
@ -195,7 +195,7 @@
@@ -195,7 +195,7 @@
|
|
|
|
|
</div> |
|
|
|
|
<div class="h-490 border-radius-8px bg-[#F9FAFB] p-10 flex-col"> |
|
|
|
|
<div class="text-16px font-500">迁移日志</div> |
|
|
|
|
<el-scrollbar class="flex-1"> |
|
|
|
|
<el-scrollbar class="flex-1" ref="transferLogScrollbar"> |
|
|
|
|
<div v-for="i in siteTransferLogList" |
|
|
|
|
:class="['error', 'timeout'].includes(i.status) ? 'text-red-500' : ''" class="text-gray-600"> |
|
|
|
|
【{{ i.device.sn }}】:{{ i.msg }} |
|
|
|
@ -274,6 +274,7 @@ const transferStatusMap = {
@@ -274,6 +274,7 @@ const transferStatusMap = {
|
|
|
|
|
success: '迁移成功', |
|
|
|
|
failed: '迁移失败', |
|
|
|
|
timeout: '迁移超时', |
|
|
|
|
stop: '迁移已终止', |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const exportPubDeviceMap = new Map<string, { device: IOnlineDevice; action: 'export' }>() |
|
|
|
@ -282,7 +283,7 @@ const curTransferLog = ref<
@@ -282,7 +283,7 @@ const curTransferLog = ref<
|
|
|
|
|
{ msg: string; host: string; status: 'success' | 'padding' | 'failed' }[] |
|
|
|
|
>([]) |
|
|
|
|
|
|
|
|
|
const transferStatus = ref<'progress' | 'success' | 'failed' | 'timeout' | undefined>() |
|
|
|
|
const transferStatus = ref<'progress' | 'success' | 'failed' | 'timeout' | 'stop' | undefined>() |
|
|
|
|
|
|
|
|
|
const devices = computed(() => { |
|
|
|
|
return isonLineTransfer.value ? Array.from(devicesMap.value.values()) : offLineDeviceList.value |
|
|
|
@ -327,6 +328,7 @@ const statusMap = {
@@ -327,6 +328,7 @@ const statusMap = {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const zmqExportMSG = ref('') |
|
|
|
|
function zmqExportCb(msg: PubMsgData) { |
|
|
|
|
if (!isonLineTransfer.value) return |
|
|
|
|
const { feedback, result, id } = msg |
|
|
|
@ -338,11 +340,34 @@ function zmqExportCb(msg: PubMsgData) {
@@ -338,11 +340,34 @@ function zmqExportCb(msg: PubMsgData) {
|
|
|
|
|
| 'padding' |
|
|
|
|
| 'failed') |
|
|
|
|
: 'failed' |
|
|
|
|
curTransferLog.value.push({ |
|
|
|
|
msg: `主机【${feedback[0]}】: ${feedback[2]}`, |
|
|
|
|
host: feedback[0], |
|
|
|
|
status, |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const isLineFeed = feedback[2] && feedback[2].includes('\n') |
|
|
|
|
if (isLineFeed) { |
|
|
|
|
|
|
|
|
|
if (zmqExportMSG.value) { |
|
|
|
|
curTransferLog.value.at(-1)!.msg += feedback[2] |
|
|
|
|
} else { |
|
|
|
|
curTransferLog.value.push({ |
|
|
|
|
msg: `主机【${feedback[0]}】: ${feedback[2]}`, |
|
|
|
|
host: feedback[0], |
|
|
|
|
status, |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
zmqExportMSG.value = '' |
|
|
|
|
} else { |
|
|
|
|
if (!zmqExportMSG.value) { |
|
|
|
|
curTransferLog.value.push({ |
|
|
|
|
msg: `主机【${feedback[0]}】: ${zmqExportMSG.value + feedback[2]}`, |
|
|
|
|
host: feedback[0], |
|
|
|
|
status, |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
zmqExportMSG.value += typeof feedback[2] === 'string' ? feedback : '' |
|
|
|
|
curTransferLog.value.at(-1)!.msg = zmqExportMSG.value |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
transferStatus.value = 'progress' |
|
|
|
|
if (result !== 'progress') { |
|
|
|
@ -388,6 +413,7 @@ function onStopTransfer() {
@@ -388,6 +413,7 @@ function onStopTransfer() {
|
|
|
|
|
worker.publish(postTransferTopic, msg) |
|
|
|
|
message.success('迁移已取消') |
|
|
|
|
exportPubDeviceMap.clear() |
|
|
|
|
transferStatus.value = 'stop' |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -684,6 +710,7 @@ const offLineTransferRes = () => {
@@ -684,6 +710,7 @@ const offLineTransferRes = () => {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const importMsg = ref('') |
|
|
|
|
const onOffDeviceTransferStatus = ref<'progress' | 'success' | undefined>() |
|
|
|
|
function zmqImportCb(msg: PubMsgData) { |
|
|
|
|
const { id, feedback, result, code } = msg |
|
|
|
@ -693,11 +720,31 @@ function zmqImportCb(msg: PubMsgData) {
@@ -693,11 +720,31 @@ function zmqImportCb(msg: PubMsgData) {
|
|
|
|
|
if (code === ZmqMsgResultType.PROGRESS) { |
|
|
|
|
onOffDeviceTransferStatus.value = 'progress' |
|
|
|
|
const log: string = Array.isArray(feedback) ? feedback[0] || '' : '' |
|
|
|
|
siteTransferLogList.value.push({ |
|
|
|
|
msg: log, |
|
|
|
|
device: offDevice, |
|
|
|
|
status: 'success' |
|
|
|
|
}) |
|
|
|
|
console.log(log) |
|
|
|
|
const isLineFeed = log && log.includes('\n') |
|
|
|
|
if (isLineFeed) { |
|
|
|
|
if (importMsg.value) { |
|
|
|
|
siteTransferLogList.value.at(-1)!.msg += log |
|
|
|
|
} else { |
|
|
|
|
siteTransferLogList.value.push({ |
|
|
|
|
msg: log, |
|
|
|
|
device: offDevice, |
|
|
|
|
status: 'success' |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
importMsg.value = '' |
|
|
|
|
} else { |
|
|
|
|
if (!importMsg.value) { |
|
|
|
|
siteTransferLogList.value.push({ |
|
|
|
|
msg: log, |
|
|
|
|
device: offDevice, |
|
|
|
|
status: 'success' |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
importMsg.value += typeof log === 'string' ? log : '' |
|
|
|
|
siteTransferLogList.value.at(-1)!.msg = importMsg.value |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (code !== ZmqMsgResultType.PROGRESS) { |
|
|
|
@ -734,6 +781,17 @@ function zmqImportTimeoutCb(msg: TimeoutMsg) {
@@ -734,6 +781,17 @@ function zmqImportTimeoutCb(msg: TimeoutMsg) {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// ================ 离线数据导入 end ========= |
|
|
|
|
|
|
|
|
|
// const transferLogScrollbar = ref() |
|
|
|
|
|
|
|
|
|
// watch(siteTransferLogList, () => { |
|
|
|
|
// nextTick(() => { |
|
|
|
|
// if (transferLogScrollbar.value) { |
|
|
|
|
// const scrollbar = transferLogScrollbar.value |
|
|
|
|
// scrollbar.setScrollTop(scrollbar.wrap$.scrollHeight) |
|
|
|
|
// } |
|
|
|
|
// }) |
|
|
|
|
// }, { deep: true }) |
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
<style scoped lang="scss"> |
|
|
|
|