Browse Source

如果是High Risk,则必须至少有一条完整的工序才可以下达

master
han\hanst 1 month ago
parent
commit
78265d3d80
  1. 2
      src/views/modules/erf/components/expTriConfirm.vue
  2. 75
      src/views/modules/erf/expApplyList.vue

2
src/views/modules/erf/components/expTriConfirm.vue

@ -99,7 +99,7 @@
已完成
</el-tag>
<el-tag v-else-if="canConfirmProcess(scope.row)" type="warning" size="small">
确认
确认
</el-tag>
<el-tag v-else type="info" size="small">
等待中

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

@ -441,7 +441,7 @@
</template>
<script>
import { searchExpApplyList, submitExpApply, deleteExpApply, withdrawExpApply, getSubmitApprovers, getFlowStatus } from '@/api/erf/erf'
import { searchExpApplyList, submitExpApply, deleteExpApply, withdrawExpApply, getSubmitApprovers, getFlowStatus, getTriConfirmList } from '@/api/erf/erf'
import { getBuList } from '@/api/factory/site'
import ExpApplyForm from './components/expApplyForm.vue'
import ExpProjectDetail from './components/expProjectDetail.vue'
@ -669,30 +669,77 @@ export default {
submitApply(row) {
// High Risk
if (row.experimentType === 'High Risk') {
//
this.currentRow = row
console.log('🔍 检测到High Risk申请单,开始验证工序...')
// DOM
this.$nextTick(() => {
if (this.$refs.triConfirm && this.$refs.triConfirm.validateHighRiskProcess) {
const isValid = this.$refs.triConfirm.validateHighRiskProcess()
if (!isValid) {
console.log('❌ High Risk验证失败,终止下达')
return
}
} else {
console.warn('⚠️ 未找到triConfirm组件或validateHighRiskProcess方法')
// API
this.validateHighRiskProcessByApi(row.applyNo).then(isValid => {
if (!isValid) {
console.log('❌ High Risk验证失败,终止下达')
this.$alert('High Risk申请单必须至少有一条完整的工序(包含车间、质量、技术三个负责人)才能下达', '操作提示', {
confirmButtonText: '确定',
type: 'warning'
})
return
}
console.log('✅ High Risk验证通过,继续下达流程')
//
this.proceedSubmit(row)
}).catch(error => {
console.error('❌ 验证工序异常:', error)
this.$message.error('验证工序失败,请重试')
})
} else {
// High Risk
console.log('📝 Low Risk申请单,直接下达')
this.proceedSubmit(row)
}
},
/**
* 通过API验证High Risk工序
*
* @param {String} applyNo 申请单号
* @return {Promise<Boolean>} 验证结果
*/
validateHighRiskProcessByApi(applyNo) {
return new Promise((resolve, reject) => {
// API
getTriConfirmList({ applyNo: applyNo }).then(({data}) => {
if (data && data.code === 0) {
const processList = data.list || []
console.log('📊 查询到工序数量:', processList.length)
//
const completeProcesses = processList.filter(process => {
const isComplete = process.prodApproverName &&
process.qaApproverName &&
process.techApproverName
if (isComplete) {
console.log('✅ 完整工序:', process.processStep, {
车间: process.prodApproverName,
质量: process.qaApproverName,
技术: process.techApproverName
})
}
return isComplete
})
console.log(`📈 完整工序数量: ${completeProcesses.length}/${processList.length}`)
//
resolve(completeProcesses.length > 0)
} else {
reject(new Error(data.msg || '查询工序列表失败'))
}
}).catch(error => {
reject(error)
})
})
},
/**
* 执行下达流程
*/

Loading…
Cancel
Save