基本配置修改 优化
This commit is contained in:
parent
aa81840f1c
commit
f214efc8f7
|
|
@ -85,11 +85,23 @@
|
|||
<el-table-column label="计量单位" align="center" prop="unitName" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="货品规格" align="center" prop="size" :show-overflow-tooltip="true">
|
||||
</el-table-column>
|
||||
<el-table-column label="采购数量" align="center" prop="purNum" :show-overflow-tooltip="true">
|
||||
<!-- <el-table-column label="采购数量" align="center" prop="purNum" :show-overflow-tooltip="true">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model.number="scope.row.purNum" placeholder="请输入" maxlength="10" clearable @input="(v)=>(scope.row.purNum=v.replace(/[^\d]/g,''))"/>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<el-table-column label="采购数量" align="center" prop="purNum" :show-overflow-tooltip="true">
|
||||
<template slot-scope="scope">
|
||||
<el-input
|
||||
v-model.number="scope.row.purNum"
|
||||
placeholder="请输入"
|
||||
clearable
|
||||
maxlength="11"
|
||||
@input="(v) => limitDecimalInput(v, scope.row, 'purNum')"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="备注" align="center" prop="notes" :show-overflow-tooltip="true">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.notes" placeholder="请输入备注" maxlength="20" clearable/>
|
||||
|
|
@ -268,6 +280,35 @@ export default {
|
|||
},
|
||||
},
|
||||
methods: {
|
||||
limitDecimalInput(value, row, key) {
|
||||
// 只允许数字和小数点
|
||||
let val = value.replace(/[^\d.]/g, '');
|
||||
|
||||
// 不允许开头是多个 0(除非小数)
|
||||
val = val.replace(/^0+(\d)/, '$1');
|
||||
val = val.replace(/^\./, '');
|
||||
|
||||
// 只保留第一个小数点
|
||||
val = val.replace('.', '#').replace(/\./g, '').replace('#', '.');
|
||||
|
||||
// 限制整数7位,小数最多3位
|
||||
if (val.includes('.')) {
|
||||
let [intPart, decPart] = val.split('.');
|
||||
intPart = intPart.slice(0, 7);
|
||||
decPart = decPart.slice(0, 3);
|
||||
val = intPart + '.' + decPart;
|
||||
} else {
|
||||
val = val.slice(0, 7); // 纯整数最多7位
|
||||
}
|
||||
|
||||
// 限制最大值为 9999999.999
|
||||
const max = 9999999.999;
|
||||
if (parseFloat(val) > max) {
|
||||
val = max.toString();
|
||||
}
|
||||
|
||||
row[key] = val;
|
||||
},
|
||||
// 返回列表页
|
||||
jumpList() {
|
||||
const obj = { path: "/foodManage/purchaseManage/goodsInquiryEdit" };
|
||||
|
|
|
|||
Loading…
Reference in New Issue