diff --git a/frontend/src/views/chart/components/compare/CompareEdit.vue b/frontend/src/views/chart/components/compare/CompareEdit.vue index aa9916a684..0d9f1dfa7c 100644 --- a/frontend/src/views/chart/components/compare/CompareEdit.vue +++ b/frontend/src/views/chart/components/compare/CompareEdit.vue @@ -62,7 +62,12 @@ export default { methods: { // 过滤xaxis,extStack所有日期字段 initFieldList() { - const xAxis = JSON.parse(this.chart.xaxis) + let xAxis = null + if (Object.prototype.toString.call(this.chart.xaxis) === '[object Array]') { + xAxis = JSON.parse(JSON.stringify(this.chart.xaxis)) + } else { + xAxis = JSON.parse(this.chart.xaxis) + } const t1 = xAxis.filter(ele => { return ele.deType === 1 }) this.fieldList = t1 // 如果没有选中字段,则默认选中第一个 diff --git a/frontend/src/views/chart/components/drag-item/DimensionExtItem.vue b/frontend/src/views/chart/components/drag-item/DimensionExtItem.vue index 747a916ae1..2d8ddf99c0 100644 --- a/frontend/src/views/chart/components/drag-item/DimensionExtItem.vue +++ b/frontend/src/views/chart/components/drag-item/DimensionExtItem.vue @@ -13,7 +13,7 @@ {{ item.name }} - + {{ $t('chart.' + item.dateStyle) }} diff --git a/frontend/src/views/chart/components/drag-item/DimensionItem.vue b/frontend/src/views/chart/components/drag-item/DimensionItem.vue index 45a6f436a3..f8b5f60da0 100644 --- a/frontend/src/views/chart/components/drag-item/DimensionItem.vue +++ b/frontend/src/views/chart/components/drag-item/DimensionItem.vue @@ -13,7 +13,7 @@ {{ item.name }} - + {{ $t('chart.' + item.dateStyle) }} diff --git a/frontend/src/views/chart/components/drag-item/QuotaExtItem.vue b/frontend/src/views/chart/components/drag-item/QuotaExtItem.vue index 053c311d21..8c08badb3d 100644 --- a/frontend/src/views/chart/components/drag-item/QuotaExtItem.vue +++ b/frontend/src/views/chart/components/drag-item/QuotaExtItem.vue @@ -17,7 +17,7 @@ {{ item.name }} - {{ $t('chart.' + item.summary) }}-{{ $t('chart.' + item.compareCalc.type) }} + {{ $t('chart.' + item.summary) }}-{{ $t('chart.' + item.compareCalc.type) }} @@ -176,12 +176,17 @@ export default { } }, isEnableCompare() { - const xAxis = JSON.parse(this.chart.xaxis) + let xAxis = null + if (Object.prototype.toString.call(this.chart.xaxis) === '[object Array]') { + xAxis = JSON.parse(JSON.stringify(this.chart.xaxis)) + } else { + xAxis = JSON.parse(this.chart.xaxis) + } const t1 = xAxis.filter(ele => { return ele.deType === 1 }) // 暂时只支持类别轴/维度的时间类型字段 - if (t1.length > 0 && this.chart.type !== 'text' && this.chart.type !== 'gauge' && this.chart.type !== 'liquid') { + if (t1.length > 0 && this.chart.type !== 'text' && this.chart.type !== 'label' && this.chart.type !== 'gauge' && this.chart.type !== 'liquid') { this.disableEditCompare = false } else { this.disableEditCompare = true diff --git a/frontend/src/views/chart/components/drag-item/QuotaItem.vue b/frontend/src/views/chart/components/drag-item/QuotaItem.vue index 66d14db6da..7b4539ff81 100644 --- a/frontend/src/views/chart/components/drag-item/QuotaItem.vue +++ b/frontend/src/views/chart/components/drag-item/QuotaItem.vue @@ -17,7 +17,7 @@ {{ item.name }} - {{ $t('chart.' + item.summary) }}-{{ $t('chart.' + item.compareCalc.type) }} + {{ $t('chart.' + item.summary) }}-{{ $t('chart.' + item.compareCalc.type) }} @@ -173,12 +173,17 @@ export default { } }, isEnableCompare() { - const xAxis = JSON.parse(this.chart.xaxis) + let xAxis = null + if (Object.prototype.toString.call(this.chart.xaxis) === '[object Array]') { + xAxis = JSON.parse(JSON.stringify(this.chart.xaxis)) + } else { + xAxis = JSON.parse(this.chart.xaxis) + } const t1 = xAxis.filter(ele => { return ele.deType === 1 }) // 暂时只支持类别轴/维度的时间类型字段 - if (t1.length > 0 && this.chart.type !== 'text' && this.chart.type !== 'gauge' && this.chart.type !== 'liquid') { + if (t1.length > 0 && this.chart.type !== 'text' && this.chart.type !== 'label' && this.chart.type !== 'gauge' && this.chart.type !== 'liquid') { this.disableEditCompare = false } else { this.disableEditCompare = true diff --git a/frontend/src/views/chart/components/shape-attr/TotalCfg.vue b/frontend/src/views/chart/components/shape-attr/TotalCfg.vue index 48e577833b..e8f4cec72e 100644 --- a/frontend/src/views/chart/components/shape-attr/TotalCfg.vue +++ b/frontend/src/views/chart/components/shape-attr/TotalCfg.vue @@ -89,7 +89,7 @@ export default { const chart = JSON.parse(JSON.stringify(this.chart)) if (chart.xaxisExt) { let arr = null - if (Object.prototype.toString.call(chart.xaxisExt) === '[object Object]') { + if (Object.prototype.toString.call(chart.xaxisExt) === '[object Array]') { arr = JSON.parse(JSON.stringify(chart.xaxisExt)) } else { arr = JSON.parse(chart.xaxisExt) @@ -102,7 +102,7 @@ export default { const chart = JSON.parse(JSON.stringify(this.chart)) if (chart.xaxis) { let arr = null - if (Object.prototype.toString.call(chart.xaxis) === '[object Object]') { + if (Object.prototype.toString.call(chart.xaxis) === '[object Array]') { arr = JSON.parse(JSON.stringify(chart.xaxis)) } else { arr = JSON.parse(chart.xaxis) diff --git a/frontend/src/views/chart/view/ChartEdit.vue b/frontend/src/views/chart/view/ChartEdit.vue index 2f2e3419ce..ff6c9d52f5 100644 --- a/frontend/src/views/chart/view/ChartEdit.vue +++ b/frontend/src/views/chart/view/ChartEdit.vue @@ -1635,6 +1635,7 @@ export default { ele.filter = [] } }) + this.chart = JSON.parse(JSON.stringify(view)) this.view = JSON.parse(JSON.stringify(view)) // stringify json param view.xaxis = JSON.stringify(view.xaxis)