xiezhiming пре 3 година
родитељ
комит
3aea248728
1 измењених фајлова са 44 додато и 15 уклоњено
  1. 44 15
      src/components/knowledgeExtra/AddNewRule.vue

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

@@ -361,7 +361,6 @@ export default {
 	//护理开单项子组件里面的传过来的值 
 	ruleContent(data){
 		this.staicData=data
-		console.log(this.staicData)
 	},
     clearValidate(data) {
       this.$refs.ruleForm.clearValidate(data);
@@ -397,26 +396,47 @@ 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) {
@@ -669,6 +689,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;
@@ -709,6 +736,8 @@ export default {
 								}else{
 									this.isRedMsg.push(true)
 								}
+							}else{
+								this.isRedMsg.push(false)
 							}
 						})
 					}