Merge pull request 'LJ' (#152) from LJ into dev

Reviewed-on: http://git.feashow.cn/clay/tunnel-cloud-web/pulls/152
This commit is contained in:
liaojie
2023-12-17 10:36:22 +00:00
6 changed files with 132 additions and 113 deletions

View File

@@ -2,30 +2,16 @@
<div id="scene"> <div id="scene">
<div id="cvs" ref="content"></div> <div id="cvs" ref="content"></div>
<dev-info ref="info" :devInfo="devInfo" /> <dev-info ref="info" :devInfo="devInfo" />
<edit-dialog <edit-dialog ref="edit" @addEquipment="handleAddEqu" @removeEquipment="handleRemoveEqu" @cancel="handleCancel"
ref="edit" :hasDev="hasDevice" :pointNum="pointNum" pointGap="500" />
@addEquipment="handleAddEqu" <el-dialog v-model="centerDialogVisible" width="30%" destroy-on-close center :show-close="false" style="
@removeEquipment="handleRemoveEqu"
@cancel="handleCancel"
:hasDev="hasDevice"
:pointNum="pointNum"
pointGap="500"
/>
<el-dialog
v-model="centerDialogVisible"
width="30%"
destroy-on-close
center
:show-close="false"
style="
margin: 20% auto; margin: 20% auto;
width: 569px; width: 569px;
height: 330px; height: 330px;
background: rgba(7, 35, 72, 0.79); background: rgba(7, 35, 72, 0.79);
border-radius: 20px; border-radius: 20px;
border: 2px solid #0f82af; border: 2px solid #0f82af;
" ">
>
<p id="remove-title">是否确定删除该设备</p> <p id="remove-title">是否确定删除该设备</p>
<div class="btn"> <div class="btn">
<button @click="centerDialogVisible = false">取消</button> <button @click="centerDialogVisible = false">取消</button>
@@ -98,6 +84,9 @@ async function handleMounted() {
} catch (err) { } catch (err) {
console.log(err); console.log(err);
} }
demo.tunnelModeInit();
} }
// 每个模型加载回调 // 每个模型加载回调
@@ -108,7 +97,7 @@ function loadModel(path) {
(obj) => { (obj) => {
resolve(obj); resolve(obj);
}, },
(xhr) => {}, (xhr) => { },
(err) => { (err) => {
reject(err); reject(err);
} }
@@ -174,6 +163,8 @@ function rClickCallback(demo) {
demo.addFunction("editDev", editDev); demo.addFunction("editDev", editDev);
} }
// 添加设备 // 添加设备
function handleAddEqu(formInfo) { function handleAddEqu(formInfo) {
if (!formInfo.equipmentType) { if (!formInfo.equipmentType) {
@@ -221,6 +212,40 @@ function handleCancel() {
demo._resetState(); demo._resetState();
demo.clearTagsObj(); demo.clearTagsObj();
} }
//现在首先有二种方案是写在TunnelScene.vue中还是demo.js中呢
//我认为可能看数据在哪获取到时候看在哪里导入首先我们放在TunnelScene里面吧
//因为没获取到接口,我们先写死!!!
//需要参考接口的数据结构!!!,主要是传入函数的参数应该是什么结构???
const ThreeConfig = {
code: 0,
data: {
tunnelThreeConfig: [{
equipmentId: 'fan_01',//传感器id
equipmentName: '01',//设备名称
pointName: 'point_005_tl',//附着点名称(定位)
equipmentType: 'fan',//设备类型(类型可根据后端
equipmentValue: 23, //设备存的值
}, {
equipmentId: 'sensors_01',//传感器id
equipmentName: '01',//设备名称
pointName: 'point_009_bl',//附着点名称(定位)
equipmentType: 'sensors',//设备类型(类型可根据后端
equipmentValue: 67, //设备存的值
}],
},
msg: "dda"
}
//取值方便操作
// const tunnelConfigEquipment = ThreeConfig.data.tunnelThreeConfig
// function tunnelModeInit() {
// for (const item of tunnelConfigEquipment) {
// let pointmodel = demo.scene.getobjectByName(item.pointName)
// console.log(pointmodel);
// }
// }
// tunnelModeInit()
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@@ -228,10 +253,12 @@ function handleCancel() {
position: relative; position: relative;
height: 100%; height: 100%;
width: 100%; width: 100%;
#cvs { #cvs {
height: 100%; height: 100%;
} }
} }
#remove-title { #remove-title {
height: 42px; height: 42px;
font-size: 32px; font-size: 32px;
@@ -243,10 +270,12 @@ function handleCancel() {
text-align: center; text-align: center;
margin: 65px 0px 70px 0px; margin: 65px 0px 70px 0px;
} }
.btn { .btn {
display: flex; display: flex;
justify-content: center; justify-content: center;
gap: 80px; gap: 80px;
:nth-child(1) { :nth-child(1) {
width: 190px; width: 190px;
height: 60px; height: 60px;
@@ -258,6 +287,7 @@ function handleCancel() {
line-height: 37px; line-height: 37px;
background: transparent; background: transparent;
} }
:nth-child(2) { :nth-child(2) {
width: 190px; width: 190px;
height: 60px; height: 60px;

View File

@@ -1,12 +1,7 @@
<template> <template>
<div id="input-num"> <div id="input-num">
<p>{{ params.name }}</p> <p>{{ params.name }}</p>
<input <input type="text" :placeholder="params.placeholder" @input="handleChange" :disabled="params.disabled" />
type="text"
:placeholder="params.placeholder"
@input="handleChange"
:disabled="params.disabled"
/>
</div> </div>
</template> </template>
@@ -34,6 +29,7 @@ function handleUnmounted() {
<style lang="scss" scoped> <style lang="scss" scoped>
#input-num { #input-num {
margin: 40px 30px 0px 30px; margin: 40px 30px 0px 30px;
P { P {
width: 130px; width: 130px;
height: 35px; height: 35px;
@@ -42,6 +38,7 @@ function handleUnmounted() {
color: #ffffff; color: #ffffff;
line-height: 35px; line-height: 35px;
} }
input { input {
width: 284px; width: 284px;
height: 51px; height: 51px;
@@ -55,6 +52,7 @@ function handleUnmounted() {
padding: 0px 10px; padding: 0px 10px;
overflow: hidden; overflow: hidden;
} }
::placeholder { ::placeholder {
color: #0f82af; color: #0f82af;
} }

View File

@@ -2,54 +2,25 @@
<div id="edit-dialog"> <div id="edit-dialog">
<div class="distance-back"> <div class="distance-back">
<p>当前距离洞口{{ pointDistance_str }}</p> <p>当前距离洞口{{ pointDistance_str }}</p>
<img <img src="/images/htmlEditDialog/back-icon.png" alt="" @click="handleCancel" />
src="/images/htmlEditDialog/back-icon.png"
alt=""
@click="handleCancel"
/>
</div> </div>
<div class="equ-info">当前风压:{{ p }}Pa</div> <div class="equ-info">当前风压:{{ p }}Pa</div>
<div class="setting"> <div class="setting">
<div class="setting-item"> <div class="setting-item">
<p>传感器类型</p> <p>传感器类型</p>
<el-select <el-select v-model="equipmentSetting.equipmentType" :fit-input-width="true" filterable clearable
v-model="equipmentSetting.equipmentType" placeholder="请选择设备类型">
:fit-input-width="true" <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
filterable
clearable
placeholder="请选择设备类型"
>
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select> </el-select>
</div> </div>
<div class="setting-item"> <div class="setting-item">
<p>设备选择</p> <p>设备选择</p>
<el-select <el-select v-model="equipmentSetting.chooseEquipment" :fit-input-width="true" filterable clearable
v-model="equipmentSetting.chooseEquipment" placeholder="请选择设备类型">
:fit-input-width="true" <el-option v-for="item in options2" :key="item.value" :label="item.label" :value="item.value" />
filterable
clearable
placeholder="请选择设备类型"
>
<el-option
v-for="item in options2"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select> </el-select>
</div> </div>
<input-num <input-num name="阈值" placeholder="请输入阈值" @inputValue="handelInput" :disabled="isDisabledInputNum" />
name="阈值"
placeholder="请输入阈值"
@inputValue="handelInput"
:disabled="isDisabledInputNum"
/>
</div> </div>
<div class="btn"> <div class="btn">
<button @click="removeEquipment">删除</button> <button @click="removeEquipment">删除</button>
@@ -80,8 +51,7 @@ let p = ref(57);
//计算锚点之间距离 //计算锚点之间距离
const pointDistance_str = computed( const pointDistance_str = computed(
() => () =>
`${params.pointGap}米*${params.pointNum}=${ `${params.pointGap}米*${params.pointNum}=${params.pointGap * params.pointNum
params.pointGap * params.pointNum
}` }`
); );
@@ -183,11 +153,13 @@ const equipment = {
z-index: 999; z-index: 999;
display: block; display: block;
opacity: 0; opacity: 0;
.distance-back { .distance-back {
height: 30px; height: 30px;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
margin: 20px 20px 0px 30px; margin: 20px 20px 0px 30px;
p { p {
width: 388px; width: 388px;
height: 35px; height: 35px;
@@ -196,13 +168,16 @@ const equipment = {
color: #ffffff; color: #ffffff;
line-height: 35px; line-height: 35px;
} }
img { img {
cursor: pointer; cursor: pointer;
} }
img:active { img:active {
transform: scale(0.9); transform: scale(0.9);
} }
} }
.equ-info { .equ-info {
width: 190px; width: 190px;
height: 35px; height: 35px;
@@ -212,6 +187,7 @@ const equipment = {
line-height: 35px; line-height: 35px;
margin: 20px 30px 0px 30px; margin: 20px 30px 0px 30px;
} }
.setting { .setting {
.setting-item { .setting-item {
padding: 30px 30px 10px 30px; padding: 30px 30px 10px 30px;
@@ -226,23 +202,27 @@ const equipment = {
margin-bottom: 20px; margin-bottom: 20px;
} }
} }
:deep(.el-select) { :deep(.el-select) {
width: 284px; width: 284px;
//height: 51px; //height: 51px;
border: transparent; border: transparent;
} }
:deep(.el-input--suffix) { :deep(.el-input--suffix) {
width: 284px; width: 284px;
height: 51px; height: 51px;
background: rgba(7, 35, 72, 0.79); background: rgba(7, 35, 72, 0.79);
border: 2px solid #0f82af; border: 2px solid #0f82af;
} }
:deep(.el-input__wrapper) { :deep(.el-input__wrapper) {
background: transparent; background: transparent;
border: none !important; border: none !important;
padding: 0px 12px 0px 10px; padding: 0px 12px 0px 10px;
box-shadow: none !important; box-shadow: none !important;
} }
:deep(.el-input__wrapper input) { :deep(.el-input__wrapper input) {
background: transparent; background: transparent;
height: 100%; height: 100%;
@@ -251,19 +231,23 @@ const equipment = {
color: #08b7b8; color: #08b7b8;
line-height: 37px; line-height: 37px;
} }
:deep(.el-icon) { :deep(.el-icon) {
color: #05feff; color: #05feff;
font-size: 34px; font-size: 34px;
} }
} }
.btn { .btn {
margin: 100px 40px 40px 40px; margin: 100px 40px 40px 40px;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
button { button {
cursor: pointer; cursor: pointer;
transition: transform 0.1s linear 0s; transition: transform 0.1s linear 0s;
} }
& :nth-child(1) { & :nth-child(1) {
width: 190px; width: 190px;
height: 60px; height: 60px;
@@ -275,6 +259,7 @@ const equipment = {
color: #08b7b8; color: #08b7b8;
line-height: 60px; line-height: 60px;
} }
& :nth-child(2) { & :nth-child(2) {
width: 190px; width: 190px;
height: 60px; height: 60px;
@@ -286,6 +271,7 @@ const equipment = {
color: #ffffff; color: #ffffff;
line-height: 60px; line-height: 60px;
} }
button:active { button:active {
transform: scale(0.9); transform: scale(0.9);
} }

View File

@@ -487,4 +487,38 @@ export default class Demo {
opacityTween(0.1, 0.5, true); opacityTween(0.1, 0.5, true);
} }
} }
ThreeConfig = {
code: 0,
data: {
tunnelThreeConfig: [{
equipmentId: 'fan_01',//传感器id
equipmentName: '01',//设备名称
pointName: 'point_005_tl',//附着点名称(定位)
equipmentType: 'fan',//设备类型(类型可根据后端
equipmentValue: 23, //设备存的值
}, {
equipmentId: 'sensors_01',//传感器id
equipmentName: '01',//设备名称
pointName: 'point_009_bl',//附着点名称(定位)
equipmentType: 'sensors',//设备类型(类型可根据后端
equipmentValue: 67, //设备存的值
}],
},
msg: "dda"
}
tunnelConfigEquipment = this.ThreeConfig.data.tunnelThreeConfig
tunnelModeInit() {
for (const item of this.tunnelConfigEquipment) {
//使用api取拿到附着点
let pointmodel = this.scene.getObjectByName(item.pointName)
let formInfo = {
equipmentType: item.equipmentType, //设备类型
chooseEquipment: item.equipmentName, //设备选择(设备名称)
threshold: item.equipmentValue, //阈值
}
this.addEquipment(pointmodel, formInfo);
}
}
} }

View File

@@ -4,6 +4,9 @@ import EquipmentTag from "../utils/EquipmentTag";
* @param {Mesh} targetPoint * @param {Mesh} targetPoint
* @param {String} equType "fan" "sensors" * @param {String} equType "fan" "sensors"
*/ */
//formInfo需要的信息这里包括了
//equipmentType、
function addEquipment(targetPoint, formInfo) { function addEquipment(targetPoint, formInfo) {
if (targetPoint.hasDevice) { if (targetPoint.hasDevice) {
alert("已添加设备"); alert("已添加设备");

View File

@@ -1,7 +1,7 @@
<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"/> <manage-btn v-model="selectIndex" @select="manageSelect" :list="routeList" />
<div class="tunnel-title"></div> <div class="tunnel-title"></div>
<manage-length class="tunnel-length"></manage-length> <manage-length class="tunnel-length"></manage-length>
<div class="top-right"> <div class="top-right">
@@ -18,54 +18,21 @@
</div> </div>
<tunnel-scene id="tunnel-box" /> <tunnel-scene id="tunnel-box" />
<div class="left"> <div class="left">
<el-drawer <el-drawer v-model="drawerLeft" direction="ltr" modal-class="modal-box" :modal="false" :show-close="false"
v-model="drawerLeft" :close-on-click-modal="false" :close-on-press-escape="false">
direction="ltr" <fan-info v-if="showFan" :list="socketData.leftData" :fan-data="largeScreenData" />
modal-class="modal-box" <transducer-list :list="socketData.leftData" :transducer-data="largeScreenData" />
:modal="false"
:show-close="false"
:close-on-click-modal="false"
:close-on-press-escape="false"
>
<fan-info
v-if="showFan"
:list="socketData.leftData"
:fan-data="largeScreenData"
/>
<transducer-list
:list="socketData.leftData"
:transducer-data="largeScreenData"
/>
<used-ele :list="socketData.leftData" :ele-data="largeScreenData" /> <used-ele :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 <el-drawer v-model="drawerRight" direction="rtl" modal-class="modal-box" :modal="false" :show-close="false"
v-model="drawerRight" :close-on-click-modal="false" :close-on-press-escape="false">
direction="rtl" <wind-pressure-list v-if="showFan" :list="socketData.windPressure" :win-data="largeScreenData" />
modal-class="modal-box" <air-info v-if="showFan" :list="socketData.sensor" :air-data="largeScreenData" />
:modal="false" <bad-gas-info v-if="showFan" :list="socketData.sensor" :bad-gas-data="largeScreenData" />
:show-close="false"
:close-on-click-modal="false"
:close-on-press-escape="false"
>
<wind-pressure-list
v-if="showFan"
:list="socketData.windPressure"
:win-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"
/>
</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>
@@ -98,8 +65,8 @@ import { dateFormat } from "@/utils/date.js";
import { onMounted } from "vue"; import { onMounted } from "vue";
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 } from "@/api/largeScreen"; import { getLargeScreen, getLargeScreenInfo } from "@/api/largeScreen";
import {ElMessageBox} from "element-plus"; import { ElMessageBox } from "element-plus";
const authStore = useAuthStore(); const authStore = useAuthStore();
const router = useRouter(); const router = useRouter();
@@ -137,9 +104,9 @@ onMounted(() => {
const getOtherInfo = async () => { const getOtherInfo = async () => {
await getLargeScreenInfo().then((res) => { await getLargeScreenInfo().then((res) => {
if (res?.code === 1000) { if (res?.code === 1000) {
routeList.value=res.data.routeList routeList.value = res.data.routeList
currentSite.value=res.data.siteOption[0].label currentSite.value = res.data.siteOption[0].label
tunnelList.value=res.data.tunnelOption tunnelList.value = res.data.tunnelOption
} }
}); });
}; };
@@ -154,7 +121,7 @@ const manageSelect = (index) => {
console.log("首页点击-", index); console.log("首页点击-", index);
if (index === 0) { if (index === 0) {
router.push("/site"); router.push("/site");
}else if (index === 1){ } else if (index === 1) {
router.push("/tunnel/1"); router.push("/tunnel/1");
} }
}; };
@@ -231,6 +198,7 @@ initWebSocket();
height: 100%; height: 100%;
width: 100%; width: 100%;
background-color: #072348; background-color: #072348;
#tunnel-box { #tunnel-box {
height: 100%; height: 100%;
} }