fix:mlogbw检测保存和编辑
This commit is contained in:
parent
397587bbeb
commit
24b4781f53
|
@ -41,6 +41,7 @@
|
||||||
v-if="item.testitem_field_type=='input-number'"
|
v-if="item.testitem_field_type=='input-number'"
|
||||||
v-model="scope.row[item.testitem_name]"
|
v-model="scope.row[item.testitem_name]"
|
||||||
:min="0"
|
:min="0"
|
||||||
|
:disabled="!scope.row.isEdit"
|
||||||
class="width-100"
|
class="width-100"
|
||||||
controls-position="right"
|
controls-position="right"
|
||||||
@change="defectCountSun(scope.row)"
|
@change="defectCountSun(scope.row)"
|
||||||
|
@ -50,6 +51,7 @@
|
||||||
v-if="item.testitem_field_type=='input-int'"
|
v-if="item.testitem_field_type=='input-int'"
|
||||||
v-model="scope.row[item.testitem_name]"
|
v-model="scope.row[item.testitem_name]"
|
||||||
:min="0"
|
:min="0"
|
||||||
|
:disabled="!scope.row.isEdit"
|
||||||
class="width-100"
|
class="width-100"
|
||||||
controls-position="right"
|
controls-position="right"
|
||||||
@change="defectCountSun(scope.row)"
|
@change="defectCountSun(scope.row)"
|
||||||
|
@ -59,6 +61,7 @@
|
||||||
v-if="item.testitem_field_type=='input-text'"
|
v-if="item.testitem_field_type=='input-text'"
|
||||||
v-model="scope.row[item.testitem_name]"
|
v-model="scope.row[item.testitem_name]"
|
||||||
class="width-100"
|
class="width-100"
|
||||||
|
:disabled="!scope.row.isEdit"
|
||||||
@change="defectCountSun(scope.row)"
|
@change="defectCountSun(scope.row)"
|
||||||
>
|
>
|
||||||
</el-input>
|
</el-input>
|
||||||
|
@ -67,6 +70,7 @@
|
||||||
v-model="scope.row[item.testitem_name]"
|
v-model="scope.row[item.testitem_name]"
|
||||||
clearable
|
clearable
|
||||||
class="width-100"
|
class="width-100"
|
||||||
|
:disabled="!scope.row.isEdit"
|
||||||
@change="defectCountSun(scope.row)"
|
@change="defectCountSun(scope.row)"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
|
@ -83,6 +87,7 @@
|
||||||
clearable
|
clearable
|
||||||
multiple
|
multiple
|
||||||
class="width-100"
|
class="width-100"
|
||||||
|
:disabled="!scope.row.isEdit"
|
||||||
@change="defectCountSun(scope.row)"
|
@change="defectCountSun(scope.row)"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
|
@ -95,7 +100,7 @@
|
||||||
</el-select>
|
</el-select>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="note" :label="item.defect_name" v-for="item in qct_defects" :key="item.id">
|
<el-table-column prop="note" :label="item.defect_name" v-for="item in qct_defects" :key="item.id" width="80px">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-switch
|
<el-switch
|
||||||
:disabled="!scope.row.isEdit"
|
:disabled="!scope.row.isEdit"
|
||||||
|
@ -121,6 +126,14 @@
|
||||||
@click="formTableSave(scope.row)"
|
@click="formTableSave(scope.row)"
|
||||||
>保存</el-button
|
>保存</el-button
|
||||||
>
|
>
|
||||||
|
<el-button
|
||||||
|
v-if="scope.row.isEdit"
|
||||||
|
text
|
||||||
|
type="primary"
|
||||||
|
size="small"
|
||||||
|
@click="formTableCancel(scope.row)"
|
||||||
|
>取消</el-button
|
||||||
|
>
|
||||||
<el-button
|
<el-button
|
||||||
v-else
|
v-else
|
||||||
text
|
text
|
||||||
|
@ -198,7 +211,6 @@ export default {
|
||||||
mounted() {
|
mounted() {
|
||||||
let that = this;
|
let that = this;
|
||||||
that.params.mlogb = that.addTemplate.mlogb = that.mlogb;
|
that.params.mlogb = that.addTemplate.mlogb = that.mlogb;
|
||||||
that.getList();
|
|
||||||
that.getOptions();
|
that.getOptions();
|
||||||
that.getdefects();
|
that.getdefects();
|
||||||
},
|
},
|
||||||
|
@ -219,17 +231,24 @@ export default {
|
||||||
that.qct_defects = res.qct_defects;
|
that.qct_defects = res.qct_defects;
|
||||||
that.qct_testitems = [];
|
that.qct_testitems = [];
|
||||||
res.qct_testitems.forEach((item2) => {
|
res.qct_testitems.forEach((item2) => {
|
||||||
that.addTemplate[item2.testitem_name] = '';
|
|
||||||
let obj2 = Object.assign({}, item2);
|
let obj2 = Object.assign({}, item2);
|
||||||
obj2.value = '';
|
obj2.value = '';
|
||||||
if(obj2.testitem_field_type=='select-text'||obj2.testitem_field_type=='selects-text'){
|
if(item2.testitem_field_type=='input-number'||item2.testitem_field_type=='input-int'){
|
||||||
|
obj2.value = 0;
|
||||||
|
that.addTemplate[item2.testitem_name] = 0;
|
||||||
|
}
|
||||||
|
if(item2.testitem_field_type=='select-text'||item2.testitem_field_type=='selects-text'){
|
||||||
let str = obj2.testitem_choices.replace(/'/g, '"');
|
let str = obj2.testitem_choices.replace(/'/g, '"');
|
||||||
let arr = JSON.parse(str);
|
let arr = JSON.parse(str);
|
||||||
obj2.testitem_choices = arr;
|
obj2.testitem_choices = arr;
|
||||||
|
that.addTemplate[item2.testitem_name] = '';
|
||||||
}
|
}
|
||||||
that.qct_testitems.push(obj2);
|
that.qct_testitems.push(obj2);
|
||||||
})
|
})
|
||||||
|
that.getList();
|
||||||
})
|
})
|
||||||
|
}else{
|
||||||
|
that.getList();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getOptions(){
|
getOptions(){
|
||||||
|
@ -251,35 +270,39 @@ export default {
|
||||||
},
|
},
|
||||||
getList(){
|
getList(){
|
||||||
let that = this;
|
let that = this;
|
||||||
that.mlogbwlist = [];
|
|
||||||
that.$API.wpm.mlogbw.list.req(that.params).then((res) => {
|
that.$API.wpm.mlogbw.list.req(that.params).then((res) => {
|
||||||
if(res.length>0){
|
if(res.length>0){
|
||||||
|
that.mlogbwlist = [];
|
||||||
res.forEach((item) => {
|
res.forEach((item) => {
|
||||||
let obj = Object.assign({},item);
|
let obj = {};
|
||||||
|
obj = Object.assign({},item);
|
||||||
obj.isEdit = false;
|
obj.isEdit = false;
|
||||||
if(that.qct!==null&&that.qct!==''){
|
if(that.qct!=null&&that.qct!=''&&item.ftest!=null){
|
||||||
if(item.ftest&&item.ftest.ftestdefects&&item.ftest.ftestdefects.length>0){
|
if(item.ftest.ftestdefects!==undefined&&item.ftest.ftestdefects!==''&&item.ftest.ftestdefects!==null&&item.ftest.ftestdefects.length>0){
|
||||||
item.ftest.ftestdefects.forEach((item1) => {
|
item.ftest.ftestdefects.forEach((item1) => {
|
||||||
obj[item1.defect_name] = item1.has;
|
obj[item1.defect_name] = item1.has;
|
||||||
})
|
})
|
||||||
}else{
|
|
||||||
that.qct_defects.forEach((item1) => {
|
|
||||||
obj[item1.defect_name] = false;
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if(item.ftest&&item.ftest.ftestitems&&item.ftest.ftestitems.length>0){
|
if(item.ftest.ftestitems!==undefined&&item.ftest.ftestitems!==''&&item.ftest.ftestitems!==null&&item.ftest.ftestitems.length>0){
|
||||||
item.ftest.ftestitems.forEach((item2) => {
|
item.ftest.ftestitems.forEach((item2) => {
|
||||||
obj[item2.testitem_name] = item2.test_val_json;
|
obj[item2.testitem_name] = item2.test_val_json;
|
||||||
})
|
})
|
||||||
}else{
|
|
||||||
that.qct_testitems.forEach((item2) => {
|
|
||||||
obj[item2.testitem_name] = "";
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
that.qct_defects.forEach((item1) => {
|
||||||
|
obj[item1.defect_name] = false;
|
||||||
|
})
|
||||||
|
that.qct_testitems.forEach((item2) => {
|
||||||
|
if(item2.testitem_field_type=='input-number'||item.testitem_field_type=='input-int'){
|
||||||
|
obj[item2.testitem_name] = 0;
|
||||||
|
}else{
|
||||||
|
obj[item2.testitem_name] = "";
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
that.mlogbwlist.push(obj);
|
that.mlogbwlist.push(obj);
|
||||||
})
|
})
|
||||||
|
console.log('mlogbwlistmlogbwlist',that.mlogbwlist);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -291,35 +314,24 @@ export default {
|
||||||
obj.mlogb = row.mlogb;
|
obj.mlogb = row.mlogb;
|
||||||
obj.wpr = row.wpr;
|
obj.wpr = row.wpr;
|
||||||
obj.note = row.note;
|
obj.note = row.note;
|
||||||
|
//qct不为空,有检验表
|
||||||
if(that.qct!==null&&that.qct!==''){
|
if(that.qct!==null&&that.qct!==''){
|
||||||
obj.ftest = {};
|
//检验表已经填过
|
||||||
obj.ftest.ftestitems = [];
|
if(row.ftest!==null){
|
||||||
obj.ftest.ftestdefects = [];
|
console.log('已填过');
|
||||||
if(row.ftest&&row.ftest.id){
|
obj.ftest =row.ftest;
|
||||||
obj.ftest.id =row.ftest.id;
|
obj.ftest.ftestdefects.forEach((item) => {
|
||||||
}
|
item.has = row[item.defect_name];
|
||||||
// obj.ftest.id = (row.ftest&&row.ftest.id)?row.ftest.id:'';
|
|
||||||
if(row.id!=''&&row.id!==undefined&&row.id!==null&&row.ftest&&row.ftest.ftestdefects){
|
|
||||||
obj.ftest.qct = row.ftest.qct;
|
|
||||||
obj.ftest.test_date = row.ftest.test_date;
|
|
||||||
obj.ftest.test_user = row.ftest.test_user;
|
|
||||||
row.ftest.ftestdefects.forEach((item) => {
|
|
||||||
let itemObj = {};
|
|
||||||
itemObj.id = item.id;
|
|
||||||
itemObj.defect = item.defect;
|
|
||||||
itemObj.test_user = item.test_user;
|
|
||||||
itemObj.has = row[item.defect_name]?row[item.defect_name]:false;
|
|
||||||
obj.ftest.ftestdefects.push(itemObj);
|
|
||||||
})
|
})
|
||||||
row.ftest.ftestitems.forEach((item1) => {
|
row.ftest.ftestitems.forEach((item1) => {
|
||||||
let itemObj1 = {};
|
item1.test_val_json = row[item1.testitem_name];
|
||||||
itemObj1.id = item1.id;
|
|
||||||
itemObj1.testitem = item1.testitem;
|
|
||||||
itemObj1.test_user = item1.test_user;
|
|
||||||
itemObj1.test_val_json = row[item1.testitem_name];
|
|
||||||
obj.ftest.ftestitems.push(itemObj1);
|
|
||||||
})
|
})
|
||||||
}else{
|
console.log('obj',obj);
|
||||||
|
}else{//检验表未填过
|
||||||
|
console.log('未填过');
|
||||||
|
obj.ftest = {};
|
||||||
|
obj.ftest.ftestitems = [];
|
||||||
|
obj.ftest.ftestdefects = [];
|
||||||
obj.ftest.qct = that.qct;
|
obj.ftest.qct = that.qct;
|
||||||
obj.ftest.test_date = that.handle_date;
|
obj.ftest.test_date = that.handle_date;
|
||||||
obj.ftest.test_user = that.handle_user;
|
obj.ftest.test_user = that.handle_user;
|
||||||
|
@ -358,6 +370,13 @@ export default {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
formTableCancel(row){
|
||||||
|
this.mlogbwlist.forEach((item, index) => {
|
||||||
|
if (item.id == row.id) {
|
||||||
|
this.mlogbwlist[index].isEdit = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
formTableEdit(row) {
|
formTableEdit(row) {
|
||||||
this.mlogbwlist.forEach((item, index) => {
|
this.mlogbwlist.forEach((item, index) => {
|
||||||
if (item.id == row.id) {
|
if (item.id == row.id) {
|
||||||
|
@ -405,10 +424,15 @@ export default {
|
||||||
let that = this;
|
let that = this;
|
||||||
let index = that.mlogbwlist.indexOf(row);
|
let index = that.mlogbwlist.indexOf(row);
|
||||||
that.qct_defects.forEach(item => {
|
that.qct_defects.forEach(item => {
|
||||||
let str = item.rule_expression.replace(/`/g, '');
|
console.log('item.rule_expression',item.rule_expression);
|
||||||
str = str.replace(/\${(.*?)}/g, 'row.\$1')
|
if(item.rule_expression!==''&&item.rule_expression!==undefined&&item.rule_expression!==null){
|
||||||
let judge = eval(str);
|
let str = item.rule_expression.replace(/`/g, '');
|
||||||
that.mlogbwlist[index][item.defect_name] = judge;
|
str = str.replace(/\${(.*?)}/g, 'row.\$1')
|
||||||
|
let judge = eval(str);
|
||||||
|
that.mlogbwlist[index][item.defect_name] = judge;
|
||||||
|
}else{
|
||||||
|
that.mlogbwlist[index][item.defect_name] = false;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
//设置过滤项
|
//设置过滤项
|
||||||
|
|
Loading…
Reference in New Issue