优化出库入库数量限制

This commit is contained in:
gyq 2024-07-22 17:13:44 +08:00
parent 2be2df7bc4
commit 52ed7edf08
2 changed files with 99 additions and 36 deletions

View File

@ -113,14 +113,15 @@
<el-table-column label="进价"> <el-table-column label="进价">
<template v-slot="scope"> <template v-slot="scope">
<el-input-number v-model="scope.row.price" :min="0" controls-position="right" <el-input-number v-model="scope.row.price" :min="0" controls-position="right"
@change="consCountTotal()"></el-input-number> @change="consCountTotal($event, scope.row, 'price')"></el-input-number>
<div class="tips">原价{{ scope.row.costPrice }}/{{ scope.row.conUnit }}</div> <div class="tips">原价{{ scope.row.costPrice }}/{{ scope.row.conUnit }}</div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="数量"> <el-table-column label="数量">
<template v-slot="scope"> <template v-slot="scope">
<el-input-number v-model="scope.row.stockNumber" :min="0" controls-position="right" <el-input-number v-model="scope.row.stockNumber" :min="0" :step="1" step-strictly
@change="consCountTotal()"></el-input-number> controls-position="right"
@change="consCountTotal($event, scope.row, 'stockNumber')"></el-input-number>
<div class="tips">入库前{{ scope.row.number }}{{ scope.row.conUnit }} <div class="tips">入库前{{ scope.row.number }}{{ scope.row.conUnit }}
</div> </div>
</template> </template>
@ -150,7 +151,7 @@
<template v-slot="scope"> <template v-slot="scope">
<div class="name_wrap"> <div class="name_wrap">
<span class="name">{{ scope.row.name }}</span> <span class="name">{{ scope.row.name }}</span>
<span v-if="scope.row.specSnap" >({{ scope.row.specSnap }})</span> <span v-if="scope.row.specSnap">({{ scope.row.specSnap }})</span>
<!-- <el-tag type="info" v-if="scope.row.specSnap" size="mini">{{ scope.row.specSnap }}</el-tag> --> <!-- <el-tag type="info" v-if="scope.row.specSnap" size="mini">{{ scope.row.specSnap }}</el-tag> -->
</div> </div>
</template> </template>
@ -158,14 +159,15 @@
<el-table-column label="进价"> <el-table-column label="进价">
<template v-slot="scope"> <template v-slot="scope">
<el-input-number v-model="scope.row.costPrice" :min="0" controls-position="right" <el-input-number v-model="scope.row.costPrice" :min="0" controls-position="right"
@change="e => { modifyPrice(); scope.row.costPrice = e }"></el-input-number> @change="modifyPrice($event, scope.row, 'costPrice')"></el-input-number>
<div class="tips">成本价{{ scope.row.costPrice }}/{{ scope.row.unitName }}</div> <div class="tips">成本价{{ scope.row.costPrice }}/{{ scope.row.unitName }}</div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="数量"> <el-table-column label="数量">
<template v-slot="scope"> <template v-slot="scope">
<el-input-number v-model="scope.row.number" :min="0" controls-position="right" <el-input-number v-model="scope.row.number" :min="0" :step="1" step-strictly
@change="e => { modifyPrice(); scope.row.totalAmount = e }"></el-input-number> controls-position="right"
@change="modifyPrice($event, scope.row, 'number', 'totalAmount')"></el-input-number>
<div class="tips">入库前{{ scope.row.stockNumber }}{{ scope.row.unitName }}</div> <div class="tips">入库前{{ scope.row.stockNumber }}{{ scope.row.unitName }}</div>
</template> </template>
</el-table-column> </el-table-column>
@ -305,20 +307,50 @@ export default {
this.queryForm.type = type this.queryForm.type = type
}, },
// //
consCountTotal() { consCountTotal(cvalue, row, key1, key2 = undefined) {
let zong = 0 if (cvalue == undefined) {
this.tableData.list.forEach(ele => { setTimeout(() => {
zong += ele.price * ele.stockNumber row[key1] = 0
})
this.queryForm.totalAmount = formatDecimal(zong) let zong = 0
this.tableData.list.forEach(ele => {
zong += ele.price * ele.stockNumber
})
this.queryForm.totalAmount = formatDecimal(zong)
}, 10)
} else {
row[key1] = cvalue
let zong = 0
this.tableData.list.forEach(ele => {
zong += ele.price * ele.stockNumber
})
this.queryForm.totalAmount = formatDecimal(zong)
}
}, },
// //
modifyPrice() { modifyPrice(cvalue, row, key1, key2 = undefined) {
let zong = 0 if (cvalue == undefined) {
this.tableData.list.forEach(ele => { setTimeout(() => {
zong += ele.costPrice * ele.number row[key1] = 0
}) row[key2] = 0
this.queryForm.totalAmount = formatDecimal(zong)
let zong = 0
this.tableData.list.forEach(ele => {
zong += ele.costPrice * ele.number
})
this.queryForm.totalAmount = formatDecimal(zong)
}, 10)
} else {
row[key1] = cvalue
row[key2] = cvalue
let zong = 0
this.tableData.list.forEach(ele => {
zong += ele.costPrice * ele.number
})
this.queryForm.totalAmount = formatDecimal(zong)
}
}, },
// //
submitHandle() { submitHandle() {

View File

@ -110,14 +110,15 @@
<el-table-column label="进价"> <el-table-column label="进价">
<template v-slot="scope"> <template v-slot="scope">
<el-input-number v-model="scope.row.price" :min="0" controls-position="right" <el-input-number v-model="scope.row.price" :min="0" controls-position="right"
@change="consCountTotal()"></el-input-number> @change="consCountTotal($event, scope.row, 'price')"></el-input-number>
<div class="tips">原价{{ scope.row.costPrice }}/{{ scope.row.conUnit }}</div> <div class="tips">原价{{ scope.row.costPrice }}/{{ scope.row.conUnit }}</div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="数量"> <el-table-column label="数量">
<template v-slot="scope"> <template v-slot="scope">
<el-input-number v-model="scope.row.stockNumber" :min="0" controls-position="right" <el-input-number v-model="scope.row.stockNumber" :min="0" :step="1" step-strictly
@change="consCountTotal()"></el-input-number> controls-position="right"
@change="consCountTotal($event, scope.row, 'stockNumber')"></el-input-number>
<div class="tips">出库前{{ scope.row.number }}{{ scope.row.conUnit }}</div> <div class="tips">出库前{{ scope.row.number }}{{ scope.row.conUnit }}</div>
</template> </template>
</el-table-column> </el-table-column>
@ -153,14 +154,14 @@
<el-table-column label="进价"> <el-table-column label="进价">
<template v-slot="scope"> <template v-slot="scope">
<el-input-number v-model="scope.row.costPrice" :min="0" controls-position="right" <el-input-number v-model="scope.row.costPrice" :min="0" controls-position="right"
@change="e => { modifyPrice(); scope.row.costPrice = e }"></el-input-number> @change="modifyPrice($event, scope.row, 'costPrice')"></el-input-number>
<div class="tips">成本价{{ scope.row.costPrice }}/{{ scope.row.unitName }}</div> <div class="tips">成本价{{ scope.row.costPrice }}/{{ scope.row.unitName }}</div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="数量"> <el-table-column label="数量">
<template v-slot="scope"> <template v-slot="scope">
<el-input-number v-model="scope.row.number" :min="0" controls-position="right" <el-input-number v-model="scope.row.number" :min="0" controls-position="right"
@change="e => { modifyPrice(); scope.row.totalAmount = e }"></el-input-number> @change="modifyPrice($event, scope.row, 'number', 'totalAmount')"></el-input-number>
<div class="tips">出库前{{ scope.row.stockNumber }}{{ scope.row.unitName }}</div> <div class="tips">出库前{{ scope.row.stockNumber }}{{ scope.row.unitName }}</div>
</template> </template>
</el-table-column> </el-table-column>
@ -299,20 +300,50 @@ export default {
this.queryForm.type = type this.queryForm.type = type
}, },
// //
consCountTotal() { consCountTotal(cvalue, row, key1, key2 = undefined) {
let zong = 0 if (cvalue == undefined) {
this.tableData.list.forEach(ele => { setTimeout(() => {
zong += ele.price * ele.stockNumber row[key1] = 0
})
this.queryForm.totalAmount = formatDecimal(zong) let zong = 0
this.tableData.list.forEach(ele => {
zong += ele.price * ele.stockNumber
})
this.queryForm.totalAmount = formatDecimal(zong)
}, 10)
} else {
row[key1] = cvalue
let zong = 0
this.tableData.list.forEach(ele => {
zong += ele.price * ele.stockNumber
})
this.queryForm.totalAmount = formatDecimal(zong)
}
}, },
// //
modifyPrice() { modifyPrice(cvalue, row, key1, key2 = undefined) {
let zong = 0 if (cvalue == undefined) {
this.tableData.list.forEach(ele => { setTimeout(() => {
zong += ele.costPrice * ele.number row[key1] = 0
}) row[key2] = 0
this.queryForm.totalAmount = zong
let zong = 0
this.tableData.list.forEach(ele => {
zong += ele.costPrice * ele.number
})
this.queryForm.totalAmount = formatDecimal(zong)
}, 10)
} else {
row[key1] = cvalue
row[key2] = cvalue
let zong = 0
this.tableData.list.forEach(ele => {
zong += ele.costPrice * ele.number
})
this.queryForm.totalAmount = formatDecimal(zong)
}
}, },
// //
submitHandle() { submitHandle() {