2020-07-27 18:26:44 +08:00
|
|
|
<template>
|
2020-07-28 11:45:37 +08:00
|
|
|
<span>
|
|
|
|
|
<div class="alertLabelInfo" v-if="type==='asset'" v-loading="loading">
|
|
|
|
|
<div class="alertLabelBox">
|
|
|
|
|
<div class="alertLabelTitle">ID</div>
|
|
|
|
|
<div class="alertLabelValue">{{alertLabelData?alertLabelData.id:''}}</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="alertLabelBox">
|
|
|
|
|
<div class="alertLabelTitle">SN</div>
|
|
|
|
|
<div class="alertLabelValue">{{alertLabelData?alertLabelData.sn:''}}</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="alertLabelBox">
|
|
|
|
|
<div class="alertLabelTitle">Host</div>
|
|
|
|
|
<div class="alertLabelValue">{{alertLabelData?alertLabelData.host:''}}</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="alertLabelBox">
|
|
|
|
|
<div class="alertLabelTitle">State</div>
|
|
|
|
|
<div class="alertLabelValue">{{alertLabelData?(alertStateStr(alertLabelData.state)):''}}</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="alertLabelBox">
|
|
|
|
|
<div class="alertLabelTitle">Ping</div>
|
|
|
|
|
<div class="alertLabelValue">
|
2020-07-28 14:26:51 +08:00
|
|
|
<div v-if="alertLabelData" :class="{'active-icon green':alertLabelData.pingStatus == 1,'active-icon red':alertLabelData.pingStatus == 0}"></div>
|
2020-07-28 11:45:37 +08:00
|
|
|
<span v-if="alertLabelData">{{alertLabelData.pingRtt?alertLabelData.pingRtt+'ms':''}}</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="alertLabelBox">
|
2020-07-28 14:26:51 +08:00
|
|
|
<div class="alertLabelTitle">Asset Type</div>
|
|
|
|
|
<div class="alertLabelValue">{{alertLabelData?alertLabelData.assetType:''}}</div>
|
2020-07-28 11:45:37 +08:00
|
|
|
</div>
|
|
|
|
|
<div class="alertLabelBox">
|
|
|
|
|
<div class="alertLabelTitle">Vendor</div>
|
2020-07-28 14:26:51 +08:00
|
|
|
<div class="alertLabelValue">{{alertLabelData?alertLabelData.vendor:''}}</div>
|
2020-07-28 11:45:37 +08:00
|
|
|
</div>
|
|
|
|
|
<div class="alertLabelBox">
|
|
|
|
|
<div class="alertLabelTitle">Model</div>
|
2020-07-28 14:26:51 +08:00
|
|
|
<div class="alertLabelValue">{{alertLabelData?alertLabelData.model:''}}</div>
|
2020-07-28 11:45:37 +08:00
|
|
|
</div>
|
|
|
|
|
<div class="alertLabelBox">
|
2020-07-28 14:26:51 +08:00
|
|
|
<div class="alertLabelTitle">PingLastReply</div>
|
|
|
|
|
<div class="alertLabelValue">{{alertLabelData?alertLabelData.pingLastReply:''}}</div>
|
2020-07-28 11:45:37 +08:00
|
|
|
</div>
|
|
|
|
|
<div class="alertLabelBox">
|
|
|
|
|
<div class="alertLabelTitle">Alert</div>
|
2020-07-28 14:26:51 +08:00
|
|
|
<div class="alertLabelValue"><sapn v-if="alertLabelData" :class="{danger:alertLabelData.alert>0,success:alertLabelData.alert<=0}">{{alertLabelData.alert + alertActiveStr()}}</sapn></div>
|
2020-07-28 11:45:37 +08:00
|
|
|
</div>
|
|
|
|
|
<div class="alertLabelBox">
|
2020-07-28 14:26:51 +08:00
|
|
|
<div class="alertLabelTitle">DC</div>
|
|
|
|
|
<div class="alertLabelValue">{{alertLabelData?alertLabelData.dataCenter:''}}</div>
|
2020-07-28 11:45:37 +08:00
|
|
|
</div>
|
|
|
|
|
<div class="alertLabelBox">
|
|
|
|
|
<div class="alertLabelTitle">Endpoint</div>
|
2020-07-28 14:26:51 +08:00
|
|
|
<div class="alertLabelValue">{{alertLabelData?alertLabelData.endpoint:''}}</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="alertLabelBox">
|
|
|
|
|
<div class="alertLabelTitle">Administrator</div>
|
|
|
|
|
<div class="alertLabelValue">{{alertLabelData?alertLabelData.principal:''}}</div>
|
2020-07-28 11:45:37 +08:00
|
|
|
</div>
|
2020-07-27 18:26:44 +08:00
|
|
|
</div>
|
2020-07-28 11:45:37 +08:00
|
|
|
|
|
|
|
|
<div class="alertLabelInfo" v-if="type==='module'" v-loading="loading">
|
2020-07-27 18:26:44 +08:00
|
|
|
<div class="alertLabelBox">
|
|
|
|
|
<div class="alertLabelTitle">ID</div>
|
|
|
|
|
<div class="alertLabelValue">{{alertLabelData?alertLabelData.id:''}}</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="alertLabelBox">
|
|
|
|
|
<div class="alertLabelTitle">Name</div>
|
|
|
|
|
<div class="alertLabelValue">{{alertLabelData?alertLabelData.name:''}}</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="alertLabelBox">
|
|
|
|
|
<div class="alertLabelTitle">Project</div>
|
|
|
|
|
<div class="alertLabelValue">{{alertLabelData?alertLabelData.project.name:''}}</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="alertLabelBox">
|
|
|
|
|
<div class="alertLabelTitle">Description</div>
|
2020-07-28 10:19:00 +08:00
|
|
|
<div class="alertLabelValue">{{alertLabelData?(alertLabelData.remark?alertLabelData.remark:'-'):''}}</div>
|
2020-07-27 18:26:44 +08:00
|
|
|
</div>
|
|
|
|
|
</div>
|
2020-07-28 11:45:37 +08:00
|
|
|
|
|
|
|
|
<div class="alertLabelInfo" v-if="type==='project'" v-loading="loading">
|
2020-07-27 18:26:44 +08:00
|
|
|
<div class="alertLabelBox">
|
|
|
|
|
<div class="alertLabelTitle">ID</div>
|
|
|
|
|
<div class="alertLabelValue">{{alertLabelData?alertLabelData.id:''}}</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="alertLabelBox">
|
|
|
|
|
<div class="alertLabelTitle">Name</div>
|
|
|
|
|
<div class="alertLabelValue">{{alertLabelData?alertLabelData.name:''}}</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="alertLabelBox">
|
|
|
|
|
<div class="alertLabelTitle">Description</div>
|
2020-07-28 10:19:00 +08:00
|
|
|
<div class="alertLabelValue">{{alertLabelData?(alertLabelData.remark?alertLabelData.remark:'-'):''}}</div>
|
2020-07-27 18:26:44 +08:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</span>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
export default {
|
|
|
|
|
name:"alertLabel",
|
|
|
|
|
props:{
|
|
|
|
|
id:{},
|
|
|
|
|
severityData:{
|
|
|
|
|
type:Array
|
|
|
|
|
},
|
|
|
|
|
type:{},
|
2020-07-28 11:45:37 +08:00
|
|
|
labelLoading:{},
|
|
|
|
|
that:{}
|
2020-07-27 18:26:44 +08:00
|
|
|
},
|
|
|
|
|
watch:{
|
|
|
|
|
labelLoading(){
|
|
|
|
|
if(this.type==='asset'){
|
2020-07-28 14:26:51 +08:00
|
|
|
this.$get('/asset/info?id='+this.id).then((res)=>{
|
2020-07-27 18:26:44 +08:00
|
|
|
if(res.msg==='success'){
|
|
|
|
|
this.loading=false;
|
2020-07-28 14:26:51 +08:00
|
|
|
this.alertLabelData=res.data.Basic;
|
2020-07-27 18:26:44 +08:00
|
|
|
} else{
|
|
|
|
|
this.$message.error(res.msg);
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
if(this.type==='project'){
|
2020-07-28 14:26:51 +08:00
|
|
|
this.$get('/project/info?id='+this.id).then((res)=>{
|
2020-07-27 18:26:44 +08:00
|
|
|
if(res.msg==='success'){
|
|
|
|
|
this.loading=false;
|
2020-07-28 14:26:51 +08:00
|
|
|
this.alertLabelData=res.data.basic;
|
2020-07-27 18:26:44 +08:00
|
|
|
} else{
|
|
|
|
|
this.$message.error(res.msg);
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
if(this.type==='module'){
|
|
|
|
|
this.$get('/module?id='+this.id).then((res)=>{
|
|
|
|
|
if(res.msg==='success'){
|
|
|
|
|
this.loading=false;
|
|
|
|
|
this.alertLabelData=res.data.list[0];
|
|
|
|
|
} else{
|
|
|
|
|
this.$message.error(res.msg);
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
alertLabelData:null,
|
2020-07-28 10:19:00 +08:00
|
|
|
loading:true
|
2020-07-27 18:26:44 +08:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
components:{
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
methods:{
|
2020-07-28 11:45:37 +08:00
|
|
|
alertActiveStr(){
|
|
|
|
|
return vm.$t('overall.active');
|
|
|
|
|
},
|
|
|
|
|
alertStateStr(num){
|
|
|
|
|
if( num == 1){
|
|
|
|
|
return vm.$t('asset.inStock')
|
|
|
|
|
} else {
|
|
|
|
|
return vm.$t('asset.notInStock')
|
|
|
|
|
}
|
2020-07-28 14:26:51 +08:00
|
|
|
},
|
2020-07-27 18:26:44 +08:00
|
|
|
},
|
|
|
|
|
mounted(){
|
2020-07-28 11:45:37 +08:00
|
|
|
// console.log(vm.$t('overall.exportAll'));
|
2020-07-27 18:26:44 +08:00
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
.alertLabelInfo{
|
|
|
|
|
border: 1px solid #ebeef5;
|
|
|
|
|
border-bottom: none;
|
|
|
|
|
font-size: 13px;
|
|
|
|
|
line-height: 26px;
|
|
|
|
|
}
|
|
|
|
|
.alertLabelBox{
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content:space-between;
|
|
|
|
|
border-bottom: 1px solid #ebeef5;
|
|
|
|
|
}
|
|
|
|
|
.alertLabelTitle{
|
|
|
|
|
text-align: left;
|
2020-07-28 11:45:37 +08:00
|
|
|
width: 90px;
|
2020-07-27 18:26:44 +08:00
|
|
|
border-right: 1px solid #ebeef5;
|
|
|
|
|
color: #666;
|
|
|
|
|
padding: 0 3px 0 13px;
|
|
|
|
|
}
|
|
|
|
|
.alertLabelValue{
|
|
|
|
|
text-align: left;
|
|
|
|
|
width: 150px;
|
|
|
|
|
color: #1a1a1a;
|
|
|
|
|
padding: 0 3px 0 13px;
|
|
|
|
|
}
|
2020-07-28 11:45:37 +08:00
|
|
|
.danger{
|
|
|
|
|
background-color: #d64f40;
|
|
|
|
|
color: white;
|
|
|
|
|
padding: 2px 5px;
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
}
|
|
|
|
|
.success{
|
|
|
|
|
background-color: #50d050;
|
|
|
|
|
color: white;
|
|
|
|
|
padding: 2px 5px;
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
}
|
|
|
|
|
/deep/.active-icon{
|
|
|
|
|
margin-top: 0;
|
|
|
|
|
}
|
2020-07-27 18:26:44 +08:00
|
|
|
</style>
|