diff --git a/hb_client/src/components/customForm/index.vue b/hb_client/src/components/customForm/index.vue index 1f0e232..e9f17f3 100644 --- a/hb_client/src/components/customForm/index.vue +++ b/hb_client/src/components/customForm/index.vue @@ -160,7 +160,7 @@ - + @@ -306,6 +306,9 @@ } }, methods: { + checkValue() { + this.number = this.number.replace(/[^0-9a-zA-Z]/g, ''); + }, filterBlock(rule, index, field_key) { let that = this; if (rule !== '' && rule !== null && rule !== undefined) { diff --git a/hb_client/src/views/inm/fifo.vue b/hb_client/src/views/inm/fifo.vue index e448e0f..c1c16c3 100644 --- a/hb_client/src/views/inm/fifo.vue +++ b/hb_client/src/views/inm/fifo.vue @@ -346,7 +346,7 @@ label="批次" :prop="'details.' + index + '.batch'" > - + @@ -379,7 +379,7 @@ - + @@ -465,7 +465,7 @@ material: "", // 物料 count: "", //数量 batch: "", //批次 - expiration_date: "", // + expiration_date: null, // details:[], }, ], @@ -481,6 +481,13 @@ export default { components: {Pagination}, data() { + const validateBatch = (rule, value, callback) => { + if (value.length < 6) { + callback(new Error("请输入不小于六位!")); + } else { + callback(); + } + }; return { inventory: defaulteinventory, outfifo: defaulteoutfifo, @@ -513,6 +520,7 @@ dialogVisibles: false, rule1: { name: [{required: true, message: "请输入", trigger: "blur"}], + batch: [{required: true, message: "请输入不小于六位", trigger: "blur", validator: validateBatch},], }, }; }, @@ -526,6 +534,12 @@ this.getpuorderList(); }, methods: { + checkValue() { + this.itemDetails = this.itemDetails.replace(/[^0-9a-zA-Z]/g, ''); + }, + checkValueItem(index) { + this.inventory.details[index].batch = this.inventory.details[index].batch.replace(/[^0-9a-zA-Z]/g, ''); + }, detailEnter(item,index){ this.inventory.details[index].details.push({number:item}); this.itemDetails = ''; @@ -639,7 +653,7 @@ material: "", // 物料 count: "", //数量 batch: "", //批次 - expiration_date: "", // + expiration_date: null, // details:[], }, ]; @@ -711,9 +725,12 @@ }, async confirm(form) { - console.log(this.inventory); + let isbatch = false; let details = []; this.inventory.details.forEach(item=>{ + if(item.batch.length<6){ + isbatch = true; + } let obj = new Object(); if(item.details.length>0){ obj = item; @@ -726,14 +743,18 @@ } details.push(obj); }); - this.inventory.details = details; - createInother(this.inventory).then((res) => { - if (res.code >= 200) { - this.getList(); - this.dialogVisible = false; - this.$message.success("成功"); - } - }); + if(isbatch){ + this.$message.warning("批次号不能少于六位数"); + }else{ + this.inventory.details = details; + createInother(this.inventory).then((res) => { + if (res.code >= 200) { + this.getList(); + this.dialogVisible = false; + this.$message.success("成功"); + } + }); + } }, handleDelete(scope) { this.$confirm("确认删除?", "警告", { diff --git a/hb_client/src/views/pm/plan.vue b/hb_client/src/views/pm/plan.vue index 460f75e..966e079 100644 --- a/hb_client/src/views/pm/plan.vue +++ b/hb_client/src/views/pm/plan.vue @@ -238,7 +238,7 @@ - +
@@ -336,7 +336,9 @@ }, methods: { checkPermission, - + checkValue() { + this.orderplan.number = this.orderplan.number.replace(/[^0-9a-zA-Z]/g, ''); + }, //订单列表 getorderList() { this.listLoading = true;