2021-04-13 20:33:12 +08:00
|
|
|
<template>
|
2022-12-27 15:43:38 +08:00
|
|
|
<div>
|
|
|
|
|
<el-table
|
|
|
|
|
id="dcTable"
|
|
|
|
|
ref="dataTable"
|
|
|
|
|
:data="tableData"
|
|
|
|
|
:height="height"
|
|
|
|
|
border
|
|
|
|
|
:default-sort="orderBy"
|
|
|
|
|
@cell-mouse-enter="cellMouseEnter"
|
|
|
|
|
@header-dragend="dragend"
|
|
|
|
|
@sort-change="tableDataSort"
|
|
|
|
|
@selection-change="selectionChange"
|
|
|
|
|
@row-dblclick="(row)=>{showBottomBox('cabinet', row)}"
|
2021-04-13 20:33:12 +08:00
|
|
|
>
|
2022-12-27 15:43:38 +08:00
|
|
|
<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">
|
|
|
|
|
<span class="data-column__span">{{item.label}}</span>
|
|
|
|
|
<div class="col-resize-area"></div>
|
2021-04-13 20:33:12 +08:00
|
|
|
</template>
|
2022-12-27 15:43:38 +08:00
|
|
|
<template slot-scope="scope" :column="item">
|
|
|
|
|
<template v-if="item.prop === 'principal'">
|
|
|
|
|
<template v-if="scope.row.adminUser">
|
|
|
|
|
{{scope.row.adminUser.name}}
|
|
|
|
|
</template>
|
|
|
|
|
<template v-else>-</template>
|
|
|
|
|
</template>
|
|
|
|
|
<template v-else-if="item.prop === 'state'">
|
|
|
|
|
<div v-if="scope.row[item.prop] === 'ON'">
|
|
|
|
|
<div class="active-icon green-bg inline-block"></div>
|
|
|
|
|
{{ $t('overall.enabled') }}
|
|
|
|
|
</div>
|
|
|
|
|
<div v-else-if="scope.row[item.prop] === 'OFF'">
|
|
|
|
|
<div class="active-icon gray-bg inline-block"></div>
|
|
|
|
|
{{ $t('overall.disabled') }}
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<template v-else-if="item.prop === 'longitude'">
|
|
|
|
|
<template v-if="regNumTest(scope.row.longitude)">{{scope.row.longitude}}</template>
|
|
|
|
|
<template v-else>-</template>
|
|
|
|
|
</template>
|
|
|
|
|
<template v-else-if="item.prop === 'latitude'">
|
|
|
|
|
<template v-if="regNumTest(scope.row.latitude)">{{scope.row.latitude}}</template>
|
|
|
|
|
<template v-else>-</template>
|
|
|
|
|
</template>
|
|
|
|
|
<template v-else-if="item.prop === 'assetNum'">
|
2022-12-12 16:55:27 +08:00
|
|
|
<span style="cursor: pointer" class="asset-num" @click.stop="showBottomBox('asset', scope.row)" @dblclick.stop="">
|
2021-04-30 17:02:43 +08:00
|
|
|
<i class="nz-icon nz-icon-overview-project monitorColor" :class="scope.row[item.prop]>0?'color23BF9A':'color23BF9A'"/>
|
2021-04-23 20:06:58 +08:00
|
|
|
{{scope.row[item.prop]}}
|
|
|
|
|
</span>
|
2022-12-27 15:43:38 +08:00
|
|
|
</template>
|
|
|
|
|
<template v-else-if="item.prop === 'alertNum'">
|
2022-12-12 16:55:27 +08:00
|
|
|
<span style="cursor: pointer" @click.stop="$emit('showBottomBox', 'alertMessageTab', scope.row)" @dblclick.stop="">
|
2022-02-25 14:07:17 +08:00
|
|
|
<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'}">
|
2022-06-21 18:14:21 +08:00
|
|
|
<div class="tooltip-title">{{$t('project.topology.alert')}}({{$t('overall.active')}})</div>
|
2022-02-25 14:07:17 +08:00
|
|
|
<div class="severity-info" style='justify-content: space-between'>
|
|
|
|
|
<div class="severity-name">{{$t('overall.result.total')}}</div>
|
|
|
|
|
<div class="severity-value">{{scope.row.alertNum}}</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<alertDaysInfo
|
2022-12-27 15:43:38 +08:00
|
|
|
v-show="!scope.row.trendLoading"
|
|
|
|
|
:alertDaysData="scope.row.alertDaysData"
|
2022-02-25 14:07:17 +08:00
|
|
|
/>
|
2021-04-23 20:06:58 +08:00
|
|
|
</span>
|
2022-12-27 15:43:38 +08:00
|
|
|
</template>
|
2021-04-13 20:33:12 +08:00
|
|
|
|
2022-12-27 15:43:38 +08:00
|
|
|
<template v-else-if="item.prop === 'cabinetNum'">
|
2022-12-12 16:55:27 +08:00
|
|
|
<span style="cursor: pointer" class="cabinet-num" @click.stop="showBottomBox('cabinet', scope.row)" @dblclick.stop="">
|
2021-04-30 17:02:43 +08:00
|
|
|
<i class="nz-icon nz-icon-cabinet monitorColor" :class="scope.row[item.prop]>0?'color23BF9A':'colorEF7458'"/>
|
2021-04-23 20:06:58 +08:00
|
|
|
{{scope.row[item.prop]}}
|
|
|
|
|
</span>
|
2022-07-06 11:11:40 +08:00
|
|
|
</template>
|
2022-12-27 15:43:38 +08:00
|
|
|
<template v-else-if="item.prop === 'name'">
|
|
|
|
|
<copy :copyData='scope.row[item.prop]' :showInfo='scope.row[item.prop]'>
|
|
|
|
|
<template slot="copy-text">
|
|
|
|
|
{{scope.row[item.prop]?scope.row[item.prop]:'-'}}
|
|
|
|
|
</template>
|
|
|
|
|
</copy>
|
|
|
|
|
</template>
|
|
|
|
|
<span v-else-if="item.prop === 'id'" :id="'globalSearch' + scope.row.id">{{scope.row[item.prop]}}</span>
|
|
|
|
|
<template v-else-if="scope.row[item.prop]">{{scope.row[item.prop]}}</template>
|
|
|
|
|
<template v-else>-</template>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column
|
|
|
|
|
:resizable="false"
|
|
|
|
|
:width="operationWidth"
|
|
|
|
|
fixed="right">
|
|
|
|
|
<div slot="header" class="table-operation-title">{{$t('overall.option')}}</div>
|
|
|
|
|
<div slot-scope="scope" class="table-operation-items">
|
2022-12-27 16:40:25 +08:00
|
|
|
<button class="table-operation-item" @click="showBottomBox('cabinet', scope.row)" :title="$t('overall.view')"><i class="nz-icon nz-icon-view1"></i></button>
|
2022-12-27 15:43:38 +08:00
|
|
|
<el-dropdown size="medium" v-has="['dc_delete','dc_edit']" trigger="click" @command="tableOperation">
|
|
|
|
|
<div class="table-operation-item table-operation-item--more" :title="$t('overall.moreOperations')">
|
|
|
|
|
<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-has="'dc_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="'dc_edit'" :command="['copy', scope.row]"><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="'dc_delete'" :command="['delete-rel', scope.row, {forceDeleteShow:true, single:true}]"><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="'asset_add'" :command="['topology', scope.row, 'datacenter']"><i class="nz-icon nz-icon-Topology"></i><span class="operation-dropdown-text">{{$t('overall.topology')}}</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>
|
2021-04-13 20:33:12 +08:00
|
|
|
</template>
|
2022-12-27 15:43:38 +08:00
|
|
|
</el-table>
|
|
|
|
|
</div>
|
2021-04-13 20:33:12 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import table from '@/components/common/mixin/table'
|
2021-04-23 20:06:58 +08:00
|
|
|
import { showTableTooltip, hideTableTooltip } from '@/components/common/js/tools'
|
2022-02-25 14:07:17 +08:00
|
|
|
import alertDaysInfo from '@/components/common/alert/alertDaysInfo'
|
2022-10-14 15:43:11 +08:00
|
|
|
import deleteButton from '@/components/common/deleteButton'
|
2022-10-20 17:08:16 +08:00
|
|
|
import copy from '@/components/common/copy'
|
2021-04-13 20:33:12 +08:00
|
|
|
export default {
|
|
|
|
|
name: 'dcTable',
|
|
|
|
|
mixins: [table],
|
2022-02-25 14:07:17 +08:00
|
|
|
components: {
|
2022-10-20 17:08:16 +08:00
|
|
|
alertDaysInfo, deleteButton, copy
|
2022-02-25 14:07:17 +08:00
|
|
|
},
|
2021-10-22 17:47:42 +08:00
|
|
|
props: {
|
|
|
|
|
loading: Boolean
|
|
|
|
|
},
|
2021-04-13 20:33:12 +08:00
|
|
|
data () {
|
|
|
|
|
return {
|
|
|
|
|
regNum: /^[0-9]+.?[0-9]*/,
|
2022-02-25 14:07:17 +08:00
|
|
|
needAlertDaysData: true,
|
|
|
|
|
trendKey: 'dcId',
|
2021-04-13 20:33:12 +08:00
|
|
|
tableTitle: [
|
|
|
|
|
{
|
|
|
|
|
label: 'ID',
|
|
|
|
|
prop: 'id',
|
|
|
|
|
show: true,
|
2021-05-07 19:10:28 +08:00
|
|
|
width: 80,
|
2021-07-01 17:56:01 +08:00
|
|
|
sortable: 'custom'
|
2021-04-13 20:33:12 +08:00
|
|
|
}, {
|
|
|
|
|
label: this.$t('overall.name'),
|
|
|
|
|
prop: 'name',
|
2021-05-07 19:10:28 +08:00
|
|
|
show: true,
|
2021-07-22 10:00:29 +08:00
|
|
|
minWidth: 200,
|
2021-07-01 17:56:01 +08:00
|
|
|
sortable: 'custom'
|
2021-04-13 20:33:12 +08:00
|
|
|
}, {
|
|
|
|
|
label: this.$t('asset.location'),
|
|
|
|
|
prop: 'location',
|
|
|
|
|
show: true
|
|
|
|
|
}, {
|
2022-06-21 14:17:46 +08:00
|
|
|
label: this.$t('asset.cabinet'),
|
2021-04-13 20:33:12 +08:00
|
|
|
prop: 'cabinetNum',
|
2021-05-07 19:10:28 +08:00
|
|
|
show: true,
|
2022-03-24 14:16:35 +08:00
|
|
|
minWidth: 110,
|
2021-07-01 17:56:01 +08:00
|
|
|
sortable: 'custom'
|
2021-04-13 20:33:12 +08:00
|
|
|
}, {
|
2022-06-21 11:29:55 +08:00
|
|
|
label: this.$t('asset.asset'),
|
2021-04-23 20:06:58 +08:00
|
|
|
prop: 'assetNum',
|
2021-05-07 19:10:28 +08:00
|
|
|
show: true,
|
2021-07-23 10:53:54 +08:00
|
|
|
minWidth: 90,
|
2021-07-01 17:56:01 +08:00
|
|
|
sortable: 'custom'
|
2021-04-27 17:38:58 +08:00
|
|
|
}, {
|
2022-06-17 10:39:36 +08:00
|
|
|
label: this.$t('overall.alert'),
|
2021-04-23 20:06:58 +08:00
|
|
|
prop: 'alertNum',
|
2022-03-28 12:30:51 +08:00
|
|
|
width: 120,
|
2021-04-13 20:33:12 +08:00
|
|
|
show: true
|
|
|
|
|
}, {
|
2022-06-16 15:58:17 +08:00
|
|
|
label: this.$t('config.dc.tel'),
|
2021-04-13 20:33:12 +08:00
|
|
|
prop: 'tel',
|
2021-08-02 15:41:43 +08:00
|
|
|
show: false,
|
|
|
|
|
minWidth: 100
|
2021-04-13 20:33:12 +08:00
|
|
|
}, {
|
2022-06-16 15:58:17 +08:00
|
|
|
label: this.$t('config.dc.principal'),
|
2021-04-13 20:33:12 +08:00
|
|
|
prop: 'principal',
|
2021-08-02 15:41:43 +08:00
|
|
|
show: false,
|
|
|
|
|
minWidth: 120
|
2021-04-13 20:33:12 +08:00
|
|
|
}, {
|
|
|
|
|
label: this.$t('config.dc.longitude'),
|
|
|
|
|
prop: 'longitude',
|
2021-08-02 15:41:43 +08:00
|
|
|
show: false,
|
|
|
|
|
minWidth: 100
|
2021-04-13 20:33:12 +08:00
|
|
|
}, {
|
|
|
|
|
label: this.$t('config.dc.latitude'),
|
|
|
|
|
prop: 'latitude',
|
2021-08-02 15:41:43 +08:00
|
|
|
show: false,
|
|
|
|
|
minWidth: 100
|
2021-04-13 20:33:12 +08:00
|
|
|
}, {
|
2022-06-16 15:58:17 +08:00
|
|
|
label: this.$t('overall.state'),
|
2021-04-13 20:33:12 +08:00
|
|
|
prop: 'state',
|
2021-05-07 19:10:28 +08:00
|
|
|
show: true,
|
2021-08-02 15:41:43 +08:00
|
|
|
minWidth: 100,
|
2021-07-01 17:56:01 +08:00
|
|
|
sortable: 'custom'
|
2021-04-13 20:33:12 +08:00
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
},
|
2021-07-01 17:56:01 +08:00
|
|
|
mounted () {
|
2021-07-02 09:59:29 +08:00
|
|
|
// console.log(this.customTableTitle)
|
2021-07-01 17:56:01 +08:00
|
|
|
},
|
2021-04-13 20:33:12 +08:00
|
|
|
methods: {
|
2021-04-27 17:38:58 +08:00
|
|
|
showTableTooltip,
|
|
|
|
|
hideTableTooltip,
|
2021-04-13 20:33:12 +08:00
|
|
|
regNumTest (val) { // 校验是否是数字
|
|
|
|
|
return this.regNum.test(val)
|
2021-04-23 20:06:58 +08:00
|
|
|
},
|
|
|
|
|
messageStyle (title, row) {
|
|
|
|
|
if (title.prop === 'alertNum') {
|
|
|
|
|
if (row.alertNum > 0) {
|
|
|
|
|
return 'danger'
|
|
|
|
|
} else {
|
|
|
|
|
return 'success'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (title.label === 'assettNum') {
|
|
|
|
|
if (row.state === 3) {
|
|
|
|
|
return 'suspended'
|
|
|
|
|
} else {
|
|
|
|
|
if (row.endpointDownNum > 0) {
|
|
|
|
|
return 'danger'
|
|
|
|
|
} else {
|
|
|
|
|
return 'success'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return ''
|
2021-04-27 17:38:58 +08:00
|
|
|
}
|
2021-04-13 20:33:12 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|