| | |
| | | type="digit" |
| | | placeholder="请输入转运公里数" |
| | | v-model="taskForm.transferDistance" |
| | | @blur="onDistanceChange" |
| | | /> |
| | | </view> |
| | | |
| | |
| | | import { listAvailableVehicles, getUserBoundVehicle } from "@/api/vehicle" |
| | | import { calculateDistance, baiduDistanceByAddress, baiduPlaceSuggestion } from "@/api/map" |
| | | import { searchHospitals, getFrequentOutHospitals, getFrequentInHospitals, searchHospitalsByDeptRegion } from "@/api/hospital" |
| | | import { listUser } from "@/api/system/user" |
| | | import { listBranchUsers } from "@/api/system/user" |
| | | import { searchIcd10 } from "@/api/icd10" |
| | | import { calculateTransferPrice } from "@/api/price" |
| | | import { checkVehicleActiveTasks } from "@/api/task" |
| | | |
| | | import { getDicts } from "@/api/dict" |
| | | import { getServiceOrdAreaTypes, getServiceOrderTypes, getHospitalDepartments } from "@/api/dictionary" |
| | |
| | | switch(staffType){ |
| | | case "nurse": |
| | | return "护士"; |
| | | case "doctor": |
| | | case "doctor": |
| | | return "医生"; |
| | | case "driver": |
| | | return "司机"; |
| | |
| | | |
| | | // 加载当前用户所在分公司的所有人员 |
| | | loadDeptStaff() { |
| | | const deptId = this.currentUser.deptId |
| | | if (!deptId) { |
| | | console.error('无法获取当前用户所在部门') |
| | | this.$modal.showToast('无法获取所在部门信息') |
| | | return |
| | | } |
| | | console.log('开始加载人员列表') |
| | | |
| | | // 直接查询当前用户部门下的所有用户 |
| | | // 后端SQL会自动处理:如果传入的是子部门,会查找其所属的分公司及其所有子部门的用户 |
| | | const queryParams = { |
| | | deptId: deptId, |
| | | status: '0', // 只查询正常状态的用户 |
| | | pageNum: 1, |
| | | pageSize: 10000 // 设置足够大的页面大小,获取所有用户 |
| | | } |
| | | |
| | | listUser(queryParams).then(response => { |
| | | const userList = response.rows || response.data || [] |
| | | // 调用新接口,自动根据当前用户的oaOrderClass获取分公司下的用户 |
| | | listBranchUsers().then(response => { |
| | | console.log('人员列表API响应:', response) |
| | | const userList = response.data || [] |
| | | console.log('解析出的用户列表:', userList, '数量:', userList.length) |
| | | |
| | | this.allStaffList = userList.map(user => ({ |
| | | userId: user.userId, |
| | | nickName: user.nickName, |
| | |
| | | // 根据岗位名称或角色名称判断类型 |
| | | type: this.getUserType(user) |
| | | })) |
| | | |
| | | console.log('处理后的人员列表:', this.allStaffList, '数量:', this.allStaffList.length) |
| | | |
| | | // 初始化过滤列表 |
| | | this.filterStaffList() |
| | |
| | | if (postName.includes('司机') || roleName.includes('司机') || deptName.includes('车队') || deptName.includes('司机')) { |
| | | return 'driver' |
| | | } |
| | | // 判断是否为医生 |
| | | if (postName.includes('医生') || roleName.includes('医生') || deptName.includes('医生')) { |
| | | return 'doctor' |
| | | } |
| | | // 判断是否为护士 |
| | | if (postName.includes('护士') || roleName.includes('护士') || deptName.includes('护士')) { |
| | | return 'nurse' |
| | | } |
| | | // 判断是否为医生 |
| | | if (postName.includes('医生') || roleName.includes('医生') || deptName.includes('医生') ) { |
| | | return 'doctor' |
| | | } |
| | | if( deptName.includes("医护")){ |
| | | return 'doctor' |
| | | } |
| | | |
| | | // 其他类型,默认为司机 |
| | | return 'driver' |
| | | }, |
| | |
| | | |
| | | // 过滤人员列表 |
| | | filterStaffList() { |
| | | console.log('开始过滤人员列表,原始数量:', this.allStaffList.length) |
| | | let list = [...this.allStaffList] |
| | | |
| | | // 按类型过滤 |
| | |
| | | list = list.filter(staff => staff.type === 'nurse') |
| | | } |
| | | |
| | | console.log('按类型过滤后:', this.staffFilterType, '数量:', list.length) |
| | | |
| | | // 按关键词搜索 |
| | | if (this.staffSearchKeyword && this.staffSearchKeyword.trim() !== '') { |
| | | const keyword = this.staffSearchKeyword.trim().toLowerCase() |
| | |
| | | }) |
| | | } |
| | | |
| | | console.log('按关键词过滤后,数量:', list.length) |
| | | |
| | | this.filteredStaffList = list |
| | | console.log('最终过滤结果:', this.filteredStaffList) |
| | | }, |
| | | |
| | | // 切换人员选中状态 |
| | |
| | | |
| | | console.log('距离计算成功:', distanceInKm, 'km') |
| | | this.$modal.showToast(`距离: ${distanceInKm}公里`) |
| | | |
| | | // 距离计算成功后,自动计算成交价 |
| | | this.calculatePrice() |
| | | } else { |
| | | console.error('距离计算失败:', response.msg) |
| | | this.$modal.showToast('距离计算失败,请手动输入') |
| | |
| | | console.error('距离计算失败:', error) |
| | | this.$modal.showToast('距离计算失败,请手动输入') |
| | | }) |
| | | }, |
| | | |
| | | // 距离输入框失焦时触发成交价计算 |
| | | onDistanceChange() { |
| | | this.calculatePrice() |
| | | }, |
| | | |
| | | // 计算成交价 |
| | | calculatePrice() { |
| | | const fromAddress = this.taskForm.hospitalOut.address |
| | | const toAddress = this.taskForm.hospitalIn.address |
| | | const distance = this.taskForm.transferDistance |
| | | |
| | | // 如果地址或距离不完整,不进行计算 |
| | | if (!fromAddress || !toAddress || !distance || parseFloat(distance) <= 0) { |
| | | console.log('地址或距离信息不完整,跳过成交价计算') |
| | | return |
| | | } |
| | | |
| | | console.log('开始计算成交价:', fromAddress, '->', toAddress, '距离:', distance) |
| | | |
| | | // 调用成交价计算接口 |
| | | calculateTransferPrice({ |
| | | fromAddress: fromAddress, |
| | | toAddress: toAddress, |
| | | distance: parseFloat(distance), |
| | | region: this.selectedRegion || '' |
| | | }).then(response => { |
| | | if (response.code === 200 && response.data) { |
| | | const price = response.data.price |
| | | |
| | | // 只有当返回的价格大于0时,才自动填充成交价 |
| | | if (price && price > 0) { |
| | | this.taskForm.price = price.toFixed(2) |
| | | console.log('成交价计算成功:', price) |
| | | this.$modal.showToast(`成交价: ¥${price.toFixed(2)}`) |
| | | } else { |
| | | console.log('成交价为0,不自动填充') |
| | | } |
| | | } else { |
| | | console.log('成交价计算失败,保持手动输入') |
| | | } |
| | | }).catch(error => { |
| | | console.error('成交价计算失败:', error) |
| | | // 计算失败时不提示用户,允许用户手动输入 |
| | | }) |
| | | }, |
| | | |
| | | // ==================== 病情选择相关方法 ==================== |
| | |
| | | |
| | | console.log('距离计算成功:', distanceInKm, 'km') |
| | | // this.$modal.showToast(`距离计算成功: ${distanceInKm}公里`) |
| | | |
| | | // 距离计算成功后,自动计算成交价 |
| | | this.calculatePrice() |
| | | } else { |
| | | console.error('距离计算失败:', response.msg) |
| | | this.$modal.showToast('距离计算失败,请手动输入') |