fix:mlogbw

This commit is contained in:
shijing 2025-01-10 10:58:01 +08:00
parent f1c363ed23
commit f01b1a6c9d
1 changed files with 88 additions and 140 deletions

View File

@ -105,76 +105,6 @@
></el-switch> ></el-switch>
</template> </template>
</el-table-column> </el-table-column>
<!-- <el-table-column prop="note" :label="item.testitem_name" v-for="item in scope.row.ftest.ftestitems" :key="item.id">
<template #default="scope">
<el-input-number
v-if="item.testitem_field_type=='input-number'"
v-model="item.test_val_json"
:min="0"
class="width-100"
controls-position="right"
@change="defectCountSun(scope.row)"
>
</el-input-number>
<el-input-number
v-if="item.testitem_field_type=='input-int'"
v-model="item.test_val_json"
: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'"
v-model="item.test_val_json"
class="width-100"
@change="defectCountSun(scope.row)"
>
</el-input>
<el-select
v-if="item.testitem_field_type=='select-text'"
v-model="item.test_val_json"
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'"
v-model="item.test_val_json"
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 :label="item1.defect_name" v-for="item1 in scope.row.ftest.ftestdefects" :key="item1.id">
<template #default="scope">
<el-switch
:disabled="!scope.row.isEdit"
v-model="item1.has"
style="--el-switch-on-color: red"
@change="switchChange(scope.row, item)"
></el-switch>
</template>
</el-table-column> -->
<el-table-column prop="note" label="备注"> <el-table-column prop="note" label="备注">
<template #default="scope"> <template #default="scope">
<span v-if="!scope.row.isEdit">{{ scope.row.note }}</span> <span v-if="!scope.row.isEdit">{{ scope.row.note }}</span>
@ -280,6 +210,7 @@ export default {
}, },
getdefects(){ getdefects(){
let that = this; let that = this;
if(that.qct!==null&&that.qct!==''){
that.$API.qm.qct.item.req(that.qct).then((res) => { that.$API.qm.qct.item.req(that.qct).then((res) => {
that.qct_defects = []; that.qct_defects = [];
res.qct_defects.forEach((item) => { res.qct_defects.forEach((item) => {
@ -299,6 +230,7 @@ export default {
that.qct_testitems.push(obj2); that.qct_testitems.push(obj2);
}) })
}) })
}
}, },
getOptions(){ getOptions(){
let that = this; let that = this;
@ -324,15 +256,26 @@ export default {
res.forEach((item) => { res.forEach((item) => {
let obj = Object.assign({},item); let obj = Object.assign({},item);
obj.isEdit = false; obj.isEdit = false;
if(item.ftest.ftestdefects.length>0){ if(that.qct!==null&&that.qct!==''){
if(item.ftest&&item.ftest.ftestdefects&&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.ftestitems.length>0){ if(item.ftest&&item.ftest.ftestitems&&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] = "";
})
}
} }
that.mlogbwlist.push(obj); that.mlogbwlist.push(obj);
}) })
@ -346,11 +289,15 @@ export default {
obj.number = row.number; obj.number = row.number;
obj.mlogb = row.mlogb; obj.mlogb = row.mlogb;
obj.note = row.note; obj.note = row.note;
if(that.qct!==null&&that.qct!==''){
obj.ftest = {}; obj.ftest = {};
obj.ftest.ftestitems = []; obj.ftest.ftestitems = [];
obj.ftest.ftestdefects = []; obj.ftest.ftestdefects = [];
if(row.id!=''&&row.id!==undefined&&row.id!==null){ if(row.ftest&&row.ftest.id){
obj.id = row.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.qct = row.ftest.qct;
obj.ftest.test_date = row.ftest.test_date; obj.ftest.test_date = row.ftest.test_date;
obj.ftest.test_user = row.ftest.test_user; obj.ftest.test_user = row.ftest.test_user;
@ -389,8 +336,9 @@ export default {
obj.ftest.ftestitems.push(itemObj1); obj.ftest.ftestitems.push(itemObj1);
}) })
} }
}
if(row.id!==''&&row.id!==undefined&&row.id!==null){ if(row.id!==''&&row.id!==undefined&&row.id!==null){
obj.ftest.id = row.ftest.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) => {
that.$message.success("保存成功"); that.$message.success("保存成功");
that.getList(); that.getList();