main
wangqiujuan0808 2023-12-15 11:45:07 +08:00
parent 0271ed9129
commit 370b5089c3
4 changed files with 43 additions and 17 deletions

View File

@ -17,7 +17,7 @@ import RealInfo from './RealInfo.vue';
import HistoryInfo from './HistoryInfo.vue'; import HistoryInfo from './HistoryInfo.vue';
import { ElMessage } from 'element-plus'; import { ElMessage } from 'element-plus';
const deviceData = { const deviceData = {
'EQ0001': { 'set1': {
name: '立仓', name: '立仓',
imgUrl: 'licang', imgUrl: 'licang',
detail: [ detail: [
@ -75,7 +75,7 @@ const deviceData = {
}, },
] ]
}, },
'EQ0002': { 'set6': {
name: '过滤槽', name: '过滤槽',
imgUrl: 'guolvcao', imgUrl: 'guolvcao',
detail: [ detail: [

View File

@ -59,28 +59,28 @@ const data = reactive({
{ {
type: '生产设备', type: '生产设备',
name: '立仓', name: '立仓',
num: 'EQ0001', num: 'set1',
value: 45, value: 45,
id: "echartDiv0" id: "echartDiv0"
}, },
{ {
type: '生产设备', type: '生产设备',
name: '过滤槽', name: '过滤槽',
num: 'EQ0002', num: 'set6',
value: 130, value: 130,
id: "echartDiv1" id: "echartDiv1"
}, },
{ {
type: '安防设备', type: '安防设备',
name: '摄像头', name: '摄像头',
num: 'EQ0001', num: 'set1',
value: 180, value: 180,
id: "echartDiv2" id: "echartDiv2"
}, },
{ {
type: '消防设备', type: '消防设备',
name: '烟感', name: '烟感',
num: 'EQ0001', num: 'set1',
value: 100, value: 100,
id: "echartDiv3" id: "echartDiv3"
} }
@ -101,28 +101,28 @@ const data = reactive({
{ {
type: '生产设备', type: '生产设备',
name: '立仓', name: '立仓',
num: 'EQ0001', num: 'set1',
value: 15, value: 15,
id: "echartDiv0" id: "echartDiv0"
}, },
{ {
type: '生产设备', type: '生产设备',
name: '过滤槽', name: '过滤槽',
num: 'EQ0002', num: 'set6',
value: 50, value: 50,
id: "echartDiv1" id: "echartDiv1"
}, },
{ {
type: '安防设备', type: '安防设备',
name: '摄像头', name: '摄像头',
num: 'EQ0001', num: 'set1',
value: 80, value: 80,
id: "echartDiv2" id: "echartDiv2"
}, },
{ {
type: '消防设备', type: '消防设备',
name: '烟感', name: '烟感',
num: 'EQ0001', num: 'set1',
value: 50, value: 50,
id: "echartDiv3" id: "echartDiv3"
} }
@ -144,28 +144,28 @@ const data = reactive({
{ {
type: '生产设备', type: '生产设备',
name: '立仓', name: '立仓',
num: 'EQ0001', num: 'set1',
value: 30, value: 30,
id: "echartDiv0" id: "echartDiv0"
}, },
{ {
type: '生产设备', type: '生产设备',
name: '过滤槽', name: '过滤槽',
num: 'EQ0002', num: 'set6',
value: 80, value: 80,
id: "echartDiv1" id: "echartDiv1"
}, },
{ {
type: '安防设备', type: '安防设备',
name: '摄像头', name: '摄像头',
num: 'EQ00011', num: 'set1',
value: 100, value: 100,
id: "echartDiv2" id: "echartDiv2"
}, },
{ {
type: '消防设备', type: '消防设备',
name: '烟感', name: '烟感',
num: 'EQ0002', num: 'set1',
value: 50, value: 50,
id: "echartDiv3" id: "echartDiv3"
} }

View File

@ -42,7 +42,7 @@ onMounted(() => {
// //
window.addEventListener('contextmenu', function (e) { window.addEventListener('contextmenu', function (e) {
if (e.button === 2) { if (e.button === 2) {
console.log("点击了鼠标右键"); onMouseDownRight(e);
} }
}); });
// document.addEventListener("mousemove", onMouseMove); // document.addEventListener("mousemove", onMouseMove);
@ -197,6 +197,23 @@ const onMouseMove = (event) => {
} }
} }
} }
const emit = defineEmits(['handleRightClick'])
//
const onMouseDownRight = (event) => {
var raycaster = new THREE.Raycaster()
mouse.x = ((event.clientX - marginLeft) / window.innerWidth) * 2 - 1;
mouse.y = -((event.clientY - marginTop) / window.innerHeight) * 2 + 1;
raycaster.setFromCamera(mouse, camera);
const intersects = raycaster.intersectObjects(scene.children, true);
console.log(123, event);
if (intersects.length > 0) {
const clickedObject = intersects[0].object;
console.log('这是我选中的模型', clickedObject);
var selectedObject = isSelent(clickedObject);
emit('handleRightClick',selectedObject);
}
}
// //
const onMouseDown = (event) => { const onMouseDown = (event) => {
var raycaster = new THREE.Raycaster() var raycaster = new THREE.Raycaster()

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<!-- 场景模型 --> <!-- 场景模型 -->
<ThreeView light="0xfffafa" :sceneUrl="sceneUrl" v-if="sceneUrl !== ''"></ThreeView> <ThreeView light="0xfffafa" :sceneUrl="sceneUrl" v-if="sceneUrl !== ''" @handleRightClick="handleRightClick"></ThreeView>
<!-- <ThreeModel /> --> <!-- <ThreeModel /> -->
<!-- 底部菜单 --> <!-- 底部菜单 -->
<MenuTab @changeMenu="changeMenu"></MenuTab> <MenuTab @changeMenu="changeMenu"></MenuTab>
@ -95,6 +95,16 @@ const onError = () => {
const onProgress = () => { const onProgress = () => {
} }
const handleRightClick = (obj) => {
console.log(1,obj.name);
if(obj.name == 'set1' || obj.name == 'set6') {
bimStore().setDeviceNum(obj.name);
dialogVisible2.value = true;
}
// viewDetail();
}
const handleBuildClick = (value, isParent) => { const handleBuildClick = (value, isParent) => {
// / // /
if (isParent) { if (isParent) {
@ -122,7 +132,6 @@ const openDialog1 = () => {
} }
const viewDetail = (val) => { const viewDetail = (val) => {
console.log(val);
dialogVisible2.value = true; dialogVisible2.value = true;
} }
</script> </script>