|
|
|
@ -40,14 +40,13 @@
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="不良类型" align="left" prop="defectCode" width="120">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<el-select v-model="scope.row.defectCode" placeholder="检验结果" clearable>
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="(item,index) in defectList"
|
|
|
|
|
:key="index"
|
|
|
|
|
:label="item.defectSubclass"
|
|
|
|
|
:value="item.defectCode"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
<el-button
|
|
|
|
|
size="mini"
|
|
|
|
|
type="text"
|
|
|
|
|
icon="el-icon-edit"
|
|
|
|
|
@click="handleDefectType(scope.row)"
|
|
|
|
|
v-hasPermi="['quality:qcIncome:edit']"
|
|
|
|
|
>不良数量</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="不良数量" align="left" prop="defectQuality" width="120">
|
|
|
|
@ -113,11 +112,32 @@
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
|
|
|
|
<el-dialog title="不良类型" :visible.sync="defectOpen" width="600px" append-to-body>
|
|
|
|
|
<el-form :model="defectForm" ref="defectForm" label-width="100px" class="demo-dynamic">
|
|
|
|
|
<el-form-item
|
|
|
|
|
v-for="(item, index) in defectForm.defectItems"
|
|
|
|
|
:label="item.defectSubclass"
|
|
|
|
|
:key="index"
|
|
|
|
|
:prop="`defectItems.${index}.noOkQuality`"
|
|
|
|
|
:rules="{
|
|
|
|
|
required: true, message: '不良类型不能为空', trigger: 'blur'
|
|
|
|
|
}"
|
|
|
|
|
>
|
|
|
|
|
<el-input type="number" v-model="item.noOkQuality" placeholder="请输入不良数量" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item>
|
|
|
|
|
<el-button type="primary" @click="submitDefectForm('defectForm')">提交</el-button>
|
|
|
|
|
<el-button @click="resetDefectForm('defectForm')">重置</el-button>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<script>
|
|
|
|
|
|
|
|
|
|
import { getCkeckProjectList,changeCheckDetailStatus,commitActualValue,commitCheckResult,getDefectList } from "@/api/quality/income";
|
|
|
|
|
import { getCkeckProjectList,changeCheckDetailStatus,commitActualValue,commitCheckResult,getDefectList} from "@/api/quality/income";
|
|
|
|
|
import { getDefectValue, commitDefectValue, updateDefectValue} from "@/api/quality/checkTaskDefect";
|
|
|
|
|
export default {
|
|
|
|
|
name: "itemSelectUser",
|
|
|
|
|
dicts: ["check_result","qc_rule_prop"],
|
|
|
|
@ -162,8 +182,28 @@ export default {
|
|
|
|
|
valueOpen: false,
|
|
|
|
|
//检测详情的id
|
|
|
|
|
recordId:'',
|
|
|
|
|
typeCode:'',//检测类型
|
|
|
|
|
defectList:[]//不良名称
|
|
|
|
|
//检测详情的belongTo
|
|
|
|
|
belongTo:'',
|
|
|
|
|
//检测类型
|
|
|
|
|
typeCode:'',
|
|
|
|
|
// 不良类型弹出层
|
|
|
|
|
defectOpen: false,
|
|
|
|
|
updateFlag: false,
|
|
|
|
|
//不良名称
|
|
|
|
|
defectList:[],
|
|
|
|
|
defectForm: {
|
|
|
|
|
defectItems: [
|
|
|
|
|
{defectSubclass: '',
|
|
|
|
|
defectCode: '',
|
|
|
|
|
noOkQuality: 0,
|
|
|
|
|
belongToDetail: '',
|
|
|
|
|
belongTo: ''
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
@ -174,6 +214,11 @@ export default {
|
|
|
|
|
getDefect(){
|
|
|
|
|
getDefectList(this.typeCode).then(response => {
|
|
|
|
|
this.defectList = response;
|
|
|
|
|
this.defectForm.defectItems = this.defectList.map(item => ({
|
|
|
|
|
defectSubclass: item.defectSubclass,
|
|
|
|
|
defectCode: item.defectCode,
|
|
|
|
|
noOkQuality: 0
|
|
|
|
|
}));
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
@ -227,13 +272,13 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
getAllRowData() {
|
|
|
|
|
const rowArray = this.$refs.myTable.data;
|
|
|
|
|
this.rowData = rowArray.map(obj => {
|
|
|
|
|
const found = this.defectList.find(subObj => subObj.defectCode === obj.defectCode);
|
|
|
|
|
if (found) {
|
|
|
|
|
return { ...obj, defectSubclass: found.defectSubclass };
|
|
|
|
|
} else {
|
|
|
|
|
this.rowData = rowArray.map(obj => {
|
|
|
|
|
const found = this.defectList.find(subObj => subObj.defectCode === obj.defectCode);
|
|
|
|
|
if (found) {
|
|
|
|
|
return { ...obj, defectSubclass: found.defectSubclass };
|
|
|
|
|
} else {
|
|
|
|
|
return obj;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
@ -281,6 +326,28 @@ export default {
|
|
|
|
|
this.valueOpen = true;
|
|
|
|
|
this.recordId = row.recordId;
|
|
|
|
|
},
|
|
|
|
|
/** 不良类型弹窗 */
|
|
|
|
|
handleDefectType(row) {
|
|
|
|
|
this.defectForm.defectItems.forEach(item => {
|
|
|
|
|
item.belongToDetail = row.recordId;
|
|
|
|
|
item.belongTo = row.belongTo;
|
|
|
|
|
});
|
|
|
|
|
getDefectValue(row.recordId).then(response => {
|
|
|
|
|
let values = response.rows;
|
|
|
|
|
if(values.length > 0){
|
|
|
|
|
this.defectForm.defectItems = values.map(item => ({
|
|
|
|
|
//此处为qc_check_task_defect的recordId
|
|
|
|
|
recordId: item.recordId,
|
|
|
|
|
defectSubclass: item.defectSubclass,
|
|
|
|
|
defectCode: item.defectCode,
|
|
|
|
|
noOkQuality: item.noOkQuality,
|
|
|
|
|
}));
|
|
|
|
|
this.updateFlag = true;
|
|
|
|
|
}
|
|
|
|
|
this.defectOpen = true;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
submitForm(formName) {
|
|
|
|
|
this.$refs[formName].validate((valid) => {
|
|
|
|
|
if (valid) {
|
|
|
|
@ -312,6 +379,51 @@ export default {
|
|
|
|
|
value: '',
|
|
|
|
|
key: Date.now()
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
submitDefectForm() {
|
|
|
|
|
this.$refs.defectForm.validate((valid) => {
|
|
|
|
|
// 直接使用 defectForm.defectItems,它已经包含了所需的数据
|
|
|
|
|
const formData = this.defectForm.defectItems;
|
|
|
|
|
if (valid) {
|
|
|
|
|
// 验证通过,可以提交数据
|
|
|
|
|
if(!this.updateFlag) {
|
|
|
|
|
commitDefectValue(formData).then(response => {
|
|
|
|
|
if(response.code === 200) {
|
|
|
|
|
this.$modal.msgSuccess("提交成功");
|
|
|
|
|
}else {
|
|
|
|
|
this.$modal.msgError(response.msg);
|
|
|
|
|
}
|
|
|
|
|
this.defectForm.defectItems = [];
|
|
|
|
|
this.defectOpen = false;
|
|
|
|
|
this.getDefect();
|
|
|
|
|
});
|
|
|
|
|
}else {
|
|
|
|
|
console.log(formData);
|
|
|
|
|
updateDefectValue(formData).then(response => {
|
|
|
|
|
if(response.code === 200) {
|
|
|
|
|
this.$modal.msgSuccess("修改成功");
|
|
|
|
|
}else {
|
|
|
|
|
this.$modal.msgError(response.msg);
|
|
|
|
|
}
|
|
|
|
|
this.defectForm.defectItems = [];
|
|
|
|
|
this.defectOpen = false;
|
|
|
|
|
this.getDefect();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
// 验证失败,提示错误信息
|
|
|
|
|
console.log('error submit!!');
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
resetDefectForm() {
|
|
|
|
|
this.$refs.defectForm.resetFields();
|
|
|
|
|
// 重置 defectForm.defectItems 为初始状态或清空 noOkQuality
|
|
|
|
|
this.defectForm.defectItems.forEach(item => (item.noOkQuality = 0));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|