单风机:故障枚举

量测:故障枚举
This commit is contained in:
高云鹏 2024-12-05 16:41:33 +08:00
parent 6229b1b4c7
commit fe312b8d06
4 changed files with 49 additions and 21 deletions

View File

@ -327,7 +327,7 @@ import { useRoute, useRouter } from 'vue-router'
import Overview from './overview.vue' import Overview from './overview.vue'
import { TableInstance } from 'element-plus' import { TableInstance } from 'element-plus'
import { dayjs, ElMessage, ElMessageBox } from 'element-plus' import { dayjs, ElMessage, ElMessageBox } from 'element-plus'
import { getRealTimeState, getCutDecimalsValue } from '/@/views/backend/equipment/airBlower/utils' import { getRealTimeState, getCutDecimalsValue, malFunctionKeys } 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 { queryfaultCodeDict } from '/@/api/backend/theoreticalpowerCurve/request'
@ -1037,7 +1037,7 @@ const createRealTimeData = async () => {
val = enumStore.data[item.attributeCode][val] val = enumStore.data[item.attributeCode][val]
} }
if (malFunctionKeys.includes(item.attributeCode)) { if (malFunctionKeys.includes(item.attributeCode)) {
val = malFunctionEnums?.[item.attributeCode] ?? val val = malFunctionEnums?.[val] ?? 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
@ -1345,29 +1345,16 @@ const getAlarmList = () => {
}) })
} }
const malFunctionKeys = [ let malFunctionEnums: any = {}
'ActiveStatusCode01',
'ActiveStatusCode02',
'ActiveStatusCode03',
'ActiveStatusCode04',
'ActiveStatusCode05',
'ActiveStatusCode06',
'ActiveStatusCode07',
'ActiveStatusCode08',
'FirstTriggeredCode',
]
const malFunctionEnums: any = {}
const getMalfunctionEnums = () => { const getMalfunctionEnums = () => {
const curWindBlower = airBlowerList.value.find((item) => item.irn === route.query.irn) const curWindBlower = airBlowerList.value.find((item) => item.irn === route.query.irn)
console.log(curWindBlower)
queryfaultCodeDict({ madeinfactory: curWindBlower!.madeinfactory, model: curWindBlower!.model }).then((res) => { queryfaultCodeDict({ madeinfactory: curWindBlower!.madeinfactory, model: curWindBlower!.model }).then((res) => {
if (res.code == 200) { if (res.code == 200) {
const data: any = {} const data: any = {}
res.data.forEach((item: any) => { res.data.forEach((item: any) => {
data[item.code] = item.description data[item.code] = item.description
}) })
malFunctionEnums = data
} }
}) })
} }

View File

@ -36,3 +36,15 @@ export const getEnumToValue = (key: string, value: any) => {
return value return value
} }
} }
export const malFunctionKeys = [
'ActiveStatusCode01',
'ActiveStatusCode02',
'ActiveStatusCode03',
'ActiveStatusCode04',
'ActiveStatusCode05',
'ActiveStatusCode06',
'ActiveStatusCode07',
'ActiveStatusCode08',
'FirstTriggeredCode',
]

View File

@ -487,6 +487,8 @@
:iotModelId="measureData.iotModelId" :iotModelId="measureData.iotModelId"
:autoUpdate="measureData.autoUpdate" :autoUpdate="measureData.autoUpdate"
:attributeType="measureData.measureType" :attributeType="measureData.measureType"
:madein-factory="measureData.madeinFactory"
:model="measureData.model"
></MeasurementPage> ></MeasurementPage>
</div> </div>
</el-dialog> </el-dialog>
@ -765,8 +767,6 @@ const modelList = ref<{ model: string; madeinFactory: string }[]>([])
const getModelList = () => { const getModelList = () => {
theoreticalpowerCurveList().then((res) => { theoreticalpowerCurveList().then((res) => {
if (res.rows) { if (res.rows) {
console.log(res)
modelList.value = (res.rows as any[]).map((item: any) => { modelList.value = (res.rows as any[]).map((item: any) => {
return { return {
model: item.model, model: item.model,
@ -1060,16 +1060,22 @@ const measureData = reactive<{
iotModelId: string iotModelId: string
autoUpdate: boolean autoUpdate: boolean
measureType: ModelAttributeType measureType: ModelAttributeType
madeinFactory:string
model:string
}>({ }>({
deviceId: '', deviceId: '',
iotModelId: '', iotModelId: '',
autoUpdate: false, autoUpdate: false,
measureType: 138, measureType: 138,
madeinFactory:'',
model:''
}) })
const showMeasure = ref(false) const showMeasure = ref(false)
const openMeasure = (data: any) => { const openMeasure = (data: any) => {
measureData.deviceId = data.row.id measureData.deviceId = data.row.id
measureData.iotModelId = data.row.iotModelId measureData.iotModelId = data.row.iotModelId
measureData.madeinFactory = data.row.madeinFactory
measureData.model = data.row.model
if (measureData.iotModelId) { if (measureData.iotModelId) {
showMeasure.value = true showMeasure.value = true
} else { } else {

View File

@ -89,16 +89,21 @@ import { getModelAttributeListReq, getRealValueListReq } from '/@/api/backend/de
import * as echarts from 'echarts' import * as echarts from 'echarts'
import { getRealValueRangeReq } from '/@/api/backend/deviceModel/request' import { getRealValueRangeReq } from '/@/api/backend/deviceModel/request'
import { useEnumStore } from '/@/stores/enums' import { useEnumStore } from '/@/stores/enums'
import { queryfaultCodeDict } from '/@/api/backend/theoreticalpowerCurve/request'
import { malFunctionKeys} from '/@/views/backend/equipment/airBlower/utils'
const enumStore = useEnumStore() const enumStore = useEnumStore()
const props = withDefaults( const props = withDefaults(
defineProps<{ iotModelId: string; deviceId: string; show: boolean; autoUpdate: boolean; attributeType: ModelAttributeType }>(), defineProps<{ iotModelId: string; deviceId: string; show: boolean; autoUpdate: boolean; attributeType: ModelAttributeType;model:string;madeinFactory:string }>(),
{ {
iotModelId: '', iotModelId: '',
deviceId: '', deviceId: '',
show: false, show: false,
autoUpdate: false, autoUpdate: false,
attributeType: 138, attributeType: 138,
model:'',
madeinFactory:''
} }
) )
@ -204,6 +209,20 @@ const getRealValueList = (data: { deviceId: string; attributes: string[] }, list
}) })
} }
let malFunctionEnums: any = {}
const getMalfunctionEnums = () => {
queryfaultCodeDict({ madeinfactory: props.madeinFactory, model: props.model }).then((res) => {
if (res.code == 200) {
const data: any = {}
res.data.forEach((item: any) => {
data[item.code] = item.description
})
malFunctionEnums = data
}
})
}
const getCompleteData = () => { const getCompleteData = () => {
getAttributeList() getAttributeList()
.then(({ data, codeList }: any) => { .then(({ data, codeList }: any) => {
@ -217,6 +236,9 @@ const getCompleteData = () => {
if (enumStore.keys.includes(item.attributeCode)) { if (enumStore.keys.includes(item.attributeCode)) {
realValItem = enumStore.data[item.attributeCode][realValItem] realValItem = enumStore.data[item.attributeCode][realValItem]
} }
if(malFunctionKeys.includes(item.attributeCode)){
realValItem = malFunctionEnums?.[realValItem] ?? realValItem
}
return { return {
...item, ...item,
realTimeValue: realValItem realTimeValue: realValItem
@ -505,6 +527,7 @@ watch(
(newVal) => { (newVal) => {
if (newVal) { if (newVal) {
getCompleteData() getCompleteData()
getMalfunctionEnums()
searchOptions.datePickerValue = shortcuts[0].value() searchOptions.datePickerValue = shortcuts[0].value()
} else { } else {
autoUpdateTimer.value && clearInterval(autoUpdateTimer.value) autoUpdateTimer.value && clearInterval(autoUpdateTimer.value)