feat: 黄金指标项图表显示全部开关控制

This commit is contained in:
TsMask
2024-02-06 15:20:02 +08:00
parent 8d92f2a588
commit 93a736a897
3 changed files with 42 additions and 11 deletions

View File

@@ -718,6 +718,7 @@ export default {
time:'Time', time:'Time',
exportSure:'Confirm whether to export all statistical data', exportSure:'Confirm whether to export all statistical data',
exportEmpty: "Export data is empty", exportEmpty: "Export data is empty",
showChartSelected: "Show All",
} }
}, },
traceManage: { traceManage: {

View File

@@ -718,6 +718,7 @@ export default {
time:'时间', time:'时间',
exportSure:'确认是否导出全部统计数据', exportSure:'确认是否导出全部统计数据',
exportEmpty: "导出数据为空", exportEmpty: "导出数据为空",
showChartSelected: "显示全部",
} }
}, },
traceManage: { traceManage: {

View File

@@ -161,6 +161,8 @@ type StateType = {
/**网元类型 */ /**网元类型 */
neType: string[]; neType: string[];
/**图表标签选择 */ /**图表标签选择 */
chartLegendSelectedFlag: boolean;
/**图表标签选择 */
chartLegendSelected: Record<string, boolean>; chartLegendSelected: Record<string, boolean>;
/**图表配置数据 */ /**图表配置数据 */
chartOption: EChartsOption; chartOption: EChartsOption;
@@ -169,6 +171,7 @@ type StateType = {
/**对象信息状态 */ /**对象信息状态 */
let state: StateType = reactive({ let state: StateType = reactive({
neType: [], neType: [],
chartLegendSelectedFlag: false,
chartLegendSelected: {}, chartLegendSelected: {},
chartOption: { chartOption: {
tooltip: { tooltip: {
@@ -197,12 +200,7 @@ let state: StateType = reactive({
color: '#646A73', color: '#646A73',
}, },
icon: 'circle', icon: 'circle',
selected: { selected: {},
// 选中'系列1'
系列1: true,
// 不选中'系列2'
系列2: false,
},
}, },
grid: { grid: {
left: '10%', left: '10%',
@@ -224,10 +222,6 @@ let state: StateType = reactive({
}, },
}); });
function fnChangShowType() {
tableState.showTable = !tableState.showTable;
}
/** /**
* 数据列表导出 * 数据列表导出
*/ */
@@ -368,6 +362,11 @@ function fnGetList() {
}); });
} }
/**切换显示类型 图或表格 */
function fnChangShowType() {
tableState.showTable = !tableState.showTable;
}
/**绘制图表 */ /**绘制图表 */
function fnRanderChart() { function fnRanderChart() {
const container: HTMLElement | undefined = kpiChartDom.value; const container: HTMLElement | undefined = kpiChartDom.value;
@@ -429,7 +428,7 @@ function fnRanderChartData() {
data: [], data: [],
}); });
tableColumnsKeyArr.push(`${columns.key}`); tableColumnsKeyArr.push(`${columns.key}`);
chartLegendSelected[`${columns.title}`] = false; chartLegendSelected[`${columns.title}`] = state.chartLegendSelectedFlag;
} }
// 用降序就反转 // 用降序就反转
@@ -449,6 +448,7 @@ function fnRanderChartData() {
} }
} }
// console.log(queryParams.sortOrder, xDatas, yDatas); // console.log(queryParams.sortOrder, xDatas, yDatas);
// 图标签选择状态标记 // 图标签选择状态标记
state.chartLegendSelected = chartLegendSelected; state.chartLegendSelected = chartLegendSelected;
kpiChart.value.setOption({ kpiChart.value.setOption({
@@ -462,6 +462,21 @@ function fnRanderChartData() {
}); });
} }
/**图表折线显示全部 */
function fnLegendSelected(bool: any) {
const chartLegendSelected: Record<string, boolean> = {};
for (const key of Object.keys(state.chartLegendSelected)) {
chartLegendSelected[key] = bool;
}
// 图标签选择状态标记
state.chartLegendSelected = chartLegendSelected;
kpiChart.value.setOption({
legend: {
selected: chartLegendSelected,
},
});
}
onMounted(() => { onMounted(() => {
// 获取网元网元列表 // 获取网元网元列表
neInfoStore.fnNelist().then(res => { neInfoStore.fnNelist().then(res => {
@@ -662,6 +677,20 @@ onMounted(() => {
</a-dropdown> </a-dropdown>
</a-tooltip> </a-tooltip>
</a-space> </a-space>
<a-space :size="8" align="center" v-show="!tableState.showTable">
<a-tooltip>
<template #title>
{{ t('views.perfManage.goldTarget.showChartSelected') }}
</template>
<a-switch
:disabled="tableState.loading"
v-model:checked="state.chartLegendSelectedFlag"
:checked-children="t('common.switch.open')"
:un-checked-children="t('common.switch.shut')"
@change="fnLegendSelected"
/>
</a-tooltip>
</a-space>
</template> </template>
<!-- 表格列表 --> <!-- 表格列表 -->