Browse Source

试验单如果没有上传附件,不允许下达

master
han\hanst 14 hours ago
parent
commit
6445182e0d
  1. 53
      src/views/modules/erf/expApplyList.vue

53
src/views/modules/erf/expApplyList.vue

@ -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,14 +889,21 @@ export default {
* 下达申请单 - 打开审批人确认弹窗
*/
submitApply(row) {
// High Risk
if (row.experimentType === 'High Risk') {
console.log('🔍 检测到High Risk申请单,开始验证工序...')
//
console.log('🔍 开始验证附件...')
this.validateAttachmentByApi(row.applyNo).then(hasAttachment => {
if (!hasAttachment) {
this.$alert('下达前必须至少上传一个附件', '操作提示', {
confirmButtonText: '确定',
type: 'warning'
})
return
}
// API
// High Risk
if (row.experimentType === 'High Risk') {
this.validateHighRiskProcessByApi(row.applyNo).then(isValid => {
if (!isValid) {
console.log('❌ High Risk验证失败,终止下达')
this.$alert('High Risk申请单必须至少有一条完整的工序(包含车间、质量、技术三个负责人)才能下达', '操作提示', {
confirmButtonText: '确定',
type: 'warning'
@ -903,18 +911,43 @@ export default {
return
}
console.log('✅ High Risk验证通过,继续下达流程')
//
this.proceedSubmit(row)
}).catch(error => {
console.error('❌ 验证工序异常:', error)
this.$message.error('验证工序失败,请重试')
})
} else {
// High Risk
console.log('📝 Low Risk申请单,直接下达')
// 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 => {
reject(error)
})
})
},
/**

Loading…
Cancel
Save