From fca0867d1bd3f5f01c58ae4be8995724228818cc Mon Sep 17 00:00:00 2001 From: hanyuxia Date: Tue, 7 Jan 2020 17:12:48 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E6=96=B0=E5=A2=9E=E5=8A=9F=E8=83=BD=201.p?= =?UTF-8?q?anel=E5=9B=BE=E8=A1=A8=E7=9A=84=E8=A1=A8=E6=A0=BC=E5=B1=95?= =?UTF-8?q?=E7=A4=BA=E5=8A=9F=E8=83=BD=202.panel=E5=9B=BE=E8=A1=A8?= =?UTF-8?q?=E6=8C=89=E6=97=B6=E9=97=B4=E6=9F=A5=E8=AF=A2=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=EF=BC=88=E8=BF=9B=E8=A1=8C=E4=B8=AD=EF=BC=8C=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E4=BA=86=E6=97=B6=E9=97=B4=E9=80=89=E6=8B=A9=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=92=8C=E5=BF=AB=E6=8D=B7=E6=97=A5=E6=9C=9F=EF=BC=8C=E6=9C=AA?= =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E6=9F=A5=E8=AF=A2=E5=8A=9F=E8=83=BD=EF=BC=89?= =?UTF-8?q?=20fix:=E4=BF=AE=E6=94=B9BUG=201.panel=E5=9B=BE=E8=A1=A8?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=97=B6=EF=BC=8C=E5=88=A0=E9=99=A4=E7=AC=AC?= =?UTF-8?q?=E4=B8=80=E4=B8=AAmetric=E6=97=B6=EF=BC=8C=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E7=9A=84=E6=98=AF=E7=AC=AC=E4=BA=8C=E4=B8=AAmetric=202.panel?= =?UTF-8?q?=E5=9B=BE=E8=A1=A8=E6=96=B0=E5=A2=9E=E6=97=B6=E7=9A=84=E6=A0=87?= =?UTF-8?q?=E9=A2=98=E4=B8=BA=E7=BC=96=E8=BE=91=E6=97=B6=E7=9A=84=E6=A0=87?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/charts/chart-list.vue | 29 +++--- .../src/components/charts/chart-table.scss | 5 +- .../src/components/charts/chart-table.vue | 35 ++++--- .../src/components/common/language/cn.js | 17 ++++ .../src/components/common/language/en.js | 17 ++++ .../components/page/dashboard/chartBox.vue | 10 +- .../components/page/dashboard/chartMetric.vue | 24 ++++- .../src/components/page/dashboard/panel.vue | 99 ++++++++++++++++++- 8 files changed, 201 insertions(+), 35 deletions(-) diff --git a/nezha-fronted/src/components/charts/chart-list.vue b/nezha-fronted/src/components/charts/chart-list.vue index 7001239c9..f22b5357b 100644 --- a/nezha-fronted/src/components/charts/chart-list.vue +++ b/nezha-fronted/src/components/charts/chart-list.vue @@ -20,14 +20,14 @@ @on-edit-chart-block="editData" :panel-id="filter.panelId" :editChartId="'editChartId' + item.id"> - + @@ -36,7 +36,7 @@ import axios from 'axios'; //import bus from '../../libs/bus'; import lineChartBlock from './line-chart-block'; -//import chartTable from './chart-table'; +import chartTable from './chart-table'; export default { name: 'chartList', @@ -44,7 +44,7 @@ export default { }, components: { lineChartBlock, - //chartTable, + chartTable, }, data() { return { @@ -189,6 +189,7 @@ export default { seriesItem.theData.name = host; seriesItem.metric_name = seriesItem.theData.name; // 将秒改为毫秒 + //alert('table=='+JSON.stringify(queryItem)) seriesItem.theData.data = queryItem.values.map((dpsItem, dpsIndex) => { /*曲线汇总暂不需要 if (sumData.data[dpsIndex]) { @@ -198,15 +199,19 @@ export default { sumData.data[dpsIndex] = [dpsItem[0] * 1000, dpsItem[1]]; } */ + let t_date = new Date(dpsItem[0] * 1000); + let timeTmp = [t_date.getFullYear(), t_date.getMonth() + 1, t_date.getDate()].join('-') + "\n" + + [t_date.getHours(), t_date.getMinutes()].join(':'); + tableData.push({//表格数据 + label: host.slice(host.indexOf('{') + 1,host.indexOf('}')),//label + metric: queryItem.metric.__name__,//metric列 + time: timeTmp,//采集时间 + value: dpsItem[1],//数值 + }); return [dpsItem[0] * 1000, dpsItem[1]]; }); - tableData.push({//表格数据 - name: host.slice(host.indexOf(', ') + 1), - metric: queryItem.metric.__name__, - time: (dpsArr[dpsArr.length - 1][0]) * 1000, - value: dpsArr[dpsArr.length - 1][1], - }); series.push(seriesItem.theData); + } else if (chartItem.elements && chartItem.elements[innerPos]) { // 无数据提示 /* @@ -229,7 +234,7 @@ export default { this.filter.panelId, this.filter); } else if (chartItem.type === 'line' || chartItem.type === 'bar' || chartItem.type === 4) { if (series.length && chartItem.type === 4) {//曲线汇总 - series.push(sumData); + //series.push(sumData);//后续需要 } this.$refs.editChart[index].setData(chartItem, series, this.filter.panelId, this.filter,legend); diff --git a/nezha-fronted/src/components/charts/chart-table.scss b/nezha-fronted/src/components/charts/chart-table.scss index ae6382a9a..4fabbb24a 100644 --- a/nezha-fronted/src/components/charts/chart-table.scss +++ b/nezha-fronted/src/components/charts/chart-table.scss @@ -9,8 +9,9 @@ padding: 10px; margin-bottom: 10px; .table-title { - font-family: "Lucida Grande", "Lucida Sans Unicode", Arial, Helvetica, sans-serif; - font-size: 14px; + font-family: Arial; + font-size: 18px; + font-weight:bold; } .edit { // position: absolute; diff --git a/nezha-fronted/src/components/charts/chart-table.vue b/nezha-fronted/src/components/charts/chart-table.vue index 52abfdf62..35bb5c426 100644 --- a/nezha-fronted/src/components/charts/chart-table.vue +++ b/nezha-fronted/src/components/charts/chart-table.vue @@ -11,26 +11,34 @@
- - + + - - + + - - + + - - + +
-
+ + + + + + +
- +