初始化功能大致完成
This commit is contained in:
@@ -84,6 +84,9 @@ async function handleMounted() {
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
}
|
||||
|
||||
demo.tunnelModeInit();
|
||||
|
||||
}
|
||||
|
||||
// 每个模型加载回调
|
||||
@@ -216,45 +219,32 @@ function handleCancel() {
|
||||
const ThreeConfig = {
|
||||
code: 0,
|
||||
data: {
|
||||
tunnelThreeConfig: {
|
||||
fan: ['point_005_tl', 'point_009_bl'],
|
||||
sensors: ['point_018_br', 'point_021_bl'],
|
||||
}
|
||||
tunnelThreeConfig: [{
|
||||
equipmentId: 'fan_01',//传感器id
|
||||
equipmentName: '01',//设备名称
|
||||
pointName: 'point_005_tl',//附着点名称(定位)
|
||||
equipmentType: 'fan',//设备类型(类型可根据后端
|
||||
equipmentValue: 23, //设备存的值
|
||||
}, {
|
||||
equipmentId: 'sensors_01',//传感器id
|
||||
equipmentName: '01',//设备名称
|
||||
pointName: 'point_009_bl',//附着点名称(定位)
|
||||
equipmentType: 'sensors',//设备类型(类型可根据后端
|
||||
equipmentValue: 67, //设备存的值
|
||||
}],
|
||||
},
|
||||
msg: "dda",
|
||||
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);
|
||||
//取值方便操作
|
||||
// const tunnelConfigEquipment = ThreeConfig.data.tunnelThreeConfig
|
||||
|
||||
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()
|
||||
// function tunnelModeInit() {
|
||||
// for (const item of tunnelConfigEquipment) {
|
||||
// let pointmodel = demo.scene.getobjectByName(item.pointName)
|
||||
// console.log(pointmodel);
|
||||
// }
|
||||
// }
|
||||
// tunnelModeInit()
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user