From 16c25ddf6badcd3f7f0ff91a4e5db6524211d195 Mon Sep 17 00:00:00 2001 From: GGJ <357021191@qq.com> Date: Wed, 11 Dec 2024 16:14:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E6=B5=B7=E5=8D=97?= =?UTF-8?q?=E6=B5=8B=E8=AF=95bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/echarts/MyEchart.vue | 14 +-- src/components/echarts/MyEchartMap.vue | 7 +- src/components/echarts/analytics.vue | 23 ++--- src/components/echarts/rmsboxi.vue | 38 +++---- src/components/echarts/shushiboxi.vue | 22 ++--- src/utils/echartMethod.ts | 67 +++++++++++++ .../evaluationList/components/charge.vue | 2 +- .../components/photovoltaic.vue | 98 ++++++++++++++----- .../evaluationList/components/policy.vue | 4 +- .../bearingCapacity/evaluationList/index.vue | 62 ++++++------ .../bearingCapacity/userManagement/index.vue | 9 +- .../area/SteadyState/components/charts.vue | 2 +- .../online/shishishuju/index.vue | 2 +- .../online/wentaishujufenxi/index.vue | 8 +- .../online/wentaizhibiaohegelv/index.vue | 12 +-- .../online/wentaizonghepinggu/index.vue | 14 +-- .../panorama/components/city/exceeded.vue | 21 ++-- .../components/details/steadyState.vue | 26 +++-- .../panorama/components/line/history.vue | 39 +++----- .../panorama/components/line/info.vue | 12 +-- .../eventStatistics/ITICquxianfenxi/index.vue | 11 +-- .../eventStatistics/SEMIF47fenxi/index.vue | 13 +-- .../chixushijiangailvfenbu/index.vue | 2 +- .../zanjiangfenbutongji/index.vue | 16 +-- .../zanjiangfuzhigailvfenbu/index.vue | 2 +- .../online/runningCondition/index.vue | 24 ++--- .../sagGovern/businessUser/event/sags3D.vue | 4 +- .../system/auth/department/popupForm.vue | 4 +- 28 files changed, 338 insertions(+), 220 deletions(-) create mode 100644 src/utils/echartMethod.ts diff --git a/src/components/echarts/MyEchart.vue b/src/components/echarts/MyEchart.vue index 63428b1f..e59645d6 100644 --- a/src/components/echarts/MyEchart.vue +++ b/src/components/echarts/MyEchart.vue @@ -62,7 +62,7 @@ const initChart = () => { opacity: 0.35, fontSize: 14 }, - backgroundColor: 'rgba(0,0,0,0.35)', + backgroundColor: 'rgba(0,0,0,0.55)', borderWidth: 0, confine: true, ...(props.options?.tooltip || null) @@ -74,15 +74,15 @@ const initChart = () => { saveAsImage: { title: '保存图片', }, - + ...(props.options?.toolbox?.featureProps || null) }, emphasis: { - iconStyle: { - borderColor: config.layout.elementUiPrimary[0], // 鼠标悬停时的边框颜色 - color: config.layout.elementUiPrimary[0] // 鼠标悬停时的图标颜色 - } - }, + iconStyle: { + borderColor: config.layout.elementUiPrimary[0], // 鼠标悬停时的边框颜色 + color: config.layout.elementUiPrimary[0] // 鼠标悬停时的图标颜色 + } + }, // }, ...(props.options?.toolbox || null) }, diff --git a/src/components/echarts/MyEchartMap.vue b/src/components/echarts/MyEchartMap.vue index 9267afe4..22662e96 100644 --- a/src/components/echarts/MyEchartMap.vue +++ b/src/components/echarts/MyEchartMap.vue @@ -26,7 +26,7 @@ const fetchConfig = async (name: string) => { // fetchConfig() const emit = defineEmits(['getRegionByRegion', 'eliminate', 'clickMap']) -onMounted(() => {}) +onMounted(() => { }) const GetEchar = async (name: string) => { let chartDom = document.getElementById('chartMap') @@ -57,7 +57,7 @@ const GetEchar = async (name: string) => { opacity: 0.35, fontSize: 14 }, - backgroundColor: 'rgba(0,0,0,0.35)', + backgroundColor: 'rgba(0,0,0,0.55)', ...(props.options.tooltip || null) }, @@ -187,7 +187,7 @@ const GetEchar = async (name: string) => { } } }) - + } const MapReturn = (name: string) => { @@ -232,6 +232,7 @@ watch( width: 100%; height: 100%; } + .iconfont { cursor: pointer; position: absolute; diff --git a/src/components/echarts/analytics.vue b/src/components/echarts/analytics.vue index be962615..48957cfc 100644 --- a/src/components/echarts/analytics.vue +++ b/src/components/echarts/analytics.vue @@ -6,14 +6,8 @@ - + @@ -31,12 +25,7 @@ - + @@ -99,7 +88,7 @@ export default { zoom: '' } }, - created() {}, + created() { }, watch: { value: function (a, b) { if (a == 2) { @@ -244,10 +233,10 @@ export default { opacity: 0.35, fontSize: 14 }, - backgroundColor: 'rgba(0,0,0,0.35)', + backgroundColor: 'rgba(0,0,0,0.55)', borderWidth: 0 }, - + title: { left: 'center', text: '发生时刻:' + this.boxoList.startTime + ' PT变化:' + this.boxoList.measurementPointName, diff --git a/src/components/echarts/rmsboxi.vue b/src/components/echarts/rmsboxi.vue index 88c0621e..9420ddcc 100644 --- a/src/components/echarts/rmsboxi.vue +++ b/src/components/echarts/rmsboxi.vue @@ -118,7 +118,7 @@ export default { backbxlb() { if (this.echartlist.length > 0) { - + this.waveDatas = [] this.echartlist.forEach(item => { item.dispose(); // 销毁echarts实例 @@ -205,7 +205,7 @@ export default { " 发生时刻:" + this.boxoList.startTime + " 暂降(骤升)幅值:" + - (this.boxoList.featureAmplitude * 100).toFixed(0) + + (this.boxoList.featureAmplitude * 1).toFixed(0) + "% 持续时间:" + this.boxoList.duration + "s"; @@ -231,7 +231,7 @@ export default { " 发生时刻:" + this.boxoList.startTime + " 暂降(骤升)幅值:" + - (this.boxoList.featureAmplitude * 100).toFixed(0) + + (this.boxoList.featureAmplitude * 1).toFixed(0) + "% 持续时间:" + this.boxoList.duration + "s"; @@ -672,10 +672,10 @@ export default { let cu = null, rmscu = null, rmscm = null, - title =null, - unit =null, - max =null, - min=null; + title = null, + unit = null, + max = null, + min = null; let a = null, b = "", c = ""; @@ -871,7 +871,7 @@ export default { " 发生时刻:" + this.time + " 暂降(骤升)幅值:" + - (this.eventValue * 100).toFixed(0) + + (this.eventValue * 1).toFixed(0) + "% 持续时间:" + this.persistTime + "s"; @@ -920,7 +920,7 @@ export default { opacity: 0.35, fontSize: 14, }, - backgroundColor: "rgba(0,0,0,0.35)", + backgroundColor: "rgba(0,0,0,0.55)", borderWidth: 0, }, title: { @@ -1191,13 +1191,13 @@ export default { b = "", c = ""; let max, min, unit; - let adata =null, - bdata =null, - cdata =null; - let radata =null, - rbdata =null, - rcdata =null; - let colors =[]; + let adata = null, + bdata = null, + cdata = null; + let radata = null, + rbdata = null, + rcdata = null; + let colors = []; switch (this.iphasic) { case 1: a = waveDataTemp.title.aTitle; @@ -1255,12 +1255,12 @@ export default { let myChartes = echarts.init(document.getElementById(rmsId)); //debugger - let titlename = '' + let titlename = '' if (this.boxoList.systemType == "ZL") { let str = [] str = rmsId.split('s') let str1 = Number(str[1]) - + this.wp.channelNames.forEach((element, i) => { if (i == 4 || i == 7 || i == 10) { if (str1 == 1 && i == 4) { @@ -1341,7 +1341,7 @@ export default { opacity: 0.35, fontSize: 14, }, - backgroundColor: "rgba(0,0,0,0.35)", + backgroundColor: "rgba(0,0,0,0.55)", borderWidth: 0, }, title: { diff --git a/src/components/echarts/shushiboxi.vue b/src/components/echarts/shushiboxi.vue index 5f22cc73..09e1cdad 100644 --- a/src/components/echarts/shushiboxi.vue +++ b/src/components/echarts/shushiboxi.vue @@ -106,19 +106,19 @@ export default { methods: { backbxlb() { - if (this.echartlist.length>0) { + if (this.echartlist.length > 0) { console.log(123111); this.waveDatas = [] this.echartlist.forEach(item => { item.dispose(); // 销毁echarts实例 - + }) - - + + } }, - download() { + download() { // 转换成canvas html2canvas(document.getElementById('boxsj'), { scale: 2 @@ -163,7 +163,7 @@ export default { ' 发生时刻:' + this.boxoList.startTime + ' 暂降(骤升)幅值:' + - (this.boxoList.featureAmplitude * 100).toFixed(0) + + (this.boxoList.featureAmplitude * 1).toFixed(0) + '% 持续时间:' + this.boxoList.duration + 's' @@ -189,7 +189,7 @@ export default { ' 发生时刻:' + this.boxoList.startTime + ' 暂降(骤升)幅值:' + - (this.boxoList.featureAmplitude * 100).toFixed(0) + + (this.boxoList.featureAmplitude * 1).toFixed(0) + '% 持续时间:' + this.boxoList.duration + 's' @@ -406,7 +406,7 @@ export default { }, //开始画图 initWave(waveDatas, time, type, severity, isOpen) { - this.echartlist=[] + this.echartlist = [] //清除之前增加的div // $("#wave ~ .bx1").remove(); $('div.bx1').remove() @@ -539,7 +539,7 @@ export default { ' 发生时刻:' + this.time + ' 暂降(骤升)幅值:' + - (this.eventValue * 100).toFixed(0) + + (this.eventValue * 1).toFixed(0) + '% 持续时间:' + this.persistTime + 's' @@ -592,7 +592,7 @@ export default { opacity: 0.35, fontSize: 14 }, - backgroundColor: 'rgba(0,0,0,0.35)', + backgroundColor: 'rgba(0,0,0,0.55)', borderWidth: 0 }, title: { @@ -946,7 +946,7 @@ export default { opacity: 0.35, fontSize: 14 }, - backgroundColor: 'rgba(0,0,0,0.35)', + backgroundColor: 'rgba(0,0,0,0.55)', borderWidth: 0 }, title: { diff --git a/src/utils/echartMethod.ts b/src/utils/echartMethod.ts new file mode 100644 index 00000000..a3c9d0f2 --- /dev/null +++ b/src/utils/echartMethod.ts @@ -0,0 +1,67 @@ +const dataProcessing = (arr: any[]) => { + return arr + .filter(item => typeof item === 'number' || (typeof item === 'string' && !isNaN(parseFloat(item)))) + .map(item => (typeof item === 'number' ? item : parseFloat(item))) +} + +// 处理y轴最大最小值 +export const yMethod = (arr: any) => { + let numList = dataProcessing(arr) + let maxValue = 0 + let minValue = 0 + let max = 0 + let min = 0 + maxValue = Math.max(...numList) + minValue = Math.min(...numList) + if (maxValue > 1000 || minValue < -1000) { + max = Math.ceil(maxValue / 100) * 100 + if (minValue == 0) { + min = 0 + } else { + min = Math.floor(minValue / 100) * 100 + } + } else if (maxValue == minValue && maxValue < 10 && minValue > 0) { + max = Math.ceil(maxValue / 10) * 10 + min = Math.floor(minValue / 10) * 10 + } else if (maxValue == minValue && maxValue != 0 && minValue != 0) { + max = Math.ceil(maxValue / 10 + 1) * 10 + min = Math.floor(minValue / 10 - 1) * 10 + } else { + max = Math.ceil(maxValue / 10) * 10 + min = Math.floor(minValue / 10) * 10 + } + + if (maxValue > 0 && maxValue < 1) { + max = 1 + } else if (max == 0 && minValue > -1 && minValue < 0) { + min = -1 + } + return [min, max] +} + +/** + * title['A相','B相',] + * data[[1,2],[3,4]] + */ +// 导出csv文件 +const convertToCSV = (title: object, data: any) => { + console.log('🚀 ~ convertToCSV ~ data:', data) + let csv = '' + // 添加列头 + csv += ',' + title.join(',') + '\n' + // 遍历数据并添加到CSV字符串中 + data?.map(item => { + csv += item.join(',') + '\n' + }) + return csv +} +export const exportCSV = (title: object, data: any, filename: string) => { + const csv = convertToCSV(title, data) + const blob = new Blob([csv], { type: 'text/csv;charset=utf-8;' }) + const link = document.createElement('a') + link.href = URL.createObjectURL(blob) + link.download = filename + link.click() + // 释放URL对象 + URL.revokeObjectURL(link.href) +} diff --git a/src/views/pqs/bearingCapacity/evaluationList/components/charge.vue b/src/views/pqs/bearingCapacity/evaluationList/components/charge.vue index a8279940..eb67bd77 100644 --- a/src/views/pqs/bearingCapacity/evaluationList/components/charge.vue +++ b/src/views/pqs/bearingCapacity/evaluationList/components/charge.vue @@ -369,7 +369,7 @@ const rendering = (row: any) => { yAxis: { show: false }, - color: ['#77DA63', '#00BFF5', '#FFBF00', '#Ff6600', '#ff0000', '#07CCCA'], + color: ['#339966', '#00BFF5', '#FFBF00', '#Ff6600', '#ff0000', '#07CCCA'], dataZoom: { show: false }, series: [ { diff --git a/src/views/pqs/bearingCapacity/evaluationList/components/photovoltaic.vue b/src/views/pqs/bearingCapacity/evaluationList/components/photovoltaic.vue index 5b594e01..d6c98843 100644 --- a/src/views/pqs/bearingCapacity/evaluationList/components/photovoltaic.vue +++ b/src/views/pqs/bearingCapacity/evaluationList/components/photovoltaic.vue @@ -15,7 +15,8 @@ 查询 导出模板 - + 离线导入