增加仪表盘累加及UPF下拉框
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { RESULT_CODE_ERROR } from '@/constants/result-constants';
|
||||
import { OptionsType, WS } from '@/plugins/ws-websocket';
|
||||
import { onBeforeUnmount, onMounted } from 'vue';
|
||||
import { onBeforeUnmount, onMounted, ref } from 'vue';
|
||||
import {
|
||||
eventListParse,
|
||||
eventItemParseAndPush,
|
||||
@@ -12,9 +12,15 @@ import {
|
||||
upfFlowParse,
|
||||
upfTotalFlowReset,
|
||||
} from './useUPFTotalFlow';
|
||||
import { topologyReset, neStateParse } from './useTopology';
|
||||
import { topologyReset, neStateParse, neStateRequestMap } from './useTopology';
|
||||
import PQueue from 'p-queue';
|
||||
|
||||
/**UPF-的Id */
|
||||
export const upfWhoId = ref<any>('');
|
||||
|
||||
/**UPF-的RmUid */
|
||||
export const upfWhoRmUid = ref<any>('');
|
||||
|
||||
/**websocket连接 */
|
||||
export default function useWS() {
|
||||
const ws = new WS();
|
||||
@@ -27,13 +33,12 @@ export default function useWS() {
|
||||
|
||||
/**接收数据后回调 */
|
||||
function wsMessage(res: Record<string, any>) {
|
||||
// console.log(res);
|
||||
//console.log(res);
|
||||
const { code, requestId, data } = res;
|
||||
if (code === RESULT_CODE_ERROR) {
|
||||
console.warn(res.msg);
|
||||
return;
|
||||
}
|
||||
|
||||
// 网元状态
|
||||
if (requestId && requestId.startsWith('neState')) {
|
||||
const neType = requestId.split('_')[1];
|
||||
@@ -72,14 +77,13 @@ export default function useWS() {
|
||||
upfTFParse('30', data);
|
||||
break;
|
||||
}
|
||||
|
||||
// 订阅组信息
|
||||
if (!data?.groupId) {
|
||||
return;
|
||||
}
|
||||
switch (data.groupId) {
|
||||
// kpiEvent 指标UPF
|
||||
case '12_001':
|
||||
case '12_' + upfWhoRmUid.value:
|
||||
if (data.data) {
|
||||
upfFlowParse(data.data);
|
||||
}
|
||||
@@ -168,7 +172,17 @@ export default function useWS() {
|
||||
});
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
/**重新发送至UPF 12_rmUid */
|
||||
function reSendUPF(rmUid: string) {
|
||||
upfWhoRmUid.value = rmUid;
|
||||
//初始时时无需还原全部属性以及关闭
|
||||
if (ws.state() === WebSocket.OPEN) {
|
||||
ws.close();
|
||||
userActivityReset();
|
||||
upfTotalFlowReset();
|
||||
neStateRequestMap.value = new Map();
|
||||
//topologyReset();
|
||||
}
|
||||
const options: OptionsType = {
|
||||
url: '/ws',
|
||||
params: {
|
||||
@@ -179,7 +193,7 @@ export default function useWS() {
|
||||
* MME_UE会话事件(GroupID:1011_neId)
|
||||
* IMS_CDR会话事件(GroupID:1005_neId)
|
||||
*/
|
||||
subGroupID: '12_001,1010,1011_001,1005_001',
|
||||
subGroupID: '12_' + rmUid + ',1010,1011_001,1005_001',
|
||||
},
|
||||
onmessage: wsMessage,
|
||||
onerror: (ev: any) => {
|
||||
@@ -187,18 +201,20 @@ export default function useWS() {
|
||||
},
|
||||
};
|
||||
ws.connect(options);
|
||||
});
|
||||
}
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
ws.close();
|
||||
userActivityReset();
|
||||
upfTotalFlowReset();
|
||||
topologyReset();
|
||||
upfWhoRmUid.value = '';
|
||||
});
|
||||
|
||||
return {
|
||||
wsSend,
|
||||
userActivitySend,
|
||||
upfTFSend,
|
||||
reSendUPF,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user