<!-- <template>
	<view class="content">
		<tki-tree ref="tkitree" :selectParent="selectParent" :multiple="multiple" :range="list" :foldAll="flod" rangeKey="label" @confirm="treeConfirm"
		 @cancel="treeCancel"></tki-tree>
	</view>
</template>

<script>
	import tkiTree from '@/components/tki-tree/tki-tree.vue';
	export default {
		components: {tkiTree},
		data() {
			return {
				list: [],
				multiple: false,
				selectParent: false,
				flod: false,
			}
		},
		onLoad(e) {
			var that=this;
			if(e.deptId&&!that._GET.clear){	
				that._GET.clear=false
				that.list=JSON.parse(uni.getStorageSync('testList'))
			}else{
				that._GET.clear=true
				that.getDataFn()
			}
		},
		methods: {
			getDataFn(){
				var that=this;
				this.$http.get("system/dept/treeselect").then(res => {
					if(res.code == 200){
						this.list = res.data
					}else {
						uni.showToast({
							title: res.msg,
							duration: 1000,
							icon: 'none'
						});
					}
				})
			},
			// 确定回调事件
			treeConfirm(e) {
				let pages = getCurrentPages(); //获取当前页面js里面的pages里的所有信息。
				let prevPage = pages[pages.length - 2]; 
				prevPage.data.id = e[0].id
				prevPage.data.label = e[0].label
				
				this.$nextTick(function(){
					uni.navigateBack({
						delta:1
					})
				})
				// var obj={
				// 	id:e[0].id,
				// 	label:e[0].label
				// }
				// uni.setStorageSync("classData",JSON.stringify(obj))
				
				console.log(e)
			},
			// 取消回调事件
			treeCancel(e) {
				console.log(e)
			},
			// 显示树形选择器
			showTree() {
				this.$refs.tkitree._show();
			},
		}
	}
</script>

<style>

</style>
 -->