<template>
	<view class="page-main">
		<liu-folding-panel :dataList="deptList" @change="change"></liu-folding-panel>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				deptList: []
			}
		},
		onLoad() {
			this.getList()
		},
		methods: {
			getList() {
				// 获取改角色的部门
				let userInfo = JSON.parse(uni.getStorageSync("userInfo"));
				this.sendRequest({
					url: "xmgl/company/getTenantOrgTreeList",
					data: {
						userId: userInfo.userId
					},
					method: "POST",
					success: (res) => {
						this.deptList = res.result;
					}
				})
			},
			change(e) {
				console.log(e, "点击")
				if (e.projectSn) {
					// 可以选择项目
					uni.setStorageSync("dept", e);
					uni.showToast({
						title: "切换成功"
					})
				}
			}
		}
	}
</script>