From 2f09efc660bf2cc94cbc5291ad25ca06fc9bdadf Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期六, 24 一月 2026 22:03:09 +0800
Subject: [PATCH] feat: 增加OCR测试,车辆
---
app/pagesTask/components/HospitalSelector.vue | 58 +++++++++++++++++++++++++++++++++++++++++-----------------
1 files changed, 41 insertions(+), 17 deletions(-)
diff --git a/app/pagesTask/components/HospitalSelector.vue b/app/pagesTask/components/HospitalSelector.vue
index cd4fd01..fc57c40 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>
@@ -57,8 +57,8 @@
</template>
<script>
-import { searchHospitals } from "@/api/hospital"
-import { baiduPlaceSuggestion } from "@/api/map"
+import { searchHospitals, searchHospitalsByKeywords } from "@/api/hospital"
+import { searchTianDiTuAddress } from "@/api/map"
export default {
name: 'HospitalSelector',
@@ -179,15 +179,38 @@
}, 300)
},
- // 鎼滅储鍖婚櫌
+ // 鎼滅储鍖婚櫌锛堟櫤鑳介�夋嫨鎺ュ彛锛�
searchHospital(keyword) {
- searchHospitals(keyword, this.deptId).then(response => {
- this.searchResults = response.data || []
- this.showResults = true
- }).catch(error => {
- console.error('鎼滅储鍖婚櫌澶辫触:', error)
- this.searchResults = []
- })
+ // 濡傛灉鍏抽敭璇嶄负绌烘垨鑰呮槸"瀹朵腑"锛屼娇鐢ㄥ師鏉ョ殑鎺ュ彛
+ if (!keyword || keyword.trim() === '' || keyword.trim() === '瀹朵腑') {
+ searchHospitals(keyword || '', this.deptId).then(response => {
+ this.searchResults = response.data || []
+ this.showResults = true
+ }).catch(error => {
+ // console.error('鎼滅储鍖婚櫌澶辫触:', error)
+ this.searchResults = []
+ // this.showResults = false
+ })
+ } else {
+ // 鏈夊叧閿瘝鏃讹紝浣跨敤鏂扮殑鍒嗚瘝鍖归厤鎺ュ彛
+ searchHospitalsByKeywords(keyword, this.deptId).then(response => {
+ // 杞崲鏁版嵁鏍煎紡锛氭彁鍙� hospital 瀵硅薄
+ const rawData = response.data || []
+ this.searchResults = rawData.map(item => {
+ // 濡傛灉鏁版嵁缁撴瀯鏄� {hospital: {...}, matchScore: ...}
+ if (item.hospital) {
+ return item.hospital
+ }
+ // 濡傛灉宸茬粡鏄尰闄㈠璞★紝鐩存帴杩斿洖
+ return item
+ })
+ this.showResults = true
+ }).catch(error => {
+ // console.error('鎼滅储鍖婚櫌澶辫触:', error)
+ this.searchResults = []
+ // this.showResults = false
+ })
+ }
},
// 杈撳叆妗嗚幏寰楃劍鐐�
@@ -208,16 +231,17 @@
}
},
- // 鍔犺浇榛樿鍖婚櫌鍒楄〃
+ // 鍔犺浇榛樿鍖婚櫌鍒楄〃锛堜娇鐢ㄥ師鏉ョ殑鎺ュ彛锛�
loadDefaultHospitals() {
+ // 浣跨敤鍘熸潵鐨勬帴鍙e姞杞介粯璁ゅ垪琛�
searchHospitals('', this.deptId).then(response => {
this.defaultHospitals = response.data || []
this.searchResults = this.defaultHospitals
this.showResults = true
this.hasLoadedDefault = true
- console.log('鍔犺浇榛樿鍖婚櫌鍒楄〃锛屾暟閲�:', this.defaultHospitals.length)
+ // console.log('鍔犺浇榛樿鍖婚櫌鍒楄〃锛屾暟閲�:', this.defaultHospitals.length)
}).catch(error => {
- console.error('鍔犺浇榛樿鍖婚櫌鍒楄〃澶辫触:', error)
+ // console.error('鍔犺浇榛樿鍖婚櫌鍒楄〃澶辫触:', error)
this.defaultHospitals = []
})
},
@@ -294,7 +318,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
@@ -303,7 +327,7 @@
this.showAddressSuggestions = false
}
}).catch(error => {
- console.error('鎼滅储鍦板潃澶辫触:', error)
+ // console.error('鎼滅储鍦板潃澶辫触:', error)
this.addressSuggestions = []
this.showAddressSuggestions = false
})
@@ -318,7 +342,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