初始化功能还在做

This commit is contained in:
Hcat1314
2023-12-17 00:25:10 +08:00
parent fdecc480ec
commit 907f4cc220
2 changed files with 71 additions and 63 deletions

View File

@@ -2,30 +2,16 @@
<div id="scene">
<div id="cvs" ref="content"></div>
<dev-info ref="info" :devInfo="devInfo" />
<edit-dialog
ref="edit"
@addEquipment="handleAddEqu"
@removeEquipment="handleRemoveEqu"
@cancel="handleCancel"
:hasDev="hasDevice"
:pointNum="pointNum"
pointGap="500"
/>
<el-dialog
v-model="centerDialogVisible"
width="30%"
destroy-on-close
center
:show-close="false"
style="
<edit-dialog ref="edit" @addEquipment="handleAddEqu" @removeEquipment="handleRemoveEqu" @cancel="handleCancel"
:hasDev="hasDevice" :pointNum="pointNum" pointGap="500" />
<el-dialog v-model="centerDialogVisible" width="30%" destroy-on-close center :show-close="false" style="
margin: 20% auto;
width: 569px;
height: 330px;
background: rgba(7, 35, 72, 0.79);
border-radius: 20px;
border: 2px solid #0f82af;
"
>
">
<p id="remove-title">是否确定删除该设备</p>
<div class="btn">
<button @click="centerDialogVisible = false">取消</button>
@@ -108,7 +94,7 @@ function loadModel(path) {
(obj) => {
resolve(obj);
},
(xhr) => {},
(xhr) => { },
(err) => {
reject(err);
}
@@ -174,6 +160,8 @@ function rClickCallback(demo) {
demo.addFunction("editDev", editDev);
}
// 添加设备
function handleAddEqu(formInfo) {
if (!formInfo.equipmentType) {
@@ -221,6 +209,53 @@ function handleCancel() {
demo._resetState();
demo.clearTagsObj();
}
//现在首先有二种方案是写在TunnelScene.vue中还是demo.js中呢
//我认为可能看数据在哪获取到时候看在哪里导入首先我们放在TunnelScene里面吧
//因为没获取到接口,我们先写死!!!
//需要参考接口的数据结构!!!,主要是传入函数的参数应该是什么结构???
const ThreeConfig = {
code: 0,
data: {
tunnelThreeConfig: {
fan: ['point_005_tl', 'point_009_bl'],
sensors: ['point_018_br', 'point_021_bl'],
}
},
msg: "dda",
}
[{ type: 'fan', point: '' }, {}]
// fan: ['point_005_tl', 'point_009_bl'],
// sensors: ['point_018_br', 'point_021_bl'],
// }
const tunnelConfigEquipment = ThreeConfig.data.tunnelThreeConfig
const tunnelKeys = Object.keys(tunnelConfigEquipment);
console.log(tunnelKeys);
function tunnelModeInit() {
for (let key in ThreeConfig.data.tunnelThreeConfig) {
if (ThreeConfig.data.tunnelThreeConfig.hasOwnProperty(key)) {
switch (key) {
case 'fan':
ThreeConfig.data.tunnelThreeConfig.fan.forEach(fan => {
// 对 fan 进行操作
console.log(fan);
});
break;
case 'sensors':
ThreeConfig.data.tunnelThreeConfig.sensors.forEach(sensor => {
// 对 sensor 进行操作
console.log(sensor);
});
break;
default:
// 处理其他键值对
console.log(key, ThreeConfig.data.tunnelThreeConfig[key]);
}
}
}
}
tunnelModeInit()
</script>
<style lang="scss" scope>
@@ -228,10 +263,12 @@ function handleCancel() {
position: relative;
height: 100%;
width: 100%;
#cvs {
height: 100%;
}
}
#remove-title {
height: 42px;
font-size: 32px;
@@ -243,10 +280,12 @@ function handleCancel() {
text-align: center;
margin: 65px 0px 70px 0px;
}
.btn {
display: flex;
justify-content: center;
gap: 80px;
:nth-child(1) {
width: 190px;
height: 60px;
@@ -258,6 +297,7 @@ function handleCancel() {
line-height: 37px;
background: transparent;
}
:nth-child(2) {
width: 190px;
height: 60px;