You need to sign in or sign up before continuing.
Commit 9b4e8403 authored by 张昊飞's avatar 张昊飞

保修单详情修改

parent 2c32294b
...@@ -146,7 +146,7 @@ public class ErpRepairFormProjectDispatchServiceImpl implements IErpRepairFormPr ...@@ -146,7 +146,7 @@ public class ErpRepairFormProjectDispatchServiceImpl implements IErpRepairFormPr
projectDispatch.setActualManHour(hour); projectDispatch.setActualManHour(hour);
// projectDispatch.setDeductManHour(hour); // projectDispatch.setDeductManHour(hour);
// 汇总实际总工时 // 汇总实际总工时
formProject.setActualTime(formProject.getActualTime().add(hour)); formProject.setActualTime(hour);
return projectDispatch; return projectDispatch;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
formProject.setIsDispatch(IsEnableStatus.YES.getCode()); formProject.setIsDispatch(IsEnableStatus.YES.getCode());
...@@ -160,6 +160,7 @@ public class ErpRepairFormProjectDispatchServiceImpl implements IErpRepairFormPr ...@@ -160,6 +160,7 @@ public class ErpRepairFormProjectDispatchServiceImpl implements IErpRepairFormPr
@Override @Override
public Boolean updateByBo(ErpRepairFormProjectDispatchBo bo) { public Boolean updateByBo(ErpRepairFormProjectDispatchBo bo) {
ErpRepairFormProjectDispatch projectDispatch = baseMapper.selectById(bo.getId()); ErpRepairFormProjectDispatch projectDispatch = baseMapper.selectById(bo.getId());
projectDispatch.setDispatchManHour(bo.getDispatchManHour());
projectDispatch.setActualManHour(bo.getDispatchManHour().subtract(bo.getDeductManHour())); projectDispatch.setActualManHour(bo.getDispatchManHour().subtract(bo.getDeductManHour()));
projectDispatch.setDeductManHour(bo.getDeductManHour()); projectDispatch.setDeductManHour(bo.getDeductManHour());
return baseMapper.updateById(projectDispatch) > 0; return baseMapper.updateById(projectDispatch) > 0;
......
...@@ -20,7 +20,20 @@ ...@@ -20,7 +20,20 @@
<el-table-column label="人员名称" align="center" prop="maintainUserName" /> <el-table-column label="人员名称" align="center" prop="maintainUserName" />
<el-table-column label="岗位名称" align="center" prop="postName" /> <el-table-column label="岗位名称" align="center" prop="postName" />
<!-- <el-table-column label="在岗状态" align="center" prop="state" />--> <!-- <el-table-column label="在岗状态" align="center" prop="state" />-->
<el-table-column label="分配工时" align="center" prop="dispatchManHour" /> <el-table-column label="分配工时" align="center" prop="dispatchManHour">
<template slot-scope="scope">
<el-input-number
v-model="scope.row.dispatchManHour"
@change="handleDispatchManHourChange(scope.row)"
controls-position="right"
size="mini"
:class="{ 'input-error': !isDispatchValid(scope.row) }"
:min="0"
:max="Number(scope.row.standardManHour)"
:precision="1"
style="width: 100%" />
</template>
</el-table-column>
<el-table-column label="扣罚工时" align="center" prop="deductManHour"> <el-table-column label="扣罚工时" align="center" prop="deductManHour">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input-number v-model="scope.row.deductManHour" @change="submitForm(scope.row)" controls-position="right" size="mini" :min="0" :max="Number(scope.row.dispatchManHour)" :precision="1" style="width: 100%" /> <el-input-number v-model="scope.row.deductManHour" @change="submitForm(scope.row)" controls-position="right" size="mini" :min="0" :max="Number(scope.row.dispatchManHour)" :precision="1" style="width: 100%" />
...@@ -28,7 +41,7 @@ ...@@ -28,7 +41,7 @@
</el-table-column> </el-table-column>
<el-table-column label="实际工时" align="center" prop="actualManHour"> <el-table-column label="实际工时" align="center" prop="actualManHour">
<template slot-scope="scope"> <template slot-scope="scope">
{{scope.row.actualManHour = Number(scope.row.dispatchManHour) - Number(scope.row.deductManHour).toFixed(1)}} {{ (Number(scope.row.dispatchManHour) - Number(scope.row.deductManHour)).toFixed(1) }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
...@@ -185,6 +198,16 @@ export default { ...@@ -185,6 +198,16 @@ export default {
} }
}; };
}, },
computed: {
// 检查总分配工时是否超过标准工时
isTotalExceedStandard() {
if (!this.data.standardManHour) return false;
const totalDispatchManHour = this.repairFormProjectDispatchList.reduce((total, item) => {
return total + (Number(item.dispatchManHour) || 0);
}, 0);
return totalDispatchManHour !== Number(this.data.standardManHour);
}
},
created() { created() {
this.getList(); this.getList();
}, },
...@@ -262,6 +285,32 @@ export default { ...@@ -262,6 +285,32 @@ export default {
this.title = "修改报修单-报修项目-派工"; this.title = "修改报修单-报修项目-派工";
}); });
}, },
// 检查分配工时是否有效
isDispatchValid(row) {
if (!this.data.standardManHour) return true;
const totalDispatchManHour = this.repairFormProjectDispatchList.reduce((total, item) => {
return total + (Number(item.dispatchManHour) || 0);
}, 0);
return totalDispatchManHour === Number(this.data.standardManHour);
},
/** 分配工时变化处理 */
handleDispatchManHourChange(row) {
// 检查总分配工时是否等于标准工时
const totalDispatchManHour = this.repairFormProjectDispatchList.reduce((total, item) => {
return total + (Number(item.dispatchManHour) || 0);
}, 0);
// 如果总分配工时不等于标准工时,显示提示
if (this.data.standardManHour && totalDispatchManHour !== Number(this.data.standardManHour)) {
this.$message.warning(`总分配工时(${totalDispatchManHour})不等于项目标准工时(${this.data.standardManHour})`);
return false;
}
// 更新实际工时
row.actualManHour = (Number(row.dispatchManHour) - Number(row.deductManHour)).toFixed(1);
// 提交更新
this.submitForm(row);
},
/** 提交按钮 */ /** 提交按钮 */
submitForm(row) { submitForm(row) {
this.buttonLoading = true; this.buttonLoading = true;
...@@ -312,3 +361,9 @@ export default { ...@@ -312,3 +361,9 @@ export default {
} }
}; };
</script> </script>
<style scoped>
.input-error ::v-deep .el-input__inner {
border-color: #f56c6c !important;
}
</style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment