mirror of
https://gitee.com/xiongmao1988/rax-medical.git
synced 2025-08-23 20:44:58 +08:00
远程管理接口调试
This commit is contained in:
parent
c962e9f5fe
commit
9186e1a01b
|
@ -10,7 +10,9 @@
|
|||
"type-check": "vue-tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@stomp/stompjs": "^7.0.0",
|
||||
"axios": "^1.3.3",
|
||||
"crypto-js": "4.2.0",
|
||||
"echarts": "^5.4.1",
|
||||
"element-plus": "2.3.1",
|
||||
"js-cookie": "^3.0.5",
|
||||
|
@ -20,8 +22,7 @@
|
|||
"vant": "^4.8.3",
|
||||
"vue": "^3.2.45",
|
||||
"vue-router": "^4.1.6",
|
||||
"xlsx": "^0.18.5",
|
||||
"crypto-js": "4.2.0"
|
||||
"xlsx": "^0.18.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/js-cookie": "^3.0.6",
|
||||
|
|
|
@ -377,7 +377,6 @@ function sliderSuccess() {
|
|||
// 存储token 信息
|
||||
Session.set('token', data.access_token);
|
||||
Session.set('refresh_token', data.refresh_token);
|
||||
console.log(data);
|
||||
toHome()
|
||||
})
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -33,6 +33,8 @@ import type { RemoteItem } from '@/utils/public-interface'
|
|||
import RemoteDialog from './part/remote-dialog.vue'
|
||||
import RemotePart from './part/remote-part.vue'
|
||||
import MessagePart from './part/message-part.vue'
|
||||
import {Client} from "@stomp/stompjs";
|
||||
import {Session} from "@/utils/storage";
|
||||
|
||||
const router = useRouter()
|
||||
const remoteStore = useRemoteStore()
|
||||
|
@ -118,6 +120,8 @@ const confirmRemote = (e: RemoteItem) => {
|
|||
}, e.index)
|
||||
remoteTask.value[e.index] = e // 状态设置为可连接
|
||||
remotePartRef.value.initData(e)
|
||||
console.log(e);
|
||||
getSurgeryData(e.patientCode, e.patientName);
|
||||
}
|
||||
// 连接失败
|
||||
const errorRemote = (e: RemoteItem) => {
|
||||
|
@ -140,6 +144,43 @@ const breakRemote = (e: RemoteItem) => {
|
|||
const addLogAfter = () => {
|
||||
messagePartRef.value.scrollToBottom()
|
||||
}
|
||||
|
||||
const surgeryClient = new Client({
|
||||
brokerURL: 'ws://localhost:5173/socket.io/admin/rax/SurgeryData',
|
||||
connectHeaders: {
|
||||
access_token: Session.get('token')
|
||||
}
|
||||
})
|
||||
surgeryClient.activate()
|
||||
|
||||
surgeryClient.onWebSocketError = (error) => {
|
||||
console.log('Error with websocket', error)
|
||||
};
|
||||
|
||||
surgeryClient.onStompError = (frame) => {
|
||||
console.log('Broker reported error: ' + frame.headers['message'])
|
||||
console.log('Additional details: ' + frame.body)
|
||||
};
|
||||
|
||||
function getSurgeryData(username: string, db: string) {
|
||||
console.log(username, db);
|
||||
surgeryClient.publish({
|
||||
destination: "/front/getSurgeryData",
|
||||
body: JSON.stringify({'status': "start", db})
|
||||
});
|
||||
const account = "admin";
|
||||
surgeryClient.subscribe('/topic/user/' + account + ":" + db + '/surgeryData', (data: any) => {
|
||||
console.log(data);
|
||||
})
|
||||
}
|
||||
|
||||
function disconnectSurgeryData(username: string, db: string) {
|
||||
surgeryClient.publish({
|
||||
destination: "/front/getSurgeryData",
|
||||
body: JSON.stringify({'status': "stop", db, username})
|
||||
});
|
||||
surgeryClient.unsubscribe("/topic/user/" + username + "/surgeryData");
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang='scss' scoped>
|
||||
|
|
|
@ -27,7 +27,13 @@ export default defineConfig({
|
|||
ws: true, // 是否启用 WebSocket
|
||||
changeOrigin: true, // 是否修改请求头中的 Origin 字段
|
||||
rewrite: (path) => path.replace(/^\/api/, ''),
|
||||
}
|
||||
},
|
||||
'/socket.io': {
|
||||
target: 'ws://localhost:9999',
|
||||
ws: true,
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/socket.io/, ''),
|
||||
},
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue
Block a user