From c51b044fbdf46acfac30dbf88033f9ac3a353feb Mon Sep 17 00:00:00 2001 From: chenjinsong <523037378@qq.com> Date: Sat, 14 Sep 2024 17:12:59 +0800 Subject: [PATCH] =?UTF-8?q?CN-1705=20fix:=20=E4=BF=AE=E5=A4=8D=E6=94=B9?= =?UTF-8?q?=E4=B8=BA4=E7=A7=8D=E9=A2=9C=E8=89=B2=E5=90=8E=EF=BC=8C?= =?UTF-8?q?=E9=A5=BC=E5=9B=BE=E5=8F=AF=E8=83=BD=E5=87=BA=E7=8E=B0=E5=B0=8F?= =?UTF-8?q?=E6=95=B0=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/location/Index.vue | 38 +++++++++++++----------------------- 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/src/views/location/Index.vue b/src/views/location/Index.vue index 1d4cb2a3..4d9201c5 100644 --- a/src/views/location/Index.vue +++ b/src/views/location/Index.vue @@ -891,28 +891,21 @@ export default { const max = _.maxBy(data, d => Number(d.number)) const result = [] if (max) { - if (max.number < 10) { - for (let i = 1; i <= this.pieColorRamp.length; i++) { - const item = { - start: i * 2 - 1, - end: i * 2, - color: this.pieColorRamp[i - 1] - } - item.count = data.filter(d => d.number >= item.start && d.number <= item.end).length - result.push(item) - } + let step + if (max.number <= 1000) { + step = 20 } else { - const maxLength = String(max.number).length - const maxLegend = Math.ceil(max.number / Math.pow(10, maxLength - 1)) * Math.pow(10, maxLength - 1) - for (let i = 1; i <= this.pieColorRamp.length; i++) { - const item = { - start: maxLegend * (i - 1) / this.pieColorRamp.length + 1, - end: maxLegend * i / this.pieColorRamp.length, - color: this.pieColorRamp[i - 1] - } - item.count = data.filter(d => d.number >= item.start && d.number <= item.end).length - result.push(item) + step = 100 + } + const maxLegend = Math.ceil((max.number) / step) * step + for (let i = 1; i <= this.pieColorRamp.length; i++) { + const item = { + start: maxLegend * (i - 1) / this.pieColorRamp.length + 1, + end: maxLegend * i / this.pieColorRamp.length, + color: this.pieColorRamp[i - 1] } + item.count = data.filter(d => d.number >= item.start && d.number <= item.end).length + result.push(item) } } return result @@ -935,7 +928,6 @@ export default { color: this.getHexagonFillColor(d.number) } })) - console.info('featureCollection', featureCollection) } else if (tab === 'traceTracking') { // 对hexId去重,将重复的hexId的时间合并 const hexagons = [] @@ -993,7 +985,6 @@ export default { } }, hoverTrigger (source, id, hover) { - console.info(source, id) this.mapChart.setFeatureState({ source, id }, { hover }) }, bindHexagonEvents () { @@ -1041,7 +1032,6 @@ export default { // 去掉上一块的高亮 this.hoverTrigger('hexGrid', this.currentPolygon.id, false) } - console.info(features) this.currentPolygon = features[0].properties this.currentPolygon.id = features[0].id this.tooltip.x = originalEvent.clientX + 15 @@ -1418,7 +1408,7 @@ export default { const levelField = this.mapLevelField.find(item => item.level === this.mapLevel) paramArray.push(levelField ? levelField.field + "='" + this.curHexId + "'" : '') } - if (this.curSearchValue && this.curSearchValue !== '') { + if (this.curSearchValue) { paramArray.push(" (subscriber_id like '%" + this.curSearchValue + "%' or phone_number like '%" + this.curSearchValue + "%') ") } if (paramArray.length > 0) {