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