eight
2024-11-01 4e80712bf8eae6094baf1fae25d6e2979b423d9d
src/views/ecg/doctor/components/DevReadyPanel.vue
@@ -47,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(formData.patName)">打印小票</el-button>
    <el-button @click="printBill(formData.patId)">打印小票</el-button>
    <el-button @click="cancelInstall"  :disabled="formLoading">放弃装机</el-button>
  <!-- 医生装机列表 -->
@@ -133,6 +133,8 @@
import {curDayEnd, curDayStart} from "@/utils/dateUtil";
import {RoomBedVO} from "@/api/ecg/doctor";
import {hiprint} from "vue-plugin-hiprint";
import {AppointmentApi, AppointmentVO} from "@/api/ecg/appointment";
import { useCheckTypeStoreWithOut } from '@/store/modules/checkType'
/** 设备领用 表单 */
defineComponent({ name: 'DevReadyPanel' })
@@ -152,6 +154,8 @@
const dialogVisible = ref(false) // 弹窗的是否展示
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
const checkTypeStore = useCheckTypeStoreWithOut()
const formData = ref({
  id: undefined,
@@ -337,7 +341,10 @@
  formData.value = await DevRentApi.getDevRent(rentId)
}
const printBill = async (myContent: string) => {
const printBill = async (patId: string) => {
  const curAppointment: AppointmentVO = await AppointmentApi.getCurAppointmentByPatId( patId )
  console.info( curAppointment )
// 引入后使用示例
  hiprint.init({
@@ -349,9 +356,21 @@
  var hiprintTemplate = new hiprint.PrintTemplate();  // 可传参数
  var panel = hiprintTemplate.addPrintPanel({ width: 100, height: 130, paperFooter: 340, paperHeader: 10 });
//文本
  panel.addPrintText({ options: { width: 140, height: 15, top: 20, left: 20, title: myContent, textAlign: 'center' } });
  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.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
  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 示例
// 引入后使用示例
@@ -391,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 = ''