mirror of
https://gitee.com/xiongmao1988/rax-medical.git
synced 2026-06-12 22:01:46 +08:00
错误修复
This commit is contained in:
parent
6dfbce71dd
commit
aa69fcab6c
|
|
@ -22,7 +22,7 @@ export function getMonthlyLogCount(startTime: string, endTime: string) {
|
|||
})
|
||||
}
|
||||
|
||||
export function getPage(current: number, size: number, condition: {timeInterval: string, logType: string}) {
|
||||
export function getPage(current: number, size: number, condition?: {timeInterval: string, logType: string}) {
|
||||
return new Promise((resolve, reject) => {
|
||||
request.get(getPageUrl, {
|
||||
params: {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,8 @@
|
|||
</loading>
|
||||
</div>
|
||||
<canvas id="bg_canvas" v-show="!loading"></canvas>
|
||||
<canvas v-show="!loading" id="block_canvas" @mousedown.prevent="(e) => drag(e, 'block_canvas', 'circle')"
|
||||
<canvas v-show="!loading" id="block_canvas"
|
||||
@mousedown.prevent="(e) => drag(e, 'block_canvas', 'circle')"
|
||||
@touchstart.prevent="(e) => {
|
||||
terminal = 'mobile'
|
||||
drag(e, 'block_canvas', 'circle')
|
||||
|
|
@ -52,7 +53,8 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<popup v-model:show="popupShow" position="bottom" :overlay="false" :teleport="getContainer()" class="result-popup"
|
||||
<popup v-model:show="popupShow" position="bottom" :overlay="false" :teleport="getContainer()"
|
||||
class="result-popup"
|
||||
:class="{ 'popup-success': verifyResult }">
|
||||
{{ verifyResult ? sText : eText }}
|
||||
</popup>
|
||||
|
|
@ -71,6 +73,7 @@ import {
|
|||
toRefs,
|
||||
} from 'vue'
|
||||
import {Popup, Loading, Toast} from 'vant'
|
||||
import {getAssetsFile} from "@/utils/other";
|
||||
|
||||
const l = 42 // 滑块边长
|
||||
const r = 9 // 滑块圆半径
|
||||
|
|
@ -320,14 +323,13 @@ export default defineComponent({
|
|||
img.crossOrigin = 'Anonymous'
|
||||
img.src = props.imgUrl
|
||||
? props.imgUrl
|
||||
: `/medical/src/assets/imgs/SliderVerify/SliderVerify-${bgRandom}.jpg`
|
||||
: getAssetsFile(`imgs/SliderVerify/SliderVerify-${bgRandom}.jpg`)
|
||||
img.onerror = () => {
|
||||
Toast({
|
||||
message: '图片加载失败',
|
||||
position: 'top',
|
||||
})
|
||||
img.src =
|
||||
'/medical/src/assets/imgs/SliderVerify/SliderVerify-error.png'
|
||||
img.src = getAssetsFile('imgs/SliderVerify/SliderVerify-error.png')
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,159 +0,0 @@
|
|||
<template>
|
||||
<div></div>
|
||||
</template>
|
||||
<script setup lang="ts" name="global-websocket">
|
||||
import { ElNotification } from 'element-plus';
|
||||
import { Session } from '/@/utils/storage';
|
||||
|
||||
const emit = defineEmits(['rollback']);
|
||||
|
||||
const props = defineProps({
|
||||
uri: {
|
||||
type: String,
|
||||
},
|
||||
});
|
||||
|
||||
const state = reactive({
|
||||
webSocket: ref(), // webSocket实例
|
||||
lockReconnect: false, // 重连锁,避免多次重连
|
||||
maxReconnect: 6, // 最大重连次数, -1 标识无限重连
|
||||
reconnectTime: 0, // 重连尝试次数
|
||||
heartbeat: {
|
||||
interval: 30 * 1000, // 心跳间隔时间
|
||||
timeout: 10 * 1000, // 响应超时时间
|
||||
pingTimeoutObj: ref(), // 延时发送心跳的定时器
|
||||
pongTimeoutObj: ref(), // 接收心跳响应的定时器
|
||||
pingMessage: JSON.stringify({ type: 'ping' }), // 心跳请求信息
|
||||
},
|
||||
});
|
||||
|
||||
const token = computed(() => {
|
||||
return Session.getToken();
|
||||
});
|
||||
|
||||
const tenant = computed(() => {
|
||||
return Session.getTenant();
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
initWebSocket();
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
state.webSocket.close();
|
||||
clearTimeoutObj(state.heartbeat);
|
||||
});
|
||||
|
||||
const initWebSocket = () => {
|
||||
// ws地址
|
||||
let host = window.location.host;
|
||||
// baseURL
|
||||
let baseURL = import.meta.env.VITE_API_URL;
|
||||
let wsUri = `ws://${host}${baseURL}${props.uri}?access_token=${token.value}&TENANT-ID=${tenant.value}`;
|
||||
// 建立连接
|
||||
state.webSocket = new WebSocket(wsUri);
|
||||
// 连接成功
|
||||
state.webSocket.onopen = onOpen;
|
||||
// 连接错误
|
||||
state.webSocket.onerror = onError;
|
||||
// 接收信息
|
||||
state.webSocket.onmessage = onMessage;
|
||||
// 连接关闭
|
||||
state.webSocket.onclose = onClose;
|
||||
};
|
||||
|
||||
const reconnect = () => {
|
||||
if (!token) {
|
||||
return;
|
||||
}
|
||||
if (state.lockReconnect || (state.maxReconnect !== -1 && state.reconnectTime > state.maxReconnect)) {
|
||||
return;
|
||||
}
|
||||
state.lockReconnect = true;
|
||||
setTimeout(() => {
|
||||
state.reconnectTime++;
|
||||
// 建立新连接
|
||||
initWebSocket();
|
||||
state.lockReconnect = false;
|
||||
}, 5000);
|
||||
};
|
||||
/**
|
||||
* 清空定时器
|
||||
*/
|
||||
const clearTimeoutObj = (heartbeat: any) => {
|
||||
heartbeat.pingTimeoutObj && clearTimeout(heartbeat.pingTimeoutObj);
|
||||
heartbeat.pongTimeoutObj && clearTimeout(heartbeat.pongTimeoutObj);
|
||||
};
|
||||
/**
|
||||
* 开启心跳
|
||||
*/
|
||||
const startHeartbeat = () => {
|
||||
const webSocket = state.webSocket;
|
||||
const heartbeat = state.heartbeat;
|
||||
// 清空定时器
|
||||
clearTimeoutObj(heartbeat);
|
||||
// 延时发送下一次心跳
|
||||
heartbeat.pingTimeoutObj = setTimeout(() => {
|
||||
// 如果连接正常
|
||||
if (webSocket.readyState === 1) {
|
||||
//这里发送一个心跳,后端收到后,返回一个心跳消息,
|
||||
webSocket.send(heartbeat.pingMessage);
|
||||
// 心跳发送后,如果服务器超时未响应则断开,如果响应了会被重置心跳定时器
|
||||
heartbeat.pongTimeoutObj = setTimeout(() => {
|
||||
webSocket.close();
|
||||
}, heartbeat.timeout);
|
||||
} else {
|
||||
// 否则重连
|
||||
reconnect();
|
||||
}
|
||||
}, heartbeat.interval);
|
||||
};
|
||||
|
||||
/**
|
||||
* 连接成功事件
|
||||
*/
|
||||
const onOpen = () => {
|
||||
//开启心跳
|
||||
startHeartbeat();
|
||||
state.reconnectTime = 0;
|
||||
};
|
||||
/**
|
||||
* 连接失败事件
|
||||
* @param e
|
||||
*/
|
||||
const onError = () => {
|
||||
//重连
|
||||
reconnect();
|
||||
};
|
||||
|
||||
/**
|
||||
* 连接关闭事件
|
||||
* @param e
|
||||
*/
|
||||
const onClose = () => {
|
||||
//重连
|
||||
reconnect();
|
||||
};
|
||||
/**
|
||||
* 接收服务器推送的信息
|
||||
* @param msgEvent
|
||||
*/
|
||||
const onMessage = (msgEvent: any) => {
|
||||
//收到服务器信息,心跳重置并发送
|
||||
startHeartbeat();
|
||||
const text = msgEvent.data;
|
||||
|
||||
if (text.indexOf('pong') > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
ElNotification.warning({
|
||||
title: '消息提醒',
|
||||
dangerouslyUseHTMLString: true,
|
||||
message: text + '请及时处理',
|
||||
offset: 60,
|
||||
});
|
||||
|
||||
emit('rollback', text);
|
||||
};
|
||||
</script>
|
||||
|
|
@ -2,9 +2,9 @@ import { defineStore } from "pinia";
|
|||
import {Session} from "@/utils/storage";
|
||||
import {ElMessage} from "element-plus";
|
||||
|
||||
const vitalUrl = "ws://localhost:5173/socket.io/admin/rax/vitalSignsMedicine?token=" + Session.getToken()
|
||||
const medicineUrl = "ws://localhost:5173/socket.io/admin/rax/addMedicine?token=" + Session.getToken()
|
||||
const chatUrl = "ws://localhost:5173/socket.io/admin/rax/chatRoom?token=" + Session.getToken()
|
||||
const vitalUrl = "ws://" + window.location.host + "/socket.io/admin/rax/vitalSignsMedicine?token=" + Session.getToken()
|
||||
const medicineUrl = "ws://" + window.location.host + "/socket.io/admin/rax/addMedicine?token=" + Session.getToken()
|
||||
const chatUrl = "ws://" + window.location.host + "/socket.io/admin/rax/chatRoom?token=" + Session.getToken()
|
||||
|
||||
export const useRemoteWsStore = defineStore("remoteWs", {
|
||||
state: () => {
|
||||
|
|
|
|||
|
|
@ -69,3 +69,9 @@ function componentToHex(c: number) {
|
|||
const hex = c.toString(16);
|
||||
return hex.length == 1 ? "0" + hex : hex;
|
||||
}
|
||||
|
||||
|
||||
// 获取assets静态资源
|
||||
export const getAssetsFile = (url: string) => {
|
||||
return new URL(`../assets/${url}`, import.meta.url).href
|
||||
}
|
||||
|
|
@ -11,7 +11,7 @@ import {dateFormater} from '@/utils/date-util';
|
|||
import {useRemoteWsStore} from "@/stores/remote-ws-store";
|
||||
|
||||
const chartDom = ref();
|
||||
const props = withDefaults(defineProps<{ names?: string[] }>(), {
|
||||
const props = withDefaults(defineProps<{ names?: any }>(), {
|
||||
names: ['CH1', 'CH2']
|
||||
});
|
||||
defineExpose({
|
||||
|
|
@ -67,7 +67,7 @@ function chartInit() {
|
|||
formatter: (params: any) => {
|
||||
let str = params[0].axisValue;
|
||||
str += `<br>`;
|
||||
props.names.forEach((item, index) => {
|
||||
props.names.forEach((item: any, index: any) => {
|
||||
str += params[index].marker;
|
||||
str += params[index].seriesName + ' ';
|
||||
str += `${params[index].value} HZ`;
|
||||
|
|
@ -124,8 +124,8 @@ function getXData() {
|
|||
}
|
||||
|
||||
function getSeries() {
|
||||
props.names.forEach((name, index) => {
|
||||
const serie = {
|
||||
props.names.forEach((name: any, index: any) => {
|
||||
const serie: any = {
|
||||
name,
|
||||
type: 'line',
|
||||
symbol: 'none',
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import {useRemoteWsStore} from "@/stores/remote-ws-store";
|
|||
|
||||
const chartDom = ref();
|
||||
const props = withDefaults(defineProps<{
|
||||
names: string[]
|
||||
names: any
|
||||
}>(), {
|
||||
names: ['BIS', 'HR']
|
||||
});
|
||||
|
|
@ -76,7 +76,7 @@ function chartInit() {
|
|||
let str = '';
|
||||
str += params[0].axisValue;
|
||||
str += '<br>';
|
||||
props.names.forEach((item, index) => {
|
||||
props.names.forEach((item: any, index: any) => {
|
||||
str += params[index].marker;
|
||||
str += params[index].seriesName + ' ';
|
||||
switch (item) {
|
||||
|
|
@ -121,7 +121,7 @@ function chartInit() {
|
|||
lineHeight: 30,
|
||||
},
|
||||
formatter: (params: string) => {
|
||||
const index = props.names.findIndex((item) => item === params);
|
||||
const index = props.names.findIndex((item: any) => item === params);
|
||||
let str = params + ' ';
|
||||
switch (params) {
|
||||
case 'BIS':
|
||||
|
|
@ -186,7 +186,7 @@ function chartInit() {
|
|||
}
|
||||
|
||||
function getSeries() {
|
||||
props.names.forEach(name => {
|
||||
props.names.forEach((name: any) => {
|
||||
const serie = {
|
||||
name,
|
||||
type: 'line',
|
||||
|
|
@ -208,7 +208,7 @@ function getXData() {
|
|||
}
|
||||
|
||||
function getLegendData() {
|
||||
props.names.forEach((name, index) => {
|
||||
props.names.forEach((name: any, index: any) => {
|
||||
legendData.push({
|
||||
name,
|
||||
textStyle: {color: colors[index]},
|
||||
|
|
|
|||
|
|
@ -126,6 +126,7 @@ const remoteItem = ref({} as any)
|
|||
let currentIndex = -1;
|
||||
const patientInfo = ref({} as any)
|
||||
const remoteWsStore = useRemoteWsStore()
|
||||
let currentException: any = {}
|
||||
|
||||
defineExpose({
|
||||
initData, showData
|
||||
|
|
@ -187,18 +188,21 @@ function getData() {
|
|||
}
|
||||
|
||||
function setLog(data: any) {
|
||||
if (currentException?.Time != data.Time) {
|
||||
currentException = data
|
||||
remoteWsStore.exceptionType.forEach((item: any) => {
|
||||
if (data[item]) {
|
||||
const msg: any = remoteWsStore.exceptionMsg[item];
|
||||
remoteWsStore.setRemoteLog({
|
||||
state: msg,
|
||||
taskName: remoteItem.value.taskName,
|
||||
time: new Date(),
|
||||
time: item.Time,
|
||||
type: "exception"
|
||||
}, currentIndex);
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const breakRemote = () => {
|
||||
remoteWsStore.getRemoteTask()[currentIndex]
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import vue from '@vitejs/plugin-vue'
|
|||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
base: '/medical/',
|
||||
// base: '/medical/',
|
||||
plugins: [vue()],
|
||||
resolve: {
|
||||
alias: {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user