fix:修改 asset chart相关bug

This commit is contained in:
zhangyu
2021-05-13 19:02:23 +08:00
parent ef6c2d3a30
commit d937dd1666
6 changed files with 47 additions and 28 deletions

View File

@@ -48,12 +48,12 @@
<span v-else-if="key == 'alert'" class="as-button" :class="{'success': value <= 0, 'danger': value > 0}">{{value + ' ' + $t('overall.active')}}</span> <span v-else-if="key == 'alert'" class="as-button" :class="{'success': value <= 0, 'danger': value > 0}">{{value + ' ' + $t('overall.active')}}</span>
<div v-else-if="key == 'tags'" class="no-overflow" style="padding-bottom: 5px;"> <div v-else-if="key == 'tags'" class="no-overflow" style="padding-bottom: 5px;">
<template v-if="value && value.length > 0"> <template v-if="value && value.length > 0">
<nz-alert-tag :label="tagItem.tag" type="normal" style="margin: 5px 5px 0 0; vertical-align: middle;" <nz-alert-tag :label="tagItem.name" type="normal" style="margin: 5px 5px 0 0; vertical-align: middle;"
:cursor-point="false" :cursor-point="false"
:key="tagItem.id" :key="tagItem.id"
v-for="(tagItem, tagIndex) in value"> v-for="(tagItem, tagIndex) in value">
<div :id="`tag-${index}-${tagIndex}`" class="tag-value"> <div :id="`tag-${index}-${tagIndex}`" class="tag-value">
<span class="content-text">{{tagItem.value}}</span> <span class="content-text">{{tagItem.value.join(',')}}</span>
</div> </div>
</nz-alert-tag> </nz-alert-tag>
</template> </template>
@@ -328,9 +328,9 @@ export default {
model: this.$t('asset.model'), model: this.$t('asset.model'),
vendor: this.$t('asset.vendor'), vendor: this.$t('asset.vendor'),
purchaseDate: this.$t('asset.procurementDate'), purchaseDate: this.$t('asset.procurementDate'),
principal: this.$t('asset.principal'), // principal: this.$t('asset.principal'),
tel: this.$t('asset.principalTel'), // tel: this.$t('asset.principalTel'),
pingStatus: this.$t('asset.assetPing'), // pingStatus: this.$t('asset.assetPing'),
pingLastReply: this.$t('asset.lastReply'), pingLastReply: this.$t('asset.lastReply'),
endpoint: this.$t('asset.modules'), endpoint: this.$t('asset.modules'),
alert: this.$t('asset.alerts'), alert: this.$t('asset.alerts'),
@@ -473,6 +473,7 @@ export default {
this.panelIdInner = panelId this.panelIdInner = panelId
this.data = chartItem this.data = chartItem
this.detail = detail this.detail = detail
console.log(detail);
if (this.detail[0] && this.detail[0].type && this.detail[0].type == 'endpointInfo') { // endpointInfo的小图表 if (this.detail[0] && this.detail[0].type && this.detail[0].type == 'endpointInfo') { // endpointInfo的小图表
this.$nextTick(() => { this.$nextTick(() => {
this.initChart(this.detail[0].data.stateSeries) this.initChart(this.detail[0].data.stateSeries)

View File

@@ -1495,26 +1495,26 @@ export default {
const basic = res[0].data const basic = res[0].data
// basic.cabinet = basic.cabinet ? basic.cabinet.name : '-' // basic.cabinet = basic.cabinet ? basic.cabinet.name : '-'
const obj = { const obj = {
purchaseDate: basic.purchaseDate,
pingRtt: basic.pingInfo ? basic.pingInfo.rtt : '-',
dataCenter: basic.dc ? basic.dc.name : '-',
pingStatus: basic.pingInfo ? basic.pingInfo.status : '-',
assetType: basic.type ? basic.type.name : '-',
tags: basic.fields,
cabinetStart: basic.cabinetStart,
principal: basic.dc ? basic.dc.principal : '-',
endpoint: basic.endpointNum,
cabinetEnd: basic.cabinetEnd,
alert: basic.alertNum,
vendor: basic.brand ? basic.brand.name : '-',
pingLastReply: basic.pingInfo ? basic.pingInfo.lastUpdate : '-',
host: basic.pingInfo ? basic.pingInfo.host : '-',
tel: basic.tel,
model: basic.model ? basic.model.name : '-',
id: basic.id, id: basic.id,
sn: basic.sn, host: basic.pingInfo ? basic.pingInfo.host : '-',
assetType: basic.type ? basic.type.name : '-',
state: basic.state ? basic.state.name : '-', state: basic.state ? basic.state.name : '-',
cabinet: basic.cabinet ? basic.cabinet.name : '-' pingRtt: basic.pingInfo ? basic.pingInfo.rtt : '',
dataCenter: basic.dc ? basic.dc.name : '-',
cabinet: basic.cabinet ? basic.cabinet.name : '-',
alert: basic.alertNum,
endpoint: basic.endpointNum,
purchaseDate: basic.purchaseDate,
vendor: basic.brand ? basic.brand.name : '-',
model: basic.model ? basic.model.name : '-',
sn: basic.sn,
tags: basic.fields,
pingStatus: basic.pingInfo ? basic.pingInfo.status : '-',
cabinetStart: basic.cabinetStart,
cabinetEnd: basic.cabinetEnd,
pingLastReply: basic.pingInfo ? basic.pingInfo.lastUpdate : ''
// principal: basic.dc ? basic.dc.principal : '-',
// tel: basic.tel,
} }
console.log(obj) console.log(obj)
basic && detail.push({ basic && detail.push({

View File

@@ -43,6 +43,8 @@
export-url="visual/panel/export" export-url="visual/panel/export"
import-url="visual/panel/import" import-url="visual/panel/import"
@afterImport="getTableData" @afterImport="getTableData"
:showLock="from === fromRoute.asset"
@panelLockChange="panelLockChange"
> >
</top-tool-more-options> </top-tool-more-options>
</template> </template>
@@ -276,7 +278,7 @@ export default {
} else { } else {
if (this.from == this.$CONSTANTS.fromRoute.chartTemp) { if (this.from == this.$CONSTANTS.fromRoute.chartTemp) {
if (this.obj.type === 'group') { if (this.obj.type === 'group') {
this.$get('/visual/panel/chart', { ids: this.obj.id,groupId:0}).then(res => { this.$get('/visual/panel/chart', { ids: this.obj.id, groupId: 0 }).then(res => {
this.panelDataList = res.data.list this.panelDataList = res.data.list
if (this.panelDataList.length > 0) { if (this.panelDataList.length > 0) {
this.showPanel.id = this.filter.panelId = 0 this.showPanel.id = this.filter.panelId = 0
@@ -428,6 +430,9 @@ export default {
}, },
tableListLeave () { tableListLeave () {
this.tableHover = false this.tableHover = false
},
panelLockChange (boolean) {
this.panelLock = boolean
} }
}, },
mounted () { mounted () {

View File

@@ -106,6 +106,7 @@ const cn = {
moreOption: '更多选项', moreOption: '更多选项',
copy: '复制', copy: '复制',
silence: '静默', silence: '静默',
labels: '标签',
}, },
setup: { setup: {
step0: '欢迎', step0: '欢迎',

View File

@@ -4,9 +4,9 @@
<i class="nz-icon nz-icon-arrow-down" style="font-size: 12px;"></i> <i class="nz-icon nz-icon-arrow-down" style="font-size: 12px;"></i>
</button> </button>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<!-- <el-dropdown-item> <el-dropdown-item v-if="showLock">
<div @click="panelLock=!panelLock" id="panel-lock"><i :class="{'nz-icon nz-icon-lock':panelLock,'nz-icon nz-icon-unlock':!panelLock}"></i>{{panelLock ? 'Locked' : 'Unlocked'}}</div> <div @click="panelLock=!panelLock" id="panel-lock"><i :class="{'nz-icon nz-icon-lock':panelLock,'nz-icon nz-icon-unlock':!panelLock}"></i>{{panelLock ? 'Locked' : 'Unlocked'}}</div>
</el-dropdown-item>--> </el-dropdown-item>
<slot name="before"></slot> <slot name="before"></slot>
<el-dropdown-item v-if="importUrl"> <el-dropdown-item v-if="importUrl">
<div id="chart-import" @click="showImportBox(1)"><i class="nz-icon nz-icon-upload"></i>{{$t('overall.importExcel')}}</div> <div id="chart-import" @click="showImportBox(1)"><i class="nz-icon nz-icon-upload"></i>{{$t('overall.importExcel')}}</div>
@@ -125,6 +125,9 @@ export default {
triggerButtonClass: { // 触发下拉事件的按钮的class triggerButtonClass: { // 触发下拉事件的按钮的class
type: String, type: String,
default: 'top-tool-btn' default: 'top-tool-btn'
},
showLock: {
type: Boolean, default: false
} }
}, },
data () { data () {
@@ -134,7 +137,8 @@ export default {
importFileList: [], importFileList: [],
importResult: null, importResult: null,
exportShow: false, exportShow: false,
paramsType: '' paramsType: '',
panelLock: true
} }
}, },
mounted () { mounted () {
@@ -348,6 +352,14 @@ export default {
default: this.paramsType = ''; break default: this.paramsType = ''; break
} }
} }
},
watch: {
panelLock: {
immediate: true,
handler (n) {
this.$emit('panelLockChange', n)
}
}
} }
} }
</script> </script>

View File

@@ -480,7 +480,7 @@ export default {
blankLabelValue (label) { blankLabelValue (label) {
if (label.type.toUpperCase() === this.assetConstants.labelTypeData.CHECKBOX) { if (label.type.toUpperCase() === this.assetConstants.labelTypeData.CHECKBOX) {
return [] return []
} else if (label.type.toUpperCase() === this.assetConstants.labelTypeData.MULTITEXT) { } else if (label.type.toUpperCase() === this.assetConstants.labelTypeData.MULTITEXT || label.type.toUpperCase() === assetConstants.labelTypeData.TEXT || label.type.toUpperCase() === assetConstants.labelTypeData.TEXTAREA) {
return [''] return ['']
} else { } else {
return '' return ''