From bb3e330d97f1e41dee878f6f9b8ce56d53a425e8 Mon Sep 17 00:00:00 2001 From: zhangyu Date: Wed, 9 Mar 2022 19:32:04 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E5=A4=84=E7=90=86=20=E8=A1=A8?= =?UTF-8?q?=E6=A0=BCtooltip=20=E8=B0=83=E7=94=A8=E4=B8=A4=E6=AC=A1?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/chart/chartMixin.js | 3 +- .../common/mixin/alertLabelMixin.js | 52 ++++ .../common/table/alert/alertMessageTable.vue | 39 +-- .../common/table/asset/assetTable.vue | 287 +++++++++--------- .../common/table/settings/endpointTable.vue | 281 +++++++++-------- 5 files changed, 334 insertions(+), 328 deletions(-) create mode 100644 nezha-fronted/src/components/common/mixin/alertLabelMixin.js diff --git a/nezha-fronted/src/components/chart/chartMixin.js b/nezha-fronted/src/components/chart/chartMixin.js index 675b0be90..fcc3a700e 100644 --- a/nezha-fronted/src/components/chart/chartMixin.js +++ b/nezha-fronted/src/components/chart/chartMixin.js @@ -263,7 +263,8 @@ export default { chartData: { deep: true, handler (n) { - if (!this.isInit) { + if (!this.isInit && this.chartOption.color) { + console.log(this.chartOption) this.colorList = this.colorList.slice(0, 20) this.chartOption.color = this.chartOption.color.slice(0, 20) this.initChart(this.chartOption) diff --git a/nezha-fronted/src/components/common/mixin/alertLabelMixin.js b/nezha-fronted/src/components/common/mixin/alertLabelMixin.js new file mode 100644 index 000000000..fa35bbac2 --- /dev/null +++ b/nezha-fronted/src/components/common/mixin/alertLabelMixin.js @@ -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 + } + } + } +} diff --git a/nezha-fronted/src/components/common/table/alert/alertMessageTable.vue b/nezha-fronted/src/components/common/table/alert/alertMessageTable.vue index 2ce76ef2e..3fe1a97b6 100644 --- a/nezha-fronted/src/components/common/table/alert/alertMessageTable.vue +++ b/nezha-fronted/src/components/common/table/alert/alertMessageTable.vue @@ -72,8 +72,8 @@