cbsl-app/pages/utils/tool.js

78 lines
1.5 KiB
JavaScript
Raw Normal View History

2026-04-13 14:13:06 +08:00
export function restm (e) {
let index = ''
if (e == '8') {
index = 0
} else if (e == '9') {
index = 1
} else if (e == '10') {
index = 2
} else if (e == '11') {
index = 3
} else if (e == '12') {
index = 4
} else if (e == '13') {
index = 5
} else if (e == '14') {
index = 6
} else if (e == '15') {
index = 7
} else if (e == '16') {
index = 8
} else if (e == '17') {
index = 9
} else if (e == '18') {
index = 10
} else if (e == '19') {
index = 11
} else if (e == '20') {
index = 12
} else if (e == '21') {
index = 13
} else if (e == '22') {
index = 14
} else if (e == '23') {
index = 15
} else if (e == '0') {
index = 16
} else if (e == '1') {
index = 17
} else if (e == '2') {
index = 18
} else if (e == '3') {
index = 19
} else if (e == '4') {
index = 20
} else if (e == '5') {
index = 21
} else if (e == '6') {
index = 22
} else if (e == '7') {
index = 23
}
return index
}
2026-04-16 15:54:02 +08:00
export const GetInterval=(min,max,step=10)=>{
const distance = Math.ceil(max) - Math.floor(min)
console.log(distance);
let s = (distance / step);
console.log(s);
if (s > 5){
s = Math.ceil(s / 5) *5;
return s;
}else{
return Math.ceil(s)
}
}
2026-04-13 14:13:06 +08:00
export const adnmZhen = adcd => {
if (!adcd || !nameMap) {
return undefined
}
if (adcd.endsWith('000000000')) {
return undefined
} else if (adcd.endsWith('000000')) {
return nameMap[adcd]
}
return nameMap[`${adcd.substr(0, 9)}000000`]
}