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 @@