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