From 4826d981522023c37ee7b8ec6549ecd1a7018753 Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Fri, 16 Jul 2021 20:00:55 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=80=A7=E8=83=BD=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8E=8B=E5=8A=9B=E5=9B=BE=E8=A1=A8=E7=9A=84?= =?UTF-8?q?bug=20--bug=3D1005191=20--user=3D=E5=88=98=E7=91=9E=E6=96=8C=20?= =?UTF-8?q?=E3=80=90=E6=80=A7=E8=83=BD=E6=B5=8B=E8=AF=95-=E6=96=B0?= =?UTF-8?q?=E5=BB=BA=E6=80=A7=E8=83=BD=E6=B5=8B...=20https://www.tapd.cn/5?= =?UTF-8?q?5049933/s/1025683?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/PerformancePressureConfig.vue | 59 +++++++++++-------- 1 file changed, 36 insertions(+), 23 deletions(-) diff --git a/frontend/src/business/components/performance/test/components/PerformancePressureConfig.vue b/frontend/src/business/components/performance/test/components/PerformancePressureConfig.vue index f9a0f229b5..60fed48a87 100644 --- a/frontend/src/business/components/performance/test/components/PerformancePressureConfig.vue +++ b/frontend/src/business/components/performance/test/components/PerformancePressureConfig.vue @@ -419,13 +419,15 @@ export default { } }, calculateTotalChart() { + this.rampUpTimeVisible = false; + this.$nextTick(() => { + this.rampUpTimeVisible = true; + this._calculateTotalChart(); + }); + }, + _calculateTotalChart() { let handler = this; - if (handler.duration < handler.rampUpTime) { - handler.rampUpTime = handler.duration; - } - if (handler.rampUpTime < handler.step) { - handler.step = handler.rampUpTime; - } + let color = ['#60acfc', '#32d3eb', '#5bc49f', '#feb64d', '#ff7c7c', '#9287e7', '#ca8622', '#bda29a', '#6e7074', '#546570', '#c4ccd3']; handler.options = { color: color, @@ -444,23 +446,26 @@ export default { }; for (let i = 0; i < handler.threadGroups.length; i++) { - if (handler.threadGroups[i].enabled === 'false' || - handler.threadGroups[i].deleted === 'true' || - handler.threadGroups[i].threadType === 'ITERATION') { + let tg = handler.threadGroups[i]; + + if (tg.enabled === 'false' || + tg.deleted === 'true' || + tg.threadType === 'ITERATION') { continue; } + if (tg.duration < tg.rampUpTime) { + tg.rampUpTime = tg.duration; + } + if (tg.rampUpTime < tg.step) { + tg.step = tg.rampUpTime; + } let seriesData = { - name: handler.threadGroups[i].attributes.testname, + name: tg.attributes.testname, data: [], type: 'line', smooth: false, symbolSize: 5, showSymbol: false, - lineStyle: { - normal: { - width: 1 - } - }, areaStyle: { normal: { color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{ @@ -483,7 +488,6 @@ export default { }, }; - let tg = handler.threadGroups[i]; let timePeriod = Math.floor(tg.rampUpTime / tg.step); let timeInc = timePeriod; @@ -515,13 +519,15 @@ export default { seriesData.step = undefined; if (j === 0) { - seriesData.data.push([0, 0]); + seriesData.data.push(['0', 0]); } if (j >= tg.rampUpTime) { - xAxis.push(duration); + if (xAxis.indexOf(duration) < 0) { + xAxis.push(duration); + } - seriesData.data.push([j, tg.threadNumber]); - seriesData.data.push([duration, tg.threadNumber]); + seriesData.data.push([j + '', tg.threadNumber]); + seriesData.data.push([duration + '', tg.threadNumber]); break; } } else { @@ -537,16 +543,23 @@ export default { if (threadPeriod > tg.threadNumber) { threadPeriod = tg.threadNumber; // 预热结束 - xAxis.push(duration); - seriesData.data.push([duration, threadPeriod]); + if (xAxis.indexOf(duration) < 0) { + xAxis.push(duration); + } + + seriesData.data.push([j + '', threadPeriod]); + seriesData.data.push([duration + '', threadPeriod]); break; } } - seriesData.data.push([j, threadPeriod]); + seriesData.data.push([j + '', threadPeriod]); } } + // x 轴排序 + handler.options.xAxis.data = handler.options.xAxis.data.sort((a, b) => a - b); handler.options.series.push(seriesData); } + // console.log(JSON.stringify(handler.options)); }, validConfig() { if (!this.resourcePool) {