From f16f649dc4fef93f5ead69b50f64b6e8eae23829 Mon Sep 17 00:00:00 2001 From: shijing Date: Fri, 17 Jan 2025 11:20:04 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E5=BA=93=E5=AD=98=E4=BA=A4=E6=8E=A5?= =?UTF-8?q?=E6=97=B6=E6=96=B0=E5=A2=9E=E8=A1=A8=E5=8D=95=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/wpm_bx/inm_record_form.vue | 70 +++++++++++++++++++--------- 1 file changed, 49 insertions(+), 21 deletions(-) diff --git a/src/views/wpm_bx/inm_record_form.vue b/src/views/wpm_bx/inm_record_form.vue index 872843e2..cdac687e 100644 --- a/src/views/wpm_bx/inm_record_form.vue +++ b/src/views/wpm_bx/inm_record_form.vue @@ -12,7 +12,7 @@ :rules="rules" label-width="120px" > - + - + - + @@ -144,9 +144,13 @@ export default { do_out: "生产领料", do_in: "生产入库", }, - form: {}, + form: { + count:1 + }, rules: { - material: [{required: true,message: "请选择物料",trigger: "blur",},], + material: [{required: true,message: "请选择物料",trigger: "blur"}], + batch: [{required: true,message: "请选择物料批次",trigger: "blur"}], + warehouse: [{required: true,message: "请选择仓库",trigger: "blur"}], }, visible: false, isSaveing: false, @@ -158,6 +162,7 @@ export default { selectBatchDisable: false, selectMaterial: null, selectBatch: null, + mioitemlist:[], wbatchOptions: [],//工段物料批次 }; }, @@ -168,6 +173,7 @@ export default { this.inputBatchDisable = true; this.getMaterialOptions(); this.getBatchOptions(); + this.getList(); }else{//入库----工段 this.getMgroupWmaterial(); } @@ -180,6 +186,14 @@ export default { this.warehouseOptions = res; }); }, + getList(){ + let that = this; + that.$API.inm.mioitem.list.req({mio:that.mioId,page:0}).then(res=>{ + console.log('mioitemlist',res); + that.mioitemlist = res; + }) + }, + //获取物料列表 getMaterialOptions() { let that = this; @@ -240,9 +254,21 @@ export default { } }, selectBatchChange(item) { - this.form.batch = item.batch; - this.form.mb = item.id; - this.form.warehouse = item.warehouse; + let that = this; + if(item&&item.batch){ + let arr = this.mioitemlist.filter((mioitem) => { + return mioitem.batch == item.batch; + }); + console.log('arr',arr); + if(arr.length > 0){ + this.$message.error('该批次已存在'); + that.selectBatchClear(); + }else{ + this.form.batch = item.batch; + this.form.mb = item.id; + this.form.warehouse = item.warehouse; + } + } }, //选择车间库存物料后的处理 selectwmChange(val){ @@ -254,6 +280,7 @@ export default { }) }, selectBatchClear() { + this.selectBatch = ""; this.form.batch = ""; this.form.mb = ""; this.form.warehouse = ""; @@ -266,24 +293,25 @@ export default { }, //提交 submit() { - this.$refs.dialogForm.validate(async (valid) => { + let that = this; + that.$refs.dialogForm.validate(async (valid) => { if (valid) { - this.isSaveing = true; - this.form.mio = this.mioId; + that.isSaveing = true; + that.form.mio = that.mioId; try { var res; - if (this.mode == "add") { - res = await this.$API.inm.mioitem.create.req(this.form); - } else if (this.mode == "edit") { - res = await this.$API.inm.mioitem.update.req(this.form.id,this.form); + if (that.mode == "add") { + res = await that.$API.inm.mioitem.create.req(that.form); + } else if (that.mode == "edit") { + res = await that.$API.inm.mioitem.update.req(that.form.id,that.form); } - this.isSaveing = false; - this.$emit("success"); - this.visible = false; - this.$message.success("操作成功"); + that.isSaveing = false; + that.$emit("success"); + that.visible = false; + that.$message.success("操作成功"); } catch (err) { //可以处理校验错误 - this.isSaveing = false; + that.isSaveing = false; return err; } }