| | |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="数量" prop="number"> |
| | | <el-input |
| | | <el-input-number :step="0.01" :min="0" style="width: 100%" |
| | | v-model="form.number" |
| | | placeholder="请输入数量" |
| | | type="number" |
| | | @change="mathNum" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="含税单价" prop="taxIncludingPriceUnit"> |
| | | <el-input |
| | | <el-input-number :step="0.01" :min="0" style="width: 100%" |
| | | v-model="form.taxIncludingPriceUnit" |
| | | placeholder="请输入含税单价" |
| | | type="number" |
| | | maxlength="10" |
| | | @change="mathNum" |
| | | @input="handleNumberInput" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | |
| | | } |
| | | }; |
| | | |
| | | const handleNumberInput = (value) => { |
| | | // 移除所有非数字字符 |
| | | let num = value.replace(/[^\d.]/g, ""); |
| | | |
| | | // 限制长度为10 |
| | | if (num.length > 10) { |
| | | num = num.slice(0, 10); |
| | | } |
| | | |
| | | // 更新值 |
| | | form.taxIncludingPriceUnit = num; |
| | | }; |
| | | |
| | | defineExpose({ |
| | | form, |
| | | loadForm, |
| | | resetForm, |
| | | }); |
| | | </script> |