diff --git a/nezha-fronted/src/components/common/rightBox/moduleBox.vue b/nezha-fronted/src/components/common/rightBox/moduleBox.vue index 06fb15c8c..b476bdeae 100644 --- a/nezha-fronted/src/components/common/rightBox/moduleBox.vue +++ b/nezha-fronted/src/components/common/rightBox/moduleBox.vue @@ -61,8 +61,10 @@
@@ -370,6 +372,47 @@ this.$refs.walkScrollbar.update(); }, + //从mibData里取得oid对应的mib名称 + getMibName(walkData, walk) { + let mibName = ""; + let objectName = ""; + walkData.forEach((item, index) => { + if (!mibName && item.subTree && item.subTree.length > 0) { + item.subTree.forEach((item2, index2) => { + if (!mibName && getMibName(item2, walk)) { + mibName = item.name; + } + }); + } + }); + function getMibName(tree, oid) { + if (oid.indexOf(tree.objectID) > -1) { + if (tree.objectID == oid) { + objectName = tree.name; + return true; + } else { + if (tree.subTree && tree.subTree.length > 0) { + let result = false; + for (let i = 0; i < tree.subTree.length; i++) { + if (getMibName(tree.subTree[i], oid)) { + result = true; + break; + } + } + return result; + } else { + return false; + } + } + } else { + return false; + } + } + if (!objectName) { + objectName = walk; + } + return mibName ? mibName + ":" + objectName : objectName + ""; + }, removeWalk(walk) { this.currentModule.walk.splice(this.currentModule.walk.indexOf(walk), 1); @@ -592,6 +635,11 @@ projectListReloadWatch() { return this.$store.state.projectListChange; }, + mibName() { + return (value) => { + return this.getMibName(this.walkData, value); + } + } }, watch: { module: {