Merge remote-tracking branch 'origin/main' into lichang

This commit is contained in:
TsMask
2024-04-17 10:54:26 +08:00
11 changed files with 155 additions and 45 deletions

View File

@@ -26,6 +26,8 @@ import TableColumnsDnd from '@/components/TableColumnsDnd/index.vue';
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
import { NE_TYPE_LIST } from '@/constants/ne-constants';
import useNeInfoStore from '@/store/modules/neinfo';
import useLockedStore from '@/store/modules/locked';
const lockedStore = useLockedStore();
const { t } = useI18n();
/**表格所需option */
@@ -546,6 +548,11 @@ function fnRecordRestart(row: Record<string, any>) {
restartNf(row)
.then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
// OMC自升级
if (row.neType.toLowerCase() === 'omc') {
lockedStore.fnLock('reload');
return;
}
message.success({
content: t('common.msgSuccess', {
msg: t('views.configManage.neManage.restart'),
@@ -927,11 +934,17 @@ onMounted(() => {
<ImportOutlined />
{{ t('views.configManage.neManage.import') }}
</a-menu-item>
<a-menu-item key="start">
<a-menu-item
key="start"
v-if="!['OMC'].includes(record.neType)"
>
<thunderbolt-outlined />
{{ t('views.configManage.neManage.start') }}
</a-menu-item>
<a-menu-item key="stop">
<a-menu-item
key="stop"
v-if="!['OMC'].includes(record.neType)"
>
<pause-outlined />
{{ t('views.configManage.neManage.stop') }}
</a-menu-item>

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
import { reactive, onMounted, toRaw, ref, onUnmounted } from 'vue';
import { reactive, onMounted, toRaw, ref, onBeforeUnmount } from 'vue';
import { PageContainer } from 'antdv-pro-layout';
import { message, Modal } from 'ant-design-vue/lib';
import { SizeType } from 'ant-design-vue/lib/config-provider';
@@ -366,8 +366,10 @@ onMounted(() => {
});
});
onUnmounted(() => {
ws.close();
onBeforeUnmount(() => {
if (ws.state() !== -1) {
ws.close();
}
});
</script>

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
import { reactive, onMounted, toRaw, ref, onUnmounted } from 'vue';
import { reactive, onMounted, toRaw, ref, onBeforeUnmount } from 'vue';
import { PageContainer } from 'antdv-pro-layout';
import { message, Modal } from 'ant-design-vue/lib';
import { SizeType } from 'ant-design-vue/lib/config-provider';
@@ -394,8 +394,10 @@ onMounted(() => {
});
});
onUnmounted(() => {
ws.close();
onBeforeUnmount(() => {
if (ws.state() !== -1) {
ws.close();
}
});
</script>

View File

@@ -76,7 +76,7 @@ function fnGraphEvent(graph: Graph) {
// 节点点击
graph.on('node:click', evt => {
// 获得鼠标当前目标节点
const node = evt.item?.getModel();
const node = evt.item?.getModel();
if (node && node.id && !notNeNodes.includes(node.id)) {
graphNodeClickID.value = node.id;
}
@@ -129,6 +129,9 @@ function handleRanderGraph(
var observer = new ResizeObserver(function (entries) {
// 当元素大小发生变化时触发回调函数
entries.forEach(function (entry) {
if (!graphG6.value) {
return;
}
graphG6.value.changeSize(
entry.contentRect.width,
entry.contentRect.height - 30

View File

@@ -158,3 +158,15 @@ export function neStateParse(neType: string, data: Record<string, any>) {
// 请求标记复位
neStateRequestMap.value.set(neType, false);
}
/**属性复位 */
export function topologyReset() {
graphState.data = {
combos: [],
edges: [],
nodes: [],
};
graphG6.value = null;
graphNodeClickID.value = 'UPF';
neStateRequestMap.value = new Map();
}

View File

@@ -1,8 +1,7 @@
import { parseSizeFromBits, parseSizeFromKbs } from '@/utils/parse-utils';
import { ref } from 'vue';
/**UPF-流量数据 */
export const upfFlowData = ref<{
type FDType = {
/**时间 */
lineXTime: string[];
/**上行 N3 */
@@ -11,7 +10,10 @@ export const upfFlowData = ref<{
lineYDown: number[];
/**容量 */
cap: number;
}>({
};
/**UPF-流量数据 */
export const upfFlowData = ref<FDType>({
lineXTime: [],
lineYUp: [],
lineYDown: [],
@@ -74,3 +76,32 @@ export function upfTFParse(data: Record<string, string>) {
/**UPF-总流量数 选中 */
export const upfTFActive = ref<number>(0);
/**属性复位 */
export function upfTotalFlowReset() {
upfFlowData.value = {
lineXTime: [],
lineYUp: [],
lineYDown: [],
cap: 0,
};
upfTotalFlow.value = [
// 0天 当天24小时
{
up: '0 B',
down: '0 B',
requestFlag: false,
},
{
up: '0 B',
down: '0 B',
requestFlag: false,
},
{
up: '0 B',
down: '0 B',
requestFlag: false,
},
];
upfTFActive.value = 0;
}

View File

@@ -1,14 +1,5 @@
import { ref } from 'vue';
/**UE事件数据 */
export const ueEventData = ref<Record<string, any>[]>([]);
/**UE事件总量 */
export const ueEventTotal = ref<number>(0);
/**UE事件推送id */
export const ueEventId = ref<string>('');
/**ueEvent UE会话事件 数据解析 */
export function ueEventParse(item: Record<string, any>) {
let evData: Record<string, any> = item.eventJSON;
@@ -29,15 +20,6 @@ export function ueEventParse(item: Record<string, any>) {
};
}
/**CDR事件数据 */
export const cdrEventData = ref<Record<string, any>[]>([]);
/**CDR事件总量 */
export const cdrEventTotal = ref<number>(0);
/**CDR事件推送id */
export const cdrEventId = ref<string>('');
/**cdrEvent CDR会话事件 数据解析 */
export function cdrEventParse(item: Record<string, any>) {
let evData: Record<string, any> = item.cdrJSON || item.CDR;
@@ -69,3 +51,10 @@ export const eventData = ref<Record<string, any>[]>([]);
export const eventTotal = ref<number>(0);
/**CDR/UE事件推送id */
export const eventId = ref<string>('');
/**属性复位 */
export function userActivityReset() {
eventData.value = [];
eventTotal.value = 0;
eventId.value = '';
}

View File

@@ -7,9 +7,15 @@ import {
eventData,
eventTotal,
eventId,
userActivityReset,
} from './useUserActivity';
import { upfTotalFlow, upfTFParse, upfFlowParse } from './useUPFTotalFlow';
import { neStateParse } from './useTopology';
import {
upfTotalFlow,
upfTFParse,
upfFlowParse,
upfTotalFlowReset,
} from './useUPFTotalFlow';
import { topologyReset, neStateParse } from './useTopology';
import PQueue from 'p-queue';
/**websocket连接 */
@@ -225,6 +231,9 @@ export default function useWS() {
onBeforeUnmount(() => {
ws.close();
userActivityReset();
upfTotalFlowReset();
topologyReset();
});
return {

View File

@@ -230,6 +230,23 @@ function handleRanderGraph(
graphG6.value = graph;
// 创建 ResizeObserver 实例
var observer = new ResizeObserver(function (entries) {
// 当元素大小发生变化时触发回调函数
entries.forEach(function (entry) {
if (!graphG6.value) {
return;
}
graphG6.value.changeSize(
entry.contentRect.width,
entry.contentRect.height - 30
);
graphG6.value.fitCenter();
});
});
// 监听元素大小变化
observer.observe(container);
return graph;
}
@@ -328,10 +345,13 @@ function fnGraphDataLoad(reload: boolean = false) {
} else {
handleRanderGraph(graphG6Dom.value, graphState.data);
}
fnGetState();
interval10s.value = setInterval(() => {
fnGetState(); // 获取网元状态
}, 10_000);
clearInterval(interval10s.value);
interval10s.value = null;
fnGetState().finally(() => {
interval10s.value = setInterval(() => {
fnGetState(); // 获取网元状态
}, 10_000);
});
});
}
@@ -473,6 +493,7 @@ onMounted(() => {
onBeforeUnmount(() => {
ws.close();
clearInterval(interval10s.value);
interval10s.value = null;
});
</script>

View File

@@ -8,7 +8,7 @@ import {
Menu,
Tooltip,
} from '@antv/g6';
import { ref } from 'vue';
import { onBeforeUnmount, ref } from 'vue';
import {
edgeCubicAnimateCircleMove,
edgeCubicAnimateLineDash,
@@ -29,7 +29,7 @@ export const graphEvent = ref<{
type: string;
target: HTMLElement | (IShapeBase & ICanvas);
item: Item | null;
}>();
} | null>(null);
/**图元素选择开始结束点 */
export const selectSourceTargetOptions = ref<Record<string, any>[]>([]);
@@ -592,6 +592,23 @@ export default function useGraph() {
graphG6.value = graph;
// 创建 ResizeObserver 实例
var observer = new ResizeObserver(function (entries) {
// 当元素大小发生变化时触发回调函数
entries.forEach(function (entry) {
if (!graphG6.value) {
return;
}
graphG6.value.changeSize(
entry.contentRect.width,
entry.contentRect.height - 30
);
graphG6.value.fitCenter();
});
});
// 监听元素大小变化
observer.observe(container);
// 图元素选择开始结束点数据
fnSelectSourceTargetOptionsData();
@@ -605,6 +622,13 @@ export default function useGraph() {
graphMode.value = graphG6.value.getCurrentMode();
}
onBeforeUnmount(() => {
graphG6.value = null;
graphEvent.value = null;
selectSourceTargetOptions.value = [];
selectComboOptions.value = [];
});
return {
graphMode,
graphModeOptions,

View File

@@ -406,7 +406,11 @@ function fnGetList(pageNum?: number) {
}
tablePagination.total = res.total;
tableState.data = res.rows;
if (tablePagination.total <=(queryParams.pageNum - 1) * tablePagination.pageSize &&queryParams.pageNum !== 1) {
if (
tablePagination.total <=
(queryParams.pageNum - 1) * tablePagination.pageSize &&
queryParams.pageNum !== 1
) {
tableState.loading = false;
fnGetList(queryParams.pageNum - 1);
}
@@ -439,22 +443,22 @@ onMounted(() => {
<a-row :gutter="16">
<a-col :lg="6" :md="12" :xs="24">
<a-form-item
:label="t('views.system.post.positionId')"
name="postCode"
:label="t('views.system.post.positionName')"
name="postName"
>
<a-input
v-model:value="queryParams.postCode"
v-model:value="queryParams.postName"
allow-clear
></a-input>
</a-form-item>
</a-col>
<a-col :lg="6" :md="12" :xs="24">
<a-form-item
:label="t('views.system.post.positionName')"
name="postName"
:label="t('views.system.post.positionCode')"
name="postCode"
>
<a-input
v-model:value="queryParams.postName"
v-model:value="queryParams.postCode"
allow-clear
></a-input>
</a-form-item>