fix:光芯交接表单优化

This commit is contained in:
shijing 2025-06-19 15:45:29 +08:00
parent 03f65b7129
commit 125c9759b8
2 changed files with 171 additions and 100 deletions

View File

@ -185,7 +185,7 @@
size="small" size="small"
@click="table_reBack(scope.row)" @click="table_reBack(scope.row)"
type="danger" type="danger"
v-if="scope.row.recive_mgroup == mgroupId&&scope.row.submit_time!== null&&scope.row.type == 10&&scope.row.mtype == 10" v-if="scope.row.recive_mgroup == mgroupId&&scope.row.submit_time!== null&&(scope.row.type == 10||scope.row.type == 20)&&scope.row.mtype == 10"
>退回</el-button> >退回</el-button>
<el-button <el-button
link link
@ -403,7 +403,7 @@ export default {
that.codeText2 = codeText2; that.codeText2 = codeText2;
this.dialog.save = true; this.dialog.save = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.saveDialog.open("add",codeText2,20); this.$refs.saveDialog.open("add",codeText2,10);
}); });
}, },
// //

View File

@ -35,7 +35,26 @@
<el-row v-show="addShow"> <el-row v-show="addShow">
<el-col> <el-col>
<el-form-item label="交接物料"> <el-form-item label="交接物料">
<el-select <xtSelect
:apiObj="apiObjM"
v-model="form.wm_in"
v-model:obj="selectObj"
:labelField="'batch'"
style="width: 100%;"
:params = "paramsM"
@change="materialChange0"
>
<el-table-column label="物料" prop="full_name">
<template #default="scope">
<span v-if="scope.row.state==20" style="color: red;border: 1px solid red;border-radius: 3px;">不合格</span>
<span v-if="scope.row.state==30" style="color: orange;border: 1px solid orange;border-radius: 3px;">返工</span>
<span>{{ scope.row.batch }}({{ scope.row.material_name }})</span>
<span v-if="scope.row.defect_name !== null" style="color: orangered">{{ scope.row.defect_name }}</span>
</template>
</el-table-column>
<el-table-column label="数量" prop="count" width="110px"></el-table-column>
</xtSelect>
<!-- <el-select
v-model="selectItems" v-model="selectItems"
placeholder="交接物料" placeholder="交接物料"
filterable filterable
@ -55,22 +74,22 @@
<span v-if="item.defect_name !== null" style="color: orangered">{{ item.defect_name }}</span> <span v-if="item.defect_name !== null" style="color: orangered">{{ item.defect_name }}</span>
<span style="float: right">{{ item.count }}</span> <span style="float: right">{{ item.count }}</span>
</el-option> </el-option>
</el-select> </el-select> -->
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row v-for="(listItem,$index) in form.handoverb" :key="listItem"> <el-row v-for="(listItem,$index) in form.handoverb" :key="listItem">
<el-col :span="10"> <el-col :span="12">
<el-form-item label="交接物料"> <el-form-item label="交接物料">
<el-input v-model="listItem.batch" disabled></el-input> <el-input v-model="listItem.label" disabled></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="5"> <el-col :span="4">
<el-form-item label="总数量"> <el-form-item label="总数量">
<span>{{ listItem.count_cando }}</span> <span>{{ listItem.count_cando }}</span>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="7"> <el-col :span="6">
<el-form-item label="交接数量"> <el-form-item label="交接数量">
<el-input-number <el-input-number
v-model="listItem.count" v-model="listItem.count"
@ -235,6 +254,9 @@ export default {
recive_mgroup: null, recive_mgroup: null,
handoverb:[], handoverb:[],
}, },
apiObjM:null,
paramsM:{},
selectObj:{},
rules: { rules: {
batch: [ batch: [
{ {
@ -319,17 +341,22 @@ export default {
// //
if(that.type==20&&that.mgroupName!=='废品库'){ if(that.type==20&&that.mgroupName!=='废品库'){
// //
that.getMaterialRework(); // that.getMaterialRework();
that.paramsM = {mgroup: that.mgroupId,page: 0,state__in:'20,34',tag : 'done'};
}else if(that.type==20&&that.mgroupName=='废品库'){ }else if(that.type==20&&that.mgroupName=='废品库'){
// //
that.getMaterialFP(); // that.getMaterialFP();
that.paramsM = {page: 0,state : 50,state_all: 1};
}else if(that.type==40){ }else if(that.type==40){
// //
that.getMaterialNotok(); // that.getMaterialNotok();
that.paramsM = {mgroupx: that.mgroupId,page: 0,state:20};
}else{ }else{
// //
that.getMaterial(); that.paramsM = {mgroup: that.mgroupId,page: 0,state:10,tag : 'done'};
// that.getMaterial();
} }
that.apiObjM = this.$API.wpm.wmaterial.list;
if(that.type==40||that.type==20){ if(that.type==40||that.type==20){
that.getMgroupOptions(); that.getMgroupOptions();
}else{ }else{
@ -353,32 +380,32 @@ export default {
}); });
}, },
// //
getMaterial() { // getMaterial() {
let that = this; // let that = this;
var req = { // var req = {
page: 0, // page: 0,
state:10, // state:10,
tag:'done' // tag:'done'
}; // };
that.materialOptions = []; // that.materialOptions = [];
req.mgroup = that.mgroupId; // req.mgroup = that.mgroupId;
that.listParams = req; // that.listParams = req;
this.$API.wpm.wmaterial.list.req(req).then((res) => { // this.$API.wpm.wmaterial.list.req(req).then((res) => {
that.materialOptions = res; // that.materialOptions = res;
res.forEach(item=>{ // res.forEach(item=>{
if(that.codeText!==''&&item.batch === that.codeText){ // if(that.codeText!==''&&item.batch === that.codeText){
let obj = {}; // let obj = {};
obj.wm = item.id; // obj.wm = item.id;
obj.batch = item.batch; // obj.batch = item.batch;
obj.count = item.count_cando; // obj.count = item.count_cando;
obj.count_cando = item.count_cando; // obj.count_cando = item.count_cando;
that.totalCount = item.count_cando; // that.totalCount = item.count_cando;
that.form.handoverb.push(obj) // that.form.handoverb.push(obj)
that.getResaveMgroups(item.material); // that.getResaveMgroups(item.material);
} // }
}) // })
}); // });
}, // },
getResaveMgroups(material){ getResaveMgroups(material){
let that = this; let that = this;
let params = { let params = {
@ -393,45 +420,45 @@ export default {
}) })
}, },
// //
getMaterialNotok() { // getMaterialNotok() {
let that = this; // let that = this;
that.materialOptions = []; // that.materialOptions = [];
var req = { // var req = {
mgroupx: that.mgroupId, // mgroupx: that.mgroupId,
page: 0, // page: 0,
state:20 // state:20
}; // };
that.listParams = req; // that.listParams = req;
this.$API.wpm.wmaterial.list.req(req).then((res) => { // this.$API.wpm.wmaterial.list.req(req).then((res) => {
that.materialOptions = res; // that.materialOptions = res;
}); // });
}, // },
getMaterialRework(){ // getMaterialRework(){
let that = this; // let that = this;
that.materialOptions = []; // that.materialOptions = [];
var req = { // var req = {
mgroup: that.mgroupId, // mgroup: that.mgroupId,
page: 0, // page: 0,
tag : 'done' // tag : 'done'
}; // };
that.listParams = req; // that.listParams = req;
this.$API.wpm.wmaterial.list.req(req).then((res) => { // this.$API.wpm.wmaterial.list.req(req).then((res) => {
that.materialOptions = res; // that.materialOptions = res;
}); // });
}, // },
// //
getMaterialFP() { // getMaterialFP() {
let that = this; // let that = this;
that.materialOptions = []; // that.materialOptions = [];
var obj = { // var obj = {
page: 0, // page: 0,
state : 50, // state : 50,
state_all: 1 // state_all: 1
}; // };
that.$API.wpm.wmaterial.list.req(obj).then((res) => { // that.$API.wpm.wmaterial.list.req(obj).then((res) => {
that.materialOptions = res; // that.materialOptions = res;
}); // });
}, // },
// //
getUserList() { getUserList() {
let that = this; let that = this;
@ -521,21 +548,47 @@ export default {
this.visible = true; this.visible = true;
return this; return this;
}, },
materialChange() { materialChange0(){
let that = this; let that = this;
let totalCount = 0; let obj = {};
let data = that.materialOptions.filter((item) => { obj.wm = that.selectObj.id;
return that.selectItems.indexOf(item.id)>-1; obj.batch = that.selectObj.batch;
obj.label = that.selectObj.defect !== null?that.selectObj.batch+'('+that.selectObj.material_name+')'+that.selectObj.defect_name:that.selectObj.batch+'('+that.selectObj.material_name+')';
obj.count = that.selectObj.count_cando;
obj.defect_name = that.selectObj.defect_name;
obj.count_cando = that.selectObj.count_cando;
obj.material = that.selectObj.material;
if(that.form.handoverb.length>0){
let datas = that.form.handoverb.filter((item) => {
return item.wm==that.selectObj.id;
}); });
data.forEach(item=>{ if(datas.length>0){
item.wm = item.id; that.$message.warning('该物料已存在');
item.count = item.count_cando; }else{
totalCount += Number(item.count_cando); that.totalCount += Number(obj.count_cando);
}) that.form.handoverb.push(obj);
that.totalCount = totalCount; }
that.form.handoverb = data; }else{
that.getResaveMgroups(data[0].material); that.totalCount += Number(obj.count_cando);
that.form.handoverb.push(obj);
}
that.getResaveMgroups(obj.material);
}, },
// materialChange() {
// let that = this;
// let totalCount = 0;
// let data = that.materialOptions.filter((item) => {
// return that.selectItems.indexOf(item.id)>-1;
// });
// data.forEach(item=>{
// item.wm = item.id;
// item.count = item.count_cando;
// totalCount += Number(item.count_cando);
// })
// that.totalCount = totalCount;
// that.form.handoverb = data;
// that.getResaveMgroups(data[0].material);
// },
countChange(){ countChange(){
let that = this; let that = this;
let totalCount = 0; let totalCount = 0;
@ -628,18 +681,36 @@ export default {
if(arr.length>0){ if(arr.length>0){
that.$message.error("该批次已存在") that.$message.error("该批次已存在")
}else{ }else{
that.materialOptions.forEach((item) => { let params = {mgroup: that.mgroupId,page: 0,state__in:res.state,search:res.batch,tag : 'done'};
if(item.batch == res.batch){ if(that.type==10){
params.state__in = '10';
}else if(that.type==20){
params.state__in = '20,34';
}
that.$API.wpm.wmaterial.list.req(params).then((res1) => {
if(res1.length>0){
res1.forEach(item=>{
let cando = Number(item.count_canhandover);
if(cando>0&&item.defect_name==res.defect_name){
let obj = {}; let obj = {};
obj.wm = item.id; obj.wm = item.id;
obj.batch = item.batch; obj.batch = item.batch;
obj.counts = item.count; obj.label = item.defect !== null?item.batch+'('+item.material_name+')'+item.defect_name:item.batch+'('+item.material_name+')';
obj.count = item.count; obj.count = item.count_cando;
obj.defect_name = item.defect_name;
obj.count_cando = item.count_cando;
obj.material = item.material;
that.form.handoverb.push(obj) that.form.handoverb.push(obj)
that.getResaveMgroups(item.material); that.getResaveMgroups(obj.material);
} }
// else{
// that.$message.error("")
// }
}) })
} }
that.codeText = '';
});
}
}) })
// //
this.scanVisible = false; this.scanVisible = false;