feat:wpr工装调整放到pre_info中,以及日志中把工装tooling保存到mlobw中

This commit is contained in:
shijing 2026-05-27 10:19:34 +08:00
parent c7d79b12df
commit 27c8dd3139
2 changed files with 60 additions and 3 deletions

View File

@ -47,6 +47,7 @@
<th class="w_140 sticky-cell sticky-left-number">物料编号</th> <th class="w_140 sticky-cell sticky-left-number">物料编号</th>
<th class="w_150" v-if="route_code=='niuzhuan'">生产设备</th> <th class="w_150" v-if="route_code=='niuzhuan'">生产设备</th>
<th class="w_180" v-if="route_code=='niuzhuan'">扭转日期</th> <th class="w_180" v-if="route_code=='niuzhuan'">扭转日期</th>
<th class="w_150" v-if="mgroupName=='喷码'">工装</th>
<th class="w_80" v-for="item in qct_testitems" :key="item.id">{{ item.testitem_name }}</th> <th class="w_80" v-for="item in qct_testitems" :key="item.id">{{ item.testitem_name }}</th>
<th class="w_80" v-for="item in qct_defects" :key="item.id">{{ item.defect_name }}</th> <th class="w_80" v-for="item in qct_defects" :key="item.id">{{ item.defect_name }}</th>
<th class="w_80">备注</th> <th class="w_80">备注</th>
@ -83,6 +84,14 @@
<div v-else> <div v-else>
<span v-if="row.work_start_time!==null">{{ row.work_start_time}}</span> <span v-if="row.work_start_time!==null">{{ row.work_start_time}}</span>
</div> </div>
</td>
<td class="w_150 " v-if="mgroupName=='喷码'">
<select name="tooling" id="tooling-select" v-if="row.isEdit" style="width: 100%;" v-model="row.tooling" :value="row.tooling">
<option v-for="item in optionsTooling" :key="item.id" :value="item.id">
{{ item.name }}
</option>
</select>
<span v-else>{{ getToolingName(row.wpr_pre_info?.tooling) || row.tooling_name }}</span>
</td> </td>
<td class="w_80 " v-for="item in qct_testitems" :key="item.id"> <td class="w_80 " v-for="item in qct_testitems" :key="item.id">
<span v-if="!row.isEdit || !item.canEdit">{{ row[item.testitem_name] }}</span> <span v-if="!row.isEdit || !item.canEdit">{{ row[item.testitem_name] }}</span>
@ -432,6 +441,7 @@ export default {
}, },
optionsEq:[], optionsEq:[],
optionsTooling:[],
defectlists:[], defectlists:[],
testitemlists:[], testitemlists:[],
selectWprList:[], selectWprList:[],
@ -460,6 +470,9 @@ export default {
if(that.route_code=='niuzhuan'){ if(that.route_code=='niuzhuan'){
that.getEquipment4(); that.getEquipment4();
} }
if(that.mgroupName=='喷码'){
that.getToolings();
}
if(that.qct!==''&&that.qct!==null){// if(that.qct!==''&&that.qct!==null){//
that.getdefects(); that.getdefects();
}else{ }else{
@ -551,6 +564,31 @@ export default {
that.optionsEq = res.reverse(); that.optionsEq = res.reverse();
}) })
}, },
getToolings() {
let that = this;
that.$API.em.equipment.list.req({page:0,type:10,cate__code:"7",query:"{id,name,number}"}).then((res) => {
that.optionsTooling = Array.isArray(res) ? res : (res.results || []);
})
},
getToolingName(id) {
if (!id) return '';
const item = this.optionsTooling.find(t => t.id == id);
return item ? item.name : id;
},
autoSyncTooling() {
const that = this;
if (that.mgroupName !== '喷码') return;
that.mlogbwlist.forEach((row) => {
const wprTooling = row.wpr_pre_info?.tooling;
if (wprTooling && row.tooling != wprTooling && row.id) {
that.$API.wpm.mlogbw.update.req(row.id, { tooling: wprTooling,number:row.number,mlogb:row.mlogb }).then((res) => {
row.tooling = res.tooling;
row.tooling_name = res.tooling_name;
row.tooling_number = res.tooling_number;
}).catch(() => {});
}
});
},
getEquipments(){ getEquipments(){
let that = this; let that = this;
that.$API.em.equipment.list.req({page:0,cate__code:"6"}).then((res) => { that.$API.em.equipment.list.req({page:0,cate__code:"6"}).then((res) => {
@ -690,6 +728,9 @@ export default {
that.mlogbwlist.push(obj); that.mlogbwlist.push(obj);
}) })
} }
that.$nextTick(() => {
that.autoSyncTooling();
});
}) })
}, },
widthFun(item){ widthFun(item){
@ -719,6 +760,9 @@ export default {
if(row.equip){ if(row.equip){
obj.equip = row.equip; obj.equip = row.equip;
} }
if(row.tooling){
obj.tooling = row.tooling;
}
//qct //qct
if((that.qct!==''&&that.qct!==null)||(that.qctId!==''&&that.qctId!==null)){ if((that.qct!==''&&that.qct!==null)||(that.qctId!==''&&that.qctId!==null)){
obj.ftest = {}; obj.ftest = {};
@ -762,6 +806,8 @@ export default {
that.mlogbwlist[editIndex].isEdit = false; that.mlogbwlist[editIndex].isEdit = false;
that.mlogbwlist[editIndex].equip_name = res.equip_name; that.mlogbwlist[editIndex].equip_name = res.equip_name;
that.mlogbwlist[editIndex].equip_number = res.equip_number; that.mlogbwlist[editIndex].equip_number = res.equip_number;
that.mlogbwlist[editIndex].tooling_name = res.tooling_name;
that.mlogbwlist[editIndex].tooling_number = res.tooling_number;
that.mlogbwlist[editIndex].work_start_time = res.work_start_time; that.mlogbwlist[editIndex].work_start_time = res.work_start_time;
// that.getList(); // that.getList();
return res; return res;
@ -778,6 +824,8 @@ export default {
that.mlogbwlist[editIndex].isEdit = false; that.mlogbwlist[editIndex].isEdit = false;
that.mlogbwlist[editIndex].equip_name = res.equip_name; that.mlogbwlist[editIndex].equip_name = res.equip_name;
that.mlogbwlist[editIndex].equip_number = res.equip_number; that.mlogbwlist[editIndex].equip_number = res.equip_number;
that.mlogbwlist[editIndex].tooling_name = res.tooling_name;
that.mlogbwlist[editIndex].tooling_number = res.tooling_number;
that.mlogbwlist[editIndex].work_start_time = res.work_start_time; that.mlogbwlist[editIndex].work_start_time = res.work_start_time;
// that.getList(); // that.getList();
return res; return res;
@ -796,6 +844,12 @@ export default {
formTableEdit(index) { formTableEdit(index) {
let that = this; let that = this;
that.mlogbwlist[index].isEdit = true; that.mlogbwlist[index].isEdit = true;
if(that.mgroupName=='喷码'){
const wprTooling = that.mlogbwlist[index].wpr_pre_info?.tooling;
if(wprTooling && that.mlogbwlist[index].tooling != wprTooling){
that.mlogbwlist[index].tooling = wprTooling;
}
}
let date = new Date(); let date = new Date();
if(that.mlogbwlist[index].work_start_time==''||that.mlogbwlist[index].work_start_time==null){ if(that.mlogbwlist[index].work_start_time==''||that.mlogbwlist[index].work_start_time==null){
that.mlogbwlist[index].work_start_time = that.$TOOL.dateFormat(date, 'yyyy-MM-dd hh:mm:ss'); that.mlogbwlist[index].work_start_time = that.$TOOL.dateFormat(date, 'yyyy-MM-dd hh:mm:ss');

View File

@ -69,7 +69,7 @@
<el-table-column label="工装" min-width="80px" v-if="mgroupName=='喷码'"> <el-table-column label="工装" min-width="80px" v-if="mgroupName=='喷码'">
<template #default="scope"> <template #default="scope">
<el-select <el-select
v-model="scope.row.pre_info.val" v-model="scope.row.pre_info.tooling"
placeholder="选择工装" placeholder="选择工装"
clearable clearable
size="small" size="small"
@ -205,7 +205,10 @@ export default {
getRowWpr(){ getRowWpr(){
let that = this; let that = this;
that.$API.wpm.wpr.list.req(that.params).then((res) => { that.$API.wpm.wpr.list.req(that.params).then((res) => {
that.wprList = res; that.wprList = (Array.isArray(res) ? res : []).map(row => ({
...row,
pre_info: row.pre_info || {},
}));
}) })
}, },
getToolingOptions(){ getToolingOptions(){
@ -216,7 +219,7 @@ export default {
}, },
handleToolingChange(row){ handleToolingChange(row){
let that = this; let that = this;
that.$API.wpm.wpr.update.req(row.id,{pre_info:{val:row.pre_info.val,name:"工装"}}).then(() => { that.$API.wpm.wpr.update.req(row.id,{pre_info:{tooling:row.pre_info.tooling}}).then(() => {
that.$message.success("工装更新成功"); that.$message.success("工装更新成功");
}); });
}, },