mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-15 13:56:43 +08:00
加了一个重复的判断
This commit is contained in:
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user