wlzboy
7 小时以前 5f2ee03958a1a16dc27195c76ea7cffb422c95d1
app/pagesTask/edit-emergency.vue
@@ -231,7 +231,7 @@
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 MapSelector from './components/map-selector.vue'
import VehicleSelector from './components/VehicleSelector.vue'
@@ -569,6 +569,7 @@
        this.taskForm.hospitalOut.department = '其它'
        this.taskForm.hospitalOut.departmentId = null
      }
      // 注意:选择新的医院时,不自动更新科室信息,保持用户已选择的科室
      
      // 如果转入地址已填写,自动计算距离
      if (this.taskForm.hospitalIn.address) {
@@ -599,6 +600,7 @@
        this.taskForm.hospitalIn.department = '其它'
        this.taskForm.hospitalIn.departmentId = null
      }
      // 注意:选择新的医院时,不自动更新科室信息,保持用户已选择的科室
      
      // 如果转出地址已填写,自动计算距离
      if (this.taskForm.hospitalOut.address) {
@@ -621,6 +623,7 @@
    
    // 转出科室变化
    onHospitalOutDepartmentChange(data) {
      console.log('转出科室变化:', data)
      if (data && typeof data === 'object') {
        this.taskForm.hospitalOut.department = data.department
        this.taskForm.hospitalOut.departmentId = data.departmentId
@@ -632,6 +635,7 @@
    
    // 转入科室变化
    onHospitalInDepartmentChange(data) {
      console.log('转入科室变化:', data)
      if (data && typeof data === 'object') {
        this.taskForm.hospitalIn.department = data.department
        this.taskForm.hospitalIn.departmentId = data.departmentId
@@ -826,6 +830,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
@@ -836,6 +846,11 @@
        return false
      }
      
      if (!this.taskForm.hospitalOut.department) {
        this.$modal.showToast('请选择转出科室')
        return false
      }
      if (!this.taskForm.hospitalIn.name) {
        this.$modal.showToast('请输入转入医院名称')
        return false
@@ -843,6 +858,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
      }
      // 验证患者身份证格式(如果填写了)
      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
      }
      
@@ -1008,7 +1063,8 @@
      
      // 调用百度地图API计算距离
      const region = this.selectedRegion || '广州'
      baiduDistanceByAddress(fromAddress, region, toAddress, region)
      //baiduDistanceByAddress(fromAddress, region, toAddress, region)
      tiandituDistanceByAddress(fromAddress,toAddress)
        .then(response => {
          uni.hideLoading()
          
@@ -1333,5 +1389,4 @@
      }
    }
  }
}
</style>
}