diff --git a/.env.development b/.env.development index d82dc0db..155b8ccf 100644 --- a/.env.development +++ b/.env.development @@ -1,5 +1,5 @@ # 历史路径-哈希带井号标识 -VITE_HISTORY_HASH = false +VITE_HISTORY_HASH = true # 历史路径-前缀URL如:/h5 VITE_HISTORY_BASE_URL = "/" diff --git a/package.json b/package.json index 40f73b5d..489df9d0 100644 --- a/package.json +++ b/package.json @@ -15,32 +15,32 @@ "@ant-design/icons-vue": "^7.0.1", "@antv/g6": "~4.8.24", "@codemirror/lang-javascript": "^6.2.2", - "@codemirror/lang-yaml": "^6.1.1", - "@codemirror/merge": "^6.7.2", + "@codemirror/lang-yaml": "^6.1.2", + "@codemirror/merge": "^6.7.4", "@codemirror/theme-one-dark": "^6.1.2", - "@tato30/vue-pdf": "^1.11.2", - "@vueuse/core": "11.2.0", + "@tato30/vue-pdf": "^1.11.3", + "@vueuse/core": "^12.0.0", "@xterm/addon-fit": "^0.10.0", "@xterm/xterm": "^5.5.0", - "ant-design-vue": "^4.2.5", - "antdv-pro-layout": "^4.1.9", + "ant-design-vue": "^4.2.6", + "antdv-pro-layout": "^4.2.0", "antdv-pro-modal": "^4.0.5", "codemirror": "^6.0.1", "crypto-js": "^4.2.0", "dayjs": "^1.11.11", "echarts": "~5.5.0", "file-saver": "^2.0.5", - "grid-layout-plus": "^1.0.5", - "intl-tel-input": "^24.6.0", + "grid-layout-plus": "^1.0.6", + "intl-tel-input": "^25.2.0", "js-base64": "^3.7.7", "js-cookie": "^3.0.5", "localforage": "^1.10.0", "nprogress": "^0.2.0", "p-queue": "~8.0.1", - "pinia": "2.2.6", - "vue": "^3.5.12", - "vue-i18n": "^10.0.4", - "vue-router": "^4.4.5", + "pinia": "^2.3.0", + "vue": "^3.5.13", + "vue-i18n": "^10.0.5", + "vue-router": "^4.5.0", "vue3-smooth-dnd": "^0.0.6", "xlsx": "~0.18.5" }, @@ -48,14 +48,14 @@ "@types/crypto-js": "^4.2.2", "@types/file-saver": "^2.0.7", "@types/js-cookie": "^3.0.6", - "@types/node": "^22.7.7", + "@types/node": "^18.0.0", "@types/nprogress": "^0.2.3", - "@vitejs/plugin-vue": "^5.1.4", - "less": "^4.2.0", - "typescript": "^5.6.3", - "unplugin-vue-components": "^0.27.4", - "vite": "5.4.10", + "@vitejs/plugin-vue": "^5.2.1", + "less": "^4.2.1", + "typescript": "~5.6.3", + "unplugin-vue-components": "^0.27.5", + "vite": "^6.0.3", "vite-plugin-compression": "~0.5.1", - "vue-tsc": "^2.1.8" + "vue-tsc": "~2.1.10" } } diff --git a/src/api/neData/sgwc.ts b/src/api/neData/sgwc.ts new file mode 100644 index 00000000..8b383256 --- /dev/null +++ b/src/api/neData/sgwc.ts @@ -0,0 +1,42 @@ +import { request } from '@/plugins/http-fetch'; + +/** + * 查询SGWC-CDR会话事件 + * @param query 查询参数 + * @returns object + */ +export function listSGWCDataCDR(query: Record) { + return request({ + url: '/neData/sgwc/cdr/list', + method: 'get', + params: query, + }); +} + +/** + * SGWC-CDR会话删除 + * @param id 信息ID + * @returns object + */ +export function delSGWCDataCDR(cdrIds: string | number) { + return request({ + url: `/neData/sgwc/cdr/${cdrIds}`, + method: 'delete', + timeout: 60_000, + }); +} + +/** + * SGWC-CDR会话列表导出 + * @param data 查询列表条件 + * @returns object + */ +export function exportSGWCDataCDR(data: Record) { + return request({ + url: '/neData/sgwc/cdr/export', + method: 'post', + data, + responseType: 'blob', + timeout: 60_000, + }); +} diff --git a/src/api/neData/smf.ts b/src/api/neData/smf.ts index 02b20e2f..a7d8c3c0 100644 --- a/src/api/neData/smf.ts +++ b/src/api/neData/smf.ts @@ -41,14 +41,27 @@ export function exportSMFDataCDR(data: Record) { }); } +/** + * SMF-在线订阅用户数量 + * @param query 查询参数 + * @returns object + */ +export function listSMFSubNum(neId: string) { + return request({ + url: '/neData/smf/sub/num', + method: 'get', + params: { neId }, + }); +} + /** * SMF-在线订阅用户列表信息 * @param query 查询参数 * @returns object */ -export function listSMFSubscribers(query: Record) { +export function listSMFSubList(query: Record) { return request({ - url: '/neData/smf/subscribers', + url: '/neData/smf/sub/list', method: 'get', params: query, }); diff --git a/src/constants/ne-constants.ts b/src/constants/ne-constants.ts index ec2282c9..cdf6b689 100644 --- a/src/constants/ne-constants.ts +++ b/src/constants/ne-constants.ts @@ -4,6 +4,7 @@ export const NE_TYPE_LIST = [ 'IMS', 'AMF', 'AUSF', + 'UDR', 'UDM', 'SMF', 'PCF', @@ -19,6 +20,8 @@ export const NE_TYPE_LIST = [ 'SMSF', 'CBC', 'CHF', + 'HLR', + 'SGWC', ]; /** diff --git a/src/i18n/locales/en-US.ts b/src/i18n/locales/en-US.ts index 701e1708..42384df2 100644 --- a/src/i18n/locales/en-US.ts +++ b/src/i18n/locales/en-US.ts @@ -222,12 +222,11 @@ export default { capability: 'Capability', serialNum: 'Serial Number', expiryDate: 'Expiry Date', - neStatus: 'NE status is abnormal', - runStatus:'Running Status', - mark:'Brief Information', + neStatus: 'Status Abnormal', + runStatus:'Status', + mark:'Information', object:'Object', versionNum:'Version', - systemStatus:'Status', realNeStatus:'Status', reloadTime:'Refresh Time', Critical:'Critical', @@ -351,163 +350,6 @@ export default { description: "No data yet, try refreshing", }, }, - configManage: { - neManage: { - addNe:'Add Network Element', - delSure:'Confirm deleting the data item with network element name {msg}', - editNe:'Edit Network Element', - exportSure:'Confirm exporting the configuration information with the network element name {msg}', - exportTip:'Export successful, please go to backup management for download', - getInfo:'Failed to get network element information', - neType:'NE Type', - neTypePlease: 'Select network element type', - neId:'NE ID', - neName:'NE Name', - neTypeTip:'Fill in the type of network element created, such as:SMF', - uid:'RM UID', - uidTip:'Please enter a unique resource identifier', - ip:'IP Address', - mac:'NE MAC address', - macTip:'Able to locate the physical address (MAC) of the network element', - port:'Port', - portTip:'Maximum range 0~65535', - pvflag:'PV Flag', - pnf:'Physical Network Element', - vnf:'Virtual Network Element', - province:'Region', - vendorName:'Vendor Name', - dn:'Network Identification', - reload: 'Reload', - restart: 'Restart', - totalSure:'Confirm the network element with {operator} network element name {msg}', - stop: 'Stop', - start: 'Start', - log: 'Logs', - export: 'Export', - import: 'Import', - fileForm:'File Source', - selectPlease:'Please select the source of the import file', - server:'Server File', - local:'Local File', - fileSelect:'Please select the current import file', - sync:'Synchronize to NE', - open:'Open', - close:'Close', - addFail:'Add failed', - operFail:'Operation Failed' - }, - backupManage: { - setBackupTask: 'Set automatic backup time', - neTypePlease: 'Query network element type', - neType: 'NE Type', - neID: 'NE ID', - fileName: 'File Name', - createAt: 'Create at', - remark:'Remark', - edit:'Edit Backup File', - totalSure:'Confirm that {oper} records item number {id}?', - }, - softwareManage: { - sendBtn: 'Distribute', - runBtn: 'Activate', - backBtn: 'Rollback', - historyBtn: 'Distribution Record', - neTypePlease: 'Select network element type', - neType: 'NE Type', - fileName: 'File Name', - version: 'Version', - versionPlease: 'Version number cannot be empty', - updateTime: 'Uploaded Time', - description: 'Description', - deleteTip: 'Are you sure to delete the data item with software [{fileName}]?', - downloadTip: 'Are you sure to download the data item with software [{fileName}]?', - updateComment: 'Comment', - updateCommentPlease: 'Please enter the software description', - updateFile: 'Software File', - updateFilePlease: 'Please upload the updated software file', - verifyFile: 'Verify File', - selectFile: 'SELECT FILE', - sendTitle: 'Distribute software version', - sendContent: 'Are you sure to send the file with the software package [{fileName}] to the corresponding network element?', - runTitle: 'Activate software version', - runContent: 'Are you sure to activate the software version of [{fileName}] that has been issued to the corresponding network element?', - backTitle: 'Fallback software version', - backContent: 'Confirm that the software version of [{fileName}] has been issued for the corresponding network element rollback?', - neId: 'Corresponding network element', - neIdPlease: 'Please select the corresponding network element', - versions:'Version', - upVersions:'Version before upgrade', - backVersions:'Version before rollback', - status:'Status', - letUpTime:'Activation time', - createTime:'Creation time', - onlyAble:'Only upload file format {fileText} is supported', - nullVersion:'There is no rollback version for the current network element.', - }, - license: { - neTypePlease: 'Select network element type', - neType: 'NE Type', - serialNum: 'Serial Num', - createTime: 'Time', - comment: 'Description', - updateComment: 'License Description', - updateCommentPlease: 'Please enter a license description', - updateFile: 'License File', - updateFilePlease: 'Please upload and update the License file', - selectFile: 'SELECT FILE', - neId: 'NE ID', - neIdPlease: 'Please select the corresponding network element', - }, - configParam:{ - dataNull:'No configuration item data yet', - editSuss:'Modification successful', - editFail:'Edit failed', - Unable:'Illegal operation of attribute value', - delSure:'Confirm to delete the data item with Index [{value}]?', - addSuss:'Add successfully', - addFail:'Add failed', - delArraySure:'Confirm to delete the data item with {arrayChildTitle} Index as [{value}]?', - parUnable:'The parameter value is not within the reasonable range', - ipv4Tip:'Not a legal IPV4 address', - ipv6Tip:'Not a legal IPV6 address', - enumTip:'Not a reasonable enumeration value', - boolTip:'Not a reasonable Boolean value', - default:'The input value is of unknown type', - reloadSuss:'Network element reloading completed', - reloadFail:'Network element reloading failed', - neNUll:'No network element list data yet', - reload:'Reload', - post:'Submit', - editSure:'Are you sure you want to update this attribute value? ', - arraryEdit:'Are you sure to submit the record whose updated Index is [{value}]? ', - addSure:'Are you sure to submit the new record of Index: [{value}]? ' - }, - configParamForm: { - treeTitle: "Navigation Configuration", - treeSelectTip: "Select configuration item information in the left configuration navigation!", - neType: 'NE Type', - neTypePleace: "Please select the network element type", - noConfigData: "No data on configuration items", - updateValue: "[ {num} ] parameter value modified successfully.", - updateValueErr: "Attribute value modification failure", - updateItem: "Modify Index to {num}.", - updateItemErr: "Record modification failure", - delItemOk: "Deleting Index as {num} succeeded", - addItemOk: "Add Index as {num} Record Succeeded", - addItemErr: "Record addition failure", - requireUn: "[ {display} ] input value is of unknown type", - requireString: "[ {display} ] parameter value is invalid.", - requireInt: "[ {display} ] parameter value not in reasonable range {filter}", - requireIpv4: "[ {display} ] not a legitimate IPV4 address", - requireIpv6: "[ {display} ] not a legitimate IPV6 address.", - requireEnum: "[ {display} ] is not a reasonable enumeration value.", - requireBool: "[ {display} ] is not a reasonable boolean value.", - editOkTip: "Confirm updating the value of this [ {num} ] attribute?", - updateItemTip: "Confirm updating the data item with Index [{num}]?", - delItemTip: "Confirm deleting the data item with Index [{num}]?", - arrayMore: "Expand", - }, - }, dashboard: { overview:{ title: "Core Network Dashboard", @@ -580,14 +422,18 @@ export default { delTip: "Confirm deletion of the data item numbered [{msg}]?", tenantName: "Tenant Name", exportTip: "Do you confirm to export the current query conditions of the CDR data? (Maximum 10,000 items can be exported.)", - smfChargingID: 'Charging ID', + chargingID: 'Charging ID', smfSubscriptionIDData: 'Subscription ID Data', smfSubscriptionIDType: 'Subscription ID Type', smfDataVolumeUplink: 'Data Volume Uplink', smfDataVolumeDownlink: 'Data Volume Downlink', smfDataTotalVolume: 'Data Total Volume', - smfDuration: 'Duration', - smfInvocationTime: 'Invocation Time', + durationTime: 'Duration', + invocationTime: 'Invocation Time', + sgwcServedIMSI: 'IMSI', + sgwcServedMSISDN: 'MSISDN', + sgwcVolumeGPRSUplink: 'GPRS Uplink', + sgwcVolumeGPRSDownlink: 'GPRS Downlink', }, ue: { eventType: "Event Type", @@ -785,7 +631,9 @@ export default { treeSelectTip: "Select configuration item information in the left configuration navigation!", neType: 'NE Type', neTypePleace: "Please select the network element type", + neIdSyncPleace: "Please select the synchronized network element", noConfigData: "No data on configuration items", + noConfigdDisabled: "The configuration item is not normal", updateValue: "[ {num} ] parameter value modified successfully.", updateValueErr: "Attribute value modification failure", updateItem: "Modify Index to {num}.", diff --git a/src/i18n/locales/zh-CN.ts b/src/i18n/locales/zh-CN.ts index 5ffe8393..22c341ac 100644 --- a/src/i18n/locales/zh-CN.ts +++ b/src/i18n/locales/zh-CN.ts @@ -222,13 +222,12 @@ export default { capability: '用户容量', serialNum: '序列号', expiryDate: '许可证到期日期', - neStatus:'网元状态异常', + neStatus:'状态异常', runStatus:'运行状态', - mark:'简略信息', + mark:'信息', object:'对象', versionNum:'版本号', - systemStatus:'系统状态', - realNeStatus:'网元状态', + realNeStatus:'状态', reloadTime:'刷新时间', Critical:'严重告警', Major:'主要告警', @@ -351,163 +350,6 @@ export default { description: "暂无数据,尝试刷新看看", }, }, - configManage: { - neManage: { - addNe:'添加网元', - delSure:'确认删除网元名称为{msg}的数据项 ', - editNe:'修改网元', - exportSure:'确认导出网元名称为 {msg} 的配置信息', - exportTip:'导出成功,请到备份管理进行下载', - getInfo:'获取网元信息失败', - neType:'网元类型', - neTypePlease: '请输入网元类型', - neId:'网元内部标识', - neName:'网元名称', - neTypeTip:'填写创建的网元类型,如:SMF', - uid:'资源唯一标识', - uidTip:'请输入资源唯一标识', - ip:'IP地址', - mac:'网元物理地址', - macTip:'能够定位网元的物理地址(MAC)', - port:'端口', - portTip:'最大范围0~65535', - pvflag:'网元虚拟化标识', - pnf:'物理网元', - vnf:'虚拟网元', - province:'网元服务省份', - vendorName:'厂商名称', - dn:'网络标识', - reload: '重载', - restart: '重启', - totalSure:'确认{oper}网元名称为 {msg} 的网元', - stop: '停止', - start: '启动', - log: '日志', - export: '导出', - import: '导入', - fileForm:'文件来源', - selectPlease:'请选择导入文件来源', - server:'服务器文件', - local:'本地文件', - fileSelect:'请选择当前导入文件', - sync:'同步到网元', - open:'开', - close:'关', - addFail:'新增失败', - operFail:'操作失败' - }, - backupManage: { - setBackupTask: '设置自动备份时间', - neTypePlease: '查询网元类型', - neType: '网元类型', - neID: '网元内部标识', - fileName: '文件名', - createAt: '创建时间', - remark:'备份说明', - edit:'编辑备份文件', - totalSure:'确认{oper}记录编号为 {id} 的数据项?', - }, - softwareManage: { - sendBtn: '下发', - runBtn: '激活', - backBtn: '回退', - historyBtn: '下发记录', - neTypePlease: '选择网元类型', - neType: '网元类型', - fileName: '文件名', - version: '版本号', - versionPlease: '版本号不能为空', - updateTime: '上传时间', - description: '功能描述', - deleteTip: '确认删除 【{fileName}】 的软件数据项?', - downloadTip: '确认下载 【{fileName}】 的软件数据项?', - updateComment: '软件说明', - updateCommentPlease: '请输入软件说明', - updateFile: '软件文件', - updateFilePlease: '请上传更新软件文件', - verifyFile: '校验文件', - selectFile: '选择文件', - sendTitle: '下发软件版本', - sendContent: '确认下发软件包为【{fileName}】的文件到对应网元?', - runTitle: '激活软件版本', - runContent: '确认在对应网元激活已下发【{fileName}】的软件版本?', - backTitle: '回退软件版本', - backContent: '确认在对应网元回退已下发【{fileName}】的软件版本?', - neId: '对应网元', - neIdPlease: '请选择对应网元', - versions:'版本', - upVersions:'升级前版本', - backVersions:'回退前版本', - status:'状态', - letUpTime:'激活时间', - createTime:'创建时间', - onlyAble:'只支持上传文件格式 {fileText}', - nullVersion:'当前网元无可回退版本', - }, - license: { - neTypePlease: '选择网元类型', - neType: '网元类型', - serialNum: '序列号', - createTime: '时间', - comment: '说明', - updateComment: 'License说明', - updateCommentPlease: '请输入License说明', - updateFile: 'License文件', - updateFilePlease: '请上传更新License文件', - selectFile: '选择文件', - neId: '网元内部标识', - neIdPlease: '请选择对应网元', - }, - configParam:{ - dataNull:'暂无配置项数据', - editSuss:'修改成功', - editFail:'修改失败', - unable:'非法操作属性值', - delSure:'确认删除Index为 【{value}】 的数据项?', - addSuss:'新增成功', - addFail:'新增失败', - delArraySure:'确认删除{arrayChildTitle} Index 为 【{value}】 的数据项?', - parUnable:'参数值不在合理范围', - ipv4Tip:'不是合法的IPV4地址', - ipv6Tip:'不是合法的IPV6地址', - enumTip:'不是合理的枚举值', - boolTip:'不是合理的布尔类型的值', - default:'输入值是未知类型', - reloadSuss:'网元重新加载完成', - reloadFail:'网元重新加载失败', - neNUll:'暂无网元列表数据', - reload:'重载', - post:'提交', - editSure:'确认更新该属性值吗?', - arraryEdit:'确认提交更新 Index 为 【{value}】 的记录吗?', - addSure:'确认提交新增 Index :【{value}】 的记录吗?', - }, - configParamForm: { - treeTitle: "配置导航", - treeSelectTip: "左侧配置导航中选择配置项信息!", - neType: "网元类型", - neTypePleace: "请选择网元类型", - noConfigData: "暂无配置项数据", - updateValue: "【 {num} 】 属性值修改成功", - updateValueErr: "属性值修改失败", - updateItem: "修改 Index 为 {num} 记录成功", - updateItemErr: "记录修改失败", - delItemOk: "删除 Index 为 {num} 记录成功", - addItemOk: "新增 Index 为 {num} 记录成功", - addItemErr: "记录新增失败", - requireUn: "【 {display} 】输入值是未知类型", - requireString: "【 {display} 】参数值不合理", - requireInt: "【 {display} 】参数值不在合理范围 {filter}", - requireIpv4: "【 {display} 】不是合法的IPV4地址", - requireIpv6: "【 {display} 】不是合法的IPV6地址", - requireEnum: "【 {display} 】不是合理的枚举值", - requireBool: "【 {display} 】不是合理的布尔类型的值", - editOkTip: "确认更新该【 {num} 】属性值吗?", - updateItemTip: "确认更新Index为 【{num}】 的数据项?", - delItemTip: "确认删除Index为 【{num}】 的数据项?", - arrayMore: "展开", - }, - }, dashboard: { overview:{ title: "核心网系统看板", @@ -580,14 +422,18 @@ export default { delTip: "确认删除编号为【{msg}】的数据项?", tenantName: "租户名称", exportTip: "确认导出当前查询条件的话单数据吗?(导出最大支持一万条)", - smfChargingID: '计费ID', + chargingID: '计费ID', smfSubscriptionIDData: '订阅 ID 数据', smfSubscriptionIDType: '订阅 ID 类型', smfDataVolumeUplink: '数据量上行链路', smfDataVolumeDownlink: '数据量下行链路', smfDataTotalVolume: '数据总量', - smfDuration: '持续时间', - smfInvocationTime: '调用时间', + durationTime: '持续时间', + invocationTime: '调用时间', + sgwcServedIMSI: 'IMSI', + sgwcServedMSISDN: 'MSISDN', + sgwcVolumeGPRSUplink: 'GPRS 上行链路', + sgwcVolumeGPRSDownlink: 'GPRS 下行链路', }, ue: { eventType: "事件类型", @@ -785,7 +631,9 @@ export default { treeSelectTip: "左侧配置导航中选择配置项信息!", neType: "网元类型", neTypePleace: "请选择网元类型", + neIdSyncPleace: "请选择同步网元", noConfigData: "暂无配置项数据", + noConfigdDisabled: "配置项网元未正常服务", updateValue: "【 {num} 】 属性值修改成功", updateValueErr: "属性值修改失败", updateItem: "修改 Index 为 {num} 记录成功", diff --git a/src/store/modules/app.ts b/src/store/modules/app.ts index fe11126c..81405212 100644 --- a/src/store/modules/app.ts +++ b/src/store/modules/app.ts @@ -54,7 +54,7 @@ const useAppStore = defineStore('app', { version: `-`, buildTime: `-`, bootloader: false, - loginAuth: false, + loginAuth: true, serialNum: `-`, copyright: `Copyright ©2023 For ${import.meta.env.VITE_APP_NAME}`, logoType: 'icon', @@ -88,7 +88,7 @@ const useAppStore = defineStore('app', { if (this.bootloader) { removeToken(); } - this.loginAuth = res.data.loginAuth === 'true'; + this.loginAuth = res.data.loginAuth !== 'false' ; this.serialNum = res.data.serialNum; this.appName = res.data.title; this.copyright = res.data.copyright; diff --git a/src/utils/parse-tree-utils.ts b/src/utils/parse-tree-utils.ts index 5269ab83..0791f050 100644 --- a/src/utils/parse-tree-utils.ts +++ b/src/utils/parse-tree-utils.ts @@ -126,7 +126,7 @@ export function parseDataToTreeExclude( } /** - * 解析树结构数据转出一维id数组 + * 解析树结构数据转出所有一维id数组 * * @param data 数组数据 * @param fieldId 读取节点字段 默认 'id' @@ -158,7 +158,7 @@ export function parseTreeKeys( } /** - * 解析树结构数据转出含子节点的一维id数组 + * 解析树结构数据转出根节点的一维id数组 * * @param data 数组数据 * @param fieldId 读取节点字段 默认 'id' diff --git a/src/views/configManage/neManage/index.vue b/src/views/configManage/neManage/index.vue deleted file mode 100644 index de374d4a..00000000 --- a/src/views/configManage/neManage/index.vue +++ /dev/null @@ -1,1275 +0,0 @@ - - - - - diff --git a/src/views/configManage/neOverview/index.vue b/src/views/configManage/neOverview/index.vue index a2492040..aa2e49c6 100644 --- a/src/views/configManage/neOverview/index.vue +++ b/src/views/configManage/neOverview/index.vue @@ -49,7 +49,6 @@ let indexColor = ref([ ]); /**表格字段列 */ -//customRender(){} ----单元格处理 let tableColumns: ColumnsType = [ { title: t('views.index.object'), @@ -67,7 +66,9 @@ let tableColumns: ColumnsType = [ dataIndex: 'serverState', align: 'left', customRender(opt) { - if (opt.value?.refreshTime) return parseDateToStr(opt.value?.refreshTime); + if (opt.value?.refreshTime) { + return parseDateToStr(opt.value?.refreshTime, 'HH:mm:ss'); + } return '-'; }, }, @@ -104,12 +105,13 @@ let tableColumns: ColumnsType = [ }, }, ]; + /**表格状态类型 */ type TabeStateType = { /**加载等待 */ loading: boolean; /**记录数据 */ - data: object[]; + data: Record[]; /**勾选记录 */ selectedRowKeys: (string | number)[]; }; @@ -121,105 +123,75 @@ let tableState: TabeStateType = reactive({ selectedRowKeys: [], }); -/**表格状态 */ -let nfInfo: any = reactive({ - obj: 'OMC', - version: appStore.version, - status: t('views.index.normal'), - outTimeDate: '', - serialNum: appStore.serialNum, -}); - -/**表格状态类型 */ -type nfStateType = { - /**主机名 */ - hostName: string; - /**操作系统信息 */ - osInfo: string; - /**IP地址 */ - ipAddress: string; - /**版本 */ - version: string; - /**CPU利用率 */ - cpuUse: string; - /**内存使用 */ - memoryUse: string; - /**用户容量 */ - capability: number; - /**序列号 */ - serialNum: string; - /**许可证到期日期 */ - /* selectedRowKeys: (string | number)[];*/ - expiryDate: string; -}; -/**网元详细信息 */ -let pronInfo: nfStateType = reactive({ - hostName: '5gc', - osInfo: 'Linux 5gc 4.15.0-112-generic 2020 x86_64 GNU/Linux', - ipAddress: '-', - version: '-', - cpuUse: '-', - memoryUse: '-', - capability: 0, - serialNum: '-', - expiryDate: '-', -}); +/**状态 */ +let serverState: any = ref({}); /**查询网元状态列表 */ function fnGetList(one: boolean) { if (tableState.loading) return; - one && (tableState.loading = true); - listAllNeInfo({ bandStatus: true }).then(res => { - tableState.data = res.data; - tableState.loading = false; - var rightNum = 0; - var errorNum = 0; - res.data.forEach((item: any) => { - if (item.serverState.online) { - rightNum++; + if (one) { + tableState.loading = true; + } + listAllNeInfo({ bandStatus: true }) + .then(res => { + tableState.data = res.data; + tableState.loading = false; + if (one && res.data.length > 0) { + const id = res.data[0].id; + fnTableSelectedRowKeys([id]); } else { - errorNum++; + fnTableSelectedRowKeys(tableState.selectedRowKeys); } - }); - const optionData: any = { - title: { - text: '', - subtext: '', - left: 'center', - }, - tooltip: { - trigger: 'item', - }, - legend: { - orient: 'vertical', - left: 'left', - }, - color: indexColor.value.map(item => item.tagClass), - series: [ - { - name: t('views.index.realNeStatus'), - type: 'pie', - radius: '70%', - center: ['50%', '50%'], - data: [ - { value: rightNum, name: t('views.index.normal') }, - { value: errorNum, name: t('views.index.abnormal') }, - ], - emphasis: { - itemStyle: { - shadowBlur: 10, - shadowOffsetX: 0, - shadowColor: 'rgba(0, 0, 0, 0.5)', - }, - }, - - label: {}, + }) + .finally(() => { + var rightNum = 0; + var errorNum = 0; + for (const v of tableState.data) { + if (v?.serverState?.online) { + rightNum++; + } else { + errorNum++; + } + } + /// 图表数据 + const optionData: any = { + title: { + text: '', + subtext: '', + left: 'center', }, - ], - }; + tooltip: { + trigger: 'item', + }, + legend: { + orient: 'vertical', + left: 'left', + }, + color: indexColor.value.map(item => item.tagClass), + series: [ + { + name: t('views.index.realNeStatus'), + type: 'pie', + radius: '70%', + center: ['50%', '50%'], + data: [ + { value: rightNum, name: t('views.index.normal') }, + { value: errorNum, name: t('views.index.abnormal') }, + ], + emphasis: { + itemStyle: { + shadowBlur: 10, + shadowOffsetX: 0, + shadowColor: 'rgba(0, 0, 0, 0.5)', + }, + }, - fnDesign(statusBar.value, optionData); - }); + label: {}, + }, + ], + }; + fnDesign(statusBar.value, optionData); + }); } function fnDesign(container: HTMLElement | undefined, option: any) { @@ -240,66 +212,43 @@ function fnDesign(container: HTMLElement | undefined, option: any) { observer.observe(container); } -/**抽屉 网元详细信息 */ -const open = ref(false); -const closeDrawer = () => { - open.value = false; -}; -/**抽屉 网元详细信息 */ +/**表格多选 */ +function fnTableSelectedRowKeys(keys: (string | number)[]) { + if (keys.length <= 0) return; + const id = keys[0]; + const row: any = tableState.data.find((item: any) => item.id === id); + if (!row) { + message.error(t('views.index.neStatus'), 2); + return; + } + const neState = row.serverState; + if (!neState?.online) { + message.error(t('views.index.neStatus'), 2); + return; + } + tableState.selectedRowKeys = keys; + // Mem 将KB转换为MB + const totalMemInKB = neState.mem?.totalMem; + const nfUsedMemInKB = neState.mem?.nfUsedMem; + const sysMemUsageInKB = neState.mem?.sysMemUsage; + const totalMemInMB = Math.round((totalMemInKB / 1024) * 100) / 100; + const nfUsedMemInMB = Math.round((nfUsedMemInKB / 1024) * 100) / 100; + const sysMemUsageInMB = Math.round((sysMemUsageInKB / 1024) * 100) / 100; -/**监听表格行事件*/ -function rowClick(record: any, index: any) { - return { - onClick: (event: any) => { - let pronData = JSON.parse(JSON.stringify(record.serverState)); - if (!pronData.online) { - message.error(t('views.index.neStatus'), 2); - return false; - } else { - const totalMemInKB = pronData.mem?.totalMem; - const nfUsedMemInKB = pronData.mem?.nfUsedMem; - const sysMemUsageInKB = pronData.mem?.sysMemUsage; + // CPU + const nfCpu = neState.cpu?.nfCpuUsage; + const sysCpu = neState.cpu?.sysCpuUsage; + const nfCpuP = Math.round(nfCpu) / 100; + const sysCpuP = Math.round(sysCpu) / 100; - // 将KB转换为MB - const totalMemInMB = Math.round((totalMemInKB / 1024) * 100) / 100; - const nfUsedMemInMB = Math.round((nfUsedMemInKB / 1024) * 100) / 100; - const sysMemUsageInMB = - Math.round((sysMemUsageInKB / 1024) * 100) / 100; - - //渲染详细信息 - pronInfo = { - hostName: pronData.hostname, - osInfo: pronData.os, - ipAddress: pronData.neIP, - version: pronData.version, - cpuUse: - pronData.neName + - ':' + - pronData.cpu?.nfCpuUsage / 100 + - '%; ' + - 'SYS:' + - pronData.cpu?.sysCpuUsage / 100 + - '%', - memoryUse: - 'Total:' + - totalMemInMB + - 'MB; ' + - pronData.name + - ':' + - nfUsedMemInMB + - 'MB; SYS:' + - sysMemUsageInMB + - 'MB', - capability: pronData.capability, - serialNum: pronData.sn, - expiryDate: pronData.expire, - }; - } - open.value = true; + serverState.value = Object.assign( + { + cpuUse: `NE:${nfCpuP}%; SYS:${sysCpuP}%`, + memoryUse: `Total: ${totalMemInMB}MB; NE: ${nfUsedMemInMB}MB; SYS: ${sysMemUsageInMB}MB`, }, - }; + neState + ); } -let timer: any; /** * 国际化翻译转换 @@ -312,6 +261,7 @@ function fnLocale() { appStore.setTitle(title); } +let timer: any; onMounted(() => { getDict('index_status') .then(res => { @@ -322,12 +272,11 @@ onMounted(() => { .finally(() => { fnLocale(); fnGetList(true); - timer = setInterval(() => fnGetList(false), 10000); // 每隔10秒执行一次 + timer = setInterval(() => fnGetList(false), 10_000); // 每隔10秒执行一次 }); }); // 在组件卸载之前清除定时器 - onBeforeUnmount(() => { clearInterval(timer); }); @@ -335,40 +284,6 @@ onBeforeUnmount(() => {