From f08739f46afe856f60ebb1d21ab23d72947629ed Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期日, 21 十二月 2025 00:03:12 +0800
Subject: [PATCH] feat:优化任务搜索查询 app

---
 app/pagesTask/edit-emergency.vue |  356 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 340 insertions(+), 16 deletions(-)

diff --git a/app/pagesTask/edit-emergency.vue b/app/pagesTask/edit-emergency.vue
index cb0d7dc..7911a84 100644
--- a/app/pagesTask/edit-emergency.vue
+++ b/app/pagesTask/edit-emergency.vue
@@ -19,7 +19,8 @@
       />
       
       <view class="form-item">
-        <OrganizationSelector 
+        <OrganizationSelector
+          ref="organizationSelector"
           v-model="selectedOrganizationId"
           :required="true"
           :auto-select-user-dept="false"
@@ -38,6 +39,26 @@
       />
       
       <view class="form-item">
+        <view class="form-label required">浠诲姟绫诲瀷</view>
+        <picker mode="selector" :range="emergencyTaskTypeOptions" range-key="text" @change="onEmergencyTaskTypeChange">
+          <view class="form-input picker-input">
+            {{ selectedEmergencyTaskType || '璇烽�夋嫨浠诲姟绫诲瀷' }}
+            <uni-icons type="arrowright" size="16" color="#999"></uni-icons>
+          </view>
+        </picker>
+      </view>
+      
+      <view class="form-item">
+        <view class="form-label required">鍗曟嵁绫诲瀷</view>
+        <picker mode="selector" :range="documentTypeOptions" range-key="text" @change="onDocumentTypeChange">
+          <view class="form-input picker-input">
+            {{ selectedDocumentType || '璇烽�夋嫨鍗曟嵁绫诲瀷' }}
+            <uni-icons type="arrowright" size="16" color="#999"></uni-icons>
+          </view>
+        </picker>
+      </view>
+      
+      <view class="form-item">
         <view class="form-label required">杞繍鏃堕棿</view>
         <uni-datetime-picker 
           v-model="taskForm.transferTime" 
@@ -53,6 +74,7 @@
         :required="false"
         :auto-add-current-user="false"
         :current-user-removable="true"
+        :branch-dept-ids="allOrganizationIds"
         @change="onStaffChange"
       />
       
@@ -117,25 +139,61 @@
       
       <view class="form-section-title">杞嚭鍖婚櫌淇℃伅</view>
       <HospitalSelector
-        label="鍖洪櫌鍚嶇О"
+        label="鍖婚櫌鍚嶇О"
         address-label="杞嚭鍦板潃"
         :required="true"
+        :show-department="false"
         v-model="taskForm.hospitalOut"
         :dept-id="selectedOrganizationId"
         @change="onHospitalOutChange"
         @address-selected="onHospitalOutAddressSelected"
       />
+      <DepartmentSelector
+        label="杞嚭绉戝"
+        :required="true"
+        v-model="taskForm.hospitalOut.department"
+        :department-id="taskForm.hospitalOut.departmentId"
+        :is-home="taskForm.hospitalOut.name === '瀹朵腑'"
+        @change="onHospitalOutDepartmentChange"
+      />
+      
+      <view class="form-item">
+        <view class="form-label">搴婂彿</view>
+        <input 
+          class="form-input" 
+          placeholder="璇疯緭鍏ュ簥鍙�" 
+          v-model="taskForm.hospitalOut.bedNumber"
+        />
+      </view>
       
       <view class="form-section-title">杞叆鍖婚櫌淇℃伅</view>
       <HospitalSelector
         label="鍖婚櫌鍚嶇О"
         address-label="杞叆鍦板潃"
         :required="true"
+        :show-department="false"
         v-model="taskForm.hospitalIn"
         :dept-id="selectedOrganizationId"
         @change="onHospitalInChange"
         @address-selected="onHospitalInAddressSelected"
       />
+      <DepartmentSelector
+        label="杞叆绉戝"
+        :required="true"
+        v-model="taskForm.hospitalIn.department"
+        :department-id="taskForm.hospitalIn.departmentId"
+        :is-home="taskForm.hospitalIn.name === '瀹朵腑'"
+        @change="onHospitalInDepartmentChange"
+      />
+      
+      <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>
@@ -193,8 +251,9 @@
 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 { getTask, updateTask } from "@/api/task"
-import { baiduDistanceByAddress } from "@/api/map"
+import { tiandituDistanceByAddress } from "@/api/map"
 import { calculateTransferPrice } from "@/api/price"
+import { getServiceOrdAreaTypes, getServiceOrderTypes } from "@/api/dictionary"
 import MapSelector from './components/map-selector.vue'
 import VehicleSelector from './components/VehicleSelector.vue'
 import OrganizationSelector from './components/OrganizationSelector.vue'
@@ -202,6 +261,7 @@
 import DiseaseSelector from './components/DiseaseSelector.vue'
 import DepartureSelector from './components/DepartureSelector.vue'
 import StaffSelector from './components/StaffSelector.vue'
+import DepartmentSelector from './components/DepartmentSelector.vue'
 import distanceCalculator from '@/mixins/distanceCalculator.js'
 
 export default {
@@ -214,7 +274,8 @@
     HospitalSelector,
     DiseaseSelector,
     DepartureSelector,
-    StaffSelector
+    StaffSelector,
+    DepartmentSelector
   },
   mixins: [distanceCalculator],
   data() {
@@ -224,6 +285,7 @@
       taskDetail: null,
       selectedVehicleId: null,
       selectedOrganizationId: null,
+      allOrganizationIds: [], // 鎵�鏈夊彲閫夋満鏋処D鏁扮粍
       selectedRegion: '',
       mapSelectorType: '',
       // 鎵╁睍 addressCoordinates 鏀寔澶氱閿悕
@@ -239,6 +301,17 @@
       departureLatitude: null,
       selectedDiseases: [], // 宸查�夋嫨鐨勭梾鎯呭垪琛紙纭繚鍒濆鍖栦负绌烘暟缁勶級
       selectedStaff: [], // 宸查�夋嫨鐨勪汉鍛樺垪琛紙纭繚鍒濆鍖栦负绌烘暟缁勶級
+      // 浠诲姟绫诲瀷鍜屽崟鎹被鍨嬬浉鍏�
+      selectedEmergencyTaskType: '', // 閫変腑鐨勪换鍔$被鍨嬫枃鏈�
+      selectedEmergencyTaskTypeId: null, // 閫変腑鐨勪换鍔$被鍨婭D
+      selectedDocumentType: '', // 閫変腑鐨勫崟鎹被鍨嬫枃鏈�
+      selectedDocumentTypeId: null, // 閫変腑鐨勫崟鎹被鍨婭D
+      pendingTaskTypeId: null, // 绛夊緟璁剧疆鐨勪换鍔$被鍨婭D
+      pendingDocumentTypeId: null, // 绛夊緟璁剧疆鐨勫崟鎹被鍨婭D
+      emergencyTaskTypes: [], // 浠诲姟绫诲瀷鍒楄〃锛堜粠 SQL Server 鍔ㄦ�佸姞杞斤級
+      emergencyTaskTypeOptions: [], // 浠诲姟绫诲瀷閫夐」锛堢敤浜巔icker鏄剧ず锛�
+      documentTypes: [], // 鍗曟嵁绫诲瀷鍒楄〃
+      documentTypeOptions: [], // 鍗曟嵁绫诲瀷閫夐」锛堢敤浜巔icker鏄剧ず锛�
       taskForm: {
         transferTime: '',
         patient: {
@@ -285,12 +358,21 @@
     if (options.id) {
       this.taskId = options.id
       this.loadTaskDetail()
+      // 鍔犺浇浠诲姟绫诲瀷鏁版嵁
+      this.loadEmergencyTaskTypes()
+      // 鍔犺浇鍗曟嵁绫诲瀷鏁版嵁
+      this.loadDocumentTypes()
     } else {
       this.$modal.showToast('浠诲姟ID涓嶈兘涓虹┖')
       setTimeout(() => {
         uni.navigateBack()
       }, 1500)
     }
+  },
+  
+  mounted() {
+    // 椤甸潰鎸傝浇鍚庡姞杞芥墍鏈夋満鏋処D
+    this.loadAllOrganizationIds()
   },
   methods: {
     // 鍔犺浇浠诲姟璇︽儏
@@ -320,8 +402,9 @@
           const info = this.taskDetail.emergencyInfo
           console.log('杞繍浠诲姟淇℃伅:', info)
           
-          // 杞繍鏃堕棿
-          this.taskForm.transferTime = this.taskDetail.plannedStartTime || ''
+          // 杞繍鏃堕棿锛堜慨澶嶏細1900骞寸殑鏃ユ湡鏄剧ず涓虹┖锛�
+          const transferTime = this.taskDetail.plannedStartTime || ''
+          this.taskForm.transferTime = transferTime && transferTime.startsWith('1900') ? '' : transferTime
           
           // 鎮h�呬俊鎭�
           this.taskForm.patient.contact = info.patientContact || ''
@@ -373,10 +456,36 @@
           // 杞繍璺濈鍜屼环鏍�
           this.taskForm.transferDistance = info.transferDistance ? String(info.transferDistance) : ''
           this.taskForm.price = info.transferPrice ? String(info.transferPrice) : ''
+          
+          // 浠诲姟绫诲瀷鍜屽崟鎹被鍨�
+          if (info.taskTypeId) {
+            // 鐩存帴璁剧疆浠诲姟绫诲瀷锛屽鏋滈�夐」杩樻湭鍔犺浇瀹屾垚锛屽垯鍦ㄥ姞杞藉畬鎴愬悗鍐嶆璁剧疆
+            const taskType = this.emergencyTaskTypeOptions.find(option => option.id == info.taskTypeId)
+            if (taskType) {
+              this.selectedEmergencyTaskType = taskType.text
+              this.selectedEmergencyTaskTypeId = taskType.id
+            } else {
+              // 濡傛灉閫夐」杩樻湭鍔犺浇瀹屾垚锛屾爣璁伴渶瑕佽缃殑ID
+              this.pendingTaskTypeId = info.taskTypeId
+            }
+          }
+          
+          if (info.documentTypeId) {
+            // 鐩存帴璁剧疆鍗曟嵁绫诲瀷锛屽鏋滈�夐」杩樻湭鍔犺浇瀹屾垚锛屽垯鍦ㄥ姞杞藉畬鎴愬悗鍐嶆璁剧疆
+            const docType = this.documentTypeOptions.find(option => option.id == info.documentTypeId)
+            if (docType) {
+              this.selectedDocumentType = docType.text
+              this.selectedDocumentTypeId = docType.id
+            } else {
+              // 濡傛灉閫夐」杩樻湭鍔犺浇瀹屾垚锛屾爣璁伴渶瑕佽缃殑ID
+              this.pendingDocumentTypeId = info.documentTypeId
+            }
+          }
         } else {
           console.warn('浠诲姟璇︽儏涓病鏈塭mergencyInfo瀛楁锛屽皾璇曚粠涓诲璞¤幏鍙栨暟鎹�')
           // 鍏煎澶勭悊锛氬鏋渆mergencyInfo涓嶅瓨鍦紝灏濊瘯浠庝富瀵硅薄鑾峰彇
-          this.taskForm.transferTime = this.taskDetail.plannedStartTime || ''
+          const transferTime = this.taskDetail.plannedStartTime || ''
+          this.taskForm.transferTime = transferTime && transferTime.startsWith('1900') ? '' : transferTime
           this.taskForm.transferDistance = this.taskDetail.estimatedDistance ? String(this.taskDetail.estimatedDistance) : ''
         }
         
@@ -421,16 +530,24 @@
           console.log('璁剧疆鐩爣鍦板潗鏍�:', this.taskDetail.destinationLongitude, this.taskDetail.destinationLatitude)
         }
         
-        // 璁剧疆鎵ц浜哄憳锛堜慨澶嶏細纭繚 assignees 涓嶄负 null锛�
+        // 璁剧疆鎵ц浜哄憳锛堜慨澶嶏細纭繚 assignees 涓嶄负 null锛屽苟姝g‘鏄犲皠瀛楁锛�
         if (this.taskDetail.assignees && Array.isArray(this.taskDetail.assignees) && this.taskDetail.assignees.length > 0) {
           console.log('鍘熷鎵ц浜哄憳鏁版嵁:', this.taskDetail.assignees)
-          this.selectedStaff = this.taskDetail.assignees.map(assignee => ({
-            userId: assignee.userId,
-            nickName: assignee.userName,
-            type: assignee.userType || 'driver',
-            phonenumber: '',
-            deptName: ''
-          }))
+          this.selectedStaff = this.taskDetail.assignees.map(assignee => {
+            console.log('澶勭悊鎵ц浜哄憳:', assignee)
+            console.log('  - userName:', assignee.userName)
+            console.log('  - nickName:', assignee.nickName)
+            console.log('  - phonenumber:', assignee.phonenumber)
+            console.log('  - phone:', assignee.phone)
+            
+            return {
+              userId: assignee.userId,
+              nickName: assignee.userName || assignee.nickName || '',
+              type: assignee.userType || 'driver',
+              phonenumber: assignee.phonenumber || assignee.phone || '',
+              deptName: assignee.deptName || ''
+            }
+          })
           console.log('澶勭悊鍚庣殑鎵ц浜哄憳鍒楄〃:', this.selectedStaff)
         } else {
           console.warn('浠诲姟娌℃湁鍒嗛厤鎵ц浜哄憳鎴朼ssignees涓虹┖')
@@ -453,6 +570,109 @@
     // 杞﹁締閫夋嫨鍙樺寲
     onVehicleChange(vehicle) {
       console.log('閫変腑杞﹁締:', vehicle)
+    },
+    
+    // 鍔犺浇浠诲姟绫诲瀷鏁版嵁锛堜粠 SQL Server锛�
+    loadEmergencyTaskTypes() {
+      getServiceOrderTypes().then(response => {
+        const list = response.data || []
+        this.emergencyTaskTypes = list
+        this.emergencyTaskTypeOptions = list.map(item => ({
+          id: item.vID,
+          text: item.vtext
+        }))
+        
+        // 濡傛灉浠诲姟璇︽儏宸插姞杞斤紝璁剧疆褰撳墠閫変腑鐨勪换鍔$被鍨�
+        if (this.taskDetail && this.taskDetail.emergencyInfo && this.taskDetail.emergencyInfo.taskTypeId) {
+          const currentType = this.emergencyTaskTypeOptions.find(option => option.id == this.taskDetail.emergencyInfo.taskTypeId)
+          if (currentType) {
+            this.selectedEmergencyTaskType = currentType.text
+            this.selectedEmergencyTaskTypeId = currentType.id
+          }
+        }
+        
+        // 妫�鏌ユ槸鍚︽湁寰呰缃殑浠诲姟绫诲瀷ID
+        if (this.pendingTaskTypeId) {
+          const pendingType = this.emergencyTaskTypeOptions.find(option => option.id == this.pendingTaskTypeId)
+          if (pendingType) {
+            this.selectedEmergencyTaskType = pendingType.text
+            this.selectedEmergencyTaskTypeId = pendingType.id
+            this.pendingTaskTypeId = null
+          }
+        }
+      }).catch(error => {
+        console.error('鍔犺浇浠诲姟绫诲瀷澶辫触:', error)
+        this.emergencyTaskTypes = []
+        this.emergencyTaskTypeOptions = []
+      })
+    },
+    
+    // 浠诲姟绫诲瀷閫夋嫨
+    onEmergencyTaskTypeChange(e) {
+      const index = e.detail.value
+      const selected = this.emergencyTaskTypeOptions[index]
+      this.selectedEmergencyTaskType = selected.text
+      this.selectedEmergencyTaskTypeId = selected.id
+    },
+    
+    // 鍔犺浇鍗曟嵁绫诲瀷鏁版嵁
+    loadDocumentTypes() {
+      getServiceOrdAreaTypes().then(response => {
+        const list = response.data || []
+        this.documentTypes = list
+        this.documentTypeOptions = list.map(item => ({
+          id: item.vID,
+          text: item.vtext
+        }))
+        
+        // 濡傛灉浠诲姟璇︽儏宸插姞杞斤紝璁剧疆褰撳墠閫変腑鐨勫崟鎹被鍨�
+        if (this.taskDetail && this.taskDetail.emergencyInfo && this.taskDetail.emergencyInfo.documentTypeId) {
+          const currentType = this.documentTypeOptions.find(option => option.id == this.taskDetail.emergencyInfo.documentTypeId)
+          if (currentType) {
+            this.selectedDocumentType = currentType.text
+            this.selectedDocumentTypeId = currentType.id
+          }
+        }
+        
+        // 妫�鏌ユ槸鍚︽湁寰呰缃殑鍗曟嵁绫诲瀷ID
+        if (this.pendingDocumentTypeId) {
+          const pendingType = this.documentTypeOptions.find(option => option.id == this.pendingDocumentTypeId)
+          if (pendingType) {
+            this.selectedDocumentType = pendingType.text
+            this.selectedDocumentTypeId = pendingType.id
+            this.pendingDocumentTypeId = null
+          }
+        }
+      }).catch(error => {
+        console.error('鍔犺浇鍗曟嵁绫诲瀷澶辫触:', error)
+        this.documentTypes = []
+        this.documentTypeOptions = []
+      })
+    },
+    
+    // 鍗曟嵁绫诲瀷閫夋嫨
+    onDocumentTypeChange(e) {
+      const index = e.detail.value
+      const selected = this.documentTypeOptions[index]
+      this.selectedDocumentType = selected.text
+      this.selectedDocumentTypeId = selected.id
+    },
+    
+    // 鍔犺浇鎵�鏈夋満鏋処D
+    loadAllOrganizationIds() {
+      // 閫氳繃 OrganizationSelector 缁勪欢鑾峰彇鎵�鏈夋満鏋�
+      const orgSelector = this.$refs.organizationSelector
+      if (orgSelector) {
+        orgSelector.reload().then(organizations => {
+          this.allOrganizationIds = organizations.map(org => org.deptId)
+          console.log('鎵�鏈夋満鏋処D:', this.allOrganizationIds)
+        })
+      } else {
+        // 濡傛灉缁勪欢杩樻湭鎸傝浇,绋嶅悗閲嶈瘯
+        setTimeout(() => {
+          this.loadAllOrganizationIds()
+        }, 100)
+      }
     },
     
     // 褰掑睘鏈烘瀯閫夋嫨鍙樺寲
@@ -491,6 +711,13 @@
       console.log('杞嚭鍖婚櫌鍙樺寲:', hospitalData)
       // 缁勪欢宸茬粡閫氳繃 v-model 鏇存柊浜� taskForm.hospitalOut
       
+      // 濡傛灉閫夋嫨鐨勬槸"瀹朵腑"锛岃嚜鍔ㄨ缃瀹や负"鍏跺畠"
+      if (hospitalData.name === '瀹朵腑') {
+        this.taskForm.hospitalOut.department = '鍏跺畠'
+        this.taskForm.hospitalOut.departmentId = null
+      }
+      // 娉ㄦ剰锛氶�夋嫨鏂扮殑鍖婚櫌鏃讹紝涓嶈嚜鍔ㄦ洿鏂扮瀹や俊鎭紝淇濇寔鐢ㄦ埛宸查�夋嫨鐨勭瀹�
+      
       // 濡傛灉杞叆鍦板潃宸插~鍐�,鑷姩璁$畻璺濈
       if (this.taskForm.hospitalIn.address) {
         // 濡傛灉涓や釜閮戒笉鏄�"瀹朵腑",浣跨敤鍖婚櫌璺濈璁$畻
@@ -515,6 +742,13 @@
       console.log('杞叆鍖婚櫌鍙樺寲:', hospitalData)
       // 缁勪欢宸茬粡閫氳繃 v-model 鏇存柊浜� taskForm.hospitalIn
       
+      // 濡傛灉閫夋嫨鐨勬槸"瀹朵腑"锛岃嚜鍔ㄨ缃瀹や负"鍏跺畠"
+      if (hospitalData.name === '瀹朵腑') {
+        this.taskForm.hospitalIn.department = '鍏跺畠'
+        this.taskForm.hospitalIn.departmentId = null
+      }
+      // 娉ㄦ剰锛氶�夋嫨鏂扮殑鍖婚櫌鏃讹紝涓嶈嚜鍔ㄦ洿鏂扮瀹や俊鎭紝淇濇寔鐢ㄦ埛宸查�夋嫨鐨勭瀹�
+      
       // 濡傛灉杞嚭鍦板潃宸插~鍐�,鑷姩璁$畻璺濈
       if (this.taskForm.hospitalOut.address) {
         // 濡傛灉涓や釜閮戒笉鏄�"瀹朵腑",浣跨敤鍖婚櫌璺濈璁$畻
@@ -531,6 +765,30 @@
     onHospitalInAddressSelected(data) {
       if (this.taskForm.hospitalOut.address) {
         this.calculateDistanceByManualAddress()
+      }
+    },
+    
+    // 杞嚭绉戝鍙樺寲
+    onHospitalOutDepartmentChange(data) {
+      console.log('杞嚭绉戝鍙樺寲:', data)
+      if (data && typeof data === 'object') {
+        this.taskForm.hospitalOut.department = data.department
+        this.taskForm.hospitalOut.departmentId = data.departmentId
+      } else {
+        this.taskForm.hospitalOut.department = data
+        this.taskForm.hospitalOut.departmentId = null
+      }
+    },
+    
+    // 杞叆绉戝鍙樺寲
+    onHospitalInDepartmentChange(data) {
+      console.log('杞叆绉戝鍙樺寲:', data)
+      if (data && typeof data === 'object') {
+        this.taskForm.hospitalIn.department = data.department
+        this.taskForm.hospitalIn.departmentId = data.departmentId
+      } else {
+        this.taskForm.hospitalIn.department = data
+        this.taskForm.hospitalIn.departmentId = null
       }
     },
     
@@ -704,6 +962,16 @@
         return false
       }
       
+      if (!this.selectedEmergencyTaskType) {
+        this.$modal.showToast('璇烽�夋嫨浠诲姟绫诲瀷')
+        return false
+      }
+      
+      if (!this.selectedDocumentType) {
+        this.$modal.showToast('璇烽�夋嫨鍗曟嵁绫诲瀷')
+        return false
+      }
+      
       if (!this.taskForm.patient.contact) {
         this.$modal.showToast('璇疯緭鍏ヨ仈绯讳汉')
         return false
@@ -719,6 +987,12 @@
         return false
       }
       
+      // 楠岃瘉鑱旂郴鐢佃瘽鏍煎紡
+      if (this.taskForm.patient.phone && !/^1[3-9]\d{9}$/.test(this.taskForm.patient.phone)) {
+        this.$modal.showToast('璇疯緭鍏ユ纭殑鎵嬫満鍙风爜')
+        return false
+      }
+      
       if (!this.taskForm.hospitalOut.name) {
         this.$modal.showToast('璇疯緭鍏ヨ浆鍑哄尰闄㈠悕绉�')
         return false
@@ -729,6 +1003,11 @@
         return false
       }
       
+      if (!this.taskForm.hospitalOut.department) {
+        this.$modal.showToast('璇烽�夋嫨杞嚭绉戝')
+        return false
+      }
+      
       if (!this.taskForm.hospitalIn.name) {
         this.$modal.showToast('璇疯緭鍏ヨ浆鍏ュ尰闄㈠悕绉�')
         return false
@@ -736,6 +1015,46 @@
       
       if (!this.taskForm.hospitalIn.address) {
         this.$modal.showToast('璇烽�夋嫨杞叆鍖婚櫌鍦板潃')
+        return false
+      }
+      
+      if (!this.taskForm.hospitalIn.department) {
+        this.$modal.showToast('璇烽�夋嫨杞叆绉戝')
+        return false
+      }
+      
+      // 楠岃瘉鎴愪氦浠峰繀濉�
+      if (!this.taskForm.price || this.taskForm.price.trim() === '') {
+        this.$modal.showToast('璇疯緭鍏ユ垚浜や环')
+        return false
+      }
+      
+      // 楠岃瘉鎴愪氦浠锋牸寮忥紙蹇呴』鏄暟瀛楋級
+      if (isNaN(this.taskForm.price) || parseFloat(this.taskForm.price) < 0) {
+        this.$modal.showToast('璇疯緭鍏ユ湁鏁堢殑鎴愪氦浠�')
+        return false
+      }
+      
+      // 楠岃瘉鎮h�呰韩浠借瘉鏍煎紡锛堝鏋滃~鍐欎簡锛�
+      if (this.taskForm.patient.idCard && this.taskForm.patient.idCard.trim() !== '') {
+        const idCard = this.taskForm.patient.idCard.trim()
+        // 绠�鍗曢獙璇�18浣嶈韩浠借瘉
+        if (!/^\d{17}[\dXx]$/.test(idCard)) {
+          this.$modal.showToast('璇疯緭鍏ユ纭殑18浣嶈韩浠借瘉鍙风爜')
+          return false
+        }
+      }
+      
+      // 楠岃瘉鐥呮儏鑷冲皯閫夋嫨涓�椤规垨濉啓鍏朵粬鎻忚堪
+      if ((!this.selectedDiseases || this.selectedDiseases.length === 0) && 
+          (!this.taskForm.patient.otherCondition || this.taskForm.patient.otherCondition.trim() === '')) {
+        this.$modal.showToast('璇烽�夋嫨鐥呮儏鎴栧~鍐欏叾浠栫梾鎯呮弿杩�')
+        return false
+      }
+      
+      // 楠岃瘉鎵ц浜哄憳鑷冲皯閫夋嫨涓�涓�
+      if (!this.selectedStaff || this.selectedStaff.length === 0) {
+        this.$modal.showToast('璇疯嚦灏戦�夋嫨涓�涓墽琛屼汉鍛�')
         return false
       }
       
@@ -778,6 +1097,9 @@
         deptId: this.selectedOrganizationId,
         vehicleIds: this.selectedVehicleId ? [this.selectedVehicleId] : [],
         plannedStartTime: this.taskForm.transferTime,
+        // 浠诲姟绫诲瀷鍜屽崟鎹被鍨�
+        taskTypeId: this.selectedEmergencyTaskTypeId,
+        documentTypeId: this.selectedDocumentTypeId,
         
         // 鍑哄彂鍦板湴鍧�鍜屽潗鏍囷紙浣跨敤杞嚭鍖婚櫌鍦板潃锛�
         departureAddress: this.departureAddress || this.taskForm.hospitalOut.address,
@@ -901,7 +1223,8 @@
       
       // 璋冪敤鐧惧害鍦板浘API璁$畻璺濈
       const region = this.selectedRegion || '骞垮窞'
-      baiduDistanceByAddress(fromAddress, region, toAddress, region)
+      //baiduDistanceByAddress(fromAddress, region, toAddress, region)
+      tiandituDistanceByAddress(fromAddress,toAddress)
         .then(response => {
           uni.hideLoading()
           
@@ -1015,6 +1338,7 @@
     }
   }
 }
+
 </script>
 
 <style lang="scss" scoped>

--
Gitblit v1.9.1