From d18f0f4c5e55edda41bbb5cc867eed426d7d1e79 Mon Sep 17 00:00:00 2001 From: liangbin <15536829364@163.com> Date: Tue, 3 Feb 2026 10:12:48 +0800 Subject: [PATCH] =?UTF-8?q?feat(WorkOrderEdit):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E8=B4=9F=E8=B4=A3=E4=BA=BA=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E5=99=A8=E5=B9=B6=E6=9B=B4=E6=96=B0=E7=9B=B8=E5=85=B3=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将作业负责人输入框改为只读并添加选择器功能 - 新增作业负责人ID字段存储 - 更新表单数据恢复和保存逻辑以适配新字段 - 修改验证逻辑检查负责人ID而非名称 --- .../WorkOrderEdit/compoents/BasicsInfo.vue | 30 +++++++++++++++---- src/pages/WorkOrderEdit/index.vue | 17 ++++++----- 2 files changed, 34 insertions(+), 13 deletions(-) diff --git a/src/pages/WorkOrderEdit/compoents/BasicsInfo.vue b/src/pages/WorkOrderEdit/compoents/BasicsInfo.vue index 48bcc2d..cfb394f 100644 --- a/src/pages/WorkOrderEdit/compoents/BasicsInfo.vue +++ b/src/pages/WorkOrderEdit/compoents/BasicsInfo.vue @@ -46,10 +46,15 @@ - 作业负责人 - - + + 作业负责人 + 添加 + + + + @@ -87,6 +92,7 @@ let mapEntity = null; // 当前标记点 let currentMarker = null; +const showMemberPicker1 = ref(false); // 是否显示成员选择器1 const showStartDatePicker = ref(false); // 是否显示开始日期选择器 const showEndDatePicker = ref(false); // 是否显示结束日期选择器 const startDate = ref(null); // 开始日期时间戳 @@ -115,7 +121,8 @@ const formData = ref({ Location: "", // 作业地点(经纬度) SpecificAddress: "", // 具体楼层或区域 period: [], // 作业周期 [开始日期, 结束日期] - ResponsiblePerson: "", // 作业负责人 + supervisorName: "", // 作业负责人 + supervisorId: "", // 作业负责人ID MemberList: [], // 作业班成员列表 }); @@ -131,7 +138,7 @@ const restoreFormData = (data) => { if (data.ProjectName) formData.value.ProjectName = data.ProjectName; if (data.Location) formData.value.Location = data.Location; if (data.SpecificAddress) formData.value.SpecificAddress = data.SpecificAddress; - if (data.ResponsiblePerson) formData.value.ResponsiblePerson = data.ResponsiblePerson; + if (data.supervisorName) formData.value.supervisorName = data.supervisorName; if (data.MemberList && Array.isArray(data.MemberList)) { formData.value.MemberList = [...data.MemberList]; } @@ -270,7 +277,16 @@ const UpdatePeriod = () => { console.log('作业周期:', formData.value.period); }; -// 处理成员选择确认事件 +// 处理作业负责人选择确认事件 +const HandleMemberConfirmA = (e) =>{ + console.log('选中的作业负责人完整信息:', e); + if (e.value) { + formData.value.supervisorName = e.value.name; + formData.value.supervisorId = e.value.id; + } +} + +// 处理作业组成员选择确认事件 const HandleMemberConfirm = (e) => { console.log('选中的成员完整信息:', e); console.log('e.value:', e.value); @@ -324,6 +340,8 @@ const HandleMemberConfirm = (e) => { showMemberPicker.value = false; }; + + // 删除成员 const RemoveMember = (index) => { formData.value.MemberList.splice(index, 1); diff --git a/src/pages/WorkOrderEdit/index.vue b/src/pages/WorkOrderEdit/index.vue index 6e7794d..60d7ff0 100644 --- a/src/pages/WorkOrderEdit/index.vue +++ b/src/pages/WorkOrderEdit/index.vue @@ -350,7 +350,8 @@ const mapWorkPlanDetailToBasicsInfo = (workPlanDetail) => { formatDate(workPlanDetail.workStartTime), formatDate(workPlanDetail.workEndTime) ], - ResponsiblePerson: workPlanDetail.supervisorName || '', + supervisorName: workPlanDetail.supervisorName || '', + supervisorId: workPlanDetail.supervisorId || '', MemberList: memberList, remark: workPlanDetail.remark || '' }; @@ -641,7 +642,8 @@ const saveDraft = () => { latitude: latitude, workStartTime: currentStepData.period && currentStepData.period[0] ? currentStepData.period[0] : '', workEndTime: currentStepData.period && currentStepData.period[1] ? currentStepData.period[1] : '', - supervisorName: currentStepData.ResponsiblePerson || '', + supervisorName: currentStepData.supervisorName || '', + supervisorId: currentStepData.supervisorId || '', sysUserIds: sysUserIds, remark: currentStepData.remark || '', projectStatus: 0 // 草稿状态 @@ -729,8 +731,8 @@ const saveDraft = () => { const workTicketData = { projectId: allData.value.BasicsInfo.projectId, workLocation: currentStepData.workLocation || allData.value.BasicsInfo.SpecificAddress || '', - supervisorId: null, - supervisorName: currentStepData.workResponsible || allData.value.BasicsInfo.ResponsiblePerson || '', + supervisorId: allData.value.BasicsInfo.supervisorId || '', + supervisorName: currentStepData.workResponsible || allData.value.BasicsInfo.supervisorName || '', supervisorPosition: '', workContent: currentStepData.workContent || '', riskType: currentStepData.riskType || '', @@ -937,7 +939,7 @@ const nextStep = () => { }); return; } - if (!basicsData.ResponsiblePerson) { + if (!basicsData.supervisorId) { uni.showToast({ title: '请填写作业负责人', icon: 'none' @@ -968,7 +970,8 @@ const nextStep = () => { latitude: latitude, workStartTime: basicsData.period[0], workEndTime: basicsData.period[1], - supervisorName: basicsData.ResponsiblePerson, + supervisorName: basicsData.supervisorName, + supervisorId: basicsData.supervisorId, sysUserIds: sysUserIds, remark: basicsData.remark || '', // 如果有备注字段 projectStatus: 0 @@ -1297,7 +1300,7 @@ const nextStep = () => { projectId: allData.value.BasicsInfo.projectId, // 必填字段 workLocation: workNoteData.workLocation || allData.value.BasicsInfo.SpecificAddress || '', supervisorId: null, // 作业负责人ID,如果需要可以从成员列表中查找 - supervisorName: workNoteData.workResponsible || allData.value.BasicsInfo.ResponsiblePerson || '', + supervisorName: workNoteData.workResponsible || allData.value.BasicsInfo.supervisorName || '', supervisorPosition: '', // 作业负责人职位,如果需要可以从用户信息中获取 workContent: workNoteData.workContent || '', riskType: workNoteData.riskType || '',