From e5486e2835483ec0438c2eff0ce1dabc659b63cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=8A=B2=E6=9D=BE?= Date: Mon, 6 Apr 2020 13:06:15 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20module=E7=BC=96=E8=BE=91=E6=A1=86walk?= =?UTF-8?q?=E5=9B=9E=E6=98=BE=E5=86=85=E5=AE=B9=E6=94=B9=E4=B8=BAmib+name?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/common/rightBox/moduleBox.vue | 52 ++++++++++++++++++- 1 file changed, 50 insertions(+), 2 deletions(-) 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 @@
- {{item}} - + +
+ +
@@ -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: {