From 09dc74e264b6262cbe41c9c8476e24705871d4a6 Mon Sep 17 00:00:00 2001
From: yxh <172933527@qq.com>
Date: 星期日, 08 十一月 2026 23:31:17 +0800
Subject: [PATCH] yxh

---
 src/views/ecg/doctor/components/DevReadyPanel.vue |   83 ++++++++++++++++++-----------------------
 1 files changed, 37 insertions(+), 46 deletions(-)

diff --git a/src/views/ecg/doctor/components/DevReadyPanel.vue b/src/views/ecg/doctor/components/DevReadyPanel.vue
index e740c11..07a620e 100644
--- a/src/views/ecg/doctor/components/DevReadyPanel.vue
+++ b/src/views/ecg/doctor/components/DevReadyPanel.vue
@@ -14,19 +14,19 @@
     >
       <!-- ===== 缂栬緫鍖猴紙闇�瑕佸綍鍏ョ殑瀛楁锛�===== -->
       <el-row :gutter="20">
-        <el-col :span="6">
+        <el-col :xs="24" :sm="12" :md="12" :lg="6">
           <el-form-item label="妫�鏌ラ」鐩�" prop="">
             {{getCheckTypeName(formData.checkType)}}
           </el-form-item>
         </el-col>
-        <el-col :span="12">
+        <el-col :xs="24" :sm="24" :md="12" :lg="12">
           <el-form-item label="鎮h�呯紪鍙�" prop="patId">
             <el-input v-model="formData.patId" placeholder="璇疯緭鍏ユ偅鑰呯紪鍙�" @input="getRentInfoByPatId" />
-            <Barcode v-if="displayBarCode" :value="displayBarCode" :width=100 />
-            <el-button @click="copyBarcode()">澶嶅埗</el-button>
+            <Barcode v-if="showBarCode" :value="barcodeContent" :width=100 />
+            <el-button v-if="showCopyButton" :disabled="!barcodeContent" @click="copyBarcode()">澶嶅埗</el-button>
           </el-form-item>
         </el-col>
-        <el-col :span="6">
+        <el-col :xs="24" :sm="12" :md="12" :lg="6">
           <el-form-item label="璁惧缂栧彿" prop="devId">
             <el-input v-model="formData.devId" placeholder="璇疯緭鍏ヨ澶囩紪鍙�" @input="getDevInfo"/>
           </el-form-item>
@@ -258,7 +258,6 @@
   state: undefined,
 })
 
-const displayBarCode = ref<string> ()
 
 const getRentInfoByPatId = () => {
   const tempPatId = formData.value.patId;
@@ -268,7 +267,6 @@
 
   formData.value.patId = tempPatId;
   getFreeRentInfo(formData.value)
-  copyBarcode()
 }
 
 // 鏍规嵁鎮h�呮垨璁惧, 鑾峰彇 Free鐨勭璧�
@@ -437,7 +435,6 @@
     formData.value.doctorAdviceNo = queueVO?.doctorAdviceNo
   formData.value.patIdentityId = queueVO?.patIdentityId
   getFreeRentInfo(formData.value)  // 寰呮鏌ョ殑淇℃伅  @ dev_rent 琛�
-  copyBarcode()
 }
 defineExpose({ setPatient, getList: () => getList() }) // 鎻愪緵 setPatient 鏂规硶锛岀敤浜庤缃偅鑰�
 
@@ -642,51 +639,45 @@
 /**
  * 鑾峰彇鏉″舰鐮侊紝鏄剧ず涓庡惁  鍚屼竴涓��
  */
-const getDisplayBarcode = (): string => {
-  if (formData.value.checkType == null)
-    return ""
+/**
+ * 銆愭湰闇�姹傘�戞偅鑰呮潯鐮佸彛寰勶紙闂ㄨ瘖/鎬ヨ瘖/浣撴 = 灏辫瘖娴佹按鍙凤紱浣忛櫌涓嶅嚭鏉$爜锛屽彧鐣欍�屽鍒躲�嶏級
+ *
+ *  路 闂ㄨ瘖(1) / 鎬ヨ瘖(2) / 浣撴(4) 鈫� 鏉$爜鍐呭 = **灏辫瘖娴佹按鍙�**锛坋pisodeId锛�
+ *  路 浣忛櫌(3)                    鈫� **涓嶆樉绀烘潯鐮�**锛屽彧淇濈暀銆屽鍒躲�嶆寜閽紙澶嶅埗鍐呭鍚屾牱鏄氨璇婃祦姘村彿锛�
+ *  路 銆屽鍒躲�嶆寜閽笌鏉$爜涓�鑷达細鍚屽彈銆屾鏌ョ被鍨� 鈫� 鎮h�呮潯鐮佹樉绀恒�嶉厤缃帶鍒�
+ *    锛堣妫�鏌ョ被鍨嬫湭鍕鹃�夎繖涓偅鑰呮潵婧愭椂锛屾潯鐮佸拰澶嶅埗鎸夐挳閮戒笉鏄剧ず锛�
+ */
+const patSourceValue = computed<number | null>(() => {
+  const source = formData.value.patDetails?.source ?? formData.value.patSrc
+  return source === null || source === undefined || source === '' ? null : Number(source)
+})
 
-  // 銆愭湰娆′慨澶嶃�戙�屾偅鑰呮潯鐮佹樉绀恒�嶆湭閰嶇疆锛坣ull/绌猴級鈫� 涓嶆樉绀猴紙鎸夌幇鍦虹‘璁ゅ彛寰勶級
+/** 鏄惁閫氳繃浜嗐�屾偅鑰呮潯鐮佹樉绀恒�嶉厤缃紙鍕鹃�変簡褰撳墠鎮h�呮潵婧愶級 */
+const barcodeEnabled = computed<boolean>(() => {
+  if (formData.value.checkType == null) return false
   const displayBarcode: number[] | undefined = checkTypeStore.getCheckTypeDispBarCode(formData.value.checkType)
-  if (displayBarcode == null || displayBarcode.length === 0)
-    return ""
+  if (displayBarcode == null || displayBarcode.length === 0) return false
+  const patSource = patSourceValue.value
+  if (patSource == null) return false
+  return displayBarcode.map(Number).includes(patSource)
+})
 
-  // 銆愭湰娆′慨澶嶃�戞潵婧愪紭鍏堝彇 patDetails.source锛岀己澶辨椂鍥為��鍒板钩閾虹殑 patSrc
-  const patSource = formData.value.patDetails?.source ?? formData.value.patSrc
-  if (patSource == null)
-    return ""
+/** 鏉$爜 / 澶嶅埗鐨勫唴瀹癸細缁熶竴鍙栥�屽氨璇婃祦姘村彿銆� */
+const barcodeContent = computed<string>(() =>
+  barcodeEnabled.value ? (formData.value.episodeId ?? '') : ''
+)
 
-  if (!displayBarcode.map(Number).includes(Number(patSource)))
-    return ""
+/** 鏄惁鏄剧ず鏉$爜锛氫綇闄紙鏉ユ簮 3锛変笉鏄剧ず锛涘唴瀹逛负绌烘椂涔熶笉鏄剧ず */
+const showBarCode = computed<boolean>(
+  () => barcodeEnabled.value && patSourceValue.value !== 3 && barcodeContent.value !== ''
+)
 
-  return getBarcode()
-}
-
-const getBarcode = (): string => {
-  if (formData.value.checkType == null)
-    return ""
-
-  const patSource = formData.value.patDetails?.source ?? formData.value.patSrc
-  if (patSource == null)
-    return ""
-
-  // 闂ㄨ瘖/鎬ヨ瘖 鈫� 鐢宠鍗曞彿锛涗綇闄�/浣撴 鈫� 灏辫瘖娴佹按鍙�
-  if (1 === Number(patSource) || 2 === Number(patSource))
-    return formData.value.applyNo??""
-  else if (3 === Number(patSource) || 4 === Number(patSource))
-    return formData.value.episodeId??""
-
-  return ""
-}
+/** 鏄惁鏄剧ず銆屽鍒躲�嶆寜閽細涓庢潯鐮佷竴鑷达紙鍚屽彈閰嶇疆鎺у埗锛� */
+const showCopyButton = computed<boolean>(() => barcodeEnabled.value)
 
 const copyBarcode = async () => {
-  displayBarCode.value = getDisplayBarcode()
-
-  const barCode = getBarcode()
-  if (isStringEmpty(barCode))
-    return
-
-  await navigator.clipboard.writeText( barCode );
+  if (!barcodeContent.value) return
+  await navigator.clipboard.writeText(barcodeContent.value)
 }
 
 /** 鍒濆鍖� **/

--
Gitblit v1.9.3