Browse Source

feat:[模板管理][暂存]

ouqian
luojie 1 month ago
parent
commit
9157982490
1 changed files with 1 additions and 43 deletions
  1. +1
    -43
      src/components/Template/DecimalInput.vue

+ 1
- 43
src/components/Template/DecimalInput.vue View File

@ -44,16 +44,7 @@ export default {
if (newVal === '' || newVal == null) {
this.internalValue = '';
} else {
// "NA" "20/30/40"
if ((this.internalValue && this.internalValue.toUpperCase() === 'NA') || (this.internalValue && /^\d+(\/\d+)*$/.test(this.internalValue))) {
return;
}
// "NA" "20/30/40"
if (String(newVal).toUpperCase() === 'NA' || /^[Nn]?[Aa]?$/.test(String(newVal)) || /^\d+(\/\d*)*$/.test(String(newVal))) {
this.internalValue = String(newVal);
} else {
this.internalValue = this.handleDecimalDigits(String(newVal));
}
this.internalValue = this.handleDecimalDigits(String(newVal));
}
}
},
@ -65,27 +56,6 @@ export default {
return;
}
// "NA"
if (val.toUpperCase() === 'NA' || /^[Nn]?[Aa]?$/.test(val)) {
this.internalValue = val;
this.$emit('input', val);
return;
}
// "20/30/40"
if (/^\d+(\/\d*)*$/.test(val)) {
this.internalValue = val;
this.$emit('input', val);
return;
}
// "NA" "20/30/40"
if ((this.internalValue && this.internalValue.toUpperCase() === 'NA') || (this.internalValue && /^\d+(\/\d+)*$/.test(this.internalValue))) {
//
this.$emit('input', this.internalValue);
return;
}
// 1.
let cleaned = val
.replace(/[^\d.-]/g, '')
@ -150,11 +120,6 @@ export default {
const actVal = val || this.internalValue;
let finalValue = actVal.trim();
// "NA" "20/30/40"
if (finalValue.toUpperCase() === 'NA' || /^\d+(\/\d+)+$/.test(finalValue)) {
return finalValue;
}
if (finalValue === '' || finalValue === '-') {
this.internalValue = '';
this.$emit('input', '');
@ -185,13 +150,6 @@ export default {
},
handleBlur() {
// "NA" "20/30/40"
if ((this.internalValue && this.internalValue.toUpperCase() === 'NA') || (this.internalValue && /^\d+(\/\d+)*$/.test(this.internalValue))) {
this.$emit('input', this.internalValue);
this.$emit('blur', this.internalValue);
return;
}
let formatted = this.handleDecimalDigits(this.internalValue);
this.internalValue = formatted;
// emit emit

Loading…
Cancel
Save