From 27060f7c540e0f67608d0c27ead55941c75393b3 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Thu, 16 Jul 2026 09:54:36 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E5=87=BA=E5=85=A5=E5=BA=93=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E5=8F=8A=E6=98=8E=E7=BB=86=E8=A1=A8=E5=8D=95=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E6=97=B6=E6=B8=85=E7=A9=BA,=E9=81=BF=E5=85=8D?= =?UTF-8?q?=E4=B8=8A=E6=AC=A1=E4=BF=9D=E5=AD=98=E6=95=B0=E6=8D=AE=E6=AE=8B?= =?UTF-8?q?=E7=95=99=E5=AF=BC=E8=87=B4"=E7=89=A9=E6=96=99=E6=89=BE?= =?UTF-8?q?=E4=B8=8D=E5=88=B0"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit mio_form/mioitem_form的open()原只设type、不重置form,saveDialog虽用 v-if="dialog.save"+@closed重建,但关闭动画未结束就再点新增时dialog.save 仍为true、组件被复用,导致上次的material/mb/batch/selectObj等残留。 新增resetForm(),add模式打开时强制清空,不依赖v-if重建时序。 Co-Authored-By: Claude Opus 4.8 (1M context) --- src/views/inm/mio_form.vue | 7 +++++++ src/views/inm/mioitem_form.vue | 24 ++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/src/views/inm/mio_form.vue b/src/views/inm/mio_form.vue index 03b23ae0..446f46f0 100644 --- a/src/views/inm/mio_form.vue +++ b/src/views/inm/mio_form.vue @@ -326,10 +326,17 @@ export default { // console.log('userOption',userOption); }); }, + //新增时清空表单,避免上次保存的数据残留(与mioitem_form一致,防v-if未及时重建时复用旧实例) + resetForm() { + this.form = { state: 10, inout_date: this.$TOOL.dateFormat2(new Date()) }; + }, //显示 open(mode = "add", type = "",htype="") { this.mode = mode; this.htype = htype; + if (mode == "add") { + this.resetForm(); + } this.form.type = type; this.init(); this.visible = true; diff --git a/src/views/inm/mioitem_form.vue b/src/views/inm/mioitem_form.vue index 7f5d72f3..e36202e5 100644 --- a/src/views/inm/mioitem_form.vue +++ b/src/views/inm/mioitem_form.vue @@ -735,11 +735,35 @@ export default { this.form.warehouse = ""; this.inputBatchDisable = false; }, + //新增时清空表单,避免上次保存的数据残留导致"物料找不到"等错误 + resetForm() { + this.form = { count: 1, note: '', pack_index: 1 }; + this.selectObj = null; + this.selectBatch = null; + this.mioitems = ['']; + this.mioitemw = []; + this.wprList = []; + this.wbatchOptions = []; + this.batchOptions = []; + this.batchOptions_o = []; + this.components = []; + this.assembShow = false; + this.batchcount = null; + this.mTracking = 10; + this.prefix = ''; + this.halfgoodprefix = ''; + this.digitNum = null; + this.count_send_yp = 0; + this.inputBatchDisable = false; + }, //显示 open(mode = "add", type = "",mtype) { let that = this; this.mode = mode; this.mtype = mtype?mtype:null; + if (mode == "add") { + this.resetForm(); + } this.form.type = this.type = type; if (mode == "add") { this.init();