From 52edcce5511b690c58905884c090b2316aa5e359 Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期二, 15 四月 2025 15:27:33 +0800
Subject: [PATCH] update

---
 src/api/ecg/common/index.ts                       |    1 +
 src/utils/stringUtil.ts                           |    2 +-
 src/views/ecg/doctor/components/DevReadyPanel.vue |   38 ++++++++++++++++++++++++++------------
 3 files changed, 28 insertions(+), 13 deletions(-)

diff --git a/src/api/ecg/common/index.ts b/src/api/ecg/common/index.ts
index 67f780b..18d35b5 100644
--- a/src/api/ecg/common/index.ts
+++ b/src/api/ecg/common/index.ts
@@ -6,4 +6,5 @@
     deptCode: string
     wardDesc: string
     source: number
+    appointmentId: number
 }
diff --git a/src/utils/stringUtil.ts b/src/utils/stringUtil.ts
index 3e57ef1..ab955b6 100644
--- a/src/utils/stringUtil.ts
+++ b/src/utils/stringUtil.ts
@@ -1,6 +1,6 @@
 
 export function isStringEmpty(value: string | null | undefined): boolean {
-  return !value || value.trim() === '';
+  return value == null || value.trim() === '';
 }
 
 export function genderFormat(value: number): string {
diff --git a/src/views/ecg/doctor/components/DevReadyPanel.vue b/src/views/ecg/doctor/components/DevReadyPanel.vue
index de29af4..0a54875 100644
--- a/src/views/ecg/doctor/components/DevReadyPanel.vue
+++ b/src/views/ecg/doctor/components/DevReadyPanel.vue
@@ -54,7 +54,7 @@
     </el-form>
     <el-button @click="submitForm" type="primary" :disabled="formLoading">棰嗙敤瀹屾垚</el-button>
     <el-checkbox style="margin-left:10px" label="鑷姩&nbsp;" v-model="autoPrint" />
-    <el-button @click="printBill(formData.patId!, formData.checkType!)">鎵撳嵃灏忕エ</el-button>
+    <el-button @click="printBill(formData.patDetails?.appointmentId)">鎵撳嵃灏忕エ</el-button>
     <el-button @click="cancelReady"  :disabled="formLoading">鏀惧純棰嗙敤</el-button>
     <el-button @click="resetForm()">閲� 缃�</el-button>
     <el-button v-if="needAutoFeeConfirm(formData.checkType)" @click="feeConfirm"  :disabled="formLoading">纭垂</el-button>
@@ -241,7 +241,7 @@
     await DevRentApi.devReady(formData.value)
 
     if (autoPrint.value && formData.value.patId && formData.value.checkType) {
-      printBill(formData.value.patId, formData.value.checkType)
+      printBill(formData.value.patDetails?.appointmentId)
     }
 
     // 鑷姩纭垂
@@ -357,10 +357,11 @@
   devInfo.value.state = data.devState
 }
 
-const printBill = async (patId: string, checkType: number, printMode?: number) => {
+const printBill = async (appointmentId: number | null | undefined, printMode?: number) => {
+  if ( appointmentId == null )
+    return
 
-  const curAppointment: AppointmentVO = await AppointmentApi.getCurAppointmentByPatIdAndCheckType( patId, checkType )
-  //console.info( curAppointment )
+  const curAppointment: AppointmentVO = await AppointmentApi.getAppointment( appointmentId )
 
 // 寮曞叆鍚庝娇鐢ㄧず渚�
   hiprint.init({
@@ -445,26 +446,34 @@
 
 const feeConfirm = async () => {
   if (formData.value.id == null) {
-    message.error(t('璇峰厛棰嗙敤'))
+    message.error('璇峰厛棰嗙敤')
     return
   }
 
-  const result = await DevRentApi.feeConfirm(formData.value.id)
-  if (0 === result)
-    message.success(t('纭垂鎿嶄綔鎴愬姛'))
+ try {
+    const result = await DevRentApi.feeConfirm(formData.value.id)
+    if (0 === result) {
+      //message.success('纭垂鎿嶄綔鎴愬姛')
+    }
+  } catch (err) {
+    // 妗嗘灦 浼氱粰鍑� 鍚庡彴鐨� 閿欒淇℃伅
+  }
 }
 
 const feeCancel = async () => {
   if (formData.value.id == null) {
-    message.error(t('璇峰厛棰嗙敤'))
+    message.error('璇峰厛棰嗙敤')
     return
   }
 
   const result = await DevRentApi.feeCancel(formData.value.id)
   if (0 === result)
-    message.success(t('鎿嶄綔鎴愬姛'))
+    message.success('鎿嶄綔鎴愬姛')
 }
 
+/**
+ * 鑾峰彇鏉″舰鐮侊紝鏄剧ず涓庡惁  鍚屼竴涓��
+ */
 const getDisplayBarcode = (): string => {
   if (formData.value.checkType == null)
     return ""
@@ -500,7 +509,12 @@
 
 const copyBarcode = async () => {
   displayBarCode.value = getDisplayBarcode()
-  await navigator.clipboard.writeText( getBarcode() );
+
+  const barCode = getBarcode()
+  if (isStringEmpty(barCode))
+    return
+
+  await navigator.clipboard.writeText( barCode );
 }
 
 /** 鍒濆鍖� **/

--
Gitblit v1.9.3