Commit 61ed19e8 authored by 332784038@qq.com's avatar 332784038@qq.com

费用申请金额允许输入的小数点限制为2位数

parent 3f5d9139
......@@ -57,7 +57,7 @@
<template v-slot:default="scope">
<el-input
:disabled="!scope.row.editMode && !!scope.row.status"
v-model="scope.row.applicationFee" type="number"
v-model="scope.row.applicationFee" type="number" @input="formatAmount(scope.row)"
></el-input>
</template>
</el-table-column>
......@@ -283,6 +283,17 @@ export default {
});
},
methods: {
formatAmount(row) {
// 使用正则表达式限制输入为数字和小数点,并限制小数点后最多两位数字
// row.applicationFee = row.applicationFee.replace(/[^\d.]/g, '').replace(/(\..*)\./g, '$1');
if (row.applicationFee.indexOf('.') > -1) {
const decimalPart = row.applicationFee.split('.')[1];
if (decimalPart.length > 2) {
row.applicationFee = row.applicationFee.substring(0, row.applicationFee.length - (decimalPart.length - 2));
}
}
},
del(index) {
this.$confirm(this.$t("确定要删除此条费用申请么?")).then(() => {
this.list.splice(index, 1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment