Browse Source

验车

master
Zhao Qiqi 3 years ago
parent
commit
40ef38c045
  1. 20
      anrui-scm/anrui-scm-ui/src/views/supplychain/yancheguanli/yancheguanliAdd.vue

20
anrui-scm/anrui-scm-ui/src/views/supplychain/yancheguanli/yancheguanliAdd.vue

@ -55,6 +55,7 @@
placeholder="请输入洗车费"
class="addinputw"
clearable
@keyup.native="temp.price = oninput(temp.price,2)"
/>
</el-form-item>
</el-col>
@ -135,6 +136,25 @@ export default {
}
},
methods: {
//
oninput(val, limit = 0) {
val = val.replace(/[^\d.]/g, '') //
val = val.replace(/^00/, '0.') //0
val = val.replace(/^\./g, '0.') //0.
val = val.replace(/\.{2,}/g, '.') //
val = val.replace('.', '$#$').replace(/\./g, '').replace('$#$', '.'); //
/^0\d+/.test(val) ? val = val.slice(1) : '' //0
const str = '^(\\d+)\\.(\\d{' + limit + '}).*$'
const reg = new RegExp(str)
if (limit === 0) {
//
val = val.replace(reg, '$1')
} else {
//
val = val.replace(reg, '$1.$2')
}
return val
},
showAdd(row) {
this.$nextTick(() => {
this.$refs['dataForm'].clearValidate()

Loading…
Cancel
Save