|
|
@@ -17,7 +17,11 @@
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="计划回款金额" prop="planAmount">
|
|
|
- <el-input v-model.number="editForm.planAmount" clearable placeholder="请输入计划回款金额" />
|
|
|
+ <el-input
|
|
|
+ v-model="editForm.planAmount"
|
|
|
+ clearable
|
|
|
+ placeholder="请输入计划回款金额"
|
|
|
+ @input="formatNum(editForm.planAmount, 'planAmount')" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
@@ -101,6 +105,16 @@
|
|
|
},
|
|
|
mounted() {},
|
|
|
methods: {
|
|
|
+ formatNum(val, key) {
|
|
|
+ let temp = val.toString()
|
|
|
+ temp = temp.replace(/。/g, '.')
|
|
|
+ temp = temp.replace(/[^\d.]/g, '') //清除"数字"和"."以外的字符
|
|
|
+ temp = temp.replace(/^\./g, '') //验证第一个字符是数字
|
|
|
+ temp = temp.replace(/\.{2,}/g, '') //只保留第一个, 清除多余的
|
|
|
+ temp = temp.replace('.', '$#$').replace(/\./g, '').replace('$#$', '.')
|
|
|
+ temp = temp.replace(/^(-)*(\d+)\.(\d\d).*$/, '$1$2.$3') //只能输入两个小数
|
|
|
+ this.editForm[key] = temp
|
|
|
+ },
|
|
|
async init(id) {
|
|
|
if (!id) {
|
|
|
this.title = '新建回款计划'
|