🔨 修改前端逻辑.
This commit is contained in:
@@ -176,7 +176,9 @@ export function getMonitorHostOverride(agentKey: string) {
|
||||
* 查询监控主机图表
|
||||
*/
|
||||
export function getMonitorHostChart(request: MonitorHostChartRequest) {
|
||||
return axios.post<Array<TimeChartSeries>>('/monitor/monitor-host/chart', request);
|
||||
return axios.post<Array<TimeChartSeries>>('/monitor/monitor-host/chart', request, {
|
||||
timeout: 180000,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="full">
|
||||
<div v-if="render" class="full">
|
||||
<!-- 消息分类 -->
|
||||
<a-spin class="message-classify-container"
|
||||
:hide-icon="true"
|
||||
@@ -90,6 +90,7 @@
|
||||
const classifyCount = ref<Record<string, number>>({});
|
||||
const messageList = ref<Array<MessageRecordResponse>>([]);
|
||||
const hasMore = ref(true);
|
||||
const render = ref(false);
|
||||
|
||||
// 重新加载消息
|
||||
const reloadAllMessage = async () => {
|
||||
@@ -210,8 +211,9 @@
|
||||
};
|
||||
|
||||
// 加载字典值
|
||||
onMounted(() => {
|
||||
loadKeys(dictKeys);
|
||||
onMounted(async () => {
|
||||
await loadKeys(dictKeys);
|
||||
render.value = true;
|
||||
});
|
||||
|
||||
// 获取消息
|
||||
|
||||
@@ -3,8 +3,28 @@ import type { DictState } from './types';
|
||||
import type { Options } from '@/types/global';
|
||||
import { defineStore } from 'pinia';
|
||||
import { getDictValueList } from '@/api/system/dict-value';
|
||||
import { isArray } from '@/utils/is';
|
||||
|
||||
export const ALL_OPTION: Options = { label: '全部', value: '' };
|
||||
const AllOption: Options = { label: '全部', value: '' };
|
||||
|
||||
// 获取拼接的选项
|
||||
const getPrependOptions = (perpendOption: boolean | Options | Options[] | RadioOption | RadioOption[]): Options[] => {
|
||||
if (!perpendOption) {
|
||||
return [];
|
||||
}
|
||||
if (perpendOption === true) {
|
||||
// 默认选项
|
||||
return [{ ...AllOption }];
|
||||
} else if (isArray(perpendOption)) {
|
||||
// 数组选项
|
||||
return perpendOption.map(s => {
|
||||
return { ...s } as Options;
|
||||
});
|
||||
} else {
|
||||
// 单一选项
|
||||
return [{ ...perpendOption as Options }];
|
||||
}
|
||||
};
|
||||
|
||||
export default defineStore('dict', {
|
||||
state: (): DictState => ({}),
|
||||
@@ -27,38 +47,30 @@ export default defineStore('dict', {
|
||||
},
|
||||
|
||||
// 获取字典选项
|
||||
toOptions(key: string, firstOption: boolean | Record<string, any> = false): Options[] {
|
||||
if (firstOption === true) {
|
||||
return [{ ...ALL_OPTION }, ...this.$state[key]];
|
||||
} else if (firstOption) {
|
||||
return [{ ...ALL_OPTION, ...firstOption }, ...this.$state[key]];
|
||||
} else {
|
||||
return this.$state[key];
|
||||
}
|
||||
toOptions(key: string, perpendOption: boolean | Options | Options[] = false): Options[] {
|
||||
let perpendOptions = getPrependOptions(perpendOption);
|
||||
const options = this.$state[key] ?? [];
|
||||
return [...perpendOptions, ...options];
|
||||
},
|
||||
|
||||
// 转为 unref 的字典选项
|
||||
toUnrefOptions(key: string, firstOption: boolean | Record<string, any> = false): Options[] {
|
||||
return this.toOptions(key, firstOption)
|
||||
toUnrefOptions(key: string, perpendOption: boolean | Options | Options[] = false): Options[] {
|
||||
return this.toOptions(key, perpendOption)
|
||||
.map(s => {
|
||||
return { ...s };
|
||||
});
|
||||
},
|
||||
|
||||
// 获取字典选项
|
||||
toRadioOptions(key: string, firstOption: boolean | Record<string, any> = false): RadioOption[] {
|
||||
if (firstOption === true) {
|
||||
return [{ ...ALL_OPTION }, ...this.$state[key]] as RadioOption[];
|
||||
} else if (firstOption) {
|
||||
return [{ ...ALL_OPTION, ...firstOption }, ...this.$state[key]] as RadioOption[];
|
||||
} else {
|
||||
return this.$state[key] as RadioOption[];
|
||||
}
|
||||
toRadioOptions(key: string, perpendOption: boolean | RadioOption | RadioOption[] = false): RadioOption[] {
|
||||
let perpendOptions = getPrependOptions(perpendOption);
|
||||
const options = this.$state[key] ?? [];
|
||||
return [...perpendOptions, ...options] as RadioOption[];
|
||||
},
|
||||
|
||||
// 转为 unref 的字典选项
|
||||
toUnrefRadioOptions(key: string, firstOption: boolean | Record<string, any> = false): RadioOption[] {
|
||||
return this.toRadioOptions(key, firstOption)
|
||||
toUnrefRadioOptions(key: string, perpendOption: boolean | RadioOption | RadioOption[] = false): RadioOption[] {
|
||||
return this.toRadioOptions(key, perpendOption)
|
||||
.map(s => {
|
||||
return { ...s };
|
||||
});
|
||||
|
||||
@@ -68,6 +68,11 @@
|
||||
},
|
||||
backgroundColor: 'transparent',
|
||||
animation: false,
|
||||
dataZoom: [{
|
||||
type: 'inside',
|
||||
zoomOnMouseWheel: true,
|
||||
moveOnMouseMove: true,
|
||||
}],
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
appendToBody: true,
|
||||
|
||||
Reference in New Issue
Block a user