Merge pull request 'dengjie' (#243) from dengjie into dev

Reviewed-on: http://git.feashow.cn/clay/tunnel-cloud-web/pulls/243
This commit is contained in:
odjbin
2024-01-17 07:20:02 +00:00
4 changed files with 136 additions and 323 deletions

View File

@@ -43,14 +43,6 @@ export const editTunnel = (data) => {
data
})
}
//设备管理-风机设备信息修改
export const editFan = (data) => {
return request({
url: '/tunnel/equipment/frequency/equipments',
method: 'put',
data
})
}
export const editEquipment = (data) => {
return request({
url: '/tunnel/equipment/equipments',
@@ -58,10 +50,3 @@ export const editEquipment = (data) => {
data
})
}
export const editAcquisitions = (data) => {
return request({
url: '/tunnel/equipment/frequency/acquisitions',
method: 'put',
data
})
}

View File

@@ -36,13 +36,11 @@
<span>风机设备管理</span>
<div class="collection-frequency">
<span>采集频率</span>
<span class="units">
<input
type="number"
min="0"
v-model="fanFrequency"
/>
</span>
<el-input type="number" v-model="fanFrequency" @change="changeFan">
<template #suffix>
<span>/</span>
</template>
</el-input>
</div>
</div>
<div class="device-table">
@@ -54,19 +52,19 @@
<el-table-column prop="phaseCurrentAOffset" label="A电流偏移量" align="center"/>
<el-table-column prop="acurrentValue" label="A电流阈值" align="center">
<template #default="scope">
<el-input placeholder="A电流" v-model="scope.row.acurrentValue"></el-input>
<el-input placeholder="A电流" v-model="scope.row.acurrentValue" @change="changeFanData(scope.row)"></el-input>
</template>
</el-table-column>
<el-table-column prop="phaseCurrentBOffset" label="B电流偏移量" align="center"/>
<el-table-column prop="bcurrentValue" label="B电流阈值" align="center">
<template #default="scope">
<el-input placeholder="B电流" v-model="scope.row.bcurrentValue"></el-input>
<el-input placeholder="B电流" v-model="scope.row.bcurrentValue" @change="changeFanData(scope.row)"></el-input>
</template>
</el-table-column>
<el-table-column prop="phaseCurrentCOffset" label="C电流偏移量" align="center"/>
<el-table-column prop="ccurrentValue" label="C电流阈值" align="center">
<template #default="scope">
<el-input placeholder="C电流" v-model="scope.row.ccurrentValue"></el-input>
<el-input placeholder="C电流" v-model="scope.row.ccurrentValue" @change="changeFanData(scope.row)"></el-input>
</template>
</el-table-column>
<el-table-column prop="state" label="状态" align="center">
@@ -74,13 +72,13 @@
<div class="switch">
<div
:class="{ active: scope.row.state }"
@click="scope.row.state = 1"
@click="scope.row.state = 1;changeFanData(scope.row)"
>
启用
</div>
<div
:class="{ active: ! scope.row.state }"
@click=" scope.row.state = 0"
@click=" scope.row.state = 0;changeFanData(scope.row)"
>
停用
</div>
@@ -93,7 +91,7 @@
<div class="cancel-btn" @click="router.back(-1)">
取消
</div>
<div class="sure-btn" @click="handleEditFan">
<div class="sure-btn" @click="editEquip">
确定
</div>
</div>
@@ -103,13 +101,11 @@
<span>风压设备管理</span>
<div class="collection-frequency">
<span>采集频率</span>
<span class="units">
<input
type="number"
min="0"
v-model="windFrequency"
/>
</span>
<el-input type="number" v-model="windFrequency" @change="changeWind">
<template #suffix>
<span>/</span>
</template>
</el-input>
</div>
</div>
<div class="device-table">
@@ -121,12 +117,12 @@
<el-table-column prop="offset" label="偏移量" align="center"/>
<el-table-column prop="unit" label="单位" align="center">
<template #default="scope">
<el-input placeholder="单位" v-model="scope.row.unit"></el-input>
<el-input placeholder="单位" v-model="scope.row.unit" @change="changeWindData(scope.row)"></el-input>
</template>
</el-table-column>
<el-table-column prop="alarmValue" label="阈值" align="center">
<template #default="scope">
<el-input placeholder="阈值" v-model="scope.row.alarmValue"></el-input>
<el-input placeholder="阈值" v-model="scope.row.alarmValue" @change="changeWindData(scope.row)"></el-input>
</template>
</el-table-column>
<el-table-column prop="state" label="状态" align="center">
@@ -134,13 +130,13 @@
<div class="switch wind-switch">
<div
:class="{ active: scope.row.state }"
@click=" scope.row.state = 1;"
@click=" scope.row.state = 1;changeWindData(scope.row)"
>
启用
</div>
<div
:class="{ active: ! scope.row.state }"
@click=" scope.row.state = 0;"
@click=" scope.row.state = 0;changeWindData(scope.row)"
>
停用
</div>
@@ -153,7 +149,7 @@
<div class="cancel-btn" @click="router.back(-1)">
取消
</div>
<div class="sure-btn" @click="handleEditWind">
<div class="sure-btn" @click="editEquip">
确定
</div>
</div>
@@ -163,13 +159,11 @@
<span>其他传感器设备管理</span>
<div class="collection-frequency">
<span>采集频率</span>
<span class="units">
<input
type="number"
min="0"
v-model="otherFrequency"
/>
</span>
<el-input type="number" v-model="otherFrequency" @change="changeOther">
<template #suffix>
<span>/</span>
</template>
</el-input>
</div>
</div>
<div class="device-table">
@@ -181,12 +175,12 @@
<el-table-column prop="offset" label="偏移量" align="center"/>
<el-table-column prop="unit" label="单位" align="center">
<template #default="scope">
<el-input placeholder="单位" v-model="scope.row.unit"></el-input>
<el-input placeholder="单位" v-model="scope.row.unit" @change="changeOtherData(scope.row)"></el-input>
</template>
</el-table-column>
<el-table-column prop="alarmValue" label="阈值" align="center">
<template #default="scope">
<el-input placeholder="阈值" v-model="scope.row.alarmValue"></el-input>
<el-input placeholder="阈值" v-model="scope.row.alarmValue" @change="changeOtherData(scope.row)"></el-input>
</template>
</el-table-column>
<el-table-column prop="state" label="状态" align="center">
@@ -194,13 +188,13 @@
<div class="switch wind-switch">
<div
:class="{ active: scope.row.state }"
@click=" scope.row.state = 1;"
@click=" scope.row.state = 1;changeOtherData(scope.row)"
>
启用
</div>
<div
:class="{ active: ! scope.row.state }"
@click=" scope.row.state = 0;"
@click=" scope.row.state = 0;changeOtherData(scope.row)"
>
停用
</div>
@@ -213,7 +207,7 @@
<div class="cancel-btn" @click="router.back(-1)">
取消
</div>
<div class="sure-btn" @click="handleEditOther">
<div class="sure-btn" @click="editEquip">
确定
</div>
</div>
@@ -223,25 +217,23 @@
<span>分流器设备管理</span>
<div class="collection-frequency">
<span>采集频率</span>
<span class="units">
<input
type="number"
min="0"
v-model="fenFrequency"
/>
</span>
<el-input type="number" v-model="fenFrequency">
<template #suffix>
<span>/</span>
</template>
</el-input>
</div>
</div>
<div class="device-table">
<el-table stripe
style="border-bottom: 1px #06e5e5 solid;background-color: #011c29;--el-table-border-color: none;"
:header-cell-style="{backgroundColor: '#064B66',color: '#fff',fontSize: '40px',borderBottom: 'none' }"
:cell-style="{textAlign: 'center',borderBottom: 'none'}" :data="fenliuData">
:cell-style="{textAlign: 'center',borderBottom: 'none'}" :data="fenLiuData">
<el-table-column prop="name" label="设备名称" align="center"/>
<el-table-column prop="offset" label="偏移量" align="center"/>
<el-table-column prop="thresholdValue" label="阈值" align="center">
<template #default="scope">
<el-input placeholder="阈值" v-model="scope.row.thresholdValue"></el-input>
<el-input placeholder="阈值" v-model="scope.row.thresholdValue" @change="changeFenData(scope.row)"></el-input>
</template>
</el-table-column>
<el-table-column prop="state" label="状态" align="center">
@@ -249,13 +241,13 @@
<div class="switch">
<div
:class="{ active: scope.row.state }"
@click=" scope.row.state = true"
@click=" scope.row.state = 1;changeFenData(scope.row)"
>
启用
</div>
<div
:class="{ active: ! scope.row.state }"
@click=" scope.row.state = false"
@click=" scope.row.state = 0;changeFenData(scope.row)"
>
停用
</div>
@@ -279,10 +271,8 @@
</template>
<script setup>
import {getEquipmentList, editFan} from "@/api/tunnelManage";
import {ElMessage} from "element-plus";
import {editEquipment, getTunnelDetail} from "@/api/tunnelManage";
import {editAcquisitions} from "../../api/tunnelManage";
import {getEquipmentList, editEquipment, getTunnelDetail} from "@/api/tunnelManage";
const router = useRouter()
const tunnelId = reactive(router.currentRoute.value.params.tunnelId)
@@ -292,237 +282,76 @@ const fanFrequency = ref(0)
const windFrequency = ref(0)
const otherFrequency = ref(0)
const changeIndex = ref(1)
const fanData = ref([
// {
// name: '一号风机',
// currentA: '2342',
// currentB: '2342',
// currentC: '2342',
// state: false,
// },
// {
// name: '二号风机',
// currentA: '2342',
// currentB: '2342',
// currentC: '2342',
// state: true,
// },
// {
// name: '三号风机',
// currentA: '2342',
// currentB: '2342',
// currentC: '2342',
// state: false,
// }
])
const winData = ref([
// {
// name: '1号风压',
// offset: '2342',
// unit: 'Pa',
// thresholdValue: '2342',
// state: false,
// },
// {
// name: '2号风压',
// offset: '2342',
// unit: 'Pa',
// thresholdValue: '2342',
// state: false,
// },
// {
// name: '3号风压',
// offset: '2342',
// unit: 'Pa',
// thresholdValue: '2342',
// state: false,
// },
// {
// name: '4号风压',
// offset: '2342',
// unit: 'Pa',
// thresholdValue: '2342',
// state: false,
// },
// {
// name: '5号风压',
// offset: '2342',
// unit: 'Pa',
// thresholdValue: '2342',
// state: false,
// },
// {
// name: '6号风压',
// offset: '2342',
// unit: 'Pa',
// thresholdValue: '2342',
// state: false,
// },
// {
// name: '7号风压',
// offset: '2342',
// unit: 'Pa',
// thresholdValue: '2342',
// state: false,
// },
// {
// name: '8号风压',
// offset: '2342',
// unit: 'Pa',
// thresholdValue: '2342',
// state: false,
// },
// {
// name: '9号风压',
// offset: '2342',
// unit: 'Pa',
// thresholdValue: '2342',
// state: false,
// },
// {
// name: '10号风压',
// offset: '2342',
// unit: 'Pa',
// thresholdValue: '2342',
// state: false,
// },
])
const otherData = ref([
// {
// name: '风速',
// offset: '2342',
// unit: 'm/s',
// thresholdValue: '2342',
// state: false,
// }, {
// name: '氧 气',
// offset: '2342',
// unit: 'm/s',
// thresholdValue: '2342',
// state: false,
// }, {
// name: '温 度',
// offset: '2342',
// unit: 'm/s',
// thresholdValue: '2342',
// state: false,
// }, {
// name: '湿 度',
// offset: '2342',
// unit: 'm/s',
// thresholdValue: '2342',
// state: false,
// }, {
// name: '粉 尘',
// offset: '2342',
// unit: 'm/s',
// thresholdValue: '2342',
// state: false,
// }, {
// name: '二氧化碳',
// offset: '2342',
// unit: 'm/s',
// thresholdValue: '2342',
// state: false,
// }, {
// name: '一氧化碳',
// offset: '2342',
// unit: 'm/s',
// thresholdValue: '2342',
// state: false,
// }, {
// name: '二氧化氮',
// offset: '2342',
// unit: 'm/s',
// thresholdValue: '2342',
// state: false,
// }, {
// name: '一氧化氮',
// offset: '2342',
// unit: 'm/s',
// thresholdValue: '2342',
// state: false,
// }, {
// name: '二氧化硫',
// offset: '2342',
// unit: 'm/s',
// thresholdValue: '2342',
// state: false,
// }, {
// name: '硫 化 氢',
// offset: '2342',
// unit: 'm/s',
// thresholdValue: '2342',
// state: false,
// }
])
const fenliuData = ref([
// {
// name: '1号分流器',
// offset: '2342',
// thresholdValue: '2342',
// state: false,
// }, {
// name: '2号分流器',
// offset: '2342',
// thresholdValue: '2342',
// state: false,
// }, {
// name: '3号分流器',
// offset: '2342',
// thresholdValue: '2342',
// state: false,
// }
])
const fanData = ref([])
const editFanData = ref([])
const winData = ref([])
const editWinData = ref([])
const otherData = ref([])
const editOtherData = ref([])
const fenLiuData = ref([])
const editFenLiuData = ref([])
const frequencyData = ref([])
const siteId = ref(0)
const tunnelName = ref('')
const changeFrequency = (acquisition, typeKey) => {
const data = {
acquisitionPeriod: acquisition,
const changeFan=(e)=>{
const fanObj={
acquisitionPeriod: e*1000,
tunnelId: tunnelId,
typeKey: typeKey
typeKey: 'frequency'
}
editAcquisitions([data]).then(res => {
frequencyData.value.push(fanObj)
}
const changeFanData=(row)=>{
editFanData.value.push(row)
}
const changeWind=(e)=>{
const windObj={
acquisitionPeriod: e*1000,
tunnelId: tunnelId,
typeKey: 'windPressure'
}
frequencyData.value.push(windObj)
}
const changeWindData=(row)=>{
editWinData.value.push(row)
}
const changeOther=(e)=>{
const otherObj={
acquisitionPeriod: e*1000,
tunnelId: tunnelId,
typeKey: 'sensor'
}
frequencyData.value.push(otherObj)
}
const changeOtherData=(row)=>{
editOtherData.value.push(row)
}
const editEquip = () => {
let data
const basicData={
frequencyChangerList: editFanData.value,
windPressureSensorList: editWinData.value,
sensorList: editOtherData.value,
// shuntList: editFenLiuData.value,
}
if(frequencyData.value.length!==0){
data = {
acquisitionList:frequencyData.value,
...basicData
}
}else {
data = basicData
}
editEquipment(data).then(res => {
if (res.code === 1000) {
ElMessage.success('修改成功')
router.push('/tunnel/' + siteId.value + '/' + type + '/' + userId)
} else {
ElMessage.error(res.msg)
}
})
}
} else {
ElMessage.error(res.msg)
}
})
}
const handleEditFan = () => {
editFan(fanData.value).then(res => {
if (res.code === 1000) {
ElMessage.success('修改成功')
router.push('/tunnel/' + siteId.value + '/' + type + '/' + userId)
} else {
ElMessage.error(res.msg)
}
})
changeFrequency(fanFrequency.value, 'frequency')
}
const handleEditWind = () => {
editEquipment(winData.value).then(res => {
if (res.code === 1000) {
ElMessage.success('修改成功')
router.push('/tunnel/' + siteId.value + '/' + type + '/' + userId)
} else {
ElMessage.error(res.msg)
}
})
changeFrequency(windFrequency.value, 'windPressure')
}
const handleEditOther = () => {
editEquipment(otherData.value).then(res => {
if (res.code === 1000) {
ElMessage.success('修改成功')
router.push('/tunnel/' + siteId.value + '/' + type + '/' + userId)
} else {
ElMessage.error(res.msg)
}
})
changeFrequency(otherFrequency.value, 'sensor')
}
const handleChangeMenu = (e) => {
changeIndex.value = e
}
@@ -540,11 +369,12 @@ const getList = () => {
})
otherData.value = res.data.sensorList
res.data.acquisitionList.map(item => {
if(item.typeKey === 'frequency'){
item.acquisitionPeriod = item.acquisitionPeriod / 1000
if (item.typeKey === 'frequency') {
fanFrequency.value = item.acquisitionPeriod
}else if(item.typeKey === 'windPressure'){
} else if (item.typeKey === 'windPressure') {
windFrequency.value = item.acquisitionPeriod
}else if(item.typeKey ==='sensor'){
} else if (item.typeKey === 'sensor') {
otherFrequency.value = item.acquisitionPeriod
}
})
@@ -556,14 +386,10 @@ const getTunnel = () => {
if (res?.code === 1000) {
siteId.value = res.data.siteId
tunnelName.value = res.data.tunnelName
console.log('设备详情', res.data)
}
});
}
getTunnel()
const handleGoTunnelMgr = () => {
router.push('/tunnel/' + siteId.value + '/' + type + '/' + userId)
}
getList()
</script>
@@ -613,12 +439,12 @@ getList()
.device-content {
display: flex;
justify-content: center;
padding-top: 220px;
padding-top: 190px;
.device-box {
display: flex;
width: 2194px;
height: 1500px;
height: 1600px;
background: #064B66;
border-radius: 20px;
border: 2px solid #05FEFF;
@@ -627,7 +453,7 @@ getList()
.box-left {
padding-left: 24px;
width: 300px;
height: 1498px;
height: 1596px;
background: #0D5A7A;
border-radius: 20px 0px 0px 20px;
@@ -683,36 +509,39 @@ getList()
}
.collection-frequency {
height: 60px;
display: flex;
align-items: center;
position: absolute;
right: 102px;
> span:first-child {
font-size: 38px !important;
white-space: pre;
margin-right: 15px;
}
.units {
position: relative;
:deep(.el-input__wrapper) {
width: 166px;
height: 56px;
background-color: transparent;
box-shadow: none;
border-radius: 6px;
border: 1px solid #05FEFF;
transform: none;
transition: none;
input {
width: 220px;
height: 50px;
border: 1px solid #05FEFF;
background: transparent;
margin-left: 14px;
font-size: 35px;
.el-input__inner {
height: 54px;
font-size: 30px;
color: #FFFFFF;
outline: none;
}
}
.units::after {
content: "秒/次";
position: absolute;
right: 6px;
top: 26%;
transform: translateY(-50%);
font-size: 35px;
color: #08B7B8;
.el-input__suffix-inner {
font-size: 30px;
color: #08B7B8;
line-height: 40px;
}
}
}
}

View File

@@ -115,7 +115,7 @@ onBeforeUnmount(() => {
.login-box {
height: 100%;
background-color: #4158d0;
background-color: #063247;
//background-image: linear-gradient(
// 43deg,
// #4158d0 0%,

View File

@@ -325,7 +325,6 @@ const nextBtn = () => {
const initWebSocket = () => {
// let wsUrl = `ws://192.168.31.175:9000/websocket/equipment/${token}/${serialNumber.value}`
let wsUrl = `ws://web-tunnel.feashow.com/api/wstunnel/websocket/equipment/${token}/${serialNumber.value}`;
console.log(wsUrl);
socket = new WebSocket(wsUrl);
//连接发生错误的回调方法
socket.onerror = function () {
@@ -337,7 +336,7 @@ const initWebSocket = () => {
};
//接收到消息的回调方法
socket.onmessage = function (event) {
console.log("服务器返回的信息: ", JSON.parse(event.data));
// console.log("服务器返回的信息: ", JSON.parse(event.data));
const type = JSON.parse(event.data).type;
const data = JSON.parse(event.data).data;
if (type === "equipment") {