<!--
人员视角 - 权限设置展示
@Author: linqian
@Date: 2021-04-21
-->
<template>
    <div>
        <dg-scrollbar>
            <div class="auth-group" style="height: calc(100vh - 19rem)">
                <template v-if="authData.length > 0">
                    <set-auth-tree
                        :showCheckbox="false"
                        v-for="(item, index) in authData"
                        :key="index"
                        :treeData="item"
                        :idcard="idcard"
                        :tab="tab"
                    ></set-auth-tree>
                </template>
                <p v-else-if="authData.length == 0 && idcard">没有设置相关的数据权限。</p>
                <p v-else>请选择人员。</p>
            </div>
        </dg-scrollbar>
    </div>
</template>

<script>
import setAuthTree from "@/pages/data-auth-manage/components/set-auth-tree";
import { userDataTreeByIdcard } from "@/api/data-auth.js";

export default {
    components: {
        setAuthTree
    },
    props: {
        tab: String,
        idcard: String
    },
    data() {
        return {
            authData: []
        };
    },
    computed: {},
    methods: {},
    created() {
        if (this.idcard) {
            userDataTreeByIdcard(this.tab, this.idcard).then((res) => {
                this.authData = res.data.content;
            });
        }
    },
    mounted() {}
};
</script>

<style lang='scss'>
</style>