From 2d4b26ebf781f9fcaec861723a2700ec1f6bfa6d Mon Sep 17 00:00:00 2001 From: junjun Date: Tue, 10 May 2022 11:38:08 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=BB=B4=E5=BA=A6=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/chart/components/compare/CustomSortEdit.vue | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/frontend/src/views/chart/components/compare/CustomSortEdit.vue b/frontend/src/views/chart/components/compare/CustomSortEdit.vue index 067118bb7d..531c8a16b1 100644 --- a/frontend/src/views/chart/components/compare/CustomSortEdit.vue +++ b/frontend/src/views/chart/components/compare/CustomSortEdit.vue @@ -47,6 +47,7 @@ export default { console.log(this.chart) const chart = JSON.parse(JSON.stringify(this.chart)) let customSortData + const res = [] if (Object.prototype.toString.call(chart.customSort) === '[object Array]') { customSortData = JSON.parse(JSON.stringify(chart.customSort)) } else { @@ -56,7 +57,7 @@ export default { if (chart && chart.data) { const data = chart.data.datas data.forEach(ele => { - this.sortList.push(ele.field) + res.push(ele.field) }) } } else { @@ -64,10 +65,14 @@ export default { const data = chart.data.datas const cus = customSort(customSortData, data) cus.forEach(ele => { - this.sortList.push(ele.field) + res.push(ele.field) }) } } + // 字段去重 + this.sortList = res.filter(function(item, index, arr) { + return res.indexOf(item, 0) === index + }) }, onMove() { },