From f00756f2c2dd4a4cfebc6aff4026dd3f248eaccb Mon Sep 17 00:00:00 2001 From: Yuan Date: Fri, 9 Sep 2022 13:47:26 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=B1=E5=85=AC=E9=87=8C=E6=A0=87=E6=89=B9?= =?UTF-8?q?=E9=87=8F=E8=AE=A1=E7=AE=97=E5=8C=BA=E6=AE=B5=E5=AE=9E=E9=99=85?= =?UTF-8?q?=E9=95=BF=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapoperate/section/batchSettings.vue | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/views/newMap/newMapdraft/mapoperate/section/batchSettings.vue b/src/views/newMap/newMapdraft/mapoperate/section/batchSettings.vue index e5100b997..8cddaa344 100644 --- a/src/views/newMap/newMapdraft/mapoperate/section/batchSettings.vue +++ b/src/views/newMap/newMapdraft/mapoperate/section/batchSettings.vue @@ -125,6 +125,9 @@ + + 设置 + @@ -424,6 +427,24 @@ export default { } models.push(deepAssign(section, { _type: 'Section' })); this.$emit('updateMapModel', models); + }, + calculateSectionLength(){ + const precisionOf = num => num.toString().split('.').pop().length + this.$confirm('确认设置所有区段的实际长度吗?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(()=>{ + this.sectionList.forEach(section => { + const { kmMin, kmMax } = section + if (typeof kmMin === 'number' && typeof kmMax === 'number') { + const precision = Math.max(precisionOf(kmMin), precisionOf(kmMax)) + section.lengthFact = Number((kmMax - kmMin).toFixed(precision)) + } + }) + this.$emit('updateMapModel', this.sectionList) + this.$message.success('区段长度设置成功!') + }) } } };