diff --git a/src/views/mes/printconfig/index.vue b/src/views/mes/printconfig/index.vue index 59b3795a..6d75b28a 100644 --- a/src/views/mes/printconfig/index.vue +++ b/src/views/mes/printconfig/index.vue @@ -71,8 +71,8 @@ - - + + @@ -191,14 +191,8 @@ const ensureHiprintInit = () => { return } - // Edge 锟斤拷锟捷o拷为 hiwebSocket 锟斤拷锟?polling 锟斤拷锟斤拷憬碉拷锟? // 原锟斤拷锟斤拷锟斤拷锟斤拷锟?transports:["websocket"]锟斤拷Edge 锟斤拷全锟斤拷锟斤拷锟斤拷 WebSocket 锟斤拷锟斤拷锟斤拷锟斤拷失锟斤拷 + // Edge ���ݣ�Ϊ hiwebSocket ���?polling ����㽵��? // ԭ���������?transports:["websocket"]��Edge ��ȫ������ WebSocket ��������ʧ�� const socket = getHiwebSocket() - - // 强制停止已有 socket 连接,确保后续 patched start 能够重建连接(使用 polling 降级) - if (socket?.socket) { - socket.stop?.() - } - if (socket?.start && !socket.__transportPatched) { const originalStart = socket.start.bind(socket) socket.start = function (callback?: any) { @@ -305,9 +299,11 @@ const getSocketHostName = () => { const printerList = Array.isArray(socket?.printerList) ? socket.printerList : [] for (const printer of printerList) { const hostName = + extractHostName(printer?.server) || extractHostName(printer?.client) || extractHostName(printer?.clientInfo) || - extractHostName(clients?.[printer?.clientId]) + extractHostName(clients?.[printer?.clientId]) || + extractHostName(clients?.[printer?.server?.clientId]) if (hostName) { return hostName } @@ -365,6 +361,13 @@ const resolveCurrentHostName = async () => { if (typeof socket.refreshPrinterList === 'function') socket.refreshPrinterList() } + if (typeof hiprint.getClientInfo === 'function') { + hiprint.getClientInfo((clientInfo: any) => { + const hn = extractHostName(clientInfo) + if (hn) finish(hn) + }) + } + // autoConnect ���� socket�����������ص��� false���ȴ����ӳɹ���� true�� autoConnect((status: boolean) => { if (!status) { @@ -496,4 +499,3 @@ onMounted(async () => { line-height: 1.5; } -