From f3a294e8fc21a26a1a1eeebbd569142e236eddb5 Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期五, 07 十一月 2025 12:02:37 +0800
Subject: [PATCH] fix:优化 评价
---
app/pages/task/create-emergency.vue | 195 ++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 163 insertions(+), 32 deletions(-)
diff --git a/app/pages/task/create-emergency.vue b/app/pages/task/create-emergency.vue
index a0f758a..094a808 100644
--- a/app/pages/task/create-emergency.vue
+++ b/app/pages/task/create-emergency.vue
@@ -18,7 +18,7 @@
</picker>
</view>
<view class="form-item">
- <view class="form-label">褰掑睘鏈烘瀯</view>
+ <view class="form-label required">褰掑睘鏈烘瀯</view>
<picker mode="selector" :range="organizations" @change="onOrganizationChange">
<view class="form-input picker-input">
{{ selectedOrganization || '璇烽�夋嫨褰掑睘鏈烘瀯' }}
@@ -274,7 +274,7 @@
</view>
<view class="form-item">
- <view class="form-label">杞繍鍏噷鏁�</view>
+ <view class="form-label required">杞繍鍏噷鏁�</view>
<input
class="form-input"
type="digit"
@@ -284,7 +284,7 @@
</view>
<view class="form-item">
- <view class="form-label">鎴愪氦浠�</view>
+ <view class="form-label required">鎴愪氦浠�</view>
<input
class="form-input"
type="digit"
@@ -444,13 +444,13 @@
import { addTask } from "@/api/task"
import { listAvailableVehicles, getUserBoundVehicle } from "@/api/vehicle"
import { calculateDistance, baiduDistanceByAddress } from "@/api/map"
-import { searchHospitals } from "@/api/hospital"
+import { searchHospitals, getFrequentOutHospitals, getFrequentInHospitals } from "@/api/hospital"
import { listUser } from "@/api/system/user"
import { searchIcd10 } from "@/api/icd10"
import { getDicts } from "@/api/dict"
import { getServiceOrdAreaTypes, getServiceOrderTypes, getHospitalDepartments } from "@/api/dictionary"
-import { listBranchCompany } from "@/api/system/dept"
+import { listBranchCompany, getDept } from "@/api/system/dept"
import MapSelector from '@/components/map-selector.vue'
export default {
@@ -465,6 +465,7 @@
selectedVehicleId: null,
selectedOrganization: '',
selectedOrganizationId: null, // 褰掑睘鏈烘瀯ID锛堥儴闂↖D锛�
+ selectedOrganizationServiceOrderClass: '', // 褰掑睘鏈烘瀯鐨勬湇鍔″崟缂栫爜
selectedRegion: '', // 浠庡綊灞炴満鏋勪腑鎻愬彇鐨勫湴鍩熶俊鎭紙濡傦細骞垮窞銆佹繁鍦崇瓑锛�
selectedEmergencyTaskType: '', // 閫変腑鐨勪换鍔$被鍨嬫枃鏈�
selectedEmergencyTaskTypeId: null, // 閫変腑鐨勪换鍔$被鍨婭D
@@ -618,17 +619,21 @@
},
getAvailableVehicles() {
- const deptId = this.currentUser.deptId
- return listAvailableVehicles(deptId, 'EMERGENCY').then(response => {
- const vehicleList = response.data || response.rows || []
+ // 鏍规嵁鐢ㄦ埛鏈夋潈闄愮鐞嗙殑鍒嗗叕鍙革紝鏌ヨ鎵�鏈夊彲鐢ㄨ溅杈�
+ return listAvailableVehicles(null, 'EMERGENCY').then(response => {
+ const vehicleList = response.data || []
this.vehicleOptions = vehicleList.map(vehicle => ({
id: vehicle.vehicleId,
name: vehicle.vehicleNo,
type: vehicle.vehicleType,
- status: vehicle.status
+ status: vehicle.status,
+ deptNames: vehicle.deptNames || [] // 杞﹁締褰掑睘鐨勫涓垎鍏徃
}))
+ // 鍙樉绀鸿溅鐗屽彿锛屼笉鏄剧ず鍒嗗叕鍙�
this.vehicles = this.vehicleOptions.map(v => v.name)
- }).catch(() => {
+ console.log('鍔犺浇鍙敤杞﹁締鏁伴噺:', this.vehicles.length)
+ }).catch(error => {
+ console.error('鍔犺浇杞﹁締鍒楄〃澶辫触:', error)
this.vehicles = []
})
},
@@ -644,8 +649,9 @@
const selected = this.organizationOptions[index]
this.selectedOrganization = selected.deptName
this.selectedOrganizationId = selected.deptId // 淇濆瓨閮ㄩ棬ID
- // 浠庡綊灞炴満鏋勪腑鎻愬彇鍦板煙鍏抽敭璇嶏紙鍘婚櫎"鍒嗗叕鍙�"鍚庣紑锛�
- // 渚嬪锛�"骞垮窞鍒嗗叕鍙�" -> "骞垮窞"
+ this.selectedOrganizationServiceOrderClass = selected.serviceOrderClass || '' // 淇濆瓨鏈嶅姟鍗曠紪鐮�
+ // 浠庡綊灞炴満鏋勪腑鎻愬彇鍦板煙鍏抽敭璇嶏紙鍘婚櫎鈥滃垎鍏徃鈥濆悗缂�锛�
+ // 渚嬪锛氣�滃箍宸炲垎鍏徃鈥� -> 鈥滃箍宸炩��
this.selectedRegion = selected.deptName.replace(/鍒嗗叕鍙�$/g, '').trim()
// 閲嶆柊鍔犺浇鍖婚櫌鍒楄〃锛堝甫鍦板煙杩囨护锛�
this.loadDefaultHospitals()
@@ -668,9 +674,10 @@
if (index !== -1) {
this.selectedOrganization = this.currentUser.branchCompanyName
this.selectedOrganizationId = this.organizationOptions[index].deptId // 淇濆瓨閮ㄩ棬ID
+ this.selectedOrganizationServiceOrderClass = this.organizationOptions[index].serviceOrderClass || '' // 淇濆瓨鏈嶅姟鍗曠紪鐮�
// 鎻愬彇鍦板煙鍏抽敭璇�
this.selectedRegion = this.selectedOrganization.replace(/鍒嗗叕鍙�$/g, '').trim()
- console.log('榛樿閫変腑褰掑睘鏈烘瀯:', this.selectedOrganization, '閮ㄩ棬ID:', this.selectedOrganizationId, '鍦板煙:', this.selectedRegion)
+ console.log('榛樿閫変腑褰掑睘鏈烘瀯:', this.selectedOrganization, '閮ㄩ棬ID:', this.selectedOrganizationId, '鏈嶅姟鍗曠紪鐮�:', this.selectedOrganizationServiceOrderClass, '鍦板煙:', this.selectedRegion)
// 鍔犺浇鍖婚櫌鍒楄〃锛堝甫鍦板煙杩囨护锛�
this.loadDefaultHospitals()
}
@@ -788,8 +795,63 @@
this.taskForm.hospitalIn.departmentId = selected.id // 淇濆瓨绉戝ID
},
- // 鍔犺浇榛樿鍖婚櫌鍒楄〃锛堝墠100鏉★級
+ // 鍔犺浇榛樿鍖婚櫌鍒楄〃锛堝父鐢ㄥ尰闄級
loadDefaultHospitals() {
+ // 妫�鏌ユ槸鍚︽湁鏈嶅姟鍗曠紪鐮�
+ if (!this.selectedOrganizationServiceOrderClass) {
+ console.warn('鏈壘鍒版湇鍔″崟缂栫爜锛屾棤娉曞姞杞藉父鐢ㄥ尰闄�')
+ // 濡傛灉娌℃湁鏈嶅姟鍗曠紪鐮侊紝闄嶇骇涓烘櫘閫氭悳绱紙鎸夊湴鍩熻繃婊わ級
+ this.loadDefaultHospitalsByRegion()
+ return
+ }
+
+ // 杞嚭鍖婚櫌锛氬姞杞藉綋鍓嶅垎鍏徃鐨勫父鐢ㄨ浆鍑哄尰闄�
+ getFrequentOutHospitals(this.selectedOrganizationServiceOrderClass, this.selectedRegion).then(response => {
+ this.hospitalOutResults = response.data || []
+ console.log('鍔犺浇甯哥敤杞嚭鍖婚櫌锛�', this.selectedOrganizationServiceOrderClass, '鍦板煙:', this.selectedRegion, '鏁伴噺:', this.hospitalOutResults.length)
+
+ // 濡傛灉娌℃湁甯哥敤鍖婚櫌锛岄檷绾т负鏅�氭悳绱�
+ if (this.hospitalOutResults.length === 0) {
+ console.log('鏈壘鍒板父鐢ㄨ浆鍑哄尰闄紝闄嶇骇涓哄湴鍩熸悳绱�')
+ searchHospitals('', this.selectedRegion).then(res => {
+ this.hospitalOutResults = res.data || []
+ })
+ }
+ }).catch(error => {
+ console.error('鍔犺浇甯哥敤杞嚭鍖婚櫌澶辫触:', error)
+ // 澶辫触鍚庨檷绾т负鏅�氭悳绱�
+ searchHospitals('', this.selectedRegion).then(res => {
+ this.hospitalOutResults = res.data || []
+ })
+ })
+
+ // 杞叆鍖婚櫌锛氬姞杞藉綋鍓嶅垎鍏徃鐨勫父鐢ㄨ浆鍏ュ尰闄紙鏈湴鍖哄煙浼樺厛锛�
+ getFrequentInHospitals(this.selectedOrganizationServiceOrderClass, '').then(response => {
+ const allHospitals = response.data || []
+ // 灏嗗尰闄㈡寜鍦板煙鎺掑簭锛氭湰鍦板尯鍩熶紭鍏�
+ this.hospitalInResults = this.sortHospitalsByRegion(allHospitals)
+ console.log('鍔犺浇甯哥敤杞叆鍖婚櫌锛�', this.selectedOrganizationServiceOrderClass, '鏁伴噺:', this.hospitalInResults.length)
+
+ // 濡傛灉娌℃湁甯哥敤鍖婚櫌锛岄檷绾т负鏅�氭悳绱�
+ if (this.hospitalInResults.length === 0) {
+ console.log('鏈壘鍒板父鐢ㄨ浆鍏ュ尰闄紝闄嶇骇涓哄叏閮ㄥ尰闄�')
+ searchHospitals('', '').then(res => {
+ const allHospitals = res.data || []
+ this.hospitalInResults = this.sortHospitalsByRegion(allHospitals)
+ })
+ }
+ }).catch(error => {
+ console.error('鍔犺浇甯哥敤杞叆鍖婚櫌澶辫触:', error)
+ // 澶辫触鍚庨檷绾т负鏅�氭悳绱�
+ searchHospitals('', '').then(res => {
+ const allHospitals = res.data || []
+ this.hospitalInResults = this.sortHospitalsByRegion(allHospitals)
+ })
+ })
+ },
+
+ // 闄嶇骇鍔犺浇鍖婚櫌锛堟寜鍦板煙杩囨护锛�
+ loadDefaultHospitalsByRegion() {
// 杞嚭鍖婚櫌锛氬彧鍔犺浇褰撳墠鍖哄煙鐨勫尰闄紙甯﹀湴鍩熻繃婊わ級
searchHospitals('', this.selectedRegion).then(response => {
this.hospitalOutResults = response.data || []
@@ -800,7 +862,7 @@
})
// 杞叆鍖婚櫌锛氬姞杞芥墍鏈夊尰闄紙涓嶅甫鍦板煙杩囨护锛屽悗缁細鎸夊湴鍩熸帓搴忥級
- searchHospitals('', this.selectedRegion).then(response => {
+ searchHospitals('', '').then(response => {
const allHospitals = response.data || []
// 灏嗗尰闄㈡寜鍦板煙鎺掑簭锛氭湰鍦板尯鍩熶紭鍏�
this.hospitalInResults = this.sortHospitalsByRegion(allHospitals)
@@ -841,14 +903,39 @@
// 杞嚭鍖婚櫌杈撳叆妗嗚幏寰楃劍鐐�
onHospitalOutFocus() {
- // 濡傛灉娌℃湁鎼滅储鍏抽敭璇嶏紝鍙樉绀哄綋鍓嶅尯鍩熺殑鍖婚櫌
+ // 濡傛灉娌℃湁鎼滅储鍏抽敭璇嶏紝鏄剧ず甯哥敤杞嚭鍖婚櫌
if (!this.hospitalOutSearchKeyword || this.hospitalOutSearchKeyword.trim() === '') {
- searchHospitals('', this.selectedRegion).then(response => {
- this.hospitalOutResults = response.data || []
- }).catch(error => {
- console.error('鍔犺浇杞嚭鍖婚櫌澶辫触:', error)
- this.hospitalOutResults = []
- })
+ // 濡傛灉宸茬粡鍔犺浇杩囧父鐢ㄥ尰闄紝鐩存帴鏄剧ず
+ if (this.hospitalOutResults.length > 0) {
+ this.showHospitalOutResults = true
+ return
+ }
+
+ // 鍚﹀垯閲嶆柊鍔犺浇甯哥敤鍖婚櫌
+ if (this.selectedOrganizationServiceOrderClass) {
+ getFrequentOutHospitals(this.selectedOrganizationServiceOrderClass, this.selectedRegion).then(response => {
+ this.hospitalOutResults = response.data || []
+ // 濡傛灉娌℃湁甯哥敤鍖婚櫌锛岄檷绾т负鏅�氭悳绱�
+ if (this.hospitalOutResults.length === 0) {
+ searchHospitals('', this.selectedRegion).then(res => {
+ this.hospitalOutResults = res.data || []
+ })
+ }
+ }).catch(error => {
+ console.error('鍔犺浇甯哥敤杞嚭鍖婚櫌澶辫触:', error)
+ searchHospitals('', this.selectedRegion).then(res => {
+ this.hospitalOutResults = res.data || []
+ })
+ })
+ } else {
+ // 娌℃湁鏈嶅姟鍗曠紪鐮侊紝浣跨敤鏅�氭悳绱�
+ searchHospitals('', this.selectedRegion).then(response => {
+ this.hospitalOutResults = response.data || []
+ }).catch(error => {
+ console.error('鍔犺浇杞嚭鍖婚櫌澶辫触:', error)
+ this.hospitalOutResults = []
+ })
+ }
}
this.showHospitalOutResults = true
},
@@ -916,16 +1003,45 @@
// 杞叆鍖婚櫌杈撳叆妗嗚幏寰楃劍鐐�
onHospitalInFocus() {
- // 濡傛灉娌℃湁鎼滅储鍏抽敭璇嶏紝鏄剧ず鎵�鏈夊尰闄紙鏈湴鍖哄煙浼樺厛锛�
+ // 濡傛灉娌℃湁鎼滅储鍏抽敭璇嶏紝鏄剧ず甯哥敤杞叆鍖婚櫌
if (!this.hospitalInSearchKeyword || this.hospitalInSearchKeyword.trim() === '') {
- searchHospitals('', '').then(response => {
- const allHospitals = response.data || []
- // 鎸夊湴鍩熸帓搴忥細鏈湴鍖哄煙浼樺厛
- this.hospitalInResults = this.sortHospitalsByRegion(allHospitals)
- }).catch(error => {
- console.error('鍔犺浇杞叆鍖婚櫌澶辫触:', error)
- this.hospitalInResults = []
- })
+ // 濡傛灉宸茬粡鍔犺浇杩囧父鐢ㄥ尰闄紝鐩存帴鏄剧ず
+ if (this.hospitalInResults.length > 0) {
+ this.showHospitalInResults = true
+ return
+ }
+
+ // 鍚﹀垯閲嶆柊鍔犺浇甯哥敤鍖婚櫌
+ if (this.selectedOrganizationServiceOrderClass) {
+ getFrequentInHospitals(this.selectedOrganizationServiceOrderClass, '').then(response => {
+ const allHospitals = response.data || []
+ // 鎸夊湴鍩熸帓搴忥細鏈湴鍖哄煙浼樺厛
+ this.hospitalInResults = this.sortHospitalsByRegion(allHospitals)
+ // 濡傛灉娌℃湁甯哥敤鍖婚櫌锛岄檷绾т负鏅�氭悳绱�
+ if (this.hospitalInResults.length === 0) {
+ searchHospitals('', '').then(res => {
+ const allHospitals = res.data || []
+ this.hospitalInResults = this.sortHospitalsByRegion(allHospitals)
+ })
+ }
+ }).catch(error => {
+ console.error('鍔犺浇甯哥敤杞叆鍖婚櫌澶辫触:', error)
+ searchHospitals('', '').then(res => {
+ const allHospitals = res.data || []
+ this.hospitalInResults = this.sortHospitalsByRegion(allHospitals)
+ })
+ })
+ } else {
+ // 娌℃湁鏈嶅姟鍗曠紪鐮侊紝浣跨敤鏅�氭悳绱�
+ searchHospitals('', '').then(response => {
+ const allHospitals = response.data || []
+ // 鎸夊湴鍩熸帓搴忥細鏈湴鍖哄煙浼樺厛
+ this.hospitalInResults = this.sortHospitalsByRegion(allHospitals)
+ }).catch(error => {
+ console.error('鍔犺浇杞叆鍖婚櫌澶辫触:', error)
+ this.hospitalInResults = []
+ })
+ }
}
this.showHospitalInResults = true
},
@@ -1290,6 +1406,11 @@
return false
}
+ if (!this.selectedOrganizationId) {
+ this.$modal.showToast('璇烽�夋嫨褰掑睘鏈烘瀯')
+ return false
+ }
+
if (!this.selectedEmergencyTaskType) {
this.$modal.showToast('璇烽�夋嫨浠诲姟绫诲瀷')
return false
@@ -1337,6 +1458,16 @@
if (!this.taskForm.hospitalIn.department) {
this.$modal.showToast('璇烽�夋嫨杞叆鍖婚櫌绉戝')
+ return false
+ }
+
+ if (!this.taskForm.transferDistance) {
+ this.$modal.showToast('璇疯緭鍏ヨ浆杩愬叕閲屾暟')
+ return false
+ }
+
+ if (!this.taskForm.price) {
+ this.$modal.showToast('璇疯緭鍏ユ垚浜や环')
return false
}
@@ -1498,7 +1629,7 @@
this.taskForm.transferDistance = distanceInKm
console.log('璺濈璁$畻鎴愬姛:', distanceInKm, 'km')
- this.$modal.showToast(`璺濈璁$畻鎴愬姛: ${distanceInKm}鍏噷`)
+ // this.$modal.showToast(`璺濈璁$畻鎴愬姛: ${distanceInKm}鍏噷`)
} else {
console.error('璺濈璁$畻澶辫触:', response.msg)
this.$modal.showToast('璺濈璁$畻澶辫触锛岃鎵嬪姩杈撳叆')
--
Gitblit v1.9.1