邓洁 : 隧道接口部分对接

This commit is contained in:
dengj
2023-12-28 18:06:48 +08:00
parent 9017465b15
commit 67f40cd6b1
3 changed files with 37 additions and 87 deletions

View File

@@ -2,11 +2,11 @@
<div id="wind-pressure"> <div id="wind-pressure">
<div class="name">风压</div> <div class="name">风压</div>
<div class="list"> <div class="list">
<wind-pressure-item v-for="(item,index) in wpList" :key="item.equipmentId" :wp="item" :index="index+1" <wind-pressure-item v-for="(item,index) in wpList" :key="item.equipmentId" :wp="item"
@click="handleOpenChart(item,index+1)"/> @click="handleOpenChart(item)"/>
</div> </div>
<div class="digital-tunnel"> <div class="digital-tunnel">
<el-dialog :close-on-click-modal="false" v-model="isVisited" :title="windSort+'号风压监控数据'" width="2175px" :modal="false"> <el-dialog :close-on-click-modal="false" v-model="isVisited" :title="windSort+'监控数据'" width="2175px" :modal="false">
<div class="left-top-icon"></div> <div class="left-top-icon"></div>
<div class="right-top-icon"></div> <div class="right-top-icon"></div>
<div class="chat-dialog"> <div class="chat-dialog">
@@ -69,9 +69,9 @@ const getWindInfo = (equipmentId) => {
}) })
} }
const handleOpenChart = (item, index) => { const handleOpenChart = (item) => {
getWindInfo(item.equipmentId) getWindInfo(item.equipmentId)
windSort.value = index windSort.value = item.equipmentName
} }
const timeSelect = (index) => { const timeSelect = (index) => {
console.log('选择时间', index) console.log('选择时间', index)
@@ -89,6 +89,7 @@ const getScreenInfo = (now) => {
now?.map(item => { now?.map(item => {
windPressureObj = { windPressureObj = {
equipmentId: item.equipmentId, equipmentId: item.equipmentId,
equipmentName: item.equipmentName,
max: 120, max: 120,
value: item.value, value: item.value,
point: item.valueThreshold, point: item.valueThreshold,

View File

@@ -2,7 +2,7 @@
<div id="wind-pressure-item" :class="{ abnormal:isWaring }"> <div id="wind-pressure-item" :class="{ abnormal:isWaring }">
<div class="label"> <div class="label">
<img src="../../../../assets/images/windPressure/icon.png" alt=""/> <img src="../../../../assets/images/windPressure/icon.png" alt=""/>
<span>{{ index }}号风压</span> <span>{{params.wp.equipmentName}}</span>
</div> </div>
<div class="container" ref="length"> <div class="container" ref="length">
<div class="value" ref="value"></div> <div class="value" ref="value"></div>
@@ -16,8 +16,7 @@
<script setup> <script setup>
const params = defineProps({ const params = defineProps({
wp: Object, wp: Object
index: Number,
}); });
// const info = { // const info = {
// windPId: 0, //编号 // windPId: 0, //编号

View File

@@ -53,20 +53,17 @@
<el-table-column prop="equipmentName" label="设备名称" align="center"/> <el-table-column prop="equipmentName" label="设备名称" align="center"/>
<el-table-column prop="phaseCurrentAOffset" label="A电流" align="center"> <el-table-column prop="phaseCurrentAOffset" label="A电流" align="center">
<template #default="scope"> <template #default="scope">
<el-input placeholder="请输入A电流" v-model="scope.row.phaseCurrentAOffset" <el-input placeholder="请输入A电流" v-model="scope.row.phaseCurrentAOffset"></el-input>
@change="changeCurrent(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">
<template #default="scope"> <template #default="scope">
<el-input placeholder="请输入B电流" v-model="scope.row.phaseCurrentBOffset" <el-input placeholder="请输入B电流" v-model="scope.row.phaseCurrentBOffset"></el-input>
@change="changeCurrent(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">
<template #default="scope"> <template #default="scope">
<el-input placeholder="请输入C电流" v-model="scope.row.phaseCurrentCOffset" <el-input placeholder="请输入C电流" v-model="scope.row.phaseCurrentCOffset"></el-input>
@change="changeCurrent(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 +71,13 @@
<div class="switch"> <div class="switch">
<div <div
:class="{ active: scope.row.state }" :class="{ active: scope.row.state }"
@click="scope.row.state = 1;changeState(scope.row)" @click="scope.row.state = 1"
> >
启用 启用
</div> </div>
<div <div
:class="{ active: ! scope.row.state }" :class="{ active: ! scope.row.state }"
@click=" scope.row.state = 0;changeState(scope.row)" @click=" scope.row.state = 0"
> >
停用 停用
</div> </div>
@@ -121,12 +118,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" @change="changeCurrent(scope.row)"></el-input> <el-input placeholder="请输入单位" v-model="scope.row.unit"></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" @change="changeCurrent(scope.row)"></el-input> <el-input placeholder="请输入阈值" v-model="scope.row.alarmValue"></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 +131,13 @@
<div class="switch"> <div class="switch">
<div <div
:class="{ active: scope.row.state }" :class="{ active: scope.row.state }"
@click=" scope.row.state = 1;changeState(scope.row)" @click=" scope.row.state = 1;"
> >
启用 启用
</div> </div>
<div <div
:class="{ active: ! scope.row.state }" :class="{ active: ! scope.row.state }"
@click=" scope.row.state = 0;changeState(scope.row)" @click=" scope.row.state = 0;"
> >
停用 停用
</div> </div>
@@ -153,7 +150,7 @@
<div class="cancel-btn"> <div class="cancel-btn">
取消 取消
</div> </div>
<div class="sure-btn" @click="editWinPresure"> <div class="sure-btn" @click="handleEditFan">
确定 确定
</div> </div>
</div> </div>
@@ -181,12 +178,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" @change="changeCurrent(scope.row)"></el-input> <el-input placeholder="请输入单位" v-model="scope.row.unit"></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" @change="changeCurrent(scope.row)"></el-input> <el-input placeholder="请输入阈值" v-model="scope.row.alarmValue"></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 +191,13 @@
<div class="switch"> <div class="switch">
<div <div
:class="{ active: scope.row.state }" :class="{ active: scope.row.state }"
@click=" scope.row.state = 1;changeState(scope.row)" @click=" scope.row.state = 1;"
> >
启用 启用
</div> </div>
<div <div
:class="{ active: ! scope.row.state }" :class="{ active: ! scope.row.state }"
@click=" scope.row.state = 0;changeState(scope.row)" @click=" scope.row.state = 0;"
> >
停用 停用
</div> </div>
@@ -213,7 +210,7 @@
<div class="cancel-btn" @click="isVisited=false"> <div class="cancel-btn" @click="isVisited=false">
取消 取消
</div> </div>
<div class="sure-btn" @click="editOtherSensor"> <div class="sure-btn" @click="handleEditFan">
确定 确定
</div> </div>
</div> </div>
@@ -268,7 +265,7 @@
<div class="cancel-btn" @click="isVisited=false"> <div class="cancel-btn" @click="isVisited=false">
取消 取消
</div> </div>
<div class="sure-btn" @click="router.back(-1)"> <div class="sure-btn" @click="handleEditFan">
确定 确定
</div> </div>
</div> </div>
@@ -282,6 +279,7 @@
import {getEquipmentList, editFan} from "@/api/tunnelManage"; import {getEquipmentList, editFan} from "@/api/tunnelManage";
import {ElMessage} from "element-plus"; import {ElMessage} from "element-plus";
import {editEquipment, getTunnelDetail} from "@/api/tunnelManage"; import {editEquipment, getTunnelDetail} 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)
const type = reactive(router.currentRoute.value.params.type) const type = reactive(router.currentRoute.value.params.type)
@@ -469,75 +467,27 @@ const fenliuData = ref([
// state: false, // state: false,
// } // }
]) ])
const fanItem=ref({}) const siteId = ref(0)
const windItem=ref({}) const tunnelName = ref('')
const sensorItem=ref({})
const siteId=ref(0)
const tunnelName=ref('')
const changeCurrent = (row) => {
fanItem.value=getFanEditItem(row)
windItem.value=getWindEditItem(row)
sensorItem.value=getSensorEditItem(row)
}
const changeState = (row) => {
fanItem.value=getFanEditItem(row)
windItem.value=getWindEditItem(row)
sensorItem.value=getSensorEditItem(row)
}
const getFanEditItem = (item) => {
return {
equipmentId: item.equipmentId,
phaseCurrentAOffset: parseInt(item.phaseCurrentAOffset),
phaseCurrentBOffset: parseInt(item.phaseCurrentBOffset),
phaseCurrentCOffset: parseInt(item.phaseCurrentCOffset),
state: item.state,
}
}
const getWindEditItem = (item) => {
return {
equipmentId: item.equipmentId,
unit: item.unit,
alarmValue: item.alarmValue,
state: item.state,
}
}
const getSensorEditItem = (item) => {
return {
equipmentId: item.equipmentId,
unit: item.unit,
alarmValue: item.alarmValue,
state: item.state,
}
}
const editWinPresure=()=>{
editEquipment([windItem.value]).then(res => {
if (res.code === 1000) {
ElMessage.success('修改成功')
}
})
}
const editOtherSensor=()=>{
editEquipment([sensorItem.value]).then(res => {
if (res.code === 1000) {
ElMessage.success('修改成功')
}
})
}
const handleEditFan = () => { const handleEditFan = () => {
editFan([fanItem.value]).then(res => { const data = [
...otherData.value,
...winData.value,
...fanData.value,
]
editFan(data).then(res => {
if (res.code === 1000) { if (res.code === 1000) {
ElMessage.success('修改成功') ElMessage.success('修改成功')
router.push('/tunnel/' + siteId.value + '/' + type)
} }
}) })
} }
const handleChangeMenu = (e) => { const handleChangeMenu = (e) => {
console.log('切换', e)
changeIndex.value = e changeIndex.value = e
} }
const getList = () => { const getList = () => {
getEquipmentList(tunnelId).then(res => { getEquipmentList(tunnelId).then(res => {
console.log('设备列表', res)
if (res.code === 1000) { if (res.code === 1000) {
fanData.value = res.data.frequencyChangerList fanData.value = res.data.frequencyChangerList
winData.value = res.data.windPressureSensorList winData.value = res.data.windPressureSensorList
@@ -555,13 +505,13 @@ 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) console.log('设备详情', res.data)
} }
}); });
} }
getTunnel() getTunnel()
const handleGoTunnelMgr=()=>{ const handleGoTunnelMgr = () => {
router.push('/tunnel/' + siteId.value+'/'+type) router.push('/tunnel/' + siteId.value + '/' + type)
} }
getList() getList()
</script> </script>