diff --git a/src/views/inStorage/inspectionGoods/inspectionGoodsAdd.vue b/src/views/inStorage/inspectionGoods/inspectionGoodsAdd.vue index 7d8392a..25527d4 100644 --- a/src/views/inStorage/inspectionGoods/inspectionGoodsAdd.vue +++ b/src/views/inStorage/inspectionGoods/inspectionGoodsAdd.vue @@ -85,7 +85,7 @@ diff --git a/src/views/inStorage/receivingGoods/inStorageAdd.vue b/src/views/inStorage/receivingGoods/inStorageAdd.vue index 097b5ec..fb79863 100644 --- a/src/views/inStorage/receivingGoods/inStorageAdd.vue +++ b/src/views/inStorage/receivingGoods/inStorageAdd.vue @@ -62,7 +62,8 @@ diff --git a/src/views/outStorage/alreadyOutStorage/index.vue b/src/views/outStorage/alreadyOutStorage/index.vue index b438f13..4b047ff 100644 --- a/src/views/outStorage/alreadyOutStorage/index.vue +++ b/src/views/outStorage/alreadyOutStorage/index.vue @@ -345,7 +345,7 @@ diff --git a/src/views/outStorage/toAllocated/index.vue b/src/views/outStorage/toAllocated/index.vue index 0a9e374..602f26a 100644 --- a/src/views/outStorage/toAllocated/index.vue +++ b/src/views/outStorage/toAllocated/index.vue @@ -344,7 +344,7 @@ diff --git a/src/views/outStorage/toOutStorage/index.vue b/src/views/outStorage/toOutStorage/index.vue index 9386600..b1bab92 100644 --- a/src/views/outStorage/toOutStorage/index.vue +++ b/src/views/outStorage/toOutStorage/index.vue @@ -345,7 +345,7 @@ diff --git a/src/views/outStorage/zeroPicking/index.vue b/src/views/outStorage/zeroPicking/index.vue index 13fd156..0ffaa6b 100644 --- a/src/views/outStorage/zeroPicking/index.vue +++ b/src/views/outStorage/zeroPicking/index.vue @@ -345,7 +345,7 @@ diff --git a/src/views/storage/inventoryAdjust/inventoryAdjust/inventoryAdjustAdd.vue b/src/views/storage/inventoryAdjust/inventoryAdjust/inventoryAdjustAdd.vue index b9fc22d..159b217 100644 --- a/src/views/storage/inventoryAdjust/inventoryAdjust/inventoryAdjustAdd.vue +++ b/src/views/storage/inventoryAdjust/inventoryAdjust/inventoryAdjustAdd.vue @@ -197,13 +197,20 @@ } }) }, - getNumber(val, limit) { - val = val.replace(/[^0-9-]/g, '') // 保留数字 - val = val.replace(/^00/, '0') // 开头不能有两个0 - val = val.replace(/\-{2,}/g, "-"); // -只能保留一个 - val = val.replace(/(\d)\-/g, "$1"); // 数字后面不能接-,不能出现类似-11-2,12-,11-23 - val = val.replace(/(-)0+/g, "$1"); // 不能出现-0,-001,-0001类似 - return val + getNumber(e, limit) { + let value = e.replace(/[^\-\d.]/g, '') // 只能输入.和-和数字 + value = value.replace(/^\./g, '') //第一个字符不能是. + value = value.replace(/\.{2,}/g, '.') // 不能连续输入. + value = value.replace(/(\.\d+)\./g, '$1') // .后面不能再输入. + value = value.replace(/(-)\./g, '$1') // -后面不能输入. + value = value.replace(/\-{2,}/g, '-') // -只能保留一个 + value = value.replace(/(\d+|\.)-/g, '$1') // 数字和.后面不能接-,不能出现类似11-, 12.- + value = value.replace(/-(0){2,}/g, "$1") // 不能出现-00,-001,-0001类似 + value = value.replace(/(-)0+(\d+)/g, '$1$2') // 不能出现-01,-02类似 + value = value.replace(/^0+(\d)/, '$1') // 第一位0开头,0后面为数字,则过滤掉,取后面的数字 + value = value.replace(/(\d{15})\d*/, '$1') // 最多保留15位整数 + value = value.replace(/(\.\d{2})\d*/, '$1') // 最多保留2位小数 + return value }, showAdd() { this.viewTitle = '【新增】调整单' diff --git a/src/views/storage/inventoryAdjust/inventoryDifferential/inventoryDifferential.vue b/src/views/storage/inventoryAdjust/inventoryDifferential/inventoryDifferential.vue index b09a12f..74c4330 100644 --- a/src/views/storage/inventoryAdjust/inventoryDifferential/inventoryDifferential.vue +++ b/src/views/storage/inventoryAdjust/inventoryDifferential/inventoryDifferential.vue @@ -229,12 +229,19 @@ }, getNumber(val, limit) { - val = val.replace(/[^0-9-]/g, '') // 保留数字 - val = val.replace(/^00/, '0') // 开头不能有两个0 - val = val.replace(/\-{2,}/g, "-"); // -只能保留一个 - val = val.replace(/(\d)\-/g, "$1"); // 数字后面不能接-,不能出现类似-11-2,12-,11-23 - val = val.replace(/(-)0+/g, "$1"); // 不能出现-0,-001,-0001类似 - return val + let value = val.replace(/[^\-\d.]/g, '') // 只能输入.和-和数字 + value = value.replace(/^\./g, '') //第一个字符不能是. + value = value.replace(/\.{2,}/g, '.') // 不能连续输入. + value = value.replace(/(\.\d+)\./g, '$1') // .后面不能再输入. + value = value.replace(/(-)\./g, '$1') // -后面不能输入. + value = value.replace(/\-{2,}/g, '-') // -只能保留一个 + value = value.replace(/(\d+|\.)-/g, '$1') // 数字和.后面不能接-,不能出现类似11-, 12.- + value = value.replace(/-(0){2,}/g, "$1") // 不能出现-00,-001,-0001类似 + value = value.replace(/(-)0+(\d+)/g, '$1$2') // 不能出现-01,-02类似 + value = value.replace(/^0+(\d)/, '$1') // 第一位0开头,0后面为数字,则过滤掉,取后面的数字 + value = value.replace(/(\d{15})\d*/, '$1') // 最多保留15位整数 + value = value.replace(/(\.\d{2})\d*/, '$1') // 最多保留2位小数 + return value }, // 搜索条件效果 clicksearchShow() { diff --git a/src/views/storage/inventoryWarning/regionalWarning/regionalWarning.vue b/src/views/storage/inventoryWarning/regionalWarning/regionalWarning.vue index 41348d4..d9d4c61 100644 --- a/src/views/storage/inventoryWarning/regionalWarning/regionalWarning.vue +++ b/src/views/storage/inventoryWarning/regionalWarning/regionalWarning.vue @@ -79,14 +79,17 @@ @@ -120,13 +123,13 @@
* 可用上限
+ oninput="value=value.replace(/[^\d.]/g, '').replace(/\.{2,}/g, '.').replace('.', '$#$').replace(/\./g, '').replace('$#$', '.').replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3').replace(/^\./g, '')" />
* 可用下限
+ oninput="value=value.replace(/[^\d.]/g, '').replace(/\.{2,}/g, '.').replace('.', '$#$').replace(/\./g, '').replace('$#$', '.').replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3').replace(/^\./g, '')" />