fix:出入库记录及明细表单新增时清空,避免上次保存数据残留导致"物料找不到"

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) <noreply@anthropic.com>
This commit is contained in:
caoqianming 2026-07-16 09:54:36 +08:00
parent 3d75e89e1e
commit 27060f7c54
2 changed files with 31 additions and 0 deletions

View File

@ -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;

View File

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