diff --git a/src/components/content/airInfo/AirInfo.vue b/src/components/content/airInfo/AirInfo.vue index af1d516..fad3f92 100644 --- a/src/components/content/airInfo/AirInfo.vue +++ b/src/components/content/airInfo/AirInfo.vue @@ -6,15 +6,16 @@
风速{{ windSpeed }}m/s
- + +
@@ -87,7 +88,7 @@ watch(() => props.list, (now) => { }) }, {deep: true}); watch(() => props.airData, (now) => { - if(now.sensorList===null){ + if(now.sensorList.length===0){ airList.value=[] }else { getAirInfo(now.sensorList) diff --git a/src/components/content/fanInfo/FanInfo.vue b/src/components/content/fanInfo/FanInfo.vue index dd2f660..14161e0 100644 --- a/src/components/content/fanInfo/FanInfo.vue +++ b/src/components/content/fanInfo/FanInfo.vue @@ -64,13 +64,13 @@
-
+
-
@@ -111,7 +111,9 @@ const stateA = ref(false) const stateB = ref(false) const stateC = ref(false) const isVisited = ref(false) +const fanIndex = ref(0) let myEcharts = reactive({}); + watch(() => props.transducerData, (now) => { getTransData(now.frequencyChangerList) }, {deep: true}); @@ -155,8 +157,9 @@ const getFanInfo = (equipmentId) => { } }) } -const handleOpenChart = (item) => { +const handleOpenChart = (item,index) => { getFanInfo(item.equipmentId) + fanIndex.value=index+1 } const getTransData = (data) => { let tranObj = {} @@ -505,7 +508,6 @@ input[type="number"] { :deep( .el-radio__label) { font-size: 28px; - font-family: MicrosoftYaHei; color: #38cafb; line-height: 37px; } @@ -520,17 +522,14 @@ input[type="number"] { left: 68px; padding: 10px; background-image: url(../../../assets/images/fanInfo/bg.png); - //clip-path: polygon(0% 0%, 40% 0%, 48% 15%, 100% 15%, 100% 100%, 0% 100%); color: #2fb0df; box-sizing: border-box; .title { width: 40%; text-align: left; - font-size: 20px; - padding: 0px 0px 0px 62px; + padding: 0 0 0 62px; font-size: 32px; - font-family: MicrosoftYaHei, MicrosoftYaHei; font-weight: bold; color: #38cafb; line-height: 42px; @@ -560,7 +559,6 @@ input[type="number"] { .echart::after { content: "Hz"; font-size: 24px; - font-family: MicrosoftYaHei, MicrosoftYaHei; font-weight: bold; color: #ffffff; line-height: 31px; @@ -574,7 +572,6 @@ input[type="number"] { width: 39px; height: 140px; font-size: 26px; - font-family: MicrosoftYaHei; color: #38cafb; line-height: 35px; text-align: center; @@ -598,7 +595,6 @@ input[type="number"] { flex-direction: column; justify-content: center; font-size: 26px; - font-family: MicrosoftYaHei; color: #38cafb; line-height: 35px; gap: 40px; @@ -644,7 +640,6 @@ input[type="number"] { border-radius: 22px; border: 2px solid #0f82af; overflow: hidden; - font-family: MicrosoftYaHei, MicrosoftYaHei; font-weight: bold; color: #127399; line-height: 35px; @@ -662,9 +657,8 @@ input[type="number"] { display: flex; flex-direction: column; justify-content: center; - padding: 0px 20px; + padding: 0 20px; font-size: 28px; - font-family: MicrosoftYaHei; color: #38cafb; line-height: 37px; gap: 33px; @@ -683,7 +677,6 @@ input[type="number"] { top: 50%; transform: translateY(-50%); font-size: 28px; - font-family: MicrosoftYaHei; color: #38cafb; line-height: 37px; } @@ -696,7 +689,6 @@ input[type="number"] { margin-left: 14px; outline: none; font-size: 28px; - font-family: MicrosoftYaHei, MicrosoftYaHei; font-weight: bold; color: #38cafb; line-height: 37px; @@ -714,7 +706,6 @@ input[type="number"] { padding-top: 30px; padding-right: 25px; font-size: 28px; - font-family: MicrosoftYaHei; color: #FFFFFF; .fenliu-icon { @@ -737,7 +728,6 @@ input[type="number"] { margin-left: 14px; outline: none; font-size: 28px; - font-family: MicrosoftYaHei, MicrosoftYaHei; font-weight: bold; color: #38cafb; line-height: 37px; @@ -751,7 +741,6 @@ input[type="number"] { bottom: 0; transform: translateY(-50%); font-size: 28px; - font-family: MicrosoftYaHei; color: #38cafb; line-height: 37px; } @@ -761,13 +750,17 @@ input[type="number"] { .current { margin-top: 30px; + margin-right: 20px; margin-left: 26px; - height: 37px; + //height: 37px; font-size: 28px; color: #FFFFFF; cursor: pointer; + &:hover{ + background-color: #2E5589; + border-radius: 6px; + } } - } } } diff --git a/src/components/content/fanInfo/FanInfoItem.vue b/src/components/content/fanInfo/FanInfoItem.vue index 8f12384..eaf6049 100644 --- a/src/components/content/fanInfo/FanInfoItem.vue +++ b/src/components/content/fanInfo/FanInfoItem.vue @@ -110,15 +110,16 @@ let isWaringC = computed(() => { display: flex; align-items: center; width: 100%; - padding: 6px 38px 7px 10px; + padding: 6px 0 7px 10px; margin-bottom: 17px; &:hover { - background: #2E5589; - border-radius: 6px; + //background: #2E5589; + //border-radius: 6px; } &:last-child { + margin-bottom: 0; .label { span { margin: 0 5px 0 14px; diff --git a/src/components/content/tunnelScene/PreviewScene.vue b/src/components/content/tunnelScene/PreviewScene.vue index 46d8b06..7435789 100644 --- a/src/components/content/tunnelScene/PreviewScene.vue +++ b/src/components/content/tunnelScene/PreviewScene.vue @@ -47,15 +47,14 @@ import { import { OBJLoader } from "three/examples/jsm/loaders/OBJLoader"; import { RGBELoader } from "three/examples/jsm/loaders/RGBELoader"; -import { onMounted, reactive, ref } from "vue"; +import { onMounted, reactive, ref, toRaw, getCurrentInstance } from "vue"; import { ElMessage } from "element-plus"; -import { useModelSceneStore } from "@/store/modelSceneStore"; -import { toRaw } from "vue" +import { deleteEquipment, initData } from "./request"; // 获取html标签跟随组件dom const content = ref(null); const info = ref(null); const edit = ref(null); -const store = useModelSceneStore(); +let modelList = ref(null); let demo; //定义demo全局变量 // const loader = new OBJLoader(); const loader = new OBJLoader(); @@ -69,6 +68,16 @@ const params = defineProps(["isedit", "tunnelId"]); //接收参数看是不是 let isedit = ref(params.isedit) +// watch( +// () => params.tunnelId, +// (now) => { +// params.tunnelId = now +// console.log(params.tunnelId); + +// }, +// { deep: true } +// ) + onMounted(handleMounted); // 挂载后回调 async function handleMounted() { @@ -89,7 +98,7 @@ async function handleMounted() { watch( () => params.tunnelId, async () => { - const text = await store.initData(params.tunnelId); + const text = await initData(params.tunnelId); } ); // 初始化设备模型 @@ -100,14 +109,38 @@ async function handleMounted() { map.set("equ_sensors", await loadModel("/devicesModel/sensors.obj")); // 给对象初加载设备模型 demo.initDevicesModel(map); - const equipmentList = await store.getEquipmentList(); - demo.previewtunnelModeInit(equipmentList); - // previewEquInfProcess(equipmentList) + // const equipmentList = await store.getEquipmentList(); + modelList.value = await initData(params.tunnelId); + // console.log("init", params.tunnelId); + demo.previewtunnelModeInit(modelList.value); + watch( + () => params.tunnelId, + (now) => { + params.tunnelId = now + // console.log(params.tunnelId); + checkTunnelInit(modelList.value) + demo.previewtunnelModeInit(modelList.value); + }, + { deep: true } + ) + // demo.previewtunnelModeInit(equipmentList); + // previewEquInfProcess(modelList.value, targetP.value) } catch (err) { console.log(err); } } + +function checkTunnelInit(equipmentList) { + equipmentList.forEach((item) => { + let equipment = toRaw(item) + console.log("我要清理掉之前的设备!!!"); + console.log(equipment); + console.log(demo.scene.getObjectByName(equipment.position)); + demo.removeEquipment(demo.scene.getObjectByName(equipment.position)); + }); +} + // 每个模型加载回调 function loadModel(path) { return new Promise((resolve, reject) => { @@ -163,46 +196,31 @@ function lClickCallback(demo) { } let pointNum = ref(0); -let targetP; +let targetP = ref({}); // 右键点击附着点后调函数 function rClickCallback(demo) { function editDev(targetPoint = null) { - hasDevice = targetPoint.hasDevice; - targetP = targetPoint; - //点击之后马上调用这个函数,变成回调,然后进行处理处理在传给preview表单 - const equipmentList = store.getEquipmentList().then((result) => { - previewEquInfProcess(result, targetP) - }); + hasDevice.value = targetPoint.hasDevice; + targetP.value = targetPoint; + const equipmentList = initData(params.tunnelId) + equipmentList.then((result) => { + previewEquInfProcess(result, targetP.value) + }) pointNum.value = Number( targetPoint.name.substring( targetPoint.name.indexOf("_") + 1, targetPoint.name.lastIndexOf("_") ) - 1 ); - if (!targetPoint.info) return; editDevInfo(targetPoint.info); } demo.addFunction("editDev", editDev); - } // 添加设备 function handleAddEqu(formInfo) { - if (!formInfo.equipmentType) { - ElMessage({ - message: "请选择传感器!", - type: "warning", - }); - return; - } - //表单信息 - //这里利用处理请求 - demo.addEquipment(targetP, formInfo); - ElMessage({ - message: "添加成功!", - type: "success", - }); + demo.addEquipment(targetP.value, formInfo); } const centerDialogVisible = ref(false); @@ -219,12 +237,22 @@ function handleRemoveEqu() { } // 对话框确认删除 function handleConfirmAddEqu() { - demo.removeEquipment(targetP); - centerDialogVisible.value = false; - ElMessage({ - message: "删除成功!", - type: "success", - }); + console.log("target:", targetP.value.info); + deleteEquipment(targetP.value.info.equipmentId, pointGap) + .then((res) => { + demo.removeEquipment(targetP.value); + centerDialogVisible.value = false; + ElMessage({ + message: "删除成功!", + type: "success", + }); + }) + .catch((res) => { + ElMessage({ + message: "删除失败!", + type: "warning", + }); + }); } // 处理取消关闭编辑框事件 function handleCancel() { @@ -242,11 +270,10 @@ let equipmentValue = ref(0) function previewEquInfProcess(equipmentList, targetP) { for (const equipment of equipmentList) { - // console.log(equipment); if (equipment.position == targetP.name) { equipmentType.value = equipment.equipmentType //需要将获取到的设备列表进行序列化 - equipmentName.value = toRaw(equipment.chooseEquipment).label + equipmentName.value = equipment.equipmentName equipmentValue.value = equipment.threshold if (equipmentType.value == 'frequency') { equipmentType.value = '风机' diff --git a/src/components/content/tunnelScene/request/index.js b/src/components/content/tunnelScene/request/index.js index 581c94f..04a93c2 100644 --- a/src/components/content/tunnelScene/request/index.js +++ b/src/components/content/tunnelScene/request/index.js @@ -101,6 +101,7 @@ export const deleteEquipment = (equipmentId, pointGap) => { }) .then((res) => { if (res?.code === 1000) { + console.log("删除成功"); modelEquipmentList = modelEquipmentList.filter( (item) => item.equipmentId != equipmentId ); diff --git a/src/components/content/tunnelScene/sceneClass/editEquipment/index.js b/src/components/content/tunnelScene/sceneClass/editEquipment/index.js index 372fc45..070fdfe 100644 --- a/src/components/content/tunnelScene/sceneClass/editEquipment/index.js +++ b/src/components/content/tunnelScene/sceneClass/editEquipment/index.js @@ -36,7 +36,7 @@ function addEquipment(targetPoint, formInfo) { // function handleValveEqu(targetPoint, equipmentInfo) { // } - +let allline = new Array // 其他传感器 function handleOtherEqu(targetPoint, equipmentInfo) { const equMesh = this.equMap.get("equ_sensors").clone(); @@ -67,41 +67,24 @@ function handleOtherEqu(targetPoint, equipmentInfo) { targetPoint.scale.set(0.03, 0.06, 0.05); this.scene.add(equMesh); targetPoint.visible = false; - // targetPoint.hasWall = true; - // //处理风压阀的代码片段 - // let lineIndex = targetPoint.name.slice(7, 9); - // for (let line = Number(lineIndex); line <= 20; line++) { - // if (line < 10) { - // let wall = "wall_" + "0" + line; - // this.scene.getObjectByName(wall).visible = true; - // let point = "point_" + "00" + line + "_tc"; - // this.scene.getObjectByName(point).visible = false; - // this.scene.getObjectByName(point).layers.set(-2); - // if (this.scene.getObjectByName(point).hasDevice == true) { - // let EquID = this.scene.getObjectByName(point).info.id; - // this.scene.getObjectById(EquID).visible = false; - // } - // } else if (line >= 10) { - // let wall = "wall_" + line; - // this.scene.getObjectByName(wall).visible = true; - // let point = "point_" + "0" + line + "_tc"; - // this.scene.getObjectByName(point).visible = false; - // this.scene.getObjectByName(point).layers.set(-2); - // if (this.scene.getObjectByName(point).hasDevice == true) { - // let EquID = this.scene.getObjectByName(point).info.id; - // this.scene.getObjectById(EquID).visible = false; - // } + targetPoint.hasWall = true; + //处理风压阀的代码片段 + let lineIndex = targetPoint.name.slice(7, 9) + if (allline.includes(Number(lineIndex))) { + allline.slice(array.indexOf(lineIndex), 1) + console.log('dadad'); + } else { + allline.push(Number(lineIndex)) + } + console.log(allline); + // console.log(allline); + // allline.forEach((item, index, array) => { + // if (array.includes(item)) { + // array.slice(array.indexOf(item), 1) + // array.slice(array.indexOf(item), 1) + // console.log(array); // } - // //处理21行的设备和附着点 - // let point = "point_" + "0" + 21 + "_tc"; - // this.scene.getObjectByName(point).visible = false; - // this.scene.getObjectByName(point).layers.set(-2); - // if (this.scene.getObjectByName(point).hasDevice == true) { - // let EquID = this.scene.getObjectByName(point).info.id; - // this.scene.getObjectById(EquID).visible = false; - // } - // } - // this.scene.getObjectByName('wall_01').visible = true + // }) // console.log(this.scene); // 保存该设备模型id,后期直接从附附着点进行删除 targetPoint.info = { @@ -154,43 +137,44 @@ function handleFanEqu( function removeEquipment(targetPoint) { //删除设备这里需要再进行处理,就是根据附着点(附着点一定保存了当前添加设备的信息了)判断是不是分压阀,然后继续一样的隐藏 if (!targetPoint.hasDevice) return; - if (targetPoint.hasWall == true) { - let lineIndex = targetPoint.name.slice(7, 9); - for (let line = Number(lineIndex); line <= 20; line++) { - if (line < 10) { - let wall = "wall_" + "0" + line; - this.scene.getObjectByName(wall).visible = false; - let point = "point_" + "00" + line + "_tc"; - console.log(this.scene.getObjectByName(point)); - this.scene.getObjectByName(point).visible = true; - this.scene.getObjectByName(point).layers.set(0); - if (this.scene.getObjectByName(point).hasDevice == true) { - this.scene.getObjectByName(point).visible = false; - let EquID = this.scene.getObjectByName(point).info.id; - this.scene.getObjectById(EquID).visible = true; - } - } else if (line >= 10) { - let wall = "wall_" + line; - this.scene.getObjectByName(wall).visible = false; - let point = "point_" + "0" + line + "_tc"; - this.scene.getObjectByName(point).visible = true; - this.scene.getObjectByName(point).layers.set(0); - if (this.scene.getObjectByName(point).hasDevice == true) { - this.scene.getObjectByName(point).visible = false; - let EquID = this.scene.getObjectByName(point).info.id; - this.scene.getObjectById(EquID).visible = true; - } - } - //处理21行的设备和附着点 - let point = "point_" + "0" + 21 + "_tc"; - this.scene.getObjectByName(point).visible = true; - this.scene.getObjectByName(point).layers.set(0); - if (this.scene.getObjectByName(point).hasDevice == true) { - let EquID = this.scene.getObjectByName(point).info.id; - this.scene.getObjectById(EquID).visible = true; - } - } - } + // if (targetPoint.hasWall == true) { + // let lineIndex = targetPoint.name.slice(7, 9); + // for (let line = Number(lineIndex); line <= 20; line++) { + // if (line < 10) { + // let wall = "wall_" + "0" + line; + // this.scene.getObjectByName(wall).visible = false; + // let point = "point_" + "00" + line + "_tc"; + // console.log(this.scene.getObjectByName(point)); + // this.scene.getObjectByName(point).visible = true; + // this.scene.getObjectByName(point).layers.set(0); + // if (this.scene.getObjectByName(point).hasDevice == true) { + // this.scene.getObjectByName(point).visible = false; + // let EquID = this.scene.getObjectByName(point).info.id; + // this.scene.getObjectById(EquID).visible = true; + // } + // } else if (line >= 10) { + // let wall = "wall_" + line; + // this.scene.getObjectByName(wall).visible = false; + // let point = "point_" + "0" + line + "_tc"; + // this.scene.getObjectByName(point).visible = true; + // this.scene.getObjectByName(point).layers.set(0); + // if (this.scene.getObjectByName(point).hasDevice == true) { + // this.scene.getObjectByName(point).visible = false; + // let EquID = this.scene.getObjectByName(point).info.id; + // this.scene.getObjectById(EquID).visible = true; + // } + // } + // //处理21行的设备和附着点 + // let point = "point_" + "0" + 21 + "_tc"; + // this.scene.getObjectByName(point).visible = true; + // this.scene.getObjectByName(point).layers.set(0); + // if (this.scene.getObjectByName(point).hasDevice == true) { + // let EquID = this.scene.getObjectByName(point).info.id; + // this.scene.getObjectById(EquID).visible = true; + // } + // } + // } + console.log("测试是不是删除了"); const mesh = this.scene.getObjectById(targetPoint.info.id); this.scene.remove(mesh); targetPoint.visible = true; diff --git a/src/components/content/tunnelScene/sceneClass/previewTunnelInit/index.js b/src/components/content/tunnelScene/sceneClass/previewTunnelInit/index.js index 1dfa150..8ea6300 100644 --- a/src/components/content/tunnelScene/sceneClass/previewTunnelInit/index.js +++ b/src/components/content/tunnelScene/sceneClass/previewTunnelInit/index.js @@ -1,3 +1,4 @@ + export default function previewtunnelModeInit(equipmentList) { //初始化将墙壁隐藏起来 // for (let line = 1; line <= 20; line++) { @@ -9,14 +10,8 @@ export default function previewtunnelModeInit(equipmentList) { // this.scene.getObjectByName(wall).visible = false // } // } - equipmentList.forEach((item) => { - const formInfo = { - equipmentType: item.equipmentType, //设备类型 - chooseEquipment: item.chooseEquipment, //设备选择(设备名称) - threshold: item.threshold, - }; - this.addEquipment(this.scene.getObjectByName(item.position), formInfo); + this.addEquipment(this.scene.getObjectByName(item.position), item); }); //进行预览和编辑模式的一些操作 if (this.isedit == false) { diff --git a/src/components/manageBtn/index.vue b/src/components/manageBtn/index.vue index 064e94d..08f1ac2 100644 --- a/src/components/manageBtn/index.vue +++ b/src/components/manageBtn/index.vue @@ -1,6 +1,6 @@