fix:处理 表格tooltip 调用两次接口的问题
This commit is contained in:
@@ -263,7 +263,8 @@ export default {
|
|||||||
chartData: {
|
chartData: {
|
||||||
deep: true,
|
deep: true,
|
||||||
handler (n) {
|
handler (n) {
|
||||||
if (!this.isInit) {
|
if (!this.isInit && this.chartOption.color) {
|
||||||
|
console.log(this.chartOption)
|
||||||
this.colorList = this.colorList.slice(0, 20)
|
this.colorList = this.colorList.slice(0, 20)
|
||||||
this.chartOption.color = this.chartOption.color.slice(0, 20)
|
this.chartOption.color = this.chartOption.color.slice(0, 20)
|
||||||
this.initChart(this.chartOption)
|
this.initChart(this.chartOption)
|
||||||
|
|||||||
52
nezha-fronted/src/components/common/mixin/alertLabelMixin.js
Normal file
52
nezha-fronted/src/components/common/mixin/alertLabelMixin.js
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
export default {
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
alertLabelShow: false,
|
||||||
|
alertLabelId: '',
|
||||||
|
alertLabelObj: {},
|
||||||
|
alertLabelType: ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// label 鼠标划入
|
||||||
|
labelHover (item, type, loading, isUseType = true, e) {
|
||||||
|
if (this.labelToolTipDis(type)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (isUseType) {
|
||||||
|
if (e) {
|
||||||
|
const dom = e.currentTarget
|
||||||
|
const position = dom.getBoundingClientRect()
|
||||||
|
this.$set(item[type], 'position', position)
|
||||||
|
this.alertLabelId = item[type].id
|
||||||
|
this.alertLabelObj = item[type]
|
||||||
|
this.alertLabelType = type
|
||||||
|
}
|
||||||
|
this.$set(item[type], 'loading', loading)
|
||||||
|
} else {
|
||||||
|
if (e) {
|
||||||
|
const dom = e.currentTarget
|
||||||
|
const position = dom.getBoundingClientRect()
|
||||||
|
this.$set(item, 'position', position)
|
||||||
|
this.alertLabelId = item.id
|
||||||
|
this.alertLabelObj = item
|
||||||
|
this.alertLabelType = type
|
||||||
|
}
|
||||||
|
this.$set(item, 'loading', loading)
|
||||||
|
}
|
||||||
|
this.alertLabelShow = loading
|
||||||
|
},
|
||||||
|
// label tooltip是否显示
|
||||||
|
labelToolTipDis (labelType) {
|
||||||
|
switch (labelType) {
|
||||||
|
case 'asset':
|
||||||
|
case 'module':
|
||||||
|
case 'endpoint':
|
||||||
|
case 'project':
|
||||||
|
case 'dc':
|
||||||
|
return false
|
||||||
|
default: return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -72,8 +72,8 @@
|
|||||||
<template v-else-if="item.prop === 'labels'" class="labels">
|
<template v-else-if="item.prop === 'labels'" class="labels">
|
||||||
<span v-for="(item, i) in labelsSort(scope.row.labels)" :key="i">
|
<span v-for="(item, i) in labelsSort(scope.row.labels)" :key="i">
|
||||||
<span
|
<span
|
||||||
@mouseenter="labelHover(scope.row, item.label, true, $event)"
|
@mouseenter="labelHover(scope.row, item.label, true, true, $event)"
|
||||||
@mouseleave="labelHover(scope.row, item.label, false)">
|
@mouseleave="labelHover(scope.row, item.label, false, true,)">
|
||||||
<nz-alert-tag
|
<nz-alert-tag
|
||||||
v-if="item.label !== 'alertname' && item.label !== 'severity'" :key="item.label" :cursor-point="tagType(item.label) !== 'info'"
|
v-if="item.label !== 'alertname' && item.label !== 'severity'" :key="item.label" :cursor-point="tagType(item.label) !== 'info'"
|
||||||
:label="item.label"
|
:label="item.label"
|
||||||
@@ -145,6 +145,7 @@ import alertRuleInfo from '../../alert/alertRuleInfo'
|
|||||||
import alertLabel from '../../alert/alertLabel'
|
import alertLabel from '../../alert/alertLabel'
|
||||||
import { calcDurationByStringTimeB } from '../../js/tools'
|
import { calcDurationByStringTimeB } from '../../js/tools'
|
||||||
import { alertMessage as alertMessageConstant } from '@/components/common/js/constants'
|
import { alertMessage as alertMessageConstant } from '@/components/common/js/constants'
|
||||||
|
import alertLabelMixin from '@/components/common/mixin/alertLabelMixin'
|
||||||
export default {
|
export default {
|
||||||
name: 'alertMessageTable',
|
name: 'alertMessageTable',
|
||||||
components: {
|
components: {
|
||||||
@@ -164,7 +165,7 @@ export default {
|
|||||||
loading: Boolean,
|
loading: Boolean,
|
||||||
chartAlertList: Boolean
|
chartAlertList: Boolean
|
||||||
},
|
},
|
||||||
mixins: [table, bus],
|
mixins: [table, bus, alertLabelMixin],
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
/* 二级列表相关 */
|
/* 二级列表相关 */
|
||||||
@@ -247,10 +248,6 @@ export default {
|
|||||||
],
|
],
|
||||||
viewAssetState: false,
|
viewAssetState: false,
|
||||||
tableDataInitNum: 0,
|
tableDataInitNum: 0,
|
||||||
alertLabelShow: false,
|
|
||||||
alertLabelId: '',
|
|
||||||
alertLabelObj: {},
|
|
||||||
alertLabelType: '',
|
|
||||||
alertRuleShow: false,
|
alertRuleShow: false,
|
||||||
alertRuleId: '',
|
alertRuleId: '',
|
||||||
alertRuleObj: ''
|
alertRuleObj: ''
|
||||||
@@ -572,18 +569,6 @@ export default {
|
|||||||
this.$refs.moduleBox.show(false, false)
|
this.$refs.moduleBox.show(false, false)
|
||||||
this.viewAssetState = false
|
this.viewAssetState = false
|
||||||
},
|
},
|
||||||
// label tooltip是否显示
|
|
||||||
labelToolTipDis (labelType) {
|
|
||||||
switch (labelType) {
|
|
||||||
case 'asset':
|
|
||||||
case 'module':
|
|
||||||
case 'endpoint':
|
|
||||||
case 'project':
|
|
||||||
case 'dc':
|
|
||||||
return false
|
|
||||||
default: return true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// alertName鼠标划入
|
// alertName鼠标划入
|
||||||
alertMessageHover (item, loading, e) {
|
alertMessageHover (item, loading, e) {
|
||||||
if (e) {
|
if (e) {
|
||||||
@@ -596,22 +581,6 @@ export default {
|
|||||||
this.$set(item.alertRule, 'loading', loading)
|
this.$set(item.alertRule, 'loading', loading)
|
||||||
this.alertRuleShow = loading
|
this.alertRuleShow = loading
|
||||||
},
|
},
|
||||||
// label 鼠标划入
|
|
||||||
labelHover (item, type, loading, e) {
|
|
||||||
if (this.labelToolTipDis(type)) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (e) {
|
|
||||||
const dom = e.currentTarget
|
|
||||||
const position = dom.getBoundingClientRect()
|
|
||||||
this.$set(item[type], 'position', position)
|
|
||||||
this.alertLabelId = item[type].id
|
|
||||||
this.alertLabelObj = item[type]
|
|
||||||
this.alertLabelType = type
|
|
||||||
}
|
|
||||||
this.$set(item[type], 'loading', loading)
|
|
||||||
this.alertLabelShow = loading
|
|
||||||
},
|
|
||||||
// Severity Label
|
// Severity Label
|
||||||
returnSeverityLabel (key) {
|
returnSeverityLabel (key) {
|
||||||
return this.$t(this.$CONSTANTS.alertMessage.severityData.find(s => { return s.value == key }).label)
|
return this.$t(this.$CONSTANTS.alertMessage.severityData.find(s => { return s.value == key }).label)
|
||||||
|
|||||||
@@ -1,50 +1,51 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-table
|
<div style="height: 100%">
|
||||||
id="roleTable"
|
<el-table
|
||||||
ref="dataTable"
|
id="roleTable"
|
||||||
class="asset-table2"
|
ref="dataTable"
|
||||||
:data="tableData"
|
class="asset-table2"
|
||||||
:height="height"
|
:data="tableData"
|
||||||
:default-sort="orderBy"
|
:height="height"
|
||||||
border
|
:default-sort="orderBy"
|
||||||
@header-dragend="dragend"
|
border
|
||||||
@sort-change="tableDataSort"
|
@header-dragend="dragend"
|
||||||
@selection-change="selectionChange"
|
@sort-change="tableDataSort"
|
||||||
@row-dblclick="(row)=>{$emit('showBottomBox', 'panelTab', row)}"
|
@selection-change="selectionChange"
|
||||||
>
|
@row-dblclick="(row)=>{$emit('showBottomBox', 'panelTab', row)}"
|
||||||
<el-table-column
|
|
||||||
:resizable="false"
|
|
||||||
align="center"
|
|
||||||
type="selection"
|
|
||||||
width="55">
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column
|
|
||||||
v-for="(item, index) in customTableTitle"
|
|
||||||
v-if="item.show"
|
|
||||||
:key="`col-${index}`"
|
|
||||||
:fixed="item.fixed"
|
|
||||||
:label="item.label"
|
|
||||||
:min-width="`${item.minWidth}`"
|
|
||||||
:prop="item.prop"
|
|
||||||
:resizable="true"
|
|
||||||
:sort-orders="['ascending', 'descending']"
|
|
||||||
:sortable="item.sortable"
|
|
||||||
:width="`${item.width}`"
|
|
||||||
class="data-column"
|
|
||||||
>
|
>
|
||||||
<template slot="header">
|
<el-table-column
|
||||||
<span class="data-column__span">{{item.label}} <i class="nz-icon nz-icon-label" v-if="item.type==='label'" style="color: #fa901c"/></span>
|
:resizable="false"
|
||||||
<div class="col-resize-area"></div>
|
align="center"
|
||||||
</template>
|
type="selection"
|
||||||
<template slot-scope="scope" :column="item">
|
width="55">
|
||||||
<template v-if="item.prop === 'type'">{{scope.row.type ? scope.row.type.name : '-'}}</template>
|
</el-table-column>
|
||||||
<template v-else-if="item.prop === 'state'">{{scope.row.state ? scope.row.state.name : '-'}}</template>
|
<el-table-column
|
||||||
<template v-else-if="item.prop === 'endpointNum'">
|
v-for="(item, index) in customTableTitle"
|
||||||
<span style="cursor: pointer" @click="$emit('showBottomBox', 'endpointTab', scope.row)"><i class="nz-icon nz-icon-overview-endpoint monitorColor"></i> <span>{{scope.row.endpointNum ? scope.row.endpointNum : 0}}</span></span>
|
v-if="item.show"
|
||||||
|
:key="`col-${index}`"
|
||||||
|
:fixed="item.fixed"
|
||||||
|
:label="item.label"
|
||||||
|
:min-width="`${item.minWidth}`"
|
||||||
|
:prop="item.prop"
|
||||||
|
:resizable="true"
|
||||||
|
:sort-orders="['ascending', 'descending']"
|
||||||
|
:sortable="item.sortable"
|
||||||
|
:width="`${item.width}`"
|
||||||
|
class="data-column"
|
||||||
|
>
|
||||||
|
<template slot="header">
|
||||||
|
<span class="data-column__span">{{item.label}} <i class="nz-icon nz-icon-label" v-if="item.type==='label'" style="color: #fa901c"/></span>
|
||||||
|
<div class="col-resize-area"></div>
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="item.prop === 'alertNum'">
|
<template slot-scope="scope" :column="item">
|
||||||
<!-- v-my-loading:ldsFacebook="scope.row.trendLoading"-->
|
<template v-if="item.prop === 'type'">{{scope.row.type ? scope.row.type.name : '-'}}</template>
|
||||||
<span style="cursor: pointer" @click="$emit('showBottomBox', 'alertMessageTab', scope.row)">
|
<template v-else-if="item.prop === 'state'">{{scope.row.state ? scope.row.state.name : '-'}}</template>
|
||||||
|
<template v-else-if="item.prop === 'endpointNum'">
|
||||||
|
<span style="cursor: pointer" @click="$emit('showBottomBox', 'endpointTab', scope.row)"><i class="nz-icon nz-icon-overview-endpoint monitorColor"></i> <span>{{scope.row.endpointNum ? scope.row.endpointNum : 0}}</span></span>
|
||||||
|
</template>
|
||||||
|
<template v-else-if="item.prop === 'alertNum'">
|
||||||
|
<!-- v-my-loading:ldsFacebook="scope.row.trendLoading"-->
|
||||||
|
<span style="cursor: pointer" @click="$emit('showBottomBox', 'alertMessageTab', scope.row)">
|
||||||
<i :class="scope.row.alertNum ? 'red' : 'green'" class="nz-icon nz-icon-overview-alert vertical-align-top;" @mouseenter="tooltipHover(scope.row,true, $event)" @mouseleave="tooltipHover(scope.row,false, $event)"></i>
|
<i :class="scope.row.alertNum ? 'red' : 'green'" class="nz-icon nz-icon-overview-alert vertical-align-top;" @mouseenter="tooltipHover(scope.row,true, $event)" @mouseleave="tooltipHover(scope.row,false, $event)"></i>
|
||||||
<div v-if="scope.row.alertNumtooltipShow" class="alert-days-info-tooltip" :style="{left: scope.row.left + 'px',top:scope.row.top + 'px'}">
|
<div v-if="scope.row.alertNumtooltipShow" class="alert-days-info-tooltip" :style="{left: scope.row.left + 'px',top:scope.row.top + 'px'}">
|
||||||
<div class="tooltip-title">Alert message (active)</div>
|
<div class="tooltip-title">Alert message (active)</div>
|
||||||
@@ -54,113 +55,114 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<alertDaysInfo
|
<alertDaysInfo
|
||||||
v-show="!scope.row.trendLoading"
|
v-show="!scope.row.trendLoading"
|
||||||
:alertDaysData="scope.row.alertDaysData"
|
:alertDaysData="scope.row.alertDaysData"
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="item.prop === 'dc'">{{scope.row.dc ? scope.row.dc.name : '-'}}</template>
|
<template v-else-if="item.prop === 'dc'">{{scope.row.dc ? scope.row.dc.name : '-'}}</template>
|
||||||
<template v-else-if="item.prop === 'cabinet'">
|
<template v-else-if="item.prop === 'cabinet'">
|
||||||
<span v-if="scope.row.cabinet && scope.row.cabinet !== '--'">{{scope.row.cabinet.name}} {{returnCabinet( scope.row.cabinetStart, scope.row.cabinetEnd)}}</span>
|
<span v-if="scope.row.cabinet && scope.row.cabinet !== '--'">{{scope.row.cabinet.name}} {{returnCabinet( scope.row.cabinetStart, scope.row.cabinetEnd)}}</span>
|
||||||
<span v-else >-</span>
|
<span v-else >-</span>
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="item.prop === 'pingInfo'">
|
<template v-else-if="item.prop === 'pingInfo'">
|
||||||
<div class="ping-info" v-if="scope.row.pingInfo">
|
<div class="ping-info" v-if="scope.row.pingInfo">
|
||||||
<div :class="{'active-icon green-bg':scope.row.pingInfo.status == 1,'active-icon red-bg':scope.row.pingInfo.status == 0}" style="position: relative">
|
<div :class="{'active-icon green-bg':scope.row.pingInfo.status == 1,'active-icon red-bg':scope.row.pingInfo.status == 0}" style="position: relative">
|
||||||
|
</div>
|
||||||
|
<div class="active-icon-content">{{$t('asset.assetStatPre')+(scope.row.pingInfo.lastUpdate?utcTimeToTimezoneStr(scope.row.pingInfo.lastUpdate):$t('asset.assetStatDown'))}}</div>
|
||||||
|
{{scope.row.pingInfo.rtt?scope.row.pingInfo.rtt+'ms':''}}
|
||||||
</div>
|
</div>
|
||||||
<div class="active-icon-content">{{$t('asset.assetStatPre')+(scope.row.pingInfo.lastUpdate?utcTimeToTimezoneStr(scope.row.pingInfo.lastUpdate):$t('asset.assetStatDown'))}}</div>
|
</template>
|
||||||
{{scope.row.pingInfo.rtt?scope.row.pingInfo.rtt+'ms':''}}
|
<template v-else-if="item.prop === 'model'">{{scope.row.model ? scope.row.model.name : '-'}}</template>
|
||||||
</div>
|
<template v-else-if="item.prop === 'parent'">
|
||||||
</template>
|
|
||||||
<template v-else-if="item.prop === 'model'">{{scope.row.model ? scope.row.model.name : '-'}}</template>
|
|
||||||
<template v-else-if="item.prop === 'parent'">
|
|
||||||
<span
|
<span
|
||||||
v-if="scope.row.parent"
|
v-if="scope.row.parent"
|
||||||
style="cursor: pointer"
|
style="cursor: pointer"
|
||||||
@mouseenter="labelHover(scope.row, 'asset', true, $event)"
|
@mouseenter="labelHover(scope.row, 'asset', true, false, $event)"
|
||||||
@mouseleave="labelHover(scope.row, 'asset', false)">
|
@mouseleave="labelHover(scope.row, 'asset', false, false)">
|
||||||
{{scope.row.parent.name}}
|
{{scope.row.parent.name}}
|
||||||
<alertLabel
|
|
||||||
v-if="scope.row.loading"
|
|
||||||
:id="scope.row.pid"
|
|
||||||
:that="scope.row"
|
|
||||||
:type="'asset'"
|
|
||||||
></alertLabel>
|
|
||||||
</span>
|
</span>
|
||||||
<span v-else> - </span>
|
<span v-else> - </span>
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="item.prop === 'children'">
|
<template v-else-if="item.prop === 'children'">
|
||||||
<div @click="$emit('showBottomBox', 'assetSubTab', scope.row)" v-if="scope.row.childrenNum" style="cursor: pointer">
|
<div @click="$emit('showBottomBox', 'assetSubTab', scope.row)" v-if="scope.row.childrenNum" style="cursor: pointer">
|
||||||
<i class="nz-icon nz-icon-overview-project monitorColor color23BF9A"></i>
|
<i class="nz-icon nz-icon-overview-project monitorColor color23BF9A"></i>
|
||||||
{{scope.row.childrenNum}}</div>
|
{{scope.row.childrenNum}}</div>
|
||||||
<!-- <span v-else-if="scope.row.pid == -1"> <i class="nz-icon nz-icon-overview-project monitorColor color23BF9A"></i> 0 </span>-->
|
<!-- <span v-else-if="scope.row.pid == -1"> <i class="nz-icon nz-icon-overview-project monitorColor color23BF9A"></i> 0 </span>-->
|
||||||
<span v-else> - </span>
|
<span v-else> - </span>
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="item.prop === 'clientState'">
|
<template v-else-if="item.prop === 'clientState'">
|
||||||
<div v-if="scope.row[item.prop]===1">
|
<div v-if="scope.row[item.prop]===1">
|
||||||
<div class="active-icon green-bg inline-block"></div>
|
<div class="active-icon green-bg inline-block"></div>
|
||||||
OK
|
OK
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="scope.row[item.prop]===0">
|
<div v-else-if="scope.row[item.prop]===0">
|
||||||
<div class="active-icon gray-bg inline-block"></div> {{ $t('config.user.disable') }}
|
<div class="active-icon gray-bg inline-block"></div> {{ $t('config.user.disable') }}
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="scope.row[item.prop]===2">
|
<div v-else-if="scope.row[item.prop]===2">
|
||||||
<div class="active-icon red-bg inline-block"></div> {{ $t('asset.connectionTimedOut') }}
|
<div class="active-icon red-bg inline-block"></div> {{ $t('asset.connectionTimedOut') }}
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="scope.row[item.prop]===3">
|
<div v-else-if="scope.row[item.prop]===3">
|
||||||
<div class="active-icon red-bg inline-block"></div> {{ $t('overall.AuthenticationFailed') }}
|
<div class="active-icon red-bg inline-block"></div> {{ $t('overall.AuthenticationFailed') }}
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="scope.row[item.prop]===4">
|
<div v-else-if="scope.row[item.prop]===4">
|
||||||
<div class="active-icon red-bg inline-block"></div> {{ $t('config.terminallog.statusItem.unknownError') }}
|
<div class="active-icon red-bg inline-block"></div> {{ $t('config.terminallog.statusItem.unknownError') }}
|
||||||
</div>
|
</div>
|
||||||
<template v-else>-</template>
|
<template v-else>-</template>
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="item.prop === 'brand'">{{scope.row.brand ? scope.row.brand.name : '-'}}</template>
|
<template v-else-if="item.prop === 'brand'">{{scope.row.brand ? scope.row.brand.name : '-'}}</template>
|
||||||
<template v-else-if="item.prop === 'purchaseDate'">{{scope.row.purchaseDate ? scope.row.purchaseDate : '-'}}</template>
|
<template v-else-if="item.prop === 'purchaseDate'">{{scope.row.purchaseDate ? scope.row.purchaseDate : '-'}}</template>
|
||||||
<span v-else-if="item.prop === 'id'" :id="'globalSearch' + scope.row.id">{{scope.row[item.prop]}}</span>
|
<span v-else-if="item.prop === 'id'" :id="'globalSearch' + scope.row.id">{{scope.row[item.prop]}}</span>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<span v-if="scope.row.fields&&scope.row.fields.find(field => field.name === item.prop)">
|
<span v-if="scope.row.fields&&scope.row.fields.find(field => field.name === item.prop)">
|
||||||
{{scope.row.fields.find(field => field.name === item.prop).value.join(',')}}
|
{{scope.row.fields.find(field => field.name === item.prop).value.join(',')}}
|
||||||
</span>
|
</span>
|
||||||
<span v-else>
|
<span v-else>
|
||||||
{{scope.row[item.prop]}}
|
{{scope.row[item.prop]}}
|
||||||
</span>
|
</span>
|
||||||
|
</template>
|
||||||
</template>
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
:resizable="false"
|
||||||
|
v-if="showOption"
|
||||||
|
:width="operationWidth"
|
||||||
|
fixed="right">
|
||||||
|
<div slot="header" class="table-operation-title">{{$t('overall.option')}}</div>
|
||||||
|
<div slot-scope="scope" class="table-operation-items">
|
||||||
|
<button v-if="assetTab" class="table-operation-item" v-has="'model_edit'" @click="$emit('edit', scope.row)"><i class="nz-icon nz-icon-edit"></i></button>
|
||||||
|
<button v-else class="table-operation-item" @click="$emit('showBottomBox', 'panelTab', scope.row)"><i class="nz-icon nz-icon-view1"></i></button>
|
||||||
|
<el-dropdown size="medium" v-has="['asset_edit','asset_connect','asset_add','asset_delete', 'alertSilence_add']" trigger="click" @command="tableOperation">
|
||||||
|
<div class="table-operation-item table-operation-item--more">
|
||||||
|
<i class="nz-icon nz-icon-more3"></i>
|
||||||
|
</div>
|
||||||
|
<el-dropdown-menu slot="dropdown" class="right-box-select-top right-public-box-dropdown-top">
|
||||||
|
<el-dropdown-item v-if="!assetTab" v-has="'asset_edit'" :command="['edit', scope.row]"><i class="nz-icon nz-icon-edit"></i><span class="operation-dropdown-text">{{$t('overall.edit')}}</span></el-dropdown-item>
|
||||||
|
<el-dropdown-item v-has="'asset_connect'" :command="['cli', scope.row]" :disabled="!scope.row.authUsername"><i class="nz-icon nz-icon-cli"></i><span class="operation-dropdown-text">{{$t('dashboard.connect')}}</span></el-dropdown-item>
|
||||||
|
<el-dropdown-item v-has="'asset_add'" :command="['duplicate', scope.row]"><i class="nz-icon nz-icon-override"></i><span class="operation-dropdown-text">{{$t('dashboard.duplicate')}}</span></el-dropdown-item>
|
||||||
|
<el-dropdown-item v-has="'asset_delete'" :command="['delete', scope.row]"><i class="nz-icon nz-icon-delete"></i><span class="operation-dropdown-text">{{$t('overall.delete')}}</span></el-dropdown-item>
|
||||||
|
<el-dropdown-item v-has="'alertSilence_add'" :command="['fastSilence', scope.row, 'asset']"><i class="nz-icon nz-icon-fast-silence"></i><span class="operation-dropdown-text">{{$t('overall.silenceAlert')}}</span></el-dropdown-item>
|
||||||
|
</el-dropdown-menu>
|
||||||
|
</el-dropdown>
|
||||||
|
</div>
|
||||||
|
</el-table-column>
|
||||||
|
<template slot="empty">
|
||||||
|
<div v-if="!loading" class="table-no-data">
|
||||||
|
<svg class="icon" aria-hidden="true">
|
||||||
|
<use xlink:href="#nz-icon-no-data-list"></use>
|
||||||
|
</svg>
|
||||||
|
<div class="table-no-data__title">No results found</div>
|
||||||
|
</div>
|
||||||
|
<div v-else> </div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table>
|
||||||
<el-table-column
|
<alertLabel
|
||||||
:resizable="false"
|
v-if="alertLabelShow"
|
||||||
v-if="showOption"
|
:id="alertLabelId"
|
||||||
:width="operationWidth"
|
:that="alertLabelObj"
|
||||||
fixed="right">
|
:type="alertLabelType"
|
||||||
<div slot="header" class="table-operation-title">{{$t('overall.option')}}</div>
|
></alertLabel>
|
||||||
<div slot-scope="scope" class="table-operation-items">
|
</div>
|
||||||
<button v-if="assetTab" class="table-operation-item" v-has="'model_edit'" @click="$emit('edit', scope.row)"><i class="nz-icon nz-icon-edit"></i></button>
|
|
||||||
<button v-else class="table-operation-item" @click="$emit('showBottomBox', 'panelTab', scope.row)"><i class="nz-icon nz-icon-view1"></i></button>
|
|
||||||
<el-dropdown size="medium" v-has="['asset_edit','asset_connect','asset_add','asset_delete', 'alertSilence_add']" trigger="click" @command="tableOperation">
|
|
||||||
<div class="table-operation-item table-operation-item--more">
|
|
||||||
<i class="nz-icon nz-icon-more3"></i>
|
|
||||||
</div>
|
|
||||||
<el-dropdown-menu slot="dropdown" class="right-box-select-top right-public-box-dropdown-top">
|
|
||||||
<el-dropdown-item v-if="!assetTab" v-has="'asset_edit'" :command="['edit', scope.row]"><i class="nz-icon nz-icon-edit"></i><span class="operation-dropdown-text">{{$t('overall.edit')}}</span></el-dropdown-item>
|
|
||||||
<el-dropdown-item v-has="'asset_connect'" :command="['cli', scope.row]" :disabled="!scope.row.authUsername"><i class="nz-icon nz-icon-cli"></i><span class="operation-dropdown-text">{{$t('dashboard.connect')}}</span></el-dropdown-item>
|
|
||||||
<el-dropdown-item v-has="'asset_add'" :command="['duplicate', scope.row]"><i class="nz-icon nz-icon-override"></i><span class="operation-dropdown-text">{{$t('dashboard.duplicate')}}</span></el-dropdown-item>
|
|
||||||
<el-dropdown-item v-has="'asset_delete'" :command="['delete', scope.row]"><i class="nz-icon nz-icon-delete"></i><span class="operation-dropdown-text">{{$t('overall.delete')}}</span></el-dropdown-item>
|
|
||||||
<el-dropdown-item v-has="'alertSilence_add'" :command="['fastSilence', scope.row, 'asset']"><i class="nz-icon nz-icon-fast-silence"></i><span class="operation-dropdown-text">{{$t('overall.silenceAlert')}}</span></el-dropdown-item>
|
|
||||||
</el-dropdown-menu>
|
|
||||||
</el-dropdown>
|
|
||||||
</div>
|
|
||||||
</el-table-column>
|
|
||||||
<template slot="empty">
|
|
||||||
<div v-if="!loading" class="table-no-data">
|
|
||||||
<svg class="icon" aria-hidden="true">
|
|
||||||
<use xlink:href="#nz-icon-no-data-list"></use>
|
|
||||||
</svg>
|
|
||||||
<div class="table-no-data__title">No results found</div>
|
|
||||||
</div>
|
|
||||||
<div v-else> </div>
|
|
||||||
</template>
|
|
||||||
</el-table>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -169,9 +171,10 @@ import { showTableTooltip, hideTableTooltip } from '@/components/common/js/tools
|
|||||||
// import bus from '@/libs/bus'
|
// import bus from '@/libs/bus'
|
||||||
import alertLabel from '@/components/common/alert/alertLabel'
|
import alertLabel from '@/components/common/alert/alertLabel'
|
||||||
import alertDaysInfo from '@/components/common/alert/alertDaysInfo'
|
import alertDaysInfo from '@/components/common/alert/alertDaysInfo'
|
||||||
|
import alertLabelMixin from '@/components/common/mixin/alertLabelMixin'
|
||||||
export default {
|
export default {
|
||||||
name: 'assetTable',
|
name: 'assetTable',
|
||||||
mixins: [table],
|
mixins: [table, alertLabelMixin],
|
||||||
components: {
|
components: {
|
||||||
alertLabel: alertLabel,
|
alertLabel: alertLabel,
|
||||||
alertDaysInfo
|
alertDaysInfo
|
||||||
@@ -337,16 +340,6 @@ export default {
|
|||||||
this.bottomBox.targetTab = 'endpoint'
|
this.bottomBox.targetTab = 'endpoint'
|
||||||
this.bottomBox.showSubList = true
|
this.bottomBox.showSubList = true
|
||||||
},
|
},
|
||||||
// label 鼠标划入
|
|
||||||
labelHover (item, type, loading, e) {
|
|
||||||
if (e) {
|
|
||||||
const dom = e.currentTarget
|
|
||||||
const position = dom.getBoundingClientRect()
|
|
||||||
this.$set(item, 'position', position)
|
|
||||||
}
|
|
||||||
this.$set(item, 'loading', loading)
|
|
||||||
// this.$set(this.tableData,index,item);// 调用父组件
|
|
||||||
},
|
|
||||||
returnCabinet (start, end) { // 返回机柜u位信息
|
returnCabinet (start, end) { // 返回机柜u位信息
|
||||||
if (!start || !end) {
|
if (!start || !end) {
|
||||||
return ''
|
return ''
|
||||||
|
|||||||
@@ -1,95 +1,78 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-table
|
<div style="height: 100%">
|
||||||
id="endpointTable"
|
<el-table
|
||||||
ref="dataTable"
|
id="endpointTable"
|
||||||
:data="tableData"
|
ref="dataTable"
|
||||||
:height="height"
|
:data="tableData"
|
||||||
border
|
:height="height"
|
||||||
:default-sort="orderBy"
|
border
|
||||||
@header-dragend="dragend"
|
:default-sort="orderBy"
|
||||||
@sort-change="tableDataSort"
|
@header-dragend="dragend"
|
||||||
@selection-change="selectionChange"
|
@sort-change="tableDataSort"
|
||||||
@row-dblclick="(row)=>{$emit('showBottomBox', 'panelTab', row)}"
|
@selection-change="selectionChange"
|
||||||
>
|
@row-dblclick="(row)=>{$emit('showBottomBox', 'panelTab', row)}"
|
||||||
<el-table-column
|
|
||||||
:resizable="false"
|
|
||||||
align="center"
|
|
||||||
type="selection"
|
|
||||||
width="55">
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column
|
|
||||||
v-for="(item, index) in customTableTitle"
|
|
||||||
v-if="item.show"
|
|
||||||
:key="`col-${index}`"
|
|
||||||
:fixed="item.fixed"
|
|
||||||
:label="item.label"
|
|
||||||
:min-width="`${item.minWidth}`"
|
|
||||||
:prop="item.prop"
|
|
||||||
:resizable="true"
|
|
||||||
:sort-orders="['ascending', 'descending']"
|
|
||||||
:sortable="item.sortable"
|
|
||||||
:width="`${item.width}`"
|
|
||||||
class="data-column"
|
|
||||||
>
|
>
|
||||||
<template slot="header">
|
<el-table-column
|
||||||
<span class="data-column__span">{{item.label}}</span>
|
:resizable="false"
|
||||||
<div class="col-resize-area"></div>
|
align="center"
|
||||||
</template>
|
type="selection"
|
||||||
<template slot-scope="scope" :column="item">
|
width="55">
|
||||||
<template v-if="item.prop === 'name'">
|
</el-table-column>
|
||||||
{{scope.row[item.prop]}}
|
<el-table-column
|
||||||
|
v-for="(item, index) in customTableTitle"
|
||||||
|
v-if="item.show"
|
||||||
|
:key="`col-${index}`"
|
||||||
|
:fixed="item.fixed"
|
||||||
|
:label="item.label"
|
||||||
|
:min-width="`${item.minWidth}`"
|
||||||
|
:prop="item.prop"
|
||||||
|
:resizable="true"
|
||||||
|
:sort-orders="['ascending', 'descending']"
|
||||||
|
:sortable="item.sortable"
|
||||||
|
:width="`${item.width}`"
|
||||||
|
class="data-column"
|
||||||
|
>
|
||||||
|
<template slot="header">
|
||||||
|
<span class="data-column__span">{{item.label}}</span>
|
||||||
|
<div class="col-resize-area"></div>
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="item.prop === 'type'">
|
<template slot-scope="scope" :column="item">
|
||||||
{{scope.row.module.type}}
|
<template v-if="item.prop === 'name'">
|
||||||
</template>
|
{{scope.row[item.prop]}}
|
||||||
<template v-else-if="item.prop === 'project'">
|
</template>
|
||||||
|
<template v-else-if="item.prop === 'type'">
|
||||||
|
{{scope.row.module.type}}
|
||||||
|
</template>
|
||||||
|
<template v-else-if="item.prop === 'project'">
|
||||||
<span
|
<span
|
||||||
class="pointer"
|
class="pointer"
|
||||||
@mouseenter="labelHover(scope.row, item.prop, true, $event)"
|
@mouseenter="labelHover(scope.row, item.prop, true,true, $event)"
|
||||||
@mouseleave="labelHover(scope.row, item.prop, false)"
|
@mouseleave="labelHover(scope.row, item.prop, false,true)"
|
||||||
>
|
>
|
||||||
{{scope.row[item.prop].name}}
|
{{scope.row[item.prop].name}}
|
||||||
</span>
|
</span>
|
||||||
<alertLabel
|
</template>
|
||||||
v-if="scope.row[item.prop] && scope.row[item.prop].loading"
|
<template v-else-if="item.prop === 'module'">
|
||||||
:id="scope.row[item.prop].id"
|
|
||||||
:that="scope.row[item.prop]"
|
|
||||||
:type="'project'"
|
|
||||||
></alertLabel>
|
|
||||||
</template>
|
|
||||||
<template v-else-if="item.prop === 'module'">
|
|
||||||
<span
|
<span
|
||||||
class="pointer"
|
class="pointer"
|
||||||
@mouseenter="labelHover(scope.row, item.prop, true, $event)"
|
@mouseenter="labelHover(scope.row, item.prop, true,true, $event)"
|
||||||
@mouseleave="labelHover(scope.row, item.prop, false)"
|
@mouseleave="labelHover(scope.row, item.prop, false,true)"
|
||||||
>
|
>
|
||||||
<i style="cursor: pointer" class="nz-icon nz-icon-overview-module monitorColor"/>
|
<i style="cursor: pointer" class="nz-icon nz-icon-overview-module monitorColor"/>
|
||||||
{{scope.row[item.prop].name}}
|
{{scope.row[item.prop].name}}
|
||||||
</span>
|
</span>
|
||||||
<alertLabel
|
</template>
|
||||||
v-if="scope.row[item.prop] && scope.row[item.prop].loading"
|
<template v-else-if="item.prop === 'asset'">
|
||||||
:id="scope.row[item.prop].id"
|
|
||||||
:that="scope.row[item.prop]"
|
|
||||||
:type="'module'"
|
|
||||||
></alertLabel>
|
|
||||||
</template>
|
|
||||||
<template v-else-if="item.prop === 'asset'">
|
|
||||||
<span
|
<span
|
||||||
class="pointer"
|
class="pointer"
|
||||||
@mouseenter="labelHover(scope.row, item.prop, true, $event)"
|
@mouseenter="labelHover(scope.row, item.prop, true,true, $event)"
|
||||||
@mouseleave="labelHover(scope.row, item.prop, false)"
|
@mouseleave="labelHover(scope.row, item.prop, false,true)"
|
||||||
>
|
>
|
||||||
<i class="nz-icon nz-icon-overview-project monitorColor color23BF9A"></i>
|
<i class="nz-icon nz-icon-overview-project monitorColor color23BF9A"></i>
|
||||||
{{scope.row.asset.name}}
|
{{scope.row.asset.name}}
|
||||||
</span>
|
</span>
|
||||||
<alertLabel
|
</template>
|
||||||
v-if="scope.row[item.prop] && scope.row[item.prop].loading"
|
<template v-else-if="item.prop === 'alerts'">
|
||||||
:id="scope.row[item.prop].id"
|
|
||||||
:that="scope.row[item.prop]"
|
|
||||||
:type="'asset'"
|
|
||||||
></alertLabel>
|
|
||||||
</template>
|
|
||||||
<template v-else-if="item.prop === 'alerts'">
|
|
||||||
<span style="cursor: pointer" @click="showBottomBox('endpointAlertMessage', scope.row)">
|
<span style="cursor: pointer" @click="showBottomBox('endpointAlertMessage', scope.row)">
|
||||||
<i :class="scope.row.alertNum ? 'red' : 'green'" class="nz-icon nz-icon-overview-alert vertical-align-top;" @mouseenter="tooltipHover(scope.row,true, $event)" @mouseleave="tooltipHover(scope.row,false, $event)"></i>
|
<i :class="scope.row.alertNum ? 'red' : 'green'" class="nz-icon nz-icon-overview-alert vertical-align-top;" @mouseenter="tooltipHover(scope.row,true, $event)" @mouseleave="tooltipHover(scope.row,false, $event)"></i>
|
||||||
<div v-if="scope.row.alertNumtooltipShow" class="alert-days-info-tooltip" :style="{left: scope.row.left + 'px',top:scope.row.top + 'px'}">
|
<div v-if="scope.row.alertNumtooltipShow" class="alert-days-info-tooltip" :style="{left: scope.row.left + 'px',top:scope.row.top + 'px'}">
|
||||||
@@ -104,27 +87,27 @@
|
|||||||
:alertDaysData="scope.row.alertDaysData"
|
:alertDaysData="scope.row.alertDaysData"
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="item.prop === 'configs'">
|
<template v-else-if="item.prop === 'configs'">
|
||||||
<span class="configs-endpoint metrics"
|
<span class="configs-endpoint metrics"
|
||||||
@mouseenter="labelHover(scope.row, item.prop, true, $event)"
|
@mouseenter="labelHover1(scope.row, item.prop, true, $event)"
|
||||||
@mouseleave="labelHover(scope.row, item.prop, false, $event, true)">
|
@mouseleave="labelHover1(scope.row, item.prop, false, $event, true)">
|
||||||
[{{scope.row.configs[0].enable ? 'Metrics':''}}{{scope.row.configs[0].enable&&scope.row.configs[1].enable?',':''}}{{scope.row.configs[1].enable ? 'logs' : ''}}]
|
[{{scope.row.configs[0].enable ? 'Metrics':''}}{{scope.row.configs[0].enable&&scope.row.configs[1].enable?',':''}}{{scope.row.configs[1].enable ? 'logs' : ''}}]
|
||||||
</span>
|
</span>
|
||||||
<nz-tooltip :that="scope.row[item.prop]" class="data-column__" v-if="scope.row[item.prop] && scope.row[item.prop].loading" :type="item.prop">
|
<nz-tooltip :that="scope.row[item.prop]" class="data-column__" v-if="scope.row[item.prop] && scope.row[item.prop].loading" :type="item.prop">
|
||||||
<div name="default">
|
<div name="default">
|
||||||
<span class="copy-value-content"> <i class="nz-icon nz-icon-override" @click="copyValue(clConfigs(scope.row))"></i></span>
|
<span class="copy-value-content"> <i class="nz-icon nz-icon-override" @click="copyValue(clConfigs(scope.row))"></i></span>
|
||||||
<pre class="copy-value-content__pre">{{JSON.stringify(clConfigs(scope.row),null,2)}}</pre>
|
<pre class="copy-value-content__pre">{{JSON.stringify(clConfigs(scope.row),null,2)}}</pre>
|
||||||
</div>
|
</div>
|
||||||
</nz-tooltip>
|
</nz-tooltip>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-else-if="item.prop === 'state'">
|
<template v-else-if="item.prop === 'state'">
|
||||||
<!-- metrics-->
|
<!-- metrics-->
|
||||||
<span style="width: auto;display: inline-block;cursor: pointer"
|
<span style="width: auto;display: inline-block;cursor: pointer"
|
||||||
@mouseenter="labelHoverConfigs(scope.row, 0, true, $event)"
|
@mouseenter="labelHoverConfigs(scope.row, 0, true, $event)"
|
||||||
@mouseleave="labelHoverConfigs(scope.row, 0, false, $event)"
|
@mouseleave="labelHoverConfigs(scope.row, 0, false, $event)"
|
||||||
>
|
>
|
||||||
<span class="endpoint-cell-left"><i class="nz-icon nz-icon-Metrics colorFA901C" /> {{$t('project.endpoint.metrics')}} </span>
|
<span class="endpoint-cell-left"><i class="nz-icon nz-icon-Metrics colorFA901C" /> {{$t('project.endpoint.metrics')}} </span>
|
||||||
<span v-if="scope.row.configs[0].state===0 || !scope.row.configs[0].state">
|
<span v-if="scope.row.configs[0].state===0 || !scope.row.configs[0].state">
|
||||||
<span class="active-icon red-bg inline-block"></span>
|
<span class="active-icon red-bg inline-block"></span>
|
||||||
@@ -136,15 +119,15 @@
|
|||||||
<span class="active-icon gray-bg inline-block"></span>
|
<span class="active-icon gray-bg inline-block"></span>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
<nz-tooltip :that="scope.row.configs[0]" v-if="scope.row.configs[0] && scope.row.configs[0].loading && scope.row.configs[0].state > 1" :type="'configs[0]'">
|
<nz-tooltip :that="scope.row.configs[0]" v-if="scope.row.configs[0] && scope.row.configs[0].loading && scope.row.configs[0].state > 1" :type="'configs[0]'">
|
||||||
<div name="default">
|
<div name="default">
|
||||||
<div v-html="suspendedStr(scope.row.configs[0].state)"></div>
|
<div v-html="suspendedStr(scope.row.configs[0].state)"></div>
|
||||||
</div>
|
</div>
|
||||||
</nz-tooltip>
|
</nz-tooltip>
|
||||||
<!-- logs-->
|
<!-- logs-->
|
||||||
<span style="width: auto;display: inline-block;cursor: pointer"
|
<span style="width: auto;display: inline-block;cursor: pointer"
|
||||||
@mouseenter="labelHoverConfigs(scope.row, 1, true, $event)"
|
@mouseenter="labelHoverConfigs(scope.row, 1, true, $event)"
|
||||||
@mouseleave="labelHoverConfigs(scope.row, 1, false, $event)">
|
@mouseleave="labelHoverConfigs(scope.row, 1, false, $event)">
|
||||||
<span class="endpoint-cell-left" style="margin-left: 10px"><i class="nz-icon nz-icon-logs colorFA901C" /> {{$t('project.endpoint.logs')}} </span>
|
<span class="endpoint-cell-left" style="margin-left: 10px"><i class="nz-icon nz-icon-logs colorFA901C" /> {{$t('project.endpoint.logs')}} </span>
|
||||||
<span v-if="scope.row.configs[1].state===0 || !scope.row.configs[1].state">
|
<span v-if="scope.row.configs[1].state===0 || !scope.row.configs[1].state">
|
||||||
<span class="active-icon red-bg inline-block"></span>
|
<span class="active-icon red-bg inline-block"></span>
|
||||||
@@ -156,66 +139,74 @@
|
|||||||
<span class="active-icon gray-bg inline-block"></span>
|
<span class="active-icon gray-bg inline-block"></span>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
<nz-tooltip :that="scope.row.configs[1]" v-if="scope.row.configs[1] && scope.row.configs[1].loading && scope.row.configs[1].state > 1" :type="'configs[1]'">
|
<nz-tooltip :that="scope.row.configs[1]" v-if="scope.row.configs[1] && scope.row.configs[1].loading && scope.row.configs[1].state > 1" :type="'configs[1]'">
|
||||||
<div name="default">
|
<div name="default">
|
||||||
<div v-html="suspendedStr(scope.row.configs[1].state)"></div>
|
<div v-html="suspendedStr(scope.row.configs[1].state)"></div>
|
||||||
|
</div>
|
||||||
|
</nz-tooltip>
|
||||||
|
</template>
|
||||||
|
<template v-else-if="item.prop === 'enabled'">
|
||||||
|
<span v-if="scope.row[item.prop] === 1">{{$t('project.endpoint.enable')}}</span>
|
||||||
|
<span v-else>{{$t('project.endpoint.disable')}}</span>
|
||||||
|
</template>
|
||||||
|
<span v-else-if="item.prop === 'id'" :id="'globalSearch' + scope.row.id">{{scope.row[item.prop]}}</span>
|
||||||
|
<span v-else>{{scope.row[item.prop] ? scope.row[item.prop] : ''}}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
:resizable="false"
|
||||||
|
:width="operationWidth"
|
||||||
|
v-if="showOption"
|
||||||
|
fixed="right">
|
||||||
|
<div slot="header" class="table-operation-title">{{$t('overall.option')}}</div>
|
||||||
|
<div slot-scope="scope" class="table-operation-items">
|
||||||
|
<button v-if="endpointTab" class="table-operation-item" v-has="'monitor_endpoint_edit'" @click="$emit('edit', scope.row)"><i class="nz-icon nz-icon-edit"></i></button>
|
||||||
|
<button v-else class="table-operation-item" @click="$emit('showBottomBox', 'panelTab', scope.row)"><i class="nz-icon nz-icon-view1"></i></button>
|
||||||
|
<el-dropdown size="medium" v-has="['monitor_endpoint_edit','monitor_endpoint_delete','alertSilence_add']" trigger="click" @command="tableOperation">
|
||||||
|
<div class="table-operation-item table-operation-item--more">
|
||||||
|
<i class="nz-icon nz-icon-more3"></i>
|
||||||
</div>
|
</div>
|
||||||
</nz-tooltip>
|
<el-dropdown-menu slot="dropdown" class="right-box-select-top right-public-box-dropdown-top">
|
||||||
</template>
|
<!-- <el-dropdown-item v-if="!endpointTab" :command="['endpointQuery', scope.row]"><i class="nz-icon nz-icon-search"></i><span class="operation-dropdown-text">{{$t('overall.query')}}</span></el-dropdown-item>-->
|
||||||
<template v-else-if="item.prop === 'enabled'">
|
<el-dropdown-item v-if="!endpointTab" v-has="'monitor_endpoint_edit'" :command="['edit', scope.row]"><i class="nz-icon nz-icon-edit"></i><span class="operation-dropdown-text">{{$t('overall.edit')}}</span></el-dropdown-item>
|
||||||
<span v-if="scope.row[item.prop] === 1">{{$t('project.endpoint.enable')}}</span>
|
<el-dropdown-item v-has="'monitor_endpoint_delete'" :command="['delete', scope.row, `sys/endpoint?ids=${scope.row.id}`]"><i class="nz-icon nz-icon-delete"></i><span class="operation-dropdown-text">{{$t('overall.delete')}}</span></el-dropdown-item>
|
||||||
<span v-else>{{$t('project.endpoint.disable')}}</span>
|
<el-dropdown-item v-has="'monitor_endpoint_edit'" :command="['copy', scope.row, 'project']"><i class="nz-icon nz-icon-override"></i><span class="operation-dropdown-text">{{$t('overall.duplicate')}}</span></el-dropdown-item>
|
||||||
</template>
|
<el-dropdown-item v-has="'alertSilence_add'" :command="['fastSilence', scope.row, 'endpoint']"><i class="nz-icon nz-icon-fast-silence"></i><span class="operation-dropdown-text">{{$t('overall.silenceAlert')}}</span></el-dropdown-item>
|
||||||
<span v-else-if="item.prop === 'id'" :id="'globalSearch' + scope.row.id">{{scope.row[item.prop]}}</span>
|
</el-dropdown-menu>
|
||||||
<span v-else>{{scope.row[item.prop] ? scope.row[item.prop] : ''}}</span>
|
</el-dropdown>
|
||||||
|
</div>
|
||||||
|
</el-table-column>
|
||||||
|
<template slot="empty">
|
||||||
|
<div v-if="!loading" class="table-no-data">
|
||||||
|
<svg class="icon" aria-hidden="true">
|
||||||
|
<use xlink:href="#nz-icon-no-data-list"></use>
|
||||||
|
</svg>
|
||||||
|
<div class="table-no-data__title">No results found</div>
|
||||||
|
</div>
|
||||||
|
<div v-else> </div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table>
|
||||||
<el-table-column
|
<alertLabel
|
||||||
:resizable="false"
|
v-if="alertLabelShow"
|
||||||
:width="operationWidth"
|
:id="alertLabelId"
|
||||||
v-if="showOption"
|
:that="alertLabelObj"
|
||||||
fixed="right">
|
:type="alertLabelType"
|
||||||
<div slot="header" class="table-operation-title">{{$t('overall.option')}}</div>
|
></alertLabel>
|
||||||
<div slot-scope="scope" class="table-operation-items">
|
</div>
|
||||||
<button v-if="endpointTab" class="table-operation-item" v-has="'monitor_endpoint_edit'" @click="$emit('edit', scope.row)"><i class="nz-icon nz-icon-edit"></i></button>
|
|
||||||
<button v-else class="table-operation-item" @click="$emit('showBottomBox', 'panelTab', scope.row)"><i class="nz-icon nz-icon-view1"></i></button>
|
|
||||||
<el-dropdown size="medium" v-has="['monitor_endpoint_edit','monitor_endpoint_delete','alertSilence_add']" trigger="click" @command="tableOperation">
|
|
||||||
<div class="table-operation-item table-operation-item--more">
|
|
||||||
<i class="nz-icon nz-icon-more3"></i>
|
|
||||||
</div>
|
|
||||||
<el-dropdown-menu slot="dropdown" class="right-box-select-top right-public-box-dropdown-top">
|
|
||||||
<!-- <el-dropdown-item v-if="!endpointTab" :command="['endpointQuery', scope.row]"><i class="nz-icon nz-icon-search"></i><span class="operation-dropdown-text">{{$t('overall.query')}}</span></el-dropdown-item>-->
|
|
||||||
<el-dropdown-item v-if="!endpointTab" v-has="'monitor_endpoint_edit'" :command="['edit', scope.row]"><i class="nz-icon nz-icon-edit"></i><span class="operation-dropdown-text">{{$t('overall.edit')}}</span></el-dropdown-item>
|
|
||||||
<el-dropdown-item v-has="'monitor_endpoint_delete'" :command="['delete', scope.row, `sys/endpoint?ids=${scope.row.id}`]"><i class="nz-icon nz-icon-delete"></i><span class="operation-dropdown-text">{{$t('overall.delete')}}</span></el-dropdown-item>
|
|
||||||
<el-dropdown-item v-has="'monitor_endpoint_edit'" :command="['copy', scope.row, 'project']"><i class="nz-icon nz-icon-override"></i><span class="operation-dropdown-text">{{$t('overall.duplicate')}}</span></el-dropdown-item>
|
|
||||||
<el-dropdown-item v-has="'alertSilence_add'" :command="['fastSilence', scope.row, 'endpoint']"><i class="nz-icon nz-icon-fast-silence"></i><span class="operation-dropdown-text">{{$t('overall.silenceAlert')}}</span></el-dropdown-item>
|
|
||||||
</el-dropdown-menu>
|
|
||||||
</el-dropdown>
|
|
||||||
</div>
|
|
||||||
</el-table-column>
|
|
||||||
<template slot="empty">
|
|
||||||
<div v-if="!loading" class="table-no-data">
|
|
||||||
<svg class="icon" aria-hidden="true">
|
|
||||||
<use xlink:href="#nz-icon-no-data-list"></use>
|
|
||||||
</svg>
|
|
||||||
<div class="table-no-data__title">No results found</div>
|
|
||||||
</div>
|
|
||||||
<div v-else> </div>
|
|
||||||
</template>
|
|
||||||
</el-table>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import table from '@/components/common/mixin/table'
|
import table from '@/components/common/mixin/table'
|
||||||
import alertLabel from '../../alert/alertLabel'
|
import alertLabel from '../../alert/alertLabel'
|
||||||
import nzTooltip from '../../alert/nzTooltip'
|
import nzTooltip from '../../alert/nzTooltip'
|
||||||
|
import alertLabelMixin from '@/components/common/mixin/alertLabelMixin'
|
||||||
export default {
|
export default {
|
||||||
name: 'endpointTable',
|
name: 'endpointTable',
|
||||||
components: {
|
components: {
|
||||||
alertLabel,
|
alertLabel,
|
||||||
nzTooltip
|
nzTooltip
|
||||||
},
|
},
|
||||||
mixins: [table],
|
mixins: [table, alertLabelMixin],
|
||||||
props: {
|
props: {
|
||||||
showOption: {
|
showOption: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
@@ -325,7 +316,7 @@ export default {
|
|||||||
return str
|
return str
|
||||||
},
|
},
|
||||||
// label 鼠标划入
|
// label 鼠标划入
|
||||||
labelHover (item, type, loading, e, slow) {
|
labelHover1 (item, type, loading, e, slow) {
|
||||||
if (e) {
|
if (e) {
|
||||||
const dom = e.currentTarget
|
const dom = e.currentTarget
|
||||||
const position = dom.getBoundingClientRect()
|
const position = dom.getBoundingClientRect()
|
||||||
|
|||||||
Reference in New Issue
Block a user