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

View File

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

View File

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

View File

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

View File

@@ -158,3 +158,15 @@ export function neStateParse(neType: string, data: Record<string, any>) {
// 请求标记复位 // 请求标记复位
neStateRequestMap.value.set(neType, false); 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 { parseSizeFromBits, parseSizeFromKbs } from '@/utils/parse-utils';
import { ref } from 'vue'; import { ref } from 'vue';
/**UPF-流量数据 */ type FDType = {
export const upfFlowData = ref<{
/**时间 */ /**时间 */
lineXTime: string[]; lineXTime: string[];
/**上行 N3 */ /**上行 N3 */
@@ -11,7 +10,10 @@ export const upfFlowData = ref<{
lineYDown: number[]; lineYDown: number[];
/**容量 */ /**容量 */
cap: number; cap: number;
}>({ };
/**UPF-流量数据 */
export const upfFlowData = ref<FDType>({
lineXTime: [], lineXTime: [],
lineYUp: [], lineYUp: [],
lineYDown: [], lineYDown: [],
@@ -74,3 +76,32 @@ export function upfTFParse(data: Record<string, string>) {
/**UPF-总流量数 选中 */ /**UPF-总流量数 选中 */
export const upfTFActive = ref<number>(0); 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'; 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会话事件 数据解析 */ /**ueEvent UE会话事件 数据解析 */
export function ueEventParse(item: Record<string, any>) { export function ueEventParse(item: Record<string, any>) {
let evData: Record<string, any> = item.eventJSON; 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会话事件 数据解析 */ /**cdrEvent CDR会话事件 数据解析 */
export function cdrEventParse(item: Record<string, any>) { export function cdrEventParse(item: Record<string, any>) {
let evData: Record<string, any> = item.cdrJSON || item.CDR; 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); export const eventTotal = ref<number>(0);
/**CDR/UE事件推送id */ /**CDR/UE事件推送id */
export const eventId = ref<string>(''); export const eventId = ref<string>('');
/**属性复位 */
export function userActivityReset() {
eventData.value = [];
eventTotal.value = 0;
eventId.value = '';
}

View File

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

View File

@@ -230,6 +230,23 @@ function handleRanderGraph(
graphG6.value = graph; 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; return graph;
} }
@@ -328,10 +345,13 @@ function fnGraphDataLoad(reload: boolean = false) {
} else { } else {
handleRanderGraph(graphG6Dom.value, graphState.data); handleRanderGraph(graphG6Dom.value, graphState.data);
} }
fnGetState(); clearInterval(interval10s.value);
interval10s.value = setInterval(() => { interval10s.value = null;
fnGetState(); // 获取网元状态 fnGetState().finally(() => {
}, 10_000); interval10s.value = setInterval(() => {
fnGetState(); // 获取网元状态
}, 10_000);
});
}); });
} }
@@ -473,6 +493,7 @@ onMounted(() => {
onBeforeUnmount(() => { onBeforeUnmount(() => {
ws.close(); ws.close();
clearInterval(interval10s.value); clearInterval(interval10s.value);
interval10s.value = null;
}); });
</script> </script>

View File

@@ -8,7 +8,7 @@ import {
Menu, Menu,
Tooltip, Tooltip,
} from '@antv/g6'; } from '@antv/g6';
import { ref } from 'vue'; import { onBeforeUnmount, ref } from 'vue';
import { import {
edgeCubicAnimateCircleMove, edgeCubicAnimateCircleMove,
edgeCubicAnimateLineDash, edgeCubicAnimateLineDash,
@@ -29,7 +29,7 @@ export const graphEvent = ref<{
type: string; type: string;
target: HTMLElement | (IShapeBase & ICanvas); target: HTMLElement | (IShapeBase & ICanvas);
item: Item | null; item: Item | null;
}>(); } | null>(null);
/**图元素选择开始结束点 */ /**图元素选择开始结束点 */
export const selectSourceTargetOptions = ref<Record<string, any>[]>([]); export const selectSourceTargetOptions = ref<Record<string, any>[]>([]);
@@ -592,6 +592,23 @@ export default function useGraph() {
graphG6.value = graph; 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(); fnSelectSourceTargetOptionsData();
@@ -605,6 +622,13 @@ export default function useGraph() {
graphMode.value = graphG6.value.getCurrentMode(); graphMode.value = graphG6.value.getCurrentMode();
} }
onBeforeUnmount(() => {
graphG6.value = null;
graphEvent.value = null;
selectSourceTargetOptions.value = [];
selectComboOptions.value = [];
});
return { return {
graphMode, graphMode,
graphModeOptions, graphModeOptions,

View File

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