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();