|
|
@@ -116,7 +116,7 @@
|
|
|
<template #default="scope">
|
|
|
<span
|
|
|
v-if="scope.row.surplusNumber !== undefined && scope.row.surplusNumber !== null && scope.row.spec !== undefined && scope.row.spec !== null">
|
|
|
- {{ parseInt(scope.row.spec) * parseFloat(scope.row.surplusNumber) }}
|
|
|
+ {{ scope.row.surplusNumber }}
|
|
|
</span>
|
|
|
<span v-else>
|
|
|
{{ scope.row.surplusNumber }}
|
|
|
@@ -129,6 +129,7 @@
|
|
|
<!-- <el-input @change="changeValue" v-model="scope.row.tradeNumber" oninput ="value=value.replace(/\D|^0/g,'')" maxlength="10"></el-input>-->
|
|
|
<!-- <el-input @change="changeValue" v-model="scope.row.tradeNumber" @blur="scope.row.tradeNumber = twoDecimalPlaces2(scope.row.tradeNumber)" maxlength="10"></el-input>-->
|
|
|
<el-input v-model="scope.row.collectNumber"
|
|
|
+ @input="scope.row.collectNumber = twoDecimalPlaces2($event)"
|
|
|
@blur="scope.row.collectNumber = twoDecimalPlaces2(scope.row.collectNumber)"
|
|
|
maxlength="10"></el-input>
|
|
|
</template>
|
|
|
@@ -228,7 +229,7 @@
|
|
|
<template #default="scope">
|
|
|
<span
|
|
|
v-if="scope.row.surplusNumber !== undefined && scope.row.surplusNumber !== null && scope.row.spec !== undefined && scope.row.spec !== null">
|
|
|
- {{ parseInt(scope.row.spec) * parseFloat(scope.row.surplusNumber) }}
|
|
|
+ {{ scope.row.surplusNumber }}
|
|
|
</span>
|
|
|
<span v-else>
|
|
|
{{ scope.row.surplusNumber }}
|
|
|
@@ -689,6 +690,11 @@ export default {
|
|
|
this.loading = false
|
|
|
return
|
|
|
}
|
|
|
+ if (!/^[1-9]\d*(?:\.0+)?$/.test(String(this.inputForm.detailInfos[j].collectNumber))) {
|
|
|
+ this.$message.error('领用详情第' + k + '行领用数量请输入正整数')
|
|
|
+ this.loading = false
|
|
|
+ return
|
|
|
+ }
|
|
|
|
|
|
if (parseFloat(this.inputForm.detailInfos[j].collectNumber) > parseFloat(this.inputForm.detailInfos[j].surplusNumber)) {
|
|
|
this.$message.error('领用详情第' + k + '行领用数量不能大于库存数量')
|
|
|
@@ -728,6 +734,33 @@ export default {
|
|
|
if (this.commonJS.isEmpty(this.inputForm.files)) {
|
|
|
this.inputForm.files = []
|
|
|
}
|
|
|
+
|
|
|
+ let i = this.inputForm.detailInfos.length
|
|
|
+ for (let j = 0; j < i; j++) {
|
|
|
+ let k = j + 1
|
|
|
+ if (this.commonJS.isEmpty(this.inputForm.detailInfos[j].collectType)) {
|
|
|
+ this.$message.error('领用详情第' + k + '行请选择商品')
|
|
|
+ this.loading = false
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (this.commonJS.isEmpty(this.inputForm.detailInfos[j].collectNumber)) {
|
|
|
+ this.$message.error('领用详情第' + k + '行请输入领用数量')
|
|
|
+ this.loading = false
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (!/^[1-9]\d*(?:\.0+)?$/.test(String(this.inputForm.detailInfos[j].collectNumber))) {
|
|
|
+ this.$message.error('领用详情第' + k + '行领用数量请输入正整数')
|
|
|
+ this.loading = false
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if (parseFloat(this.inputForm.detailInfos[j].collectNumber) > parseFloat(this.inputForm.detailInfos[j].surplusNumber)) {
|
|
|
+ this.$message.error('领用详情第' + k + '行领用数量不能大于库存数量')
|
|
|
+ this.loading = false
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
this.inputForm.files = this.$refs.uploadComponent.getDataList()
|
|
|
this.commonApi.getTaskNameByProcInsId(this.inputForm.procInsId).then((data) => {
|
|
|
if (this.commonJS.isNotEmpty(data)) {
|
|
|
@@ -846,31 +879,23 @@ export default {
|
|
|
// this.inputForm.detailInfos[index].priceSum = str.replace(/[^\d^\.]+/g, '') // 保留数字和小数点
|
|
|
// },
|
|
|
twoDecimalPlaces2(num) {
|
|
|
- let str = num.toString()
|
|
|
- var len1 = str.substr(0, 1)
|
|
|
- var len2 = str.substr(1, 1)
|
|
|
- // eslint-disable-next-line eqeqeq
|
|
|
- if (str.length > 1 && len1 == 0 && len2 != '.') {
|
|
|
- str = str.substr(1, 1)
|
|
|
+ if (this.commonJS.isEmpty(num)) {
|
|
|
+ return ''
|
|
|
}
|
|
|
- // eslint-disable-next-line eqeqeq
|
|
|
- if (len1 == '.') {
|
|
|
- str = ''
|
|
|
+ let str = String(num).replace(/[^\d.]/g, '')
|
|
|
+ if (str.endsWith('.')) {
|
|
|
+ return ''
|
|
|
}
|
|
|
- // eslint-disable-next-line eqeqeq
|
|
|
- if (str.indexOf('.') != -1) {
|
|
|
- var str_ = str.substr(str.indexOf('.') + 1)
|
|
|
- // eslint-disable-next-line eqeqeq
|
|
|
- if (str_.indexOf('.') != -1) {
|
|
|
- str = str.substr(0, str.indexOf('.') + str_.indexOf('.') + 1)
|
|
|
- }
|
|
|
- if (str_.length > 2) {
|
|
|
- this.$message.warning(`领用数量小数点后只能输入两位,请正确输入!`)
|
|
|
- return (str = '')
|
|
|
- }
|
|
|
+ const dotIndex = str.indexOf('.')
|
|
|
+ if (dotIndex !== -1) {
|
|
|
+ const integerPart = str.substring(0, dotIndex)
|
|
|
+ const decimalPart = str.substring(dotIndex + 1).replace(/\./g, '').replace(/[1-9]/g, '')
|
|
|
+ str = integerPart + '.' + decimalPart
|
|
|
+ }
|
|
|
+ str = str.replace(/^0+(\d)/, '$1')
|
|
|
+ if (str === '.') {
|
|
|
+ return ''
|
|
|
}
|
|
|
- // eslint-disable-next-line no-useless-escape
|
|
|
- str = str.replace(/[^\d^\.]+/g, '') // 保留数字和小数点
|
|
|
return str
|
|
|
},
|
|
|
countAmount(row) {
|