diff --git a/src/views/material/wareHouse/index.vue b/src/views/material/wareHouse/index.vue index e2a666c3..0f80229c 100644 --- a/src/views/material/wareHouse/index.vue +++ b/src/views/material/wareHouse/index.vue @@ -713,13 +713,13 @@ :show-overflow-tooltip="true" > - - + --> @@ -1416,10 +1415,26 @@ export default { }, // 入库数量输入框失去焦点 handlePutBlur(row) { + console.log('🚀 ~ handlePutBlur ~ rowxxxxxxxxxxxxxxxxx:', row) if (!row.putInStoreNum) { this.$message.warning('入库数量不能为空') row.putInStoreNum = 1 } + + // 根据计量单位类型决定是否允许小数 + if (row.unitValue == 1) { + console.log("yyyyyyyyyyyyyy") + // 允许小数:移除非数字和小数点的字符 + row.putInStoreNum = Number(String(row.putInStoreNum).replace(/[^\d.]/g, '')) + } else { + console.log("zzzzzzzzzzzzzz") + // 不允许小数:只保留数字字符 + row.putInStoreNum = Number(String(row.putInStoreNum).replace(/[^\d]/g, '')) + } + // 确保数量不小于0 + if (row.putInStoreNum <= 0) { + row.putInStoreNum = 1 + } }, // 删除行 handleDeleteRow(index) { @@ -1541,6 +1556,7 @@ export default { template.unitCn = node.data.unitName template.typeCn = node.pathLabels[2] template.guigeCn = node.pathLabels[3] + template.unitValue = node.data.unitValue template.putInStoreNum = 1 if (this.taskId) {