|
|
|
@ -637,6 +637,7 @@ |
|
|
|
<script> |
|
|
|
import { searchExpApplyList, submitExpApply, deleteExpApply, withdrawExpApply, cancelExpApply, copyExpApply, getSubmitApprovers, getFlowStatus, getTriConfirmList, confirmSample, saveRemark } from '@/api/erf/erf' |
|
|
|
import { getBuList } from '@/api/factory/site' |
|
|
|
import { queryOss } from '@/api/oss/oss' |
|
|
|
import ExpApplyForm from './components/expApplyForm.vue' |
|
|
|
import ExpProjectDetail from './components/expProjectDetail.vue' |
|
|
|
import ExpTriConfirm from './components/expTriConfirm.vue' |
|
|
|
@ -888,33 +889,65 @@ export default { |
|
|
|
* 下达申请单 - 打开审批人确认弹窗 |
|
|
|
*/ |
|
|
|
submitApply(row) { |
|
|
|
// ✅ 如果是High Risk,先验证工序 |
|
|
|
if (row.experimentType === 'High Risk') { |
|
|
|
console.log('🔍 检测到High Risk申请单,开始验证工序...') |
|
|
|
|
|
|
|
// 通过API查询工序列表进行验证(不依赖子组件是否已加载) |
|
|
|
this.validateHighRiskProcessByApi(row.applyNo).then(isValid => { |
|
|
|
if (!isValid) { |
|
|
|
console.log('❌ High Risk验证失败,终止下达') |
|
|
|
this.$alert('High Risk申请单必须至少有一条完整的工序(包含车间、质量、技术三个负责人)才能下达', '操作提示', { |
|
|
|
confirmButtonText: '确定', |
|
|
|
type: 'warning' |
|
|
|
}) |
|
|
|
return |
|
|
|
} |
|
|
|
// 第一步:所有申请单都必须验证附件 |
|
|
|
console.log('🔍 开始验证附件...') |
|
|
|
this.validateAttachmentByApi(row.applyNo).then(hasAttachment => { |
|
|
|
if (!hasAttachment) { |
|
|
|
this.$alert('下达前必须至少上传一个附件', '操作提示', { |
|
|
|
confirmButtonText: '确定', |
|
|
|
type: 'warning' |
|
|
|
}) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
console.log('✅ High Risk验证通过,继续下达流程') |
|
|
|
// 验证通过后继续下达流程 |
|
|
|
// 第二步:如果是High Risk,继续验证工序 |
|
|
|
if (row.experimentType === 'High Risk') { |
|
|
|
this.validateHighRiskProcessByApi(row.applyNo).then(isValid => { |
|
|
|
if (!isValid) { |
|
|
|
this.$alert('High Risk申请单必须至少有一条完整的工序(包含车间、质量、技术三个负责人)才能下达', '操作提示', { |
|
|
|
confirmButtonText: '确定', |
|
|
|
type: 'warning' |
|
|
|
}) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
this.proceedSubmit(row) |
|
|
|
}).catch(error => { |
|
|
|
this.$message.error('验证工序失败,请重试') |
|
|
|
}) |
|
|
|
} else { |
|
|
|
// Low Risk 附件验证通过后直接下达 |
|
|
|
this.proceedSubmit(row) |
|
|
|
} |
|
|
|
}).catch(error => { |
|
|
|
this.$message.error('验证附件失败,请重试') |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
* 通过API验证申请单是否已上传附件 |
|
|
|
* |
|
|
|
* @param {String} applyNo 申请单号 |
|
|
|
* @return {Promise<Boolean>} 验证结果 |
|
|
|
*/ |
|
|
|
validateAttachmentByApi(applyNo) { |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
queryOss({ |
|
|
|
orderRef1: 'ERF', |
|
|
|
orderRef2: applyNo, |
|
|
|
orderRef6: 'EXP_APPLY' |
|
|
|
}).then(({data}) => { |
|
|
|
if (data && data.code === 0) { |
|
|
|
const fileList = data.rows || [] |
|
|
|
console.log('📎 查询到附件数量:', fileList.length) |
|
|
|
resolve(fileList.length > 0) |
|
|
|
} else { |
|
|
|
reject(new Error(data.msg || '查询附件列表失败')) |
|
|
|
} |
|
|
|
}).catch(error => { |
|
|
|
console.error('❌ 验证工序异常:', error) |
|
|
|
this.$message.error('验证工序失败,请重试') |
|
|
|
reject(error) |
|
|
|
}) |
|
|
|
} else { |
|
|
|
// 非High Risk直接下达 |
|
|
|
console.log('📝 Low Risk申请单,直接下达') |
|
|
|
this.proceedSubmit(row) |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
|