fix: 修复endpoint更改module时变形的bug

This commit is contained in:
陈劲松
2020-04-02 20:35:13 +08:00
parent cf279dd11f
commit 7a521c67ed
2 changed files with 20 additions and 13 deletions

View File

@@ -177,7 +177,7 @@
projectData: [], //顶部菜单project列表中的数据 projectData: [], //顶部菜单project列表中的数据
editProject: {id: '', name: '', remark: ''}, //新增/编辑的project editProject: {id: '', name: '', remark: ''}, //新增/编辑的project
currentProject: {id: '', name: '', remark: ''}, //module/endpoint弹框用来回显project currentProject: {id: '', name: '', remark: ''}, //module/endpoint弹框用来回显project
editModule: {id: '', name: '', project: {}, port: '', path: '', param: '', paramObj: []}, //新增/编辑的module editModule: {id: '', type: 'http', name: '', project: {}, port: '', path: '', param: '', paramObj: []}, //新增/编辑的module
currentModule: {id: '', name: '', project: {}, port: '', path: '', param: '', paramObj: []}, //endpoint弹框用来回显module此处固定为空对象 currentModule: {id: '', name: '', project: {}, port: '', path: '', param: '', paramObj: []}, //endpoint弹框用来回显module此处固定为空对象
editEndpoint: { //新增/编辑的endpoint editEndpoint: { //新增/编辑的endpoint
id: '', id: '',

View File

@@ -1,6 +1,6 @@
<template> <template>
<transition name="right-box-840"> <transition name="right-box-840">
<div class="right-box right-box-add-endpoint" :class="{'right-box-add-endpoint-snmp': currentModuleCopy.type.toLowerCase() == 'snmp'}" v-if="rightBox.show" @mousedown="showEditParamBox(false)" v-clickoutside="clickos"> <div class="right-box right-box-add-endpoint" :class="{'right-box-add-endpoint-snmp': currentModuleCopy.type && currentModuleCopy.type.toLowerCase() == 'snmp'}" v-if="rightBox.show" @mousedown="showEditParamBox(false)" v-clickoutside="clickos">
<!-- begin--顶部按钮--> <!-- begin--顶部按钮-->
<div class="right-box-top-btns"> <div class="right-box-top-btns">
</div> </div>
@@ -74,23 +74,23 @@
<!--end--table--> <!--end--table-->
</div> </div>
<!--右侧endpoint列表--> <!--右侧endpoint列表-->
<div class="right-child-box endpoints-box" :class="{'endpoints-box-snmp': currentModuleCopy.type.toLowerCase() == 'snmp'}"> <div class="right-child-box endpoints-box" :class="{'endpoints-box-snmp': currentModuleCopy.type && currentModuleCopy.type.toLowerCase() == 'snmp'}">
<!--module--> <!--module-->
<div class="endpoints-box-module-info"> <div class="endpoints-box-module-info">
<div class="title">{{$t('project.endpoint.moduleParameter')}}:</div> <div class="title">{{$t('project.endpoint.moduleParameter')}}:</div>
<el-input class="module-info module-info-port input-x-mini-22" :class="{'module-info-port-snmp': currentModuleCopy.type.toLowerCase() == 'snmp'}" v-model="currentModuleCopy.port"></el-input> <el-input class="module-info module-info-port input-x-mini-22" :class="{'module-info-port-snmp': currentModuleCopy.type && currentModuleCopy.type.toLowerCase() == 'snmp'}" v-model="currentModuleCopy.port"></el-input>
<el-popover <el-popover
placement="bottom" placement="bottom"
width="200" width="200"
trigger="hover" trigger="hover"
v-if="currentModuleCopy.type.toLowerCase() == 'http'" v-if="currentModuleCopy.type && currentModuleCopy.type.toLowerCase() == 'http'"
> >
<div class="endpoint-param-pop"> <div class="endpoint-param-pop">
<div v-for="item,index in currentModuleCopy.paramObj">{{item.key}}={{item.value}}</div> <div v-for="item,index in currentModuleCopy.paramObj">{{item.key}}={{item.value}}</div>
</div> </div>
<el-input id="edit-param" @click.native.stop="showEditParamBox(true, currentModuleCopy, 1, $event)" slot="reference" disabled class="module-info module-info-param input-x-mini-22" v-model="currentModuleCopy.param"></el-input> <el-input id="edit-param" @click.native.stop="showEditParamBox(true, currentModuleCopy, 1, $event)" slot="reference" disabled class="module-info module-info-param input-x-mini-22" v-model="currentModuleCopy.param"></el-input>
</el-popover> </el-popover>
<el-input v-if="currentModuleCopy.type.toLowerCase() == 'http'" class="module-info module-info-path input-x-mini-22" v-model="currentModuleCopy.path"></el-input> <el-input v-if="currentModuleCopy.type && currentModuleCopy.type.toLowerCase() == 'http'" class="module-info module-info-path input-x-mini-22" v-model="currentModuleCopy.path"></el-input>
<button type="button" id="cover-param" @click="coverEndpoint" class="nz-btn nz-btn-size-small nz-btn-style-light module-info module-info-cover"><i class="nz-icon nz-icon-override"></i></button> <button type="button" id="cover-param" @click="coverEndpoint" class="nz-btn nz-btn-size-small nz-btn-style-light module-info module-info-cover"><i class="nz-icon nz-icon-override"></i></button>
</div> </div>
<!--endpoints--> <!--endpoints-->
@@ -635,13 +635,20 @@
if(n) { if(n) {
this.endpointForm.moduleId = n.id; this.endpointForm.moduleId = n.id;
this.currentModuleCopy = JSON.parse(JSON.stringify(n)); this.currentModuleCopy = JSON.parse(JSON.stringify(n));
if (n.type && n.type.toLowerCase() == 'snmp') {
this.endpointTableTitle[3].show = false; }
this.endpointTableTitle[4].show = false; }
} else { },
this.endpointTableTitle[3].show = true; currentModuleCopy: {
this.endpointTableTitle[4].show = true; immediate: true,
} handler(n, o) {
console.info(n)
if (n.type && n.type.toLowerCase() == 'snmp') {
this.endpointTableTitle[3].show = false;
this.endpointTableTitle[4].show = false;
} else {
this.endpointTableTitle[3].show = true;
this.endpointTableTitle[4].show = true;
} }
} }
}, },