故障码字典

This commit is contained in:
geting 2024-12-02 15:48:58 +08:00
parent 0bb6eb8a58
commit 1c02c50481
5 changed files with 192 additions and 32 deletions

View File

@ -136,3 +136,38 @@ export function queryplcDesc(params: object = {}) {
data: params, data: params,
}) })
} }
export const importfaultCodeDict = (data: FormData, v: string) => {
const token = encrypt_aes(adminInfo.token, v)
return createAxios(
{
url: '/api/fdr/faultCodeDict/import',
method: 'POST',
data: data,
headers: {
'Content-Type': 'multipart/form-data',
v,
token,
},
},
{ customEncrypt: true }
)
}
// 导出
export function exportfaultCodeDict(params: object = {}) {
return createAxios({
url: '/api/fdr/faultCodeDict/export',
method: 'POST',
data: params,
responseType: 'blob',
})
}
export function queryfaultCodeDict(params: object = {}) {
return createAxios({
url: '/api/fdr/faultCodeDict/query',
method: 'POST',
data: params,
})
}

View File

@ -67,6 +67,8 @@ import { queryWindTurbinesPages, historyReq, powerCurveExport } from '/@/api/bac
import { theoreticalpowerCurveList, powerCurveQuery } from '/@/api/backend/theoreticalpowerCurve/request' import { theoreticalpowerCurveList, powerCurveQuery } from '/@/api/backend/theoreticalpowerCurve/request'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import * as echarts from 'echarts' import * as echarts from 'echarts'
import { getCutDecimalsValue } from '/@/views/backend/equipment/airBlower/utils'
const { t } = useI18n() const { t } = useI18n()
const statAnalysisFatory = ref('') const statAnalysisFatory = ref('')
@ -327,11 +329,12 @@ const statAnalysisOperate = () => {
ElMessage.info(`实时值数据为空`) ElMessage.info(`实时值数据为空`)
} else { } else {
const seriesData = iGenPower.map((item: any, index: number) => { const seriesData = iGenPower.map((item: any, index: number) => {
return [iWindSpeed[index], item] return [getCutDecimalsValue(iWindSpeed[index], 2), getCutDecimalsValue(item, 2)]
}) })
seriesData.sort((a: any, b: any) => { seriesData.sort((a: any, b: any) => {
return a[0] - b[0] return a[0] - b[0]
}) })
const series = { const series = {
type: 'line', type: 'line',
data: seriesData, data: seriesData,
@ -345,7 +348,7 @@ const statAnalysisOperate = () => {
} }
if (resData1.length) { if (resData1.length) {
const seriesData = resData1.map((item: any) => { const seriesData = resData1.map((item: any) => {
return [item.speed, item.power] return [getCutDecimalsValue(item.speed, 2), getCutDecimalsValue(item.power, 2)]
}) })
const series = { const series = {
type: 'line', type: 'line',

View File

@ -104,6 +104,7 @@ import { ElMessage } from 'element-plus'
import { DArrowRight, Plus, Delete, Close } from '@element-plus/icons-vue' import { DArrowRight, Plus, Delete, Close } from '@element-plus/icons-vue'
import MeasurementPage from './analysisAttributes.vue' import MeasurementPage from './analysisAttributes.vue'
import { getModelAttributeListReq } from '/@/api/backend/deviceModel/request' import { getModelAttributeListReq } from '/@/api/backend/deviceModel/request'
import { getCutDecimalsValue } from '/@/views/backend/equipment/airBlower/utils'
import * as echarts from 'echarts' import * as echarts from 'echarts'
const { t } = useI18n() const { t } = useI18n()
@ -502,7 +503,7 @@ const historyDataReq = (promises: any) => {
.map((item: any) => { .map((item: any) => {
const matchData = xDatas.filter((x: any) => x.series == item.seriesName) const matchData = xDatas.filter((x: any) => x.series == item.seriesName)
const x = timestampToTime(matchData[0]['data'][item.dataIndex]) const x = timestampToTime(matchData[0]['data'][item.dataIndex])
return `${item.marker}${item.seriesName} (${x}): ${item.data}${statAnalysisSelect.unit}` return `${item.marker}${item.seriesName} (${x}): ${item.data.value}${statAnalysisSelect.unit}`
}) })
.join('<br/>') .join('<br/>')
}, },
@ -511,7 +512,9 @@ const historyDataReq = (promises: any) => {
const seriesData = { const seriesData = {
name: customName[index], name: customName[index],
type: 'line', type: 'line',
data: yData, data: yData.map((value: any) => ({
value: getCutDecimalsValue(value, 2),
})),
showSymbol: true, showSymbol: true,
animation: false, animation: false,
} }

View File

@ -122,6 +122,7 @@ import { ElMessage, ElMenu } from 'element-plus'
import { DArrowRight, Plus, Crop, Close } from '@element-plus/icons-vue' import { DArrowRight, Plus, Crop, Close } from '@element-plus/icons-vue'
import * as echarts from 'echarts' import * as echarts from 'echarts'
import { getModelAttributeListReq } from '/@/api/backend/deviceModel/request' import { getModelAttributeListReq } from '/@/api/backend/deviceModel/request'
import { getCutDecimalsValue } from '/@/views/backend/equipment/airBlower/utils'
const { t } = useI18n() const { t } = useI18n()
@ -216,7 +217,12 @@ const queryWindTurbines = () => {
queryWindTurbinesPages() queryWindTurbinesPages()
.then((res) => { .then((res) => {
if (res.code == 200) { if (res.code == 200) {
const resData = res.data const resData = res.data.map((item: any, index: any) => {
return {
index: index,
...item,
}
})
if (resData.length) { if (resData.length) {
iotModelId.value = resData[0]['modelId'] iotModelId.value = resData[0]['modelId']
const middleIndex = Math.ceil(resData.length / 2) const middleIndex = Math.ceil(resData.length / 2)
@ -399,7 +405,6 @@ function generateDeviceAttributes(devices: any, attributes: any) {
const statAnalysisOperate = () => { const statAnalysisOperate = () => {
const allDevices = [...selectedLeft.value, ...selectedRight.value] const allDevices = [...selectedLeft.value, ...selectedRight.value]
console.log('🚀 ~ statAnalysisOperate ~ selectedRight.value:', selectedRight.value)
if (!statAnalysisTime.value) { if (!statAnalysisTime.value) {
ElMessage.info('请选择查询时间!') ElMessage.info('请选择查询时间!')
return return
@ -420,6 +425,9 @@ const statAnalysisOperate = () => {
} }
const calculate: any = ref([{ max: '', min: '', average: '' }]) const calculate: any = ref([{ max: '', min: '', average: '' }])
const historyDataReq = (data: any) => { const historyDataReq = (data: any) => {
const selectAllDevices = [...selectedLeft.value, ...selectedRight.value].sort((a: any, b: any) => {
return a.index - b.index
})
historyReq(data) historyReq(data)
.then((res) => { .then((res) => {
isLoading.value = false isLoading.value = false
@ -427,14 +435,17 @@ const historyDataReq = (data: any) => {
const resData = res.data const resData = res.data
const deviceIdKeys = Object.keys(resData) const deviceIdKeys = Object.keys(resData)
if (deviceIdKeys.length) { if (deviceIdKeys.length) {
deviceIdKeys.forEach((item) => { selectAllDevices.forEach((item: any) => {
const deviceRow = [...selectedLeft.value, ...selectedRight.value].filter((value: any) => value.irn === item) if (!resData[item.irn]) {
const deviceName = deviceRow[0]['name'] ElMessage.info(`${item.name}没有数据`)
Object.keys(resData[item]).forEach((val) => { return
}
const deviceName = item.name
Object.keys(resData[item.irn]).forEach((val) => {
const attRow = multipleSelection.value.filter((value: any) => value.attributeCode === val) const attRow = multipleSelection.value.filter((value: any) => value.attributeCode === val)
const attName = attRow[0]['attributeName'] const attName = attRow[0]['attributeName']
const unit = attRow[0]['unit'] const unit = attRow[0]['unit']
const historyData = resData[item][val] const historyData = resData[item.irn][val]
const xData = historyData['times'] const xData = historyData['times']
const yData = historyData['values'] const yData = historyData['values']
if (!yData.length) { if (!yData.length) {
@ -445,7 +456,7 @@ const historyDataReq = (data: any) => {
name: deviceName + attName, name: deviceName + attName,
type: 'line', type: 'line',
data: yData.map((value: any) => ({ data: yData.map((value: any) => ({
value: value, value: getCutDecimalsValue(value, 2),
unit: unit, // unit: unit, //
})), })),
animation: false, animation: false,

View File

@ -35,20 +35,57 @@
></el-pagination> ></el-pagination>
</div> </div>
</el-card> </el-card>
<el-card class="box-card2"> <div class="bottom">
<div class="mainHeader"> <el-card class="box-card2 bottom-left">
<el-text class="mx-1 title">理论功率曲线</el-text> <div class="mainHeader">
<div class="right"> <el-text class="mx-1 title">理论功率曲线</el-text>
<el-upload :show-file-list="false" :http-request="update"> <div class="right">
<template #trigger> <el-upload :show-file-list="false" :http-request="update">
<el-button :icon="Refresh" type="primary">更新</el-button> <template #trigger>
</template> <el-button :icon="Refresh" type="primary">更新</el-button>
</el-upload> </template>
<el-button :icon="Download" type="primary" @click="download">下载</el-button> </el-upload>
<el-button :icon="Download" type="primary" @click="download">下载</el-button>
</div>
</div> </div>
</div> <div ref="chartContainer" class="chartContainer"></div>
<div ref="chartContainer" class="chartContainer"></div> </el-card>
</el-card> <el-card class="box-card3">
<div>
<div class="mainHeader">
<el-text class="mx-1 title">故障码字典</el-text>
<div class="right">
<el-upload :show-file-list="false" :http-request="update3">
<template #trigger>
<el-button :icon="Refresh" type="primary">更新</el-button>
</template>
</el-upload>
<el-button :icon="Download" type="primary" @click="download3">下载</el-button>
</div>
</div>
<div class="tabsPart">
<el-table :data="faultCodeDictpageData" class="tablePart">
<el-table-column prop="variable" label="编码" align="center"> </el-table-column>
<el-table-column prop="description" label="描述" align="center"> </el-table-column>
</el-table>
</div>
<div class="mainFooter">
<el-pagination
v-model:current-page="paginationOptions3.current"
v-model:page-size="paginationOptions3.pageSize"
:total="paginationOptions3.total"
:page-sizes="paginationOptions3.pageSizes"
background
:pager-count="5"
layout="prev, pager, next"
@size-change="handleSizeChange3"
@current-change="handleCurrentChange3"
></el-pagination>
</div>
</div>
</el-card>
</div>
<div class="bottom"> <div class="bottom">
<el-card class="box-card3 bottom-left"> <el-card class="box-card3 bottom-left">
<div> <div>
@ -180,6 +217,9 @@ import {
exportplcData, exportplcData,
queryFdrDesc, queryFdrDesc,
queryplcDesc, queryplcDesc,
importfaultCodeDict,
exportfaultCodeDict,
queryfaultCodeDict,
} from '/@/api/backend/theoreticalpowerCurve/request' } from '/@/api/backend/theoreticalpowerCurve/request'
import * as echarts from 'echarts' import * as echarts from 'echarts'
// //
@ -292,6 +332,42 @@ const download2 = () => {
}) })
} }
//
const update3 = (file: any) => {
const formData = new FormData()
formData.append('file', file.file)
const v = generateRandomNumber(16)
const id = encrypt_aes(currentRow.value.id, v)
formData.append('id', id)
return importfaultCodeDict(formData, v)
.then((res: any) => {
if (res.success) {
ElMessage.success('更新成功')
getRunLog()
} else {
ElMessage.error(res.msg)
}
})
.catch((err) => {
ElMessage.error(err?.response?.data?.msg ?? '更新失败')
})
}
//
const download3 = () => {
console.log(currentRow)
exportfaultCodeDict({ id: currentRow.value.id }).then((res: any) => {
const downloadUrl = window.URL.createObjectURL(res)
const a = document.createElement('a')
a.href = downloadUrl
a.download = '故障码字典' + new Date().getTime()
document.body.appendChild(a)
a.click()
window.URL.revokeObjectURL(downloadUrl)
document.body.removeChild(a)
})
}
const rowClassName = ({ row, rowIndex }: any) => { const rowClassName = ({ row, rowIndex }: any) => {
if (currentRow.value === row) { if (currentRow.value === row) {
return 'current-row' return 'current-row'
@ -339,10 +415,6 @@ const option: any = reactive({
}, },
}, },
series: [], series: [],
grid: {
left: '3%',
right: '3%',
},
}) })
const chart: any = ref(null) const chart: any = ref(null)
const chartContainer = ref<HTMLElement | null>(null) const chartContainer = ref<HTMLElement | null>(null)
@ -457,6 +529,8 @@ const faultRecordingData: any = ref([])
const faultRecordingpageData: any = ref([]) const faultRecordingpageData: any = ref([])
const runLogData: any = ref([]) const runLogData: any = ref([])
const runLogpageData: any = ref([]) const runLogpageData: any = ref([])
const faultCodeDictData: any = ref([])
const faultCodeDictpageData: any = ref([])
const handleSizeChange1 = (val: any) => { const handleSizeChange1 = (val: any) => {
paginationOptions1.pageSize = val paginationOptions1.pageSize = val
@ -483,6 +557,20 @@ const handleCurrentChange2 = (val: any) => {
const end = start + paginationOptions2.pageSize const end = start + paginationOptions2.pageSize
runLogpageData.value = runLogData.value.slice(start, end) runLogpageData.value = runLogData.value.slice(start, end)
} }
const handleSizeChange3 = (val: any) => {
paginationOptions3.pageSize = val
paginationOptions3.current = 1
runLogpageData.value = runLogData.value.slice(0, paginationOptions1.pageSize)
}
//
const handleCurrentChange3 = (val: any) => {
paginationOptions3.current = val
const start = (paginationOptions3.current - 1) * paginationOptions3.pageSize
const end = start + paginationOptions3.pageSize
runLogpageData.value = runLogData.value.slice(start, end)
}
const getList = () => { const getList = () => {
const transparams = searchParams() const transparams = searchParams()
theoreticalpowerCurveList(transparams) theoreticalpowerCurveList(transparams)
@ -498,6 +586,7 @@ const getList = () => {
getpowerCurve() getpowerCurve()
getFaultRecording() getFaultRecording()
getRunLog() getRunLog()
getfaultCodeDict()
} else { } else {
ElMessage.error(res.msg ?? '查询失败') ElMessage.error(res.msg ?? '查询失败')
} }
@ -574,6 +663,19 @@ const getRunLog = () => {
}) })
} }
const getfaultCodeDict = () => {
currentRow.value = currentRow.value ?? theoreticalTableData.value[0]
queryfaultCodeDict({ madeinfactory: currentRow.value.madeinfactory, model: currentRow.value.model }).then((res) => {
if (res.code == 200) {
faultCodeDictData.value = [...res.data]
paginationOptions3.total = faultCodeDictData.value.length
faultCodeDictpageData.value = faultCodeDictData.value.slice(0, paginationOptions3.pageSize)
} else {
ElMessage.warning('查询失败')
}
})
}
const paginationOptions = reactive({ const paginationOptions = reactive({
current: 1, current: 1,
pageSize: 5, pageSize: 5,
@ -592,6 +694,13 @@ const paginationOptions2 = reactive({
total: 0, total: 0,
pageSizes: [5, 50, 100], pageSizes: [5, 50, 100],
}) })
const paginationOptions3 = reactive({
current: 1,
pageSize: 5,
total: 0,
pageSizes: [5, 50, 100],
})
const getcurrentPage = () => { const getcurrentPage = () => {
getList() getList()
} }
@ -694,7 +803,7 @@ $paginationHeight: 32px;
} }
.chartContainer { .chartContainer {
width: 100%; width: 50%;
height: 240px; height: 240px;
border: 1px solid rgb(217, 217, 217); border: 1px solid rgb(217, 217, 217);
margin-top: 10px; margin-top: 10px;
@ -705,8 +814,7 @@ $paginationHeight: 32px;
} }
} }
.box-card2 { .box-card2 {
width: 100%; width: 50%;
margin-bottom: 20px;
.chartContainer { .chartContainer {
width: 100%; width: 100%;
height: 200px; height: 200px;