Merge remote-tracking branch 'origin/codeCheck' into codeCheck

This commit is contained in:
chenjinsong
2020-10-15 19:28:54 +08:00
9 changed files with 224 additions and 101 deletions

View File

@@ -372,6 +372,9 @@ function asciiCompute2(num,ascii,units,dot=2,unitIndex=0){
* unit:设置的单位
* */
function timeCompute(value,unit,dot=0){
if(Number.isInteger(value)) {
dot=0;
}
if(unit == 'year'){
return `${value.toFixed(dot)} ${unit}`;
}

View File

@@ -508,6 +508,7 @@
toolbox:{
show:false,
top:'0',
right:'18',
showTitle:true,
feature:{
dataZoom:{

View File

@@ -1,5 +1,5 @@
<template>
<div class="alert-label" :style="calcPosition(that.position)">
<div :class="calcHeight(that.position,that)" :style="calcPosition(that.position,that)" ref="alertLabels">
<div class="alert-label-info" v-if="type==='asset'" v-loading="loading">
<div class="alert-label-box">
<div class="alert-label-title">ID</div>
@@ -153,7 +153,17 @@
},
computed: {
calcPosition() {
let self=this;
return function(position) {
let clientHeight = (document.body.clientHeight<document.documentElement.clientHeight)?document.body.clientHeight:document.documentElement.clientHeight;
let elHeight=self.type==='asset'?370:(self.type==='project'?70:70);
console.log(elHeight);
if(position.top+elHeight>clientHeight){
return {
left: `${position.left + position.width + 20}px`,
top: `${position.top -elHeight- 20}px`,
}
}else{
return {
left: `${position.left + position.width + 20}px`,
top: `${position.top - 20}px`,
@@ -161,6 +171,20 @@
}
}
},
calcHeight(){
let self=this;
return function(position) {
let clientHeight = (document.body.clientHeight<document.documentElement.clientHeight)?document.body.clientHeight:document.documentElement.clientHeight;
let elHeight=self.type==='asset'?370:(self.type==='project'?70:70);
if(position.top+elHeight>clientHeight){
return 'alert-labelUp'
}else{
return 'alert-label'
}
}
}
},
methods:{
alertActiveStr(){
return this.$t('overall.active');
@@ -185,10 +209,10 @@
})
}
if(this.type==='project'){
this.$get('/project/info?id='+this.id).then((res)=>{
this.$get('/project?id='+this.id).then((res)=>{
if(res.msg==='success'){
this.loading=false;
this.alertLabelData=res.data.basic;
this.alertLabelData=res.data.list[0];
} else{
this.$message.error(res.msg);
}
@@ -218,6 +242,14 @@
border-radius: 4px;
box-shadow: -1px 1px 9px -1px rgba(205,205,205,0.77);
}
.alert-labelUp {
position: fixed;
background-color: white;
z-index: 3000;
padding: 10px;
border-radius: 4px;
box-shadow: -1px 1px 9px -1px rgba(205,205,205,0.77);
}
.alert-label::after {
content: '';
display: block;
@@ -234,6 +266,22 @@
left: 0;
transform: translate(-100%, -50%);
}
.alert-labelUp::after {
content: '';
display: block;
width:0;
height:0;
overflow: hidden;
font-size: 0;
line-height: 0;
border: 5px;
border-style: dashed solid dashed dashed;
border-color: transparent #fff transparent transparent;
position: absolute;
bottom: 20px;
left: 0;
transform: translate(-100%, -50%);
}
.alert-label-info{
border: 1px solid #ebeef5;
border-bottom: none;

View File

@@ -60,7 +60,10 @@
<template slot-scope="scope" :column="item">
<template v-if="item.prop == 'alertRule'">
<div v-if="scope.row.alertRule.alertName" >
<span @mouseenter="alertMessagehover(scope.row.alertRule, true, $event)" @mouseleave="alertMessagehover(scope.row.alertRule, false)">{{scope.row.alertRule.alertName}}</span>
<span
@mouseenter="alertMessagehover(scope.row.alertRule, true, $event)"
@mouseleave="alertMessagehover(scope.row.alertRule, false)"
>{{scope.row.alertRule.alertName}}</span>
<alertRuleInfo v-if="scope.row.alertRule.loading" :id="scope.row.alertRule.id" :that="scope.row.alertRule"></alertRuleInfo>
</div>
<template v-else>-</template>
@@ -83,7 +86,9 @@
</span>
<template v-else-if="item.prop == 'labels'" class="labels">
<span v-for="(item,i) in labelsSort(scope.row.labels)">
<span @mouseenter="labelHover(scope.row, item.label, true, $event)" @mouseleave="labelHover(scope.row, item.label, false)">
<span
@mouseenter="labelHover(scope.row, item.label, true, $event)"
@mouseleave="labelHover(scope.row, item.label, false)">
<nz-alert-tag
:label="item.label" :type="tagType(item.label)" style="margin: 5px 0 5px 5px;"
:cursor-point="tagType(item.label) == 'info' ? false : true"

View File

@@ -1,5 +1,5 @@
<template>
<div class="alert-rule-tip" :style="calcPosition(that.position)" v-loading="loading">
<div :class="calcHeight(that.position,that)" :style="calcPosition(that.position,that)" v-loading="loading">
<div class="alert-rule-info" >
<div class="alert-rule-box">
<div class="alert-rule-title">ID</div>
@@ -60,11 +60,35 @@
},
computed: {
calcPosition() {
let self=this;
return function(position) {
let clientHeight = (document.body.clientHeight<document.documentElement.clientHeight)?document.body.clientHeight:document.documentElement.clientHeight;
let elHeight=50;
console.log(elHeight);
if(position.top+elHeight>clientHeight){
return {
left: `${position.left + position.width + 20}px`,
top: `${position.top - 10}px`,
top: `${position.top -elHeight- 20}px`,
}
}else{
return {
left: `${position.left + position.width + 20}px`,
top: `${position.top - 20}px`,
}
}
}
},
calcHeight(){
let self=this;
return function(position) {
let clientHeight = (document.body.clientHeight<document.documentElement.clientHeight)?document.body.clientHeight:document.documentElement.clientHeight;
let elHeight=50;
if(position.top+elHeight>clientHeight){
return 'alert-rule-tip-Up'
}else{
return 'alert-rule-tip'
}
}
}
},
@@ -117,6 +141,30 @@
left: 0;
transform: translate(-100%, -50%);
}
.alert-rule-tip-Up {
position: fixed;
background-color: white;
z-index: 3000;
padding: 10px;
border-radius: 4px;
box-shadow: -1px 1px 9px -1px rgba(205,205,205,0.77);
}
.alert-rule-tip-Up::after {
content: '';
display: block;
width:0;
height:0;
overflow: hidden;
font-size: 0;
line-height: 0;
border: 5px;
border-style: dashed solid dashed dashed;
border-color: transparent #fff transparent transparent;
position: absolute;
bottom: 20px;
left: 0;
transform: translate(-100%, -50%);
}
.alert-rule-info{
border: 1px solid #ebeef5;
border-bottom: none;

View File

@@ -524,7 +524,9 @@ const cn = {
notInStock: "出库",
principal: "负责人",
tel: "电话",
featureTitle: "属性"
featureTitle: "属性",
endpointUpNum:'代表正常的数量',
endpointNum:'代表总的数量',
},
config: {
config: "设置",

View File

@@ -437,6 +437,8 @@ const en = {
ping:'Ping',
},
featureTitle:'Attribute',
endpointUpNum:'It\'s a normal number',
endpointNum:'Represents the total quantity',
editAssetTab:{
title:'New asset',//'新增资产'
sn:'SN',//SN

View File

@@ -90,7 +90,13 @@
</el-popover>
</div>
<template v-if="item.prop=='Module'">
<span class="link" @click="showEndpoint(scope.row)">{{scope.row.endpointNum}}</span>
<el-tooltip placement="right" effect="light">
<div slot="content">
{{scope.row.endpointNum-scope.row.endpointDownNum}}&nbsp;{{$t('asset.endpointUpNum')}}<br/>
{{scope.row.endpointNum}}&nbsp;{{$t('asset.endpointNum')}}
</div>
<span class="link" @click="showEndpoint(scope.row)" style="padding: 2px 8px">{{scope.row.endpointNum-scope.row.endpointDownNum}}/{{scope.row.endpointNum}}</span>
</el-tooltip>
</template>
<template v-if="item.prop=='Alert'">
<el-tooltip :content="scope.row.alertNum+' '+$t('overall.active')" placement="top" effect="light" :disabled=" scope.row.alertNum < 99">
@@ -474,6 +480,13 @@
return 'success';
}
}
if(e.column.label == 'Module' || e.column.label == this.$t("asset.tableTitle.modules")){
if (e.row.endpointDownNum > 0) {
return 'danger';
} else {
return 'success';
}
}
return '';
},
edit(asset) {

View File

@@ -37,6 +37,7 @@
toolbox:{
show:false,
top:'0',
right:'18',
showTitle:true,
tooltip:{
show:false,