提交 2d4b26eb authored 作者: junjun's avatar junjun

feat: 维度自定义排序

上级 9118b043
...@@ -47,6 +47,7 @@ export default { ...@@ -47,6 +47,7 @@ export default {
console.log(this.chart) console.log(this.chart)
const chart = JSON.parse(JSON.stringify(this.chart)) const chart = JSON.parse(JSON.stringify(this.chart))
let customSortData let customSortData
const res = []
if (Object.prototype.toString.call(chart.customSort) === '[object Array]') { if (Object.prototype.toString.call(chart.customSort) === '[object Array]') {
customSortData = JSON.parse(JSON.stringify(chart.customSort)) customSortData = JSON.parse(JSON.stringify(chart.customSort))
} else { } else {
...@@ -56,7 +57,7 @@ export default { ...@@ -56,7 +57,7 @@ export default {
if (chart && chart.data) { if (chart && chart.data) {
const data = chart.data.datas const data = chart.data.datas
data.forEach(ele => { data.forEach(ele => {
this.sortList.push(ele.field) res.push(ele.field)
}) })
} }
} else { } else {
...@@ -64,10 +65,14 @@ export default { ...@@ -64,10 +65,14 @@ export default {
const data = chart.data.datas const data = chart.data.datas
const cus = customSort(customSortData, data) const cus = customSort(customSortData, data)
cus.forEach(ele => { 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() { onMove() {
}, },
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论