eight
2024-11-01 4e80712bf8eae6094baf1fae25d6e2979b423d9d
src/views/ecg/doctor/components/DevReadyPanel.vue
@@ -1,3 +1,4 @@
<!--设备领用界面-->
<template>
<!--  当前患者: {{patient?.patId}} {{isStringEmpty(patient?.patName)?'无':patient.patName}}-->
@@ -26,12 +27,12 @@
      <el-form-item label="设备描述" prop="">
        {{deviceInfo.brand + "&nbsp;&nbsp;" + deviceInfo.model + " " + deviceInfo.state}}
      </el-form-item>
      <el-form-item label="装机时间" prop="rentTime">
      <el-form-item label="领用时间" prop="rentTime">
        <el-date-picker
          v-model="formData.rentTime"
          type="date"
          value-format="x"
          placeholder="选择装机时间"
          placeholder="选择领用时间"
        />
      </el-form-item>
      <el-form-item label="备注" prop="remark">
@@ -46,7 +47,7 @@
    </el-form>
    <el-button @click="submitForm" type="primary" :disabled="formLoading">领用完成</el-button>
    <el-button @click="resetForm()">重 置</el-button>
    <el-button @click="printBill()">打印小票</el-button>
    <el-button @click="printBill(formData.patId)">打印小票</el-button>
    <el-button @click="cancelInstall"  :disabled="formLoading">放弃装机</el-button>
  <!-- 医生装机列表 -->
@@ -131,7 +132,9 @@
import {DeviceApi, DeviceVO} from "@/api/ecg/devmanage";
import {curDayEnd, curDayStart} from "@/utils/dateUtil";
import {RoomBedVO} from "@/api/ecg/doctor";
import {hiprint, defaultElementTypeProvider} from "vue-plugin-hiprint"
import {hiprint} from "vue-plugin-hiprint";
import {AppointmentApi, AppointmentVO} from "@/api/ecg/appointment";
import { useCheckTypeStoreWithOut } from '@/store/modules/checkType'
/** 设备领用 表单 */
defineComponent({ name: 'DevReadyPanel' })
@@ -151,7 +154,8 @@
const dialogVisible = ref(false) // 弹窗的是否展示
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
const formType = ref('create') // 表单的类型:create - 新增;update - 修改
const checkTypeStore = useCheckTypeStoreWithOut()
const formData = ref({
  id: undefined,
@@ -199,16 +203,19 @@
    return
  formData.value.patId = tempPatId;
  getFreeRentInfo()
  getFreeRentInfo(formData.value)
}
const getFreeRentInfo = async () => {
  const data = await DevRentApi.getFreeRent(formData.value)
// 根据患者或设备, 获取 Free的租赁
const getFreeRentInfo = async (devRentVO) => {
  const data = await DevRentApi.getFreeRent(devRentVO)
  if (null === data)
    return
  // formDate 对应  DevRent
  formData.value = data
  // formData.value = data  //不能整个赋值, 默认领用时间被清空
  formData.value.id = data.id;
  formData.value.patDetails = data.patDetails
}
/** 提交表单 */
@@ -287,8 +294,10 @@
//   formData.value.patName = queueVO?.patName
// }
const setPatient = (queueVO: QueueVO | undefined) => {
  resetForm()
  formData.value.patId = queueVO?.patId
  getRentInfoByPatId()
  formData.value.patName = queueVO?.patName
  getFreeRentInfo(formData.value)
}
defineExpose({ setPatient }) // 提供 setPatient 方法,用于设置患者
@@ -332,16 +341,41 @@
  formData.value = await DevRentApi.getDevRent(rentId)
}
const printBill = async () => {
  // ElNotification({
  //   title: '温馨提示',
  //   message: '待实现!',
  //   type: 'warning'
  // })
const printBill = async (patId: string) => {
  const curAppointment: AppointmentVO = await AppointmentApi.getCurAppointmentByPatId( patId )
  console.info( curAppointment )
// 引入后使用示例
  hiprint.init({
//    host: 'http://192.168.2.100:17521',
    //    host: 'http://192.168.2.100:17521',
    token: '111111'
  });
// 下列方法都是没有拖拽设计页面的, 相当于代码模式, 使用代码设计页面
// 想要实现拖拽设计页面,请往下看 '自定义设计'
  var hiprintTemplate = new hiprint.PrintTemplate();  // 可传参数
  var panel = hiprintTemplate.addPrintPanel({ width: 100, height: 130, paperFooter: 340, paperHeader: 10 });
//文本
  const checkTypeName = checkTypeStore.getCheckTypeName(curAppointment.bookCheckType)
  panel.addPrintText({ options: { width: 140, height: 15, top: 20, left: 20, title: checkTypeName, textAlign: 'center' } });
  const patientBaisc = curAppointment.patName + "  " + curAppointment.patGender + "  " + curAppointment.patAge
  panel.addPrintText({ options: { width: 140, height: 15, top: 40, left: 20, title: patientBaisc, textAlign: 'center' } });
  const ward_bed = curAppointment.patWardDesc + "-" + curAppointment.patBedNo
  panel.addPrintText({ options: { width: 140, height: 15, top: 60, left: 20, title: ward_bed, textAlign: 'center' } });
  const bookTime = curAppointment.bookDate + "-" + getBookBeginTime(curAppointment.bookTimeslot)
  panel.addPrintText({ options: { width: 140, height: 15, top: 80, left: 20, title: bookTime, textAlign: 'center' } });
  panel.addPrintText({ options: { width: 140, height: 15, top: 100, left: 20, title: curAppointment.patId, textAlign: 'center' } });
  panel.addPrintText({ options: { width: 140, height: 15, top: 120, left: 20, title: curAppointment.patMobile, textAlign: 'center' } });
//条形码
  panel.addPrintText({ options: { width: 140, height: 35, top: 140, left: 20, title: curAppointment.patId, textType: 'barcode' } });
//打印
  hiprintTemplate.print([{},{},{}]); // 可以传 [定位参数]  http://https://ccsimple.github.io/sv-print-docs/config/template.html#%E8%87%AA%E5%AE%9A%E4%B9%89%E8%AE%BE%E8%AE%A1%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B
}
/* hiprint 示例
// 引入后使用示例
  hiprint.init({
    //    host: 'http://192.168.2.100:17521',
    token: '111111'
  });
// 下列方法都是没有拖拽设计页面的, 相当于代码模式, 使用代码设计页面
@@ -356,9 +390,9 @@
  panel.addPrintText({ options: { width: 35, height: 35, top: 40, left: 165, title: '123456', textType: 'qrcode' } });
//长文本
  panel.addPrintLongText({ options: { width: 180, height: 35, top: 90, left: 20, title: '长文本:hiprint是一个很好的webjs打印,浏览器在的地方他都可以运行' } });
//打印
//打印 直接打印
  hiprintTemplate.print2({}); // 可以传 [定位参数]  http://https://ccsimple.github.io/sv-print-docs/config/template.html#%E8%87%AA%E5%AE%9A%E4%B9%89%E8%AE%BE%E8%AE%A1%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B
}
*/
/* 分页打印
HiPrint.print({
  pages: [
@@ -376,6 +410,15 @@
});
*/
const getBookBeginTime = (bookTimeslot: string): string => {
  if (7 == bookTimeslot.length) {
    return bookTimeslot.slice(0, 0) + ":" + bookTimeslot.slice(1, 2)
  } else if (8 == bookTimeslot.length) {
    return bookTimeslot.slice(0, 1) + ":" + bookTimeslot.slice(2, 3)
  }
  return "-"
}
const getDevInfo = async () => {
  deviceInfo.value.category = ''
  deviceInfo.value.brand = ''