From 3328aec7bc4cc2c090f015cba905a82d6d52870c Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期日, 19 十月 2025 10:34:29 +0800
Subject: [PATCH] fix:更新
---
app/pages/task/create-emergency.vue | 179 +++++++++++++++++++++++++++++++++++++++++++++++++----------
1 files changed, 149 insertions(+), 30 deletions(-)
diff --git a/app/pages/task/create-emergency.vue b/app/pages/task/create-emergency.vue
index cefe5b2..df6c704 100644
--- a/app/pages/task/create-emergency.vue
+++ b/app/pages/task/create-emergency.vue
@@ -4,7 +4,7 @@
<view class="back-btn" @click="goBack">
<uni-icons type="arrowleft" size="20"></uni-icons>
</view>
- <view class="title">鍒涘缓闈炴�ユ晳杞繍浠诲姟</view>
+ <view class="title">鍒涘缓鎬ユ晳杞繍浠诲姟</view>
</view>
<view class="form-section">
@@ -170,7 +170,7 @@
placeholder="璇疯緭鍏ュ尰闄㈠悕绉版垨鍦板潃鎼滅储"
v-model="hospitalOutSearchKeyword"
@input="onHospitalOutSearch"
- @focus="showHospitalOutResults = true"
+ @focus="onHospitalOutFocus"
/>
<view class="search-results" v-if="showHospitalOutResults && hospitalOutResults.length > 0">
<view
@@ -188,11 +188,12 @@
<view class="form-item">
<view class="form-label">绉戝</view>
- <input
- class="form-input"
- placeholder="璇疯緭鍏ョ瀹�"
- v-model="taskForm.hospitalOut.department"
- />
+ <picker mode="selector" :range="departmentOptions" range-key="dictLabel" @change="onHospitalOutDepartmentChange">
+ <view class="form-input picker-input">
+ {{ taskForm.hospitalOut.department || '璇烽�夋嫨绉戝' }}
+ <uni-icons type="arrowright" size="16" color="#999"></uni-icons>
+ </view>
+ </picker>
</view>
<view class="form-item">
@@ -220,7 +221,7 @@
placeholder="璇疯緭鍏ュ尰闄㈠悕绉版垨鍦板潃鎼滅储"
v-model="hospitalInSearchKeyword"
@input="onHospitalInSearch"
- @focus="showHospitalInResults = true"
+ @focus="onHospitalInFocus"
/>
<view class="search-results" v-if="showHospitalInResults && hospitalInResults.length > 0">
<view
@@ -238,11 +239,12 @@
<view class="form-item">
<view class="form-label">绉戝</view>
- <input
- class="form-input"
- placeholder="璇疯緭鍏ョ瀹�"
- v-model="taskForm.hospitalIn.department"
- />
+ <picker mode="selector" :range="departmentOptions" range-key="dictLabel" @change="onHospitalInDepartmentChange">
+ <view class="form-input picker-input">
+ {{ taskForm.hospitalIn.department || '璇烽�夋嫨绉戝' }}
+ <uni-icons type="arrowright" size="16" color="#999"></uni-icons>
+ </view>
+ </picker>
</view>
<view class="form-item">
@@ -410,14 +412,9 @@
<view v-else class="checkbox-empty"></view>
</view>
- <view class="no-data" v-if="diseaseSearchResults.length === 0 && diseaseSearchKeyword">
+ <view class="no-data" v-if="diseaseSearchResults.length === 0">
<uni-icons type="info" size="40" color="#ccc"></uni-icons>
- <text>鏈壘鍒扮浉鍏崇柧鐥�</text>
- </view>
-
- <view class="no-data" v-if="diseaseSearchResults.length === 0 && !diseaseSearchKeyword">
- <uni-icons type="search" size="40" color="#ccc"></uni-icons>
- <text>璇疯緭鍏ュ叧閿瘝鎼滅储鐤剧梾</text>
+ <text>{{ diseaseSearchKeyword ? '鏈壘鍒扮浉鍏崇柧鐥�' : '鏆傛棤鐥呮儏鏁版嵁' }}</text>
</view>
</scroll-view>
@@ -435,11 +432,13 @@
import uniDatetimePicker from '@/uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue'
import uniPopup from '@/uni_modules/uni-popup/components/uni-popup/uni-popup.vue'
import { addTask } from "@/api/task"
-import { listAvailableVehicles } from "@/api/vehicle"
+import { listAvailableVehicles, getUserBoundVehicle } from "@/api/vehicle"
import { calculateDistance } from "@/api/map"
import { searchHospitals } from "@/api/hospital"
import { listUser } from "@/api/system/user"
import { searchIcd10 } from "@/api/icd10"
+import { getUserProfile } from "@/api/system/user"
+import { getDicts } from "@/api/dict"
import MapSelector from '@/components/map-selector.vue'
export default {
@@ -463,6 +462,7 @@
hospitalInResults: [],
showHospitalInResults: false,
searchTimer: null,
+ defaultHospitals: [], // 榛樿鐨�100鏉″尰闄㈡暟鎹�
// 浜哄憳閫夋嫨鐩稿叧
selectedStaff: [], // 宸查�夋嫨鐨勪汉鍛樺垪琛�
allStaffList: [], // 鎵�鏈変汉鍛樺垪琛�
@@ -504,6 +504,7 @@
vehicleOptions: [],
organizations: ['骞垮窞鍒嗗叕鍙�', '娣卞湷鍒嗗叕鍙�', '鐝犳捣鍒嗗叕鍙�', '浣涘北鍒嗗叕鍙�'],
emergencyTaskTypes: ['鎬ユ晳杞繍', '鑸┖杞繍'],
+ departmentOptions: [], // 绉戝瀛楀吀鏁版嵁
loading: false,
addressCoordinates: {
hospitalOutAddress: null,
@@ -519,16 +520,53 @@
nickName: state.user.nickName || state.user.name || '寮犱笁',
position: '鍙告満',
deptId: state.user.deptId || 100,
- phonenumber: state.user.phonenumber || ''
+ phonenumber: state.user.phonenumber || '',
+ branchCompanyId: state.user.branchCompanyId,
+ branchCompanyName: state.user.branchCompanyName
})
})
},
onLoad(options) {
- this.getAvailableVehicles()
+ // 鍏堝姞杞借溅杈嗗垪琛紝鐒跺悗鍔犺浇缁戝畾杞﹁締淇℃伅
+ this.getAvailableVehicles().then(() => {
+ this.getUserBoundVehicleInfo()
+ })
this.initSelectedStaff()
this.loadDeptStaff()
+ // 璁剧疆榛樿褰掑睘鏈烘瀯
+ if (this.currentUser.branchCompanyName) {
+ this.selectedOrganization = this.currentUser.branchCompanyName
+ }
+ // 鍔犺浇榛樿鍖婚櫌鍒楄〃锛堝墠100鏉★級
+ this.loadDefaultHospitals()
+ // 鍔犺浇绉戝瀛楀吀鏁版嵁
+ this.loadDepartments()
},
methods: {
+ // 鑾峰彇鐢ㄦ埛缁戝畾鐨勮溅杈嗕俊鎭�
+ getUserBoundVehicleInfo() {
+ getUserProfile().then(response => {
+ const userInfo = response.data || response
+ if (userInfo.boundVehicle) {
+ const boundVehicleNo = userInfo.boundVehicle.vehicleNumber
+ const boundVehicleId = userInfo.boundVehicle.vehicleId
+
+ // 鍦ㄨ溅杈嗗垪琛ㄤ腑鏌ユ壘缁戝畾鐨勮溅杈�
+ const vehicleIndex = this.vehicleOptions.findIndex(v =>
+ v.id === boundVehicleId || v.name === boundVehicleNo
+ )
+
+ if (vehicleIndex !== -1) {
+ // 璁剧疆榛樿閫変腑鐨勮溅杈�
+ this.selectedVehicle = this.vehicleOptions[vehicleIndex].name
+ this.selectedVehicleId = this.vehicleOptions[vehicleIndex].id
+ }
+ }
+ }).catch(error => {
+ console.error('鑾峰彇鐢ㄦ埛缁戝畾杞﹁締淇℃伅澶辫触:', error)
+ })
+ },
+
getAvailableVehicles() {
const deptId = this.currentUser.deptId
return listAvailableVehicles(deptId, 'EMERGENCY').then(response => {
@@ -559,6 +597,51 @@
this.selectedEmergencyTaskType = this.emergencyTaskTypes[e.detail.value]
},
+ // 鍔犺浇绉戝瀛楀吀鏁版嵁
+ loadDepartments() {
+ getDicts('hospital_department').then(response => {
+ this.departmentOptions = response.data || []
+ }).catch(error => {
+ console.error('鍔犺浇绉戝瀛楀吀澶辫触:', error)
+ this.departmentOptions = []
+ })
+ },
+
+ // 杞嚭鍖婚櫌绉戝閫夋嫨
+ onHospitalOutDepartmentChange(e) {
+ const index = e.detail.value
+ this.taskForm.hospitalOut.department = this.departmentOptions[index].dictValue
+ },
+
+ // 杞叆鍖婚櫌绉戝閫夋嫨
+ onHospitalInDepartmentChange(e) {
+ const index = e.detail.value
+ this.taskForm.hospitalIn.department = this.departmentOptions[index].dictValue
+ },
+
+ // 鍔犺浇榛樿鍖婚櫌鍒楄〃锛堝墠100鏉★級
+ loadDefaultHospitals() {
+ // 浼犲叆绌哄瓧绗︿覆鎴栫壒娈婃爣璇嗚幏鍙栧墠100鏉�
+ searchHospitals('').then(response => {
+ this.defaultHospitals = response.data || []
+ // 鍚屾椂鍒濆鍖栦袱涓悳绱㈢粨鏋滀负榛樿鏁版嵁
+ this.hospitalOutResults = [...this.defaultHospitals]
+ this.hospitalInResults = [...this.defaultHospitals]
+ }).catch(error => {
+ console.error('鍔犺浇榛樿鍖婚櫌鍒楄〃澶辫触:', error)
+ this.defaultHospitals = []
+ })
+ },
+
+ // 杞嚭鍖婚櫌杈撳叆妗嗚幏寰楃劍鐐�
+ onHospitalOutFocus() {
+ // 濡傛灉娌℃湁鎼滅储鍏抽敭璇嶏紝鏄剧ず榛樿鐨�100鏉℃暟鎹�
+ if (!this.hospitalOutSearchKeyword || this.hospitalOutSearchKeyword.trim() === '') {
+ this.hospitalOutResults = [...this.defaultHospitals]
+ }
+ this.showHospitalOutResults = true
+ },
+
// 杞嚭鍖婚櫌鎼滅储
onHospitalOutSearch(e) {
const keyword = e.detail.value
@@ -569,11 +652,14 @@
clearTimeout(this.searchTimer)
}
+ // 濡傛灉鍏抽敭璇嶄负绌猴紝鏄剧ず榛樿100鏉�
if (!keyword || keyword.trim() === '') {
- this.hospitalOutResults = []
+ this.hospitalOutResults = [...this.defaultHospitals]
+ this.showHospitalOutResults = true
return
}
+ // 鏈夊叧閿瘝鏃讹紝鍘绘湇鍔$鎼滅储
this.searchTimer = setTimeout(() => {
this.searchHospitalOut(keyword)
}, 300)
@@ -610,6 +696,15 @@
}
},
+ // 杞叆鍖婚櫌杈撳叆妗嗚幏寰楃劍鐐�
+ onHospitalInFocus() {
+ // 濡傛灉娌℃湁鎼滅储鍏抽敭璇嶏紝鏄剧ず榛樿鐨�100鏉℃暟鎹�
+ if (!this.hospitalInSearchKeyword || this.hospitalInSearchKeyword.trim() === '') {
+ this.hospitalInResults = [...this.defaultHospitals]
+ }
+ this.showHospitalInResults = true
+ },
+
// 杞叆鍖婚櫌鎼滅储
onHospitalInSearch(e) {
const keyword = e.detail.value
@@ -620,11 +715,14 @@
clearTimeout(this.searchTimer)
}
+ // 濡傛灉鍏抽敭璇嶄负绌猴紝鏄剧ず榛樿100鏉�
if (!keyword || keyword.trim() === '') {
- this.hospitalInResults = []
+ this.hospitalInResults = [...this.defaultHospitals]
+ this.showHospitalInResults = true
return
}
+ // 鏈夊叧閿瘝鏃讹紝鍘绘湇鍔$鎼滅储
this.searchTimer = setTimeout(() => {
this.searchHospitalIn(keyword)
}, 300)
@@ -675,13 +773,17 @@
const deptId = this.currentUser.deptId
if (!deptId) {
console.error('鏃犳硶鑾峰彇褰撳墠鐢ㄦ埛鎵�鍦ㄩ儴闂�')
+ this.$modal.showToast('鏃犳硶鑾峰彇鎵�鍦ㄩ儴闂ㄤ俊鎭�')
return
}
- // 鏌ヨ褰撳墠閮ㄩ棬涓嬬殑鎵�鏈夌敤鎴凤紙鍙告満銆佹姢澹級
+ // 鐩存帴鏌ヨ褰撳墠鐢ㄦ埛閮ㄩ棬涓嬬殑鎵�鏈夌敤鎴�
+ // 鍚庣SQL浼氳嚜鍔ㄥ鐞嗭細濡傛灉浼犲叆鐨勬槸瀛愰儴闂紝浼氭煡鎵惧叾鎵�灞炵殑鍒嗗叕鍙稿強鍏舵墍鏈夊瓙閮ㄩ棬鐨勭敤鎴�
const queryParams = {
deptId: deptId,
- status: '0' // 鍙煡璇㈡甯哥姸鎬佺殑鐢ㄦ埛
+ status: '0', // 鍙煡璇㈡甯哥姸鎬佺殑鐢ㄦ埛
+ pageNum: 1,
+ pageSize: 10000 // 璁剧疆瓒冲澶х殑椤甸潰澶у皬锛岃幏鍙栨墍鏈夌敤鎴�
}
listUser(queryParams).then(response => {
@@ -822,7 +924,8 @@
// 鍒濆鍖栦复鏃堕�夋嫨鍒楄〃锛堝鍒跺綋鍓嶅凡閫夋嫨鐨勭梾鎯咃級
this.tempSelectedDiseases = [...this.selectedDiseases]
this.diseaseSearchKeyword = ''
- this.diseaseSearchResults = []
+ // 榛樿鍔犺浇鎵�鏈夌梾鎯�
+ this.loadAllDiseases()
this.$refs.diseasePopup.open()
},
@@ -844,14 +947,28 @@
clearTimeout(this.diseaseSearchTimer)
}
+ // 濡傛灉鍏抽敭璇嶄负绌猴紝鍔犺浇鎵�鏈夌梾鎯�
if (!keyword || keyword.trim() === '') {
- this.diseaseSearchResults = []
+ 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 = []
+ })
},
// 鏍规嵁鍏抽敭璇嶆悳绱㈢梾鎯�
@@ -991,7 +1108,9 @@
this.loading = false
this.$modal.showToast('浠诲姟鍒涘缓鎴愬姛')
setTimeout(() => {
- this.$tab.navigateTo('/pages/task/index')
+ uni.redirectTo({
+ url: '/pages/task/index'
+ })
}, 1500)
}).catch(error => {
this.loading = false
--
Gitblit v1.9.1