diff --git a/src/views/portal/case/Index.vue b/src/views/portal/case/Index.vue index 27d92215..b2f8d3e1 100644 --- a/src/views/portal/case/Index.vue +++ b/src/views/portal/case/Index.vue @@ -319,9 +319,6 @@ export default { this.queryCondition.orgDomain = null; }; this.specialized(); - // this.$nextTick(function() { - // this.closeSearch(); - // }); if (!this.portalCase.readProtocol) { this.protocolDialogVisible = true; } @@ -333,11 +330,11 @@ export default { this.getPopularity(); this.searchterm(); this.getPositive(); - this.getProfess(); + //this.getProfess(); this.getdomain(); // this.getCaseData(); this.search(); - this.couresreso(); + this.couresreso(); window.addEventListener("scroll", this.handleScroll); }, @@ -356,26 +353,68 @@ export default { }, methods: { fieldmajor(item){//专业分类 - this.majarr.push(item);//搜索条件 - this.fieldData = Array.from(new Set(this.majarr))//过滤重复的数据 - this.majsto.push(item.code); - this.majorTypeData = this.majsto.toString()//传给后端 - this.queryCondition.majorType = this.majorTypeData item.fielclass = !item.fielclass; + if(item.fielclass){ + let has=this.fieldData.some(fd=>{ + return fd.code==item.code; + }); + //console.log(has,'has') + if(!has){ + this.fieldData.push(item); + } + }else{ + let delIdx=-1; + this.fieldData.some((fd,fdidx)=>{ + if(fd.code==item.code){ + delIdx=fdidx; + return true; + } + return false; + }); + if(delIdx>-1){ + this.fieldData.splice(delIdx,1); + } + } + // this.majarr.push(item);//搜索条件 + // this.fieldData = Array.from(new Set(this.majarr))//过滤重复的数据 + // this.majsto.push(item.code); + // this.majorTypeData = this.majsto.toString()//传给后端 + // this.queryCondition.majorType = this.majorTypeData + this.getCaseData(); - // this.lmj(); }, fieldswich(item){//组织领域 - this.Domarr.push(item);//搜索条件 - this.fieldData = Array.from(new Set(this.Domarr))//过滤重复的数据 + console.log(item,'item') + item.fielclass = !item.fielclass; + if(item.fielclass){ + let has=this.fieldData.some(fd=>{ + return fd.code==item.code; + }); + //console.log(has,'has') + if(!has){ + this.fieldData.push(item); + } + }else{ + let delIdx=-1; + this.fieldData.some((fd,fdidx)=>{ + if(fd.code==item.code){ + delIdx=fdidx; + return true; + } + return false; + }); + if(delIdx>-1){ + this.fieldData.splice(delIdx,1); + } + } this.orgsto.push(item.code); this.orgDomainData = this.orgsto.toString()//传给后端 this.queryCondition.orgDomain = this.orgDomainData; - item.fielclass = !item.fielclass; this.getCaseData(); - this.lmj(); + //this.lmj(); }, lmj(){ + let delindex = -1; this.fieldData.forEach((item,idx) =>{ if(item.fielclass == false){ console.log(item,'lll') @@ -384,7 +423,7 @@ export default { // 删除这个为false的item this.fieldData.splice(index,1) // console.log(this.fieldData) - this.fieldData.splice(item,1) + // this.fieldData.splice(item,1) } }) }, @@ -407,10 +446,11 @@ export default { if (res.status == 200) { res.result.forEach(item =>{ item.fielclass = false; - + item.type='major_type'; }) } this.speciData = res.result; + this.Profess=res.result; this.$nextTick(function() { $this.initHeight = document.getElementById("searchBox").offsetHeight; $this.closeSearch(); @@ -491,6 +531,7 @@ export default { if (res.status == 200) { res.result.forEach(item =>{ item.fielclass = false; + item.type=key; }) this.domain = res.result; if(res.result.length > 0) { @@ -499,6 +540,7 @@ export default { } }); }, + //删除,不再使用 getProfess() { let key = "major_type"; apiDict.items(key).then(res => { @@ -698,29 +740,51 @@ export default { } }, tagsClose(tag, index) { - for (let i in this.queryCondition) { - if (tag.type === i) { - if (i == "majorType") { - this.queryCondition.majorType = ''; + if(tag.type=='org_domain'){ + this.domain.some((m,idx)=>{ + if(m.code=tag.code){ + m.fielclass=false; + return true; } - if (i == "orgDomain") { - this.queryCondition.orgDomain = ''; + return false; + }) + }else if(tag.type=='major_type'){ + this.speciData.some((m,idx)=>{ + if(m.code=tag.code){ + m.fielclass=false; + return true; } - if (i == "keyWord") { - this.queryCondition.keyWord = ""; - this.keyWord = ""; - } - this.queryCondition[i] = ""; - this.searchTags.splice(index, 1); - if (i == "majorType") { - this.queryCondition.majorType = null; - } - if (i == "orgDomain") { - this.queryCondition.orgDomain = null; - } - this.getCaseData(); - } + return false; + }) + }else if(tag.type=='keyWord'){ + this.queryCondition.keyWord = ""; + this.keyWord = ""; } + this.fieldData.splice(index,1); + this.caseData(); + // for (let i in this.queryCondition) { + // if (tag.type === i) { + // if (i == "majorType") { + // this.queryCondition.majorType = ''; + // } + // if (i == "orgDomain") { + // this.queryCondition.orgDomain = ''; + // } + // if (i == "keyWord") { + // this.queryCondition.keyWord = ""; + // this.keyWord = ""; + // } + // this.queryCondition[i] = ""; + // this.searchTags.splice(index, 1); + // if (i == "majorType") { + // this.queryCondition.majorType = null; + // } + // if (i == "orgDomain") { + // this.queryCondition.orgDomain = null; + // } + // this.getCaseData(); + // } + // } }, getCaseUserData(caseList) {