fix:修复module编辑页bug
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
active="1"
|
||||
unique-opened
|
||||
>
|
||||
<el-submenu :index="'-3'" popper-class="nz-submenu" class="icon-menu-item">
|
||||
<el-submenu :index="'-3'" popper-class="nz-submenu" class="icon-menu-item" :disabled="!linkData||linkData.length <1" >
|
||||
<template slot="title">
|
||||
<i class="nz-icon-navmore nz-icon" style="font-size: 17px;"></i>
|
||||
</template>
|
||||
@@ -219,7 +219,7 @@
|
||||
projectData: [], //顶部菜单project列表中的数据
|
||||
editProject: {id: '', name: '', remark: ''}, //新增/编辑的project
|
||||
currentProject: {id: '', name: '', remark: ''}, //module/endpoint弹框用来回显project
|
||||
editModule: {id: '', type: 'http', name: '', project: {}, port: '', path: '', param: '', paramObj: []}, //新增/编辑的module
|
||||
editModule: { type: 'http', name: '', project: {}, port: 9100, path: '', param: '', paramObj: []}, //新增/编辑的module
|
||||
currentModule: {id: '', name: '', project: {}, port: '', path: '', param: '', paramObj: []}, //endpoint弹框用来回显module,此处固定为空对象
|
||||
editEndpoint: { //新增/编辑的endpoint
|
||||
id: '',
|
||||
@@ -324,13 +324,12 @@
|
||||
} else if (item.type == 2) {
|
||||
this.rightBox.module.show = true;
|
||||
this.editModule = {
|
||||
id: '',
|
||||
name: '',
|
||||
project: this.$store.state.currentProject,
|
||||
port: '',
|
||||
port: 9100,
|
||||
path: '',
|
||||
param: '',
|
||||
type: '',
|
||||
type: 'http',
|
||||
paramObj: [],
|
||||
snmpParam: '',
|
||||
//snmp setting 下划线命名是因为业务需求
|
||||
|
||||
@@ -215,7 +215,7 @@
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<el-row>
|
||||
<el-row v-if="editModule.version == 3">
|
||||
<el-col :span="6">
|
||||
<div class="sub-label">{{$t('project.module.contextName')}}</div>
|
||||
</el-col>
|
||||
@@ -443,6 +443,11 @@
|
||||
return;
|
||||
}
|
||||
this.editModule.type = type;
|
||||
if(type == 'http'){
|
||||
this.editModule.port = 9100
|
||||
}else{
|
||||
this.editModule.port= 161
|
||||
}
|
||||
this.updateScrollbar();
|
||||
},
|
||||
//转化snmpParam属性
|
||||
@@ -474,6 +479,9 @@
|
||||
},
|
||||
//回显时解析snmpParam
|
||||
reparseSnmpParam(module) {
|
||||
if(!module.snmpParam){
|
||||
return;
|
||||
}
|
||||
let snmpObj = JSON.parse(module.snmpParam);
|
||||
module.walk = snmpObj.walk;
|
||||
module.version = snmpObj.version;
|
||||
@@ -618,30 +626,15 @@
|
||||
immediate: true,
|
||||
deep: true,
|
||||
handler(n, o) {
|
||||
console.log('post module',n)
|
||||
this.editModule = JSON.parse(JSON.stringify(n));
|
||||
}
|
||||
},
|
||||
editModule: {
|
||||
immediate: true,
|
||||
deep: true,
|
||||
handler(n, o) {
|
||||
if (!n.id && n.type && n.type.toLowerCase() == 'snmp') {
|
||||
n.port = 161;
|
||||
this.expandedWalkData = [];
|
||||
this.$nextTick(() => {
|
||||
this.$refs.selectWalk.show();
|
||||
});
|
||||
for (let i = 0; i < n.walk.length; i++) {
|
||||
this.expandedWalkData.push(n.walk[i].substring(0, n.walk[i].lastIndexOf(".")));
|
||||
}
|
||||
} else if (!n.id && n.type && n.type.toLowerCase() == 'http') {
|
||||
n.port = 9100;
|
||||
if(n.id){
|
||||
this.reparseSnmpParam(this.editModule)
|
||||
}else{
|
||||
this.reparseSnmpParam(n)
|
||||
if(n.type&&n.type.toLowerCase() == 'snmp'){
|
||||
for (let i = 0; i < this.editModule.walk.length; i++) {
|
||||
this.expandedWalkData.push(this.editModule.walk[i].substring(0, this.editModule.walk[i].lastIndexOf(".")));
|
||||
}
|
||||
}
|
||||
if (!n.type) {
|
||||
n.type = 'http';
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user