main
wangqiujuan0808 2023-12-15 14:58:56 +08:00
parent 2cb6a3f4c4
commit 0d2a3c5367
3 changed files with 36 additions and 32 deletions

View File

@ -1,5 +1,5 @@
<template> <template>
<div class="navbar1"> <div class="navbar1" :style="{'backgroundColor' : background}">
<!-- <top-nav id="topmenu-container" class="topmenu-container" v-if="settingsStore.topNav" /> --> <!-- <top-nav id="topmenu-container" class="topmenu-container" v-if="settingsStore.topNav" /> -->
<div class="left"> <div class="left">
<!-- <img src="@/assets/logo/logo.png" alt="dark" /> --> <!-- <img src="@/assets/logo/logo.png" alt="dark" /> -->
@ -8,7 +8,7 @@
</span> </span>
</div> </div>
<div class="middle"> <div class="middle">
BIM运维管理系统 BIM运维管理系统{{ test }}
</div> </div>
<div class="right-menu"> <div class="right-menu">
<template v-if="appStore.device !== 'mobile'"> <template v-if="appStore.device !== 'mobile'">
@ -71,7 +71,9 @@ import useAppStore from '@/store/modules/app'
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
import useSettingsStore from '@/store/modules/settings' import useSettingsStore from '@/store/modules/settings'
import dayjs from "dayjs"; import dayjs from "dayjs";
import { computed } from 'vue'
const router = useRouter(); const router = useRouter();
import bimStore from '@/store/modules/bim';
const appStore = useAppStore() const appStore = useAppStore()
const userStore = useUserStore() const userStore = useUserStore()
@ -81,9 +83,10 @@ const data = reactive({
interval: "", interval: "",
currentTime: "", currentTime: "",
time: "", time: "",
week: "" week: "",
background: ''
}); });
const { interval, currentTime, time, week } = toRefs(data); const { interval, currentTime, time, week,background } = toRefs(data);
onMounted(() => { onMounted(() => {
interval.value = setInterval(updateTime, 1000); interval.value = setInterval(updateTime, 1000);
@ -91,6 +94,9 @@ onMounted(() => {
onUnmounted(() => { onUnmounted(() => {
clearInterval(interval.value); clearInterval(interval.value);
}); });
watch(() => bimStore().activateMenu, value => background.value = value.background);
function toggleSideBar() { function toggleSideBar() {
appStore.toggleSideBar() appStore.toggleSideBar()
} }

View File

@ -37,14 +37,9 @@ const data = reactive({
{ {
label: '消防系统', label: '消防系统',
id: '0-1', id: '0-1',
url: '/jz/glb/scene.gltf' url: '/jz/glb/scene.gltf',
children:[]
}, }
{
label: '电力系统',
id: '0-2',
url: '/seraphine/scene.gltf'
},
], ],
}, },
@ -55,17 +50,17 @@ const { applicationValue, treeData, checkedkeys } = toRefs(data);
const emit = defineEmits(['handleNodeClick']) const emit = defineEmits(['handleNodeClick'])
onMounted(() => { onMounted(() => {
nextTick(() => { nextTick(() => {
checkedkeys.value = treeData.value[0].children[0].id; checkedkeys.value = treeData.value[0].id;
// myTree.setCurrentKey(checkedkeys.value); bimStore().setActivateApplicationTree(treeData.value[0]);
bimStore().setActivateApplicationTree(treeData.value[0].children[0]); handleNodeClick(treeData.value[0]);
handleNodeClick(treeData.value[0].children[0]);
}) })
}); });
const handleNodeClick = (value) => { const handleNodeClick = (value) => {
bimStore().setActivateTree(value); bimStore().setActivateTree(value);
const isParent = value.children.length > 0;
emit('handleNodeClick', value); emit('handleNodeClick', value);
setTimeout(() => { setTimeout(() => {
Bus.emit('clickApplication'); Bus.emit('clickApplication', isParent );
}, 100) }, 100)
} }

View File

@ -15,9 +15,6 @@
<div class="button" @click="roam()"> <div class="button" @click="roam()">
漫游 漫游
</div> </div>
<div class="button" @click="xiaof()">
消防
</div>
</div> </div>
</div> </div>
</template> </template>
@ -92,9 +89,12 @@ Bus.on('clickDevice', (isParent) => {
}) })
// //
Bus.on('clickApplication', e => { Bus.on('clickApplication', (isParent) => {
// Todo // Todo
console.log('clickApplication'); if(!isParent) {
xiaof();
}
}) })
watch(() => bimStore().activateMenu, value => { watch(() => bimStore().activateMenu, value => {
@ -219,6 +219,7 @@ const onMouseDownRight = (event) => {
const clickedObject = intersects[0].object; const clickedObject = intersects[0].object;
console.log('这是我选中的模型', clickedObject); console.log('这是我选中的模型', clickedObject);
var selectedObject = isSelent(clickedObject); var selectedObject = isSelent(clickedObject);
// addLabel(selectedObject);
emit('handleRightClick', selectedObject); emit('handleRightClick', selectedObject);
} }
} }
@ -371,10 +372,16 @@ const renders = () => {
let roamdObjects = ref([]); let roamdObjects = ref([]);
// //
const toHomeView = () => { const toHomeView = () => {
//
if (selectBoxByClick) { if (selectBoxByClick) {
scene.remove(selectBoxByClick); scene.remove(selectBoxByClick);
} }
//
if(!isAddLabel.value) {
removeLabel(); removeLabel();
isAddLabel.value = !isAddLabel.value;
}
//
controls.reset(); controls.reset();
} }
// //
@ -395,16 +402,15 @@ const nearCamera = (floor) => {
// //
const setLabel = () => { const setLabel = () => {
if (isAddLabel.value) { if (isAddLabel.value) {
addLabel(); let obj = scene.getObjectByName('set2');
addLabel(obj);
} else { } else {
removeLabel(); removeLabel();
toHomeView();
} }
isAddLabel.value = !isAddLabel.value; isAddLabel.value = !isAddLabel.value;
} }
// //
const addLabel = () => { const addLabel = (obj) => {
let obj = scene.getObjectByName('set2');
// console.log(123, obj); // console.log(123, obj);
centerSelectedGroup(obj); centerSelectedGroup(obj);
let text = "设备二"; let text = "设备二";
@ -427,10 +433,7 @@ const createLableObj = (text) => {
return pointLabel; return pointLabel;
}; };
const removeLabel = () => { const removeLabel = () => {
if(pointLabel) {
isAddLabel.value = true;
document.body.removeChild(labelRenderer.domElement); document.body.removeChild(labelRenderer.domElement);
}
} }
@ -468,7 +471,7 @@ const xfadd = (obj,state)=> {
const sprite = new THREE.Sprite(spriteMaterial); const sprite = new THREE.Sprite(spriteMaterial);
// //
sprite.scale.set(5, 5, 5); sprite.scale.set(5, 5, 5);
sprite.position.y = 5; // sprite.position.y = 10; //
obj.add(sprite); //tagobj obj.add(sprite); //tagobj
} }