From 223e698c9b7532c5009b5b18296599a6e4181126 Mon Sep 17 00:00:00 2001 From: GGJ <357021191@qq.com> Date: Tue, 15 Oct 2024 15:31:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B5=8B=E8=AF=95=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/echarts/rmsboxi.vue | 2944 ++++++++--------- src/components/echarts/shushiboxi.vue | 38 +- src/components/form/datePicker/index.vue | 27 +- src/views/govern/device/control/index.vue | 2 +- .../tabs/components/waveFormAnalysis.vue | 1 + .../govern/device/control/tabs/event.vue | 13 + .../govern/device/control/tabs/trend.vue | 389 +-- src/views/govern/device/planData/index.vue | 110 +- src/views/govern/log/debug.vue | 8 +- 9 files changed, 1720 insertions(+), 1812 deletions(-) diff --git a/src/components/echarts/rmsboxi.vue b/src/components/echarts/rmsboxi.vue index 428caaa..4251dc3 100644 --- a/src/components/echarts/rmsboxi.vue +++ b/src/components/echarts/rmsboxi.vue @@ -1,21 +1,21 @@ diff --git a/src/components/echarts/shushiboxi.vue b/src/components/echarts/shushiboxi.vue index 1d68f9a..a52d530 100644 --- a/src/components/echarts/shushiboxi.vue +++ b/src/components/echarts/shushiboxi.vue @@ -21,6 +21,7 @@ import html2canvas from 'html2canvas' import $ from 'jquery' import * as echarts from 'echarts' + import { mainHeight } from '@/utils/layout' import url from '@/assets/img/point.png' export default { @@ -96,7 +97,7 @@ export default { } }, mounted() { - console.log(`123123`,this.boxoList,this.wp); + // console.log(`123123`,this.boxoList,this.wp); this.zoom = 1 / document.body.style.zoom window.addEventListener('resize', () => { this.zoom = 1 / document.body.style.zoom @@ -142,7 +143,6 @@ export default { }, //根据后台查询的数据,清洗数据 initWaves() { - console.log(this.boxoList.systemType,"this.boxoList.systemType"); if (null != this.wp) { if (this.boxoList.systemType == 'pms') { this.titles = @@ -170,26 +170,32 @@ export default { ' 持续时间:' + this.boxoList.evtParamTm + 's' + } + else if (this.boxoList.systemType == 'WX') { + this.titles = + // "变电站名称:" + + // this.boxoList.equipmentName + + ' 监测点名称:' + + this.boxoList.equipmentName + + ' 发生时刻:' + + this.boxoList.startTime + + ' 暂降(骤升)幅值:' + + this.boxoList.featureAmplitude==null?'/':this.boxoList.featureAmplitude.toFixed(2) + + ' 持续时间:' + + this.boxoList.persistTime==null? '/':this.boxoList.persistTime+ + 's' } else { - if((this.boxoList.featureAmplitude * 100).toFixed(0)){ - this.boxoList.featureAmplitude= (this.boxoList.featureAmplitude * 100).toFixed(0) - } - for(var key in this.boxoList) { - if(this.boxoList[key]==null||!this.boxoList[key]){ - this.boxoList[key]='/' - } - } this.titles = '变电站名称:' + - this.boxoList.subName + + this.boxoList.subName + ' 监测点名称:' + this.boxoList.lineName + ' 发生时刻:' + this.boxoList.startTime + ' 暂降(骤升)幅值:' + - this.boxoList.featureAmplitude + + (this.boxoList.featureAmplitude * 100).toFixed(0) + '% 持续时间:' + - this.boxoList.duration + + this.boxoList.duration + 's' } @@ -511,9 +517,7 @@ export default { for (var step = 1; step < waveDatas.length; step++) { var waveId = 'wave' + step var newDivShunshi = $(`
-
+
`) newDivShunshi.insertAfter($('#shushi')) @@ -589,7 +593,7 @@ export default { }, title: { left: 'center', - text: '电网侧-电压 ' + title, + text: title, textStyle: { fontSize: '0.8rem', color: _this.DColor ? '#fff' : echartsColor.WordColor diff --git a/src/components/form/datePicker/index.vue b/src/components/form/datePicker/index.vue index 923673c..3924dda 100644 --- a/src/components/form/datePicker/index.vue +++ b/src/components/form/datePicker/index.vue @@ -4,19 +4,9 @@ - + 当前 @@ -43,7 +33,7 @@ const count = ref(0) const disabledPicker = ref(true) const timeValue = ref() const backDisabled = ref(false) -const preDisabled = ref(false) +const preDisabled = ref(true) const timeOptions: any = ref([ { label: '年份', value: 1 }, { label: '季度', value: 2 }, @@ -86,7 +76,7 @@ onMounted(() => { // 选择时间范围 const timeChange = (e: number) => { backDisabled.value = false - preDisabled.value = false + preDisabled.value = true count.value = 0 if (e == 1) { disabledPicker.value = true @@ -128,6 +118,7 @@ const nowTime = () => { } // 上一个 const preClick = () => { + preDisabled.value = false let startTime = timeValue.value[0] let endTime = timeValue.value[1] let year = parseInt(startTime.substring(0, 4)) @@ -410,6 +401,12 @@ const next = () => { } } + if (!props.nextFlag) { + if (new Date(endTime + ' 00:00:00').getTime() >= new Date(window.XEUtils.toDateString(new Date(), 'yyyy-MM-dd ') + ' 00:00:00').getTime()) { + preDisabled.value = true + } + } + timeValue.value = [startTime, endTime] } diff --git a/src/views/govern/device/control/index.vue b/src/views/govern/device/control/index.vue index 56384e1..58454d4 100644 --- a/src/views/govern/device/control/index.vue +++ b/src/views/govern/device/control/index.vue @@ -852,7 +852,7 @@ queryByCode('Device_Type').then(res => { }) }) const echoName = (value: any, arr: any[]) => { - return value ? arr.find(item => item.value == value).label : '/' + return value ? arr.find(item => item.value == value)?.label : '/' } onMounted(() => {}) diff --git a/src/views/govern/device/control/tabs/components/waveFormAnalysis.vue b/src/views/govern/device/control/tabs/components/waveFormAnalysis.vue index 886f421..b0f89ba 100644 --- a/src/views/govern/device/control/tabs/components/waveFormAnalysis.vue +++ b/src/views/govern/device/control/tabs/components/waveFormAnalysis.vue @@ -150,6 +150,7 @@ defineExpose({ getWpData }) height: 50px; display: flex; align-items: center; + justify-content: space-between; .el-select { width: 200px !important; diff --git a/src/views/govern/device/control/tabs/event.vue b/src/views/govern/device/control/tabs/event.vue index ace7076..6c24953 100644 --- a/src/views/govern/device/control/tabs/event.vue +++ b/src/views/govern/device/control/tabs/event.vue @@ -91,6 +91,7 @@ const tableStore: any = new TableStore({ row.loading = false if (res != undefined) { boxoList.value = row + boxoList.value.systemType = 'WX' wp.value = res.data view.value = false view2.value = true @@ -104,6 +105,18 @@ const tableStore: any = new TableStore({ waveFormAnalysisRef.value && waveFormAnalysisRef.value.getWpData(wp.value, boxoList.value) }) } + }, + { + name: 'edit', + text: '暂无波形', + type: 'info', + icon: 'el-icon-DataLine', + render: 'basicButton', + disabled: row => { + return row.wavePath + }, + + } ] } diff --git a/src/views/govern/device/control/tabs/trend.vue b/src/views/govern/device/control/tabs/trend.vue index d7048fb..09fc6bb 100644 --- a/src/views/govern/device/control/tabs/trend.vue +++ b/src/views/govern/device/control/tabs/trend.vue @@ -56,6 +56,7 @@ import { position } from 'html2canvas/dist/types/css/property-descriptors/positi import { read, writeFile, utils } from 'xlsx' import TableStore from '@/utils/tableStore' import Table from '@/components/table/index.vue' +import { yMethod } from '@/utils/echartMethod' import TableHeader from '@/components/table/header/index.vue' import { getTabsDataByType } from '@/api/cs-device-boot/EquipmentDelivery' import DatePicker from '@/components/form/datePicker/index.vue' @@ -183,271 +184,155 @@ const init = async () => { .then((res: any) => { if (res.code == 'A0000') { historyDataList.value = res.data - echartsData.value = null + let chartsList = JSON.parse(JSON.stringify(res.data)) + echartsData.value = {} //icon图标替换legend图例 - const iconThree = - 'path://M512 85.333333c235.637333 0 426.666667 191.029333 426.666667 426.666667S747.637333 938.666667 512 938.666667 85.333333 747.637333 85.333333 512 276.362667 85.333333 512 85.333333z m214.592 318.677334a32 32 0 0 0-45.248 0.064L544.736 541.066667l-81.792-89.109334a32 32 0 0 0-46.613333-0.576l-119.36 123.733334a32 32 0 1 0 46.058666 44.437333l95.754667-99.264 81.418667 88.704a32 32 0 0 0 46.24 0.96l160.213333-160.693333a32 32 0 0 0-0.064-45.248z' - const iconDanger = - 'path://M1001.661867 796.544c48.896 84.906667 7.68 157.013333-87.552 157.013333H110.781867c-97.834667 0-139.050667-69.504-90.112-157.013333l401.664-666.88c48.896-87.552 128.725333-87.552 177.664 0l401.664 666.88zM479.165867 296.533333v341.333334a32 32 0 1 0 64 0v-341.333334a32 32 0 1 0-64 0z m0 469.333334v42.666666a32 32 0 1 0 64 0v-42.666666a32 32 0 1 0-64 0z' - let xAxis: any = [], - timeList: any = [] + // y轴单位数组 let unitList: any = [] - historyDataList.value.map((item: any) => { - timeList.push(item.time) - if (unitList.indexOf(item.unit) == -1) { - unitList.push(item.unit) + + let groupedData = chartsList.reduce((acc, item) => { + let key = item.anotherName; + if (!acc[key]) { + acc[key] = []; } - }) - xAxis = timeList.sort((a: any, b: any) => { - return new Date(a).getTime() - new Date(b).getTime() - }) - echartsData.value = { - options: { - title: [ - { - left: '10%', - top: 0, - text: chartTitle.value - } - ], - toolbox: { - feature: { - // saveAsImage: { - // title: '保存' - // }, - // dataView: { readOnly: false }, - // } - } - }, - tooltip: { - trigger: 'axis', - textStyle: { - color: '#fff', - fontStyle: 'normal', - opacity: 0.35, - fontSize: 14 - }, - backgroundColor: 'rgba(0,0,0,0.35)', - borderWidth: 0, - axisPointer: { - type: 'cross', - crossStyle: { - color: '#999' - } - }, - - formatter: function (params: any) { - let list = params.filter((item, index, self) => { - return index === self.findIndex(t => t.seriesName === item.seriesName) - }) - var res = - '' + - list[0].value[0] + - list[0].name + - '
' - for (var i = 0, l = list.length; i < l; i++) { - list[i].unit = - echartsData.value.options.yAxis[ - echartsData.value.options.series[list[i].seriesIndex].yAxisIndex - ]?.name - res += - list[i].seriesName + - ' ' + - `
` + - `
${list[i].value[1]==null?'':list[i].value[1].toFixed(2)} ${list[i].unit || ''}

` - } - return res - } - }, - - legend: { - //legend使用iconfont图标 - data: [], - itemWidth: 20, - itemHeight: 10, - itemGap: 15, - type: 'scroll', // 开启滚动分页 - // orient: 'vertical', // 垂直排列 - right: '3%', // 位置调整 - top: 0, - bottom: 20, - width: 430, - height: 50 - }, - - xAxis: { - type: 'time', - axisLabel: { - formatter: { - day: '{MM}-{dd}', - month: '{MM}', - year: '{yyyy}', - } - }, - }, - - // [ - // { - // type: 'category', - // name: '时间', - // axisLabel: { - // color: '#A9AEB2', - // fontSize: 12, - // show: function (index: any, value: any) { - // // 检查数据中是否存在这个时间点 - // // return data.some(item:any => item[0] === value) - // } - // }, - // nameTextStyle: { - // right: 0 - // }, - // data: Array.from(new Set(xAxis)), - // axisLine: { - // lineStyle: { - // color: '#43485E' - // } - // } - // } - // ], - yAxis: [ - { - type: 'value', - name: unitList[0], - axisLabel: { - color: '#000', - fontSize: 14 - }, - splitNumber: 5, - minInterval: 1, - axisTick: { - show: true - }, - axisLine: { - show: true, - lineStyle: { - color: colorList[0] - } - }, - nameTextStyle: { - color: '#000', - fontSize: '14' - }, - splitLine: { - show: false, - lineStyle: { - color: ['#43485E'], - width: 1, - type: 'solid' - } - } - } - ], - series: [] - } - } - //处理多y轴 - if (unitList.length != 0 && unitList.length > 1) { - // echartsData.value.options.yAxis[0].yAxisIndex = 0 - unitList.map((item: any, index: any) => { - if (index != unitList.length - 1) { - echartsData.value.options.yAxis.push({ - type: 'value', - position: 'right', - offset: index * 80, // y轴位置的偏移量 - name: unitList[index + 1], - axisLabel: { - color: '#000', - fontSize: 14 - }, - splitNumber: 5, - minInterval: 1, - axisTick: { - show: true - }, - axisLine: { - show: true, - lineStyle: { - color: colorList[index + 1] - } - }, - nameTextStyle: { - color: '#000', - fontSize: '14' - }, - splitLine: { - show: false, - lineStyle: { - color: ['#43485E'], - width: 1, - type: 'solid' - } - } - }) - } + acc[key].push(item); + return acc; + }, {}) + let result = Object.values(groupedData); + if (chartsList.length > 0) { + unitList = result.map((item: any) => { + return item[0].unit }) } - list.map((item: any, index: any) => { - item.map((vv: any, indexs: any) => { - //处理legend - if (historyDataList.value.length != 0) { - echartsData.value.options.legend.data.push({ - name: vv.phase + '相' + vv.showName, - icon: iconThree - }) - } - if ( - unitList.findIndex((item: any) => { - return item == vv.unit - }) != -1 - ) { - vv.yAxisIndex = unitList.findIndex((item: any) => { - return item == vv.unit - }) - } else { - vv.yAxisIndex = 0 - } + echartsData.value = { + legend: { + + itemWidth: 20, + itemHeight: 10, + itemGap: 15, + type: 'scroll', // 开启滚动分页 + // orient: 'vertical', // 垂直排列 + top: 5, + bottom: 30, + width: 400, + height: 50 + }, + tooltip: { + axisPointer: { + type: 'cross', + label: { + color: '#fff', + fontSize: 16 + } + }, + textStyle: { + color: '#fff', + fontStyle: 'normal', + opacity: 0.35, + fontSize: 14 + }, + backgroundColor: 'rgba(0,0,0,0.35)', + borderWidth: 0, + formatter(params) { + const xname = params[0].value[0]; + let str = `${xname}
`; + params.forEach((el, index) => { + str += `${el.marker}${el.seriesName.split('(')[0]}:${el.value[1]}${el.value[2]}
`; + }); + return str; + }, - //series数据 - echartsData.value.options.series.push({ - name: vv.phase + '相' + vv.showName, - type: 'line', - smooth: true, - symbol: 'none', - emphasis: { - focus: 'series' + + + + }, + color: ['#FFCC00', '#009900', '#CC0000', ...color], + xAxis: { + type: 'time', + axisLabel: { + formatter: { + day: '{MM}-{dd}', + month: '{MM}', + year: '{yyyy}' + } + } + }, + yAxis: [{ + + }], + + options: { + series: [ + + ] + } + } + if (chartsList.length > 0) { + echartsData.value.yAxis = [] + unitList.forEach((item: any, index: any) => { + let right = { + position: 'right', + offset: (index - 1) * 80, + } + echartsData.value.yAxis.push({ + name: item, + yAxisIndex: index, + splitNumber: 5, + minInterval: 1, + splitLine: { + show: false, + }, - itemStyle: {}, - //数据 - data: historyDataList.value - .map((kk: any) => { - if (kk.statisticalName == vv.name) { - - return [kk.time, kk.statisticalData] - } else { - return '' - } - }) - .filter((kk: any) => kk !== ''), - //数据对应的y轴 - // yAxisIndex:0, - yAxisIndex: vv.yAxisIndex + ...(index > 0 ? right : null) }) }) - }) - //设置数据项颜色 - echartsData.value.options.series.map((item: any, index: any) => { - item.itemStyle = { - normal: { - color: colorList[index], - lineStyle: { - color: colorList[index] + + result.forEach((item: any, index: any) => { + let yMethodList: any = [] + + let ABCList = Object.values(item.reduce((acc, item) => { + let key = item.phase; + if (!acc[key]) { + acc[key] = []; } - } - } - }) + acc[key].push(item); + return acc; + }, {})); + ABCList.forEach((kk: any,) => { + let seriesList: any = [] + kk.forEach((cc: any) => { + if (cc.statisticalData) { + yMethodList.push(cc.statisticalData?.toFixed(2) - 0) + + } + + seriesList.push([cc.time, cc.statisticalData?.toFixed(2),cc.unit]) + }) + + + echartsData.value.options.series.push({ + name: kk[0].phase + '相' + item[0].anotherName, + type: 'line', + smooth: true, + symbol: 'none', + data: seriesList, + yAxisIndex: index + + }) + + + }) + let [min, max] = yMethod(yMethodList) + echartsData.value.yAxis[index].min = min + echartsData.value.yAxis[index].max = max + + + + }) + } loading.value = false } }) diff --git a/src/views/govern/device/planData/index.vue b/src/views/govern/device/planData/index.vue index f595d72..457eed4 100644 --- a/src/views/govern/device/planData/index.vue +++ b/src/views/govern/device/planData/index.vue @@ -424,7 +424,15 @@ const init = (flag: boolean) => { fontSize: 14 }, backgroundColor: 'rgba(0,0,0,0.35)', - borderWidth: 0 + borderWidth: 0, + formatter(params) { + const xname = params[0].value[0]; + let str = `${xname}
`; + params.forEach((el, index) => { + str += `${el.marker}${el.seriesName.split('(')[0]}:${el.value[1]}${el.value[2]}
`; + }); + return str; + }, }, color: ['#FFCC00', '#009900', '#CC0000', ...color], xAxis: { @@ -448,66 +456,68 @@ const init = (flag: boolean) => { } } if (chartsList.length > 0) { - echartsData.value.yAxis=[] - unitList.forEach((item: any, index: any) => { - let right = { - position: 'right', - offset: (index - 1) * 80, - } - echartsData.value.yAxis.push({ - name: item, - yAxisIndex: index, - splitLine: { - show: false, - - }, - ...(index > 0 ? right : null) - }) - }) - - result.forEach((item: any, index: any) => { - let yMethodList: any = [] - - let ABCList = Object.values(item.reduce((acc, item) => { - let key = item.phase; - if (!acc[key]) { - acc[key] = []; + echartsData.value.yAxis = [] + unitList.forEach((item: any, index: any) => { + let right = { + position: 'right', + offset: (index - 1) * 80, } - acc[key].push(item); - return acc; - }, {})); - ABCList.forEach((kk: any,) => { - let seriesList: any = [] - kk.forEach((cc: any) => { - if (cc.statisticalData) { - yMethodList.push(cc.statisticalData?.toFixed(2) - 0) + echartsData.value.yAxis.push({ + name: item, + yAxisIndex: index, + splitNumber: 5, + minInterval: 1, + splitLine: { + show: false, + }, + ...(index > 0 ? right : null) + }) + }) + + result.forEach((item: any, index: any) => { + let yMethodList: any = [] + + let ABCList = Object.values(item.reduce((acc, item) => { + let key = item.phase; + if (!acc[key]) { + acc[key] = []; } + acc[key].push(item); + return acc; + }, {})); + ABCList.forEach((kk: any,) => { + let seriesList: any = [] + kk.forEach((cc: any) => { + if (cc.statisticalData) { + yMethodList.push(cc.statisticalData?.toFixed(2) - 0) - seriesList.push([cc.time, cc.statisticalData?.toFixed(2)]) - }) + } + + seriesList.push([cc.time, cc.statisticalData?.toFixed(2),cc.unit]) + }) - echartsData.value.options.series.push({ - name: kk[0].phase + '相' + item[0].anotherName, - type: 'line', - smooth: true, - symbol: 'none', - data: seriesList, - yAxisIndex: index + echartsData.value.options.series.push({ + name: kk[0].phase + '相' + item[0].anotherName, + type: 'line', + smooth: true, + symbol: 'none', + data: seriesList, + yAxisIndex: index + + }) + }) + let [min, max] = yMethod(yMethodList) + echartsData.value.yAxis[index].min = min + echartsData.value.yAxis[index].max = max + }) - let [min, max] = yMethod(yMethodList) - echartsData.value.yAxis[index].min = min - echartsData.value.yAxis[index].max = max - - - - }) - } + } // console.log("🚀 ~ .1111 ~ echartsData.value :", echartsData.value) diff --git a/src/views/govern/log/debug.vue b/src/views/govern/log/debug.vue index 54ae605..9039ee6 100644 --- a/src/views/govern/log/debug.vue +++ b/src/views/govern/log/debug.vue @@ -26,7 +26,11 @@ const tableStore = new TableStore({ column: [ { title: '设备名称', field: 'devName', align: 'center' }, { title: '操作用户', field: 'operatorName', align: 'center' }, - { title: '操作内容', field: 'processName', align: 'center', width: '300' }, + { + title: '操作内容', field: 'process', align: 'center', formatter: (row: any) => { + return row.cellValue == 1 ? '设备登记' : row.cellValue == 2 ? '功能调试' : row.cellValue == 3 ? '出厂调试' : row.cellValue == 4 ? '设备投运' : '' + } + }, { title: '开始时间', field: 'startTime', align: 'center' }, { title: '结束时间', field: 'endTime', align: 'center' } ], @@ -52,5 +56,5 @@ onMounted(() => { tableStore.index() }) -const addMenu = () => {} +const addMenu = () => { }