廖杰:完成风机功能+预览模式路牌修复
This commit is contained in:
@@ -59,16 +59,29 @@ const edit = ref(null);
|
|||||||
let modelList = ref(null);
|
let modelList = ref(null);
|
||||||
let demo; //定义demo全局变量
|
let demo; //定义demo全局变量
|
||||||
// const loader = new OBJLoader();
|
// const loader = new OBJLoader();
|
||||||
|
const form = ref({
|
||||||
|
tunnelName: "",
|
||||||
|
serialNumber: "",
|
||||||
|
totalLength: "",
|
||||||
|
referenceFrequency: '',
|
||||||
|
upTime: '',
|
||||||
|
upFrequency: '',
|
||||||
|
dropTime: '',
|
||||||
|
dropFrequency: '',
|
||||||
|
isDefault: false,
|
||||||
|
remarks: "",
|
||||||
|
});
|
||||||
const loader = new OBJLoader();
|
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", "largeScreen"]); //接收参数看是不是编辑模式,如果是编辑模式,则需要做一些处理
|
const params = defineProps(["isedit", "tunnelId", "tunnelLen", "largeScreen"]); //接收参数看是不是编辑模式,如果是编辑模式,则需要做一些处理
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
let isedit = ref(params.isedit)
|
let isedit = ref(params.isedit)
|
||||||
let fanData;
|
let fanData;
|
||||||
|
let tunnelAlias = reactive('')
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => params.largeScreen,
|
() => params.largeScreen,
|
||||||
@@ -80,6 +93,19 @@ watch(
|
|||||||
},
|
},
|
||||||
{ deep: true }
|
{ deep: true }
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const getTunnel = () => {
|
||||||
|
if (params.tunnelId !== 0) {
|
||||||
|
getTunnelDetail(params.tunnelId).then((res) => {
|
||||||
|
if (res?.code === 1000) {
|
||||||
|
form.value = res.data;
|
||||||
|
console.log(form.value.tunnelAlias);
|
||||||
|
tunnelAlias = form.value.tunnelAlias
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
getTunnel();
|
||||||
// const form = ref({
|
// const form = ref({
|
||||||
// tunnelName: "",
|
// tunnelName: "",
|
||||||
// serialNumber: "",
|
// serialNumber: "",
|
||||||
@@ -157,7 +183,7 @@ async function handleMounted() {
|
|||||||
// console.log(modelList.value);
|
// console.log(modelList.value);
|
||||||
// console.log("init", params.tunnelId);
|
// console.log("init", params.tunnelId);
|
||||||
demo.previewtunnelModeInit(toRaw(modelList.value), fanData);
|
demo.previewtunnelModeInit(toRaw(modelList.value), fanData);
|
||||||
demo.SignsInf(params.tunnelName, String(params.tunnelLen.value))
|
demo.SignsInf(tunnelAlias, String(params.tunnelLen.value))
|
||||||
// watch(
|
// watch(
|
||||||
// () => params.tunnelId,
|
// () => params.tunnelId,
|
||||||
// (now) => {
|
// (now) => {
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ function handleOtherEqu(targetPoint, equipmentInfo) {
|
|||||||
function handleFanEqu(
|
function handleFanEqu(
|
||||||
targetPoint,
|
targetPoint,
|
||||||
equipmentInfo,
|
equipmentInfo,
|
||||||
fanData = 1,
|
fanData,
|
||||||
speed = Math.random().toFixed(1) * 1000
|
speed = Math.random().toFixed(1) * 1000
|
||||||
) {
|
) {
|
||||||
// 由于风机比较多,每个风机转速不一直,保存在一个数中遍历
|
// 由于风机比较多,每个风机转速不一直,保存在一个数中遍历
|
||||||
@@ -197,61 +197,8 @@ function handleFanEqu(
|
|||||||
id: equMesh.id, //模型在场景id
|
id: equMesh.id, //模型在场景id
|
||||||
...equipmentInfo,
|
...equipmentInfo,
|
||||||
};
|
};
|
||||||
// console.log(targetPoint.info);
|
//这里感觉情况改变风机的颜色
|
||||||
//风机颜色重新命名
|
changeFanColor(fanData, targetPoint, this.scene)
|
||||||
if (fanData != 1) {
|
|
||||||
if (fanData.length == 2) {
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
let fan1 = fanData[0].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)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// console.log(fanData);
|
|
||||||
|
|
||||||
|
|
||||||
// 定义风机旋转
|
// 定义风机旋转
|
||||||
@@ -337,3 +284,54 @@ function deleteItem(array, item) {
|
|||||||
}
|
}
|
||||||
return array
|
return array
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//这里是改变风机颜色的代码
|
||||||
|
function changeFanColor(fanData, targetPoint, scene) {
|
||||||
|
if (fanData !== undefined) {
|
||||||
|
//保证是预览模式才进行这里的操作(!=1)
|
||||||
|
if (fanData.length > 0) {
|
||||||
|
//if保证存在风机(即有长度再进行遍历)
|
||||||
|
for (let i = 0; i < fanData.length; i++) {
|
||||||
|
//先做匹配操作
|
||||||
|
let fanType = fanData[i].equipmentType
|
||||||
|
//有符合条件的风机进来了
|
||||||
|
if (targetPoint.info.typeKey == fanType) {
|
||||||
|
//下面进行变色需要的逻辑判断了
|
||||||
|
if (fanData[i].breakdown == true) {
|
||||||
|
//故障状态,变红色
|
||||||
|
scene.traverse(function (child) {
|
||||||
|
if (child.id === targetPoint.info.id) {
|
||||||
|
child.traverse(function (obj) {
|
||||||
|
// console.log(obj);
|
||||||
|
// 判断子对象是否是物体,如果是,更改其颜色
|
||||||
|
if (obj.isMesh) {
|
||||||
|
obj.material.color.set(0xFF0000)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// 这里再判断是否运行
|
||||||
|
if (fanData[i].running == true) {
|
||||||
|
//运行状态,绿色 0x008000
|
||||||
|
scene.traverse(function (child) {
|
||||||
|
if (child.id === targetPoint.info.id) {
|
||||||
|
child.traverse(function (obj) {
|
||||||
|
// console.log(obj);
|
||||||
|
// 判断子对象是否是物体,如果是,更改其颜色
|
||||||
|
if (obj.isMesh) {
|
||||||
|
obj.material.color.set(0x008000)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
//停止状态,不变色
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
export default function previewtunnelModeInit(equipmentList, fanData = 1) {
|
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, fanData = 1) {
|
|||||||
// console.log(equipmentList);
|
// console.log(equipmentList);
|
||||||
|
|
||||||
equipmentList.forEach((item) => {
|
equipmentList.forEach((item) => {
|
||||||
this.addEquipment(this.scene.getObjectByName(item.position), item, fanData = 1);
|
this.addEquipment(this.scene.getObjectByName(item.position), item, fanData);
|
||||||
});
|
});
|
||||||
//进行预览和编辑模式的一些操作
|
//进行预览和编辑模式的一些操作
|
||||||
if (this.isedit == false) {
|
if (this.isedit == false) {
|
||||||
|
|||||||
@@ -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,7 +32,7 @@
|
|||||||
<!-- <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" :largeScreen="largeScreen"></preview-scene>
|
: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">
|
||||||
@@ -119,9 +119,9 @@ const constructionLength = ref(0);
|
|||||||
const routeList = ref([]);
|
const routeList = ref([]);
|
||||||
let socket = reactive("");
|
let socket = reactive("");
|
||||||
let pattern = reactive(new RegExp("[A-Za-z]+"));
|
let pattern = reactive(new RegExp("[A-Za-z]+"));
|
||||||
let tunnelName = reactive("")
|
|
||||||
let isTunnel = reactive(false)
|
let isTunnel = reactive(false)
|
||||||
|
|
||||||
|
|
||||||
const btnList = ref([
|
const btnList = ref([
|
||||||
{
|
{
|
||||||
route: '/site',
|
route: '/site',
|
||||||
@@ -181,6 +181,7 @@ const getUser = () => {
|
|||||||
|
|
||||||
const getOtherInfo = () => {
|
const getOtherInfo = () => {
|
||||||
getLargeScreenInfo().then((res) => {
|
getLargeScreenInfo().then((res) => {
|
||||||
|
// console.log(res);
|
||||||
if (res?.code === 1000) {
|
if (res?.code === 1000) {
|
||||||
let routeArr = [];
|
let routeArr = [];
|
||||||
res.data.routeList.forEach((item) => {
|
res.data.routeList.forEach((item) => {
|
||||||
@@ -250,7 +251,6 @@ 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)
|
||||||
}
|
}
|
||||||
@@ -268,14 +268,8 @@ const getList = () => {
|
|||||||
getTunnelList({
|
getTunnelList({
|
||||||
siteId: siteId
|
siteId: siteId
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
console.log(siteId);
|
|
||||||
console.log(res.data.rows);
|
|
||||||
//这里拿到我们的隧道简称
|
//这里拿到我们的隧道简称
|
||||||
for (let i = 0; i < res.data.rows.length; i++) {
|
|
||||||
if (siteId == res.data.rows[i].tunnelId) {
|
|
||||||
tunnelName = res.data.rows[i].tunnelAlias;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (res.code === 1000) {
|
if (res.code === 1000) {
|
||||||
if (res.data.rows.length !== 0) {
|
if (res.data.rows.length !== 0) {
|
||||||
isTunnel = true;
|
isTunnel = true;
|
||||||
@@ -305,7 +299,6 @@ const getTunnel = (id) => {
|
|||||||
} else {
|
} else {
|
||||||
getScreenInfo(res.data[0]?.value)
|
getScreenInfo(res.data[0]?.value)
|
||||||
console.log(res);
|
console.log(res);
|
||||||
//tunnelName = res.data[0].label
|
|
||||||
}
|
}
|
||||||
tunnelList.value = res.data
|
tunnelList.value = res.data
|
||||||
tunnelList.value.forEach((item, index) => {
|
tunnelList.value.forEach((item, index) => {
|
||||||
@@ -429,6 +422,7 @@ const initWebSocket = () => {
|
|||||||
}, 30000);
|
}, 30000);
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.el-drawer__header {
|
.el-drawer__header {
|
||||||
display: none;
|
display: none;
|
||||||
@@ -485,6 +479,7 @@ const initWebSocket = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
#main {
|
#main {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|||||||
Reference in New Issue
Block a user