From a30f5ac1fd3b69457b16f8332cd918aa2f5a093b Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期一, 02 十二月 2024 11:37:42 +0800
Subject: [PATCH] 条码复制完成

---
 src/views/ecg/doctor/components/RoutinePanel.vue |   25 +++++++++++++++++++++----
 1 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/src/views/ecg/doctor/components/RoutinePanel.vue b/src/views/ecg/doctor/components/RoutinePanel.vue
index 2c9a405..803e26f 100644
--- a/src/views/ecg/doctor/components/RoutinePanel.vue
+++ b/src/views/ecg/doctor/components/RoutinePanel.vue
@@ -12,7 +12,8 @@
           <el-form-item label="鎮h�呯紪鍙�" prop="patId">
             <el-input v-model="formData.patId" placeholder="璇疯緭鍏ユ偅鑰呯紪鍙�" @input="getRentInfoByPatId" />
 <!--        <Qrcode v-if="formData.patId !== undefined && formData.patId !== ''" :text="formData.patId" logo="/logo.gif" width=100 />-->
-            <Barcode v-if="getDisplayBarcode()" :value="getDisplayBarcode()" :width=100 />
+            <Barcode v-if="displayBarCode" :value="displayBarCode" :width=100 />
+            <el-button @click="copyBarcode()">澶嶅埗</el-button>
           </el-form-item>
           <el-form-item label="鎮h�呭悕绉�" prop="patName">
             <el-input v-model="formData.patName" placeholder="璇疯緭鍏ユ偅鑰呭悕绉�" />
@@ -145,6 +146,7 @@
   formData.value.checkType = queueVO?.bookCheckType
   formData.value.patSrc = queueVO?.patDetails.source
   getFreeRentInfo(formData.value)
+  copyBarcode()
 }
 defineExpose({ setPatient }) // 鎻愪緵 setPatient 鏂规硶锛岀敤浜庤缃偅鑰�
 
@@ -162,6 +164,8 @@
   rentTime: [{ required: true, message: '璇烽�夋嫨瑁呮満鏃ユ湡', trigger: 'blur' }],
 })
 const formRef = ref() // 琛ㄥ崟 Ref
+
+const displayBarCode = ref<string> ()
 
 /** 鎻愪氦琛ㄥ崟 */
 const submitForm = async () => {
@@ -218,6 +222,7 @@
 
   formData.value.patId = tempPatId;
   getFreeRentInfo(formData.value)
+  copyBarcode()
 }
 
 const getFreeRentInfo = async (devRentVO) => {
@@ -298,7 +303,7 @@
     message.success(t('鎿嶄綔鎴愬姛'))
 }
 
-const getDisplayBarcode = () => {
+const getDisplayBarcode = (): string => {
   if (!formData.value.checkType)
     return ""
 
@@ -306,14 +311,26 @@
   if (!displayBarcode.includes( formData.value.patSrc ))
     return ""
 
+  return getBarcode()
+}
+
+const getBarcode = (): string => {
+  if (!formData.value.checkType)
+    return ""
+
   if (1 === formData.value.patSrc || 2 === formData.value.patSrc)
-    return formData.value.applyNo
+    return formData.value.applyNo??""
   else if (3 === formData.value.patSrc || 4 === formData.value.patSrc)
-    return formData.value.episodeId
+    return formData.value.episodeId??""
 
   return ""
 }
 
+const copyBarcode = async () => {
+  displayBarCode.value = getDisplayBarcode()
+  await navigator.clipboard.writeText( getBarcode() );
+}
+
 /** 鍒濆鍖� **/
 onMounted(() => {
   resetForm()

--
Gitblit v1.9.3