diff --git a/nezha-fronted/src/components/chart/chart.vue b/nezha-fronted/src/components/chart/chart.vue index 746e16b06..c9148793d 100644 --- a/nezha-fronted/src/components/chart/chart.vue +++ b/nezha-fronted/src/components/chart/chart.vue @@ -309,7 +309,6 @@ export default { this.chartChildrenData = flag }, resize () { - console.log(this.$refs['chart' + this.chartInfo.id]) this.$refs['chart' + this.chartInfo.id] && this.$refs['chart' + this.chartInfo.id].resize() }, refreshLogs (params) { diff --git a/nezha-fronted/src/components/chart/chart/chartTimeSeries.vue b/nezha-fronted/src/components/chart/chart/chartTimeSeries.vue index eb2ca9204..cd13af52c 100644 --- a/nezha-fronted/src/components/chart/chart/chartTimeSeries.vue +++ b/nezha-fronted/src/components/chart/chart/chartTimeSeries.vue @@ -341,7 +341,6 @@ export default { } }, resize () { - console.log(213) setTimeout(() => { getChart(this.chartId) && getChart(this.chartId).resize() }, 100) diff --git a/nezha-fronted/src/components/charts/chartDataFormat.js b/nezha-fronted/src/components/charts/chartDataFormat.js index 9554bec4a..5ae955974 100644 --- a/nezha-fronted/src/components/charts/chartDataFormat.js +++ b/nezha-fronted/src/components/charts/chartDataFormat.js @@ -34,7 +34,7 @@ function percent02 (value, index) { if (!numberWithEConvent(scientificNotationValue)) { return `${scientificNotationValue} %` } - value = parseFloat((Number(value) * 100)) + value = parseFloat((Number(value) * 100).toFixed(2)) return `${value} %` } function localFormat (value, index) { @@ -728,7 +728,7 @@ export default { pow++ value = value * 10 } - return Math.ceil(value + 1) / Math.pow(10, pow) + return Math.floor(value + 1) / Math.pow(10, pow) } if (type === 'Time') { return value diff --git a/nezha-fronted/src/components/common/js/tools.js b/nezha-fronted/src/components/common/js/tools.js index 7f7f27138..89208731b 100644 --- a/nezha-fronted/src/components/common/js/tools.js +++ b/nezha-fronted/src/components/common/js/tools.js @@ -203,9 +203,9 @@ export const cancelWithChange = { if (!binding.value || !binding.value.obj) return const unsavedChange = localStorage.getItem('nz-unnsaved-change') const oldValue = JSON.parse(JSON.stringify(binding.value.obj)) + el.__newValue__ = oldValue function domClick (e) { - const newValue = JSON.parse(JSON.stringify(binding.value.obj)) - if (unsavedChange == 'on' && !isEqual(oldValue, newValue)) { + if (unsavedChange == 'on' && !isEqual(oldValue, el.__newValue__)) { MessageBox.confirm(i18n.t('tip.confirmCancel'), { confirmButtonText: i18n.t('tip.yes'), cancelButtonText: i18n.t('tip.no'), @@ -222,6 +222,9 @@ export const cancelWithChange = { el.__vueDomClick__ = domClick el.addEventListener('click', domClick) }, + update (el, binding, vnode) { + el.__newValue__ = binding.value.obj + }, unbind: function (el, binding) { // 解除事件监听 document.removeEventListener('click', el.__vueDomClick__) diff --git a/nezha-fronted/src/components/common/project/L5/CanvasProps.vue b/nezha-fronted/src/components/common/project/L5/CanvasProps.vue index feb4e2b23..a227f5220 100644 --- a/nezha-fronted/src/components/common/project/L5/CanvasProps.vue +++ b/nezha-fronted/src/components/common/project/L5/CanvasProps.vue @@ -6,7 +6,7 @@ - --> - +
@@ -650,7 +650,7 @@
- +
{{ $t('project.topology.textContent') }}
diff --git a/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue b/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue index fa725da8a..48aa7572f 100644 --- a/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue +++ b/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue @@ -234,14 +234,18 @@ export default { params.x = 0 params.y = 0 } - if (!params.x && !params.y && params.groupId) { // group 内的坐标需要单独计算 + if (isNaN(params.y) && isNaN(params.y) && params.groupId) { // group 内的坐标需要单独计算 params.x = 0 params.y = 999 } - if (!params.x && !params.y) { + if (isNaN(params.y) && isNaN(params.y)) { params.x = this.chartLastPosition.x + params.span > 12 ? 0 : this.chartLastPosition.x params.y = this.chartLastPosition.y + 12 } + if (params.x + params.span > 12) { + params.x = 0 + params.y += 1 + } delete params.panel if (params.type === 'table') { delete params.param.tags diff --git a/nezha-fronted/src/main.js b/nezha-fronted/src/main.js index 2e137d83c..579138526 100644 --- a/nezha-fronted/src/main.js +++ b/nezha-fronted/src/main.js @@ -104,7 +104,7 @@ Vue.mixin({ }, utcTimeToTimezoneStr: function (time) { if (time) { - return bus.timeFormate(bus.UTCTimeToConfigTimezone(time), localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'YYYY-MM-DD HH:mm:ss') + return bus.timeFormate(time, localStorage.getItem('nz-default-dateFormat') || 'YYYY-MM-DD HH:mm:ss') } else { return '-' }