feat:kpi图表隐藏按钮添加
This commit is contained in:
@@ -43,7 +43,7 @@ import saveAs from 'file-saver';
|
|||||||
import { generateColorRGBA } from '@/utils/generate-utils';
|
import { generateColorRGBA } from '@/utils/generate-utils';
|
||||||
import { OptionsType, WS } from '@/plugins/ws-websocket';
|
import { OptionsType, WS } from '@/plugins/ws-websocket';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { LineOutlined, InfoCircleOutlined } from '@ant-design/icons-vue';
|
import { LineOutlined, InfoCircleOutlined, EyeOutlined, EyeInvisibleOutlined } from '@ant-design/icons-vue';
|
||||||
import useLayoutStore from '@/store/modules/layout';
|
import useLayoutStore from '@/store/modules/layout';
|
||||||
import { SelectValue } from 'ant-design-vue/es/select';
|
import { SelectValue } from 'ant-design-vue/es/select';
|
||||||
import type { DefaultOptionType } from 'ant-design-vue/es/select';
|
import type { DefaultOptionType } from 'ant-design-vue/es/select';
|
||||||
@@ -185,6 +185,9 @@ let tableState: TabeStateType = reactive({
|
|||||||
/**统计表格loading状态 */
|
/**统计表格loading状态 */
|
||||||
const statsTableLoading = ref(false);
|
const statsTableLoading = ref(false);
|
||||||
|
|
||||||
|
/**图表显示状态 */
|
||||||
|
const isChartVisible = ref(true);
|
||||||
|
|
||||||
/**表格紧凑型变更操作 */
|
/**表格紧凑型变更操作 */
|
||||||
function fnTableSize({ key }: MenuInfo) {
|
function fnTableSize({ key }: MenuInfo) {
|
||||||
tableState.size = key as SizeType;
|
tableState.size = key as SizeType;
|
||||||
@@ -1016,6 +1019,17 @@ function fnChangShowType() {
|
|||||||
tableState.showTable = !tableState.showTable;
|
tableState.showTable = !tableState.showTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**切换图表显示状态 */
|
||||||
|
function toggleChartVisibility() {
|
||||||
|
isChartVisible.value = !isChartVisible.value;
|
||||||
|
// 当图表重新显示时,需要重新调整大小
|
||||||
|
if (isChartVisible.value && kpiChart.value) {
|
||||||
|
nextTick(() => {
|
||||||
|
kpiChart.value?.resize();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**绘制图表 */
|
/**绘制图表 */
|
||||||
function fnRanderChart() {
|
function fnRanderChart() {
|
||||||
const container: HTMLElement | undefined = kpiChartDom.value; //获取图表容器DOM元素
|
const container: HTMLElement | undefined = kpiChartDom.value; //获取图表容器DOM元素
|
||||||
@@ -1749,6 +1763,17 @@ onBeforeUnmount(() => {
|
|||||||
size="small"
|
size="small"
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
<a-button
|
||||||
|
v-show="!tableState.showTable"
|
||||||
|
type="link"
|
||||||
|
ghost
|
||||||
|
@click="toggleChartVisibility"
|
||||||
|
class="chart-toggle-btn"
|
||||||
|
:title="isChartVisible ? 'hide' : 'show'"
|
||||||
|
>
|
||||||
|
<EyeOutlined v-if="isChartVisible" />
|
||||||
|
<EyeInvisibleOutlined v-else />
|
||||||
|
</a-button>
|
||||||
</a-form>
|
</a-form>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -1780,6 +1805,7 @@ onBeforeUnmount(() => {
|
|||||||
ref="kpiChartDom"
|
ref="kpiChartDom"
|
||||||
class="chart-container"
|
class="chart-container"
|
||||||
style="height: 450px; width: 100%"
|
style="height: 450px; width: 100%"
|
||||||
|
:style="{ display: isChartVisible ? 'block' : 'none' }"
|
||||||
></div>
|
></div>
|
||||||
|
|
||||||
<div class="table-container">
|
<div class="table-container">
|
||||||
@@ -1882,6 +1908,12 @@ onBeforeUnmount(() => {
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 图表隐藏时,表格容器的高度调整 */
|
||||||
|
.chart-container[style*="display: none"] + .table-container {
|
||||||
|
height: 500px;
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* 表格布局相关样式 */
|
/* 表格布局相关样式 */
|
||||||
:deep(.ant-table-wrapper),
|
:deep(.ant-table-wrapper),
|
||||||
:deep(.ant-table),
|
:deep(.ant-table),
|
||||||
@@ -1942,4 +1974,9 @@ onBeforeUnmount(() => {
|
|||||||
:deep(.ant-table-tbody tr:hover) {
|
:deep(.ant-table-tbody tr:hover) {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 图表切换按钮样式 */
|
||||||
|
.chart-toggle-btn {
|
||||||
|
margin-left: 8px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ import { writeSheet } from '@/utils/execl-utils';
|
|||||||
import saveAs from 'file-saver';
|
import saveAs from 'file-saver';
|
||||||
import { generateColorRGBA } from '@/utils/generate-utils';
|
import { generateColorRGBA } from '@/utils/generate-utils';
|
||||||
import { OptionsType, WS } from '@/plugins/ws-websocket';
|
import { OptionsType, WS } from '@/plugins/ws-websocket';
|
||||||
import { LineOutlined, InfoCircleOutlined } from '@ant-design/icons-vue';
|
import { LineOutlined, InfoCircleOutlined, EyeOutlined, EyeInvisibleOutlined } from '@ant-design/icons-vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import dayjs, { Dayjs } from 'dayjs';
|
import dayjs, { Dayjs } from 'dayjs';
|
||||||
import useLayoutStore from '@/store/modules/layout';
|
import useLayoutStore from '@/store/modules/layout';
|
||||||
@@ -243,6 +243,9 @@ const kpiStats: any = ref([]);
|
|||||||
// 统计表格loading状态
|
// 统计表格loading状态
|
||||||
const statsTableLoading = ref(false);
|
const statsTableLoading = ref(false);
|
||||||
|
|
||||||
|
/**图表显示状态 */
|
||||||
|
const isChartVisible = ref(true);
|
||||||
|
|
||||||
// 添加一个函数来获取当前主题下的网格线颜色
|
// 添加一个函数来获取当前主题下的网格线颜色
|
||||||
function getSplitLineColor() {
|
function getSplitLineColor() {
|
||||||
return document.documentElement.getAttribute('data-theme') === 'dark'
|
return document.documentElement.getAttribute('data-theme') === 'dark'
|
||||||
@@ -653,6 +656,17 @@ function fnChangShowType() {
|
|||||||
tableState.showTable = !tableState.showTable;
|
tableState.showTable = !tableState.showTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**切换图表显示状态 */
|
||||||
|
function toggleChartVisibility() {
|
||||||
|
isChartVisible.value = !isChartVisible.value;
|
||||||
|
// 当图表重新显示时,需要重新调整大小
|
||||||
|
if (isChartVisible.value && kpiChart.value) {
|
||||||
|
nextTick(() => {
|
||||||
|
kpiChart.value?.resize();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**绘制图表 */
|
/**绘制图表 */
|
||||||
function fnRanderChart() {
|
function fnRanderChart() {
|
||||||
const container: HTMLElement | undefined = kpiChartDom.value;
|
const container: HTMLElement | undefined = kpiChartDom.value;
|
||||||
@@ -1278,6 +1292,17 @@ onBeforeUnmount(() => {
|
|||||||
size="small"
|
size="small"
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
<a-button
|
||||||
|
v-show="!tableState.showTable"
|
||||||
|
type="link"
|
||||||
|
ghost
|
||||||
|
@click="toggleChartVisibility"
|
||||||
|
class="chart-toggle-btn"
|
||||||
|
:title="isChartVisible ? 'hide' : 'show'"
|
||||||
|
>
|
||||||
|
<EyeOutlined v-if="isChartVisible" />
|
||||||
|
<EyeInvisibleOutlined v-else />
|
||||||
|
</a-button>
|
||||||
</a-form>
|
</a-form>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -1304,6 +1329,7 @@ onBeforeUnmount(() => {
|
|||||||
ref="kpiChartDom"
|
ref="kpiChartDom"
|
||||||
class="chart-container"
|
class="chart-container"
|
||||||
style="height: 450px; width: 100%"
|
style="height: 450px; width: 100%"
|
||||||
|
:style="{ display: isChartVisible ? 'block' : 'none' }"
|
||||||
></div>
|
></div>
|
||||||
|
|
||||||
<div class="table-container">
|
<div class="table-container">
|
||||||
@@ -1343,6 +1369,12 @@ onBeforeUnmount(() => {
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 图表隐藏时,表格容器的高度调整 */
|
||||||
|
.chart-container[style*="display: none"] + .table-container {
|
||||||
|
height: 500px;
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* 表格布局相关样式 */
|
/* 表格布局相关样式 */
|
||||||
:deep(.ant-table-wrapper),
|
:deep(.ant-table-wrapper),
|
||||||
:deep(.ant-table),
|
:deep(.ant-table),
|
||||||
@@ -1403,4 +1435,9 @@ onBeforeUnmount(() => {
|
|||||||
:deep(.ant-table-tbody tr:hover) {
|
:deep(.ant-table-tbody tr:hover) {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 图表切换按钮样式 */
|
||||||
|
.chart-toggle-btn {
|
||||||
|
margin-left: 8px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import type { Dayjs } from 'dayjs';
|
|||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import { OptionsType, WS } from '@/plugins/ws-websocket';
|
import { OptionsType, WS } from '@/plugins/ws-websocket';
|
||||||
import { generateColorRGBA } from '@/utils/generate-utils';
|
import { generateColorRGBA } from '@/utils/generate-utils';
|
||||||
import { LineOutlined, InfoCircleOutlined } from '@ant-design/icons-vue';
|
import { LineOutlined, InfoCircleOutlined, EyeOutlined, EyeInvisibleOutlined } from '@ant-design/icons-vue';
|
||||||
import { TableColumnType } from 'ant-design-vue';
|
import { TableColumnType } from 'ant-design-vue';
|
||||||
import useNeInfoStore from '@/store/modules/neinfo';
|
import useNeInfoStore from '@/store/modules/neinfo';
|
||||||
const { t, currentLocale } = useI18n();
|
const { t, currentLocale } = useI18n();
|
||||||
@@ -109,6 +109,8 @@ const dateRange = ref<[string, string]>([
|
|||||||
]);
|
]);
|
||||||
//实时数据状态
|
//实时数据状态
|
||||||
const isRealtime = ref(false);
|
const isRealtime = ref(false);
|
||||||
|
//图表显示状态
|
||||||
|
const isChartVisible = ref(true);
|
||||||
//图表数据响应式数组
|
//图表数据响应式数组
|
||||||
const chartData = ref<ChartDataItem[]>([]);
|
const chartData = ref<ChartDataItem[]>([]);
|
||||||
|
|
||||||
@@ -140,6 +142,17 @@ const toggleRealtime = () => {
|
|||||||
fnRealTimeSwitch(isRealtime.value);
|
fnRealTimeSwitch(isRealtime.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//切换图表显示状态
|
||||||
|
const toggleChartVisibility = () => {
|
||||||
|
isChartVisible.value = !isChartVisible.value;
|
||||||
|
// 当图表重新显示时,需要重新调整大小
|
||||||
|
if (isChartVisible.value && chart) {
|
||||||
|
nextTick(() => {
|
||||||
|
chart?.resize();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// 定义要筛选的指标 ID,按网元类型组织
|
// 定义要筛选的指标 ID,按网元类型组织
|
||||||
const TARGET_KPI_IDS: Record<NeType, string[]> = {
|
const TARGET_KPI_IDS: Record<NeType, string[]> = {
|
||||||
AMF: ['AMF.02', 'AMF.03'],
|
AMF: ['AMF.02', 'AMF.03'],
|
||||||
@@ -1168,9 +1181,23 @@ const tableRowConfig = computed(() => {
|
|||||||
>
|
>
|
||||||
<a-switch v-model:checked="isRealtime" @change="toggleRealtime" />
|
<a-switch v-model:checked="isRealtime" @change="toggleRealtime" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
<a-button
|
||||||
|
type="link"
|
||||||
|
ghost
|
||||||
|
@click="toggleChartVisibility"
|
||||||
|
class="chart-toggle-btn"
|
||||||
|
:title="isChartVisible ? 'hide' : 'show'"
|
||||||
|
>
|
||||||
|
<EyeOutlined v-if="isChartVisible" />
|
||||||
|
<EyeInvisibleOutlined v-else />
|
||||||
|
</a-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="chart-wrapper">
|
<div class="chart-wrapper">
|
||||||
<div id="chartContainer" class="chart-container"></div>
|
<div
|
||||||
|
id="chartContainer"
|
||||||
|
class="chart-container"
|
||||||
|
:style="{ display: isChartVisible ? 'block' : 'none' }"
|
||||||
|
></div>
|
||||||
<div class="table-container">
|
<div class="table-container">
|
||||||
<a-table
|
<a-table
|
||||||
:columns="statsColumns"
|
:columns="statsColumns"
|
||||||
@@ -1229,6 +1256,12 @@ const tableRowConfig = computed(() => {
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 图表隐藏时,表格容器的高度调整 */
|
||||||
|
.chart-wrapper:has(.chart-container[style*="display: none"]) .table-container {
|
||||||
|
height: 500px;
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* 表格布局相关样式 */
|
/* 表格布局相关样式 */
|
||||||
:deep(.ant-table-wrapper),
|
:deep(.ant-table-wrapper),
|
||||||
:deep(.ant-table),
|
:deep(.ant-table),
|
||||||
@@ -1309,4 +1342,9 @@ const tableRowConfig = computed(() => {
|
|||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 图表切换按钮样式 */
|
||||||
|
.chart-toggle-btn {
|
||||||
|
margin-left: 8px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user