fix:添加输入输出的检验物料

This commit is contained in:
shijing 2025-07-21 10:48:07 +08:00
parent cf5bcc69b7
commit 40d31912e7
1 changed files with 113 additions and 43 deletions

View File

@ -83,42 +83,106 @@
<span v-else>{{ scope.row.equip_name }}</span>
</template>
</el-table-column>
<el-table-column label="开始时间" min-width="80px" v-if="mode == 'ins'&&route_code=='niuzhuan'">
<el-table-column label="扭转日期" min-width="80px" v-if="mode == 'ins'&&route_code=='niuzhuan'">
<template #default="scope">
<el-date-picker
v-if="scope.row.isEdit"
v-model="scope.row.work_start_time"
type="datetime"
value-format="YYYY-MM-DD HH:mm:ss"
formatter="YYYY-MM-DD"
style="width: 100%;"
popper-append-to-body
/>
<span v-else>{{ scope.row.work_start_time }}</span>
<div v-else>
<span v-if="scope.row.work_start_time!==null">{{ scope.row.work_start_time.split(' ')[0]}}</span>
</div>
</template>
</el-table-column>
<el-table-column label="扭转时间" min-width="80px" v-if="mode == 'ins'&&route_code=='niuzhuan'">
<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"
@change="workTimeCountSun(scope.row)"
:precision="3"
></el-input-number>
<span v-else>{{ scope.row.work_time }}</span>
</template>
</el-table-column>
<el-table-column label="结束时间" min-width="80px" v-if="mode == 'ins'&&route_code=='niuzhuan'">
</el-table-column> -->
<el-table-column prop="note" :label="item.testitem_name" v-for="item in testitems" :key="item.id" width="150px">
<template #default="scope">
<el-date-picker
v-if="scope.row.isEdit"
v-model="scope.row.work_end_time"
type="datetime"
value-format="YYYY-MM-DD HH:mm:ss"
style="width: 100%;"
popper-append-to-body
/>
<span v-else>{{ scope.row.work_end_time }}</span>
<span v-if="!scope.row.isEdit||!item.canEdit">{{ scope.row[item.testitem_name] }}</span>
<el-input-number
v-if="item.testitem_field_type=='input-number'&&scope.row.isEdit&&item.canEdit"
v-model="scope.row[item.testitem_name]"
class="width-100"
controls-position="right"
@change="defectCountSun(scope.row)"
></el-input-number>
<el-input-number
v-if="item.testitem_field_type=='input-int'&&scope.row.isEdit&&item.canEdit"
v-model="scope.row[item.testitem_name]"
:min="0"
class="width-100"
controls-position="right"
@change="defectCountSun(scope.row)"
></el-input-number>
<el-input
v-if="item.testitem_field_type=='input-text'&&scope.row.isEdit&&item.canEdit"
v-model="scope.row[item.testitem_name]"
class="width-100"
@change="defectCountSun(scope.row)"
></el-input>
<el-select
v-if="item.testitem_field_type=='select-text'&&scope.row.isEdit&&item.canEdit"
v-model="scope.row[item.testitem_name]"
clearable
class="width-100"
@change="defectCountSun(scope.row)"
>
<el-option
v-for="item0 in item.testitem_choices"
:key="item0"
:label="item0"
:value="item0"
></el-option>
</el-select>
<el-select
v-if="item.testitem_field_type=='selects-text'&&scope.row.isEdit&&item.canEdit"
v-model="scope.row[item.testitem_name]"
clearable
multiple
class="width-100"
@change="defectCountSun(scope.row)"
>
<el-option
v-for="item1 in item.testitem_choices"
:key="item1"
:label="item1"
:value="item1"
></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column prop="note" :label="item.testitem_name" v-for="item in qct_testitems" :key="item.id" width="150px">
@ -430,6 +494,10 @@ export default {
type:String,
default:"",
},
material_in:{
type:String,
default:"",
},
processType:{
type:String,
default:"",
@ -477,6 +545,7 @@ export default {
qct_defects:[],
qct_testitems:[],
mlogbwlist:[],
testitems:[],
equipmentOptions:[],
addTemplate:{
mlogb: "",
@ -519,9 +588,9 @@ export default {
mounted() {
let that = this;
this.route_code = this.$route.path.split("/")[2];
// if(this.route_code=='niuzhuan'){
// this.getEquipment4();
// }
if(this.route_code=='niuzhuan'&&that.mode == 'ins'){
// that.gettestitem();
}
that.hideAdd = that.isSubmit;
if(that.mgroupName=='排一次棒'||that.mgroupName=='排板'){
// that.getNewNumber();
@ -549,6 +618,23 @@ export default {
that.tableHeight = document.getElementById('mlogbwMain').clientHeight-20;
},500)
},
//testItem
gettestitem(){
let that = this;
that.$API.qm.qct.getQct.req({ material: that.material_in,type:'in',tag:'process' }).then((res) => {
console.log('gettestitem',res);
// that.qct = res[0].id;
that.testitems = [];
// let list = res[0].qct_testitems;
// list.forEach(item=>{
// let obj = Object.assign({}, item);
// obj.value = null;
// obj.canEdit = true;
// obj.addto_wpr = item.addto_wpr;
// that.testitems.push(obj)
// })
});
},
getNewNumber(){
let that = this;
let date = new Date();
@ -590,8 +676,6 @@ export default {
}else if(num<1000){
num = "0"+num;
}
console.log('num',num);
console.log('data.number:',data.number);
if(that.mgroupName=='排一次棒'){
that.addTemplate.number = years+months+num;
}
@ -599,18 +683,10 @@ export default {
that.addTemplate.number = years+ months + that.material_model+num;
}
},
workTimeCountSun(row){
let that = this;
let time = row.work_time*60*1000;
let index = that.mlogbwlist.indexOf(row);
let end = new Date(row.work_start_time).getTime()+time;
let end_time = that.$TOOL.dateFormat(new Date(end), 'yyyy-MM-dd hh:mm:ss');
that.mlogbwlist[index].work_end_time = end_time;
},
getEquipment4() {
let that = this;
that.$API.em.equipment.list.req({page:0,cate__code:"4",query:"{id,name,number}"}).then((res) => {
that.optionsEq = res;
that.optionsEq = res.reverse();
})
},
getEquipments(){
@ -681,12 +757,6 @@ export default {
let obj = {};
obj = Object.assign({},item);
obj.isEdit = false;
if(obj.work_start_time!==null&&obj.work_start_time!==''&&obj.work_end_time!==null&&obj.work_end_time!==''){
let start = new Date(obj.work_start_time).getTime();
let end = new Date(obj.work_end_time).getTime();
let time = (end-start)/60000;
obj.work_time = time;
}
if(that.qct!=''){
if(item.ftest!=null){
if(item.ftest.ftestdefects!==undefined&&item.ftest.ftestdefects!==''&&item.ftest.ftestdefects!==null&&item.ftest.ftestdefects.length>0){
@ -722,7 +792,7 @@ export default {
obj.wpr = row.wpr;
obj.note = row.note;
//qct
if(that.qct!==''){
if(that.qct!==''&&that.qct!==null){
that.qct_defects_origin.forEach(item => {
if(item.rule_expression!==''&&item.rule_expression!==undefined&&item.rule_expression!==null){
let str = item.rule_expression.replace(/`/g, '');
@ -765,13 +835,14 @@ export default {
obj.ftest.ftestitems.push(itemObj1);
})
}
}else{
obj.ftest = null;
}
// console.log('obj',obj);
if(that.mode == 'ins'&&that.route_code=='niuzhuan'){
obj.equip = row.equip;
obj.work_start_time = row.work_start_time;
obj.work_end_time = row.work_end_time;
obj.work_time = row.work_time;
obj.wave_number = row.wave_number;
}
if(row.id!==''&&row.id!==undefined&&row.id!==null){
obj.id = row.id;
@ -807,8 +878,6 @@ export default {
that.mlogbwlist.forEach((item, index) => {
if (item.id == row.id) {
that.mlogbwlist[index].isEdit = true;
console.log('row',row);
console.log('that.qct_testitems',that.qct_testitems);
let date = new Date();
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');
@ -855,7 +924,6 @@ export default {
let that = this;
let index = that.mlogbwlist.indexOf(row);
that.qct_defects_origin.forEach(item => {
// console.log('item.rule_expression',item.rule_expression);
if(item.rule_expression!==''&&item.rule_expression!==undefined&&item.rule_expression!==null){
let str = item.rule_expression.replace(/`/g, '');
str = str.replace(/\${(.*?)}/g, 'row.\$1')
@ -960,6 +1028,7 @@ export default {
},
checkSetting(){
let that = this;
that.isSaveing = true;
that.$refs.dialogForm.validate((valid) => {
if (valid) {
Object.assign(that.setForm,that.form);
@ -1020,8 +1089,10 @@ export default {
that.qct_testitems = [];
that.qct_testitems = that.testitemlists;
that.tableHeight = document.getElementById('mlogbwMain').clientHeight-80;
that.isSaveing = false;
that.getList();
}).catch((err) => {
that.isSaveing = false;
return err;
});
}
@ -1046,7 +1117,6 @@ export default {
that.mlogbwlist.forEach((item,index) => {
let indexs = item.number.indexOf(that.wprInputText)
if(indexs>-1&&that.wprInputText !== ""){
// console.log(item.number,that.wprInputText,indexs,indexs>-1);
// if(item.number == that.wprInputText){
let obj = Object.assign({},item);
obj.isEdit = true;