12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- var utilsJs = {
- pxConversionMm(value) {
- /*px转换为mm*/
- var inch = value / this.conversion_getDPI()[0]
- var c_value = inch * 25.4
- return c_value
- },
- mmConversionPx(value) {
- /*mm转换为px*/
- //in 英尺单位 1in = 25.4 mm
- var inch = value / 25.4
- var c_value = inch * this.conversion_getDPI()[0]
- return c_value
- },
- indexToWords(index){
- let arr = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]
- return arr[index];
- },
- sectionToChinese(section) {
- let chnNumChar = ['', '一', '二', '三', '四', '五', '六', '七', '八', '九']
- let chnUnitChar = ['', '十', '百', '千']
- let strIns = '',chnStr = ''
- let unitPos = 0
- let zero = true
- let count = section
- while (section > 0) {
- var v = section % 10
- if (v === 0) {
- if (!zero) {
- zero = true
- chnStr = chnNumChar[v] + chnStr
- }
- } else {
- zero = false
- if(unitPos == 1 && parseInt(count/10) == 1){
- chnStr = chnUnitChar[unitPos] + chnNumChar[count%10]
- }else{
- strIns = chnNumChar[v]
- strIns += chnUnitChar[unitPos]
- chnStr = strIns + chnStr
- }
- }
- unitPos++
- section = Math.floor(section / 10)
- }
- return chnStr
- },
- }
|