diff --git a/src/api/qc/qc.js b/src/api/qc/qc.js index 4bdeabd..70d7cb5 100644 --- a/src/api/qc/qc.js +++ b/src/api/qc/qc.js @@ -246,6 +246,9 @@ export const goUpItemQC = data => createAPI(`/pms/qc/goUpItemQC`,'post',data) export const goDownItemQC = data => createAPI(`/pms/qc/goDownItemQC`,'post',data) export const cancelApproval2 = data => createAPI(`/pms/qc/cancelApproval2`,'post',data) +// ===================================== SQC取消审核 ===================================== +export const cancelSQCApproval = data => createAPI(`/pms/qc/cancelSQCApproval`,'post',data) + // ===================================== 外采设备维护 ===================================== export const queryEquipmentFolderLocationList = data => createAPI(`/pms/qc/queryEquipmentFolderLocationList`,'post',data) export const deleteEquipmentFolderLocationList = data => createAPI(`/pms/qc/deleteEquipmentFolderLocationList`,'post',data) diff --git a/src/views/modules/qc/SQCResultEntry.vue b/src/views/modules/qc/SQCResultEntry.vue index 9fc47d1..023e502 100644 --- a/src/views/modules/qc/SQCResultEntry.vue +++ b/src/views/modules/qc/SQCResultEntry.vue @@ -221,7 +221,7 @@ getResponsibleOperatorList, getSQCItemObjectList, dataAcquisitionByItem, - cancelApproval, + cancelSQCApproval, overLoadSearchPartInfo, } from "@/api/qc/qc.js" import {getTableDefaultListLanguage, getTableUserListLanguage} from "@/api/table.js" @@ -883,8 +883,8 @@ // 是否允许勾选 selectFlag (row) { - // 已完成的不允许批量操作(与 IQC 常见控制一致) - return row && row.state !== '已完成' + // 取消审核需要勾选“已完成”记录,因此这里不做行级限制 + return true }, // 导出字段(简版:按主表列导出) @@ -930,6 +930,26 @@ this.$message.warning('请勾选要审核的检验单!') return } + let tempData1 = '' // 记录不是待检验状态的单号 + let tempData2 = '' // 记录处置措施未填写的单号 + for (let i = 0; i < this.submitList.length; i++) { + if (this.submitList[i].state !== '待检验') { + tempData1 = tempData1 + this.submitList[i].inspectionNo + '、' + } + if (this.submitList[i].inspectionResult === '不合格' && (this.submitList[i].disposalMeasures === '' || this.submitList[i].disposalMeasures == null)) { + tempData2 = tempData2 + this.submitList[i].inspectionNo + '、' + } + } + if (tempData1 !== '') { + tempData1 = tempData1.substring(0, tempData1.length - 1) + this.$message.warning('检验单号 ' + tempData1 + ' ,不是待检验状态!') + return + } + if (tempData2 !== '') { + tempData2 = tempData2.substring(0, tempData2.length - 1) + this.$message.warning('检验单号 ' + tempData2 + ' 的处置措施未选择!') + return + } this.$confirm(`确认审核选中的检验单?`, '提示', { confirmButtonText: '确定', cancelButtonText: '取消', @@ -939,6 +959,7 @@ if (data && data.code === 0) { this.$message.success('操作成功') this.getDataList() + this.submitList = [] } else { this.$message.warning(data.msg || '操作失败') } @@ -946,9 +967,43 @@ }).catch(() => {}) }, - // 取消审核(后端暂未实现 SQC 专用取消逻辑,这里先避免前端报错) + // 取消审核 cancelApproval () { - this.$message.warning('SQC暂未接入取消审核功能') + let tempData1 = '' // 记录不是已完成状态的单号 + if (!this.submitList || this.submitList.length === 0) { + this.$message.warning('请勾选要取消审核的检验单!') + return + } + for (let i = 0; i < this.submitList.length; i++) { + if (this.submitList[i].state !== '已完成') { + tempData1 = tempData1 + this.submitList[i].inspectionNo + '、' + } + } + if (tempData1 !== '') { + tempData1 = tempData1.substring(0, tempData1.length - 1) + this.$message.warning('检验单号 ' + tempData1 + ' ,不是已完成状态!') + return + } + this.$confirm(`确定取消审核该 ` + this.submitList.length + ` 条记录`, '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + cancelSQCApproval({ submitList: this.submitList }).then(({data}) => { + if (data && data.code === 0) { + this.getDataList() + this.submitList = [] + this.$message({ + message: '操作成功', + type: 'success', + duration: 1500, + onClose: () => {} + }) + } else { + this.$message.warning(data.msg || '操作失败') + } + }) + }).catch(() => {}) }, // 删除