| | |
| | | /> |
| | | |
| | | <view class="form-item"> |
| | | <OrganizationSelector |
| | | <OrganizationSelector |
| | | ref="organizationSelector" |
| | | v-model="selectedOrganizationId" |
| | | :required="true" |
| | | :auto-select-user-dept="false" |
| | |
| | | :required="false" |
| | | :auto-add-current-user="false" |
| | | :current-user-removable="true" |
| | | :branch-dept-ids="allOrganizationIds" |
| | | @change="onStaffChange" |
| | | /> |
| | | |
| | |
| | | taskDetail: null, |
| | | selectedVehicleId: null, |
| | | selectedOrganizationId: null, |
| | | allOrganizationIds: [], // 所有可选机构ID数组 |
| | | selectedRegion: '', |
| | | mapSelectorType: '', |
| | | // 扩展 addressCoordinates 支持多种键名 |
| | |
| | | }, 1500) |
| | | } |
| | | }, |
| | | |
| | | mounted() { |
| | | // 页面挂载后加载所有机构ID |
| | | this.loadAllOrganizationIds() |
| | | }, |
| | | methods: { |
| | | // 加载任务详情 |
| | | loadTaskDetail() { |
| | |
| | | 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 |
| | | |
| | | // 患者信息 |
| | | this.taskForm.patient.contact = info.patientContact || '' |
| | |
| | | } else { |
| | | console.warn('任务详情中没有emergencyInfo字段,尝试从主对象获取数据') |
| | | // 兼容处理:如果emergencyInfo不存在,尝试从主对象获取 |
| | | 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) : '' |
| | | } |
| | | |
| | |
| | | console.log('设置目标地坐标:', this.taskDetail.destinationLongitude, this.taskDetail.destinationLatitude) |
| | | } |
| | | |
| | | // 设置执行人员(修复:确保 assignees 不为 null) |
| | | // 设置执行人员(修复:确保 assignees 不为 null,并正确映射字段) |
| | | 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('任务没有分配执行人员或assignees为空') |
| | |
| | | console.log('选中车辆:', vehicle) |
| | | }, |
| | | |
| | | // 加载所有机构ID |
| | | loadAllOrganizationIds() { |
| | | // 通过 OrganizationSelector 组件获取所有机构 |
| | | const orgSelector = this.$refs.organizationSelector |
| | | if (orgSelector) { |
| | | orgSelector.reload().then(organizations => { |
| | | this.allOrganizationIds = organizations.map(org => org.deptId) |
| | | console.log('所有机构ID:', this.allOrganizationIds) |
| | | }) |
| | | } else { |
| | | // 如果组件还未挂载,稍后重试 |
| | | setTimeout(() => { |
| | | this.loadAllOrganizationIds() |
| | | }, 100) |
| | | } |
| | | }, |
| | | |
| | | // 归属机构选择变化 |
| | | onOrganizationChange(orgData) { |
| | | // orgData 包含:deptId, deptName, serviceOrderClass, region, departureAddress, departureLongitude, departureLatitude |