节点:保存调整

单风机:实时预览故障代码枚举替换
This commit is contained in:
高云鹏 2024-12-03 16:11:27 +08:00
parent 7ef5d8011b
commit 8ba368f194
3 changed files with 59 additions and 20 deletions

View File

@ -330,6 +330,7 @@ import { dayjs, ElMessage, ElMessageBox } from 'element-plus'
import { getRealTimeState, getCutDecimalsValue } from '/@/views/backend/equipment/airBlower/utils'
import { sendCommandReq, sendManualCommandReq } from '/@/api/backend/control/request'
import { getAlarmListReq } from '/@/api/backend/alarms/request'
import { queryfaultCodeDict } from '/@/api/backend/theoreticalpowerCurve/request'
import { useEnumStore } from '/@/stores/enums'
const enumStore = useEnumStore()
@ -1037,6 +1038,9 @@ const createRealTimeData = async () => {
if (enumStore.keys.includes(item.attributeCode)) {
val = enumStore.data[item.attributeCode][val]
}
if (malFunctionKeys.includes(item.attributeCode)) {
val = malFunctionEnums?.[item.attributeCode] ?? val
}
if (sigleDataKeys.includes(item.attributeCode.toLowerCase())) {
realTimeDataForSingle.value[item.attributeCode.toLowerCase()] = val === '-' ? val : val
}
@ -1351,6 +1355,34 @@ const getAlarmList = () => {
}
})
}
const malFunctionKeys = [
'ActiveStatusCode01',
'ActiveStatusCode02',
'ActiveStatusCode03',
'ActiveStatusCode04',
'ActiveStatusCode05',
'ActiveStatusCode06',
'ActiveStatusCode07',
'ActiveStatusCode08',
'FirstTriggeredCode',
]
const malFunctionEnums: any = {}
const getMalfunctionEnums = () => {
const curWindBlower = airBlowerList.value.find((item) => item.irn === route.query.irn)
console.log(curWindBlower)
queryfaultCodeDict({ madeinfactory: curWindBlower!.madeinfactory, model: curWindBlower!.model }).then((res) => {
if (res.code == 200) {
const data: any = {}
res.data.forEach((item: any) => {
data[item.code] = item.description
})
}
})
}
const airBlowerList = ref<
{
irn: string
@ -1358,11 +1390,12 @@ const airBlowerList = ref<
name: string
deviceCode: string
iotModelId: string
madeinfactory: string
}[]
>([])
const getAirBlowerList = () => {
getAirBlowerListReq().then((res) => {
return getAirBlowerListReq().then((res) => {
if (res.success) {
airBlowerList.value = res.data.map((item) => {
return {
@ -1371,8 +1404,10 @@ const getAirBlowerList = () => {
name: item.name,
deviceCode: item.deviceCode,
iotModelId: item.modelId,
madeinfactory: item.madeinfactory,
}
})
return
}
})
}
@ -1413,7 +1448,9 @@ onMounted(() => {
useEventListener(window, 'resize', echartsResize)
autoUpdate()
getAlarmList()
getAirBlowerList()
getAirBlowerList().then(() => {
getMalfunctionEnums()
})
})
onUnmounted(() => {

View File

@ -1,16 +1,18 @@
<template>
<div class="overviewWrap">
<div class="dialogContent">
<div class="PitchPart">
<el-row>
<el-col :span="12" v-for="item in showData" :key="item.name">
<div class="Pitchitem">
<span class="PitchitemLeft">{{ item.name }}</span>
<span class="PitchitemRight">{{ item.value }}</span>
</div>
</el-col>
</el-row>
</div>
<el-scrollbar>
<div class="PitchPart">
<el-row>
<el-col :span="12" v-for="item in showData" :key="item.name">
<div class="Pitchitem">
<span class="PitchitemLeft">{{ item.name }}</span>
<span class="PitchitemRight">{{ item.value }}</span>
</div>
</el-col>
</el-row>
</div>
</el-scrollbar>
</div>
<div class="footer">
<el-pagination
@ -71,15 +73,13 @@ onMounted(() => {
<style scoped lang="scss">
.dialogContent {
width: 100%;
max-height: 540px;
overflow-x: hidden;
overflow-y: auto;
height: 540px;
.PitchPart {
.Pitchitem {
border: 1px solid #e1edf6;
display: flex;
justify-content: space-between;
margin-left: 15px;
// margin-left: 15px;
width: 100%;
height: 100%;
.PitchitemLeft {

View File

@ -603,6 +603,8 @@ export const createUpLoadExcelData = (workbookData: any) => {
}
sheetData.params = JSON.stringify(params)
data.push(sheetData)
console.log(data);
}
})
})
@ -622,10 +624,10 @@ export const createSheetData = (data: any, protocol: string | number) => {
const result: any = {}
data[item].forEach((obj: any, index: number) => {
const params = obj.params && obj.params !== '' ? JSON.parse(obj.params) : {}
obj = { ...obj, ...params }
const newObj = { ...obj, ...params }
const row = index + 1
result[row] = {}
Object.keys(obj).forEach((field) => {
Object.keys(newObj).forEach((field) => {
const col = excelCellDataMap[field]
if (col) {
let custom: any
@ -633,9 +635,9 @@ export const createSheetData = (data: any, protocol: string | number) => {
custom = {}
custom.type = item
custom.protocol = Number(protocol)
custom.otherData = params
custom.otherData = obj
}
result[row][col] = { v: obj[field], s: '1', custom }
result[row][col] = { v: newObj[field], s: '1', custom }
}
})
})