fix: 修复手动来料物料选择和 mgroup 传递问题

- 修正 xtSelect @change 回调签名,正确赋值 material_name
- createForm 初始化时默认填入当前 mgroup,提交时从 createForm 读取

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
caoqianming 2026-03-27 16:41:24 +08:00
parent 5e77d575b8
commit 9e3ebb5a46
2 changed files with 27 additions and 57 deletions

View File

@ -241,14 +241,6 @@
</el-table-column>
</scTable>
</el-main>
<el-dialog title="选择物料" v-model="materialsVisible" width="90%">
<materials
style="height: 500px"
:materialType="materialType"
ref="materialsChose"
@choseChange="choseChange"
></materials>
</el-dialog>
<check-dialog
v-if="dialog.check"
ref="checkDialog"
@ -325,7 +317,17 @@
<el-dialog title="手动来料" v-model="dialog.create" width="400px">
<el-form :model="createForm" label-width="80px">
<el-form-item label="物料">
<el-button size="small" @click="materialsVisible = true">{{ createForm.material_name || '选择物料' }}</el-button>
<xtSelect
v-model="createForm.material"
:label="createForm.material_name"
:apiObj="$API.mtm.material.list"
:params="{ process_todo: process }"
style="width:100%"
@change="(row) => createForm.material_name = row && row.name"
>
<el-table-column label="名称" prop="name" />
<el-table-column label="规格" prop="specification" />
</xtSelect>
</el-form-item>
<el-form-item label="批次号">
<el-input v-model="createForm.batch" />
@ -343,7 +345,6 @@
</template>
<script>
import { wmState } from "@/utils/enum.js";
import materials from "./../mtm/materials.vue";
import checkDialog from "./check_form.vue";
import showDrawer from "./check_drawer.vue";
import scrapDialog from "./handover_form.vue";
@ -376,7 +377,6 @@ export default {
components: {
wprDialog,
saveDialog,
materials,
checkDialog,
showDrawer,
scrapDialog,
@ -418,10 +418,6 @@ export default {
{ value: false, name: "未合批"},
{ value: true, name: "已合批"},
],
queryWm: {
search: "",
material: "",
},
wmItem:{},
wprParams:{
page:0,
@ -434,10 +430,8 @@ export default {
showBatch: "",
wmMaterial:'',
cate_type:'',
materialType: "wm",
showWprList: false,
limitedWatch:false,
materialsVisible:false,
visibleDrawer: false,
wprApiObj:this.$API.wpm.wpr.list,
apiObjPrint:this.$API.cm.labelmat.fromWm,
@ -485,10 +479,6 @@ export default {
this.$refs.saveDialog.open("add");
});
},
materialsChoses(str) {
this.materialType = str;
this.materialsVisible = true;
},
tomio(type) {
let that = this;
that.cate_type=type;
@ -594,19 +584,14 @@ export default {
},
//
table_create() {
this.createForm = { material: '', material_name: '', batch: '', count: 0 };
this.createForm = { material: '', material_name: '', batch: '', count: 0, mgroup: this.mgroupId };
this.dialog.create = true;
},
choseChange(data) {
this.createForm.material = data.id;
this.createForm.material_name = data.name;
this.materialsVisible = false;
},
submitCreate() {
let that = this;
if (!that.createForm.material) { that.$message.warning('请选择物料'); return; }
if (!that.createForm.batch) { that.$message.warning('请输入批次号'); return; }
let data = { material: that.createForm.material, batch: that.createForm.batch, count: that.createForm.count, mgroup: that.mgroupId };
let data = { material: that.createForm.material, batch: that.createForm.batch, count: that.createForm.count, mgroup: that.createForm.mgroup };
that.$API.wpm.wmaterial.create.req(data).then(() => {
that.$message.success('来料成功');
that.dialog.create = false;

View File

@ -131,14 +131,6 @@
</el-table-column>
</scTable>
</el-main>
<el-dialog title="选择物料" v-model="materialsVisible" width="90%">
<materials
style="height: 500px"
:materialType="materialType"
ref="materialsChose"
@choseChange="choseChange"
></materials>
</el-dialog>
<!-- 检验 -->
<!-- <check-dialog
v-if="dialog.save"
@ -200,7 +192,17 @@
<el-dialog title="手动来料" v-model="dialog.create" width="400px">
<el-form :model="createForm" label-width="80px">
<el-form-item label="物料">
<el-button size="small" @click="materialsVisible = true">{{ createForm.material_name || '选择物料' }}</el-button>
<xtSelect
v-model="createForm.material"
:label="createForm.material_name"
:apiObj="$API.mtm.material.list"
:params="{ process_todo: processId }"
style="width:100%"
@change="(row) => createForm.material_name = row && row.name"
>
<el-table-column label="名称" prop="name" />
<el-table-column label="规格" prop="specification" />
</xtSelect>
</el-form-item>
<el-form-item label="批次号">
<el-input v-model="createForm.batch" />
@ -218,7 +220,6 @@
</template>
<script>
import { wmState } from "@/utils/enum.js";
import materials from "./../mtm/materials.vue";
import printDialog from "./../template/printmaterial.vue";
import checkDialog from "./check_form.vue";
import showDrawer from "./check_drawer.vue";
@ -250,7 +251,6 @@ export default {
},
components: {
saveDialog,
materials,
checkDialog,
showDrawer,
scrapDialog,
@ -288,17 +288,11 @@ export default {
{ value: 20, name: "不合格"},
{ value: 30, name: "返工"},
],
queryWm: {
search: "",
material: "",
},
queryState: null,
codeText2: "",
codeText4: "",
cate_type:'',
materialType: "wm",
changebatch:false,
materialsVisible:false,
visibleDrawer: false,
apiObjPrint:this.$API.cm.labelmat.fromWm,
wmId:'',
@ -359,10 +353,6 @@ export default {
this.$refs.scrapDialog.open("add",handoverb,30);
});
},
materialsChoses(str) {
this.materialType = str;
this.materialsVisible = true;
},
searchStateChange(){
let that = this;
that.query.state = null;
@ -462,19 +452,14 @@ export default {
},
//
table_create() {
this.createForm = { material: '', material_name: '', batch: '', count: 0 };
this.createForm = { material: '', material_name: '', batch: '', count: 0, mgroup: this.mgroupId };
this.dialog.create = true;
},
choseChange(data) {
this.createForm.material = data.id;
this.createForm.material_name = data.name;
this.materialsVisible = false;
},
submitCreate() {
let that = this;
if (!that.createForm.material) { that.$message.warning('请选择物料'); return; }
if (!that.createForm.batch) { that.$message.warning('请输入批次号'); return; }
let data = { material: that.createForm.material, batch: that.createForm.batch, count: that.createForm.count, mgroup: that.mgroupId };
let data = { material: that.createForm.material, batch: that.createForm.batch, count: that.createForm.count, mgroup: that.createForm.mgroup };
that.$API.wpm.wmaterial.create.req(data).then(() => {
that.$message.success('来料成功');
that.dialog.create = false;