<template>
	<view>
		<cu-custom bgColor="bg-gradual-pink" :isBack="true">
			<block slot="backText">返回</block>
			<block slot="content">组织架构</block>
		</cu-custom>
		<xiaolu-tree  :checkList="checkList"  v-if="tree.length>0"  :props="prop" @sendValue="confirm"  :isCheck="true" :treeNone="tree"></xiaolu-tree>
		
	</view>
</template>

<script>
	import XiaoluTree from'@/components/xiaolu-tree/tree.vue'
	import api from '@/api/api'
	export default {
		components: {
			XiaoluTree
		},
		data() {
			return {
				data:[],
				userUrl:'/sys/user/departList',
				departName:'',
				orgName:'',
				tree: [],
				checkList: [],
				backList: this.checkList,
				prop:{
				label: 'name',
				children: 'children',
				multiple:true,
				},
				max: 5,	
			}
			},
			watch:{
				departName:{
					handler(newVal, objVal) {
					 this.querydepartName(newVal);
			  },
				}
			},
			created(){
				this.querydepartName()
				uni.setStorageSync("orgType",3);
			},
			methods:{
				
				jump(s){
					console.log(s)
					this.$store.commit('SET_DEPARTID',s)
					 this.$Router.push({name:'wagesuser'}) 
				},
				querydepartName(s){
					this.$http.get(this.userUrl,{params:{departName:s}}).then(res=>{
						console.log("res",res)
						 this.tree=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>
