From 668e570bd1db6bd00e4293b6977e6d3d051053ce Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期四, 27 十一月 2025 00:07:46 +0800
Subject: [PATCH] feat: 修改app录入界面及车辆用户同步
---
app/pages/task/create-emergency.vue | 1317 +++++++++--------------------------------------------------
1 files changed, 208 insertions(+), 1,109 deletions(-)
diff --git a/app/pages/task/create-emergency.vue b/app/pages/task/create-emergency.vue
index 6cd7631..2a6c730 100644
--- a/app/pages/task/create-emergency.vue
+++ b/app/pages/task/create-emergency.vue
@@ -22,14 +22,23 @@
</picker>
</view>
<view class="form-item">
- <view class="form-label required">褰掑睘鏈烘瀯</view>
- <picker mode="selector" :range="organizations" @change="onOrganizationChange">
- <view class="form-input picker-input">
- {{ selectedOrganization || '璇烽�夋嫨褰掑睘鏈烘瀯' }}
- <uni-icons type="arrowright" size="16" color="#999"></uni-icons>
- </view>
- </picker>
+ <OrganizationSelector
+ v-model="selectedOrganizationId"
+ :required="true"
+ :auto-select-user-dept="true"
+ @change="onOrganizationChange"
+ />
</view>
+
+ <DepartureSelector
+ :address.sync="departureAddress"
+ :longitude.sync="departureLongitude"
+ :latitude.sync="departureLatitude"
+ :region="selectedRegion"
+ :required="false"
+ @address-selected="onDepartureAddressSelected"
+ @location-success="onDepartureLocationSuccess"
+ />
<view class="form-item">
<view class="form-label required">浠诲姟绫诲瀷</view>
@@ -144,200 +153,38 @@
/>
</view>
- <view class="form-item">
- <view class="form-label">鐥呮儏</view>
- <view class="disease-container">
- <view class="disease-tags" v-if="selectedDiseases.length > 0">
- <view
- class="disease-tag"
- v-for="(disease, index) in selectedDiseases"
- :key="index"
- >
- <text class="disease-name">{{ disease.icdName }}</text>
- <uni-icons
- type="closeempty"
- size="16"
- color="#fff"
- @click="removeDisease(index)"
- ></uni-icons>
- </view>
- </view>
- <view class="add-disease-btn" @click="showDiseaseSelector">
- <uni-icons type="plusempty" size="20" color="#007AFF"></uni-icons>
- <text>娣诲姞鐥呮儏</text>
- </view>
- <textarea
- class="form-textarea"
- placeholder="鍏朵粬鐥呮儏鎻忚堪锛堥�夊~锛�"
- v-model="taskForm.patient.condition"
- style="margin-top: 20rpx;"
- />
- </view>
- </view>
+ <DiseaseSelector
+ v-model="selectedDiseases"
+ :other-description.sync="taskForm.patient.condition"
+ />
<view class="form-section-title">杞嚭鍖婚櫌淇℃伅</view>
- <view class="form-item">
- <view class="form-label required">鍖婚櫌鍚嶇О</view>
- <view class="hospital-search-container">
- <input
- class="form-input"
- placeholder="璇疯緭鍏ュ尰闄㈠悕绉版垨鍦板潃鎼滅储"
- v-model="hospitalOutSearchKeyword"
- @input="onHospitalOutSearch"
- @focus="onHospitalOutFocus"
- />
- <view class="search-results" v-if="showHospitalOutResults && hospitalOutResults.length > 0">
- <view
- class="search-result-item"
- v-for="hospital in hospitalOutResults"
- :key="hospital.hospId"
- @click="selectHospitalOut(hospital)"
- >
- <view class="hospital-name">
- {{ hospital.hospName }}
- <text class="hospital-short" v-if="hospital.hospShort">{{ hospital.hospShort }}</text>
- </view>
- <view class="hospital-address">{{ buildFullAddress(hospital) }}</view>
- </view>
- </view>
- </view>
- </view>
-
- <view class="form-item">
- <view class="form-label required">绉戝</view>
- <picker
- v-if="taskForm.hospitalOut.name !== '瀹朵腑'"
- mode="selector"
- :range="departmentOptions"
- range-key="text"
- @change="onHospitalOutDepartmentChange"
- >
- <view class="form-input picker-input">
- {{ taskForm.hospitalOut.department || '璇烽�夋嫨绉戝' }}
- <uni-icons type="arrowright" size="16" color="#999"></uni-icons>
- </view>
- </picker>
- <view v-else class="form-input picker-input disabled">
- 鍏跺畠
- </view>
- </view>
-
- <view class="form-item">
- <view class="form-label">搴婂彿</view>
- <input
- class="form-input"
- placeholder="璇疯緭鍏ュ簥鍙�"
- v-model="taskForm.hospitalOut.bedNumber"
- />
- </view>
-
- <view class="form-item">
- <view class="form-label">杞嚭鍦板潃</view>
- <view class="address-input-container" v-if="taskForm.hospitalOut.name === '瀹朵腑'">
- <input
- class="form-input"
- placeholder="璇疯緭鍏ヨ缁嗗湴鍧�"
- v-model="taskForm.hospitalOut.address"
- @input="onAddressOutInput"
- @focus="onAddressOutFocus"
- />
- <view class="address-suggestions" v-if="showAddressOutSuggestions && addressOutSuggestions.length > 0">
- <view
- class="address-suggestion-item"
- v-for="(item, index) in addressOutSuggestions"
- :key="index"
- @click="selectAddressOut(item)">
- <view class="suggestion-name">{{ item.name }}</view>
- <view class="suggestion-address">{{ item.district }}{{ item.address }}</view>
- </view>
- </view>
- </view>
- <view v-else class="form-input picker-input disabled">
- {{ taskForm.hospitalOut.address || '閫夋嫨鍖婚櫌鍚庤嚜鍔ㄥ~鍏�' }}
- </view>
- </view>
+ <HospitalSelector
+ label="鍖婚櫌鍚嶇О"
+ address-label="杞嚭鍦板潃"
+ :required="true"
+ :department-required="true"
+ v-model="taskForm.hospitalOut"
+ :dept-id="selectedOrganizationId"
+ :region="selectedRegion"
+ :department-options="departmentOptions"
+ @change="onHospitalOutChange"
+ @address-selected="onHospitalOutAddressSelected"
+ />
<view class="form-section-title">杞叆鍖婚櫌淇℃伅</view>
- <view class="form-item">
- <view class="form-label required">鍖婚櫌鍚嶇О</view>
- <view class="hospital-search-container">
- <input
- class="form-input"
- placeholder="璇疯緭鍏ュ尰闄㈠悕绉版垨鍦板潃鎼滅储"
- v-model="hospitalInSearchKeyword"
- @input="onHospitalInSearch"
- @focus="onHospitalInFocus"
- />
- <view class="search-results" v-if="showHospitalInResults && hospitalInResults.length > 0">
- <view
- class="search-result-item"
- v-for="hospital in hospitalInResults"
- :key="hospital.hospId"
- @click="selectHospitalIn(hospital)"
- >
- <view class="hospital-name">
- {{ hospital.hospName }}
- <text class="hospital-short" v-if="hospital.hospShort">{{ hospital.hospShort }}</text>
- </view>
- <view class="hospital-address">{{ buildFullAddress(hospital) }}</view>
- </view>
- </view>
- </view>
- </view>
-
- <view class="form-item">
- <view class="form-label required">绉戝</view>
- <picker
- v-if="taskForm.hospitalIn.name !== '瀹朵腑'"
- mode="selector"
- :range="departmentOptions"
- range-key="text"
- @change="onHospitalInDepartmentChange"
- >
- <view class="form-input picker-input">
- {{ taskForm.hospitalIn.department || '璇烽�夋嫨绉戝' }}
- <uni-icons type="arrowright" size="16" color="#999"></uni-icons>
- </view>
- </picker>
- <view v-else class="form-input picker-input disabled">
- 鍏跺畠
- </view>
- </view>
-
- <view class="form-item">
- <view class="form-label">搴婂彿</view>
- <input
- class="form-input"
- placeholder="璇疯緭鍏ュ簥鍙�"
- v-model="taskForm.hospitalIn.bedNumber"
- />
- </view>
-
- <view class="form-item">
- <view class="form-label">杞叆鍦板潃</view>
- <view class="address-input-container" v-if="taskForm.hospitalIn.name === '瀹朵腑'">
- <input
- class="form-input"
- placeholder="璇疯緭鍏ヨ缁嗗湴鍧�"
- v-model="taskForm.hospitalIn.address"
- @input="onAddressInInput"
- @focus="onAddressInFocus"
- />
- <view class="address-suggestions" v-if="showAddressInSuggestions && addressInSuggestions.length > 0">
- <view
- class="address-suggestion-item"
- v-for="(item, index) in addressInSuggestions"
- :key="index"
- @click="selectAddressIn(item)">
- <view class="suggestion-name">{{ item.name }}</view>
- <view class="suggestion-address">{{ item.district }}{{ item.address }}</view>
- </view>
- </view>
- </view>
- <view v-else class="form-input picker-input disabled">
- {{ taskForm.hospitalIn.address || '閫夋嫨鍖婚櫌鍚庤嚜鍔ㄥ~鍏�' }}
- </view>
- </view>
+ <HospitalSelector
+ label="鍖婚櫌鍚嶇О"
+ address-label="杞叆鍦板潃"
+ :required="true"
+ :department-required="true"
+ v-model="taskForm.hospitalIn"
+ :dept-id="selectedOrganizationId"
+ :region="selectedRegion"
+ :department-options="departmentOptions"
+ @change="onHospitalInChange"
+ @address-selected="onHospitalInAddressSelected"
+ />
<view class="form-item">
<view class="form-label required">杞繍鍏噷鏁�</view>
@@ -475,64 +322,6 @@
</view>
</view>
</uni-popup>
-
- <!-- 鐥呮儏閫夋嫨寮圭獥 -->
- <uni-popup ref="diseasePopup" type="bottom" :safe-area="true">
- <view class="disease-selector-popup">
- <view class="popup-header">
- <view class="popup-title">閫夋嫨鐥呮儏锛圛CD-10锛�</view>
- <view class="popup-close" @click="closeDiseaseSelector">
- <uni-icons type="closeempty" size="24" color="#333"></uni-icons>
- </view>
- </view>
-
- <view class="search-box">
- <uni-icons type="search" size="18" color="#999"></uni-icons>
- <input
- class="search-input"
- placeholder="鎼滅储鐤剧梾鍚嶇О銆佺紪鐮佹垨鍔╄鐮�"
- v-model="diseaseSearchKeyword"
- @input="onDiseaseSearch"
- />
- </view>
-
- <scroll-view class="disease-list-popup" scroll-y="true">
- <view
- class="disease-item-popup"
- v-for="disease in diseaseSearchResults"
- :key="disease.id"
- @click="toggleDiseaseSelection(disease)"
- >
- <view class="disease-info">
- <view class="disease-name-row">
- <text class="disease-name">{{ disease.icdName }}</text>
- <text class="disease-code">[{{ disease.icdCode }}]</text>
- </view>
- <view class="disease-detail-row" v-if="disease.sm">
- <text class="disease-desc">{{ disease.sm }}</text>
- </view>
- </view>
- <uni-icons
- v-if="isDiseaseSelected(disease.id)"
- type="checkmarkempty"
- size="24"
- color="#007AFF"
- ></uni-icons>
- <view v-else class="checkbox-empty"></view>
- </view>
-
- <view class="no-data" v-if="diseaseSearchResults.length === 0">
- <uni-icons type="info" size="40" color="#ccc"></uni-icons>
- <text>{{ diseaseSearchKeyword ? '鏈壘鍒扮浉鍏崇柧鐥�' : '鏆傛棤鐥呮儏鏁版嵁' }}</text>
- </view>
- </scroll-view>
-
- <view class="popup-footer">
- <button class="cancel-btn" @click="closeDiseaseSelector">鍙栨秷</button>
- <button class="confirm-btn" @click="confirmDiseaseSelection">纭畾(宸查�墈{ tempSelectedDiseases.length }})</button>
- </view>
- </view>
- </uni-popup>
</scroll-view>
</template>
@@ -542,8 +331,9 @@
import uniPopup from '@/uni_modules/uni-popup/components/uni-popup/uni-popup.vue'
import { addTask } from "@/api/task"
import { listAvailableVehicles, getUserBoundVehicle } from "@/api/vehicle"
+import { searchHospitals, searchHospitalsByDeptRegion } from "@/api/hospital"
+import DepartureSelector from '@/components/DepartureSelector.vue'
import { calculateDistance, baiduDistanceByAddress, baiduPlaceSuggestion } from "@/api/map"
-import { searchHospitals, getFrequentOutHospitals, getFrequentInHospitals, searchHospitalsByDeptRegion } from "@/api/hospital"
import { listBranchUsers } from "@/api/system/user"
import { searchIcd10 } from "@/api/icd10"
import { calculateTransferPrice } from "@/api/price"
@@ -553,41 +343,35 @@
import { getServiceOrdAreaTypes, getServiceOrderTypes, getHospitalDepartments } from "@/api/dictionary"
import { listBranchCompany, getDept } from "@/api/system/dept"
import MapSelector from '@/components/map-selector.vue'
+import OrganizationSelector from '@/components/OrganizationSelector.vue'
+import HospitalSelector from '@/components/HospitalSelector.vue'
+import DiseaseSelector from '@/components/DiseaseSelector.vue'
export default {
components: {
uniDatetimePicker,
uniPopup,
- MapSelector
+ MapSelector,
+ OrganizationSelector,
+ HospitalSelector,
+ DiseaseSelector,
+ DepartureSelector
},
data() {
return {
selectedVehicle: '',
selectedVehicleId: null,
- selectedOrganization: '',
selectedOrganizationId: null, // 褰掑睘鏈烘瀯ID锛堥儴闂↖D锛�
selectedOrganizationServiceOrderClass: '', // 褰掑睘鏈烘瀯鐨勬湇鍔″崟缂栫爜
selectedRegion: '', // 浠庡綊灞炴満鏋勪腑鎻愬彇鐨勫湴鍩熶俊鎭紙濡傦細骞垮窞銆佹繁鍦崇瓑锛�
+ departureAddress: '', // 鍑哄彂鍦板湴鍧�
+ departureLongitude: null, // 鍑哄彂鍦扮粡搴�
+ departureLatitude: null, // 鍑哄彂鍦扮含搴�
selectedEmergencyTaskType: '', // 閫変腑鐨勪换鍔$被鍨嬫枃鏈�
selectedEmergencyTaskTypeId: null, // 閫変腑鐨勪换鍔$被鍨婭D
selectedDocumentType: '', // 閫変腑鐨勫崟鎹被鍨嬫枃鏈�
selectedDocumentTypeId: null, // 閫変腑鐨勫崟鎹被鍨婭D
mapSelectorType: '',
- // 鍖婚櫌鎼滅储鐩稿叧
- hospitalOutSearchKeyword: '',
- hospitalOutResults: [],
- showHospitalOutResults: false,
- hospitalInSearchKeyword: '',
- hospitalInResults: [],
- showHospitalInResults: false,
- searchTimer: null,
- defaultHospitals: [], // 榛樿鐨�100鏉″尰闄㈡暟鎹�
- // 鍦板潃鎼滅储鎻愮ず鐩稿叧
- addressOutSuggestions: [], // 杞嚭鍦板潃鎻愮ず鍒楄〃
- showAddressOutSuggestions: false,
- addressInSuggestions: [], // 杞叆鍦板潃鎻愮ず鍒楄〃
- showAddressInSuggestions: false,
- addressSearchTimer: null, // 鍦板潃鎼滅储闃叉姈瀹氭椂鍣�
// 浜哄憳閫夋嫨鐩稿叧
selectedStaff: [], // 宸查�夋嫨鐨勪汉鍛樺垪琛�
allStaffList: [], // 鎵�鏈変汉鍛樺垪琛�
@@ -596,10 +380,6 @@
staffFilterType: 'driver', // 浜哄憳绛涢�夌被鍨嬶細driver/doctor/nurse锛岄粯璁ら�変腑鍙告満
// 鐥呮儏閫夋嫨鐩稿叧
selectedDiseases: [], // 宸查�夋嫨鐨勭梾鎯呭垪琛�
- tempSelectedDiseases: [], // 涓存椂閫夋嫨鐨勭梾鎯呭垪琛紙鐢ㄤ簬寮圭獥锛�
- diseaseSearchKeyword: '', // 鐥呮儏鎼滅储鍏抽敭璇�
- diseaseSearchResults: [], // 鐥呮儏鎼滅储缁撴灉
- diseaseSearchTimer: null, // 鐥呮儏鎼滅储闃叉姈瀹氭椂鍣�
taskForm: {
transferTime: '',
patient: {
@@ -631,18 +411,13 @@
},
vehicles: [],
vehicleOptions: [],
- organizations: [], // 褰掑睘鏈烘瀯鍒楄〃锛堜粠鍚庡彴鍔犺浇鍒嗗叕鍙告暟鎹級
- organizationOptions: [], // 褰掑睘鏈烘瀯閫夐」锛堢敤浜巔icker鏄剧ず锛�
+
emergencyTaskTypes: [], // 浠诲姟绫诲瀷鍒楄〃锛堜粠 SQL Server 鍔ㄦ�佸姞杞斤級
emergencyTaskTypeOptions: [], // 浠诲姟绫诲瀷閫夐」锛堢敤浜巔icker鏄剧ず锛�
documentTypes: [], // 鍗曟嵁绫诲瀷鍒楄〃
documentTypeOptions: [], // 鍗曟嵁绫诲瀷閫夐」锛堢敤浜巔icker鏄剧ず锛�
departmentOptions: [], // 绉戝瀛楀吀鏁版嵁
loading: false,
- addressCoordinates: {
- hospitalOutAddress: null,
- hospitalInAddress: null
- },
// 鏅鸿兘璇嗗埆鐩稿叧
rawText: '',
parseLoading: false
@@ -680,8 +455,6 @@
})
this.initSelectedStaff()
this.loadDeptStaff()
- // 鍔犺浇鍒嗗叕鍙告暟鎹紙浼氳嚜鍔ㄨ缃粯璁ゅ垎鍏徃骞跺姞杞藉尰闄㈠垪琛級
- this.loadBranchCompanies()
// 鍔犺浇绉戝瀛楀吀鏁版嵁
this.loadDepartments()
// 鍔犺浇浠诲姟绫诲瀷鏁版嵁
@@ -754,53 +527,25 @@
this.selectedVehicleId = this.vehicleOptions[index]?.id
},
- onOrganizationChange(e) {
- const index = e.detail.value
- const selected = this.organizationOptions[index]
- this.selectedOrganization = selected.deptName
- this.selectedOrganizationId = selected.deptId // 淇濆瓨閮ㄩ棬ID
- this.selectedOrganizationServiceOrderClass = selected.serviceOrderClass || '' // 淇濆瓨鏈嶅姟鍗曠紪鐮�
- // 浠庡綊灞炴満鏋勪腑鎻愬彇鍦板煙鍏抽敭璇嶏紙鍘婚櫎鈥滃垎鍏徃鈥濆悗缂�锛�
- // 渚嬪锛氣�滃箍宸炲垎鍏徃鈥� -> 鈥滃箍宸炩��
- //濡傛灉鍑虹幇骞垮窞鎬诲叕鍙革紝涔熻鍘婚櫎鈥滄�诲叕鍙糕�濆悗缂�
- this.selectedRegion = this.replaceRegion(selected.deptName);
- // 閲嶆柊鍔犺浇鍖婚櫌鍒楄〃锛堝甫鍦板煙杩囨护锛�
- this.loadDefaultHospitals()
+ onOrganizationChange(orgData) {
+ // orgData 鍖呭惈锛歞eptId, deptName, serviceOrderClass, region, departureAddress, departureLongitude, departureLatitude
+ this.selectedOrganizationId = orgData.deptId
+ this.selectedOrganizationServiceOrderClass = orgData.serviceOrderClass
+ this.selectedRegion = orgData.region
+
+ // 鑷姩濉厖鍑哄彂鍦颁俊鎭紙鏈烘瀯鐨勫湴鍧�鍜屽潗鏍囷級
+ if (orgData.departureAddress) {
+ this.departureAddress = orgData.departureAddress
+ this.departureLongitude = orgData.departureLongitude || null
+ this.departureLatitude = orgData.departureLatitude || null
+ console.log('鑷姩濉厖鏈烘瀯鍑哄彂鍦�:', this.departureAddress, '鍧愭爣:', this.departureLongitude, this.departureLatitude)
+ }
+
+ console.log('閫変腑褰掑睘鏈烘瀯:', orgData.deptName, '閮ㄩ棬ID:', orgData.deptId, '鏈嶅姟鍗曠紪鐮�:', orgData.serviceOrderClass, '鍦板煙:', orgData.region)
},
replaceRegion(region){
return region.replace(/(鍒嗗叕鍙竱鎬诲叕鍙竱鎬婚儴)$/g, '').trim();
},
- // 鍔犺浇鍒嗗叕鍙告暟鎹紙parent_id=100鐨勯儴闂級
- loadBranchCompanies() {
- listBranchCompany().then(response => {
- const list = response.data || []
- // 杩囨护鍑� parent_id = 100 鐨勯儴闂紙鍒嗗叕鍙革級
- this.organizationOptions = list.filter(dept => dept.parentId === 100)
- // 鐢熸垚picker鐨勬暟鎹簮锛堝彧鏄剧ず鍚嶇О锛�
- this.organizations = this.organizationOptions.map(dept => dept.deptName)
-
- // 榛樿璁剧疆涓哄綋鍓嶇敤鎴风殑鍒嗗叕鍙�
- if (this.currentUser.branchCompanyName) {
- const index = this.organizationOptions.findIndex(
- dept => dept.deptName === this.currentUser.branchCompanyName
- )
- if (index !== -1) {
- this.selectedOrganization = this.currentUser.branchCompanyName
- this.selectedOrganizationId = this.organizationOptions[index].deptId // 淇濆瓨閮ㄩ棬ID
- this.selectedOrganizationServiceOrderClass = this.organizationOptions[index].serviceOrderClass || '' // 淇濆瓨鏈嶅姟鍗曠紪鐮�
- // 鎻愬彇鍦板煙鍏抽敭璇�
- this.selectedRegion =this.replaceRegion(this.selectedOrganization);
- console.log('榛樿閫変腑褰掑睘鏈烘瀯:', this.selectedOrganization, '閮ㄩ棬ID:', this.selectedOrganizationId, '鏈嶅姟鍗曠紪鐮�:', this.selectedOrganizationServiceOrderClass, '鍦板煙:', this.selectedRegion)
- // 鍔犺浇鍖婚櫌鍒楄〃锛堝甫鍦板煙杩囨护锛�
- this.loadDefaultHospitals()
- }
- }
- }).catch(error => {
- console.error('鍔犺浇鍒嗗叕鍙告暟鎹け璐�:', error)
- this.organizationOptions = []
- this.organizations = []
- })
- },
// 鍔犺浇绉戝鏁版嵁锛堜粠 SQL Server 鍔ㄦ�佸姞杞斤級
loadDepartments() {
@@ -892,243 +637,15 @@
this.selectedDocumentTypeId = selected.id
},
- // 杞嚭鍖婚櫌绉戝閫夋嫨
- onHospitalOutDepartmentChange(e) {
- const index = e.detail.value
- const selected = this.departmentOptions[index]
- this.taskForm.hospitalOut.department = selected.text // 淇濆瓨绉戝鍚嶇О
- this.taskForm.hospitalOut.departmentId = selected.id // 淇濆瓨绉戝ID
- },
-
- // 杞叆鍖婚櫌绉戝閫夋嫨
- onHospitalInDepartmentChange(e) {
- const index = e.detail.value
- const selected = this.departmentOptions[index]
- this.taskForm.hospitalIn.department = selected.text // 淇濆瓨绉戝鍚嶇О
- this.taskForm.hospitalIn.departmentId = selected.id // 淇濆瓨绉戝ID
- },
-
- // 鍔犺浇榛樿鍖婚櫌鍒楄〃锛堝父鐢ㄥ尰闄級
- loadDefaultHospitals() {
- // 妫�鏌ユ槸鍚︽湁褰掑睘鏈烘瀯ID
- if (!this.selectedOrganizationId) {
- console.warn('鏈�夋嫨褰掑睘鏈烘瀯锛屾棤娉曞姞杞藉尰闄㈠垪琛�')
- return
- }
-
- // 杞嚭鍖婚櫌锛氭牴鎹綊灞炴満鏋勭殑鍖哄煙閰嶇疆鍔犺浇
- this.loadHospitalsByDeptRegion('out')
-
- // 杞叆鍖婚櫌锛氭牴鎹綊灞炴満鏋勭殑鍖哄煙閰嶇疆鍔犺浇
- this.loadHospitalsByDeptRegion('in')
- },
-
- // 闄嶇骇鍔犺浇鍖婚櫌锛堟寜鍦板煙杩囨护锛�
- loadDefaultHospitalsByRegion() {
- // 杞嚭鍖婚櫌锛氬彧鍔犺浇褰撳墠鍖哄煙鐨勫尰闄紙甯﹀湴鍩熻繃婊わ級
- searchHospitals('', this.selectedRegion).then(response => {
- this.hospitalOutResults = response.data || []
- console.log('鍔犺浇杞嚭鍖婚櫌锛堝綋鍓嶅尯鍩燂級:', this.selectedRegion, '鏁伴噺:', this.hospitalOutResults.length)
- }).catch(error => {
- console.error('鍔犺浇杞嚭鍖婚櫌鍒楄〃澶辫触:', error)
- this.hospitalOutResults = []
- })
-
- // 杞叆鍖婚櫌锛氬姞杞芥墍鏈夊尰闄紙涓嶅甫鍦板煙杩囨护锛屽悗缁細鎸夊湴鍩熸帓搴忥級
- searchHospitals('', '').then(response => {
- const allHospitals = response.data || []
- // 灏嗗尰闄㈡寜鍦板煙鎺掑簭锛氭湰鍦板尯鍩熶紭鍏�
- this.hospitalInResults = this.sortHospitalsByRegion(allHospitals)
- console.log('鍔犺浇杞叆鍖婚櫌锛堝叏閮ㄥ尯鍩燂級:', '鏁伴噺:', this.hospitalInResults.length)
- }).catch(error => {
- console.error('鍔犺浇杞叆鍖婚櫌鍒楄〃澶辫触:', error)
- this.hospitalInResults = []
- })
- },
-
- // 鏍规嵁閮ㄩ棬鍖哄煙閰嶇疆鍔犺浇鍖婚櫌
- loadHospitalsByDeptRegion(type) {
- const deptId = this.selectedOrganizationId
- if (!deptId) {
- console.warn('閮ㄩ棬ID涓嶅瓨鍦�')
- return
- }
-
- // 璋冪敤鍚庣鎺ュ彛锛屾牴鎹儴闂ㄧ殑鍖哄煙閰嶇疆鏌ヨ鍖婚櫌
- searchHospitalsByDeptRegion('', deptId).then(response => {
- const hospitals = response.data || []
-
- if (type === 'out') {
- this.hospitalOutResults = hospitals
- console.log('鍔犺浇杞嚭鍖婚櫌锛堝尯鍩熼厤缃級锛氶儴闂�', deptId, '鏁伴噺:', this.hospitalOutResults.length)
- } else if (type === 'in') {
- // 杞叆鍖婚櫌鎸夊湴鍩熸帓搴�
- this.hospitalInResults = this.sortHospitalsByRegion(hospitals)
- console.log('鍔犺浇杞叆鍖婚櫌锛堝尯鍩熼厤缃級锛氶儴闂�', deptId, '鏁伴噺:', this.hospitalInResults.length)
- }
- }).catch(error => {
- console.error('鍔犺浇鍖婚櫌澶辫触锛堝尯鍩熼厤缃級:', error)
- // 澶辫触鍚庨檷绾т负鏅�氭悳绱�
- this.loadDefaultHospitalsByRegion()
- })
- },
-
- // 鎸夊湴鍩熸帓搴忓尰闄細鏈湴鍖哄煙浼樺厛锛�"瀹朵腑"濮嬬粓鍦ㄦ渶鍓嶉潰
- sortHospitalsByRegion(hospitals) {
- if (!hospitals || hospitals.length === 0) {
- return hospitals
- }
-
- const region = this.selectedRegion
- const homeHospital = [] // "瀹朵腑"
- const localHospitals = [] // 鏈湴鍖婚櫌
- const otherHospitals = [] // 鍏朵粬鍖婚櫌
-
- hospitals.forEach(hospital => {
- // "瀹朵腑"浼樺厛澶勭悊锛屾斁鍦ㄦ渶鍓嶉潰
- if (hospital.hospName === '瀹朵腑') {
- homeHospital.push(hospital)
- return
- }
-
- // 鍒ゆ柇鍖婚櫌鏄惁鍦ㄦ湰鍦板尯鍩燂紙鐪併�佸競銆佸尯浠讳竴鍖呭惈鍦板煙鍏抽敭璇嶏級
- const isLocal = region && (
- (hospital.hopsProvince && hospital.hopsProvince.includes(region)) ||
- (hospital.hopsCity && hospital.hopsCity.includes(region)) ||
- (hospital.hopsArea && hospital.hopsArea.includes(region))
- )
-
- if (isLocal) {
- localHospitals.push(hospital)
- } else {
- otherHospitals.push(hospital)
- }
- })
-
- // "瀹朵腑"鍦ㄦ渶鍓嶏紝鏈湴鍖婚櫌鍏舵锛屽叾浠栧尰闄㈠湪鍚�
- return [...homeHospital, ...localHospitals, ...otherHospitals]
- },
-
- // 杞嚭鍖婚櫌杈撳叆妗嗚幏寰楃劍鐐�
- onHospitalOutFocus() {
- // 濡傛灉娌℃湁鎼滅储鍏抽敭璇嶏紝鏄剧ず甯哥敤杞嚭鍖婚櫌
- if (!this.hospitalOutSearchKeyword || this.hospitalOutSearchKeyword.trim() === '') {
- // 濡傛灉宸茬粡鍔犺浇杩囧父鐢ㄥ尰闄紝鐩存帴鏄剧ず
- if (this.hospitalOutResults.length > 0) {
- this.showHospitalOutResults = true
- return
- }
-
- // 鍚﹀垯閲嶆柊鍔犺浇甯哥敤鍖婚櫌
- if (this.selectedOrganizationServiceOrderClass) {
- getFrequentOutHospitals(this.selectedOrganizationServiceOrderClass, this.selectedRegion).then(response => {
- const hospitals = response.data || []
- // 纭繚"瀹朵腑"鍦ㄦ渶鍓嶉潰
- this.hospitalOutResults = this.sortHospitalsByRegion(hospitals)
- // 濡傛灉娌℃湁甯哥敤鍖婚櫌锛岄檷绾т负鏅�氭悳绱�
- if (this.hospitalOutResults.length === 0) {
- searchHospitals('', this.selectedOrganizationId).then(res => {
- const hospitals = res.data || []
- this.hospitalOutResults = this.sortHospitalsByRegion(hospitals)
- })
- }
- }).catch(error => {
- console.error('鍔犺浇甯哥敤杞嚭鍖婚櫌澶辫触:', error)
- searchHospitals('', this.selectedOrganizationId).then(res => {
- const hospitals = res.data || []
- this.hospitalOutResults = this.sortHospitalsByRegion(hospitals)
- })
- })
- } else {
- // 娌℃湁鏈嶅姟鍗曠紪鐮侊紝浣跨敤鏅�氭悳绱�
- searchHospitals('', this.selectedOrganizationId).then(response => {
- const hospitals = response.data || []
- this.hospitalOutResults = this.sortHospitalsByRegion(hospitals)
- }).catch(error => {
- console.error('鍔犺浇杞嚭鍖婚櫌澶辫触:', error)
- this.hospitalOutResults = []
- })
- }
- }
- this.showHospitalOutResults = true
- },
-
- // 杞嚭鍖婚櫌鎼滅储
- onHospitalOutSearch(e) {
- const keyword = e.detail.value
- this.hospitalOutSearchKeyword = keyword
-
- // 闃叉姈澶勭悊
- if (this.searchTimer) {
- clearTimeout(this.searchTimer)
- }
-
- // 濡傛灉鍏抽敭璇嶄负绌猴紝鏄剧ず褰撳墠鍖哄煙鐨勫尰闄�
- if (!keyword || keyword.trim() === '') {
- searchHospitals('', this.selectedOrganizationId).then(response => {
- const hospitals = response.data || []
- // 纭繚"瀹朵腑"鍦ㄦ渶鍓嶉潰
- this.hospitalOutResults = this.sortHospitalsByRegion(hospitals)
- }).catch(error => {
- console.error('鍔犺浇杞嚭鍖婚櫌澶辫触:', error)
- this.hospitalOutResults = []
- })
- this.showHospitalOutResults = true
- return
- }
-
- // 鏈夊叧閿瘝鏃讹紝鍘绘湇鍔$鎼滅储锛堜粎闄愬綋鍓嶅尯鍩燂級
- this.searchTimer = setTimeout(() => {
- this.searchHospitalOut(keyword)
- }, 300)
- },
-
- // 鎼滅储杞嚭鍖婚櫌锛堜粎闄愬綋鍓嶅尯鍩燂級
- searchHospitalOut(keyword) {
- // 浼犲叆鍏抽敭璇嶅拰閮ㄩ棬ID锛屽彧鎼滅储褰撳墠鍖哄煙鐨勫尰闄�
- searchHospitals(keyword, this.selectedOrganizationId).then(response => {
- const hospitals = response.data || []
- // 纭繚"瀹朵腑"鍦ㄦ渶鍓嶉潰
- this.hospitalOutResults = this.sortHospitalsByRegion(hospitals)
- this.showHospitalOutResults = true
- console.log('鎼滅储杞嚭鍖婚櫌:', keyword, '閮ㄩ棬ID:', this.selectedOrganizationId, '缁撴灉鏁�:', this.hospitalOutResults.length)
- }).catch(error => {
- console.error('鎼滅储杞嚭鍖婚櫌澶辫触:', error)
- this.hospitalOutResults = []
- })
- },
-
- // 閫夋嫨杞嚭鍖婚櫌
- selectHospitalOut(hospital) {
- this.taskForm.hospitalOut.id = hospital.hospId // 淇濆瓨鍖婚櫌ID
- this.taskForm.hospitalOut.name = hospital.hospName
- // 濡傛灉閫夋嫨鐨勬槸"瀹朵腑"锛屾竻绌哄湴鍧�璁╃敤鎴锋墜鍔ㄨ緭鍏ワ紱鍚﹀垯鑷姩濉厖鍦板潃
- if (hospital.hospName === '瀹朵腑') {
- this.taskForm.hospitalOut.address = ''
- // 绉戝鑷姩璁剧疆涓�"鍏跺畠"
- this.taskForm.hospitalOut.department = '鍏跺畠'
- this.taskForm.hospitalOut.departmentId = null
- } else {
- // 鍚堝苟鐪佸競鍖� + 璇︾粏鍦板潃
- const fullAddress = this.buildFullAddress(hospital)
- this.taskForm.hospitalOut.address = fullAddress
- // 娓呯┖绉戝锛岃鐢ㄦ埛閲嶆柊閫夋嫨
- if (this.taskForm.hospitalOut.department === '鍏跺畠') {
- this.taskForm.hospitalOut.department = ''
- this.taskForm.hospitalOut.departmentId = null
- }
- }
- this.hospitalOutSearchKeyword = hospital.hospName
- this.showHospitalOutResults = false
- this.hospitalOutResults = []
-
- // 淇濆瓨杞嚭鍖婚櫌鐨勫煄甯備俊鎭�
- this.taskForm.hospitalOut.city = hospital.hopsCity || ''
+ // 杞嚭鍖婚櫌鍙樺寲
+ onHospitalOutChange(hospitalData) {
+ console.log('杞嚭鍖婚櫌鍙樺寲:', hospitalData)
+ // 缁勪欢宸茬粡閫氳繃 v-model 鏇存柊浜� taskForm.hospitalOut
// 濡傛灉杞叆鍦板潃宸插~鍐�,鑷姩璁$畻璺濈
if (this.taskForm.hospitalIn.address) {
// 濡傛灉涓や釜閮戒笉鏄�"瀹朵腑",浣跨敤鍖婚櫌璺濈璁$畻
- if (hospital.hospName !== '瀹朵腑' && this.taskForm.hospitalIn.name !== '瀹朵腑') {
+ if (hospitalData.name !== '瀹朵腑' && this.taskForm.hospitalIn.name !== '瀹朵腑') {
this.calculateHospitalDistance()
} else {
// 鏈変竴涓槸"瀹朵腑",浣跨敤鍦板潃璁$畻
@@ -1137,132 +654,34 @@
}
},
- // 杞叆鍖婚櫌杈撳叆妗嗚幏寰楃劍鐐�
- onHospitalInFocus() {
- // 濡傛灉娌℃湁鎼滅储鍏抽敭璇嶏紝鏄剧ず甯哥敤杞叆鍖婚櫌
- if (!this.hospitalInSearchKeyword || this.hospitalInSearchKeyword.trim() === '') {
- // 濡傛灉宸茬粡鍔犺浇杩囧父鐢ㄥ尰闄紝鐩存帴鏄剧ず
- 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('', null).then(res => {
- const allHospitals = res.data || []
- this.hospitalInResults = this.sortHospitalsByRegion(allHospitals)
- })
- }
- }).catch(error => {
- console.error('鍔犺浇甯哥敤杞叆鍖婚櫌澶辫触:', error)
- searchHospitals('', null).then(res => {
- const allHospitals = res.data || []
- this.hospitalInResults = this.sortHospitalsByRegion(allHospitals)
- })
- })
- } else {
- // 娌℃湁鏈嶅姟鍗曠紪鐮侊紝浣跨敤鏅�氭悳绱�
- searchHospitals('', null).then(response => {
- const allHospitals = response.data || []
- // 鎸夊湴鍩熸帓搴忥細鏈湴鍖哄煙浼樺厛
- this.hospitalInResults = this.sortHospitalsByRegion(allHospitals)
- }).catch(error => {
- console.error('鍔犺浇杞叆鍖婚櫌澶辫触:', error)
- this.hospitalInResults = []
- })
- }
+ // 杞嚭鍖婚櫌鍦板潃閫夋嫨浜嬩欢锛堢畝鍖栵紝绉婚櫎GPS澶勭悊锛�
+ onHospitalOutAddressSelected(data) {
+ if (this.taskForm.hospitalIn.address) {
+ this.calculateDistanceByManualAddress()
}
- this.showHospitalInResults = true
},
- // 杞叆鍖婚櫌鎼滅储
- onHospitalInSearch(e) {
- const keyword = e.detail.value
- this.hospitalInSearchKeyword = keyword
-
- // 闃叉姈澶勭悊
- if (this.searchTimer) {
- clearTimeout(this.searchTimer)
- }
-
- // 濡傛灉鍏抽敭璇嶄负绌猴紝鏄剧ず鎵�鏈夊尰闄紙鏈湴鍖哄煙浼樺厛锛�
- if (!keyword || keyword.trim() === '') {
- searchHospitals('', null).then(response => {
- const allHospitals = response.data || []
- // 鎸夊湴鍩熸帓搴忥細"瀹朵腑"鏈�鍓嶏紝鏈湴鍖哄煙浼樺厛
- this.hospitalInResults = this.sortHospitalsByRegion(allHospitals)
- }).catch(error => {
- console.error('鍔犺浇杞叆鍖婚櫌澶辫触:', error)
- this.hospitalInResults = []
- })
- this.showHospitalInResults = true
- return
- }
-
- // 鏈夊叧閿瘝鏃讹紝鍘绘湇鍔$鎼滅储锛堜笉闄愬尯鍩燂紝浣嗙粨鏋滄寜鍦板煙鎺掑簭锛�
- this.searchTimer = setTimeout(() => {
- this.searchHospitalIn(keyword)
- }, 300)
- },
-
- // 鎼滅储杞叆鍖婚櫌锛堜笉闄愬尯鍩燂紝浣嗘湰鍦板尯鍩熶紭鍏堬級
- searchHospitalIn(keyword) {
- // 浼犲叆鍏抽敭璇嶏紝涓嶄紶閮ㄩ棬ID锛堟悳绱㈡墍鏈夊尯鍩燂級
- searchHospitals(keyword, null).then(response => {
- const allHospitals = response.data || []
- // 鎸夊湴鍩熸帓搴忥細"瀹朵腑"鏈�鍓嶏紝鏈湴鍖哄煙浼樺厛
- this.hospitalInResults = this.sortHospitalsByRegion(allHospitals)
- this.showHospitalInResults = true
- console.log('鎼滅储杞叆鍖婚櫌:', keyword, '缁撴灉鏁�:', this.hospitalInResults.length)
- }).catch(error => {
- console.error('鎼滅储杞叆鍖婚櫌澶辫触:', error)
- this.hospitalInResults = []
- })
- },
-
- // 閫夋嫨杞叆鍖婚櫌
- selectHospitalIn(hospital) {
- this.taskForm.hospitalIn.id = hospital.hospId // 淇濆瓨鍖婚櫌ID
- this.taskForm.hospitalIn.name = hospital.hospName
- // 濡傛灉閫夋嫨鐨勬槸"瀹朵腑"锛屾竻绌哄湴鍧�璁╃敤鎴锋墜鍔ㄨ緭鍏ワ紱鍚﹀垯鑷姩濉厖鍦板潃
- if (hospital.hospName === '瀹朵腑') {
- this.taskForm.hospitalIn.address = ''
- // 绉戝鑷姩璁剧疆涓�"鍏跺畠"
- this.taskForm.hospitalIn.department = '鍏跺畠'
- this.taskForm.hospitalIn.departmentId = null
- } else {
- // 鍚堝苟鐪佸競鍖� + 璇︾粏鍦板潃
- const fullAddress = this.buildFullAddress(hospital)
- this.taskForm.hospitalIn.address = fullAddress
- // 娓呯┖绉戝锛岃鐢ㄦ埛閲嶆柊閫夋嫨
- if (this.taskForm.hospitalIn.department === '鍏跺畠') {
- this.taskForm.hospitalIn.department = ''
- this.taskForm.hospitalIn.departmentId = null
- }
- }
- this.hospitalInSearchKeyword = hospital.hospName
- this.showHospitalInResults = false
- this.hospitalInResults = []
-
- // 淇濆瓨杞叆鍖婚櫌鐨勫煄甯備俊鎭�
- this.taskForm.hospitalIn.city = hospital.hopsCity || ''
+ // 杞叆鍖婚櫌鍙樺寲
+ onHospitalInChange(hospitalData) {
+ console.log('杞叆鍖婚櫌鍙樺寲:', hospitalData)
+ // 缁勪欢宸茬粡閫氳繃 v-model 鏇存柊浜� taskForm.hospitalIn
// 濡傛灉杞嚭鍦板潃宸插~鍐�,鑷姩璁$畻璺濈
if (this.taskForm.hospitalOut.address) {
// 濡傛灉涓や釜閮戒笉鏄�"瀹朵腑",浣跨敤鍖婚櫌璺濈璁$畻
- if (hospital.hospName !== '瀹朵腑' && this.taskForm.hospitalOut.name !== '瀹朵腑') {
+ if (hospitalData.name !== '瀹朵腑' && this.taskForm.hospitalOut.name !== '瀹朵腑') {
this.calculateHospitalDistance()
} else {
// 鏈変竴涓槸"瀹朵腑",浣跨敤鍦板潃璁$畻
this.calculateDistanceByManualAddress()
}
+ }
+ },
+
+ // 杞叆鍖婚櫌鍦板潃閫夋嫨浜嬩欢锛堢畝鍖栵紝绉婚櫎GPS澶勭悊锛�
+ onHospitalInAddressSelected(data) {
+ if (this.taskForm.hospitalOut.address) {
+ this.calculateDistanceByManualAddress()
}
},
@@ -1396,7 +815,7 @@
console.log('鎸夊叧閿瘝杩囨护鍚庯紝鏁伴噺:', list.length)
this.filteredStaffList = list
- console.log('鏈�缁堣繃婊ょ粨鏋�:', this.filteredStaffList)
+ // console.log('鏈�缁堣繃婊ょ粨鏋�:', this.filteredStaffList)
},
// 鍒囨崲浜哄憳閫変腑鐘舵��
@@ -1443,168 +862,6 @@
addStaff() {
this.showStaffSelector()
},
-
- // ==================== 鍦板潃杈撳叆鑱旀兂鐩稿叧鏂规硶 ====================
-
- // 杞嚭鍦板潃杈撳叆鐩戝惉
- onAddressOutInput(e) {
- const query = e.detail.value
- this.taskForm.hospitalOut.address = query
-
- // 闃叉姈澶勭悊
- if (this.addressSearchTimer) {
- clearTimeout(this.addressSearchTimer)
- }
-
- // 濡傛灉杈撳叆涓虹┖锛岄殣钘忔彁绀哄垪琛�
- if (!query || query.trim() === '') {
- this.showAddressOutSuggestions = false
- this.addressOutSuggestions = []
- return
- }
-
- // 杈撳叆闀垮害澶т簬2鎵嶅紑濮嬫悳绱�
- if (query.trim().length < 2) {
- this.showAddressOutSuggestions = false
- return
- }
-
- // 寤惰繜300ms鎼滅储
- this.addressSearchTimer = setTimeout(() => {
- this.searchAddressOut(query)
- }, 300)
- },
-
- // 杞嚭鍦板潃杈撳叆妗嗚幏寰楃劍鐐�
- onAddressOutFocus() {
- // 濡傛灉鏈夊湴鍧�涓旀湁鎼滅储缁撴灉锛屾樉绀烘彁绀哄垪琛�
- if (this.taskForm.hospitalOut.address && this.addressOutSuggestions.length > 0) {
- this.showAddressOutSuggestions = true
- }
- },
-
- // 鎼滅储杞嚭鍦板潃
- searchAddressOut(query) {
- // 鑾峰彇褰撳墠鍖哄煙锛堜紭鍏堜娇鐢ㄥ綊灞炴満鏋勭殑鍖哄煙锛�
- const region = this.selectedRegion || '骞垮窞'
-
- baiduPlaceSuggestion(query, region).then(response => {
- if (response.code === 200 && response.data) {
- this.addressOutSuggestions = response.data
- this.showAddressOutSuggestions = true
- } else {
- this.addressOutSuggestions = []
- this.showAddressOutSuggestions = false
- }
- }).catch(error => {
- console.error('鎼滅储杞嚭鍦板潃澶辫触:', error)
- this.addressOutSuggestions = []
- this.showAddressOutSuggestions = false
- })
- },
-
- // 閫夋嫨杞嚭鍦板潃
- selectAddressOut(item) {
- // 濉厖瀹屾暣鍦板潃
- const fullAddress = item.district + item.address
- this.taskForm.hospitalOut.address = fullAddress
-
- // 淇濆瓨缁忕含搴︼紙濡傛灉鏈夛級
- if (item.location) {
- this.taskForm.hospitalOut.latitude = item.location.lat
- this.taskForm.hospitalOut.longitude = item.location.lng
- }
-
- // 闅愯棌鎻愮ず鍒楄〃
- this.showAddressOutSuggestions = false
- this.addressOutSuggestions = []
-
- // 濡傛灉杞叆鍦板潃涔熷凡濉啓,鑷姩璁$畻璺濈
- if (this.taskForm.hospitalIn.address) {
- this.calculateDistanceByManualAddress()
- }
- },
-
- // 杞叆鍦板潃杈撳叆鐩戝惉
- onAddressInInput(e) {
- const query = e.detail.value
- this.taskForm.hospitalIn.address = query
-
- // 闃叉姈澶勭悊
- if (this.addressSearchTimer) {
- clearTimeout(this.addressSearchTimer)
- }
-
- // 濡傛灉杈撳叆涓虹┖锛岄殣钘忔彁绀哄垪琛�
- if (!query || query.trim() === '') {
- this.showAddressInSuggestions = false
- this.addressInSuggestions = []
- return
- }
-
- // 杈撳叆闀垮害澶т簬2鎵嶅紑濮嬫悳绱�
- if (query.trim().length < 2) {
- this.showAddressInSuggestions = false
- return
- }
-
- // 寤惰繜300ms鎼滅储
- this.addressSearchTimer = setTimeout(() => {
- this.searchAddressIn(query)
- }, 300)
- },
-
- // 杞叆鍦板潃杈撳叆妗嗚幏寰楃劍鐐�
- onAddressInFocus() {
- // 濡傛灉鏈夊湴鍧�涓旀湁鎼滅储缁撴灉锛屾樉绀烘彁绀哄垪琛�
- if (this.taskForm.hospitalIn.address && this.addressInSuggestions.length > 0) {
- this.showAddressInSuggestions = true
- }
- },
-
- // 鎼滅储杞叆鍦板潃
- searchAddressIn(query) {
- // 鑾峰彇褰撳墠鍖哄煙锛堜紭鍏堜娇鐢ㄥ綊灞炴満鏋勭殑鍖哄煙锛�
- const region = this.selectedRegion || '骞垮窞'
-
- baiduPlaceSuggestion(query, region).then(response => {
- if (response.code === 200 && response.data) {
- this.addressInSuggestions = response.data
- this.showAddressInSuggestions = true
- } else {
- this.addressInSuggestions = []
- this.showAddressInSuggestions = false
- }
- }).catch(error => {
- console.error('鎼滅储杞叆鍦板潃澶辫触:', error)
- this.addressInSuggestions = []
- this.showAddressInSuggestions = false
- })
- },
-
- // 閫夋嫨杞叆鍦板潃
- selectAddressIn(item) {
- // 濉厖瀹屾暣鍦板潃
- const fullAddress = item.district + item.address
- this.taskForm.hospitalIn.address = fullAddress
-
- // 淇濆瓨缁忕含搴︼紙濡傛灉鏈夛級
- if (item.location) {
- this.taskForm.hospitalIn.latitude = item.location.lat
- this.taskForm.hospitalIn.longitude = item.location.lng
- }
-
- // 闅愯棌鎻愮ず鍒楄〃
- this.showAddressInSuggestions = false
- this.addressInSuggestions = []
-
- // 濡傛灉杞嚭鍦板潃涔熷凡濉啓,鑷姩璁$畻璺濈
- if (this.taskForm.hospitalOut.address) {
- this.calculateDistanceByManualAddress()
- }
- },
-
- // 鎵嬪姩杈撳叆鍦板潃鏃惰绠楄窛绂�
calculateDistanceByManualAddress() {
const fromAddress = this.taskForm.hospitalOut.address
const toAddress = this.taskForm.hospitalIn.address
@@ -1694,107 +951,7 @@
// 璁$畻澶辫触鏃朵笉鎻愮ず鐢ㄦ埛锛屽厑璁哥敤鎴锋墜鍔ㄨ緭鍏�
})
},
-
- // ==================== 鐥呮儏閫夋嫨鐩稿叧鏂规硶 ====================
-
- // 鏄剧ず鐥呮儏閫夋嫨寮圭獥
- showDiseaseSelector() {
- // 鍒濆鍖栦复鏃堕�夋嫨鍒楄〃锛堝鍒跺綋鍓嶅凡閫夋嫨鐨勭梾鎯咃級
- this.tempSelectedDiseases = [...this.selectedDiseases]
- this.diseaseSearchKeyword = ''
- // 榛樿鍔犺浇鎵�鏈夌梾鎯�
- this.loadAllDiseases()
- this.$refs.diseasePopup.open()
- },
-
- // 鍏抽棴鐥呮儏閫夋嫨寮圭獥
- closeDiseaseSelector() {
- this.$refs.diseasePopup.close()
- this.diseaseSearchKeyword = ''
- this.diseaseSearchResults = []
- this.tempSelectedDiseases = []
- },
-
- // 鐥呮儏鎼滅储
- onDiseaseSearch(e) {
- const keyword = e.detail.value
- this.diseaseSearchKeyword = keyword
-
- // 闃叉姈澶勭悊
- if (this.diseaseSearchTimer) {
- clearTimeout(this.diseaseSearchTimer)
- }
-
- // 濡傛灉鍏抽敭璇嶄负绌猴紝鍔犺浇鎵�鏈夌梾鎯�
- if (!keyword || keyword.trim() === '') {
- this.loadAllDiseases()
- return
- }
-
- // 鏈夊叧閿瘝鏃惰繘琛屾悳绱�
- this.diseaseSearchTimer = setTimeout(() => {
- this.searchDiseaseByKeyword(keyword)
- }, 300)
- },
-
- // 鍔犺浇鎵�鏈夌梾鎯咃紙榛樿鏄剧ず锛�
- loadAllDiseases() {
- // 浣跨敤绌哄瓧绗︿覆鎴栫壒娈婃爣璇嗙鏉ヨ幏鍙栨墍鏈夌梾鎯�
- // 濡傛灉鍚庣涓嶆敮鎸佺┖鏌ヨ锛屽彲浠ヤ紶鍏ヤ竴涓�氶厤绗﹀'%'鎴栬�呬慨鏀瑰悗绔帴鍙�
- searchIcd10('').then(response => {
- this.diseaseSearchResults = response.data || []
- }).catch(error => {
- console.error('鍔犺浇鐥呮儏鍒楄〃澶辫触:', error)
- this.diseaseSearchResults = []
- })
- },
-
- // 鏍规嵁鍏抽敭璇嶆悳绱㈢梾鎯�
- searchDiseaseByKeyword(keyword) {
- searchIcd10(keyword).then(response => {
- this.diseaseSearchResults = response.data || []
- }).catch(error => {
- console.error('鎼滅储鐥呮儏澶辫触:', error)
- this.diseaseSearchResults = []
- })
- },
-
- // 鍒囨崲鐥呮儏閫変腑鐘舵��
- toggleDiseaseSelection(disease) {
- const index = this.tempSelectedDiseases.findIndex(d => d.id === disease.id)
-
- if (index > -1) {
- // 宸查�変腑锛岀Щ闄�
- this.tempSelectedDiseases.splice(index, 1)
- } else {
- // 鏈�変腑锛屾坊鍔�
- this.tempSelectedDiseases.push({
- id: disease.id,
- icdCode: disease.icdCode,
- icdName: disease.icdName,
- sm: disease.sm
- })
- }
- },
-
- // 鍒ゆ柇鐥呮儏鏄惁宸查�変腑
- isDiseaseSelected(diseaseId) {
- return this.tempSelectedDiseases.some(d => d.id === diseaseId)
- },
-
- // 纭鐥呮儏閫夋嫨
- confirmDiseaseSelection() {
- // 灏嗕复鏃堕�夋嫨鐨勭梾鎯呭鍒跺埌姝e紡鍒楄〃
- this.selectedDiseases = [...this.tempSelectedDiseases]
- this.closeDiseaseSelector()
- },
-
- // 绉婚櫎鐥呮儏
- removeDisease(index) {
- this.selectedDiseases.splice(index, 1)
- },
-
- // 璁剧疆榛樿杞繍鏃堕棿涓哄綋鍓嶆椂闂�
+ // 鎵嬪姩杈撳叆鍦板潃鏃惰绠楄窛绂�
setDefaultTransferTime() {
const now = new Date()
const year = now.getFullYear()
@@ -1886,8 +1043,14 @@
// 鍚堝苟鐥呮儏淇℃伅锛氶�変腑鐨処CD-10鐤剧梾 + 鍏朵粬鎻忚堪
let conditionText = ''
if (this.selectedDiseases.length > 0) {
- const diseaseNames = this.selectedDiseases.map(d => `${d.icdName}(${d.icdCode})`).join('銆�')
- conditionText = diseaseNames
+ // 杩囨护鎺夌梾鎯呭悕绉颁负绌虹殑椤癸紝骞舵瀯寤虹梾鎯呭瓧绗︿覆
+ const diseaseNames = this.selectedDiseases
+ .filter(d => d.icdName && d.icdName.trim())
+ .map(d => `${d.icdName}(${d.icdCode})`)
+ .join('銆�')
+ if (diseaseNames) {
+ conditionText = diseaseNames
+ }
}
if (this.taskForm.patient.condition && this.taskForm.patient.condition.trim()) {
if (conditionText) {
@@ -1914,47 +1077,42 @@
documentTypeId: this.selectedDocumentTypeId, // 鍗曟嵁绫诲瀷ID
taskTypeId: this.selectedEmergencyTaskTypeId, // 浠诲姟绫诲瀷ID
// 鐥呮儏ID鍒楄〃锛堢敤浜庡悓姝ヨ皟搴﹀崟鐨凮rdICD_ID鍙傛暟锛�
- diseaseIds: this.selectedDiseases.map(d => d.id),
+ diseaseIds: this.selectedDiseases.filter(d => d.id !== null).map(d => d.id),
// 灏嗚浆鍑哄尰闄㈠湴鍧�浣滀负鍑哄彂鍦帮紝杞叆鍖婚櫌鍦板潃浣滀负鐩殑鍦�
- departureAddress: this.taskForm.hospitalOut.address || '',
+ departureAddress: this.departureAddress || this.taskForm.hospitalOut.address || '',
destinationAddress: this.taskForm.hospitalIn.address || '',
patient: {
...this.taskForm.patient,
condition: conditionText, // 浣跨敤鍚堝苟鍚庣殑鐥呮儏淇℃伅
- diseases: this.selectedDiseases.map(d => ({
- icdId: d.id,
- icdCode: d.icdCode,
- icdName: d.icdName
- }))
+ diseases: this.selectedDiseases
+ .filter(d => d.icdName && d.icdName.trim())
+ .map(d => ({
+ icdId: d.id,
+ icdCode: d.icdCode,
+ icdName: d.icdName
+ }))
},
- // 鍖婚櫌淇℃伅锛堝寘鍚尰闄D銆佺瀹ゅ悕绉般�佺瀹D绛夊畬鏁翠俊鎭級
- hospitalOut: this.taskForm.hospitalOut, // 鍖呭惈: id, name, department, departmentId, bedNumber, address
- hospitalIn: this.taskForm.hospitalIn, // 鍖呭惈: id, name, department, departmentId, bedNumber, address
+ // 鍖婚櫌淇℃伅锛堝寘鍚尰闄D銆佺瀹ゅ悕绉般�佺瀹D銆丟PS鍧愭爣绛夊畬鏁翠俊鎭級
+ hospitalOut: {
+ ...this.taskForm.hospitalOut
+ // GPS鍧愭爣鐢卞悗绔嚜鍔ㄨ幏鍙�
+ },
+ hospitalIn: {
+ ...this.taskForm.hospitalIn
+ // GPS鍧愭爣鐢卞悗绔嚜鍔ㄨ幏鍙�
+ },
+
transferDistance: this.taskForm.transferDistance ? parseFloat(this.taskForm.transferDistance) : null,
price: this.taskForm.price ? parseFloat(this.taskForm.price) : null
}
- if (this.addressCoordinates.hospitalOutAddress) {
- // 杞嚭鍖婚櫌GPS鍧愭爣鍐欏叆鎵╁睍琛�
- if (!submitData.hospitalOut) submitData.hospitalOut = {}
- submitData.hospitalOut.longitude = this.addressCoordinates.hospitalOutAddress.lng
- submitData.hospitalOut.latitude = this.addressCoordinates.hospitalOutAddress.lat
-
- // 鍚屾椂鍐欏叆涓讳换鍔¤〃鐨勫嚭鍙戝湴缁忕含搴�
- submitData.departureLongitude = this.addressCoordinates.hospitalOutAddress.lng
- submitData.departureLatitude = this.addressCoordinates.hospitalOutAddress.lat
+ // 鍑哄彂鍦癎PS鍧愭爣锛堜紭鍏堜娇鐢ㄨ嚜瀹氫箟鐨勫嚭鍙戝湴鍧愭爣锛�
+ if (this.departureLongitude && this.departureLatitude) {
+ submitData.departureLongitude = this.departureLongitude
+ submitData.departureLatitude = this.departureLatitude
}
- if (this.addressCoordinates.hospitalInAddress) {
- // 杞叆鍖婚櫌GPS鍧愭爣鍐欏叆鎵╁睍琛�
- if (!submitData.hospitalIn) submitData.hospitalIn = {}
- submitData.hospitalIn.longitude = this.addressCoordinates.hospitalInAddress.lng
- submitData.hospitalIn.latitude = this.addressCoordinates.hospitalInAddress.lat
-
- // 鍚屾椂鍐欏叆涓讳换鍔¤〃鐨勭洰鐨勫湴缁忕含搴�
- submitData.destinationLongitude = this.addressCoordinates.hospitalInAddress.lng
- submitData.destinationLatitude = this.addressCoordinates.hospitalInAddress.lat
- }
+ // 鐩爣鍦癎PS鍧愭爣鐢卞悗绔牴鎹浆鍏ュ尰闄㈠湴鍧�鑷姩鑾峰彇
return submitData
},
@@ -1993,6 +1151,79 @@
goBack() {
uni.navigateBack()
+ },
+
+ // 鑾峰彇褰撳墠浣嶇疆
+ getCurrentLocation() {
+ uni.showLoading({
+ title: '鑾峰彇浣嶇疆涓�...'
+ })
+
+ // 浣跨敤uni-app鐨凣PS瀹氫綅鍔熻兘
+ uni.getLocation({
+ type: 'gcj02', // 杩斿洖鍥芥祴灞�鍧愭爣锛岄�傜敤浜庡浗鍐呭湴鍥�
+ success: (res) => {
+ console.log('鑾峰彇鍒癎PS鍧愭爣:', res)
+ const latitude = res.latitude
+ const longitude = res.longitude
+
+ // 淇濆瓨GPS鍧愭爣
+ this.departureLatitude = latitude
+ this.departureLongitude = longitude
+
+ // 璋冪敤閫嗗湴鐞嗙紪鐮佹帴鍙o紝灏嗗潗鏍囪浆鎹负鍦板潃
+ reverseGeocoder(latitude, longitude)
+ .then(response => {
+ uni.hideLoading()
+
+ if (response.code === 200 && response.data) {
+ // 鑾峰彇璇︾粏鍦板潃
+ const address = response.data.address || response.data.formattedAddress || ''
+ this.departureAddress = address
+
+ console.log('閫嗗湴鐞嗙紪鐮佹垚鍔�:', address)
+ this.$modal.showToast('宸茶幏鍙栧綋鍓嶄綅缃�')
+ } else {
+ console.error('閫嗗湴鐞嗙紪鐮佸け璐�:', response.msg)
+ this.$modal.showToast('浣嶇疆瑙f瀽澶辫触锛岃鎵嬪姩杈撳叆鍦板潃')
+ }
+ })
+ .catch(error => {
+ uni.hideLoading()
+ console.error('閫嗗湴鐞嗙紪鐮佸け璐�:', error)
+ // 鍗充娇鍦板潃瑙f瀽澶辫触锛屼篃淇濈暀GPS鍧愭爣
+ this.$modal.showToast('浣嶇疆瑙f瀽澶辫触锛屼絾GPS鍧愭爣宸蹭繚瀛�')
+ })
+ },
+ fail: (err) => {
+ uni.hideLoading()
+ console.error('鑾峰彇浣嶇疆澶辫触:', err)
+
+ // 鎻愮ず鐢ㄦ埛鍙兘鐨勫師鍥�
+ let errorMsg = '鑾峰彇浣嶇疆澶辫触'
+ if (err.errMsg && err.errMsg.includes('auth deny')) {
+ errorMsg = '璇峰湪璁剧疆涓紑鍚綅缃潈闄�'
+ } else if (err.errMsg && err.errMsg.includes('timeout')) {
+ errorMsg = '瀹氫綅瓒呮椂锛岃绋嶅悗閲嶈瘯'
+ }
+
+ this.$modal.showToast(errorMsg)
+ }
+ })
+ },
+
+ // 鍑哄彂鍦板湴鍧�閫夋嫨锛堜粠鍦板浘寤鸿涓�夋嫨锛�
+ onDepartureAddressSelected(data) {
+ // data 鍖呭惈: address, longitude, latitude, location
+ console.log('鍑哄彂鍦板湴鍧�閫夋嫨:', data)
+ // 缁勪欢宸茬粡閫氳繃 .sync 鏇存柊浜� departureAddress, departureLongitude, departureLatitude
+ },
+
+ // 鍑哄彂鍦癎PS瀹氫綅鎴愬姛
+ onDepartureLocationSuccess(data) {
+ // data 鍖呭惈: address, longitude, latitude
+ console.log('鍑哄彂鍦癎PS瀹氫綅鎴愬姛:', data)
+ // 缁勪欢宸茬粡閫氳繃 .sync 鏇存柊浜� departureAddress, departureLongitude, departureLatitude
},
// ==================== 鏅鸿兘璇嗗埆鐩稿叧鏂规硶 ====================
@@ -2623,6 +1854,13 @@
font-size: 28rpx;
}
+ .form-tip {
+ margin-top: 10rpx;
+ font-size: 24rpx;
+ color: #999;
+ line-height: 1.5;
+ }
+
.disease-container {
.disease-tags {
display: flex;
@@ -2989,145 +2227,6 @@
background-color: #ccc;
color: #999;
}
- }
- }
-}
-
-// 鐥呮儏閫夋嫨寮圭獥鏍峰紡
-.disease-selector-popup {
- background-color: white;
- border-radius: 20rpx 20rpx 0 0;
- max-height: 80vh;
- display: flex;
- flex-direction: column;
-
- .popup-header {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 30rpx;
- border-bottom: 1rpx solid #f0f0f0;
- flex-shrink: 0;
-
- .popup-title {
- font-size: 32rpx;
- font-weight: bold;
- color: #333;
- }
-
- .popup-close {
- padding: 10rpx;
- }
- }
-
- .search-box {
- display: flex;
- align-items: center;
- margin: 20rpx 30rpx;
- padding: 15rpx 20rpx;
- background-color: #f5f5f5;
- border-radius: 10rpx;
- flex-shrink: 0;
-
- .search-input {
- flex: 1;
- margin-left: 10rpx;
- font-size: 28rpx;
- }
- }
-
- .disease-list-popup {
- flex: 1;
- overflow-y: auto;
- padding: 0 30rpx;
-
- .disease-item-popup {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 25rpx 20rpx;
- border-bottom: 1rpx solid #f0f0f0;
-
- &:active {
- background-color: #f5f5f5;
- }
-
- .disease-info {
- flex: 1;
-
- .disease-name-row {
- display: flex;
- align-items: center;
- margin-bottom: 8rpx;
-
- .disease-name {
- font-size: 30rpx;
- font-weight: bold;
- color: #333;
- margin-right: 15rpx;
- }
-
- .disease-code {
- font-size: 24rpx;
- color: #007AFF;
- background-color: #e6f2ff;
- padding: 4rpx 12rpx;
- border-radius: 6rpx;
- }
- }
-
- .disease-detail-row {
- .disease-desc {
- font-size: 24rpx;
- color: #999;
- line-height: 1.5;
- }
- }
- }
-
- .checkbox-empty {
- width: 40rpx;
- height: 40rpx;
- border: 2rpx solid #ddd;
- border-radius: 50%;
- }
- }
-
- .no-data {
- text-align: center;
- padding: 100rpx 0;
- color: #999;
-
- text {
- display: block;
- margin-top: 20rpx;
- font-size: 28rpx;
- }
- }
- }
-
- .popup-footer {
- display: flex;
- padding: 20rpx 30rpx;
- border-top: 1rpx solid #f0f0f0;
- gap: 20rpx;
- flex-shrink: 0;
-
- button {
- flex: 1;
- height: 80rpx;
- border-radius: 10rpx;
- font-size: 30rpx;
- }
-
- .cancel-btn {
- background-color: #f5f5f5;
- color: #666;
- }
-
- .confirm-btn {
- background-color: #007AFF;
- color: white;
}
}
}
--
Gitblit v1.9.1