diff --git a/src/views/workCenter/enterpriseStandardInspectionPlan/EnterpriseStandardInspectionPlanFlow.vue b/src/views/workCenter/enterpriseStandardInspectionPlan/EnterpriseStandardInspectionPlanFlow.vue index 11f356ff..67c91de4 100644 --- a/src/views/workCenter/enterpriseStandardInspectionPlan/EnterpriseStandardInspectionPlanFlow.vue +++ b/src/views/workCenter/enterpriseStandardInspectionPlan/EnterpriseStandardInspectionPlanFlow.vue @@ -349,6 +349,25 @@ export default { this.$message.warning(this.$t('addAtLeastOneRowOfData')) throw new Error('base') } + // 节点2,验证所有数据意见是否都已填写 + if (isValidate && this.currentNode === EsInspectionPlan.fillInComments.value) { + // 当前登录用户,查找意见为空的数据 + const currentUserName = this.$store.getters.userInfo.username + const opinionHasEmpty = this.$refs.inspectionPlanTable.dataSource.some(item => { + // 自己的数据就不用填写意见 + if (item.createBy === currentUserName) { + return false + } + // 如果没有意见内容,就是有没填的 + if (!item.processEsInspectPlanOpinion || !item.processEsInspectPlanOpinion.opinion) { + return true + } + }) + if (opinionHasEmpty) { + this.$message.warning(this.$t('pleaseCompleteTableInfo')) + throw new Error('base') + } + } const params = {} // 业务表信息 params.processEsInspectPlanList = this.$refs.inspectionPlanTable.dataSource.map(item => { @@ -466,30 +485,6 @@ export default { */ handleSubmit () { if (this.loading) return - // 节点2,验证所有数据意见是否都已填写 - if (this.currentNode === EsInspectionPlan.fillInComments.value) { - // 当前登录用户,查找意见为空的数据 - const currentUserName = this.$store.getters.userInfo.username - const opinionHasEmpty = this.$refs.inspectionPlanTable.dataSource.find(item => { - // 自己的数据就不用填写意见 - if (item.createBy === currentUserName) { - return false - } - // 如果意见字段为空,或者没有意见数据,就是没填的数据 - if (!item.processEsInspectPlanOpinionList || !item.processEsInspectPlanOpinionList.length) { - return true - } - // 如果有意见信息,从中找自己的数据,没找到自己的数据,就是没填的数据 - const selfOpinionData = item.processEsInspectPlanOpinionList.find(childItem => { - return childItem.createBy === currentUserName - }) - return !selfOpinionData - }) - if (opinionHasEmpty) { - this.$message.warning(this.$t('pleaseCompleteTableInfo')) - return - } - } // 有taskId说明已经发起过,调审批接口,否则调发起接口 if (this.$route.query.taskId) { this.handleAgree(true) diff --git a/src/views/workCenter/enterpriseStandardInspectionPlan/modules/InspectionPlanTable.vue b/src/views/workCenter/enterpriseStandardInspectionPlan/modules/InspectionPlanTable.vue index 19fe8989..4917ba4c 100644 --- a/src/views/workCenter/enterpriseStandardInspectionPlan/modules/InspectionPlanTable.vue +++ b/src/views/workCenter/enterpriseStandardInspectionPlan/modules/InspectionPlanTable.vue @@ -356,6 +356,9 @@ export default { }, // 是否显示意见 isShowOpinion (record) { + if (record.processEsInspectPlanOpinion && record.processEsInspectPlanOpinion.opinion) { + return true + } const list = record.processEsInspectPlanOpinionList || [] // 意见列表是否有当前用户的意见 return !!(list.find(item => item.createBy === this.currentUserName))