diff --git a/maintain-business/src/main/java/com/maintain/business/service/impl/ErpRepairFormProjectDispatchServiceImpl.java b/maintain-business/src/main/java/com/maintain/business/service/impl/ErpRepairFormProjectDispatchServiceImpl.java
index a1b57fa4c2b07db30845d422c9f634c84db48293..5768cc230f227b75a1181878b00aa5c82310a17e 100644
--- a/maintain-business/src/main/java/com/maintain/business/service/impl/ErpRepairFormProjectDispatchServiceImpl.java
+++ b/maintain-business/src/main/java/com/maintain/business/service/impl/ErpRepairFormProjectDispatchServiceImpl.java
@@ -146,7 +146,7 @@ public class ErpRepairFormProjectDispatchServiceImpl implements IErpRepairFormPr
projectDispatch.setActualManHour(hour);
// projectDispatch.setDeductManHour(hour);
// 汇总实际总工时
- formProject.setActualTime(formProject.getActualTime().add(hour));
+ formProject.setActualTime(hour);
return projectDispatch;
}).collect(Collectors.toList());
formProject.setIsDispatch(IsEnableStatus.YES.getCode());
@@ -160,6 +160,7 @@ public class ErpRepairFormProjectDispatchServiceImpl implements IErpRepairFormPr
@Override
public Boolean updateByBo(ErpRepairFormProjectDispatchBo bo) {
ErpRepairFormProjectDispatch projectDispatch = baseMapper.selectById(bo.getId());
+ projectDispatch.setDispatchManHour(bo.getDispatchManHour());
projectDispatch.setActualManHour(bo.getDispatchManHour().subtract(bo.getDeductManHour()));
projectDispatch.setDeductManHour(bo.getDeductManHour());
return baseMapper.updateById(projectDispatch) > 0;
diff --git a/maintain-ui/src/views/business/repairFormProjectDispatch/index.vue b/maintain-ui/src/views/business/repairFormProjectDispatch/index.vue
index 9b04962fa0433684fae5292e9f18b07ad22a866f..68143d887872a54df8de4ea6bf113e0e29e8972f 100644
--- a/maintain-ui/src/views/business/repairFormProjectDispatch/index.vue
+++ b/maintain-ui/src/views/business/repairFormProjectDispatch/index.vue
@@ -20,7 +20,20 @@
-
+
+
+
+
+
@@ -28,7 +41,7 @@
- {{scope.row.actualManHour = Number(scope.row.dispatchManHour) - Number(scope.row.deductManHour).toFixed(1)}}
+ {{ (Number(scope.row.dispatchManHour) - Number(scope.row.deductManHour)).toFixed(1) }}
@@ -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() {
this.getList();
},
@@ -262,6 +285,32 @@ export default {
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) {
this.buttonLoading = true;
@@ -312,3 +361,9 @@ export default {
}
};
+
+
\ No newline at end of file