节点:保存调整

单风机:实时预览故障代码枚举替换
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 { getRealTimeState, getCutDecimalsValue } from '/@/views/backend/equipment/airBlower/utils'
import { sendCommandReq, sendManualCommandReq } from '/@/api/backend/control/request' import { sendCommandReq, sendManualCommandReq } from '/@/api/backend/control/request'
import { getAlarmListReq } from '/@/api/backend/alarms/request' import { getAlarmListReq } from '/@/api/backend/alarms/request'
import { queryfaultCodeDict } from '/@/api/backend/theoreticalpowerCurve/request'
import { useEnumStore } from '/@/stores/enums' import { useEnumStore } from '/@/stores/enums'
const enumStore = useEnumStore() const enumStore = useEnumStore()
@ -1037,6 +1038,9 @@ const createRealTimeData = async () => {
if (enumStore.keys.includes(item.attributeCode)) { if (enumStore.keys.includes(item.attributeCode)) {
val = enumStore.data[item.attributeCode][val] val = enumStore.data[item.attributeCode][val]
} }
if (malFunctionKeys.includes(item.attributeCode)) {
val = malFunctionEnums?.[item.attributeCode] ?? val
}
if (sigleDataKeys.includes(item.attributeCode.toLowerCase())) { if (sigleDataKeys.includes(item.attributeCode.toLowerCase())) {
realTimeDataForSingle.value[item.attributeCode.toLowerCase()] = val === '-' ? val : val 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< const airBlowerList = ref<
{ {
irn: string irn: string
@ -1358,11 +1390,12 @@ const airBlowerList = ref<
name: string name: string
deviceCode: string deviceCode: string
iotModelId: string iotModelId: string
madeinfactory: string
}[] }[]
>([]) >([])
const getAirBlowerList = () => { const getAirBlowerList = () => {
getAirBlowerListReq().then((res) => { return getAirBlowerListReq().then((res) => {
if (res.success) { if (res.success) {
airBlowerList.value = res.data.map((item) => { airBlowerList.value = res.data.map((item) => {
return { return {
@ -1371,8 +1404,10 @@ const getAirBlowerList = () => {
name: item.name, name: item.name,
deviceCode: item.deviceCode, deviceCode: item.deviceCode,
iotModelId: item.modelId, iotModelId: item.modelId,
madeinfactory: item.madeinfactory,
} }
}) })
return
} }
}) })
} }
@ -1413,7 +1448,9 @@ onMounted(() => {
useEventListener(window, 'resize', echartsResize) useEventListener(window, 'resize', echartsResize)
autoUpdate() autoUpdate()
getAlarmList() getAlarmList()
getAirBlowerList() getAirBlowerList().then(() => {
getMalfunctionEnums()
})
}) })
onUnmounted(() => { onUnmounted(() => {

View File

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

View File

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