fix:输入物料操作项

This commit is contained in:
shijing 2025-07-21 13:49:13 +08:00
parent 40d31912e7
commit f159b63515
1 changed files with 97 additions and 87 deletions

View File

@ -99,37 +99,6 @@
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="波数" min-width="80px" v-if="mode == 'ins'&&route_code=='niuzhuan'">
<template #default="scope">
<el-select
v-if="scope.row.isEdit"
v-model="scope.row.wave_number"
placeholder="波数"
clearable
style="width: 100%"
>
<el-option
v-for="item in 10"
:key="item"
:label="item"
:value="item"
></el-option>
</el-select>
<span v-else>{{ scope.row.wave_number }}</span>
</template>
</el-table-column>
<!-- <el-table-column label="扭转角设定值" min-width="80px" v-if="mode == 'ins'&&route_code=='niuzhuan'">
<template #default="scope">
<el-input-number
v-if="scope.row.isEdit"
v-model="scope.row.work_time"
style="width: 100%;"
controls-position="right"
:precision="3"
></el-input-number>
<span v-else>{{ scope.row.work_time }}</span>
</template>
</el-table-column> -->
<el-table-column prop="note" :label="item.testitem_name" v-for="item in testitems" :key="item.id" width="150px"> <el-table-column prop="note" :label="item.testitem_name" v-for="item in testitems" :key="item.id" width="150px">
<template #default="scope"> <template #default="scope">
<span v-if="!scope.row.isEdit||!item.canEdit">{{ scope.row[item.testitem_name] }}</span> <span v-if="!scope.row.isEdit||!item.canEdit">{{ scope.row[item.testitem_name] }}</span>
@ -514,7 +483,7 @@ export default {
ins:'输入物料详情', ins:'输入物料详情',
outs:'输出物料详情', outs:'输出物料详情',
}, },
mode:'ins', mode:'',
// //
form: { form: {
test_user:"", test_user:"",
@ -587,10 +556,7 @@ export default {
}, },
mounted() { mounted() {
let that = this; let that = this;
this.route_code = this.$route.path.split("/")[2]; that.route_code = that.$route.path.split("/")[2];
if(this.route_code=='niuzhuan'&&that.mode == 'ins'){
// that.gettestitem();
}
that.hideAdd = that.isSubmit; that.hideAdd = that.isSubmit;
if(that.mgroupName=='排一次棒'||that.mgroupName=='排板'){ if(that.mgroupName=='排一次棒'||that.mgroupName=='排板'){
// that.getNewNumber(); // that.getNewNumber();
@ -599,9 +565,12 @@ export default {
that.currentDate = that.$TOOL.dateFormat2(new Date()); that.currentDate = that.$TOOL.dateFormat2(new Date());
}, },
methods: { methods: {
open(mode = "ins",qct = '') { open(mode = "",qct = '') {
let that = this; let that = this;
this.mode = mode; this.mode = mode;
if(that.route_code=='niuzhuan'&&that.mode == 'ins'){
that.gettestitem();
}
if(that.mode == 'ins'&&that.route_code!=='niuzhuan'){// if(that.mode == 'ins'&&that.route_code!=='niuzhuan'){//
that.getOptions(); that.getOptions();
that.qct = "" that.qct = ""
@ -622,17 +591,25 @@ export default {
gettestitem(){ gettestitem(){
let that = this; let that = this;
that.$API.qm.qct.getQct.req({ material: that.material_in,type:'in',tag:'process' }).then((res) => { that.$API.qm.qct.getQct.req({ material: that.material_in,type:'in',tag:'process' }).then((res) => {
console.log('gettestitem',res); that.qct = res.id;
// that.qct = res[0].id;
that.testitems = []; that.testitems = [];
// let list = res[0].qct_testitems; let list = res.qct_testitems;
// list.forEach(item=>{ list.forEach(item=>{
// let obj = Object.assign({}, item); if(item.testitem_type=='20'){
// obj.value = null; let obj = Object.assign({}, item);
// obj.canEdit = true; obj.value = null;
// obj.addto_wpr = item.addto_wpr; obj.canEdit = true;
// that.testitems.push(obj) if(item.testitem_field_type=='input-number'||item.testitem_field_type=='input-int'){
// }) obj.value = null;
}
if(item.testitem_field_type=='select-text'||item.testitem_field_type=='selects-text'){
let str = obj.testitem_choices.replace(/'/g, '"');
let arr = JSON.parse(str);
obj.testitem_choices = arr;
}
that.testitems.push(obj)
}
})
}); });
}, },
getNewNumber(){ getNewNumber(){
@ -709,22 +686,24 @@ export default {
that.qct_defects_origin = that.qct_defects; that.qct_defects_origin = that.qct_defects;
that.qct_testitems = []; that.qct_testitems = [];
res.qct_testitems.forEach((item2) => { res.qct_testitems.forEach((item2) => {
let obj2 = Object.assign({}, item2); if(item2.type=='10'){
obj2.value = ''; let obj2 = Object.assign({}, item2);
obj2.canEdit = that.processType=='20'?false:true; obj2.value = '';
obj2.canEdit = that.processType=='20'?false:true;
obj2.addto_wpr = item2.addto_wpr;
if(item2.testitem_field_type=='input-number'||item2.testitem_field_type=='input-int'){ obj2.addto_wpr = item2.addto_wpr;
obj2.value = null; if(item2.testitem_field_type=='input-number'||item2.testitem_field_type=='input-int'){
that.addTemplate[item2.testitem_name] = null; obj2.value = null;
that.addTemplate[item2.testitem_name] = null;
}
if(item2.testitem_field_type=='select-text'||item2.testitem_field_type=='selects-text'){
let str = obj2.testitem_choices.replace(/'/g, '"');
let arr = JSON.parse(str);
obj2.testitem_choices = arr;
that.addTemplate[item2.testitem_name] = null;
}
that.qct_testitems.push(obj2);
} }
if(item2.testitem_field_type=='select-text'||item2.testitem_field_type=='selects-text'){
let str = obj2.testitem_choices.replace(/'/g, '"');
let arr = JSON.parse(str);
obj2.testitem_choices = arr;
that.addTemplate[item2.testitem_name] = null;
}
that.qct_testitems.push(obj2);
}) })
that.qct_testitems_origin = that.qct_testitems; that.qct_testitems_origin = that.qct_testitems;
that.getList(); that.getList();
@ -802,30 +781,55 @@ export default {
} }
}); });
// //
if(row.ftest!==null&&row.ftest!==undefined&&row.ftest!==''){ // if(row.ftest!==null&&row.ftest!==undefined&&row.ftest!==''){
console.log('已填过'); // console.log('');
obj.ftest =row.ftest; // obj.ftest =row.ftest;
obj.ftest.ftestdefects.forEach((item) => { // obj.ftest.ftestdefects.forEach((item) => {
item.has = row[item.defect_name]; // item.has = row[item.defect_name];
}) // })
row.ftest.ftestitems.forEach((item1) => { // row.ftest.ftestitems.forEach((item1) => {
item1.test_val_json = row[item1.testitem_name]; // item1.test_val_json = row[item1.testitem_name];
}) // })
}else{// // }else{//
console.log('未填过'); // console.log('');
obj.ftest = {}; // obj.ftest = {};
obj.ftest.ftestitems = []; // obj.ftest.ftestitems = [];
obj.ftest.ftestdefects = []; // obj.ftest.ftestdefects = [];
obj.ftest.qct = that.qct; // obj.ftest.qct = that.qct;
obj.ftest.test_date = that.handle_date!=null?that.handle_date:that.currentDate; // obj.ftest.test_date = that.handle_date!=null?that.handle_date:that.currentDate;
obj.ftest.test_user = that.handle_user; // obj.ftest.test_user = that.handle_user;
that.qct_defects_origin.forEach((item) => { // that.qct_defects_origin.forEach((item) => {
// let itemObj = {};
// itemObj.defect = item.defect;
// itemObj.test_user = that.handle_user;
// itemObj.has = row[item.defect_name]?row[item.defect_name]:false;
// obj.ftest.ftestdefects.push(itemObj);
// })
// that.qct_testitems.forEach((item1) => {
// let itemObj1 = {};
// itemObj1.testitem = item1.testitem;
// itemObj1.test_user = that.handle_user;
// itemObj1.addto_wpr = item1.addto_wpr;
// itemObj1.test_val_json = row[item1.testitem_name];
// obj.ftest.ftestitems.push(itemObj1);
// })
// }
obj.ftest = {};
obj.ftest.ftestitems = [];
obj.ftest.ftestdefects = [];
obj.ftest.qct = that.qct;
obj.ftest.test_date = that.handle_date!=null?that.handle_date:that.currentDate;
obj.ftest.test_user = that.handle_user;
if(that.qct_defects.length>0){
that.qct_defects.forEach((item) => {
let itemObj = {}; let itemObj = {};
itemObj.defect = item.defect; itemObj.defect = item.defect;
itemObj.test_user = that.handle_user; itemObj.test_user = that.handle_user;
itemObj.has = row[item.defect_name]?row[item.defect_name]:false; itemObj.has = row[item.defect_name]?row[item.defect_name]:false;
obj.ftest.ftestdefects.push(itemObj); obj.ftest.ftestdefects.push(itemObj);
}) })
}
if(that.qct_testitems.length>0){
that.qct_testitems.forEach((item1) => { that.qct_testitems.forEach((item1) => {
let itemObj1 = {}; let itemObj1 = {};
itemObj1.testitem = item1.testitem; itemObj1.testitem = item1.testitem;
@ -834,16 +838,22 @@ export default {
itemObj1.test_val_json = row[item1.testitem_name]; itemObj1.test_val_json = row[item1.testitem_name];
obj.ftest.ftestitems.push(itemObj1); obj.ftest.ftestitems.push(itemObj1);
}) })
} }
if(that.mode == 'ins'&&that.route_code=='niuzhuan'&&that.testitems.length>0){
obj.equip = row.equip;
obj.work_start_time = row.work_start_time;
that.testitems.forEach((item1) => {
let itemObj1 = {};
itemObj1.testitem = item1.testitem;
itemObj1.test_user = that.handle_user;
itemObj1.addto_wpr = item1.addto_wpr;
itemObj1.test_val_json = row[item1.testitem_name];
obj.ftest.ftestitems.push(itemObj1);
})
}
}else{ }else{
obj.ftest = null; obj.ftest = null;
} }
if(that.mode == 'ins'&&that.route_code=='niuzhuan'){
obj.equip = row.equip;
obj.work_start_time = row.work_start_time;
obj.work_time = row.work_time;
obj.wave_number = row.wave_number;
}
if(row.id!==''&&row.id!==undefined&&row.id!==null){ if(row.id!==''&&row.id!==undefined&&row.id!==null){
obj.id = row.id; obj.id = row.id;
that.$API.wpm.mlogbw.update.req(row.id,obj).then((res) => { that.$API.wpm.mlogbw.update.req(row.id,obj).then((res) => {