rax-medical/src/views/remote-manage/part/remote-dialog.vue

161 lines
4.4 KiB
Vue
Raw Normal View History

2023-12-20 14:54:01 +08:00
<template>
2024-04-23 09:42:25 +08:00
<el-dialog class="header-none" v-model="dialogVisible" :width="700" :show-close="false">
<div class="content-box">
<img src="@/assets/imgs/remote/remote_bck.png">
<div class="info">
<h3>连接云服务器</h3>
<br>
<!-- <p>云服务器连接状态{{ patientInfo.isRemote ? '已连接' : '未连接' }}</p>
<p>输入用户名{{ patientInfo.serverun }}</p>
<p>密码*********</p>
<br>-->
<p class="input-box"><span>输入病人姓名</span>
<el-input v-model="patientInfo.patient"></el-input>
</p>
<p class="input-box"><span>输入病人身份证号</span>
<el-input v-model="patientInfo.patientId"></el-input>
</p>
<p class="input-box"><span>请选择手术时间</span>
<el-date-picker
v-model="patientInfo.date"
type="date"
placeholder="请选择日期"
/>
</p>
</div>
</div>
<div class="btn-box">
<el-button class="f18" type="primary" @click="confirmRemote">确定连接</el-button>
<!-- <el-button class="f18" @click="breakRemote">断开连接</el-button> -->
<el-button class="f18" style="margin-left: 50px;" @click="dialogVisible = false">返回</el-button>
</div>
</el-dialog>
2023-12-20 14:54:01 +08:00
</template>
<script lang='ts' setup>
2024-04-23 09:42:25 +08:00
import {ref} from 'vue'
import {ElMessage} from 'element-plus'
import {useRemoteWsStore} from "@/stores/remote-ws-store";
import {dateFormater} from "@/utils/date-util";
2023-12-20 14:54:01 +08:00
const emit = defineEmits(['confirmRemote', 'errorRemote', 'breakRemote'])
const dialogVisible = ref(false)
2024-04-23 09:42:25 +08:00
const patientInfo = ref({} as any)
const remoteWsStore = useRemoteWsStore();
2023-12-20 14:54:01 +08:00
defineExpose({
2024-04-23 09:42:25 +08:00
open,
close,
2023-12-20 14:54:01 +08:00
})
2024-04-23 09:42:25 +08:00
function open(e: number) {
patientInfo.value = remoteWsStore.remoteTasks[e]
dialogVisible.value = true
2023-12-20 14:54:01 +08:00
}
2024-04-23 09:42:25 +08:00
2023-12-20 14:54:01 +08:00
function close() {
2024-04-23 09:42:25 +08:00
dialogVisible.value = false
2023-12-20 14:54:01 +08:00
}
const confirmRemote = () => {
2024-04-23 09:42:25 +08:00
if (patientInfo.value.patientId && patientInfo.value.patient) {
ElMessage.success('连接成功!')
patientInfo.value.isRemote = true
patientInfo.value.taskName = '远程控制' + (patientInfo.value.index + 1)
patientInfo.value.date = dateFormater("yyyy-MM-dd", patientInfo.value.date)
unsubscribeLastTask();
remoteWsStore.$patch({currentTaskIndex: patientInfo.value.index})
remoteWsStore.setRemoteLog({
time: new Date(),
taskName: patientInfo.value.taskName,
state: '连接成功',
type: "normal"
}, remoteWsStore.currentTaskIndex)
emit('confirmRemote', patientInfo.value)
close()
} else {
remoteWsStore.setRemoteLog({
time: new Date(),
taskName: patientInfo.value.taskName,
state: '连接失败'
}, patientInfo.value.index)
ElMessage.error('连接失败!')
emit('errorRemote', patientInfo.value)
}
2023-12-20 14:54:01 +08:00
}
const breakRemote = () => {
2024-04-23 09:42:25 +08:00
ElMessage.info('连接已断开!')
emit('breakRemote', patientInfo.value)
close()
}
const unsubscribeLastTask = () => {
const lastTaskIndex = remoteWsStore.currentTaskIndex;
const lastTask: any = remoteWsStore.remoteTasks[lastTaskIndex];
if (lastTask) {
remoteWsStore.unsubscribeVital(lastTask.patient, lastTask.patientId, lastTask.date);
}
2023-12-20 14:54:01 +08:00
}
</script>
<style lang='scss' scoped>
.content-box {
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
&>img {
width: 260px;
border: 1px solid #C77000;
border-radius: 20px;
}
.info {
width: calc(100% - 290px);
color: $main-color;
line-height: 2;
font-weight: 600;
h3 {
font-size: 28px;
}
p {
font-size: 15px;
}
.input-box {
display: flex;
align-items: center;
2024-02-22 20:48:08 +08:00
2023-12-20 14:54:01 +08:00
&>span {
flex-shrink: 0;
}
:deep(.el-input) {
border-bottom: 1px solid $text3-color;
.el-input__wrapper {
box-shadow: none;
padding: 0;
input {
height: 20px;
font-size: 15px;
color: $main-color;
}
}
}
}
}
}
2024-04-23 09:42:25 +08:00
2023-12-20 14:54:01 +08:00
.btn-box {
display: flex;
2023-12-21 11:58:50 +08:00
justify-content: center;
2023-12-20 14:54:01 +08:00
align-items: center;
margin-top: 50px;
.el-button {
font-weight: 600;
padding: 15px 50px;
height: auto;
}
}
</style>