org.vue 1.32 KB
<template>
	<view class="org-content">
		<!-- 公共组件-每个页面必须引入 -->
		<public-module></public-module>
		<view>
			<luyj-tree @sendValue="confirm" :is-check="isCheck" search-placeholder="请输入搜索内容" :search-if="true" v-slot:default="{ item }" :max="max" :trees="tree">
				<view>
					<view class="content-item">
						<view class="word">{{ item.name }}</view>
					</view>
				</view>
			</luyj-tree>
		</view>
	</view>
</template>

<script>
import { transOrgFunc } from '@/config/common.js';

export default {
	data() {
		return {
			isCheck: true, // 是否可选
			tree: [],
			max: 5,
			id: ''
		};
	},
	onLoad(e) {
		// 隐藏原生的tabbar
		uni.hideTabBar();
		this.loadData();
	},
	methods: {
		loadData() {
			uni.$u.http
				.get('/yt/organization/me/list')
				.then(res => {
					if (res) {
						const list = transOrgFunc(res);
						this.tree = list;
					}
				})
				.catch(e => {});
		},
		confirm(val) {
			this.id = val[0].id;
			let pages = getCurrentPages(); //获取所有页面栈实例列表
			let nowPage = pages[pages.length - 1]; //当前页页面实例
			let prevPage = pages[pages.length - 2]; //上一页页面实例
			prevPage.$vm.ordId = this.id;
			uni.navigateBack({
				delta: 1
			});
		}
	}
};
</script>

<style lang="scss" scoped>
.org-content {
	padding: 0 10rpx;
}
</style>