xytSk-App/pages/utils/tool.js

84 lines
1.7 KiB
JavaScript

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
}
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`]
}
export const fileChange = (file) => {
let target= ''
let blob = new Blob([file]);
console.log("blobblob",blob);
let url = window.URL.createObjectURL(blob);
// let reader = new FileReader(blob);
// console.log("reader",reader);
// reader.readAsDataURL(url);
// reader.onload = function (e) {
// target=e.target.result
// }
console.log("target",url);
return url
}