eight
2024-10-24 6657e1941f1b517c66a47ec14ef5ed65afb75e21
src/views/ecg/doctor/components/DevInstallPanel.vue
@@ -116,11 +116,28 @@
import {isStringEmpty} from "@/utils/stringUtil";
import {curDayEnd, curDayStart} from "@/utils/dateUtil";
import {DeviceApi} from "@/api/ecg/devmanage";
import {QueueVO} from "@/api/ecg/queue";
import {RoomBedVO} from "@/api/ecg/doctor";
/** 装机 表单 */
defineOptions({ name: 'DevrInstall' })
/** 设备装机 表单 */
defineComponent({ name: 'DevInstallPanel' })
const  props = defineProps({
  room: {
    type: Object as PropType<RoomBedVO>,
    required: true
  }
})
const emit = defineEmits(['event_dev_install']) // 定义 success 事件,用于操作成功后的回调
const setPatient = (queueVO: QueueVO | undefined) => {
  resetForm()
  formData.value.patId = queueVO?.patId
  formData.value.patName = queueVO?.patName
  getReadyRentInfo()
}
defineExpose({ setPatient }) // 提供 setPatient 方法,用于设置患者
const { t } = useI18n() // 国际化
const message = useMessage() // 消息弹窗
@@ -144,8 +161,9 @@
  // 提交请求
  formLoading.value = true
  try {
    formData.value.roomId = props.room.roomId
    formData.value.bedNo = props.room.bedNo
    const data = formData.value as unknown as DevRentVO
    //await DevRentApi.updateDevRent(data)
    await DevRentApi.devInstall(data)
    message.success(t('操作成功'))
    dialogVisible.value = false
@@ -198,18 +216,6 @@
  formData.value.model = data === null ? "" : data.model
}
/*
const getRentInfoByDevId = () => {
  const tempDevId = formData.value.devId;
  resetForm()
  if (isStringEmpty(tempDevId))
    return
  formData.value.devId = tempDevId;
  getRentInfo()
}
*/
const getRentInfoByPatId = () => {
  const tempPatId = formData.value.patId;
  resetForm()
@@ -217,19 +223,22 @@
    return
  formData.value.patId = tempPatId;
  getRentInfo()
  getReadyRentInfo(formData.value)
}
const getRentInfo = async () => {
  const data = await DevRentApi.getReadyRent(formData.value)
const getReadyRentInfo = async (devRentVO) => {
  const data = await DevRentApi.getReadyRent(devRentVO)
  if (null === data)
    return
  formData.value = data
  if (data.returnTime === null)
    data.returnTime = new Date().getTime()
  // formData.value = data  //不能整个赋值, 默认装机时间被清空
  formData.value.id = data.id;
  formData.value.devId = data.devId
  formData.value.category = data.category
  formData.value.brand = data.brand
  formData.value.model = data.model
  formData.value.patDetails = data.patDetails
}
const loading = ref(true) // 列表的加载中
const list = ref<JobRecordVO[]>([]) // 列表的数据
@@ -270,6 +279,8 @@
}
const cancelInstall = async () => {
  formData.value.roomId = props.room.roomId
  formData.value.bedNo = props.room.bedNo
  const data = formData.value as unknown as DevRentVO
  if (formData.value.id === null || formData.value.id === undefined) {
    const result = await DevRentApi.devInstallCancel(data)