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/DevInstallPanel.vue |   80 +++++++++++++++++++---------------------
 1 files changed, 38 insertions(+), 42 deletions(-)

diff --git a/src/views/ecg/doctor/components/DevInstallPanel.vue b/src/views/ecg/doctor/components/DevInstallPanel.vue
index fbd7d95..7ba56dd 100644
--- a/src/views/ecg/doctor/components/DevInstallPanel.vue
+++ b/src/views/ecg/doctor/components/DevInstallPanel.vue
@@ -2,19 +2,19 @@
   <el-form class="patient-compact-form" ref="formRef" :model="formData" :rules="formRules" label-width="100px" v-loading="formLoading">
     <!-- ===== 缂栬緫鍖猴紙闇�瑕佸綍鍏ョ殑瀛楁锛�===== -->
     <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>
@@ -171,7 +171,6 @@
 
 const formRef = ref() // 琛ㄥ崟 Ref
 
-const displayBarCode = ref<string>()
 
 const formLoading = ref(false) // 琛ㄥ崟鐨勫姞杞戒腑锛�1锛変慨鏀规椂鐨勬暟鎹姞杞斤紱2锛夋彁浜ょ殑鎸夐挳绂佺敤
 
@@ -234,7 +233,6 @@
     formData.value.doctorAdviceNo = queueVO?.doctorAdviceNo
   formData.value.patIdentityId = queueVO?.patIdentityId
   getReadyRentInfo(formData.value)    // 鑾峰彇棰嗙敤淇℃伅
-  copyBarcode()
 }
 defineExpose({ setPatient, getList: () => getList() }) // 鎻愪緵 setPatient 鏂规硶锛岀敤浜庤缃偅鑰�
 
@@ -344,7 +342,6 @@
 
   formData.value.patId = tempPatId;
   getReadyRentInfo(formData.value)
-  copyBarcode()
 }
 
 // 鑾峰彇鎮h�呯殑棰嗙敤淇℃伅
@@ -474,46 +471,45 @@
   getList()
 }
 
-const getDisplayBarcode = (): string => {
-  if (!formData.value.checkType)
-    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/绌猴級鈫� 涓嶆樉绀猴紙鎸夌幇鍦虹‘璁ゅ彛寰勶級
-  const displayBarcode: number[] | undefined = checkTypeStore.getCheckTypeDispBarCode(formData.value.checkType!)
-  if (displayBarcode == null || displayBarcode.length === 0)
-    return ""
+/** 鏄惁閫氳繃浜嗐�屾偅鑰呮潯鐮佹樉绀恒�嶉厤缃紙鍕鹃�変簡褰撳墠鎮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 false
+  const patSource = patSourceValue.value
+  if (patSource == null) return false
+  return displayBarcode.map(Number).includes(patSource)
+})
 
-  // 銆愭湰娆′慨澶嶃�戞潵婧愪紭鍏堝彇 patDetails.source锛岀己澶辨椂鍥為��鍒板钩閾虹殑 patSrc
-  // 锛堝師鏉ョ洿鎺ュ彇 patDetails.source锛宲atDetails 缂哄け鏃� `.includes` 杩樹細鎶涘紓甯革級
-  const patSource = formData.value.patDetails?.source ?? formData.value.patSrc
-  if (patSource == null)
-    return ""
-  if (!displayBarcode.map(Number).includes(Number(patSource)))
-    return ""
+/** 鏉$爜 / 澶嶅埗鐨勫唴瀹癸細缁熶竴鍙栥�屽氨璇婃祦姘村彿銆� */
+const barcodeContent = computed<string>(() =>
+  barcodeEnabled.value ? (formData.value.episodeId ?? '') : ''
+)
 
-  return getBarcode()
-}
+/** 鏄惁鏄剧ず鏉$爜锛氫綇闄紙鏉ユ簮 3锛変笉鏄剧ず锛涘唴瀹逛负绌烘椂涔熶笉鏄剧ず */
+const showBarCode = computed<boolean>(
+  () => barcodeEnabled.value && patSourceValue.value !== 3 && barcodeContent.value !== ''
+)
 
-const getBarcode = (): string => {
-  if (!formData.value.checkType)
-    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()
-  await navigator.clipboard.writeText(getBarcode());
+  if (!barcodeContent.value) return
+  await navigator.clipboard.writeText(barcodeContent.value)
 }
 
 /** 鍒濆鍖� **/

--
Gitblit v1.9.3