diff --git a/src/components/cockpit/transientStatistics/components/transientStatisticsDetail.vue b/src/components/cockpit/transientStatistics/components/transientStatisticsDetail.vue index 4f60bb2..d9a646d 100644 --- a/src/components/cockpit/transientStatistics/components/transientStatisticsDetail.vue +++ b/src/components/cockpit/transientStatistics/components/transientStatisticsDetail.vue @@ -2,14 +2,10 @@
- + -
+
- + @@ -50,18 +53,22 @@ const loading = ref(false) const wp = ref({}) const boxoList: any = ref({}) +const tableHeaderRef = ref() + const options = [ { value: '35kV进线', label: '35kV进线' } ] -const height = mainHeight(0, 2).height as any +const heightRef = ref(mainHeight(57, 2.3).height) +const selectChange = (flag: boolean, h: any) => { + heightRef.value = mainHeight(h, 2.3).height +} const tableStore: any = new TableStore({ - url: '/user-boot/role/selectRoleDetail?id=0', + url: '/cs-harmonic-boot/event/pageEvent', method: 'POST', - publicHeight: 30, - showPage: false, + showPage: true, exportName: '主要监测点列表', column: [ { @@ -74,36 +81,49 @@ const tableStore: any = new TableStore({ }, { title: '暂态时间', - field: 'time' + field: 'startTime' }, { title: '测点名称', - field: 'name', + field: 'lineName', width: '150' }, { title: '暂态类型', - field: 'flicker', + field: 'tag', width: '100' }, { title: '特征幅值(%)', - field: 'flicker', + field: 'amplitude', width: '100' }, { title: '暂降深度(%)', - field: 'flicker', - width: '100' + field: 'depth', + width: '100', + formatter: (row: any) => { + // 当暂态类型不是电压暂升时,计算暂降深度 = 100 - 特征幅值 + if (row.tag !== '电压暂升') { + const amplitude = parseFloat(row.row.amplitude) + if (!isNaN(amplitude)) { + return 100 - amplitude + } + return '-' + } else { + // 电压暂升时不显示暂降深度 + return '/' + } + } }, { title: '持续时间(S)', - field: 'flicker', + field: 'persistTime', width: '100' }, { title: '严重度', - field: 'flicker', + field: 'severity', width: '80' }, { @@ -112,27 +132,38 @@ const tableStore: any = new TableStore({ render: 'buttons', buttons: [ { - name: 'check', - title: '查看波形', + name: 'edit', + text: '波形分析', type: 'primary', - icon: 'el-icon-EditPen', + icon: 'el-icon-DataLine', render: 'basicButton', - loading: 'loading1', - // disabled: row => { - // return !row.wavePath - // }, + disabled: row => { + return !row.wavePath + }, + click: async row => { row.loading1 = true loading.value = true isWaveCharts.value = true + dialogVisible.value = false + // 在打开弹窗时立即设置高度 + nextTick(() => { + if (waveFormAnalysisRef.value) { + waveFormAnalysisRef.value.setHeight(false, 360) + } + }) await analyseWave(row.id) .then(res => { row.loading1 = false if (res != undefined) { boxoList.value = row + // boxoList.value = { + // ...row, + // duration: row.persistTime // 将 persistTime 值赋给 duration + // } boxoList.value.featureAmplitude = row.evtParamVVaDepth != '-' ? row.evtParamVVaDepth - 0 : null - boxoList.value.systemType = 'WX' + boxoList.value.systemType = 'YPT' wp.value = res.data } loading.value = false @@ -145,39 +176,60 @@ const tableStore: any = new TableStore({ nextTick(() => { waveFormAnalysisRef.value && waveFormAnalysisRef.value.getWpData(wp.value, boxoList.value, true) + // waveFormAnalysisRef.value && waveFormAnalysisRef.value.setHeight(false, 360) }) } + }, + { + name: 'edit', + text: '暂无波形', + type: 'info', + icon: 'el-icon-DataLine', + render: 'basicButton', + disabled: row => { + return !(!row.wavePath && row.evtParamTm < 20) + } } ] } ], beforeSearchFun: () => {}, loadCallback: () => { - tableStore.table.data = [ - { - time: '2024-01-01 00:00:00', - name: '35kV进线', - flicker: '0' - }, - { - time: '2024-01-01 00:00:00', - name: '35kV进线', - flicker: '0' - }, - { - time: '2024-01-01 00:00:00', - name: '35kV进线', - flicker: '0' - } - ] + // tableStore.table.data = [ + // { + // time: '2024-01-01 00:00:00', + // name: '35kV进线', + // flicker: '0' + // }, + // { + // time: '2024-01-01 00:00:00', + // name: '35kV进线', + // flicker: '0' + // }, + // { + // time: '2024-01-01 00:00:00', + // name: '35kV进线', + // flicker: '0' + // } + // ] } }) -tableStore.table.params.searchValue = '' provide('tableStore', tableStore) -const open = async (row: any) => { +const open = async (row: any, searchBeginTime: any, searchEndTime: any) => { + dialogVisible.value = true + tableStore.table.params.lineId = row.id + nextTick(() => { + tableHeaderRef.value.setTimeInterval([searchBeginTime, searchEndTime]) + tableStore.table.params.searchBeginTime = searchBeginTime + tableStore.table.params.searchEndTime = searchEndTime + tableStore.index() + }) +} + +const handleHideCharts = () => { + isWaveCharts.value = false dialogVisible.value = true - tableStore.index() } // 点击行 diff --git a/src/components/cockpit/transientStatistics/index.vue b/src/components/cockpit/transientStatistics/index.vue index 9a3f897..eda6ab9 100644 --- a/src/components/cockpit/transientStatistics/index.vue +++ b/src/components/cockpit/transientStatistics/index.vue @@ -24,12 +24,9 @@ import { ref, onMounted, provide, reactive, watch, h } from 'vue' import TableStore from '@/utils/tableStore' import Table from '@/components/table/index.vue' import MyEchart from '@/components/echarts/MyEchart.vue' -import { getTimeOfTheMonth } from '@/utils/formatTime' import { useConfig } from '@/stores/config' import TransientStatisticsDetail from '@/components/cockpit/transientStatistics/components/transientStatisticsDetail.vue' import TableHeader from '@/components/table/header/index.vue' -import { useRoute } from 'vue-router' -import { useTimeCacheStore } from '@/stores/timeCache' import { netEventEcharts } from '@/api/harmonic-boot/cockpit/cockpit' const prop = defineProps({ @@ -76,7 +73,7 @@ const eventEcharts = () => { searchEndTime: tableStore.table.params.searchEndTime || prop.timeValue?.[1] }).then(res => { // 整理接口数据为图表所需格式 - const rawData = res.data || {}; + const rawData = res.data || {} data.value = [ { name: '电压中断', @@ -90,8 +87,8 @@ const eventEcharts = () => { name: '电压暂升', value: rawData.eventUp || 0 } - ]; - + ] + echartList.value = { title: {}, tooltip: { @@ -124,7 +121,7 @@ const eventEcharts = () => { left: 'center' }, { - text: (rawData.eventOff + rawData.eventDown + rawData.eventUp) + '次', + text: rawData.eventOff + rawData.eventDown + rawData.eventUp + '次', left: 'center', top: 'center' } @@ -174,6 +171,7 @@ const tableStore: any = new TableStore({ title: '电压中断(次)', field: 'eventOff', minWidth: '70', + sortable: true, render: 'customTemplate', customTemplate: (row: any) => { return `${row.eventOff}` @@ -183,6 +181,7 @@ const tableStore: any = new TableStore({ title: '电压暂降(次)', field: 'eventDown', minWidth: '80', + sortable: true, render: 'customTemplate', customTemplate: (row: any) => { return `${row.eventDown}` @@ -192,6 +191,7 @@ const tableStore: any = new TableStore({ title: '电压暂升(次)', field: 'eventUp', minWidth: '80', + sortable: true, render: 'customTemplate', customTemplate: (row: any) => { return `${row.eventUp}` @@ -215,7 +215,11 @@ provide('tableStore', tableStore) // 点击行 const cellClickEvent = ({ row, column }: any) => { if (column.field != 'name') { - transientStatisticsDetailRef.value.open(row) + transientStatisticsDetailRef.value.open( + row, + tableStore.table.params.searchBeginTime || prop.timeValue?.[0], + tableStore.table.params.searchEndTime || prop.timeValue?.[1] + ) } } diff --git a/src/components/echarts/shuWorker.js b/src/components/echarts/shuWorker.js index 11d7758..50c035a 100644 --- a/src/components/echarts/shuWorker.js +++ b/src/components/echarts/shuWorker.js @@ -1,179 +1,203 @@ // waveData.worker.js -self.addEventListener('message', function(e) { - const { wp, value, iphasic, isOpen, boxoList } = JSON.parse(e.data); - - // 处理波形数据的函数 - const fliteWaveData = (wp, step) => { - // 将原有的fliteWaveData函数实现复制到这里 - const shunData = wp.listWaveData; - const pt = Number(wp.pt) / 1000; - const ct = Number(wp.ct); - const titleList = wp.waveTitle; - let xishu = pt; - let aTitle = '', bTitle = '', cTitle = '', unit = '电压'; - let ifmax = 0, ifmin = 0, ismax = 0, ismin = 0; +self.addEventListener('message', function (e) { + const { wp, value, iphasic, isOpen, boxoList } = JSON.parse(e.data) - const shunshiFA = []; - const shunshiFB = []; - const shunshiFC = []; - const shunshiSA = []; - const shunshiSB = []; - const shunshiSC = []; + // 处理波形数据的函数 + const fliteWaveData = (wp, step) => { + // 将原有的fliteWaveData函数实现复制到这里 + const shunData = wp.listWaveData + const pt = Number(wp.pt) / 1000 + const ct = Number(wp.ct) + const titleList = wp.waveTitle + let xishu = pt + let aTitle = '', + bTitle = '', + cTitle = '', + unit = '电压' + let ifmax = 0, + ifmin = 0, + ismax = 0, + ismin = 0 - if (shunData.length > 0) { - if (titleList[iphasic * step + 1]?.substring(0, 1) !== 'U') { - xishu = ct; - unit = '电流'; - } + const shunshiFA = [] + const shunshiFB = [] + const shunshiFC = [] + const shunshiSA = [] + const shunshiSB = [] + const shunshiSC = [] - for (let i = 1; i <= iphasic; i++) { - switch (i) { - case 1: - aTitle = titleList[iphasic * step + i]?.substring(1) || ''; - break; - case 2: - bTitle = titleList[iphasic * step + i]?.substring(1) || ''; - break; - case 3: - cTitle = titleList[iphasic * step + i]?.substring(1) || ''; - break; - } - } + if (shunData.length > 0) { + if (titleList[iphasic * step + 1]?.substring(0, 1) !== 'U') { + xishu = ct + unit = '电流' + } - if (shunData[0][iphasic * step + 1] !== undefined) { - ifmax = shunData[0][iphasic * step + 1] * xishu; - ifmin = shunData[0][iphasic * step + 1] * xishu; - ismax = shunData[0][iphasic * step + 1]; - ismin = shunData[0][iphasic * step + 1]; - } + for (let i = 1; i <= iphasic; i++) { + switch (i) { + case 1: + aTitle = titleList[iphasic * step + i]?.substring(1) || '' + break + case 2: + bTitle = titleList[iphasic * step + i]?.substring(1) || '' + break + case 3: + cTitle = titleList[iphasic * step + i]?.substring(1) || '' + break + } + } - for (let shun = 0; shun < shunData.length; shun++) { - if (shunData[shun][iphasic * step + 1] === undefined) { - break; + if (shunData[0][iphasic * step + 1] !== undefined) { + ifmax = shunData[0][iphasic * step + 1] * xishu + ifmin = shunData[0][iphasic * step + 1] * xishu + ismax = shunData[0][iphasic * step + 1] + ismin = shunData[0][iphasic * step + 1] + } + + for (let shun = 0; shun < shunData.length; shun++) { + if (shunData[shun][iphasic * step + 1] === undefined) { + break + } + + switch (iphasic) { + case 1: + const shunFirstA = shunData[shun][iphasic * step + 1] * xishu + shunshiFA.push([shunData[shun][0], shunFirstA]) + ifmax = Math.max(ifmax, shunFirstA) + ifmin = Math.min(ifmin, shunFirstA) + + const shunSecondA = shunData[shun][iphasic * step + 1] + shunshiSA.push([shunData[shun][0], shunSecondA]) + ismax = Math.max(ismax, shunSecondA) + ismin = Math.min(ismin, shunSecondA) + break + case 2: + const shunFirstA2 = shunData[shun][iphasic * step + 1] * xishu + const shunFirstB2 = shunData[shun][iphasic * step + 2] * xishu + shunshiFA.push([shunData[shun][0], shunFirstA2]) + shunshiFB.push([shunData[shun][0], shunFirstB2]) + ifmax = Math.max(ifmax, shunFirstA2, shunFirstB2) + ifmin = Math.min(ifmin, shunFirstA2, shunFirstB2) + + const shunSecondA2 = shunData[shun][iphasic * step + 1] + const shunSecondB2 = shunData[shun][iphasic * step + 2] + shunshiSA.push([shunData[shun][0], shunSecondA2]) + shunshiSB.push([shunData[shun][0], shunSecondB2]) + ismax = Math.max(ismax, shunSecondA2, shunSecondB2) + ismin = Math.min(ismin, shunSecondA2, shunSecondB2) + break + case 3: + const shunFirstA3 = shunData[shun][iphasic * step + 1] * xishu + const shunFirstB3 = shunData[shun][iphasic * step + 2] * xishu + const shunFirstC3 = shunData[shun][iphasic * step + 3] * xishu + shunshiFA.push([shunData[shun][0], shunFirstA3]) + shunshiFB.push([shunData[shun][0], shunFirstB3]) + shunshiFC.push([shunData[shun][0], shunFirstC3]) + ifmax = Math.max(ifmax, shunFirstA3, shunFirstB3, shunFirstC3) + ifmin = isOpen + ? Math.min(ifmin, shunFirstA3, shunFirstC3) + : Math.min(ifmin, shunFirstA3, shunFirstB3, shunFirstC3) + + const shunSecondA3 = shunData[shun][iphasic * step + 1] + const shunSecondB3 = shunData[shun][iphasic * step + 2] + const shunSecondC3 = shunData[shun][iphasic * step + 3] + shunshiSA.push([shunData[shun][0], shunSecondA3]) + shunshiSB.push([shunData[shun][0], shunSecondB3]) + shunshiSC.push([shunData[shun][0], shunSecondC3]) + ismax = Math.max(ismax, shunSecondA3, shunSecondB3, shunSecondC3) + ismin = isOpen + ? Math.min(ismin, shunSecondA3, shunSecondC3) + : Math.min(ismin, shunSecondA3, shunSecondB3, shunSecondC3) + break + } + } } - switch (iphasic) { - case 1: - const shunFirstA = shunData[shun][iphasic * step + 1] * xishu; - shunshiFA.push([shunData[shun][0], shunFirstA]); - ifmax = Math.max(ifmax, shunFirstA); - ifmin = Math.min(ifmin, shunFirstA); + const instantF = { max: ifmax, min: ifmin } + const instantS = { max: ismax, min: ismin } + const shunshiF = { shunshiFA, shunshiFB, shunshiFC } + const shunshiS = { shunshiSA, shunshiSB, shunshiSC } + const title = { aTitle, bTitle, cTitle, unit } - const shunSecondA = shunData[shun][iphasic * step + 1]; - shunshiSA.push([shunData[shun][0], shunSecondA]); - ismax = Math.max(ismax, shunSecondA); - ismin = Math.min(ismin, shunSecondA); - break; - case 2: - const shunFirstA2 = shunData[shun][iphasic * step + 1] * xishu; - const shunFirstB2 = shunData[shun][iphasic * step + 2] * xishu; - shunshiFA.push([shunData[shun][0], shunFirstA2]); - shunshiFB.push([shunData[shun][0], shunFirstB2]); - ifmax = Math.max(ifmax, shunFirstA2, shunFirstB2); - ifmin = Math.min(ifmin, shunFirstA2, shunFirstB2); - - const shunSecondA2 = shunData[shun][iphasic * step + 1]; - const shunSecondB2 = shunData[shun][iphasic * step + 2]; - shunshiSA.push([shunData[shun][0], shunSecondA2]); - shunshiSB.push([shunData[shun][0], shunSecondB2]); - ismax = Math.max(ismax, shunSecondA2, shunSecondB2); - ismin = Math.min(ismin, shunSecondA2, shunSecondB2); - break; - case 3: - const shunFirstA3 = shunData[shun][iphasic * step + 1] * xishu; - const shunFirstB3 = shunData[shun][iphasic * step + 2] * xishu; - const shunFirstC3 = shunData[shun][iphasic * step + 3] * xishu; - shunshiFA.push([shunData[shun][0], shunFirstA3]); - shunshiFB.push([shunData[shun][0], shunFirstB3]); - shunshiFC.push([shunData[shun][0], shunFirstC3]); - ifmax = Math.max(ifmax, shunFirstA3, shunFirstB3, shunFirstC3); - ifmin = isOpen ? Math.min(ifmin, shunFirstA3, shunFirstC3) : Math.min(ifmin, shunFirstA3, shunFirstB3, shunFirstC3); - - const shunSecondA3 = shunData[shun][iphasic * step + 1]; - const shunSecondB3 = shunData[shun][iphasic * step + 2]; - const shunSecondC3 = shunData[shun][iphasic * step + 3]; - shunshiSA.push([shunData[shun][0], shunSecondA3]); - shunshiSB.push([shunData[shun][0], shunSecondB3]); - shunshiSC.push([shunData[shun][0], shunSecondC3]); - ismax = Math.max(ismax, shunSecondA3, shunSecondB3, shunSecondC3); - ismin = isOpen ? Math.min(ismin, shunSecondA3, shunSecondC3) : Math.min(ismin, shunSecondA3, shunSecondB3, shunSecondC3); - break; - } - } + return { instantF, instantS, shunshiF, shunshiS, title, unit } } - const instantF = { max: ifmax, min: ifmin }; - const instantS = { max: ismax, min: ismin }; - const shunshiF = { shunshiFA, shunshiFB, shunshiFC }; - const shunshiS = { shunshiSA, shunshiSB, shunshiSC }; - const title = { aTitle, bTitle, cTitle, unit }; + // 处理标题 + let titles = '' + if (boxoList.systemType == 'pms') { + titles = + '变电站名称:' + + boxoList.powerStationName + + ' 监测点名称:' + + boxoList.measurementPointName + + ' 发生时刻:' + + boxoList.startTime + + ' 残余电压:' + + (boxoList.featureAmplitude * 100).toFixed(2) + + '% 持续时间:' + + boxoList.duration + + 's' + } else if (boxoList.systemType == 'ZL') { + titles = + ' 监测点名称:' + + boxoList.equipmentName + + ' 发生时刻:' + + boxoList.startTime + + ' 残余电压:' + + boxoList.evtParamVVaDepth + + ' 持续时间:' + + boxoList.evtParamTm + + 's' + } else if (boxoList.systemType == 'YPT') { + titles = + ' 监测点名称:' + + boxoList.lineName + + ' 发生时刻:' + + boxoList.startTime + + ' 残余电压:' + + (boxoList.featureAmplitude * 100).toFixed(2) + + '% 持续时间:' + + boxoList.persistTime + + 's' + } else { + titles = + '变电站名称:' + + boxoList.subName + + ' 监测点名称:' + + boxoList.lineName + + ' 发生时刻:' + + boxoList.startTime + + ' 残余电压:' + + (boxoList.featureAmplitude * 100).toFixed(2) + + '% 持续时间:' + + boxoList.duration + + 's' + } - return { instantF, instantS, shunshiF, shunshiS, title, unit }; - }; + const iphasicValue = wp.iphasic || 1 + const picCounts = (wp.waveTitle.length - 1) / iphasicValue + const waveDatas = [] - // 处理标题 - let titles = ''; - if (boxoList.systemType == 'pms') { - titles = '变电站名称:' + - boxoList.powerStationName + - ' 监测点名称:' + - boxoList.measurementPointName + - ' 发生时刻:' + - boxoList.startTime + - ' 残余电压:' + - (boxoList.featureAmplitude * 100).toFixed(2) + - '% 持续时间:' + - boxoList.duration + - 's'; - } else if (boxoList.systemType == 'ZL') { - titles = ' 监测点名称:' + - boxoList.equipmentName + - ' 发生时刻:' + - boxoList.startTime + - ' 残余电压:' + - boxoList.evtParamVVaDepth + - ' 持续时间:' + - boxoList.evtParamTm + - 's'; - } else { - titles = '变电站名称:' + - boxoList.subName + - ' 监测点名称:' + - boxoList.lineName + - ' 发生时刻:' + - boxoList.startTime + - ' 残余电压:' + - (boxoList.featureAmplitude * 100).toFixed(2) + - '% 持续时间:' + - boxoList.duration + - 's'; - } + for (let i = 0; i < picCounts; i++) { + const data = fliteWaveData(wp, i) + waveDatas.push(data) + } - const iphasicValue = wp.iphasic || 1; - const picCounts = (wp.waveTitle.length - 1) / iphasicValue; - const waveDatas = []; + const time = wp.time + const type = wp.waveType + let severity = wp.yzd - for (let i = 0; i < picCounts; i++) { - const data = fliteWaveData(wp, i); - waveDatas.push(data); - } + if (severity < 0) { + severity = '/' + type = '/' + } - const time = wp.time; - const type = wp.waveType; - let severity = wp.yzd; - - if (severity < 0) { - severity = '/'; - type = '/'; - } - - // 将处理结果发送回主线程 - self.postMessage({ - waveDatas, - time, - type, - severity, - titles, - iphasic: iphasicValue - }); -}); \ No newline at end of file + // 将处理结果发送回主线程 + self.postMessage({ + waveDatas, + time, + type, + severity, + titles, + iphasic: iphasicValue + }) +})