refactor(qc): 移除页面顶部审批操作按钮,调整审批逻辑
1. 移除待审批状态下页面顶部的审批通过和驳回按钮 2. 重构审批相关的前端方法,删除冗余的handleApprove和handleReject 3. 优化后端审批日志逻辑,自动获取当前登录用户作为操作人 4. 新增评审单修改状态校验,仅草稿和已驳回状态可修改 5. 新增钢卷改判状态完整性校验,确保所有钢卷都已指定改判质量 6. 完善保存前的数据校验,新增产品名称非空校验和默认传审部门
This commit is contained in:
@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.utils.StringUtils;
|
||||
import com.klp.common.helper.LoginHelper;
|
||||
import com.klp.domain.WmsMaterialCoil;
|
||||
import com.klp.mapper.WmsMaterialCoilMapper;
|
||||
import com.klp.service.IWmsMaterialCoilService;
|
||||
@@ -111,11 +112,19 @@ public class QcQualityReviewServiceImpl implements IQcQualityReviewService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改评审单(仅草稿状态可修改)
|
||||
* 修改评审单(仅草稿或已驳回状态可修改)
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean updateByBo(QcQualityReviewBo bo) {
|
||||
// 校验:只有待提交或已驳回状态才能修改
|
||||
if (bo.getReviewId() != null) {
|
||||
QcQualityReview exist = baseMapper.selectById(bo.getReviewId());
|
||||
if (exist != null && !Long.valueOf(1L).equals(exist.getFlowStatus())
|
||||
&& !Long.valueOf(4L).equals(exist.getFlowStatus())) {
|
||||
throw new RuntimeException("只有待提交或已驳回状态的评审单才能修改");
|
||||
}
|
||||
}
|
||||
QcQualityReview update = BeanUtil.toBean(bo, QcQualityReview.class);
|
||||
validEntityBeforeSave(update);
|
||||
boolean flag = baseMapper.updateById(update) > 0;
|
||||
@@ -193,7 +202,7 @@ public class QcQualityReviewServiceImpl implements IQcQualityReviewService {
|
||||
.set(QcQualityReview::getRejectReason, null));
|
||||
|
||||
// 记录审批日志
|
||||
addLog(reviewId, "submit", "提交送审", null);
|
||||
addLog(reviewId, "submit", "提交送审");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -214,6 +223,20 @@ public class QcQualityReviewServiceImpl implements IQcQualityReviewService {
|
||||
throw new RuntimeException("请为每个钢卷指定改判后质量状态");
|
||||
}
|
||||
|
||||
// 校验:coilRegradeList 是否覆盖了评审单中的所有有效钢卷
|
||||
List<QcQualityReviewCoil> dbCoils = coilMapper.selectList(
|
||||
Wrappers.<QcQualityReviewCoil>lambdaQuery()
|
||||
.eq(QcQualityReviewCoil::getReviewId, bo.getReviewId())
|
||||
.eq(QcQualityReviewCoil::getDelFlag, 0));
|
||||
Set<Long> regradedIds = bo.getCoilRegradeList().stream()
|
||||
.map(QcQualityReviewApproveBo.CoilRegradeBo::getDetailId)
|
||||
.collect(Collectors.toSet());
|
||||
for (QcQualityReviewCoil coil : dbCoils) {
|
||||
if (!regradedIds.contains(coil.getDetailId())) {
|
||||
throw new RuntimeException("钢卷【" + coil.getCurrentCoilNo() + "】未指定改判后质量状态");
|
||||
}
|
||||
}
|
||||
|
||||
// 1. 更新主表流程状态
|
||||
baseMapper.update(null, Wrappers.<QcQualityReview>lambdaUpdate()
|
||||
.eq(QcQualityReview::getReviewId, bo.getReviewId())
|
||||
@@ -230,7 +253,7 @@ public class QcQualityReviewServiceImpl implements IQcQualityReviewService {
|
||||
}
|
||||
|
||||
// 3. 记录审批日志
|
||||
addLog(bo.getReviewId(), "approve", bo.getLeaderOpinion(), bo.getLeaderSign());
|
||||
addLog(bo.getReviewId(), "approve", bo.getLeaderOpinion());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -258,7 +281,7 @@ public class QcQualityReviewServiceImpl implements IQcQualityReviewService {
|
||||
.set(QcQualityReview::getRejectReason, reason));
|
||||
|
||||
// 记录审批日志
|
||||
addLog(reviewId, "reject", reason, null);
|
||||
addLog(reviewId, "reject", reason);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -355,14 +378,14 @@ public class QcQualityReviewServiceImpl implements IQcQualityReviewService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加审批日志
|
||||
* 添加审批日志(自动记录当前登录用户为操作人)
|
||||
*/
|
||||
private void addLog(Long reviewId, String action, String opinion, String operator) {
|
||||
private void addLog(Long reviewId, String action, String opinion) {
|
||||
QcQualityReviewLog log = new QcQualityReviewLog();
|
||||
log.setReviewId(reviewId);
|
||||
log.setAction(action);
|
||||
log.setOpinion(opinion);
|
||||
log.setOperator(operator);
|
||||
log.setOperator(LoginHelper.getUsername());
|
||||
log.setOperateTime(new Date());
|
||||
logMapper.insert(log);
|
||||
}
|
||||
@@ -378,6 +401,11 @@ public class QcQualityReviewServiceImpl implements IQcQualityReviewService {
|
||||
}
|
||||
|
||||
private void validEntityBeforeSave(QcQualityReview entity) {
|
||||
// TODO 数据校验
|
||||
if (StringUtils.isBlank(entity.getProductName())) {
|
||||
throw new RuntimeException("产品名称不能为空");
|
||||
}
|
||||
if (StringUtils.isBlank(entity.getTransmitDept())) {
|
||||
entity.setTransmitDept("品质部");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,11 +69,7 @@
|
||||
<!-- 待提交:提交送审 -->
|
||||
<el-button v-if="currentRow.flowStatus === 1" size="mini" type="primary" plain icon="el-icon-s-promotion"
|
||||
@click="handleSubmit" v-hasPermi="['qc:qualityReview:submit']">提交送审</el-button>
|
||||
<!-- 待审批:审批/驳回 -->
|
||||
<el-button v-if="currentRow.flowStatus === 2" size="mini" type="success" plain icon="el-icon-check"
|
||||
@click="handleApprove" v-hasPermi="['qc:qualityReview:approve']">审批通过</el-button>
|
||||
<el-button v-if="currentRow.flowStatus === 2" size="mini" type="danger" plain icon="el-icon-close"
|
||||
@click="handleReject" v-hasPermi="['qc:qualityReview:approve']">驳回</el-button>
|
||||
<!-- 待审批:审批/驳回表单在下方展示,顶部不再重复放置操作按钮 -->
|
||||
<!-- 已通过:执行改判 -->
|
||||
<el-button v-if="currentRow.flowStatus === 3" size="mini" type="warning" plain icon="el-icon-setting"
|
||||
@click="handleExecute" v-hasPermi="['qc:qualityReview:execute']">执行改判</el-button>
|
||||
@@ -541,20 +537,6 @@ export default {
|
||||
},
|
||||
|
||||
// ===== 审批 =====
|
||||
handleApprove() {
|
||||
this.approveAction = 'approve'
|
||||
this.approveForm = {
|
||||
reviewId: this.currentRow.reviewId,
|
||||
leaderOpinion: '',
|
||||
leaderSign: ''
|
||||
}
|
||||
// 先构建完整对象再赋值
|
||||
const map = {}
|
||||
this.coilList.forEach(c => {
|
||||
map[c.detailId] = c.regradeQuality || ''
|
||||
})
|
||||
this.approveCoilMap = map
|
||||
},
|
||||
doApprove() {
|
||||
if (!this.approveForm.leaderOpinion) {
|
||||
this.$modal.msgError('请输入审批意见')
|
||||
@@ -581,10 +563,6 @@ export default {
|
||||
})
|
||||
}).catch(() => {})
|
||||
},
|
||||
handleReject() {
|
||||
this.approveAction = 'reject'
|
||||
this.rejectReason = ''
|
||||
},
|
||||
doReject() {
|
||||
if (!this.rejectReason) {
|
||||
this.$modal.msgError('请输入驳回原因')
|
||||
|
||||
Reference in New Issue
Block a user