mirror of
https://gitee.com/xiongmao1988/rax-medical.git
synced 2025-08-24 04:54:58 +08:00
临时提交
This commit is contained in:
parent
db7031eb20
commit
fdea342eec
|
@ -1,46 +0,0 @@
|
||||||
let ws: WebSocket;
|
|
||||||
|
|
||||||
function init(url: string | URL, protocols?: string | string[]) {
|
|
||||||
return new Promise(resolve => {
|
|
||||||
try {
|
|
||||||
ws = new WebSocket(url);
|
|
||||||
resolve(true)
|
|
||||||
} catch (e) {
|
|
||||||
console.log(e)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
function close(code?: number, reason?: string) {
|
|
||||||
ws.close(code, reason)
|
|
||||||
}
|
|
||||||
|
|
||||||
function send(data: string | ArrayBufferLike | Blob | ArrayBufferView) {
|
|
||||||
ws.send(data)
|
|
||||||
}
|
|
||||||
|
|
||||||
function closeListener(cb: any) {
|
|
||||||
ws.onclose = cb
|
|
||||||
}
|
|
||||||
|
|
||||||
function openListener(cb: any) {
|
|
||||||
ws.onopen = cb
|
|
||||||
}
|
|
||||||
|
|
||||||
function errorListener(cb: any) {
|
|
||||||
ws.onerror = cb
|
|
||||||
}
|
|
||||||
|
|
||||||
function messageListener(cb: any) {
|
|
||||||
ws.onmessage = cb
|
|
||||||
}
|
|
||||||
|
|
||||||
export const wsApi= {
|
|
||||||
init,
|
|
||||||
close,
|
|
||||||
send,
|
|
||||||
closeListener,
|
|
||||||
openListener,
|
|
||||||
errorListener,
|
|
||||||
messageListener
|
|
||||||
}
|
|
|
@ -67,7 +67,6 @@ import {ElMessage, ElMessageBox} from 'element-plus'
|
||||||
import {useLoginStore} from '@/stores/user-info-store'
|
import {useLoginStore} from '@/stores/user-info-store'
|
||||||
import {getHospitalsData} from '@/static-data/core'
|
import {getHospitalsData} from '@/static-data/core'
|
||||||
import userInfoForm from '@/components/user-info.vue'
|
import userInfoForm from '@/components/user-info.vue'
|
||||||
import {wsApi} from "@/api/ws";
|
|
||||||
import {Session} from "@/utils/storage";
|
import {Session} from "@/utils/storage";
|
||||||
import {logout} from "@/api/login";
|
import {logout} from "@/api/login";
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="remote-manage-page">
|
<div class="remote-manage-page">
|
||||||
|
<button @click="getSurgeryData">123</button>
|
||||||
|
<button @click="disconnectSurgeryData">断开</button>
|
||||||
<div class="header-box">
|
<div class="header-box">
|
||||||
<div class="thumbnail" @click="viewThumbnail">
|
<div class="thumbnail" @click="viewThumbnail">
|
||||||
<el-icon>
|
<el-icon>
|
||||||
|
@ -26,16 +28,14 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang='ts' setup>
|
<script lang='ts' setup>
|
||||||
import {onMounted, reactive, ref, toRefs, watch} from 'vue'
|
import {ref} from 'vue'
|
||||||
import {useRouter} from 'vue-router'
|
import {useRouter} from 'vue-router'
|
||||||
import {useRemoteStore} from '@/stores/remote-info-store'
|
import {useRemoteStore} from '@/stores/remote-info-store'
|
||||||
import type {RemoteItem} from '@/utils/public-interface'
|
import type {RemoteItem} from '@/utils/public-interface'
|
||||||
import RemoteDialog from './part/remote-dialog.vue'
|
import RemoteDialog from './part/remote-dialog.vue'
|
||||||
import RemotePart from './part/remote-part.vue'
|
import RemotePart from './part/remote-part.vue'
|
||||||
import MessagePart from './part/message-part.vue'
|
import MessagePart from './part/message-part.vue'
|
||||||
import {Client} from "@stomp/stompjs";
|
|
||||||
import {Session} from "@/utils/storage";
|
import {Session} from "@/utils/storage";
|
||||||
import {wsApi} from "@/api/ws";
|
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const remoteStore = useRemoteStore()
|
const remoteStore = useRemoteStore()
|
||||||
|
@ -123,7 +123,7 @@ const confirmRemote = (e: RemoteItem) => {
|
||||||
remoteTask.value[e.index] = e // 状态设置为可连接
|
remoteTask.value[e.index] = e // 状态设置为可连接
|
||||||
remotePartRef.value.initData(e)
|
remotePartRef.value.initData(e)
|
||||||
console.log(e);
|
console.log(e);
|
||||||
getSurgeryData(e.patientCode, e.patientName);
|
getSurgeryData();
|
||||||
}
|
}
|
||||||
// 连接失败
|
// 连接失败
|
||||||
const errorRemote = (e: RemoteItem) => {
|
const errorRemote = (e: RemoteItem) => {
|
||||||
|
@ -142,12 +142,34 @@ const breakRemote = (e: RemoteItem) => {
|
||||||
title: e.title,
|
title: e.title,
|
||||||
state: '断开连接'
|
state: '断开连接'
|
||||||
}, e.index)
|
}, e.index)
|
||||||
disconnectSurgeryData("", "1")
|
// disconnectSurgeryData("", "1")
|
||||||
}
|
}
|
||||||
const addLogAfter = () => {
|
const addLogAfter = () => {
|
||||||
messagePartRef.value.scrollToBottom()
|
messagePartRef.value.scrollToBottom()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const ws = new WebSocket("ws://localhost:5173/socket.io/admin/rax/vitalSignsMedicine?token=" + Session.getToken());
|
||||||
|
|
||||||
|
ws.onopen = function () {
|
||||||
|
}
|
||||||
|
|
||||||
|
function getSurgeryData() {
|
||||||
|
const params = {
|
||||||
|
patientName: "1111111",
|
||||||
|
idNum: "123567890",
|
||||||
|
date: "20230505"
|
||||||
|
}
|
||||||
|
ws.send(JSON.stringify(params))
|
||||||
|
}
|
||||||
|
|
||||||
|
function disconnectSurgeryData() {
|
||||||
|
ws.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
ws.onmessage = function (e) {
|
||||||
|
console.log(e)
|
||||||
|
}
|
||||||
|
|
||||||
/*const surgeryClient = new Client({
|
/*const surgeryClient = new Client({
|
||||||
brokerURL: 'ws://localhost:5173/socket.io/admin/rax/SurgeryData',
|
brokerURL: 'ws://localhost:5173/socket.io/admin/rax/SurgeryData',
|
||||||
connectHeaders: {
|
connectHeaders: {
|
||||||
|
@ -229,13 +251,6 @@ function sendChatMessage() {
|
||||||
})
|
})
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
wsApi.init("ws://localhost:5173/socket.io/admin/vitalSignsMedicine").then(() => {
|
|
||||||
|
|
||||||
})
|
|
||||||
wsApi.openListener((cb: any) => {
|
|
||||||
console.log(cb)
|
|
||||||
})
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang='scss' scoped>
|
<style lang='scss' scoped>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user