diff --git a/yxt-as-ui/src/views/purchase/procurement/procurementAdd.vue b/yxt-as-ui/src/views/purchase/procurement/procurementAdd.vue
index de13c1712d..dd78c9e356 100644
--- a/yxt-as-ui/src/views/purchase/procurement/procurementAdd.vue
+++ b/yxt-as-ui/src/views/purchase/procurement/procurementAdd.vue
@@ -243,7 +243,7 @@
应付金额:
- {{ yfTotal }} = 采购金额:{{ cgTotal }} + 运费: - 优惠: + 误差调整:
+ {{ yfTotal }} = 采购金额:{{ cgTotal }} + 运费: - 优惠: + 误差调整:
@@ -511,6 +511,29 @@ export default {
}
return val
},
+ inputByAstrict(val, limit) {
+ let value = val.replace(/[^\-\d.]/g, '') // 只能输入'.'和'-'及数字
+ value = value.replace(/^\./g, '') // 第一个字符不能是'.'
+ value = value.replace(/\.{2,}/g, '.') // 不能连续输入'.'
+ value = value.replace(/(\.\d+)\./g, '$1') // '.'后面不能在输入'0'
+ value = value.replace(/(-)\./g, '$1') // '-'后面不能输入'.'
+ value = value.replace(/\-{2,}/g, '-') // 只保留一个'-'
+ value = value.replace(/(\d+|\.)-/g, '$1') // 数字和'.'后面不能跟'-', 例如11- 或 11.-
+ 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后面为数字,则过滤掉0, 取后面的数字
+ value = value.replace(/(\d{15})\d*/, '$1') // 最多保留15整数
+ const str = '^(\\d+)\\.(\\d{' + limit + '}).*$'
+ const reg = new RegExp(str)
+ if (limit === 0) {
+ // 不需要小数点
+ value = value.replace(reg, '$1')
+ } else {
+ // 通过正则保留小数点后指定的位数
+ value = value.replace(reg, '$1.$2')
+ }
+ return value
+ },
purchaseTypeChange(value) {
const choose = this.procurementType_list.filter((item) => item.dictValue === value)
if (choose !== null && choose.length > 0) {
diff --git a/yxt-as-ui/src/views/workFlow/caigouFlow/procurementEdit.vue b/yxt-as-ui/src/views/workFlow/caigouFlow/procurementEdit.vue
index b63da66b25..f020b952b2 100644
--- a/yxt-as-ui/src/views/workFlow/caigouFlow/procurementEdit.vue
+++ b/yxt-as-ui/src/views/workFlow/caigouFlow/procurementEdit.vue
@@ -242,7 +242,7 @@
应付金额:
- {{ yfTotal }} = 采购金额:{{ cgTotal }} + 运费: - 优惠: + 误差调整:
+ {{ yfTotal }} = 采购金额:{{ cgTotal }} + 运费: - 优惠: + 误差调整:
@@ -502,6 +502,29 @@ export default {
}
return val
},
+ inputByAstrict(val, limit) {
+ let value = val.replace(/[^\-\d.]/g, '') // 只能输入'.'和'-'及数字
+ value = value.replace(/^\./g, '') // 第一个字符不能是'.'
+ value = value.replace(/\.{2,}/g, '.') // 不能连续输入'.'
+ value = value.replace(/(\.\d+)\./g, '$1') // '.'后面不能在输入'0'
+ value = value.replace(/(-)\./g, '$1') // '-'后面不能输入'.'
+ value = value.replace(/\-{2,}/g, '-') // 只保留一个'-'
+ value = value.replace(/(\d+|\.)-/g, '$1') // 数字和'.'后面不能跟'-', 例如11- 或 11.-
+ 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后面为数字,则过滤掉0, 取后面的数字
+ value = value.replace(/(\d{15})\d*/, '$1') // 最多保留15整数
+ const str = '^(\\d+)\\.(\\d{' + limit + '}).*$'
+ const reg = new RegExp(str)
+ if (limit === 0) {
+ // 不需要小数点
+ value = value.replace(reg, '$1')
+ } else {
+ // 通过正则保留小数点后指定的位数
+ value = value.replace(reg, '$1.$2')
+ }
+ return value
+ },
purchaseTypeChange(value) {
const choose = this.procurementType_list.filter((item) => item.dictValue === value)
if (choose !== null && choose.length > 0) {