diff --git a/src/pages/processCenter/pages/creatProcess/bzpg/step1.vue b/src/pages/processCenter/pages/creatProcess/bzpg/step1.vue index 6456d330a..9959f36e2 100644 --- a/src/pages/processCenter/pages/creatProcess/bzpg/step1.vue +++ b/src/pages/processCenter/pages/creatProcess/bzpg/step1.vue @@ -1049,29 +1049,21 @@ export default { // 确认添加事件 okProject () { if(this.projectList.length) { - const proData = [] + this.projectList.forEach(i => { + i.name = i.projectGroup + '-' + i.managementHostName + '-' + i.developmentHostName + }) if(this.dataList.length) { - this.dataList.forEach(item => { - if(!proData.length) { - proData.push(item.projectGroup) - }else if(!proData.includes(item.projectGroup)) { - proData.push(item.projectGroup) - } - }) - this.projectList.forEach(items => { - if(!proData.includes(items.projectGroup)) { - this.dataList.push(items) - }else{ - this.subFlag++ - } - }) - if(this.subFlag > 0) { + if (this.dataList.some(data => this.projectList.some(project => project.name === data.name))) { this.$message.warning('请勿重复添加数据') + return + } else { + this.dataList = [ ...this.dataList, ...this.projectList ] } }else{ - this.dataList = this.projectList + this.dataList = [ ...this.projectList ] } this.ProjectModel = false; + console.log(this.dataList === this.projectList) }else{ this.$message.warning('请至少选择一条数据进行添加') }