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 hdrLoader = new RGBELoader();
|
||||||
let backColorSet = three.sRGBEncoding;
|
let backColorSet = three.sRGBEncoding;
|
||||||
const modelStore = useModelSceneStore();
|
const modelStore = useModelSceneStore();
|
||||||
const params = defineProps(["isedit", "tunnelId", "tunnelLen", "tunnelName"]); //接收参数看是不是编辑模式,如果是编辑模式,则需要做一些处理
|
const params = defineProps(["isedit", "tunnelId", "tunnelLen", "tunnelName", "largeScreen"]); //接收参数看是不是编辑模式,如果是编辑模式,则需要做一些处理
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
let isedit = ref(params.isedit)
|
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({
|
// const form = ref({
|
||||||
// tunnelName: "",
|
// tunnelName: "",
|
||||||
// serialNumber: "",
|
// serialNumber: "",
|
||||||
@@ -133,6 +144,7 @@ async function handleMounted() {
|
|||||||
// );
|
// );
|
||||||
// 初始化设备模型
|
// 初始化设备模型
|
||||||
try {
|
try {
|
||||||
|
|
||||||
//在这加载隧道
|
//在这加载隧道
|
||||||
const map = new Map();
|
const map = new Map();
|
||||||
map.set("equ_fan", await loadModel("/devicesModel/model2.obj"));
|
map.set("equ_fan", await loadModel("/devicesModel/model2.obj"));
|
||||||
@@ -141,8 +153,9 @@ async function handleMounted() {
|
|||||||
demo.initDevicesModel(map);
|
demo.initDevicesModel(map);
|
||||||
// const equipmentList = await store.getEquipmentList();
|
// const equipmentList = await store.getEquipmentList();
|
||||||
modelList.value = await modelStore.initModelDataPreview(params.tunnelId);
|
modelList.value = await modelStore.initModelDataPreview(params.tunnelId);
|
||||||
|
// console.log(modelList.value);
|
||||||
// console.log("init", params.tunnelId);
|
// console.log("init", params.tunnelId);
|
||||||
demo.previewtunnelModeInit(toRaw(modelList.value));
|
demo.previewtunnelModeInit(toRaw(modelList.value), fanData);
|
||||||
demo.SignsInf(params.tunnelName, String(params.tunnelLen.value))
|
demo.SignsInf(params.tunnelName, String(params.tunnelLen.value))
|
||||||
// watch(
|
// watch(
|
||||||
// () => params.tunnelId,
|
// () => params.tunnelId,
|
||||||
|
|||||||
@@ -388,6 +388,7 @@ export default class Demo {
|
|||||||
// 初始化风机颜色
|
// 初始化风机颜色
|
||||||
this.equMap.get("equ_fan").traverse((v) => {
|
this.equMap.get("equ_fan").traverse((v) => {
|
||||||
v.material = new this.THREE.MeshBasicMaterial();
|
v.material = new this.THREE.MeshBasicMaterial();
|
||||||
|
// v.material.color = new this.THREE.Color(0xFF0000);
|
||||||
v.material.color = new this.THREE.Color(0xC0C0C0);
|
v.material.color = new this.THREE.Color(0xC0C0C0);
|
||||||
if (/^leaf/.test(v.name) || /^roller/.test(v.name)) {
|
if (/^leaf/.test(v.name) || /^roller/.test(v.name)) {
|
||||||
group.add(v.clone());
|
group.add(v.clone());
|
||||||
@@ -512,7 +513,7 @@ export default class Demo {
|
|||||||
}
|
}
|
||||||
SignsInf(tunnelName, tunnelLength) {
|
SignsInf(tunnelName, tunnelLength) {
|
||||||
let Signs = this.scene.getObjectByName('streetSigns');
|
let Signs = this.scene.getObjectByName('streetSigns');
|
||||||
console.log(Signs);
|
// console.log(Signs);
|
||||||
const tag = new this.THREE.Mesh(
|
const tag = new this.THREE.Mesh(
|
||||||
new this.THREE.PlaneGeometry(100, 76),
|
new this.THREE.PlaneGeometry(100, 76),
|
||||||
new this.THREE.MeshBasicMaterial({ color: "white" })
|
new this.THREE.MeshBasicMaterial({ color: "white" })
|
||||||
|
|||||||
@@ -8,14 +8,14 @@ import EquipmentTag from "../utils/EquipmentTag";
|
|||||||
//formInfo需要的信息这里包括了
|
//formInfo需要的信息这里包括了
|
||||||
//equipmentType
|
//equipmentType
|
||||||
|
|
||||||
function addEquipment(targetPoint, formInfo) {
|
function addEquipment(targetPoint, formInfo, fanData) {
|
||||||
if (targetPoint.hasDevice) {
|
if (targetPoint.hasDevice) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (formInfo.equipmentType) {
|
switch (formInfo.equipmentType) {
|
||||||
case "frequency":
|
case "frequency":
|
||||||
handleFanEqu.call(this, targetPoint, formInfo);
|
handleFanEqu.call(this, targetPoint, formInfo, fanData);
|
||||||
break;
|
break;
|
||||||
// 还没有风压阀的模型,所以先用其他设备传感器实现
|
// 还没有风压阀的模型,所以先用其他设备传感器实现
|
||||||
// case "valve":
|
// case "valve":
|
||||||
@@ -177,6 +177,7 @@ function handleOtherEqu(targetPoint, equipmentInfo) {
|
|||||||
function handleFanEqu(
|
function handleFanEqu(
|
||||||
targetPoint,
|
targetPoint,
|
||||||
equipmentInfo,
|
equipmentInfo,
|
||||||
|
fanData,
|
||||||
speed = Math.random().toFixed(1) * 1000
|
speed = Math.random().toFixed(1) * 1000
|
||||||
) {
|
) {
|
||||||
// 由于风机比较多,每个风机转速不一直,保存在一个数中遍历
|
// 由于风机比较多,每个风机转速不一直,保存在一个数中遍历
|
||||||
@@ -196,6 +197,41 @@ function handleFanEqu(
|
|||||||
id: equMesh.id, //模型在场景id
|
id: equMesh.id, //模型在场景id
|
||||||
...equipmentInfo,
|
...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");
|
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++) {
|
// for (let line = 1; line <= 20; line++) {
|
||||||
// if (line < 10) {
|
// if (line < 10) {
|
||||||
@@ -13,7 +13,7 @@ export default function previewtunnelModeInit(equipmentList) {
|
|||||||
// console.log(equipmentList);
|
// console.log(equipmentList);
|
||||||
|
|
||||||
equipmentList.forEach((item) => {
|
equipmentList.forEach((item) => {
|
||||||
this.addEquipment(this.scene.getObjectByName(item.position), item);
|
this.addEquipment(this.scene.getObjectByName(item.position), item, fanData);
|
||||||
});
|
});
|
||||||
//进行预览和编辑模式的一些操作
|
//进行预览和编辑模式的一些操作
|
||||||
if (this.isedit == false) {
|
if (this.isedit == false) {
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<div id="main">
|
<div id="main">
|
||||||
<div class="box-top">
|
<div class="box-top">
|
||||||
<manage-btn v-model="selectIndex" @select="manageSelect" :list="routeList" v-if="showMenu"/>
|
<manage-btn v-model="selectIndex" @select="manageSelect" :list="routeList" v-if="showMenu" />
|
||||||
<tunnel-title v-if="showTunnelTitle"/>
|
<tunnel-title v-if="showTunnelTitle" />
|
||||||
<div class="top-length">
|
<div class="top-length">
|
||||||
<!-- <span>隧道总长度: {{ tunnelLength }}米</span>-->
|
<!-- <span>隧道总长度: {{ tunnelLength }}米</span>-->
|
||||||
<span>当前施工长度: {{ constructionLength }}米</span>
|
<span>当前施工长度: {{ constructionLength }}米</span>
|
||||||
@@ -15,8 +15,8 @@
|
|||||||
<template #dropdown>
|
<template #dropdown>
|
||||||
<el-dropdown-menu>
|
<el-dropdown-menu>
|
||||||
<el-dropdown-item v-for="item in siteList" :key="item.value" :command="item">{{
|
<el-dropdown-item v-for="item in siteList" :key="item.value" :command="item">{{
|
||||||
item.label
|
item.label
|
||||||
}}
|
}}
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</template>
|
</template>
|
||||||
@@ -32,25 +32,25 @@
|
|||||||
<!-- <tunnel-scene id="tunnel-box" :isedit="false" /> -->
|
<!-- <tunnel-scene id="tunnel-box" :isedit="false" /> -->
|
||||||
<!-- 一进去的话应该是预览模式,所以引入这个组件1 -->
|
<!-- 一进去的话应该是预览模式,所以引入这个组件1 -->
|
||||||
<preview-scene id="tunnel-box" :isedit="false" :tunnelId="tunnelId" :key="tunnelId" :tunnelLen="tunnelLen"
|
<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">
|
<div class="left">
|
||||||
<el-drawer v-model="drawerLeft" direction="ltr" modal-class="modal-box" :modal="false" :show-close="false"
|
<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"
|
<fan-info v-if="showFan" :list="socketData.leftData" :fan-data="largeScreenData"
|
||||||
:transducer-data="largeScreenData" :loading="showFanLoading" :tunnel-id="tunnelId"/>
|
:transducer-data="largeScreenData" :loading="showFanLoading" :tunnel-id="tunnelId" />
|
||||||
<used-ele v-if="showFan" :list="socketData.leftData" :ele-data="largeScreenData"/>
|
<used-ele v-if="showFan" :list="socketData.leftData" :ele-data="largeScreenData" />
|
||||||
</el-drawer>
|
</el-drawer>
|
||||||
<div v-if="drawerLeft" class="left-arrow" @click="closeLeft"></div>
|
<div v-if="drawerLeft" class="left-arrow" @click="closeLeft"></div>
|
||||||
<div v-else class="shrink-left" @click="closeLeft"></div>
|
<div v-else class="shrink-left" @click="closeLeft"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="right">
|
<div class="right">
|
||||||
<el-drawer v-model="drawerRight" direction="rtl" modal-class="modal-box" :modal="false" :show-close="false"
|
<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"
|
<wind-pressure-list v-if="showFan" :list="socketData.windPressure" :win-data="largeScreenData"
|
||||||
:loading="showWindLoading"/>
|
:loading="showWindLoading" />
|
||||||
<air-info v-if="showFan" :list="socketData.sensor" :air-data="largeScreenData"/>
|
<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"
|
<bad-gas-info v-if="showFan" :list="socketData.sensor" :bad-gas-data="largeScreenData" :tunnelId="tunnelId"
|
||||||
:loading="showBadLoading"/>
|
:loading="showBadLoading" />
|
||||||
</el-drawer>
|
</el-drawer>
|
||||||
<div v-if="drawerRight" class="right-arrow" @click="closeRight"></div>
|
<div v-if="drawerRight" class="right-arrow" @click="closeRight"></div>
|
||||||
<div v-else class="shrink-right" @click="closeRight"></div>
|
<div v-else class="shrink-right" @click="closeRight"></div>
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
<div class="switch-btn">
|
<div class="switch-btn">
|
||||||
<div class="arrow" @click="previousBtn"></div>
|
<div class="arrow" @click="previousBtn"></div>
|
||||||
<el-carousel height="150px" type="card" ref="tunnelBtn" :autoplay="false" :initial-index="initialIndex"
|
<el-carousel height="150px" type="card" ref="tunnelBtn" :autoplay="false" :initial-index="initialIndex"
|
||||||
@change="changeTunnel">
|
@change="changeTunnel">
|
||||||
<div class="btn">
|
<div class="btn">
|
||||||
<el-carousel-item v-for="item in tunnelList" :key="item.value">
|
<el-carousel-item v-for="item in tunnelList" :key="item.value">
|
||||||
{{ item.label }}
|
{{ item.label }}
|
||||||
@@ -79,14 +79,15 @@ import AirInfo from "@/components/content/airInfo/AirInfo.vue";
|
|||||||
import BadGasInfo from "@/components/content/badGasInfo/BadGasInfo.vue";
|
import BadGasInfo from "@/components/content/badGasInfo/BadGasInfo.vue";
|
||||||
import ManageBtn from "@/components/manageBtn/index.vue";
|
import ManageBtn from "@/components/manageBtn/index.vue";
|
||||||
import TunnelTitle from "@/components/tunnelTitle/index.vue";
|
import TunnelTitle from "@/components/tunnelTitle/index.vue";
|
||||||
import {dateFormat} from "@/utils/date.js";
|
import { dateFormat } from "@/utils/date.js";
|
||||||
import {getToken} from "@/utils/auth";
|
import { getToken } from "@/utils/auth";
|
||||||
import {useAuthStore} from "@/store/userstore.js";
|
import { useAuthStore } from "@/store/userstore.js";
|
||||||
import {getLargeScreen, getLargeScreenInfo, getTunnelBySiteId} from "@/api/largeScreen";
|
import { getLargeScreen, getLargeScreenInfo, getTunnelBySiteId } from "@/api/largeScreen";
|
||||||
import {ElMessage, ElMessageBox} from "element-plus";
|
import { ElMessage, ElMessageBox } from "element-plus";
|
||||||
import {getUserInfo} from "@/api/login";
|
import { getUserInfo } from "@/api/login";
|
||||||
import {initSceneData} from "@/api/tunnelScene";
|
import { initSceneData } from "@/api/tunnelScene";
|
||||||
import {getTunnelList} from "@/api/tunnelManage";
|
import { getTunnelList } from "@/api/tunnelManage";
|
||||||
|
import { computed } from "vue";
|
||||||
|
|
||||||
const authStore = useAuthStore();
|
const authStore = useAuthStore();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -203,7 +204,7 @@ const getOtherInfo = () => {
|
|||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
showTunnelTitle.value = true
|
showTunnelTitle.value = true
|
||||||
});
|
});
|
||||||
console.log('siteId',siteId)
|
console.log('siteId', siteId)
|
||||||
getTunnel(siteId)
|
getTunnel(siteId)
|
||||||
} else {
|
} else {
|
||||||
getTunnel(res.data.siteOption[0].value)
|
getTunnel(res.data.siteOption[0].value)
|
||||||
@@ -233,12 +234,12 @@ const getScreenInfo = (id) => {
|
|||||||
if (res.data.sensorList.length !== 0) {
|
if (res.data.sensorList.length !== 0) {
|
||||||
res.data.sensorList.forEach((item) => {
|
res.data.sensorList.forEach((item) => {
|
||||||
if (
|
if (
|
||||||
item.equipmentType === "carbonDioxide" ||
|
item.equipmentType === "carbonDioxide" ||
|
||||||
item.equipmentType === "carbonMonoxide" ||
|
item.equipmentType === "carbonMonoxide" ||
|
||||||
item.equipmentType === "hydrogenSulfide" ||
|
item.equipmentType === "hydrogenSulfide" ||
|
||||||
item.equipmentType === "sulfurDioxide" ||
|
item.equipmentType === "sulfurDioxide" ||
|
||||||
item.equipmentType === "sulfurMonoxide" ||
|
item.equipmentType === "sulfurMonoxide" ||
|
||||||
item.equipmentType === "nitrogenDioxide"
|
item.equipmentType === "nitrogenDioxide"
|
||||||
) {
|
) {
|
||||||
showBadLoading.value = 0
|
showBadLoading.value = 0
|
||||||
} else {
|
} else {
|
||||||
@@ -249,6 +250,7 @@ const getScreenInfo = (id) => {
|
|||||||
showBadLoading.value = 1
|
showBadLoading.value = 1
|
||||||
}
|
}
|
||||||
largeScreenData.value = res.data;
|
largeScreenData.value = res.data;
|
||||||
|
// console.log(largeScreenData.value);
|
||||||
} else {
|
} else {
|
||||||
ElMessage.warning(res.msg)
|
ElMessage.warning(res.msg)
|
||||||
}
|
}
|
||||||
@@ -276,6 +278,7 @@ const getList = () => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
//根据站点id获取隧道信息option
|
//根据站点id获取隧道信息option
|
||||||
|
let largeScreen = computed(() => largeScreenData)
|
||||||
const getTunnel = (id) => {
|
const getTunnel = (id) => {
|
||||||
getTunnelBySiteId(id).then((res) => {
|
getTunnelBySiteId(id).then((res) => {
|
||||||
if (res?.code === 1000) {
|
if (res?.code === 1000) {
|
||||||
@@ -289,7 +292,7 @@ const getTunnel = (id) => {
|
|||||||
} else {
|
} else {
|
||||||
if (!pattern.test(previewId)) {
|
if (!pattern.test(previewId)) {
|
||||||
getScreenInfo(previewId)
|
getScreenInfo(previewId)
|
||||||
}else {
|
} else {
|
||||||
getScreenInfo(res.data[0]?.value)
|
getScreenInfo(res.data[0]?.value)
|
||||||
tunnelName = res.data[0].label
|
tunnelName = res.data[0].label
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user