diff --git a/yxt-as-ui/src/views/storage/receivingGoods/receivingGoodsAdd.vue b/yxt-as-ui/src/views/storage/receivingGoods/receivingGoodsAdd.vue index 70f42a9457..86edc07208 100644 --- a/yxt-as-ui/src/views/storage/receivingGoods/receivingGoodsAdd.vue +++ b/yxt-as-ui/src/views/storage/receivingGoods/receivingGoodsAdd.vue @@ -223,6 +223,18 @@ export default { saveOrUpdate() { this.$refs['form_obj'].validate((valid) => { if (valid) { + if (this.formobj.list.length === 0) { + this.$message({ showClose: true, type: 'error', message: '商品列表不能为空' }) + return + } + for (var i = 0; i < this.formobj.list.length; i++) { + if (this.formobj.list[i].actualInCount === '' ) { + this.$message({ showClose: true, type: 'error', message: '实收数量不能为空' }) + return + } else if (parseFloat(this.formobj.list[i].actualInCount) < 1) { + this.$message({ showClose: true, type: 'error', message: '实收数量不能为零' }) + } + } this.submitdisabled = true req.save(this.formobj).then((res) => { if (res.success) { @@ -245,14 +257,11 @@ export default { return } for (var i = 0; i < this.formobj.list.length; i++) { - var item = this.formobj.list[i] - if (item.actualInCount == 0) { - this.$message({ - showClose: true, - type: 'error', - message: '实收数量不能为空' - }) + if (this.formobj.list[i].actualInCount === '' ) { + this.$message({ showClose: true, type: 'error', message: '实收数量不能为空' }) return + } else if (parseFloat(this.formobj.list[i].actualInCount) < 1) { + this.$message({ showClose: true, type: 'error', message: '实收数量不能为零' }) } } this.submitdisabled = true