fix : 多序列号功能

This commit is contained in:
2024-08-25 23:00:39 +08:00
parent 4fd4cf4f4c
commit d7378bf0af
5 changed files with 385 additions and 215 deletions

View File

@@ -36,7 +36,7 @@
<span>风机设备管理</span>
<div class="collection-frequency">
<span>采集频率</span>
<el-input type="number" v-model="fanFrequency" @change="changeFan">
<el-input type="number" v-model="fanFrequency">
<template #suffix>
<span>/</span>
</template>
@@ -45,62 +45,63 @@
</div>
<div class="device-table">
<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;" table-layout="auto"
:header-cell-style="{backgroundColor: '#064B66',color: '#fff',fontSize: '40px',borderBottom: 'none' }"
:cell-style="{textAlign: 'center',borderBottom: 'none'}" :data="fanData">
<el-table-column prop="equipmentName" label="设备名称" align="center"/>
<el-table-column prop="ratedPower" label="额定功率" align="center">
<template #default="scope">
<el-input placeholder="额定功率" v-model="scope.row.ratedPower"
@change="changeFanData(scope.row)"></el-input>
></el-input>
</template>
</el-table-column>
<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"
@change="changeFanData(scope.row)"></el-input>
></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"
@change="changeFanData(scope.row)"></el-input>
></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"
@change="changeFanData(scope.row)"></el-input>
></el-input>
</template>
</el-table-column>
<!-- <el-table-column prop="serialNumber" label="序列号" align="center" width="500">-->
<!-- <template #default="scope">-->
<!-- <el-select placeholder="请选择" v-model="scope.row.serialNumber" popper-class="serialNumber-select"-->
<!-- @change="changeFanData(scope.row)" class="serialNumber">-->
<!-- <el-option-->
<!-- v-for="item in scope.row.serialNumberOption"-->
<!-- :key="item.value"-->
<!-- :label="item.label"-->
<!-- :value="item.value"-->
<!-- />-->
<!-- </el-select>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column prop="state" label="状态" align="center" min-width="86">
<el-table-column prop="serialNumber" label="序列号" align="center" width="500">
<template #default="scope">
<!-- {{scope.row.serialNumberOption.filter(item => item.value == scope.row.serialNumber).map(item => item.label)[0]}}?-->
<!-- <el-select placeholder="请选择" v-model="scope.row.serialNumber" popper-class="serialNumber-select"-->
<!-- clearable class="serialNumber">-->
<!-- <el-option-->
<!-- v-for="item in scope.row.serialNumberOption"-->
<!-- :key="item.value"-->
<!-- :label="item.label"-->
<!-- :value="item.value"-->
<!-- />-->
<!-- </el-select>-->
</template>
</el-table-column>
<el-table-column prop="state" label="状态" align="center" width="200">
<template #default="scope">
<div class="switch">
<div
:class="{ active: scope.row.state }"
@click="scope.row.state = 1;changeFanData(scope.row)"
@click="scope.row.state = 1; "
>
启用
</div>
<div
:class="{ active: ! scope.row.state }"
@click=" scope.row.state = 0;changeFanData(scope.row)"
@click=" scope.row.state = 0; "
>
停用
</div>
@@ -123,7 +124,7 @@
<span>风压设备管理</span>
<div class="collection-frequency">
<span>采集频率</span>
<el-input type="number" v-model="windFrequency" @change="changeWind">
<el-input type="number" v-model="windFrequency">
<template #suffix>
<span>/</span>
</template>
@@ -131,7 +132,7 @@
</div>
</div>
<div class="device-table">
<el-table stripe
<el-table stripe table-layout="auto"
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="winData">
@@ -139,52 +140,54 @@
<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" @change="changeWindData(scope.row)"></el-input>
<el-input placeholder="单位" v-model="scope.row.unit" ></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"
@change="changeWindData(scope.row)"></el-input>
></el-input>
</template>
</el-table-column>
<el-table-column prop="miniRange" label="最小范围" align="center">
<template #default="scope">
<el-input placeholder="最小范围" v-model="scope.row.miniRange"
@change="changeWindData(scope.row)"></el-input>
></el-input>
</template>
</el-table-column>
<el-table-column prop="maxRange" label="最大范围" align="center">
<template #default="scope">
<el-input placeholder="最大范围" v-model="scope.row.maxRange"
@change="changeWindData(scope.row)"></el-input>
></el-input>
</template>
</el-table-column>
<!-- <el-table-column prop="serialNumber" label="序列号" align="center" width="500">-->
<!-- <template #default="scope">-->
<!-- <el-select placeholder="请选择" v-model="scope.row.serialNumber" popper-class="serialNumber-select"-->
<!-- @change="changeWindData(scope.row)" class="serialNumber">-->
<!-- <el-option-->
<!-- v-for="item in scope.row.serialNumberOption"-->
<!-- :key="item.value"-->
<!-- :label="item.label"-->
<!-- :value="item.value"-->
<!-- />-->
<!-- </el-select>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column prop="state" label="状态" align="center">
<el-table-column prop="serialNumber" label="序列号" align="center" width="500">
<template #default="scope">
<el-select placeholder="请选择" v-model="scope.row.serialNumber" popper-class="serialNumber-select"
clearable class="serialNumber" @clear="clearWinDataSelectedOption" @change="changeWindDataSerialNumber($event,scope.row.serialNumberOption)">
<el-option
v-for="item in scope.row.serialNumberOption"
:key="item.value"
:label="item.label"
:value="item.value"
:disabled="serialNumberOptionDisabled(item)"
:title="serialNumberOptionDisabled(item)?'该4G序列号已选择':''"
/>
</el-select>
</template>
</el-table-column>
<el-table-column prop="state" label="状态" align="center" width="200">
<template #default="scope">
<div class="switch wind-switch">
<div
:class="{ active: scope.row.state }"
@click=" scope.row.state = 1;changeWindData(scope.row)"
@click=" scope.row.state = 1; "
>
启用
</div>
<div
:class="{ active: ! scope.row.state }"
@click=" scope.row.state = 0;changeWindData(scope.row)"
@click=" scope.row.state = 0; "
>
停用
</div>
@@ -207,7 +210,7 @@
<span>其他传感器设备管理</span>
<div class="collection-frequency">
<span>采集频率</span>
<el-input type="number" v-model="otherFrequency" @change="changeOther">
<el-input type="number" v-model="otherFrequency">
<template #suffix>
<span>/</span>
</template>
@@ -215,7 +218,7 @@
</div>
</div>
<div class="device-table">
<el-table stripe
<el-table stripe table-layout="auto"
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="otherData">
@@ -223,52 +226,52 @@
<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" @change="changeOtherData(scope.row)"></el-input>
<el-input placeholder="单位" v-model="scope.row.unit" ></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"
@change="changeOtherData(scope.row)"></el-input>
></el-input>
</template>
</el-table-column>
<el-table-column prop="miniRange" label="最小范围" align="center">
<template #default="scope">
<el-input placeholder="最小范围" v-model="scope.row.miniRange"
@change="changeOtherData(scope.row)"></el-input>
></el-input>
</template>
</el-table-column>
<el-table-column prop="maxRange" label="最大范围" align="center">
<template #default="scope">
<el-input placeholder="最大范围" v-model="scope.row.maxRange"
@change="changeOtherData(scope.row)"></el-input>
></el-input>
</template>
</el-table-column>
<!-- <el-table-column prop="serialNumber" label="序列号" align="center" width="500">-->
<!-- <template #default="scope">-->
<!-- <el-select placeholder="请选择" v-model="scope.row.serialNumber" popper-class="serialNumber-select"-->
<!-- @change="changeOtherData(scope.row)" clearable class="serialNumber">-->
<!-- <el-option-->
<!-- v-for="item in scope.row.serialNumberOption"-->
<!-- :key="item.value"-->
<!-- :label="item.label"-->
<!-- :value="item.value"-->
<!-- />-->
<!-- </el-select>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column prop="state" label="状态" align="center">
<el-table-column prop="serialNumber" label="序列号" align="center" width="500">
<template #default="scope">
<el-select placeholder="请选择" v-model="scope.row.serialNumber" popper-class="serialNumber-select"
clearable class="serialNumber">
<el-option
v-for="item in otherSensorSerialNumberOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</template>
</el-table-column>
<el-table-column prop="state" label="状态" align="center" width="200">
<template #default="scope">
<div class="switch wind-switch">
<div
:class="{ active: scope.row.state }"
@click=" scope.row.state = 1;changeOtherData(scope.row)"
@click=" scope.row.state = 1; "
>
启用
</div>
<div
:class="{ active: ! scope.row.state }"
@click=" scope.row.state = 0;changeOtherData(scope.row)"
@click=" scope.row.state = 0; "
>
停用
</div>
@@ -311,7 +314,7 @@
@change="changeFenData(scope.row)"></el-input>
</template>
</el-table-column>
<el-table-column prop="state" label="状态" align="center">
<el-table-column prop="state" label="状态" align="center" width="200">
<template #default="scope">
<div class="switch">
<div
@@ -347,7 +350,7 @@
<script setup>
import {ElLoading, ElMessage} from "element-plus";
import {getEquipmentList, editEquipment, getTunnelDetail, getEquipmentSerialNumberOptions} from "@/api/tunnelManage";
import {getEquipmentList, editEquipment, getTunnelDetail,getOtherSensorSerialNumberOptions, getWindPressureSerialNumberOptions} from "@/api/tunnelManage";
import TunnelTitle from "@/components/tunnelTitle/index.vue";
import {debounce} from 'lodash'
@@ -360,66 +363,49 @@ const windFrequency = ref(0)
const otherFrequency = ref(0)
const changeIndex = ref(1)
const fanData = ref([])
const editFanData = ref([])
const winData = ref([])
const editWinData = ref([])
const windPressureDataSerialNumberOptions = ref([])
const otherSensorSerialNumberOptions = ref([])
const otherData = ref([])
const editOtherData = ref([])
const winDataSelectedOption = ref([])
const fenLiuData = ref([])
const editFenLiuData = ref([])
const frequencyData = ref([])
const serialNumberOptions = ref([])
const siteId = ref(0)
const tunnelName = ref('')
const getSerialNumberOptions =async (equipmentId) => {
console.log('tunnelId',tunnelId)
let {data,code,msg}=await getEquipmentSerialNumberOptions(tunnelId,equipmentId)
const getWindPressureOptions =async () => {
let {data,code,msg}=await getWindPressureSerialNumberOptions(tunnelId)
if(code===1000){
return data
// windPressureDataSerialNumberOptions.value= data
return data
}else{
ElMessage.error(msg)
}
// getEquipmentSerialNumberOptions(tunnelId,equipmentId).then(res => {
// if (res.code === 1000) {
// serialNumberOptions.value = res.data
// } else {
// ElMessage.error(res.msg)
// }
// })
}
// getSerialNumberOptions()
const changeFan = (e) => {
// const fanObj = {
// acquisitionPeriod: e * 1000,
// tunnelId: tunnelId,
// typeKey: 'frequency'
// }
// frequencyData.value.push(fanObj)
const getOtherSensorOptions =async () => {
let {data,code,msg}=await getOtherSensorSerialNumberOptions(tunnelId)
if(code===1000){
otherSensorSerialNumberOptions.value= data
}else{
ElMessage.error(msg)
}
}
const changeFanData = (row) => {
// editFanData.value.push(row)
getOtherSensorOptions()
const clearWinDataSelectedOption=()=>{
winDataSelectedOption.value=[]
}
const changeWind = (e) => {
// const windObj = {
// acquisitionPeriod: e * 1000,
// tunnelId: tunnelId,
// typeKey: 'windPressure'
// }
// frequencyData.value.push(windObj)
const changeWindDataSerialNumber = (value,options) => {
options?.forEach(item=>{
if(item.value==value){
if(item.label.indexOf('4G')>=0){
winDataSelectedOption.value.push(value)
}else{
winDataSelectedOption.value=[]
}
}
})
}
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 serialNumberOptionDisabled=(item)=>{
return winDataSelectedOption.value.indexOf(item.value) >= 0;
}
const changeData = (item) => {
return {
@@ -433,6 +419,12 @@ const changeData = (item) => {
}
}
const editEquip = debounce(() => {
const loading = ElLoading.service({
lock: true,
text: '修改中...',
background: 'rgba(0, 0, 0, 0.7)',
customClass: 'allLoading'
})
let newFrequency = [{
acquisitionPeriod: fanFrequency.value * 1000,
tunnelId: parseInt(tunnelId),
@@ -478,10 +470,13 @@ const editEquip = debounce(() => {
console.info("🚀 ~ file:index method: line:478 -----",basicData)
editEquipment(basicData).then(res => {
if (res.code === 1000) {
loading.close()
ElMessage.success('修改成功')
router.push('/tunnel/' + siteId.value + '/' + type + '/' + userId)
} else {
ElMessage.error(res.msg)
loading.close()
}
})
}, 100)
@@ -490,7 +485,8 @@ const handleChangeMenu = (e) => {
changeIndex.value = e
}
const getList =async () => {
const getList = async () => {
const windPressureOption=await getWindPressureOptions()
const loading = ElLoading.service({
lock: true,
text: '正在加载系统资源...',
@@ -500,23 +496,21 @@ const getList =async () => {
await getEquipmentList(tunnelId).then( res => {
if (res.code === 1000) {
fanData.value = res.data.frequencyChangerList
fanData.value?.forEach( async item => {
item.serialNumberOption =await getSerialNumberOptions(item.equipmentId)
})
res.data.windPressureSensorList?.forEach(item => {
item.offset = item.offset + 4000
})
winData.value = res.data.windPressureSensorList
winData.value?.forEach( async item => {
item.serialNumberOption =await getSerialNumberOptions(item.equipmentId)
winData.value?.forEach(item => {
for (const equipmentId in windPressureOption) {
if(item.equipmentId == equipmentId){
item.serialNumberOption =windPressureOption[equipmentId]
}
}
})
res.data.sensorList?.forEach(item => {
item.offset = item.offset + 4000
})
otherData.value = res.data.sensorList
otherData.value?.forEach( async item => {
item.serialNumberOption =await getSerialNumberOptions(item.equipmentId)
})
res.data.acquisitionList.map(item => {
item.acquisitionPeriod = item.acquisitionPeriod / 1000
if (item.typeKey === 'frequency') {
@@ -545,7 +539,7 @@ getList()
<style lang="scss">
.serialNumber{
.el-input{
width: 466px!important;
width: 580px!important;
}
.el-input__suffix-inner{
.el-icon{
@@ -585,7 +579,7 @@ getList()
background: #064B66 !important;
border: 2px solid #05FEFF !important;
.el-select-dropdown {
.el-select-dropdown {
min-width: 130px !important;
}
.el-select-dropdown__item.is-hovering{
@@ -599,12 +593,19 @@ getList()
border-bottom: none;
}
}
.el-select-dropdown__item.selected {
background-color: transparent !important;
color: #F7B500;
}
.el-select-dropdown__item.hover,
.el-select-dropdown__item:hover {
background-color: transparent !important;
color: #F7B500;
}
.el-select-dropdown__item.is-disabled{
background-color: transparent !important;
color: #fff!important;
}
}
</style>
<style scoped lang="scss">
@@ -657,7 +658,7 @@ getList()
.device-box {
display: flex;
width: 3200px;
width: 3500px;
height: 1600px;
background: #064B66;
border-radius: 20px;
@@ -779,7 +780,7 @@ getList()
}
.wind-switch {
margin-left: 26px;
//margin-left: 26px;
}
.switch {