diff --git a/src/views/perfManage/kpiCReport/index.vue b/src/views/perfManage/kpiCReport/index.vue index 291327b8..bac19e12 100644 --- a/src/views/perfManage/kpiCReport/index.vue +++ b/src/views/perfManage/kpiCReport/index.vue @@ -53,8 +53,6 @@ const route = useRoute(); const { t, currentLocale } = useI18n(); const ws = new WS(); - - echarts.use([ TooltipComponent, GridComponent, @@ -449,20 +447,19 @@ function fnGetList() { return item[columns.key] ? Number(item[columns.key]) : 0; }); - // 计算总值 - const total = Number(values.reduce((sum, val) => sum + val, 0).toFixed(2)); + const total = Number( + values.reduce((sum, val) => sum + val, 0).toFixed(2) + ); // 计算平均值 - const avg = values.length > 0 - ? Number((total / values.length).toFixed(2)) - : 0; + const avg = values.length > 0 ? Number((total / values.length).toFixed(2)) : 0; kpiStats.value.push({ kpiId: columns.key, title: columns.title, max: values.length > 0 ? Math.max(...values) : 0, min: values.length > 0 ? Math.min(...values) : 0, - avg + avg, }); } } @@ -487,16 +484,19 @@ function fnRanderChart() { return [pt[0], '10%']; }, confine: true, // 限制 tooltip 显示范围 - backgroundColor: document.documentElement.getAttribute('data-theme') === 'dark' - ? 'rgba(48, 48, 48, 0.8)' - : 'rgba(255, 255, 255, 0.9)', - borderColor: document.documentElement.getAttribute('data-theme') === 'dark' - ? '#555' - : '#ddd', + backgroundColor: + document.documentElement.getAttribute('data-theme') === 'dark' + ? 'rgba(48, 48, 48, 0.8)' + : 'rgba(255, 255, 255, 0.9)', + borderColor: + document.documentElement.getAttribute('data-theme') === 'dark' + ? '#555' + : '#ddd', textStyle: { - color: document.documentElement.getAttribute('data-theme') === 'dark' - ? '#CACADA' - : '#333' + color: + document.documentElement.getAttribute('data-theme') === 'dark' + ? '#CACADA' + : '#333', }, }, xAxis: { @@ -633,29 +633,31 @@ function fnRanderChartData() { type: 'category', boundaryGap: false, axisLabel: { - color: document.documentElement.getAttribute('data-theme') === 'dark' - ? '#CACADA' - : '#333' + color: + document.documentElement.getAttribute('data-theme') === 'dark' + ? '#CACADA' + : '#333', }, splitLine: { show: true, lineStyle: { - color: getSplitLineColor() - } + color: getSplitLineColor(), + }, }, data: chartDataXAxisData, }, yAxis: { axisLabel: { - color: document.documentElement.getAttribute('data-theme') === 'dark' - ? '#CACADA' - : '#333' + color: + document.documentElement.getAttribute('data-theme') === 'dark' + ? '#CACADA' + : '#333', }, splitLine: { show: true, lineStyle: { - color: getSplitLineColor() - } + color: getSplitLineColor(), + }, }, }, series: chartDataYSeriesData, @@ -784,59 +786,49 @@ function handleRowClick(record: any) { // 监听主题变化 watch( () => layoutStore.proConfig.theme, // 监听的值 - (newValue) => { + newValue => { if (kpiChart.value) { const splitLineColor = getSplitLineColor(); // 绘制图数据 - kpiChart.value.setOption( - { - tooltip: { - trigger: 'axis', - position: function (pt: any) { - return [pt[0], '10%']; - }, - confine: true, // 限制 tooltip 显示范围 - backgroundColor: newValue === 'dark' + kpiChart.value.setOption({ + tooltip: { + trigger: 'axis', + position: function (pt: any) { + return [pt[0], '10%']; + }, + confine: true, // 限制 tooltip 显示范围 + backgroundColor: + newValue === 'dark' ? 'rgba(48, 48, 48, 0.8)' : 'rgba(255, 255, 255, 0.9)', - borderColor: newValue === 'dark' - ? '#555' - : '#ddd', - textStyle: { - color: newValue === 'dark' - ? '#CACADA' - : '#333' + borderColor: newValue === 'dark' ? '#555' : '#ddd', + textStyle: { + color: newValue === 'dark' ? '#CACADA' : '#333', + }, + }, + xAxis: { + axisLabel: { + color: newValue === 'dark' ? '#CACADA' : '#333', + }, + splitLine: { + show: true, + lineStyle: { + color: splitLineColor, }, }, - xAxis: { - axisLabel: { - color: newValue === 'dark' - ? '#CACADA' - : '#333' - }, - splitLine: { - show: true, - lineStyle: { - color: splitLineColor - } - } + }, + yAxis: { + axisLabel: { + color: newValue === 'dark' ? '#CACADA' : '#333', }, - yAxis: { - axisLabel: { - color: newValue === 'dark' - ? '#CACADA' - : '#333' + splitLine: { + show: true, + lineStyle: { + color: splitLineColor, }, - splitLine: { - show: true, - lineStyle: { - color: splitLineColor - } - } - } - } - ); - + }, + }, + }); } } ); @@ -924,28 +916,50 @@ onBeforeUnmount(() => { - +
-
+
- + + +
diff --git a/src/views/perfManage/kpiKeyTarget/index.vue b/src/views/perfManage/kpiKeyTarget/index.vue index b36edb0c..012f96fe 100644 --- a/src/views/perfManage/kpiKeyTarget/index.vue +++ b/src/views/perfManage/kpiKeyTarget/index.vue @@ -1,8 +1,20 @@ @@ -882,7 +923,54 @@ const tableRowConfig = computed(() => { size="small" :loading="tableLoading" :custom-row="tableRowConfig" - /> + > + +
@@ -944,8 +1032,8 @@ const tableRowConfig = computed(() => { } /* 表格行和表头样式 */ -:deep(.ant-table-thead tr th), -:deep(.ant-table-tbody tr td) { +:deep(.ant-table-thead tr th), +:deep(.ant-table-tbody tr td) { padding: 8px; height: 40px; }