xiezhiming 3 سال پیش
والد
کامیت
b11b43e415
1فایلهای تغییر یافته به همراه46 افزوده شده و 15 حذف شده
  1. 46 15
      src/components/knowledgeExtra/AddNewRule.vue

+ 46 - 15
src/components/knowledgeExtra/AddNewRule.vue

@@ -387,27 +387,49 @@ export default {
 	  }
 	  //加载护理非开单项的关联静态知识
 	  if(this.form.parRuleType==8){
-	  		  this.isStatic=true;
-	  		  if(Array.isArray(this.form.klRuleByIdGroup)){
-	  			  let itemCopy={}
-	  			  this.form.klRuleByIdGroup.forEach((item,index)=>{
-	  					if(Array.isArray(item.klRuleStaticSub)){
-							this.$set(this.form.klRuleByIdSub[index],'ruleStatic',[])
-							this.$set(this.form.klRuleByIdSub[index],'ruleStaticList',[])
-	  						item.klRuleStaticSub.forEach((items,ind)=>{
+	  		this.isStatic=true;
+	  		if(Array.isArray(this.form.klRuleByIdGroup)){
+	  			let itemCopy={} //用来存放对象
+	  				let itemsCopy={}
+	  			let klRuleByIdSub=[] //中间数组
+	  			this.form.klRuleByIdGroup.forEach((item,index)=>{
+	  					let obj={
+	  						groupType:item.groupType,
+	  						klRuleStaticSub:item.klRuleStaticSub
+	  					}
+	  					itemCopy=JSON.parse(JSON.stringify(obj))
+	  				klRuleByIdSub.push(itemCopy)
+	  			})
+	  				if(Array.isArray(this.form.klRuleByIdSub)){
+	  					this.form.klRuleByIdSub.forEach(item=>{
+	  						this.$set(item,'ruleStatic',[])
+	  						this.$set(item,'ruleStaticList',[])  
+	  						this.$set(item,'ruleStaticLists',[])  
+	  					})
+	  				}
+	  				this.form.klRuleByIdSub.forEach((item,index)=>{
+	  					klRuleByIdSub.forEach(items=>{
+	  						if(items.groupType==item.groupType){
+	  							this.form.klRuleByIdSub[index].ruleStaticLists=items.klRuleStaticSub
+	  						}
+	  					})
+	  				})
+	  				this.form.klRuleByIdSub.forEach((item,index)=>{
+	  					if(Array.isArray(item.ruleStaticLists)){
+	  						item.ruleStaticLists.forEach(items=>{
 	  							let obj={
 	  								id:items.conceptId,
 	  								name:items.name
 	  							}
-	  							itemCopy=JSON.parse(JSON.stringify(obj))
-	  							this.form.klRuleByIdSub[index].ruleStatic.push(itemCopy.id);
-	  							this.form.klRuleByIdSub[index].ruleStaticList.push(itemCopy)
+	  							itemsCopy=JSON.parse(JSON.stringify(obj))
+	  							this.form.klRuleByIdSub[index].ruleStaticList.push(itemsCopy)
+	  							this.form.klRuleByIdSub[index].ruleStatic.push(itemsCopy.id)
 	  						})
-	  										  
 	  					}
-	  			  })
-	  		  }
+	  				})		  		 
+	  		}
 	  }
+	 
 	  //加载列表规则内容
       if (this.form.parConceptId && this.checkFirstPlace && this.conceptList) {
         this.firstPlace = this.conceptList.find(
@@ -659,6 +681,13 @@ export default {
     		})
     		//删除第二层的klRuleInfoSaveSub
     		delete paramsCopy.klRuleInfoSaveSub
+			//清除子集的关联静态知识
+			paramsCopy.klRuleInfoSaveGroup.forEach((item,index)=>{
+				if(index+1>=paramsCopy.klRuleInfoSaveGroup.length) return
+				if(item.groupType==paramsCopy.klRuleInfoSaveGroup[index+1].groupType){
+					paramsCopy.klRuleInfoSaveGroup[index+1].ruleStatic=[]
+				}
+			})
     	}  
     	//判断护理开单是否附加信息和关联静态信息是否都没存在值
     	 let flagRule=false;
@@ -699,7 +728,9 @@ export default {
     							}else{
     								this.isRedMsg.push(true)
     							}
-    						}
+    						}else{
+								this.isRedMsg.push(false)
+							}
     					})
     				}
     			})