解决小数输入问题
This commit is contained in:
parent
079ee2c2e6
commit
1bda53878b
|
|
@ -299,19 +299,13 @@
|
|||
<el-table-column label="预领数量" prop="preNum" align="center">
|
||||
<template v-slot="scope">
|
||||
<el-input
|
||||
v-model.number="scope.row.preNum"
|
||||
controls-position="right"
|
||||
type="number"
|
||||
v-model="scope.row.preNum"
|
||||
type="text"
|
||||
style="width: 100%"
|
||||
:disabled="isDetail"
|
||||
:min="0"
|
||||
@input="
|
||||
v =>
|
||||
scope.row.unitValue == 1
|
||||
? (scope.row.preNum = Number(v.replace(/[^\d.]/g, '')))
|
||||
: (scope.row.preNum = Number(v.replace(/[^\d]/g, '')))
|
||||
"
|
||||
></el-input>
|
||||
:disabled="scope.row.alNum && scope.row.alNum != 0"
|
||||
@input="handlePreNum(scope.row, $event, 'input')"
|
||||
@blur="handlePreNum(scope.row, $event, 'blur')"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column align="center" label="当前库存" prop="storageNum" /> -->
|
||||
|
|
@ -657,6 +651,18 @@ export default {
|
|||
console.log(this.$route.query, 'this.$route.query')
|
||||
},
|
||||
methods: {
|
||||
handlePreNum(row, val, type) {
|
||||
if (type === 'input') {
|
||||
const reg = row.unitValue == 1
|
||||
? val.replace(/[^\d.]/g, '') // 允许小数
|
||||
: val.replace(/[^\d]/g, '') // 只能整数
|
||||
row.preNum = reg
|
||||
} else if (type === 'blur') {
|
||||
if (row.preNum !== '') {
|
||||
row.preNum = Number(row.preNum)
|
||||
}
|
||||
}
|
||||
},
|
||||
fitNumChange() {
|
||||
const newVal = Math.min(5, Math.max(1, parseInt(this.maForm.fitNum) || 1))
|
||||
const ratio = newVal / this.lastFitNum
|
||||
|
|
|
|||
|
|
@ -260,11 +260,13 @@
|
|||
<el-table-column label="预领数量" prop="preNum" align="center">
|
||||
<template v-slot="scope">
|
||||
<el-input
|
||||
v-model.number="scope.row.preNum"
|
||||
controls-position="right" type="number"
|
||||
style="width: 100%" :disabled="scope.row.alNum && scope.row.alNum != 0 ? true : false"
|
||||
:min="0" @input="(v)=>(scope.row.unitValue==1?scope.row.preNum=Number(v.replace(/[^\d.]/g,'')) : scope.row.preNum=Number(v.replace(/[^\d]/g,'')))"
|
||||
></el-input>
|
||||
v-model="scope.row.preNum"
|
||||
type="text"
|
||||
style="width: 100%"
|
||||
:disabled="scope.row.alNum && scope.row.alNum != 0"
|
||||
@input="handlePreNum(scope.row, $event, 'input')"
|
||||
@blur="handlePreNum(scope.row, $event, 'blur')"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="已出库数量" align="center" prop="alNum" v-if="maForm.taskId" :show-overflow-tooltip="true"/>
|
||||
|
|
@ -540,6 +542,18 @@ export default {
|
|||
// this.equipmentType();
|
||||
},
|
||||
methods: {
|
||||
handlePreNum(row, val, type) {
|
||||
if (type === 'input') {
|
||||
const reg = row.unitValue == 1
|
||||
? val.replace(/[^\d.]/g, '') // 允许小数
|
||||
: val.replace(/[^\d]/g, '') // 只能整数
|
||||
row.preNum = reg
|
||||
} else if (type === 'blur') {
|
||||
if (row.preNum !== '') {
|
||||
row.preNum = Number(row.preNum)
|
||||
}
|
||||
}
|
||||
},
|
||||
/** 转换菜单数据结构 */
|
||||
normalizer(node) {
|
||||
if (node.children && !node.children.length) {
|
||||
|
|
|
|||
|
|
@ -151,18 +151,12 @@
|
|||
<el-table-column label="采购数量" prop="purchaseNum" align="center" width="120">
|
||||
<template v-slot="scope">
|
||||
<el-input
|
||||
v-model.number="scope.row.purchaseNum"
|
||||
controls-position="right"
|
||||
type="number"
|
||||
v-model="scope.row.purchaseNum"
|
||||
type="text"
|
||||
style="width: 100%"
|
||||
:min="0"
|
||||
@input="
|
||||
v =>
|
||||
scope.row.unitValue == 1
|
||||
? (scope.row.purchaseNum = Number(v.replace(/[^\d.]/g, '')))
|
||||
: (scope.row.purchaseNum = Number(v.replace(/[^\d]/g, '')))
|
||||
"
|
||||
></el-input>
|
||||
@input="handlePreNum(scope.row, $event, 'input')"
|
||||
@blur="handlePreNum(scope.row, $event, 'blur')"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="购置单价(元含税)" prop="purchaseTaxPrice" align="center" width="150">
|
||||
|
|
@ -525,6 +519,18 @@ export default {
|
|||
this.getTaskInfo()
|
||||
},
|
||||
methods: {
|
||||
handlePreNum(row, val, type) {
|
||||
if (type === 'input') {
|
||||
const reg = row.unitValue == 1
|
||||
? val.replace(/[^\d.]/g, '') // 允许小数
|
||||
: val.replace(/[^\d]/g, '') // 只能整数
|
||||
row.purchaseNum = reg
|
||||
} else if (type === 'blur') {
|
||||
if (row.purchaseNum !== '') {
|
||||
row.purchaseNum = Number(row.purchaseNum)
|
||||
}
|
||||
}
|
||||
},
|
||||
handleDateTypeChange(val) {
|
||||
console.log('xxxxx', val)
|
||||
if (val === 'day') {
|
||||
|
|
|
|||
Loading…
Reference in New Issue