feat(WorkOrderEdit): 添加作业负责人选择器并更新相关逻辑
- 将作业负责人输入框改为只读并添加选择器功能 - 新增作业负责人ID字段存储 - 更新表单数据恢复和保存逻辑以适配新字段 - 修改验证逻辑检查负责人ID而非名称
This commit is contained in:
parent
e19ba8e145
commit
d18f0f4c5e
|
|
@ -46,10 +46,15 @@
|
|||
</view>
|
||||
</view>
|
||||
<view class="FormItem">
|
||||
<view class="FormLableBox mustBox">作业负责人</view>
|
||||
<view class="FormValueBox">
|
||||
<u-input v-model="formData.ResponsiblePerson" placeholder="请输入作业负责人"></u-input>
|
||||
<view class="FormLableBox FlexBox">
|
||||
<view class="mustBox">作业负责人</view>
|
||||
<view class="addBtn" @click="showMemberPicker1 = true">添加</view>
|
||||
</view>
|
||||
<view class="FormValueBox">
|
||||
<u-input v-model="formData.supervisorName" placeholder="请输入作业负责人" readonly></u-input>
|
||||
</view>
|
||||
<u-picker :show="showMemberPicker1" :columns="[MemberArr]" keyName="name" @confirm="HandleMemberConfirmA"
|
||||
@cancel="showMemberPicker1 = false"></u-picker>
|
||||
</view>
|
||||
<view class="FormItem">
|
||||
<view class="FormLableBox FlexBox">
|
||||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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 || '',
|
||||
|
|
|
|||
Loading…
Reference in New Issue