Merge pull request 'liaojie' (#280) from liaojie into dev
Reviewed-on: http://git.feashow.cn/clay/tunnel-cloud-web/pulls/280
This commit is contained in:
@@ -63,11 +63,22 @@ const loader = new OBJLoader();
|
||||
let hdrLoader = new RGBELoader();
|
||||
let backColorSet = three.sRGBEncoding;
|
||||
const modelStore = useModelSceneStore();
|
||||
const params = defineProps(["isedit", "tunnelId", "tunnelLen", "tunnelName"]); //接收参数看是不是编辑模式,如果是编辑模式,则需要做一些处理
|
||||
const params = defineProps(["isedit", "tunnelId", "tunnelLen", "tunnelName", "largeScreen"]); //接收参数看是不是编辑模式,如果是编辑模式,则需要做一些处理
|
||||
|
||||
|
||||
|
||||
let isedit = ref(params.isedit)
|
||||
let fanData;
|
||||
|
||||
watch(
|
||||
() => params.largeScreen,
|
||||
(now) => {
|
||||
params.largeScreen = now;
|
||||
fanData = (toRaw(params.largeScreen.value)).frequencyChangerList;
|
||||
console.log(fanData);
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
// const form = ref({
|
||||
// tunnelName: "",
|
||||
// serialNumber: "",
|
||||
@@ -133,6 +144,7 @@ async function handleMounted() {
|
||||
// );
|
||||
// 初始化设备模型
|
||||
try {
|
||||
|
||||
//在这加载隧道
|
||||
const map = new Map();
|
||||
map.set("equ_fan", await loadModel("/devicesModel/model2.obj"));
|
||||
@@ -141,8 +153,9 @@ async function handleMounted() {
|
||||
demo.initDevicesModel(map);
|
||||
// const equipmentList = await store.getEquipmentList();
|
||||
modelList.value = await modelStore.initModelDataPreview(params.tunnelId);
|
||||
// console.log(modelList.value);
|
||||
// console.log("init", params.tunnelId);
|
||||
demo.previewtunnelModeInit(toRaw(modelList.value));
|
||||
demo.previewtunnelModeInit(toRaw(modelList.value), fanData);
|
||||
demo.SignsInf(params.tunnelName, String(params.tunnelLen.value))
|
||||
// watch(
|
||||
// () => params.tunnelId,
|
||||
|
||||
@@ -388,6 +388,7 @@ export default class Demo {
|
||||
// 初始化风机颜色
|
||||
this.equMap.get("equ_fan").traverse((v) => {
|
||||
v.material = new this.THREE.MeshBasicMaterial();
|
||||
// v.material.color = new this.THREE.Color(0xFF0000);
|
||||
v.material.color = new this.THREE.Color(0xC0C0C0);
|
||||
if (/^leaf/.test(v.name) || /^roller/.test(v.name)) {
|
||||
group.add(v.clone());
|
||||
@@ -512,7 +513,7 @@ export default class Demo {
|
||||
}
|
||||
SignsInf(tunnelName, tunnelLength) {
|
||||
let Signs = this.scene.getObjectByName('streetSigns');
|
||||
console.log(Signs);
|
||||
// console.log(Signs);
|
||||
const tag = new this.THREE.Mesh(
|
||||
new this.THREE.PlaneGeometry(100, 76),
|
||||
new this.THREE.MeshBasicMaterial({ color: "white" })
|
||||
|
||||
@@ -8,14 +8,14 @@ import EquipmentTag from "../utils/EquipmentTag";
|
||||
//formInfo需要的信息这里包括了
|
||||
//equipmentType
|
||||
|
||||
function addEquipment(targetPoint, formInfo) {
|
||||
function addEquipment(targetPoint, formInfo, fanData) {
|
||||
if (targetPoint.hasDevice) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (formInfo.equipmentType) {
|
||||
case "frequency":
|
||||
handleFanEqu.call(this, targetPoint, formInfo);
|
||||
handleFanEqu.call(this, targetPoint, formInfo, fanData);
|
||||
break;
|
||||
// 还没有风压阀的模型,所以先用其他设备传感器实现
|
||||
// case "valve":
|
||||
@@ -177,6 +177,7 @@ function handleOtherEqu(targetPoint, equipmentInfo) {
|
||||
function handleFanEqu(
|
||||
targetPoint,
|
||||
equipmentInfo,
|
||||
fanData,
|
||||
speed = Math.random().toFixed(1) * 1000
|
||||
) {
|
||||
// 由于风机比较多,每个风机转速不一直,保存在一个数中遍历
|
||||
@@ -196,6 +197,41 @@ function handleFanEqu(
|
||||
id: equMesh.id, //模型在场景id
|
||||
...equipmentInfo,
|
||||
};
|
||||
// console.log(targetPoint.info);
|
||||
//风机颜色重新命名
|
||||
let fan1 = fanData[0].equipmentType
|
||||
let fan2 = fanData[1].equipmentType
|
||||
if (targetPoint.info.typeKey == fan1) {
|
||||
if (fanData[0].online == false) {
|
||||
this.scene.traverse(function (child) {
|
||||
if (child.id === 1005) {
|
||||
child.traverse(function (obj) {
|
||||
// console.log(obj);
|
||||
// 判断子对象是否是物体,如果是,更改其颜色
|
||||
if (obj.isMesh) {
|
||||
obj.material.color.set(0xFF0000)
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
if (fanData[1].online == false) {
|
||||
this.scene.traverse(function (child) {
|
||||
if (child.id === 1005) {
|
||||
child.traverse(function (obj) {
|
||||
// console.log(obj);
|
||||
// 判断子对象是否是物体,如果是,更改其颜色
|
||||
if (obj.isMesh) {
|
||||
obj.material.color.set(0xFF0000)
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
// console.log(fanData);
|
||||
|
||||
|
||||
// 定义风机旋转
|
||||
const fanLeaf = equMesh.getObjectByName("fan_leafs");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
export default function previewtunnelModeInit(equipmentList) {
|
||||
export default function previewtunnelModeInit(equipmentList, fanData) {
|
||||
//初始化将墙壁隐藏起来
|
||||
// for (let line = 1; line <= 20; line++) {
|
||||
// if (line < 10) {
|
||||
@@ -13,7 +13,7 @@ export default function previewtunnelModeInit(equipmentList) {
|
||||
// console.log(equipmentList);
|
||||
|
||||
equipmentList.forEach((item) => {
|
||||
this.addEquipment(this.scene.getObjectByName(item.position), item);
|
||||
this.addEquipment(this.scene.getObjectByName(item.position), item, fanData);
|
||||
});
|
||||
//进行预览和编辑模式的一些操作
|
||||
if (this.isedit == false) {
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
<!-- <tunnel-scene id="tunnel-box" :isedit="false" /> -->
|
||||
<!-- 一进去的话应该是预览模式,所以引入这个组件1 -->
|
||||
<preview-scene id="tunnel-box" :isedit="false" :tunnelId="tunnelId" :key="tunnelId" :tunnelLen="tunnelLen"
|
||||
:tunnelName="tunnelName"></preview-scene>
|
||||
:tunnelName="tunnelName" :largeScreen="largeScreen"></preview-scene>
|
||||
<div class="left">
|
||||
<el-drawer v-model="drawerLeft" direction="ltr" modal-class="modal-box" :modal="false" :show-close="false"
|
||||
:close-on-click-modal="false" :close-on-press-escape="false">
|
||||
@@ -87,6 +87,7 @@ import {ElMessage, ElMessageBox} from "element-plus";
|
||||
import { getUserInfo } from "@/api/login";
|
||||
import { initSceneData } from "@/api/tunnelScene";
|
||||
import { getTunnelList } from "@/api/tunnelManage";
|
||||
import { computed } from "vue";
|
||||
|
||||
const authStore = useAuthStore();
|
||||
const router = useRouter();
|
||||
@@ -249,6 +250,7 @@ const getScreenInfo = (id) => {
|
||||
showBadLoading.value = 1
|
||||
}
|
||||
largeScreenData.value = res.data;
|
||||
// console.log(largeScreenData.value);
|
||||
} else {
|
||||
ElMessage.warning(res.msg)
|
||||
}
|
||||
@@ -276,6 +278,7 @@ const getList = () => {
|
||||
})
|
||||
}
|
||||
//根据站点id获取隧道信息option
|
||||
let largeScreen = computed(() => largeScreenData)
|
||||
const getTunnel = (id) => {
|
||||
getTunnelBySiteId(id).then((res) => {
|
||||
if (res?.code === 1000) {
|
||||
|
||||
Reference in New Issue
Block a user