From 1c02c504813c53662df3a93e81468006eb039ae0 Mon Sep 17 00:00:00 2001 From: geting <13585118195@163.com> Date: Mon, 2 Dec 2024 15:48:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=85=E9=9A=9C=E7=A0=81=E5=AD=97=E5=85=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../backend/theoreticalpowerCurve/request.ts | 35 +++++ .../statAnalysis/powerCurveAnalysis.vue | 7 +- .../backend/statAnalysis/trendAnalysis.vue | 7 +- .../backend/statAnalysis/trendComparison.vue | 27 +++- .../backend/theoreticalpowerCurve/index.vue | 148 +++++++++++++++--- 5 files changed, 192 insertions(+), 32 deletions(-) diff --git a/ui/dasadmin/src/api/backend/theoreticalpowerCurve/request.ts b/ui/dasadmin/src/api/backend/theoreticalpowerCurve/request.ts index 02fa797f..228458ab 100644 --- a/ui/dasadmin/src/api/backend/theoreticalpowerCurve/request.ts +++ b/ui/dasadmin/src/api/backend/theoreticalpowerCurve/request.ts @@ -136,3 +136,38 @@ export function queryplcDesc(params: object = {}) { 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, + }) +} diff --git a/ui/dasadmin/src/views/backend/statAnalysis/powerCurveAnalysis.vue b/ui/dasadmin/src/views/backend/statAnalysis/powerCurveAnalysis.vue index 1f108e54..79da17a2 100644 --- a/ui/dasadmin/src/views/backend/statAnalysis/powerCurveAnalysis.vue +++ b/ui/dasadmin/src/views/backend/statAnalysis/powerCurveAnalysis.vue @@ -67,6 +67,8 @@ import { queryWindTurbinesPages, historyReq, powerCurveExport } from '/@/api/bac import { theoreticalpowerCurveList, powerCurveQuery } from '/@/api/backend/theoreticalpowerCurve/request' import { ElMessage } from 'element-plus' import * as echarts from 'echarts' +import { getCutDecimalsValue } from '/@/views/backend/equipment/airBlower/utils' + const { t } = useI18n() const statAnalysisFatory = ref('') @@ -327,11 +329,12 @@ const statAnalysisOperate = () => { ElMessage.info(`实时值数据为空`) } else { 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) => { return a[0] - b[0] }) + const series = { type: 'line', data: seriesData, @@ -345,7 +348,7 @@ const statAnalysisOperate = () => { } if (resData1.length) { const seriesData = resData1.map((item: any) => { - return [item.speed, item.power] + return [getCutDecimalsValue(item.speed, 2), getCutDecimalsValue(item.power, 2)] }) const series = { type: 'line', diff --git a/ui/dasadmin/src/views/backend/statAnalysis/trendAnalysis.vue b/ui/dasadmin/src/views/backend/statAnalysis/trendAnalysis.vue index bbcb9760..10b31131 100644 --- a/ui/dasadmin/src/views/backend/statAnalysis/trendAnalysis.vue +++ b/ui/dasadmin/src/views/backend/statAnalysis/trendAnalysis.vue @@ -104,6 +104,7 @@ import { ElMessage } from 'element-plus' import { DArrowRight, Plus, Delete, Close } from '@element-plus/icons-vue' import MeasurementPage from './analysisAttributes.vue' import { getModelAttributeListReq } from '/@/api/backend/deviceModel/request' +import { getCutDecimalsValue } from '/@/views/backend/equipment/airBlower/utils' import * as echarts from 'echarts' const { t } = useI18n() @@ -502,7 +503,7 @@ const historyDataReq = (promises: any) => { .map((item: any) => { const matchData = xDatas.filter((x: any) => x.series == item.seriesName) 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('
') }, @@ -511,7 +512,9 @@ const historyDataReq = (promises: any) => { const seriesData = { name: customName[index], type: 'line', - data: yData, + data: yData.map((value: any) => ({ + value: getCutDecimalsValue(value, 2), + })), showSymbol: true, animation: false, } diff --git a/ui/dasadmin/src/views/backend/statAnalysis/trendComparison.vue b/ui/dasadmin/src/views/backend/statAnalysis/trendComparison.vue index 1162d766..d67fe79d 100644 --- a/ui/dasadmin/src/views/backend/statAnalysis/trendComparison.vue +++ b/ui/dasadmin/src/views/backend/statAnalysis/trendComparison.vue @@ -122,6 +122,7 @@ import { ElMessage, ElMenu } from 'element-plus' import { DArrowRight, Plus, Crop, Close } from '@element-plus/icons-vue' import * as echarts from 'echarts' import { getModelAttributeListReq } from '/@/api/backend/deviceModel/request' +import { getCutDecimalsValue } from '/@/views/backend/equipment/airBlower/utils' const { t } = useI18n() @@ -216,7 +217,12 @@ const queryWindTurbines = () => { queryWindTurbinesPages() .then((res) => { if (res.code == 200) { - const resData = res.data + const resData = res.data.map((item: any, index: any) => { + return { + index: index, + ...item, + } + }) if (resData.length) { iotModelId.value = resData[0]['modelId'] const middleIndex = Math.ceil(resData.length / 2) @@ -399,7 +405,6 @@ function generateDeviceAttributes(devices: any, attributes: any) { const statAnalysisOperate = () => { const allDevices = [...selectedLeft.value, ...selectedRight.value] - console.log('🚀 ~ statAnalysisOperate ~ selectedRight.value:', selectedRight.value) if (!statAnalysisTime.value) { ElMessage.info('请选择查询时间!') return @@ -420,6 +425,9 @@ const statAnalysisOperate = () => { } const calculate: any = ref([{ max: '', min: '', average: '' }]) const historyDataReq = (data: any) => { + const selectAllDevices = [...selectedLeft.value, ...selectedRight.value].sort((a: any, b: any) => { + return a.index - b.index + }) historyReq(data) .then((res) => { isLoading.value = false @@ -427,14 +435,17 @@ const historyDataReq = (data: any) => { const resData = res.data const deviceIdKeys = Object.keys(resData) if (deviceIdKeys.length) { - deviceIdKeys.forEach((item) => { - const deviceRow = [...selectedLeft.value, ...selectedRight.value].filter((value: any) => value.irn === item) - const deviceName = deviceRow[0]['name'] - Object.keys(resData[item]).forEach((val) => { + selectAllDevices.forEach((item: any) => { + if (!resData[item.irn]) { + ElMessage.info(`${item.name}没有数据`) + return + } + const deviceName = item.name + Object.keys(resData[item.irn]).forEach((val) => { const attRow = multipleSelection.value.filter((value: any) => value.attributeCode === val) const attName = attRow[0]['attributeName'] const unit = attRow[0]['unit'] - const historyData = resData[item][val] + const historyData = resData[item.irn][val] const xData = historyData['times'] const yData = historyData['values'] if (!yData.length) { @@ -445,7 +456,7 @@ const historyDataReq = (data: any) => { name: deviceName + attName, type: 'line', data: yData.map((value: any) => ({ - value: value, + value: getCutDecimalsValue(value, 2), unit: unit, // 将单位添加到每个数据点 })), animation: false, diff --git a/ui/dasadmin/src/views/backend/theoreticalpowerCurve/index.vue b/ui/dasadmin/src/views/backend/theoreticalpowerCurve/index.vue index 9d475734..56edff34 100644 --- a/ui/dasadmin/src/views/backend/theoreticalpowerCurve/index.vue +++ b/ui/dasadmin/src/views/backend/theoreticalpowerCurve/index.vue @@ -35,20 +35,57 @@ > - -
- 理论功率曲线 -
- - - - 下载 +
+ +
+ 理论功率曲线 +
+ + + + 下载 +
-
-
- +
+ + +
+
+ 故障码字典 +
+ + + + 下载 +
+
+
+ + + + +
+
+ +
+
+
+
+
@@ -180,6 +217,9 @@ import { exportplcData, queryFdrDesc, queryplcDesc, + importfaultCodeDict, + exportfaultCodeDict, + queryfaultCodeDict, } from '/@/api/backend/theoreticalpowerCurve/request' 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) => { if (currentRow.value === row) { return 'current-row' @@ -339,10 +415,6 @@ const option: any = reactive({ }, }, series: [], - grid: { - left: '3%', - right: '3%', - }, }) const chart: any = ref(null) const chartContainer = ref(null) @@ -457,6 +529,8 @@ const faultRecordingData: any = ref([]) const faultRecordingpageData: any = ref([]) const runLogData: any = ref([]) const runLogpageData: any = ref([]) +const faultCodeDictData: any = ref([]) +const faultCodeDictpageData: any = ref([]) const handleSizeChange1 = (val: any) => { paginationOptions1.pageSize = val @@ -483,6 +557,20 @@ const handleCurrentChange2 = (val: any) => { const end = start + paginationOptions2.pageSize 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 transparams = searchParams() theoreticalpowerCurveList(transparams) @@ -498,6 +586,7 @@ const getList = () => { getpowerCurve() getFaultRecording() getRunLog() + getfaultCodeDict() } else { 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({ current: 1, pageSize: 5, @@ -592,6 +694,13 @@ const paginationOptions2 = reactive({ total: 0, pageSizes: [5, 50, 100], }) + +const paginationOptions3 = reactive({ + current: 1, + pageSize: 5, + total: 0, + pageSizes: [5, 50, 100], +}) const getcurrentPage = () => { getList() } @@ -694,7 +803,7 @@ $paginationHeight: 32px; } .chartContainer { - width: 100%; + width: 50%; height: 240px; border: 1px solid rgb(217, 217, 217); margin-top: 10px; @@ -705,8 +814,7 @@ $paginationHeight: 32px; } } .box-card2 { - width: 100%; - margin-bottom: 20px; + width: 50%; .chartContainer { width: 100%; height: 200px;