邓洁: 设备修改接口对接

This commit is contained in:
邓洁
2024-01-17 15:17:59 +08:00
parent 84786e404b
commit 797cf8371e
4 changed files with 135 additions and 322 deletions

View File

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

View File

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

View File

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

View File

@@ -325,7 +325,6 @@ const nextBtn = () => {
const initWebSocket = () => { const initWebSocket = () => {
// let wsUrl = `ws://192.168.31.175:9000/websocket/equipment/${token}/${serialNumber.value}` // 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}`; let wsUrl = `ws://web-tunnel.feashow.com/api/wstunnel/websocket/equipment/${token}/${serialNumber.value}`;
console.log(wsUrl);
socket = new WebSocket(wsUrl); socket = new WebSocket(wsUrl);
//连接发生错误的回调方法 //连接发生错误的回调方法
socket.onerror = function () { socket.onerror = function () {