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

View File

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