|
@@ -272,7 +272,11 @@
|
|
|
|
|
|
|
|
<el-col :span="8">
|
|
<el-col :span="8">
|
|
|
<el-form-item label="面积" prop="area">
|
|
<el-form-item label="面积" prop="area">
|
|
|
- <el-input v-model="form.area" :disabled="isReadOnly" />
|
|
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="form.area"
|
|
|
|
|
+ @input="handleAreaInput"
|
|
|
|
|
+ :disabled="isReadOnly"
|
|
|
|
|
+ />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
|
|
|
|
@@ -355,10 +359,10 @@
|
|
|
<div class="form-line">
|
|
<div class="form-line">
|
|
|
<el-input
|
|
<el-input
|
|
|
v-model="form.volume"
|
|
v-model="form.volume"
|
|
|
|
|
+ @input="handleInput"
|
|
|
style="width: calc(100% - 100px)"
|
|
style="width: calc(100% - 100px)"
|
|
|
:disabled="isReadOnly"
|
|
:disabled="isReadOnly"
|
|
|
/>
|
|
/>
|
|
|
- <!-- @input="handleInput1" -->
|
|
|
|
|
<DictSelection
|
|
<DictSelection
|
|
|
dictName="体积单位"
|
|
dictName="体积单位"
|
|
|
clearable
|
|
clearable
|
|
@@ -1236,14 +1240,42 @@
|
|
|
changeMeasureType() {
|
|
changeMeasureType() {
|
|
|
this.setNetWeight();
|
|
this.setNetWeight();
|
|
|
},
|
|
},
|
|
|
|
|
+ sanitizePositiveDecimalInput(value) {
|
|
|
|
|
+ if (value === null || value === undefined) return '';
|
|
|
|
|
+
|
|
|
|
|
+ const filteredValue = String(value).replace(/[^0-9.]/g, '');
|
|
|
|
|
+ if (!filteredValue) return '';
|
|
|
|
|
+
|
|
|
|
|
+ const [integerPart, ...decimalParts] = filteredValue.split('.');
|
|
|
|
|
+ if (!decimalParts.length) {
|
|
|
|
|
+ return integerPart;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return `${integerPart || '0'}.${decimalParts.join('')}`;
|
|
|
|
|
+ },
|
|
|
|
|
+ normalizeDecimalFields() {
|
|
|
|
|
+ ['area', 'roughWeight', 'netWeight', 'volume'].forEach((field) => {
|
|
|
|
|
+ const value = this.sanitizePositiveDecimalInput(this.form[field]);
|
|
|
|
|
+ this.$set(
|
|
|
|
|
+ this.form,
|
|
|
|
|
+ field,
|
|
|
|
|
+ value.endsWith('.') ? value.slice(0, -1) : value
|
|
|
|
|
+ );
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ handleAreaInput(value) {
|
|
|
|
|
+ this.form.area = this.sanitizePositiveDecimalInput(value);
|
|
|
|
|
+ },
|
|
|
handleInput(value) {
|
|
handleInput(value) {
|
|
|
- // this.form.volume = this.$handleInputPublicHasPoint(value);
|
|
|
|
|
|
|
+ this.form.volume = this.sanitizePositiveDecimalInput(value);
|
|
|
},
|
|
},
|
|
|
handleInput2(value) {
|
|
handleInput2(value) {
|
|
|
- this.form.roughWeight = this.$handleInputPublicHasPoint(value);
|
|
|
|
|
|
|
+ this.form.roughWeight = this.sanitizePositiveDecimalInput(value);
|
|
|
},
|
|
},
|
|
|
handleInput3(value) {
|
|
handleInput3(value) {
|
|
|
- // this.form.netWeight = this.$handleInputPublicHasPoint(value);
|
|
|
|
|
|
|
+ this.form.netWeight = this.sanitizePositiveDecimalInput(
|
|
|
|
|
+ value === undefined ? this.form.netWeight : value
|
|
|
|
|
+ );
|
|
|
if (this.form.weightUnit == this.form.measuringUnit) {
|
|
if (this.form.weightUnit == this.form.measuringUnit) {
|
|
|
this.$refs.warehouseRefs.changeNetWeight(this.form.netWeight);
|
|
this.$refs.warehouseRefs.changeNetWeight(this.form.netWeight);
|
|
|
}
|
|
}
|
|
@@ -1665,6 +1697,7 @@
|
|
|
|
|
|
|
|
// 保存
|
|
// 保存
|
|
|
submit() {
|
|
submit() {
|
|
|
|
|
+ this.normalizeDecimalFields();
|
|
|
this.$refs.manageForm.validate(async (valid) => {
|
|
this.$refs.manageForm.validate(async (valid) => {
|
|
|
console.log(this.$refs.qualityRefs);
|
|
console.log(this.$refs.qualityRefs);
|
|
|
|
|
|