提交 8ee9fa93 authored 作者: lidongxu's avatar lidongxu

fix(plan): 促销计划_按钮新增单条计划上下班时间的年月日和活动时间要统一

上级 82209933
......@@ -1112,14 +1112,31 @@ const handleAddOrEditPlan = async () => {
addOrEditPlanForm.value.operNo = userStore().getEmployeeNo
addOrEditPlanForm.value.operName = store.state.value.user.userInfo.nickName
addOrEditPlanForm.value.operId = store.state.value.user.userInfo.userId
if (addOrEditPlanForm.value.id) {
// 上班打卡和下班打卡时间前面要和 date 创建任务的年月日一致
const nowDate = new Date(addOrEditPlanForm.value.date)
const clockInTime = new Date(addOrEditPlanForm.value.clockInTime)
clockInTime.setFullYear(nowDate.getFullYear())
clockInTime.setMonth(nowDate.getMonth())
clockInTime.setDate(nowDate.getDate())
// 下班打卡时间
const clockOutTime = new Date(addOrEditPlanForm.value.clockOutTime)
clockOutTime.setFullYear(nowDate.getFullYear())
clockOutTime.setMonth(nowDate.getMonth())
clockOutTime.setDate(nowDate.getDate())
const dataObj = {
...addOrEditPlanForm.value,
clockInTime,
clockOutTime
}
if (dataObj.id) {
// 根据归属人 employeeId 查询它的 id 和名字
const employeeInfo = belongPerList.value.find(item => item.employeeNo === addOrEditPlanForm.value.employeeNo)
addOrEditPlanForm.value.employeeId = employeeInfo.value
addOrEditPlanForm.value.employeeName = employeeInfo.label
await updatePlanByWebAPI(addOrEditPlanForm.value)
const employeeInfo = belongPerList.value.find(item => item.employeeNo === dataObj.employeeNo)
dataObj.employeeId = employeeInfo.value
dataObj.employeeName = employeeInfo.label
await updatePlanByWebAPI(dataObj)
} else {
await addPlanByWebAPI(addOrEditPlanForm.value)
await addPlanByWebAPI(dataObj)
}
ElMessage.success('保存成功')
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论