From affaafea83841d40904570d6cd25e3661f05f7fc Mon Sep 17 00:00:00 2001 From: GGJ <357021191@qq.com> Date: Wed, 20 Nov 2024 16:20:15 +0800 Subject: [PATCH] =?UTF-8?q?=E8=81=94=E8=B0=83=E5=87=86=E5=AE=9E=E6=97=B6?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/cs-device-boot/EquipmentDelivery.ts | 9 ++ src/api/cs-device-boot/csGroup.ts | 18 +++ src/views/govern/device/control/index.vue | 128 ++++++++++++++++-- .../device/control/nearRealTimeData.vue | 66 +++++++++ .../control/tabs/components/realtrend.vue | 1 - 5 files changed, 207 insertions(+), 15 deletions(-) create mode 100644 src/views/govern/device/control/nearRealTimeData.vue diff --git a/src/api/cs-device-boot/EquipmentDelivery.ts b/src/api/cs-device-boot/EquipmentDelivery.ts index 15d791d..4b6512f 100644 --- a/src/api/cs-device-boot/EquipmentDelivery.ts +++ b/src/api/cs-device-boot/EquipmentDelivery.ts @@ -102,3 +102,12 @@ export function getDeviceHarmonicSpectrumData(data: any) { data: data }) } +//获取指标类型-谐波频谱 +export function queryDictType() { + return createAxios({ + url: '/system-boot/dictTree/queryDictType', + method: 'GET', + + }) +} + diff --git a/src/api/cs-device-boot/csGroup.ts b/src/api/cs-device-boot/csGroup.ts index c50d04a..de08d55 100644 --- a/src/api/cs-device-boot/csGroup.ts +++ b/src/api/cs-device-boot/csGroup.ts @@ -51,3 +51,21 @@ export function deviceRtData(data: any) { data: form }) } +// 装置分组历史数据 +export function realTimeData(data: any) { + let form = new FormData() + form.append('id', data.id) + form.append('lineId', data.lineId) + form.append('pageNum', data.pageNum) + form.append('pageSize', data.pageSize) + form.append('searchValue', data.searchValue) + form.append('targetType', data.targetType) + form.append('dataLevel',data.dataLevel) + return createAxios({ + url: '/cs-harmonic-boot/data/realTimeData', + method: 'POST', + + data + }) +} + diff --git a/src/views/govern/device/control/index.vue b/src/views/govern/device/control/index.vue index 2d2b4ad..35c4df1 100644 --- a/src/views/govern/device/control/index.vue +++ b/src/views/govern/device/control/index.vue @@ -82,10 +82,17 @@ - + + + + + + + @@ -139,10 +146,16 @@ tableData.length != 0 ">
- 统计时间:{{ tableData[0].children.length ? tableData[0].children[0].time : '' }} + 统计时间:{{ tableData[0]?.time || '' }}
+ + + + -
- + +
+
+
+ {{ child.anotherName }}: + {{ child.dataValue === 3.1415926 ? '暂无数据' : child.dataValue }} +
+ +
+ +
+
+
+ + MAX + + {{ + item.children[0].maxValue === 3.1415956 || + typeof item.children[0].maxValue != 'number' + ? '暂无数据' + : item.children[0].maxValue + }} +
+
+ + AVG + + {{ + item.children[0].avgValue === 3.1415956 || + typeof item.children[0].avgValue != 'number' + ? '暂无数据' + : item.children[0].avgValue + }} +
+
+ + MIN + + {{ + item.children[0].minValue === 3.1415956 || + typeof item.children[0].minValue != 'number' + ? '暂无数据' + : item.children[0].minValue + }} +
+
+ + + + - + :total="formInline.total"> -->
@@ -271,9 +348,11 @@ import { getDeviceData, getBasicRealData, getHarmRealData, - getOverLimitData + getOverLimitData, + queryDictType, + } from '@/api/cs-device-boot/EquipmentDelivery' -import { deviceHisData, deviceRtData } from '@/api/cs-device-boot/csGroup' +import { deviceHisData, deviceRtData, realTimeData } from '@/api/cs-device-boot/csGroup' import { ref, reactive, onMounted, onUnmounted, inject, nextTick, onBeforeUnmount } from 'vue' import { ElMessage } from 'element-plus' import DatePicker from '@/components/form/datePicker/index.vue' @@ -284,6 +363,7 @@ import harmonicSpectrum from './tabs/components/harmonicSpectrum.vue' //实时 import recordWoves from './tabs/components/recordwoves.vue' //实时数据-实时录波子页面 import offLineDataImport from './offLineDataImport/index.vue' import Event from './tabs/event.vue' +import nearRealTimeData from './nearRealTimeData.vue' import { useRouter } from 'vue-router' import TableHeader from '@/components/table/header/index.vue' import { useAdminInfo } from '@/stores/adminInfo' @@ -300,11 +380,12 @@ const tableLoading = ref(false) const getGroupLoading = ref(false) const deviceData = ref(null) const dataSet = ref('') +const nearRealTimeDataRef = ref() const devTypeOptions = ref([]) const devModelOptions = ref([]) const tableData = ref([]) -const tableHeight = mainHeight(330).height -const tableHeightBox = mainHeight(365).height +const tableHeight = mainHeight(290).height +const tableHeightBox = mainHeight(310).height const mangePopup = ref() const datePickerRef = ref() const formInline = reactive({ @@ -316,8 +397,10 @@ const formInline = reactive({ endTime: '', id: '', lineId: '', + targetType: '', dataLevel: 'Secondary' }) + const detail = ref(null) //是否显示实时数据默认内容 const realTimeFlag = ref(true) @@ -339,6 +422,7 @@ const changeTrendType = (val: any) => { const activeTrendName: any = ref(0) const trendTimer: any = ref() const trendDataTime: any = ref() + //谐波频谱方法 const handleTrend = async () => { realTimeFlag.value = false @@ -493,6 +577,7 @@ const nodeClick = async (e: anyObj) => { formInline.lineId = e.level == 3 ? e.id : e.children[0].id await getDeviceData(e.level == 3 ? e.pid : e.id, 'history', e.level == 3 ? e.id : e.children[0].id) .then((res: any) => { + deviceData.value = res.data formInline.dataLevel = res.data.dataLevel dataLevel.value = res.data.dataLevel @@ -504,6 +589,7 @@ const nodeClick = async (e: anyObj) => { tableData.value = [] loading.value = false } else { + res.data.dataSetList.forEach((item: any) => { //历史 if (item.type === 'history') { @@ -522,6 +608,7 @@ const nodeClick = async (e: anyObj) => { item.id = item.id + '_event' } }) + res.data.dataSetList = res.data.dataSetList.filter((item: any) => item.name != '历史统计数据') //便携式设备默认二次值 // if (deviceType.value == '1') { // formInline.dataLevel = 'Primary' @@ -771,6 +858,7 @@ const handleClick = async (tab?: any) => { realTimeFlag.value = false //初始化点击tab隐藏子页面 sonTab.value = null + console.log(123, dataSet.value.includes('_history')); //查询历史指标 if (dataSet.value.includes('_history')) { @@ -848,12 +936,19 @@ const handleClick = async (tab?: any) => { //查询当前指标 if (!dataSet.value.includes('_')) { formInline.id = dataSet.value - await deviceRtData(formInline) + console.log("🚀 ~ handleClick ~ formInline:", formInline) + + // await deviceRtData(formInline) + await realTimeData(formInline) .then((res: any) => { - tableData.value = res.data.records + tableData.value = res.data formInline.total = res.data.total tableLoading.value = false + setTimeout(() => { //targetType + nearRealTimeDataRef.value.setData(res.data, queryList.value.filter((item: any) => item.id == formInline.targetType)) + }, 500) setTimeout(() => { + loading.value = false }, 1500) }) @@ -913,6 +1008,11 @@ queryByCode('Device_Type').then(res => { }) }) }) +const queryList: any = ref([]) +queryDictType().then(res => { + queryList.value = res.data + formInline.targetType = res.data[0].id +}) const echoName = (value: any, arr: any[]) => { return value ? arr.find(item => item.value == value)?.label : '/' } diff --git a/src/views/govern/device/control/nearRealTimeData.vue b/src/views/govern/device/control/nearRealTimeData.vue new file mode 100644 index 0000000..a69b6fc --- /dev/null +++ b/src/views/govern/device/control/nearRealTimeData.vue @@ -0,0 +1,66 @@ + + + diff --git a/src/views/govern/device/control/tabs/components/realtrend.vue b/src/views/govern/device/control/tabs/components/realtrend.vue index 539455d..5de6a12 100644 --- a/src/views/govern/device/control/tabs/components/realtrend.vue +++ b/src/views/govern/device/control/tabs/components/realtrend.vue @@ -257,7 +257,6 @@ const setRealTrendData = (val: any) => { tableData.value[key] = val[key] } } - } else { if (activeName.value == 2) { if (numberPart % 2 === 0) {