This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
nezha-nezha-fronted/nezha-fronted/src/components/common/rightBox/trafficSetting/trafficSettingTab.vue

735 lines
27 KiB
Vue
Raw Normal View History

2020-04-28 17:39:54 +08:00
<template>
<div class="asset-config-tab">
<el-form-item :label="$t('asset.asset')" size="small" class="right-box-form-content" ref="assetConfigForm" label-width="90px">
2020-04-30 19:55:41 +08:00
<!--<el-select class="right-box-row-with-btn" clearable @clear="clearAssetInput" v-model="assetSetting.assetId" @change="assetChanged" popper-class="no-style-class" :class="{'input-error':assetValidate}">
2020-04-28 17:39:54 +08:00
<el-option v-for="(item,index) in assetList" :label="item.host" :disabled="item.isOccupy" :value="item.id" :key="item.host+'-'+item.id"></el-option>
2020-04-30 19:55:41 +08:00
</el-select>-->
<el-autocomplete
clearable
2020-05-06 13:59:00 +08:00
:class="{'input-error':hostInvalid || hostRepeat}"
2020-04-30 19:55:41 +08:00
class="asset-input right-box-row-with-btn"
v-model="assetSetting.host"
2020-05-06 13:59:00 +08:00
popper-class="no-style-class"
2020-04-30 19:55:41 +08:00
:fetch-suggestions="queryAssetHosts"
:debounce="1000"
:trigger-on-focus="false"
:highlight-first-item="true"
@input="hostInputChange"
2020-05-06 19:17:49 +08:00
@blur="validateHostEmpty"
2020-12-16 16:27:06 +08:00
></el-autocomplete><el-popover
@hide="popHide" @show="popShow" placement="bottom" popper-class="no-style-class" trigger="click">
2020-04-30 19:55:41 +08:00
<div class="mib-browser-ad-search">
2020-10-23 11:00:48 +08:00
<el-row class="mib-browser-ad-search-item" style="font-weight: bold">{{$t('config.dc.traffic.snmpSetting')}}</el-row>
2020-04-30 19:55:41 +08:00
<el-row class="mib-browser-ad-search-item">
<el-col :span="6"><div class="mib-browser-ad-search-label">{{$t("project.endpoint.port")}}</div></el-col>
<el-col :span="17">
<el-input class="input-x-mini-24" v-model.number="assetSetting.port"></el-input>
</el-col>
</el-row>
<el-row class="mib-browser-ad-search-item">
<el-col :span="6"><div class="mib-browser-ad-search-label">{{$t('project.module.community')}}</div></el-col>
<el-col :span="17">
<el-input class="input-x-mini-24" v-model="assetSetting.community"></el-input>
</el-col>
</el-row>
<el-row class="mib-browser-ad-search-item">
<el-col :span="6"><div class="mib-browser-ad-search-label">{{$t('project.module.version')}}</div></el-col>
<el-col :span="17">
<el-radio-group v-model.number="assetSetting.version" >
2020-04-30 19:55:41 +08:00
<el-radio-button :label="2"></el-radio-button>
<el-radio-button :label="3"></el-radio-button>
</el-radio-group>
</el-col>
</el-row>
<!--SNMP V3 setting-->
<template v-if="assetSetting.version == 3">
<el-row class="mib-browser-ad-search-item">
<el-col :span="6">
<div class="mib-browser-ad-search-label">{{$t('login.username')}}</div>
</el-col>
<el-col :span="17">
<el-input class="input-x-mini-24" v-model.trim="assetSetting.auth.username"></el-input>
</el-col>
</el-row>
<el-row class="mib-browser-ad-search-item">
<el-col :span="6">
<div class="mib-browser-ad-search-label">{{$t('project.module.securityLevel')}}</div>
</el-col>
<el-col :span="17">
<el-radio-group v-model="assetSetting.auth.securityLevel" size="small">
<el-radio-button label="noAuthNoPriv"></el-radio-button>
<el-radio-button label="authNoPriv"></el-radio-button>
<el-radio-button label="authPriv"></el-radio-button>
</el-radio-group>
</el-col>
</el-row>
<el-row class="mib-browser-ad-search-item" v-if="assetSetting.auth.securityLevel == 'authNoPriv' || assetSetting.auth.securityLevel == 'authPriv'">
<el-col :span="6">
<div class="mib-browser-ad-search-label">{{$t('login.password')}}</div>
2020-04-30 19:55:41 +08:00
</el-col>
<el-col :span="17">
<el-input class="input-x-mini-24" v-model.trim="assetSetting.auth.password"></el-input>
</el-col>
</el-row>
<el-row class="mib-browser-ad-search-item same-label-width" v-if="assetSetting.auth.securityLevel == 'authNoPriv' || assetSetting.auth.securityLevel == 'authPriv'">
<el-col :span="6">
<div class="mib-browser-ad-search-label">{{$t('project.module.authProtocol')}}</div>
</el-col>
<el-col :span="17">
<el-radio-group v-model="assetSetting.auth.authProtocol">
<el-radio-button label="MD5"></el-radio-button>
<el-radio-button label="SHA"></el-radio-button>
</el-radio-group>
</el-col>
</el-row>
<el-row class="mib-browser-ad-search-item same-label-width" v-if="assetSetting.auth.securityLevel == 'authPriv'">
<el-col :span="6">
<div class="mib-browser-ad-search-label">{{$t('project.module.privProtocol')}}</div>
</el-col>
<el-col :span="17">
<el-radio-group v-model="assetSetting.auth.privProtocol">
<el-radio-button label="DES"></el-radio-button>
<el-radio-button label="AES"></el-radio-button>
</el-radio-group>
</el-col>
</el-row>
<el-row class="mib-browser-ad-search-item" v-if="assetSetting.auth.securityLevel == 'authPriv'">
<el-col :span="6">
<div class="mib-browser-ad-search-label">{{$t('project.module.privPassword')}}</div>
2020-04-30 19:55:41 +08:00
</el-col>
<el-col :span="17">
<el-input class="input-x-mini-24" v-model.trim="assetSetting.auth.privPassword"></el-input>
</el-col>
</el-row>
</template>
</div>
<button type="button" slot="reference" class="nz-btn nz-btn-size-normal nz-btn-style-light" id="snmp-advanced">
<i class="el-icon-more"></i>
2020-04-30 19:55:41 +08:00
</button>
</el-popover>
2020-12-16 16:27:06 +08:00
<span @click="delSelf" class="right-box-form-minus-box"
style="vertical-align: middle;right: 0;
position: absolute;
line-height: 21px;
height: 21px;
top: 50%;
transform: translateY(-50%);"
><i class="nz-icon nz-icon-minus"></i></span>
2020-05-06 19:17:49 +08:00
<div>
<span style="color:#F56C6C;font-size: 12px;" v-if="hostRepeat">{{$t('validate.repeat')}}</span>
<span style="color:#F56C6C;font-size: 12px;" v-if="hostInvalid">{{$t('validate.host')}}</span>
<span style="color:#F56C6C;font-size: 12px;" v-if="hostEmpty">{{$t('validate.required')}}</span>
</div>
2020-04-28 17:39:54 +08:00
</el-form-item>
2020-10-15 14:27:46 +08:00
<div class="endpoints-box-endpoints" style="border: 1px solid #E7EAED;border-radius: 2px;padding-bottom: 10px">
2020-04-28 17:39:54 +08:00
<el-table :data="assetSetting.configs"
tooltip-effect="light"
max-height="300"
height="200"
2020-04-30 19:55:41 +08:00
:row-class-name="assetSetting.host == null?'not-allowed':''"
2020-04-28 17:39:54 +08:00
@row-dblclick="changeRowEditState"
@row-click="validateRows"
class="taffic-setting-tab"
2020-05-06 19:17:49 +08:00
v-if="refreshTab"
2020-04-28 17:39:54 +08:00
style="width: 100%;">
<el-table-column
2020-10-15 14:27:46 +08:00
label-class-name="traffic-set-table-title"
2020-04-28 17:39:54 +08:00
:resizable="false"
show-overflow-tooltip
v-for="(item, index) in tableLabels"
:width="item.width"
2020-04-30 19:55:41 +08:00
align="center"
2020-04-28 17:39:54 +08:00
:key="`col-${index}`"
2020-04-30 19:55:41 +08:00
style="max-height: 200px"
2020-04-28 17:39:54 +08:00
>
<template slot="header">
<span v-if="item.required == true"><span style="color: red;">*</span>{{item.label}}</span>
<span v-else>{{item.label}}</span>
</template>
<template slot-scope="scope" :column="item">
<template v-if="item.prop == 'tags'">
2020-05-06 19:17:49 +08:00
<div class="tab-tags" @click="showEditTagsBox(true,scope.$index,scope.row,$event)">
<!--<el-scrollbar style="height: 100%;">
2020-04-30 19:55:41 +08:00
<el-tag
v-for="(value, key, index) in scope.row[item.prop]"
class="tab-tags"
size="mini"
:key="key"
style="display: block;margin-bottom:5px;" >
2020-05-06 19:17:49 +08:00
&lt;!&ndash; <div class="tab-tags-item">&ndash;&gt;
&lt;!&ndash; <div class="tag-item-key">{{key}}</div><div class="tag-item-value">{{value}}</div>&ndash;&gt;
2020-04-30 19:55:41 +08:00
2020-05-06 19:17:49 +08:00
&lt;!&ndash; </div>&ndash;&gt;
2020-04-30 19:55:41 +08:00
{{key}}{{value}}
</el-tag>
2020-05-06 19:17:49 +08:00
</el-scrollbar>-->
<el-tooltip placement="top" effect="light" popper-class="tags-pop transparent-pop">
<div slot="content">
<template v-if="scope.row[item.prop]">
<div class="tab-tags-item" v-for="(value, key, index) in scope.row[item.prop]">
<div class="tag-item-key">{{key}}</div>
<div class="tag-item-value">{{value}}</div>
</div>
</template>
2020-05-06 19:17:49 +08:00
</div>
<div class="tab-tags-item" v-if="scope.row[item.prop]&&Object.keys(scope.row[item.prop]).length>0">
2020-05-06 19:17:49 +08:00
<div class="tag-item-key">{{Object.keys(scope.row[item.prop])[0]}}</div>
<div class="tag-item-value">{{scope.row[item.prop][Object.keys(scope.row[item.prop])[0]]}}</div>
<div class="tag-item-text" v-if="Object.keys(scope.row[item.prop]).length>1">+{{Object.keys(scope.row[item.prop]).length-1}}</div>
</div>
</el-tooltip>
2020-04-30 19:55:41 +08:00
</div>
2020-04-28 17:39:54 +08:00
</template>
<template v-if="item.prop == 'ifindex'">
<span v-if="scope.row.edit==false">{{scope.row[item.prop]}}</span>
<template v-else>
2020-04-30 19:55:41 +08:00
<!-- <el-select v-model="scope.row[item.prop]" :disabled="assetSetting.host == null" size="mini" popper-class="no-style-class" @change="ifIndexChange(scope.row[item.prop],scope.row)" :class="{'input-error':isError(item.errRows,scope.$index),'transparent-pop':assetSetting.host == null}">-->
<!-- <el-option v-for="(item,index) in ifIndexList" :label="item.label" :value="item.value" :key="item.value" :disabled="item.isOccupy"></el-option>-->
<!-- </el-select>-->
<el-autocomplete
2020-05-06 13:59:00 +08:00
v-model="scope.row[item.prop]"
:class="{'input-error':isError(item.errRows,scope.$index)||ifIndexError,'transparent-pop':assetSetting.host == ''}"
2020-04-30 19:55:41 +08:00
:fetch-suggestions="loadIfIndex"
:debounce="300"
:trigger-on-focus="true"
2020-05-06 13:59:00 +08:00
popper-class="no-style-class"
2020-04-30 19:55:41 +08:00
size="mini"
:highlight-first-item="true"
2020-05-06 13:59:00 +08:00
@input="ifIndexInputChange(scope.row[item.prop],scope.row,scope.$index)"
2020-04-30 19:55:41 +08:00
></el-autocomplete>
2020-04-28 17:39:54 +08:00
</template>
</template>
<template v-if="item.prop == 'ifdescr'">
2020-05-06 19:17:49 +08:00
<!--<span v-if="scope.row.edit==false">{{scope.row[item.prop]}}</span>
2020-05-06 13:59:00 +08:00
<template v-else>
<el-input v-model="scope.row[item.prop]" size="small" clearable></el-input>
2020-05-06 19:17:49 +08:00
</template>-->
<span>{{scope.row[item.prop]}}</span>
2020-04-28 17:39:54 +08:00
</template>
<template v-if="item.prop == 'direction'">
<template v-if="scope.row.edit==false">
<span v-if="scope.row[item.prop][0]">{{scope.row[item.prop][0]}}</span>
<span v-if="scope.row[item.prop][1]">{{scope.row[item.prop][1]}}</span>
</template>
<template v-else>
2020-04-30 19:55:41 +08:00
<el-checkbox-group :disabled="assetSetting.host == null" v-model="scope.row[item.prop]" class="direction-checkbox" :class="{'input-error':isError(item.errRows,scope.$index),'transparent-pop':assetSetting.host == null}">
2020-04-28 17:39:54 +08:00
<div class="input__inner">
2020-05-06 13:59:00 +08:00
<el-checkbox label="rx">RX</el-checkbox>
<el-checkbox label="tx" >TX</el-checkbox>
2020-04-28 17:39:54 +08:00
</div>
</el-checkbox-group>
</template>
</template>
</template>
</el-table-column>
2020-10-15 14:27:46 +08:00
<el-table-column label="" :width="40" :show-overflow-tooltip="false">
2020-04-28 17:39:54 +08:00
<template slot-scope="scope">
2020-10-15 14:27:46 +08:00
<span @click.stop="delTabRow(scope.$index,scope.row)" :disabled="assetSetting.host == null" class=".right-box-form-delete" size="mini"><i class="nz-icon nz-icon-minus"></i></span>
2020-04-28 17:39:54 +08:00
</template>
</el-table-column>
</el-table>
2020-10-15 14:27:46 +08:00
<div class="add-btn" style="margin-top: 10px;">
<span @click="addTabRow" size="mini" class="right-box-form-add">
<i class="nz-icon nz-icon-plus"></i>
</span>
2020-04-28 17:39:54 +08:00
</div>
</div>
2020-05-06 19:17:49 +08:00
<sub-box ref="subBox" @after="refreshTabFunc"></sub-box>
2020-04-28 17:39:54 +08:00
<loading ref="loading"></loading>
</div>
</template>
<script>
import subBox from "./subBox";
import loading from "../../loading";
2020-05-06 13:59:00 +08:00
import vm from "../../../../main";
2020-04-28 17:39:54 +08:00
export default {
name: "assetConfigTab",
components:{
'sub-box':subBox,
'loading':loading,
},
props:{
index:{},
postAssetList:{type:Array,required:true},
assetSetting:{type:Object},
2020-05-06 13:59:00 +08:00
validateRepeatFunc:{type:Function},
2020-04-28 17:39:54 +08:00
},
data(){
return {
assetList:[],
assetValidate:false,
2020-05-06 13:59:00 +08:00
hostRepeat:false,
hostInvalid:false,
2020-05-06 19:17:49 +08:00
hostEmpty:false,
refreshTab:true,
2020-04-28 17:39:54 +08:00
tableLabels:[
{
2020-05-06 13:59:00 +08:00
label:'ifIndex',
2020-04-28 17:39:54 +08:00
prop:'ifindex',
2020-08-27 18:38:59 +08:00
width:100,
2020-04-28 17:39:54 +08:00
required:true,
errRows:[],
},
{
2020-05-06 13:59:00 +08:00
label:'ifDescr',
2020-04-28 17:39:54 +08:00
prop:'ifdescr',
2020-10-15 14:27:46 +08:00
width:100,
2020-04-28 17:39:54 +08:00
required:false,
errRows:[],
},
{
2020-05-06 19:17:49 +08:00
label:this.$t('config.dc.traffic.direction'),
2020-04-28 17:39:54 +08:00
prop:'direction',
2020-10-15 14:27:46 +08:00
width:100,
2020-04-28 17:39:54 +08:00
required:true,
errRows:[],
},
{
2020-05-06 19:17:49 +08:00
label:this.$t('config.dc.traffic.tags'),
2020-04-28 17:39:54 +08:00
prop:'tags',
required:false,
errRows:[],
},
],
ifIndexList:[],
ifDescMap:new Map(),
editTagsBox: {show: false, top: 0, left: 0,}, //param编辑弹框
tempTagsObj:[],
showTags:[],
2020-04-30 19:55:41 +08:00
showTagInput:false,
newTag:{key:'',value:''},
hostTimer:null,
ifIndexError:false,
2020-04-28 17:39:54 +08:00
}
},
created() {
this.assetList=Object.assign([],this.postAssetList);
this.showTags=Object.assign([],this.assetSetting.tags)
},
methods:{
clearAssetInput:function(){
this.resetComponet();
},
2020-05-06 19:17:49 +08:00
refreshTabFunc:function(){
this.refreshTab=false;
this.$nextTick(()=>{
this.refreshTab=true;
});
},
2020-04-28 17:39:54 +08:00
resetComponet:function(){
this.ifIndexList=[];
this.assetSetting.assetId=null;
this.assetSetting.configs=[];
this.assetSetting.configs.push({
direction:[],
ifindex:null,
ifdescr:' ',
tags:{},
2020-04-28 17:39:54 +08:00
edit:true,
})
this.tableLabels=this.tableLabels.map(item=>{
item.errRows=[];
return item;
})
},
ifIndexChange:function(ifIndex,row){
this.$set(row,'ifdescr',this.ifDescMap.get('ifDescr.'+ifIndex))
},
assetChanged:function(){
if(!this.assetSetting||this.assetSetting.assetId == null){
return ;
}
this.assetValidate=false;
this.assetSetting.configs=[
{
direction:[],
ifindex:null,
ifdescr:' ',
tags:{},
2020-04-28 17:39:54 +08:00
edit:true,
}
]
this.queryInterfaceInfos(this.assetSetting.assetId,true);
},
2020-04-30 19:55:41 +08:00
queryInterfaceInfos:function(skipCommit=false){
// this.$refs.loading.startLoading();
let queryParams={
operation:'walk',
host:this.assetSetting.host,
port:this.assetSetting.port,
version:this.assetSetting.version,
community:this.assetSetting.community,
oid:'1.3.6.1.2.1.2.2.1',
auth:this.assetSetting.auth,
2020-04-28 17:39:54 +08:00
}
2020-04-30 19:55:41 +08:00
this.$post('/mib/browser',queryParams).then(response=>{
this.ifIndexList=[];
this.ifDescMap.clear();
if(response.code == 200){
let resultList=response.data.list;
let ifIndexList=resultList.filter(item=>{
return /if(?:Index)\.\d+/.test(item.name);
})
this.ifIndexList=ifIndexList.map(item=>{
2020-05-06 13:59:00 +08:00
return {label:item.value,value:item.value,isOccupy:false};
2020-04-30 19:55:41 +08:00
})
let ifDescrList=resultList.filter(item=>{
return /if(?:Descr)\.\d+/.test(item.name);
})
this.ifDescrList=ifDescrList.filter(item=>{
this.ifDescMap.set(item.name,item.value)
})
this.commitAdd(skipCommit);
// this.$refs.loading.endLoading();
}else{
// this.$refs.loading.endLoading();
console.error(response);
2020-05-06 13:59:00 +08:00
// this.$message.error(response.msg)
2020-04-30 19:55:41 +08:00
}
2020-04-28 17:39:54 +08:00
})
2020-04-30 19:55:41 +08:00
},
loadIfIndex:function(queryString,cb){
2020-05-06 13:59:00 +08:00
let result=Object.assign([],this.ifIndexList);
result=result.filter(item=>{
let temp=this.assetSetting.configs.find(c=>{
return c.ifindex == item.value;
})
return typeof temp == "undefined";
})
cb(result)
2020-04-30 19:55:41 +08:00
},
queryAssetHosts:function(queryString,cb){
let param={
pageSize:-1,
host:queryString,
}
this.$get('/asset',param).then(response=>{
if(response.code == 200){
let data=response.data.list;
let result=data.map(item=>{
return {label:item.host,value:item.host}
})
cb(result)
}else{
cb([]);
console.error(response)
2020-04-28 17:39:54 +08:00
}
2020-04-30 19:55:41 +08:00
})
},
popShow() {
2020-04-28 17:39:54 +08:00
2020-04-30 19:55:41 +08:00
},
popHide() {
this.queryInterfaceInfos(true);
2020-04-30 19:55:41 +08:00
},
showInput:function(){
this.showTagInput=true;
},
handleInputConfirm:function(){
},
2020-05-06 13:59:00 +08:00
ifIndexInputChange:function(ifindex,row,index){
2020-04-30 19:55:41 +08:00
if(this.ifIndexList && this.ifIndexList.length>0){
2020-05-06 19:17:49 +08:00
// let temp=this.ifIndexList.find(item=>{
// return item.value == ifindex;
// })
// if(!temp){
// this.ifIndexError=true;
// return ;
// }else{
// this.ifIndexError=false;
// }
2020-05-06 13:59:00 +08:00
this.ifIndexChange(ifindex,row)
let tmp=this.assetSetting.configs.find((item,i)=>{
return i != index && item.ifindex == ifindex;
})
if(tmp){
this.ifIndexError=true;
return ;
}else{
this.ifIndexError=false;
}
}else{
this.ifIndexError=false;
2020-04-28 17:39:54 +08:00
}
},
2020-04-30 19:55:41 +08:00
hostInputChange:function(value){
if(this.hostTimer){
clearTimeout(this.hostTimer);
}
this.hostTimer=setTimeout(()=>{
2020-05-06 13:59:00 +08:00
this.validateHostRepeat(value);
this.validateHostValid(value);
2020-05-06 19:17:49 +08:00
if(!this.hostEmpty&&!this.hostRepeat&&!this.hostInvalid){
this.queryInterfaceInfos(true);
}
},500)
},
validateHostEmpty:function(){
this.hostEmpty=!this.assetSetting.host||this.assetSetting.host == '';
2020-04-30 19:55:41 +08:00
},
2020-05-06 13:59:00 +08:00
validateHostValid:function(host){
2020-05-06 19:17:49 +08:00
if(host==''){
return false
}
2020-05-06 13:59:00 +08:00
const hostReg = /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])(\:\d{0,5})?$/
if (hostReg.test(host)) {
this.hostInvalid=false;
} else {
this.hostInvalid=true;
}
},
validateHostRepeat:function(host){
if(!this.validateRepeatFunc(host,this.index)){
this.hostRepeat=true;
}else{
this.hostRepeat=false;
}
},
2020-04-28 17:39:54 +08:00
changeRowEditState:function(row,column,event){
if(this.validateRows()){
2020-05-06 13:59:00 +08:00
this.commitAdd(false);
2020-04-28 17:39:54 +08:00
if(row.edit == true){
this.$set(row,'edit',false)
}else{
this.$set(row,'edit',true)
}
}
},
validateRows:function(){
let validateFlag=true;
2020-04-30 19:55:41 +08:00
validateFlag=this.assetSetting && this.assetSetting.host != '' ;
2020-04-28 17:39:54 +08:00
if(!validateFlag){
this.assetValidate=true;
return validateFlag;
}
this.assetValidate=false
this.tableLabels.forEach(item=>{
item.errRows=[];
})
this.assetSetting.configs.forEach((config,index)=>{
this.tableLabels.forEach(label=>{
let value=config[label.prop]
let required=label.required
if(required &&(!value || (typeof value =='string' && value == '')||(value instanceof Array && value.length<1))){
validateFlag=false
label.errRows.push(index) //保存有错误的行的index通过行列唯一定位有错误的输入框
2020-05-06 19:17:49 +08:00
}else{
if(label.prop == 'ifindex'){
if(this.ifIndexList && this.ifIndexList.length>0) {
let temp = this.ifIndexList.find(item => {
return item.value == value;
})
if(!temp){
validateFlag=false
label.errRows.push(index) //保存有错误的行的index通过行列唯一定位有错误的输入框
}
}
}
2020-04-28 17:39:54 +08:00
}
})
})
2020-05-06 13:59:00 +08:00
if(this.ifIndexError){
validateFlag=false;
}
2020-04-28 17:39:54 +08:00
return validateFlag;
},
isError:function(columnErrRows,rowIndex){
return columnErrRows.includes(rowIndex);
},
commitAdd:function(skipChangeEditState=false){
this.resetIfIndexOccupyState();
this.assetSetting.configs=this.assetSetting.configs.map((config)=>{
if(!skipChangeEditState){
this.$set(config,'edit',false)
}
this.changeIfIndexOccupyState(config.ifindex,true);
return config
})
},
addTabRow:function(){
let validateFlag=this.validateRows();
if(validateFlag){
this.commitAdd();
this.assetSetting.configs.push({
direction:[],
ifindex:null,
ifdescr:' ',
2020-05-06 19:17:49 +08:00
tags:{},
2020-04-28 17:39:54 +08:00
edit:true,
})
}
},
2020-05-06 19:17:49 +08:00
delTabRow:function(index,row){
2020-04-28 17:39:54 +08:00
if(this.assetSetting.configs.length>1){
2020-05-06 19:17:49 +08:00
this.assetSetting.configs.splice(index,1);
if(row.edit == true && this.ifIndexError == true){
this.ifIndexError=false;
}
this.changeIfIndexOccupyState(row.ifindex,false)
2020-04-28 17:39:54 +08:00
}
},
resetIfIndexOccupyState:function(){
this.ifIndexList=this.ifIndexList.map(item=>{
item.isOccupy=false;
return item;
})
},
changeIfIndexOccupyState:function(ifindex,state){
this.ifIndexList=this.ifIndexList.map(item=>{
if(item.value == ifindex){
item.isOccupy=state;
}
return item;
})
},
delSelf:function(){
this.$emit('delSelf',this.index)
},
2020-05-06 13:59:00 +08:00
showEditTagsBox:function(show,index,row,e){
if(this.assetSetting.host != '' && row.edit == true){
2020-04-28 17:39:54 +08:00
this.$refs.subBox.showEditTagsBox(show,this.assetSetting.configs,index,e);
}
},
},
mounted() {
2020-05-06 13:59:00 +08:00
if(this.assetSetting&&this.assetSetting.host&&this.assetSetting.host != ''){
this.queryInterfaceInfos(true);
2020-04-28 17:39:54 +08:00
}
}
}
</script>
<style scoped>
.asset-config-tab{
2020-10-15 14:27:46 +08:00
width: calc(100% - 160px);
2020-04-28 17:39:54 +08:00
min-height: 100px;
max-height: 400px;
border: 1px solid lightgrey;
border-radius: 5px;
2020-10-15 14:27:46 +08:00
padding:18px 50px 25px 40px;
2020-04-28 17:39:54 +08:00
margin: 0;
margin-bottom: 10px;
2020-10-15 14:27:46 +08:00
margin-left: 70px;
2020-04-28 17:39:54 +08:00
position: relative;
}
.asset-config-tab .add-btn{
text-align: center;
}
2020-04-30 19:55:41 +08:00
.asset-config-tab #snmp-advanced{
border-top-left-radius: 0px;
border-bottom-left-radius: 0px;
height: 30px;
2020-12-16 16:27:06 +08:00
top: 1px;
left: -1px;
2020-04-30 19:55:41 +08:00
}
.asset-config-tab .right-box-row-with-btn{
width: calc(100% - 69px);
}
2020-10-15 14:27:46 +08:00
/deep/ .el-table tr:last-child td{
border-bottom: none;
}
/deep/ .el-table .traffic-set-table-title{
color: #0275b8;
}
2020-04-28 17:39:54 +08:00
</style>
<style lang="scss">
2020-04-30 19:55:41 +08:00
.tab-tags{
2020-05-06 19:17:49 +08:00
width: 100%;
height: 22px;
}
.tags-pop{
width: 110px;
text-align: center;
2020-04-30 19:55:41 +08:00
}
2020-05-06 19:17:49 +08:00
.tab-tags-item{
2020-04-30 19:55:41 +08:00
display: flex;
2020-05-06 19:17:49 +08:00
margin-bottom: 5px;
height: 20px;
2020-10-12 13:46:31 +08:00
line-height: 18px;
2020-12-16 16:27:06 +08:00
justify-content: center;
2020-04-30 19:55:41 +08:00
}
.tab-tags-item .tag-item-key{
border:1px solid #409eff;;
2020-05-06 19:17:49 +08:00
border-top-left-radius: 3px;
border-bottom-left-radius: 3px;
background-color: #409eff;
2020-12-16 16:27:06 +08:00
min-width: 40px;
padding: 0 8px;
color: white;
2020-05-06 19:17:49 +08:00
}
.tab-tags-item .tag-item-value{
border:1px solid #409eff;
2020-05-06 19:17:49 +08:00
border-top-right-radius: 3px;
border-bottom-right-radius: 3px;
background-color: #FFF;
2020-12-16 16:27:06 +08:00
min-width: 40px;
padding: 0 8px;
2020-05-06 19:17:49 +08:00
}
.tab-tags-item .tag-item-text{
background-color: #FFF;
width: 20px;
2020-04-30 19:55:41 +08:00
}
2020-04-28 17:39:54 +08:00
.taffic-setting-tab .el-table__row:hover{
.input__inner{
border-color: #F0F0F0;
}
}
.input__inner{
border: 1px solid;
border-color: white;
border-radius: 4px;
padding-left: 4px;
2020-04-28 17:39:54 +08:00
background-color: white;
}
.input-error .el-input__inner,.input-error .el-input__inner:hover,.input-error .el-input__inner:focus,
.input-error .input__inner,.input-error .input__inner:hover,.input-error .input__inner:focus {
border-color: #F56C6C !important;
}
.direction-checkbox .el-checkbox{
margin-right: 10px;
}
.direction-checkbox .el-checkbox__label{
padding-left:0px
}
2020-04-30 19:55:41 +08:00
/*.taffic-setting-tab td>.cell , .taffic-setting-tab td{
2020-04-28 17:39:54 +08:00
text-align: center !important;
padding:0 10px!important;
}
.taffic-setting-tab th>.cell{
text-align: center !important;
padding:0 10px!important;
2020-04-30 19:55:41 +08:00
}*/
2020-04-28 17:39:54 +08:00
.not-allowed:hover{
cursor: not-allowed;
}
2020-04-30 19:55:41 +08:00
.asset-config-tab .asset-input .el-input__inner{
border-top-right-radius: 0px !important;
border-bottom-right-radius: 0px !important;
}
/*mib 移植*/
.mib-browser-ad-search-item {
margin-bottom: 10px;
}
.mib-browser-ad-search .el-radio-group .el-radio-button__inner {
height: 24px;
line-height: 0;
}
.mib-browser-ad-search-label {
line-height: 24px;
}
.mib-browser-ad-search {
width: 450px;
}
2020-04-28 17:39:54 +08:00
</style>