From 97f4e581af58ca03ff4c39210fd4b2f3ae11f8ff Mon Sep 17 00:00:00 2001
From: yxh <172933527@qq.com>
Date: 星期五, 27 十一月 2026 10:35:43 +0800
Subject: [PATCH] 设备编号记录要求

---
 src/views/ecg/doctor/components/DevReadyPanel.vue |  238 +++++++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 182 insertions(+), 56 deletions(-)

diff --git a/src/views/ecg/doctor/components/DevReadyPanel.vue b/src/views/ecg/doctor/components/DevReadyPanel.vue
index 6860dea..8ff6cef 100644
--- a/src/views/ecg/doctor/components/DevReadyPanel.vue
+++ b/src/views/ecg/doctor/components/DevReadyPanel.vue
@@ -14,21 +14,21 @@
     >
       <!-- ===== 缂栬緫鍖猴紙闇�瑕佸綍鍏ョ殑瀛楁锛�===== -->
       <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-input v-model="formData.devId" :placeholder="requireDevId ? '璇疯緭鍏ヨ澶囩紪鍙�' : '鍙暀绌�'" @input="getDevInfo"/>
           </el-form-item>
         </el-col>
       </el-row>
@@ -74,13 +74,21 @@
     </div>
 
   <!-- 鍖荤敓瑁呮満鍒楄〃 -->
+  <!-- 銆愭湰娆¢渶姹傘�戞搷浣滃姛鑳藉尯涓庡凡瀹屾垚璁板綍涔嬮棿鐨勬爣棰樻爮 -->
+  <div class="records-title">
+    <span class="records-title__bar"></span>
+    <span class="records-title__text">宸插畬鎴愬垪琛�</span>
+  </div>
   <div class="records-host">
     <ContentWrap class="records-wrap">
+    <div class="records-scroll">
     <el-table
       v-loading="loading"
       :data="list"
       :stripe="true"
       :show-overflow-tooltip="true"
+      highlight-current-row
+      @current-change="onCurrentRowChange"
       @row-click="onRowClick"
     >
       <!-- 闇�姹�11锛堜慨姝o級锛氥�屾挙閿�銆嶄綔涓�**宸插畬鎴愰鐢ㄨ褰曞垪琛ㄧ殑绗竴鍒�**锛堣〃澶存彃妲斤級锛�
@@ -92,7 +100,8 @@
             type="warning"
             :disabled="undoDisabled"
             :loading="undoLoading"
-            @click="$emit('event_undo_finish')"
+            title="鍏堝湪涓嬫柟鐐归�変竴鏉″畬鎴愯褰曪紝鍐嶇偣姝ゆ挙閿�"
+            @click="undoSelected"
           >
             鎾ら攢
           </el-button>
@@ -105,9 +114,15 @@
       </el-table-column>
       <el-table-column label="棰嗙敤鎯呭喌" align="center" prop="cancelled" >
         <template #default="scope">
-          <span v-if="scope.row.jobType === 5">"宸查鐢�"</span>
+          <!-- 銆愭湰闇�姹傘�戝畬鎴愯鎾ら攢杩囷細璇ユ潯璁板綍鏄剧ず銆屽凡鎾ら攢銆嶏紱鍐嶆瀹屾垚鏃跺悗绔� undone 鑷姩鍙樺洖 false -->
+          <el-tag v-if="scope.row.undone" type="danger" size="small">宸叉挙閿�</el-tag>
+          <span v-else-if="scope.row.jobType === 5">"宸查鐢�"</span>
           <span v-if="scope.row.jobType === 30">"宸叉斁寮�"</span>
         </template>
+      </el-table-column>
+      <!-- 銆�2026-11-25 闇�姹傘�戝悓涓�鎮h�呭彲鑳芥湁澶氫釜妫�鏌ラ」鐩紝宸插畬鎴愬垪琛ㄥ垪鍑烘潵鎵嶈兘鍖哄垎/绮剧‘鎾ら攢 -->
+      <el-table-column label="妫�鏌ラ」鐩�" align="center" width="150">
+        <template #default="scope">{{ getCheckTypeName(scope.row.checkType) }}</template>
       </el-table-column>
 <!--      <el-table-column label="浣滀笟绫诲瀷" align="center" prop="jobType" />-->
 <!--      <el-table-column label="鍖荤敓缂栧彿" align="center" prop="docId" />-->
@@ -155,6 +170,7 @@
       </el-table-column>
 -->
     </el-table>
+    </div>
     </ContentWrap>
     <!-- 鍒嗛〉 -->
     <Pagination
@@ -184,6 +200,8 @@
 import {calGender, getBookBeginTime} from "@/utils";
 import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
 import {tranlateDevState} from "@/utils/statusFormatter";
+import { copyText } from '@/utils/copyText'
+import { getConfigKey } from '@/api/infra/config'
 import {getCheckTypeName, needAutoFeeConfirm, needDevReady} from "../../../../utils/checkTypeFormatter";
 import { useRoomStore } from '@/store/modules/room'
 // 闇�姹�1锛氭偅鑰呬俊鎭� 18 椤圭粺涓�灞曠ず鍧�
@@ -242,6 +260,29 @@
   patId: [{ required: true, message: '鐩墠娌℃湁鎮h��', trigger: 'blur' }],
   patName: [{ required: true, message: '鐩墠娌℃湁鎮h��', trigger: 'blur' }]
 })
+
+/**
+ * 銆愮郴缁熷弬鏁般�戝姩鎬佽鍘嬪拰蹇冪數璁惧棰嗙敤瀹夎鐧昏璁惧缂栧彿
+ *   鍊尖�滄槸鈥濓紙榛樿锛夆啋 璁惧缂栧彿蹇呭~锛�
+ *   鍊尖�滃惁鈥�       鈫� 鍏佽涓嶅~锛堟牎楠岃鍒欏悓姝ユ斁寮�锛夈��
+ */
+const requireDevId = ref(true)
+const loadDevIdRequired = async () => {
+  try {
+    const value = await getConfigKey('ecg.dev.rent.device.no.required')
+    const text = String(value ?? '').trim()
+    requireDevId.value = !(
+      text === '鍚�' || text === '0' ||
+      text.toLowerCase() === 'false' || text.toLowerCase() === 'no'
+    )
+  } catch (e) {
+    console.warn('[DevReadyPanel] 璇诲彇鈥滆澶囩紪鍙峰繀濉�濈郴缁熷弬鏁板け璐ワ紝鎸夊繀濉鐞�', e)
+    requireDevId.value = true
+  }
+  formRules.devId = requireDevId.value
+    ? [{ required: true, message: '璁惧缂栧彿涓嶈兘涓虹┖', trigger: 'blur' }]
+    : []
+}
 const formRef = ref() // 琛ㄥ崟 Ref
 
 const devInfo = ref<Partial<DeviceVO>>({
@@ -251,7 +292,6 @@
   state: undefined,
 })
 
-const displayBarCode = ref<string> ()
 
 const getRentInfoByPatId = () => {
   const tempPatId = formData.value.patId;
@@ -261,7 +301,6 @@
 
   formData.value.patId = tempPatId;
   getFreeRentInfo(formData.value)
-  copyBarcode()
 }
 
 // 鏍规嵁鎮h�呮垨璁惧, 鑾峰彇 Free鐨勭璧�
@@ -309,7 +348,7 @@
       `銆�${ctName}銆嶄笉闇�瑕佽澶囬鐢紝涓嶈兘鍦ㄨ澶囬鐢ㄦā鍧楀姙鐞嗐�俙 +
       `璇风‘璁ゆ槸鍚﹀簲鍒般�屽彨鍙锋鏌ャ�嶉〉闈㈠鐞嗚鎮h�呫�俙
     )
-    return
+    return false
   }
 
   // 鏍¢獙琛ㄥ崟
@@ -336,6 +375,7 @@
     // 鍙戦�佹搷浣滄垚鍔熺殑浜嬩欢
     emit('event_dev_ready')
     message.success(t('鎿嶄綔瀹屾垚'))
+    return true
   } finally {
     formLoading.value = false
   }
@@ -416,6 +456,10 @@
   formData.value.doctor = queueVO?.doctor
   formData.value.doctorTime = queueVO?.doctorTime
   formData.value.patSrc = queueVO?.patSrc
+  // 銆愭湰娆′慨澶嶃�戞潯鐮�/鎵撳嵃灏忕エ渚濊禆 patDetails锛堝惈 source/appointmentId锛夛紝
+  // 闃熷垪琛屾湰灏卞甫鐫�瀹冿紱鍘熷厛鍙湪 getFreeRentInfo() 鏌ュ埌"寰呮鏌ュ崟"鏃舵墠璧嬪�硷紝
+  // 瀵艰嚧缁濆ぇ澶氭暟鎯呭喌涓� patDetails 涓� undefined 鈫� 鏉$爜涓嶆樉绀恒��
+  formData.value.patDetails = queueVO?.patDetails
   formData.value.patMobile = queueVO?.patMobile
   formData.value.patPhone = queueVO?.patPhone
   formData.value.patWardDesc = queueVO?.patWardDesc
@@ -426,9 +470,19 @@
     formData.value.doctorAdviceNo = queueVO?.doctorAdviceNo
   formData.value.patIdentityId = queueVO?.patIdentityId
   getFreeRentInfo(formData.value)  // 寰呮鏌ョ殑淇℃伅  @ dev_rent 琛�
-  copyBarcode()
 }
-defineExpose({ setPatient }) // 鎻愪緵 setPatient 鏂规硶锛岀敤浜庤缃偅鑰�
+/**
+ * 銆愬彨鍙疯嚜鍔ㄥ畬鎴愩�戜緵鐖堕〉闈㈢偣銆屽彨鍙枫�嶆椂鍏堣嚜鍔ㄥ畬鎴愬綋鍓嶆偅鑰咃紙绛夊悓鐐广�岄鐢ㄥ畬鎴愩�嶏級銆�
+ */
+const completeCurrent = async (): Promise<boolean> => {
+  try {
+    return (await submitForm()) === true
+  } catch (e) {
+    console.warn('[DevReadyPanel] 鑷姩銆岄鐢ㄥ畬鎴愩�嶅け璐�', e)
+    return false
+  }
+}
+defineExpose({ setPatient, getList: () => getList(), completeCurrent }) // 鎻愪緵 setPatient 鏂规硶锛岀敤浜庤缃偅鑰�
 
 
 const loading = ref(true) // 鍒楄〃鐨勫姞杞戒腑
@@ -488,9 +542,29 @@
     const data = await JobRecordApi.getJobRecordDoctorPage(queryParams)
     list.value = data.list
     total.value = data.total
+    // 鍒楄〃鍒锋柊鍚庢棫鐨勯�変腑琛屽凡澶辨晥锛屾竻鎺夛紝閬垮厤銆屾挙閿�銆嶄綔鐢ㄥ埌涓婁竴灞忕殑璁板綍
+    selectedRecord.value = undefined
   } finally {
     loading.value = false
   }
+}
+
+/** 銆�2026-11-25 闇�姹傘�戝凡瀹屾垚鍒楄〃鐨勯�変腑琛岋細鎾ら攢鍓嶅厛鐐归�変竴鏉★紝鎾ら攢浣滅敤鍦ㄩ�変腑璁板綍涓� */
+const selectedRecord = ref<any>()
+const onCurrentRowChange = (row: any) => {
+  selectedRecord.value = row || undefined
+}
+
+/** 鎾ら攢锛氬彧鎾ら攢褰撳墠閫変腑鐨勯偅鏉″畬鎴愯褰曪紙鏈�変腑鏃舵彁绀猴紝涓嶅啀榛樿鎾ら攢"鏈�杩戜竴鏉�"锛� */
+const undoSelected = () => {
+  if (!selectedRecord.value) {
+    message.warning('璇峰厛鍦ㄣ�屽凡瀹屾垚鍒楄〃銆嶄腑鐐归�変竴鏉¤褰曪紝鍐嶇偣銆屾挙閿�銆�')
+    return
+  }
+  emit('event_undo_finish', {
+    ...selectedRecord.value,
+    checkTypeName: getCheckTypeName(selectedRecord.value.checkType)
+  })
 }
 
 const onRowClick = (cur) => {
@@ -584,7 +658,8 @@
 */
 
 const getDevInfo = async () => {
-  if (formData.value?.devId == null) {
+  // 璁惧缂栧彿鍏佽鐣欑┖锛堢郴缁熷弬鏁�=鍚︼級鏃讹紝绌哄�间笉鍐嶅幓鏌ヨ澶囷紝閬垮厤鏃犳剰涔夎姹�/鎶ラ敊
+  if (!formData.value?.devId) {
     devInfo.value.brand = undefined
     devInfo.value.model = undefined
     devInfo.value.state = undefined
@@ -631,57 +706,84 @@
 /**
  * 鑾峰彇鏉″舰鐮侊紝鏄剧ず涓庡惁  鍚屼竴涓��
  */
-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)
+})
 
-  if (formData.value.patDetails?.source == null)
-    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)
+})
 
-  const displayBarcode: number[] = checkTypeStore.getCheckTypeDispBarCode(formData.value.checkType)
-  if (displayBarcode == null || displayBarcode.length === 0)
-    return ""
+/** 鏉$爜 / 澶嶅埗鐨勫唴瀹癸細缁熶竴鍙栥�屽氨璇婃祦姘村彿銆� */
+const barcodeContent = computed<string>(() =>
+  barcodeEnabled.value ? (formData.value.episodeId ?? '') : ''
+)
 
-  if (!displayBarcode.includes( formData.value.patDetails.source ))
-    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
-  if (patSource == null)
-    return ""
-
-  if (1 === patSource || 2 === patSource)
-    return formData.value.applyNo??""
-  else if (3 === patSource || 4 === 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
+  // 銆愬吋瀹� Chrome 85 / http 璁块棶銆戦潪瀹夊叏涓婁笅鏂囦笅 navigator.clipboard 涓嶅彲鐢紝鐢ㄥ吋瀹瑰疄鐜�
+  const ok = await copyText(barcodeContent.value)
+  if (ok) {
+    message.success('宸插鍒�')
+  } else {
+    message.warning('褰撳墠娴忚鍣ㄤ笉鏀寔鑷姩澶嶅埗锛岃鎵嬪姩閫変腑澶嶅埗')
+  }
 }
 
 /** 鍒濆鍖� **/
 onMounted(() => {
   getList()
+  loadDevIdRequired()
 })
 
 </script>
 
 <style scoped lang="scss">
+
+/* 銆愭湰娆¢渶姹傘�戙�屽凡瀹屾垚鍒楄〃銆嶆爣棰樻爮锛氬乏渚т富鑹茬珫绾� + 鍔犵矖灏忔爣棰橈紝绱у噾楂樺害涓嶆尋鍘嬭〃鏍� */
+.records-title {
+  display: flex;
+  align-items: center;
+  flex: none;
+  gap: 6px;
+  padding: 2px 0 6px;
+
+  &__bar {
+    width: 3px;
+    height: 14px;
+    background-color: var(--el-color-primary);
+    border-radius: 2px;
+  }
+
+  &__text {
+    font-size: 15px;
+    font-weight: 600;
+    color: var(--el-text-color-primary);
+  }
+}
 /* ==========================================================================
    闇�姹傦細琛ㄥ崟鍐呭鎸ゅ崰浜嗕笅鏂硅褰曡〃鏍肩殑绌洪棿 鈥斺�� 鍘嬬缉琛岄棿璺濄��
    Element Plus 榛樿 `.el-form-item { margin-bottom: 18px }`锛�
@@ -733,19 +835,43 @@
 .patient-actions {
   display: flex;
   flex: none;
-  flex-wrap: nowrap;
+  /* 鎸夐挳澶氭椂鍏佽鎹㈣锛岄伩鍏嶆尋鍦ㄤ竴琛岋紙妫�鏌ラ〉鏈�澶� 6 涓寜閽級 */
+  flex-wrap: wrap;
   gap: 8px;
   align-items: center;
-  /* 涓婁笅鐣欑櫧 + 鍒嗛殧绾匡紝褰㈡垚鐙珛鍔熻兘鍧� */
-  padding: 6px 4px;
-  margin-bottom: 6px;
-  background-color: var(--el-bg-color);
-  border-top: 1px solid var(--el-border-color-lighter);
-  border-bottom: 1px solid var(--el-border-color-lighter);
+  /*
+    銆愭湰娆¢渶姹傘�戞搷浣滃姛鑳藉尯鍋氫竴鐐硅瑙夊尯鍒嗭紝鏂逛究鍖荤敓涓�鐪煎畾浣嶏細
+    鏋佹祬鐨勪富鑹插簳 + 缁嗚竟妗� + 宸︿晶 3px 涓昏壊绔栨潯锛堜笌銆屸枎宸插畬鎴愬垪琛ㄣ�嶆爣棰樻潯鍚屾璇█锛夈��
+    鍙仛"绋嶆湁鍖哄垎"锛屼笉鏀规寜閽湰韬殑灏哄/棰滆壊/椤哄簭銆�
+  */
+  padding: 8px 10px;
+  margin: 2px 0 10px;
+  background-color: var(--el-color-primary-light-9);
+  border: 1px solid var(--el-color-primary-light-7);
+  border-left: 3px solid var(--el-color-primary);
+  border-radius: 4px;
 
   /* Element Plus 缁欑浉閭� el-button 榛樿鍔犱簡 margin-left:12px锛屼細涓� gap 鍙犲姞锛屾竻鎺� */
   :deep(.el-button + .el-button) {
     margin-left: 0;
   }
 }
+
+/* ==========================================================================
+   銆�2026-11-25 闇�姹傘�戝凡瀹屾垚鍒楄〃锛氬彧鏄剧ず 4 琛屽乏鍙筹紝瓒呰繃灏卞嚭鐜扮旱鍚戞粴鍔ㄦ潯
+   锛堝疄娴嬭楂� 40px銆佽〃澶� 63px 鈫� 63 + 4脳40 + 2 = 225px锛夈��
+   ========================================================================== */
+.records-scroll {
+  max-height: 225px;
+  min-height: 120px;
+  overflow-y: auto;
+  overflow-x: hidden;
+
+  :deep(.el-table__header-wrapper) {
+    position: sticky;
+    top: 0;
+    z-index: 2;
+    background-color: var(--el-bg-color);
+  }
+}
 </style>

--
Gitblit v1.9.3