| | |
| | | |
| | | getAvailableVehicles() { |
| | | // 根据用户有权限管理的分公司,查询所有可用车辆 |
| | | listAvailableVehicles(null, 'EMERGENCY').then(response => { |
| | | return listAvailableVehicles(null, 'EMERGENCY').then(response => { |
| | | const vehicleList = response.data || [] |
| | | this.vehicleOptions = vehicleList.map(vehicle => ({ |
| | | id: vehicle.vehicleId, |
| | |
| | | status: vehicle.status, |
| | | deptNames: vehicle.deptNames || [] // 车辆归属的多个分公司 |
| | | })) |
| | | this.vehicles = this.vehicleOptions.map(v => { |
| | | // 如果车辆归属多个分公司,在车牌号后面显示 |
| | | if (v.deptNames && v.deptNames.length > 0) { |
| | | return `${v.name} (${v.deptNames.join('、')})` |
| | | } |
| | | return v.name |
| | | }) |
| | | // 只显示车牌号,不显示分公司 |
| | | this.vehicles = this.vehicleOptions.map(v => v.name) |
| | | console.log('加载可用车辆数量:', this.vehicles.length) |
| | | }).catch(error => { |
| | | console.error('加载车辆列表失败:', error) |