新增首触故障码搜索
This commit is contained in:
parent
b167bfc36e
commit
464a74cd5c
@ -1,6 +1,7 @@
|
||||
export default {
|
||||
select: '请选择',
|
||||
selectDate: '选择日期时间',
|
||||
firstTriggeredCode: '首触故障码',
|
||||
type: '类别',
|
||||
alarmTime: '告警时间',
|
||||
}
|
||||
|
@ -22,10 +22,22 @@
|
||||
:placeholder="t('alarm.select') + t('airBlower.airBlowerNumber')"
|
||||
class="alarmSelect"
|
||||
clearable
|
||||
@change="handleairBlowerChange"
|
||||
>
|
||||
<el-option v-for="v in airBlowerList" :key="v.value" :label="v.label" :value="v.value"></el-option>
|
||||
</el-select>
|
||||
<div style="width: 20px"></div>
|
||||
<div style="width: fit-content; white-space: nowrap">{{ t('alarm.firstTriggeredCode') }}</div>
|
||||
<el-select
|
||||
v-model="firstTriggeredCode"
|
||||
:placeholder="t('alarm.select') + t('alarm.firstTriggeredCode')"
|
||||
class="alarmSelect firstTriggeredCodeSelect"
|
||||
clearable
|
||||
filterable
|
||||
>
|
||||
<el-option v-for="v in firstTriggeredCodes" :key="v.code" :label="v.description" :value="v.code"></el-option>
|
||||
</el-select>
|
||||
<div style="width: 20px"></div>
|
||||
<div style="width: fit-content; min-width: 30px">{{ t('alarm.type') }}</div>
|
||||
<el-select v-model="alarmTypeValue" :placeholder="t('alarm.select') + t('alarm.type')" class="alarmSelect" clearable>
|
||||
<el-option v-for="v in alarmTypes" :key="v.value" :label="v.label" :value="v.value"></el-option>
|
||||
@ -156,7 +168,7 @@ const getFormattedDate = (offset: number) => {
|
||||
|
||||
// 风机编号
|
||||
const airBlowerNumberValue = ref('')
|
||||
const airBlowerList = ref([{ label: '', value: '' }])
|
||||
const airBlowerList = ref([{ label: '', value: '', model: '', madeinFactory: '' }])
|
||||
// 类别
|
||||
const alarmTypeValue = ref(2)
|
||||
const alarmTypes = ref([
|
||||
@ -164,6 +176,8 @@ const alarmTypes = ref([
|
||||
{ label: '告警', value: 1 },
|
||||
{ label: '提示', value: 0 },
|
||||
])
|
||||
const firstTriggeredCode = ref('')
|
||||
const firstTriggeredCodes: any = ref([])
|
||||
const isLoading = ref(false)
|
||||
const searchOperate = () => {
|
||||
isLoading.value = true
|
||||
@ -189,6 +203,7 @@ const searchalarms = (): GetAlarmsTableParam => {
|
||||
deviceCode: deviceCode,
|
||||
pageNum: paginationOptions.current,
|
||||
pageSize: paginationOptions.pageSize,
|
||||
firstTriggeredCode: firstTriggeredCode.value,
|
||||
}
|
||||
}
|
||||
|
||||
@ -207,13 +222,12 @@ const getcurrentPage = () => {
|
||||
|
||||
const getalarmsList = async () => {
|
||||
const transparams = searchalarms()
|
||||
console.log('🚀 ~ getalarmsList ~ transparams:', transparams)
|
||||
getAlarmListReq(transparams).then((res: any) => {
|
||||
getAlarmListReq(transparams)
|
||||
.then((res: any) => {
|
||||
isLoading.value = false
|
||||
if (res.code == 200) {
|
||||
paginationOptions.total = res.total
|
||||
alarmsTableData.value = res.rows.map((item: any) => {
|
||||
console.log('🚀 ~ alarmsTableData.value=res.rows.map ~ item:', item)
|
||||
const descriptions = descriptionMap.value[`${item.madeinFactory}_${item.model}`] || {}
|
||||
return {
|
||||
...item,
|
||||
@ -225,10 +239,10 @@ const getalarmsList = async () => {
|
||||
ElMessage.error(res.msg ?? '查询失败')
|
||||
}
|
||||
})
|
||||
// .catch((err) => {
|
||||
// isLoading.value = false
|
||||
// ElMessage.error(err ?? '查询失败')
|
||||
// })
|
||||
.catch((err) => {
|
||||
isLoading.value = false
|
||||
ElMessage.error(err ?? '查询失败')
|
||||
})
|
||||
}
|
||||
|
||||
const descriptionMap = computed(() => {
|
||||
@ -239,8 +253,6 @@ const descriptionMap = computed(() => {
|
||||
return acc
|
||||
}, {})
|
||||
})
|
||||
console.log('🚀 ~ map[item.key]=item.value.reduce ~ map:', map)
|
||||
|
||||
return map
|
||||
})
|
||||
|
||||
@ -322,54 +334,64 @@ const getDateRange = (type: 'week' | 'month') => {
|
||||
}
|
||||
}
|
||||
|
||||
const handleairBlowerChange = (value: any) => {
|
||||
if (value) {
|
||||
const selectObj: any = airBlowerList.value.find((item) => {
|
||||
return item.value == value
|
||||
})
|
||||
firstTriggeredCode.value = ''
|
||||
firstTriggeredCodes.value = faultCodeMap[`${selectObj.madeinFactory}_${selectObj.model}`]
|
||||
} else {
|
||||
firstTriggeredCode.value = ''
|
||||
firstTriggeredCodes.value = faultCodeMap[`${airBlowerList.value[0].madeinFactory}_${airBlowerList.value[0].model}`]
|
||||
}
|
||||
}
|
||||
|
||||
const faultCodeMap: any = {}
|
||||
onMounted(() => {
|
||||
equipList({
|
||||
// orgId: adminInfo.orgid,
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
const res = await equipList({
|
||||
objectType: 10002,
|
||||
}).then((res) => {
|
||||
})
|
||||
if (res.code == 200) {
|
||||
airBlowerList.value = res.data.map((item: any) => {
|
||||
return {
|
||||
label: item.name,
|
||||
value: item.code,
|
||||
}
|
||||
})
|
||||
getalarmsList()
|
||||
madeinFactory: item.madeinFactory,
|
||||
model: item.model,
|
||||
}
|
||||
})
|
||||
|
||||
theoreticalpowerCurveList()
|
||||
.then((res: any) => {
|
||||
if (res.code == 200) {
|
||||
paginationOptions.total = res.total
|
||||
res.rows.forEach((item: any, index: number) => {
|
||||
getfaultCodeDict(item)
|
||||
})
|
||||
const theoreticalRes = await theoreticalpowerCurveList()
|
||||
if (theoreticalRes.code == 200) {
|
||||
await getfaultCodeDict(theoreticalRes.rows)
|
||||
firstTriggeredCodes.value = faultCodeMap[`${airBlowerList.value[0].madeinFactory}_${airBlowerList.value[0].model}`]
|
||||
console.log(firstTriggeredCodes.value)
|
||||
} else {
|
||||
ElMessage.error(res.msg ?? '查询失败')
|
||||
ElMessage.error(theoreticalRes.msg ?? '查询失败')
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
ElMessage.error(err ?? '查询失败')
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
ElMessage.error(err?.response?.data?.msg ?? '查询失败')
|
||||
})
|
||||
})
|
||||
|
||||
const getfaultCodeDict = (data: any) => {
|
||||
queryfaultCodeDict({ madeinfactory: data.madeinfactory, model: data.model }).then((res: any) => {
|
||||
const getfaultCodeDict = async (data: any) => {
|
||||
const promises = data.map(async (item: any) => {
|
||||
const res = await queryfaultCodeDict({ madeinfactory: item.madeinfactory, model: item.model })
|
||||
if (res.code == 200) {
|
||||
const deflautList: any = []
|
||||
res.data.forEach((item: any) => {
|
||||
deflautList.push({
|
||||
code: item.code,
|
||||
description: item.description,
|
||||
})
|
||||
})
|
||||
faultCodeMap[`${data.madeinfactory}_${data.model}`] = deflautList
|
||||
const deflautList = res.data.map((faultItem: any) => ({
|
||||
code: faultItem.code,
|
||||
description: faultItem.description,
|
||||
}))
|
||||
faultCodeMap[`${item.madeinfactory}_${item.model}`] = deflautList
|
||||
} else {
|
||||
ElMessage.warning('查询失败')
|
||||
}
|
||||
})
|
||||
await Promise.all(promises)
|
||||
}
|
||||
|
||||
const openDefalt = (row: any) => {
|
||||
@ -414,11 +436,14 @@ $paginationHeight: 32px;
|
||||
align-items: center;
|
||||
// width: 320px;
|
||||
.alarmSelect {
|
||||
width: 200px;
|
||||
width: 150px;
|
||||
:deep(.el-select__wrapper) {
|
||||
height: 40px;
|
||||
}
|
||||
}
|
||||
.firstTriggeredCodeSelect {
|
||||
width: 220px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.mainMain {
|
||||
|
@ -26,6 +26,7 @@ export type GetAlarmsTableParam = {
|
||||
eventLevel?: string | number | null
|
||||
pageNum?: Number
|
||||
pageSize?: Number
|
||||
firstTriggeredCode: string | number | null
|
||||
}
|
||||
|
||||
export enum AlarmsFieldsEnums {
|
||||
|
@ -8,7 +8,7 @@
|
||||
v-model="windBlowerValue"
|
||||
@change="selectWindBlower"
|
||||
:placeholder="'请选择' + t('statAnalysis.deviceId')"
|
||||
class="windBlowerSelect commonSelect"
|
||||
class="commonSelect"
|
||||
>
|
||||
<el-option v-for="v in windBlowerList" :key="v.irn" :label="v.name" :value="v.irn"></el-option>
|
||||
</el-select>
|
||||
@ -29,11 +29,16 @@
|
||||
<el-select v-model="interval" :placeholder="'请选择' + t('statAnalysis.interval')" class="commonSelect">
|
||||
<el-option v-for="v in intervals" :key="v.value" :label="v.label" :value="v.value"></el-option>
|
||||
</el-select>
|
||||
<div style="width: 20px"></div>
|
||||
<div style="min-width: 30px">{{ t('statAnalysis.calFunction') }}</div>
|
||||
<el-select v-model="calFunction" :placeholder="'请选择' + t('statAnalysis.calFunction')" class="commonSelect">
|
||||
<el-option v-for="v in calFunctions" :key="v.value" :label="v.label" :value="v.value"></el-option>
|
||||
</el-select>
|
||||
</el-space>
|
||||
<div>
|
||||
<el-space style="margin-top: 10px">
|
||||
<div style="min-width: 30px">模板</div>
|
||||
<el-select v-model="template" placeholder="请选择模板" class="commonSelect" @change="changeTemplate">
|
||||
<el-select v-model="template" placeholder="请选择模板" class="templateSelect commonSelect" @change="changeTemplate">
|
||||
<el-option v-for="v in reportTemplateList" :key="v.value" :label="v.label" :value="v.value">
|
||||
<template #default>
|
||||
<div class="tamplateOption">
|
||||
@ -131,6 +136,7 @@ import { WindBlowerList, RequestData, Devices } from './type'
|
||||
import {
|
||||
queryWindTurbinesPages,
|
||||
historyReq,
|
||||
windowReq,
|
||||
getReportTemplateListReq,
|
||||
addReportTemplateListReq,
|
||||
delReportTemplateListReq,
|
||||
@ -212,6 +218,13 @@ const intervals = [
|
||||
{ label: '一天', value: '1d' },
|
||||
{ label: '原始', value: 'NONE' },
|
||||
]
|
||||
const calFunction = ref('interpolation')
|
||||
const calFunctions = [
|
||||
{ label: '瞬时值', value: 'interpolation' },
|
||||
{ label: '平均值', value: 'average' },
|
||||
{ label: '最大值', value: 'max' },
|
||||
{ label: '最小值', value: 'min' },
|
||||
]
|
||||
// 模板
|
||||
const template = ref('')
|
||||
const reportTemplateList = ref<{ label: string; value: string; columns: any[]; interval: string }[]>([])
|
||||
@ -441,9 +454,28 @@ const queryHistoryData = () => {
|
||||
interval: interval.value,
|
||||
startTime: new Date(timeRange.value[0]).getTime(),
|
||||
endTime: new Date(timeRange.value[1]).getTime(),
|
||||
} as any
|
||||
calFunction: calFunction.value,
|
||||
} as anyObj
|
||||
if (calFunction.value == 'interpolation') {
|
||||
historyReq(requestData)
|
||||
.then((res) => {
|
||||
handleRes(res, attributeCodes)
|
||||
})
|
||||
.finally(() => {
|
||||
reportLoading.value = false
|
||||
})
|
||||
} else {
|
||||
windowReq(requestData)
|
||||
.then((res) => {
|
||||
handleRes(res, attributeCodes)
|
||||
})
|
||||
.finally(() => {
|
||||
reportLoading.value = false
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const handleRes = (res: any, attributeCodes: any) => {
|
||||
if (res.code == 200) {
|
||||
const result = res.data
|
||||
if (Object.keys(result)?.length) {
|
||||
@ -486,10 +518,6 @@ const queryHistoryData = () => {
|
||||
reportLoading.value = false
|
||||
ElMessage.warning('查询失败')
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
reportLoading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
// 时间转换
|
||||
@ -560,11 +588,14 @@ onMounted(() => {
|
||||
}
|
||||
|
||||
.commonSelect {
|
||||
min-width: 250px;
|
||||
min-width: 150px;
|
||||
:deep(.el-select__wrapper) {
|
||||
height: 40px;
|
||||
}
|
||||
}
|
||||
.templateSelect {
|
||||
min-width: 223px;
|
||||
}
|
||||
|
||||
.button {
|
||||
height: 40px;
|
||||
|
@ -269,7 +269,7 @@ const statAnalysisSelectOptions: any = reactive({
|
||||
{ label: '原始', value: 'NONE' },
|
||||
],
|
||||
calFunction: [
|
||||
{ label: '插值', value: 'interpolation' },
|
||||
{ label: '瞬时值', value: 'interpolation' },
|
||||
{ label: '平均值', value: 'average' },
|
||||
{ label: '最大值', value: 'max' },
|
||||
{ label: '最小值', value: 'min' },
|
||||
|
@ -162,7 +162,7 @@ const statAnalysisSelectOptions: any = reactive({
|
||||
{ label: '原始', value: 'NONE' },
|
||||
],
|
||||
calFunction: [
|
||||
{ label: '插值', value: 'interpolation' },
|
||||
{ label: '瞬时值', value: 'interpolation' },
|
||||
{ label: '平均值', value: 'average' },
|
||||
{ label: '最大值', value: 'max' },
|
||||
{ label: '最小值', value: 'min' },
|
||||
|
Loading…
Reference in New Issue
Block a user