<template>
    <div class="bim-setting-page">
        <div id="bimSettingContainer"></div>
        <model-floor-tree ref="modelFloorTree" :projectMessage="models" v-if="showTree"></model-floor-tree>
    </div>
</template>

<script>
import useUserStore from '@/store/modules/user'
import { listBimModel } from '@/api/bim/bimModel'
import ModelFloorTree from './ModelFloorTree.vue'
export default {
    components: {
        ModelFloorTree,
    },
    data() {
        return {
            userStore: {},
            isAdmin: false,
            projects: [],
            currentPrjId: null,
            currentComId: null,
            subDepts: [],
            models: [],
            showTree: false,
        }
    },
    mounted() {
        this.userStore = useUserStore()
        this.isAdmin = this.userStore.isAdmin
        this.currentPrjId = this.userStore.currentPrjId
        this.currentComId = this.userStore.currentComId
        this.initLoadModel()
    },
    methods: {
        initLoadModel() {
            listBimModel({
                pageNum: 1,
                pageSize: 10,
                comId: this.currentComId,
                projectId: this.currentPrjId,
            }).then((d) => {
                this.models = d.rows || []
                if (this.models.length == 0) {
                    this.$model.msgError('暂无模型，请先关联模型')
                } else {
                    this.showTree = true
                }
            })
        },
    },
}
</script>

<style lang="scss">
.bim-setting-page {
    position: relative;
}
</style>