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) {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<template>
|
||||
<div id="main">
|
||||
<div class="box-top">
|
||||
<manage-btn v-model="selectIndex" @select="manageSelect" :list="routeList" v-if="showMenu"/>
|
||||
<tunnel-title v-if="showTunnelTitle"/>
|
||||
<manage-btn v-model="selectIndex" @select="manageSelect" :list="routeList" v-if="showMenu" />
|
||||
<tunnel-title v-if="showTunnelTitle" />
|
||||
<div class="top-length">
|
||||
<!-- <span>隧道总长度: {{ tunnelLength }}米</span>-->
|
||||
<span>当前施工长度: {{ constructionLength }}米</span>
|
||||
@@ -15,8 +15,8 @@
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item v-for="item in siteList" :key="item.value" :command="item">{{
|
||||
item.label
|
||||
}}
|
||||
item.label
|
||||
}}
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
@@ -32,25 +32,25 @@
|
||||
<!-- <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">
|
||||
:close-on-click-modal="false" :close-on-press-escape="false">
|
||||
<fan-info v-if="showFan" :list="socketData.leftData" :fan-data="largeScreenData"
|
||||
:transducer-data="largeScreenData" :loading="showFanLoading" :tunnel-id="tunnelId"/>
|
||||
<used-ele v-if="showFan" :list="socketData.leftData" :ele-data="largeScreenData"/>
|
||||
:transducer-data="largeScreenData" :loading="showFanLoading" :tunnel-id="tunnelId" />
|
||||
<used-ele v-if="showFan" :list="socketData.leftData" :ele-data="largeScreenData" />
|
||||
</el-drawer>
|
||||
<div v-if="drawerLeft" class="left-arrow" @click="closeLeft"></div>
|
||||
<div v-else class="shrink-left" @click="closeLeft"></div>
|
||||
</div>
|
||||
<div class="right">
|
||||
<el-drawer v-model="drawerRight" direction="rtl" modal-class="modal-box" :modal="false" :show-close="false"
|
||||
:close-on-click-modal="false" :close-on-press-escape="false">
|
||||
:close-on-click-modal="false" :close-on-press-escape="false">
|
||||
<wind-pressure-list v-if="showFan" :list="socketData.windPressure" :win-data="largeScreenData"
|
||||
:loading="showWindLoading"/>
|
||||
<air-info v-if="showFan" :list="socketData.sensor" :air-data="largeScreenData"/>
|
||||
:loading="showWindLoading" />
|
||||
<air-info v-if="showFan" :list="socketData.sensor" :air-data="largeScreenData" />
|
||||
<bad-gas-info v-if="showFan" :list="socketData.sensor" :bad-gas-data="largeScreenData" :tunnelId="tunnelId"
|
||||
:loading="showBadLoading"/>
|
||||
:loading="showBadLoading" />
|
||||
</el-drawer>
|
||||
<div v-if="drawerRight" class="right-arrow" @click="closeRight"></div>
|
||||
<div v-else class="shrink-right" @click="closeRight"></div>
|
||||
@@ -58,7 +58,7 @@
|
||||
<div class="switch-btn">
|
||||
<div class="arrow" @click="previousBtn"></div>
|
||||
<el-carousel height="150px" type="card" ref="tunnelBtn" :autoplay="false" :initial-index="initialIndex"
|
||||
@change="changeTunnel">
|
||||
@change="changeTunnel">
|
||||
<div class="btn">
|
||||
<el-carousel-item v-for="item in tunnelList" :key="item.value">
|
||||
{{ item.label }}
|
||||
@@ -79,14 +79,15 @@ import AirInfo from "@/components/content/airInfo/AirInfo.vue";
|
||||
import BadGasInfo from "@/components/content/badGasInfo/BadGasInfo.vue";
|
||||
import ManageBtn from "@/components/manageBtn/index.vue";
|
||||
import TunnelTitle from "@/components/tunnelTitle/index.vue";
|
||||
import {dateFormat} from "@/utils/date.js";
|
||||
import {getToken} from "@/utils/auth";
|
||||
import {useAuthStore} from "@/store/userstore.js";
|
||||
import {getLargeScreen, getLargeScreenInfo, getTunnelBySiteId} from "@/api/largeScreen";
|
||||
import {ElMessage, ElMessageBox} from "element-plus";
|
||||
import {getUserInfo} from "@/api/login";
|
||||
import {initSceneData} from "@/api/tunnelScene";
|
||||
import {getTunnelList} from "@/api/tunnelManage";
|
||||
import { dateFormat } from "@/utils/date.js";
|
||||
import { getToken } from "@/utils/auth";
|
||||
import { useAuthStore } from "@/store/userstore.js";
|
||||
import { getLargeScreen, getLargeScreenInfo, getTunnelBySiteId } from "@/api/largeScreen";
|
||||
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();
|
||||
@@ -203,7 +204,7 @@ const getOtherInfo = () => {
|
||||
nextTick(() => {
|
||||
showTunnelTitle.value = true
|
||||
});
|
||||
console.log('siteId',siteId)
|
||||
console.log('siteId', siteId)
|
||||
getTunnel(siteId)
|
||||
} else {
|
||||
getTunnel(res.data.siteOption[0].value)
|
||||
@@ -233,12 +234,12 @@ const getScreenInfo = (id) => {
|
||||
if (res.data.sensorList.length !== 0) {
|
||||
res.data.sensorList.forEach((item) => {
|
||||
if (
|
||||
item.equipmentType === "carbonDioxide" ||
|
||||
item.equipmentType === "carbonMonoxide" ||
|
||||
item.equipmentType === "hydrogenSulfide" ||
|
||||
item.equipmentType === "sulfurDioxide" ||
|
||||
item.equipmentType === "sulfurMonoxide" ||
|
||||
item.equipmentType === "nitrogenDioxide"
|
||||
item.equipmentType === "carbonDioxide" ||
|
||||
item.equipmentType === "carbonMonoxide" ||
|
||||
item.equipmentType === "hydrogenSulfide" ||
|
||||
item.equipmentType === "sulfurDioxide" ||
|
||||
item.equipmentType === "sulfurMonoxide" ||
|
||||
item.equipmentType === "nitrogenDioxide"
|
||||
) {
|
||||
showBadLoading.value = 0
|
||||
} else {
|
||||
@@ -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) {
|
||||
@@ -289,7 +292,7 @@ const getTunnel = (id) => {
|
||||
} else {
|
||||
if (!pattern.test(previewId)) {
|
||||
getScreenInfo(previewId)
|
||||
}else {
|
||||
} else {
|
||||
getScreenInfo(res.data[0]?.value)
|
||||
tunnelName = res.data[0].label
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user