<template>
	<div style="background-color: #FFFFFF;">
		
		<cu-custom bgColor="bg-gradual-pink" :isBack="true">
			<block slot="backText">返回</block>
			<block slot="content">组织架构</block>
		</cu-custom>
		<div class="ins">
			<div style="height: 3px;"></div>
			 <input  placeholder="🔍  搜索" style="text-align: center;" v-model="departName" />
		</div>
		<br>
		<div style="height: 10px;width: 100%;background-color: #F1F1F1 ;"></div>
		<div style="height: 10px;width: 100%;"></div>
		<span style="margin-left: 20px; color:  #A3A7B1;">{{orgName.departName}}</span>
		
		<view class="cu-list menu  radius" >
		  <view class="cu-item arrow animation-slide-bottom" :style="[{animationDelay: '0.1s'}]" v-for='(item,index) in data'>
		    <navigator class="content" @click="jump(item.departId)" hover-class="none">
		     
		      <text class="text-grey">{{item.orgCodeTxt}} ({{item.count}})</text>
		   </navigator>
		  </view> 
					</view>
	</div>
</template>

<script>
	import api from '@/api/api'
	export default {
		data() {
			return {
				data:[],
				userUrl:'/sys/user/departList',
				departName:'',
				orgName:''
			}
			},
			watch:{
				departName:{
					handler(newVal, objVal) {
					 this.querydepartName(newVal);
			  },
				}
			},
			created(){
				this.querydepartName()
			},
			methods:{
				
				jump(s){
					console.log(s)
					this.$store.commit('SET_DEPARTID',s)
					 this.$Router.push({name:'teams'}) 
				},
				querydepartName(s){
					this.$http.get(this.userUrl,{params:{departName:s}}).then(res=>{
						console.log("res",res)
						 this.data=res.data.departName;
						 this.orgName=res.data.orgName;
						
					}).catch(err => {
						console.log(err);
					});
				},
				ret(){
					this.$Router.push({name:'index'})
				},
				
			}
			
	}
	
	
</script>

<style>
	.ins{
		background-color: #F1F1F1;
		width: 90%;
		height: 30px;
		margin:0 auto;
		border-radius:5px 5px 5px 5px; 
		margin-top: 20px;
		
	}
	.s{
		list-style-type:none;
		margin-left: -40px;
	}
	
	.imgs{
		width: 15px;
		height: 15px;
		float: right;
	}
	
	.top{
		  background-color: #5677AC;
		  width: 100%;
		  height: 40px;
		 
	}
</style>
