YZProjectCloud/yanzhu-ui-vue3/src/views/bim/bimSetting/index.vue

94 lines
2.9 KiB
Vue
Raw Normal View History

2025-04-22 00:07:38 +08:00
<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,
2025-04-23 23:43:26 +08:00
initSuccess: false,
2025-04-22 00:07:38 +08:00
}
},
2025-04-23 23:43:26 +08:00
beforeUnmount() {
document.body.classList.remove('is-sapi')
},
2025-04-22 00:07:38 +08:00
mounted() {
2025-04-23 23:43:26 +08:00
document.body.classList.add('is-sapi')
2025-04-22 00:07:38 +08:00
this.userStore = useUserStore()
this.isAdmin = this.userStore.isAdmin
this.currentPrjId = this.userStore.currentPrjId
this.currentComId = this.userStore.currentComId
this.initLoadModel()
2025-04-23 23:43:26 +08:00
this.initEngine()
2025-04-22 00:07:38 +08:00
},
methods: {
2025-04-23 23:43:26 +08:00
initEngine() {
window.api = new SAPI(
{
serverIP: window.config.serverIP, //服务ip地址
port: window.config.port, //HTTP端口
useHttps: window.config.useHttps, //使用Https
container: 'bimSettingContainer', //[必须]容器id
secretKey: window.config.secretKey,
openEarth: window.config.openEarth, //[可选]开启Gis场景
bgColor: window.config.bgColor, //[可选]bim场景背景色, 传值即为纯色天空盒
tintColor: window.config.tintColor, //[可选]osgb单体化颜色
sceneTime: window.config.sceneTime, //[可选]分别为当前时间、日出时间、日落时间
cadMode: window.config.cadMode, // 是否是Cad图纸预览模式
},
() => {
this.initSuccess = true
console.log('初始化成功')
}
)
},
2025-04-22 00:07:38 +08:00
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;
2025-04-23 23:43:26 +08:00
height: 100%;
#bimSettingContainer {
height: 100%;
}
}
body.is-sapi {
.app-main {
height: calc(100vh - 84px);
}
2025-04-22 00:07:38 +08:00
}
</style>