zkx 1 år sedan
förälder
incheckning
742d2ad1bd
1 ändrade filer med 39 tillägg och 2 borttagningar
  1. 39 2
      components/tree/tree-node.vue

+ 39 - 2
components/tree/tree-node.vue

@@ -100,13 +100,21 @@
 					
 					
 				</view>
-				<view v-if="node.type==6" class="meter-state"
+				<view v-if="node.type==6&&!node.tag" class="meter-state"
 				 :style="{
 					  borderColor:colorList[node.manyType%7],
 				 	background:colorList[node.manyType%7],
 				 	color:'#fff',
 				 }">
 					{{node.manyTypeN}}
+				</view>
+				<view v-if="node.tag" class="meter-state" v-for="(item ,i)	in  getTags(node.tag)"
+				 :style="{
+					  borderColor:item.color,
+				 	background:item.color,
+				 	color:'#fff',
+				 }">
+					{{item.name}}
 				</view>
 			</view>
 			<view class="operationList">
@@ -159,7 +167,36 @@ export default {
 		this.toggle()
 	}
   },
-  methods: {
+  methods: {
+	  getTags(tag){
+		  if(!tag){
+			  return []
+		  }
+		  var sz=[]
+		  var str1=tag.split(',')
+		  for(var i in str1){
+			  if(str1[i].indexOf('#')>-1){
+				  var str2=str1[i].split('#');
+				  console.log(str2[1],typeof(str2[1]))
+				   var num =parseInt(str2[1])
+				  if(!isNaN(num)){
+					  
+					 sz.push({
+					 				  name:str2[0],
+					 				  color:this.colorList[num%7]
+					 }) 
+				  }else{
+					 sz.push({
+					 				  name:str2[0],
+					 				  color:'#'+str2[1]
+					 }) 
+				  }
+				  
+			  }
+			 
+		  }
+		  return sz
+	  },
 	  switchBtn(node,key){
 		  this.$emit('switchBtn',node,key)
 	  },