багфиксы: сборка и число с запятыми на некоторых локалях в вебке

This commit is contained in:
2025-04-01 17:47:08 +03:00
parent 1b6b8b5329
commit 17110a82e0
5 changed files with 43 additions and 16 deletions

View File

@@ -567,6 +567,18 @@
return availableTabs[0]
}
function toLocaleStringWithSpaces(num) {
if (typeof num !== 'number') {
if (typeof num === 'string') { return num }
return String(num);
}
const numberString = num.toString()
const [integerPart, fractionalPart] = numberString.split('.')
const spacedIntegerPart = integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, " ")
if (fractionalPart) { return `${spacedIntegerPart}.${fractionalPart}` }
else { return spacedIntegerPart }
}
const app = Vue.createApp({
data() {
return {
@@ -768,7 +780,7 @@
result = Math.round(result / step) * step
if ('min' in validation) { if (result <= validation['min']) { result = validation['min'] } }
if ('max' in validation) { if (result >= validation['max']) { result = validation['max'] } }
return result.toLocaleString()
return toLocaleStringWithSpaces(result)
},
// ========== include from 'common/all-params-methods.js.j2'
@@ -1079,9 +1091,9 @@
let snr;
if (isNaN(calcSnr)) { snr = `ОСШ=?` } else { snr=`ОСШ=${calcSnr}` }
if (result > 1024) {
return (result / 1024).toLocaleString() + ' Мбит/с; ' + snr
return toLocaleStringWithSpaces(result / 1024) + ' Мбит/с; ' + snr
} else {
return result.toLocaleString() + ' кбит/с; ' + snr
return toLocaleStringWithSpaces(result) + ' кбит/с; ' + snr
}
},
// ========== include end from 'common/setup-methods.js.j2'