加了一个重复的判断

This commit is contained in:
daihh
2022-08-15 13:08:48 +08:00
parent 88cf54392b
commit 2f1312fcc0

View File

@@ -546,6 +546,24 @@ export default {
if(!this.paper.testName) {
return this.$message.warning('请您完善基本信息必填项!')
}
//检查是否有重复的试卷
let qidMap=new Map();
let hasItem=null;
this.paper.data.some(qitem=>{
if(qidMap.has(qitem.id)){
hasItem=qitem;
return true;
}else{
qidMap.set(qitem.id,qitem.id);
return false;
}
})
if(hasItem!=null){
console.log(hasItem);
this.$message.error('选择的试题重复:'+hasItem.title)
return
}
this.paper.resOwner1 = this.resOwner[0];
this.paper.resOwner2 = this.resOwner[1];
this.paper.resOwner3 = this.resOwner[2];