|
|
|
@ -131,166 +131,171 @@
|
|
|
|
|
// size: 'small',
|
|
|
|
|
})
|
|
|
|
|
async function submit() {
|
|
|
|
|
let data = getFieldsValue2()
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
let data = getFieldsValue2()
|
|
|
|
|
console.log(data, 11111111111)
|
|
|
|
|
|
|
|
|
|
let SS = data.pkgs
|
|
|
|
|
if (SS) {
|
|
|
|
|
let GetStringNum = (str) => {
|
|
|
|
|
var num = 0
|
|
|
|
|
if (str == null || str == '') return num
|
|
|
|
|
if (str.length == 0) return num
|
|
|
|
|
var if_find = false
|
|
|
|
|
var str_num = ''
|
|
|
|
|
for (var i = 0; i < str.length; i += 1) {
|
|
|
|
|
var member = str.substr(i, 1)
|
|
|
|
|
if (
|
|
|
|
|
member == '0' ||
|
|
|
|
|
member == '1' ||
|
|
|
|
|
member == '2' ||
|
|
|
|
|
member == '3' ||
|
|
|
|
|
member == '4' ||
|
|
|
|
|
member == '5' ||
|
|
|
|
|
member == '6' ||
|
|
|
|
|
member == '7' ||
|
|
|
|
|
member == '8' ||
|
|
|
|
|
member == '9' ||
|
|
|
|
|
member == '.' ||
|
|
|
|
|
member == '-'
|
|
|
|
|
) {
|
|
|
|
|
if (!if_find) {
|
|
|
|
|
str_num = str_num + member
|
|
|
|
|
let SS = data.pkgs
|
|
|
|
|
if (SS) {
|
|
|
|
|
let GetStringNum = (str) => {
|
|
|
|
|
var num = 0
|
|
|
|
|
if (str == null || str == '') return num
|
|
|
|
|
if (str.length == 0) return num
|
|
|
|
|
var if_find = false
|
|
|
|
|
var str_num = ''
|
|
|
|
|
for (var i = 0; i < str.length; i += 1) {
|
|
|
|
|
var member = str.substr(i, 1)
|
|
|
|
|
if (
|
|
|
|
|
member == '0' ||
|
|
|
|
|
member == '1' ||
|
|
|
|
|
member == '2' ||
|
|
|
|
|
member == '3' ||
|
|
|
|
|
member == '4' ||
|
|
|
|
|
member == '5' ||
|
|
|
|
|
member == '6' ||
|
|
|
|
|
member == '7' ||
|
|
|
|
|
member == '8' ||
|
|
|
|
|
member == '9' ||
|
|
|
|
|
member == '.' ||
|
|
|
|
|
member == '-'
|
|
|
|
|
) {
|
|
|
|
|
if (!if_find) {
|
|
|
|
|
str_num = str_num + member
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if_find = true
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if_find = true
|
|
|
|
|
}
|
|
|
|
|
return str_num
|
|
|
|
|
}
|
|
|
|
|
return str_num
|
|
|
|
|
}
|
|
|
|
|
let ToEn = (a) => {
|
|
|
|
|
// eslint-disable-next-line no-array-constructor
|
|
|
|
|
const arr1 = new Array('', ' thousand', ' million', ' billion')
|
|
|
|
|
const b = a.length
|
|
|
|
|
let f: any = null
|
|
|
|
|
let h = 0
|
|
|
|
|
let g = ''
|
|
|
|
|
const e = Math.ceil(b / 3)
|
|
|
|
|
const k = b - e * 3
|
|
|
|
|
g = ''
|
|
|
|
|
for (f = k; f < b; f += 3) {
|
|
|
|
|
++h
|
|
|
|
|
// eslint-disable-next-line no-undef
|
|
|
|
|
const num3 = f >= 0 ? a.substring(f, f + 3) : a.substring(0, k + 3)
|
|
|
|
|
// eslint-disable-next-line no-undef
|
|
|
|
|
const strEng = English(num3)
|
|
|
|
|
// eslint-disable-next-line eqeqeq
|
|
|
|
|
if (strEng != '') {
|
|
|
|
|
let ToEn = (a) => {
|
|
|
|
|
// eslint-disable-next-line no-array-constructor
|
|
|
|
|
const arr1 = new Array('', ' thousand', ' million', ' billion')
|
|
|
|
|
const b = a.length
|
|
|
|
|
let f: any = null
|
|
|
|
|
let h = 0
|
|
|
|
|
let g = ''
|
|
|
|
|
const e = Math.ceil(b / 3)
|
|
|
|
|
const k = b - e * 3
|
|
|
|
|
g = ''
|
|
|
|
|
for (f = k; f < b; f += 3) {
|
|
|
|
|
++h
|
|
|
|
|
// eslint-disable-next-line no-undef
|
|
|
|
|
const num3 = f >= 0 ? a.substring(f, f + 3) : a.substring(0, k + 3)
|
|
|
|
|
// eslint-disable-next-line no-undef
|
|
|
|
|
const strEng = English(num3)
|
|
|
|
|
// eslint-disable-next-line eqeqeq
|
|
|
|
|
if (g != '') g += ' '
|
|
|
|
|
g += English(num3) + arr1[e - h]
|
|
|
|
|
if (strEng != '') {
|
|
|
|
|
// eslint-disable-next-line eqeqeq
|
|
|
|
|
if (g != '') g += ' '
|
|
|
|
|
g += English(num3) + arr1[e - h]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return g
|
|
|
|
|
}
|
|
|
|
|
return g
|
|
|
|
|
}
|
|
|
|
|
let English = (a) => {
|
|
|
|
|
// eslint-disable-next-line no-array-constructor
|
|
|
|
|
var arr2 = new Array(
|
|
|
|
|
'zero',
|
|
|
|
|
'ten',
|
|
|
|
|
'twenty',
|
|
|
|
|
'thirty',
|
|
|
|
|
'forty',
|
|
|
|
|
'fifty',
|
|
|
|
|
'sixty',
|
|
|
|
|
'seventy',
|
|
|
|
|
'eighty',
|
|
|
|
|
'ninety',
|
|
|
|
|
)
|
|
|
|
|
// eslint-disable-next-line no-array-constructor
|
|
|
|
|
var arr3 = new Array(
|
|
|
|
|
'zero',
|
|
|
|
|
'one',
|
|
|
|
|
'two',
|
|
|
|
|
'three',
|
|
|
|
|
'four',
|
|
|
|
|
'five',
|
|
|
|
|
'six',
|
|
|
|
|
'seven',
|
|
|
|
|
'eight',
|
|
|
|
|
'nine',
|
|
|
|
|
)
|
|
|
|
|
// eslint-disable-next-line no-array-constructor
|
|
|
|
|
var arr4 = new Array(
|
|
|
|
|
'ten',
|
|
|
|
|
'eleven',
|
|
|
|
|
'twelve',
|
|
|
|
|
'thirteen',
|
|
|
|
|
'fourteen',
|
|
|
|
|
'fifteen',
|
|
|
|
|
'sixteen',
|
|
|
|
|
'seventeen',
|
|
|
|
|
'eighteen',
|
|
|
|
|
'nineteen',
|
|
|
|
|
)
|
|
|
|
|
let English = (a) => {
|
|
|
|
|
// eslint-disable-next-line no-array-constructor
|
|
|
|
|
var arr2 = new Array(
|
|
|
|
|
'zero',
|
|
|
|
|
'ten',
|
|
|
|
|
'twenty',
|
|
|
|
|
'thirty',
|
|
|
|
|
'forty',
|
|
|
|
|
'fifty',
|
|
|
|
|
'sixty',
|
|
|
|
|
'seventy',
|
|
|
|
|
'eighty',
|
|
|
|
|
'ninety',
|
|
|
|
|
)
|
|
|
|
|
// eslint-disable-next-line no-array-constructor
|
|
|
|
|
var arr3 = new Array(
|
|
|
|
|
'zero',
|
|
|
|
|
'one',
|
|
|
|
|
'two',
|
|
|
|
|
'three',
|
|
|
|
|
'four',
|
|
|
|
|
'five',
|
|
|
|
|
'six',
|
|
|
|
|
'seven',
|
|
|
|
|
'eight',
|
|
|
|
|
'nine',
|
|
|
|
|
)
|
|
|
|
|
// eslint-disable-next-line no-array-constructor
|
|
|
|
|
var arr4 = new Array(
|
|
|
|
|
'ten',
|
|
|
|
|
'eleven',
|
|
|
|
|
'twelve',
|
|
|
|
|
'thirteen',
|
|
|
|
|
'fourteen',
|
|
|
|
|
'fifteen',
|
|
|
|
|
'sixteen',
|
|
|
|
|
'seventeen',
|
|
|
|
|
'eighteen',
|
|
|
|
|
'nineteen',
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
let strRet = ''
|
|
|
|
|
// eslint-disable-next-line eqeqeq
|
|
|
|
|
if (a.length == 3 && a.substr(0, 3) != '000') {
|
|
|
|
|
if (a.substr(0, 1) != '0') {
|
|
|
|
|
strRet += arr3[a.substr(0, 1)] + ' hundred'
|
|
|
|
|
if (a.substr(1, 2) != '00') strRet += ' and '
|
|
|
|
|
} else {
|
|
|
|
|
strRet += ' and '
|
|
|
|
|
}
|
|
|
|
|
a = a.substring(1)
|
|
|
|
|
}
|
|
|
|
|
if (a.length == 2) {
|
|
|
|
|
if (a.substr(0, 1) == '0') a = a.substring(1)
|
|
|
|
|
else if (a.substr(0, 1) == '1') strRet += arr4[a.substr(1, 2)]
|
|
|
|
|
else {
|
|
|
|
|
strRet += arr2[a.substr(0, 1)]
|
|
|
|
|
if (a.substr(1, 1) != '0') strRet += '-'
|
|
|
|
|
let strRet = ''
|
|
|
|
|
// eslint-disable-next-line eqeqeq
|
|
|
|
|
if (a.length == 3 && a.substr(0, 3) != '000') {
|
|
|
|
|
if (a.substr(0, 1) != '0') {
|
|
|
|
|
strRet += arr3[a.substr(0, 1)] + ' hundred'
|
|
|
|
|
if (a.substr(1, 2) != '00') strRet += ' and '
|
|
|
|
|
} else {
|
|
|
|
|
strRet += ' and '
|
|
|
|
|
}
|
|
|
|
|
a = a.substring(1)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (a.length == 1 && a.substr(0, 1) != '0') strRet += arr3[a.substr(0, 1)]
|
|
|
|
|
return strRet
|
|
|
|
|
}
|
|
|
|
|
SS = SS.toString()
|
|
|
|
|
const i = SS.indexOf('\n')
|
|
|
|
|
let num = 0
|
|
|
|
|
let strKind: any = ''
|
|
|
|
|
let enCapital = ''
|
|
|
|
|
if (i > 0) {
|
|
|
|
|
const slist = SS.split('\n')
|
|
|
|
|
for (let i = 0; i < slist.length; i += 1) {
|
|
|
|
|
const member = slist[i]
|
|
|
|
|
const strNum: any = GetStringNum(member)
|
|
|
|
|
if (i == 0) {
|
|
|
|
|
strKind = member.substring(strNum.length)
|
|
|
|
|
if (a.length == 2) {
|
|
|
|
|
if (a.substr(0, 1) == '0') a = a.substring(1)
|
|
|
|
|
else if (a.substr(0, 1) == '1') strRet += arr4[a.substr(1, 2)]
|
|
|
|
|
else {
|
|
|
|
|
strRet += arr2[a.substr(0, 1)]
|
|
|
|
|
if (a.substr(1, 1) != '0') strRet += '-'
|
|
|
|
|
a = a.substring(1)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
num = parseFloat(num).add(parseFloat(strNum))
|
|
|
|
|
if (a.length == 1 && a.substr(0, 1) != '0') strRet += arr3[a.substr(0, 1)]
|
|
|
|
|
return strRet
|
|
|
|
|
}
|
|
|
|
|
SS = SS.toString()
|
|
|
|
|
const i = SS.indexOf('\n')
|
|
|
|
|
let num = 0
|
|
|
|
|
let strKind: any = ''
|
|
|
|
|
let enCapital = ''
|
|
|
|
|
if (i > 0) {
|
|
|
|
|
const slist = SS.split('\n')
|
|
|
|
|
for (let i = 0; i < slist.length; i += 1) {
|
|
|
|
|
const member = slist[i]
|
|
|
|
|
const strNum: any = GetStringNum(member)
|
|
|
|
|
if (i == 0) {
|
|
|
|
|
strKind = member.substring(strNum.length)
|
|
|
|
|
}
|
|
|
|
|
num = parseFloat(num).add(parseFloat(strNum))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (strKind !== '') {
|
|
|
|
|
enCapital = strKind
|
|
|
|
|
if (strKind !== '') {
|
|
|
|
|
enCapital = strKind
|
|
|
|
|
} else {
|
|
|
|
|
strKind = data.kindPkgsName ? data.kindPkgsName : ''
|
|
|
|
|
enCapital = ToEn(num).toUpperCase() + ' ' + strKind + ' ONLY.'
|
|
|
|
|
}
|
|
|
|
|
console.log(strKind, 1)
|
|
|
|
|
} else {
|
|
|
|
|
strKind = data.kindPkgsName ? data.kindPkgsName : ''
|
|
|
|
|
enCapital = ToEn(num).toUpperCase() + ' ' + strKind + ' ONLY.'
|
|
|
|
|
const strNum: any = GetStringNum(SS)
|
|
|
|
|
strKind = SS.substring(strNum.length) ? SS.substring(strNum.length) : ''
|
|
|
|
|
if (strKind !== '') {
|
|
|
|
|
enCapital = strKind
|
|
|
|
|
} else {
|
|
|
|
|
strKind = data.kindPkgsName ? data.kindPkgsName : ''
|
|
|
|
|
enCapital = 'SAY:' + ToEn(strNum).toUpperCase() + ' ' + strKind + ' ONLY.'
|
|
|
|
|
}
|
|
|
|
|
console.log(strKind, 2)
|
|
|
|
|
}
|
|
|
|
|
setFieldsValue4({ totalNo: enCapital })
|
|
|
|
|
} else {
|
|
|
|
|
const strNum: any = GetStringNum(SS)
|
|
|
|
|
strKind = SS.substring(strNum.length) ? SS.substring(strNum.length) : ''
|
|
|
|
|
if (strKind !== '') {
|
|
|
|
|
enCapital = strKind
|
|
|
|
|
} else {
|
|
|
|
|
strKind = data.kindPkgsName ? data.kindPkgsName : ''
|
|
|
|
|
enCapital = 'SAY:' + ToEn(strNum).toUpperCase() + ' ' + strKind + ' ONLY.'
|
|
|
|
|
}
|
|
|
|
|
setFieldsValue4({ totalNo: '' })
|
|
|
|
|
}
|
|
|
|
|
setFieldsValue4({ totalNo: enCapital })
|
|
|
|
|
} else {
|
|
|
|
|
setFieldsValue4({ totalNo: '' })
|
|
|
|
|
}
|
|
|
|
|
}, 0)
|
|
|
|
|
}
|
|
|
|
|
const [
|
|
|
|
|
registerForm4,
|
|
|
|
|