From 89d22e55c77723fa8a89f4772fbb5452a22564b6 Mon Sep 17 00:00:00 2001 From: zhongzm Date: Wed, 13 Nov 2024 16:56:15 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=85=B3=E9=94=AE=E6=8C=87=E6=A0=87?= =?UTF-8?q?=E5=9B=BE=E8=A1=A8=E7=95=8C=E9=9D=A2=E9=87=8D=E6=9E=84(grafana?= =?UTF-8?q?=E6=A0=87=E5=87=86)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/i18n/locales/en-US.ts | 3 + src/i18n/locales/zh-CN.ts | 3 + src/views/perfManage/kpiKeyTarget/index.vue | 838 +++++++++++--------- 3 files changed, 473 insertions(+), 371 deletions(-) diff --git a/src/i18n/locales/en-US.ts b/src/i18n/locales/en-US.ts index 3bca6233..78bf00e7 100644 --- a/src/i18n/locales/en-US.ts +++ b/src/i18n/locales/en-US.ts @@ -1084,6 +1084,9 @@ export default { expressionNoIdTip:'Please check the expression, no valid indicator is found', }, kpiKeyTarget:{ + "time":"Time", + "rawData":"Table Data", + "statistics":"NE metrics", "fullWidthLayout":"Full Width", "twoColumnLayout":"Two Column", "saveLayout": "Save Layout", diff --git a/src/i18n/locales/zh-CN.ts b/src/i18n/locales/zh-CN.ts index 5d1ba365..36ab6a14 100644 --- a/src/i18n/locales/zh-CN.ts +++ b/src/i18n/locales/zh-CN.ts @@ -1084,6 +1084,9 @@ export default { expressionNoIdTip:'请检查表达式,没有找到任何有效的指标', }, kpiKeyTarget:{ + "time":"时间", + "rawData":"表格数据", + "statistics":"指标", "fullWidthLayout":"全宽布局", "twoColumnLayout":"两列布局", "saveLayout": "保存布局", diff --git a/src/views/perfManage/kpiKeyTarget/index.vue b/src/views/perfManage/kpiKeyTarget/index.vue index 58e0a880..0b4def30 100644 --- a/src/views/perfManage/kpiKeyTarget/index.vue +++ b/src/views/perfManage/kpiKeyTarget/index.vue @@ -1,8 +1,7 @@ @@ -910,27 +903,23 @@ const applyTwoColumnLayout = () => { } .charts-container { - width: 100%; - min-height: 600px; -} - -.grid-item { - overflow: visible; - position: relative; -} - -.date-picker-wrapper { - position: absolute; - top: -40px; - left: 0; - right: 0; - z-index: 1; -} - -.card-container { - height: 100%; + padding: 16px; display: flex; flex-direction: column; + gap: 16px; +} + +.chart-card { + width: 100%; + height: 500px; + + :deep(.ant-card-body) { + height: calc(100% - 57px); // 减去卡片头部高度 + padding: 16px !important; + display: flex; + flex-direction: column; + overflow: hidden; + } } .card-header { @@ -938,9 +927,7 @@ const applyTwoColumnLayout = () => { justify-content: space-between; align-items: center; width: 100%; - cursor: move; - flex-wrap: wrap; /* 添加这行,允许内容换行 */ - gap: 8px; /* 添加这行,为换行时的元素之间添加间隔 */ + gap: 8px; } .card-title { @@ -954,9 +941,16 @@ const applyTwoColumnLayout = () => { } } -.chart { - flex: 1; - min-height: 0; +.card-content { + height: 100%; + display: flex; + gap: 16px; +} + +.chart-container { + flex: 3; + min-width: 0; + height: 100%; > div { width: 100%; @@ -964,52 +958,154 @@ const applyTwoColumnLayout = () => { } } -.switch-label { - margin-left: 8px; - font-size: 14px; - color: rgba(0, 0, 0, 0.65); - white-space: nowrap; -} - - - -:deep(.ant-card-body) { - flex: 1; +.table-container { + flex: 2; + min-width: 500px; + height: 100%; display: flex; flex-direction: column; - padding: 16px !important; - overflow: hidden; + + :deep(.ant-tabs) { + height: 100%; + display: flex; + flex-direction: column; + } + + :deep(.ant-tabs-content-holder) { + flex: 1; + overflow: hidden; + } + + :deep(.ant-tabs-content) { + height: 100%; + } + + :deep(.ant-tabs-tabpane) { + height: 100%; + overflow: hidden; + display: flex; + flex-direction: column; + } + + :deep(.ant-table-wrapper) { + flex: 1; + overflow: hidden; + display: flex; + flex-direction: column; + } + + :deep(.ant-spin-nested-loading) { + height: 100%; + } + + :deep(.ant-spin-container) { + height: 100%; + display: flex; + flex-direction: column; + } + + :deep(.ant-table) { + flex: 1; + overflow: hidden; + display: flex; + flex-direction: column; + } + + :deep(.ant-table-container) { + height: 100%; + display: flex; + flex-direction: column; + } + + :deep(.ant-table-header) { + flex-shrink: 0; + } + + :deep(.ant-table-body) { + flex: 1; + overflow-y: auto !important; + min-height: 0; + + &::-webkit-scrollbar { + width: 6px; + height: 6px; + } + + &::-webkit-scrollbar-thumb { + background: rgba(0, 0, 0, 0.2); + border-radius: 3px; + + &:hover { + background: rgba(0, 0, 0, 0.3); + } + } + + &::-webkit-scrollbar-track { + background: rgba(0, 0, 0, 0.05); + border-radius: 3px; + } + } } -:deep(.ant-form-item) { - margin-bottom: 0; +// 暗色主题下的滚动条样式 +[data-theme='dark'] { + :deep(.ant-table-body) { + &::-webkit-scrollbar-thumb { + background: rgba(255, 255, 255, 0.2); + + &:hover { + background: rgba(255, 255, 255, 0.3); + } + } + + &::-webkit-scrollbar-track { + background: rgba(255, 255, 255, 0.05); + } + } } -:deep(.ant-form-item-label) { - font-weight: 500; - color: rgba(0, 0, 0, 0.85); +// 表格交互样式 +:deep(.ant-table-tbody) { + tr { + cursor: pointer; + + &:hover > td { + background-color: rgba(24, 144, 255, 0.1); + } + + &.selected-row { + background-color: rgba(24, 144, 255, 0.1); + } + } } -:deep(.anticon) { - font-size: 16px; - color: #1890ff; +[data-theme='dark'] :deep(.selected-row) { + background-color: rgba(24, 144, 255, 0.2); } -:deep(.ant-select) { - min-width: 200px; -} +// 基础组件样式覆盖 +:deep { + .ant-form-item { + margin-bottom: 0; -:deep(.ant-card-head) { - padding: 8px 16px; /* 减小上下内边距 */ -} + &-label { + font-weight: 500; + color: rgba(0, 0, 0, 0.85); + } + } -:deep(.ant-card-head-title) { - padding: 8px 0; /* 减小上下内边距 */ - width: 100%; // 确保标题占据全宽 -} + .ant-card-head { + padding: 8px 16px; -:deep(.ant-range-picker) { - flex-shrink: 0; // 防止日期选择被压缩 - max-width: 100%; // 确保在小屏幕上不会溢出 + &-title { + padding: 8px 0; + width: 100%; + } + } + + .ant-range-picker { + flex-shrink: 0; + max-width: 100%; + } }