From c10b1e130ccbc94e6481a43e8e2d35cfc8fcf83b Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期五, 26 十二月 2025 18:05:06 +0800
Subject: [PATCH] feat:显示问题

---
 app/pagesTask/components/HospitalSelector.vue |   30 ++++++++++++++++++------------
 1 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/app/pagesTask/components/HospitalSelector.vue b/app/pagesTask/components/HospitalSelector.vue
index b82dc5b..6d6443e 100644
--- a/app/pagesTask/components/HospitalSelector.vue
+++ b/app/pagesTask/components/HospitalSelector.vue
@@ -45,7 +45,7 @@
             @click="selectAddressSuggestion(item)"
           >
             <view class="suggestion-name">{{ item.name }}</view>
-            <view class="suggestion-address">{{ item.district }}{{ item.address }}</view>
+            <view class="suggestion-address">{{ (item.district || '') + (item.address || '') }}</view>
           </view>
         </view>
       </view>
@@ -58,7 +58,7 @@
 
 <script>
 import { searchHospitals } from "@/api/hospital"
-import { baiduPlaceSuggestion } from "@/api/map"
+import { searchTianDiTuAddress } from "@/api/map"
 
 export default {
   name: 'HospitalSelector',
@@ -224,21 +224,27 @@
     
     // 閫夋嫨鍖婚櫌
     selectHospital(hospital) {
-      this.selectedHospitalName = hospital.hospName
-      this.searchKeyword = hospital.hospName
+      // 娣诲姞null妫�鏌�
+      if (!hospital) {
+        console.warn('閫夋嫨鐨勫尰闄㈠璞′负绌�');
+        return;
+      }
+      
+      this.selectedHospitalName = hospital.hospName || '';
+      this.searchKeyword = hospital.hospName || '';
       
       const hospitalData = {
-        id: hospital.hospId,
-        name: hospital.hospName,
+        id: hospital.hospId || null,
+        name: hospital.hospName || '',
         address: hospital.hospName === '瀹朵腑' ? '' : this.buildFullAddress(hospital)
       }
       
-      this.showResults = false
-      this.searchResults = []
+      this.showResults = false;
+      this.searchResults = [];
       
       // 瑙﹀彂鏇存柊浜嬩欢
-      this.$emit('input', hospitalData)
-      this.$emit('change', hospitalData)
+      this.$emit('input', hospitalData);
+      this.$emit('change', hospitalData);
     },
     
 
@@ -288,7 +294,7 @@
         
     // 鎼滅储鍦板潃寤鸿
     searchAddress(query) {
-      baiduPlaceSuggestion(query, this.region).then(response => {
+      searchTianDiTuAddress(query, this.region).then(response => {
         if (response.code === 200 && response.data) {
           this.addressSuggestions = response.data
           this.showAddressSuggestions = true
@@ -312,7 +318,7 @@
         
     // 閫夋嫨鍦板潃寤鸿
     selectAddressSuggestion(item) {
-      const fullAddress = item.district + item.address
+      const fullAddress = (item.district || '') + (item.address || '')
       this.$emit('input', {
         ...this.value,
         address: fullAddress

--
Gitblit v1.9.1