中航光电热表web
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

697 lines
32 KiB

<template>
<el-dialog title="选择问题零件" append-to-body :modelValue="showDialog" width="90%" @close="closeDialog" @opened="opened">
<el-row >
<el-col :span="10">
<el-form :inline="true" v-model="searchForm" v-show="rsId === null">
<el-form-item label="生产订单号">
<el-input style="width: 150px;" placeholder="请输入生产订单号" v-model="searchForm.woCode"></el-input>
</el-form-item>
<el-form-item label="流程卡号">
<el-input style="width: 150px;" placeholder="请输入流程卡号" v-model="searchForm.cardNo"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="openZlSystem">搜 索 </el-button>
</el-form-item>
</el-form>
</el-col>
<el-col :span="14">
<div class="right_box">
<div class="right_item">
<span>比例:</span>
<el-input v-model="qcReviewSheet.scale" @input="handleScale"></el-input>
</div>
<div class="right_item">
<span>不合格数量:</span>
<el-input v-model="qcReviewSheet.unqualifiedQty" @input="handleUnqual"></el-input>
</div>
<div class="right_item">
<span>上级编号:</span>
<el-input style="width: 150px;" v-model="qcReviewSheet.supCode"></el-input>
</div>
<div class="right_item">
<el-checkbox v-model="qcReviewSheet.batchProblem">批次性问题</el-checkbox>
</div>
<div class="right_item">
<el-checkbox v-model="qcReviewSheet.typicalProblem">典型问题</el-checkbox>
</div>
<div class="right_item">
<el-checkbox v-model="qcReviewSheet.lowError">低级错误</el-checkbox>
</div>
<div class="right_item">
<el-checkbox v-model="qcReviewSheet.qualityProblem" :disabled=qualityProblemAbled>质量问题</el-checkbox>
</div>
</div>
</el-col>
</el-row>
<div>
<el-table :data="tableData" style="width: 100%" @row-click="rowClick" :row-class-name="rowClass" @current-change="currentRow">
<el-table-column type="index" width="50"></el-table-column>
<el-table-column prop="poorReason" label="简单原因" width="150" align="center">
<template #default="scope">
<div>
<el-select v-model="scope.row.poorReason">
<el-option v-for="item in reasonData" :key="item.bcId" :value="item.bcId" :label="item.code + item.name"></el-option>
</el-select>
</div>
</template>
</el-table-column>
<el-table-column label="不良描述" prop="poorMemo" width="150" align="center">
<template #default="scope">
<div>
<el-input v-model="scope.row.poorMemo"></el-input>
</div>
</template>
</el-table-column>
<el-table-column label="车间订单号" prop="prWorkPlan.prWorkOrder.woCode" width="200" align="center"></el-table-column>
<el-table-column label="发现工序" prop="prWorkPlan.procedureSet.ppsName" width="150" align="center"></el-table-column>
<el-table-column label="流程卡号" prop="prWorkPlan.prWorkOrder.cardNo" width="200" align="center"></el-table-column>
<el-table-column label="批次号" prop="prWorkPlan.prWorkOrder.batchNo" width="200" align="center"></el-table-column>
<el-table-column label="总数量" prop="prWorkPlan.prWorkOrder.makeQty" width="200" align="center"></el-table-column>
<el-table-column label="物料号" prop="prWorkPlan.prWorkOrder.pjYieldOrder.partCode" width="200" align="center"></el-table-column>
<el-table-column label="物料名称" prop="prWorkPlan.prWorkOrder.pjYieldOrder.partName" width="200" align="center"></el-table-column>
</el-table>
<el-pagination
style="display: flex;justify-content: end;margin-top: 20px;"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="page.currentPage"
:page-sizes="[10, 20, 50, 100]"
:page-size="page.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="page.total">
</el-pagination>
</div>
<el-row>
<el-col :span="12">
<div class="btn_box">
<el-button type="primary" plain @click="insertFaultEvent()">插入一行</el-button>
<el-button type="danger" plain @click="deleteFaultEvent()">删除选择行</el-button>
</div>
<div class="table_box">
<el-table ref="faultTable" height="240" :data="faultList" @selection-change="handleSelectionChange" @select="selectChangeData">
<el-table-column type="selection" width="55"></el-table-column>
<el-table-column label="故障类别" prop="faultType.rstId" align="center" width="120">
<template #default="scope">
<el-select v-model="scope.row.faultType.rstId">
<el-option v-for="item in errorTypeArr" :key="item.rstId" :value="item.rstId" :label="item.rstName"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column label="问题大类" prop="questClass.rstId" align="center">
<template #default="scope">
<el-select v-model="scope.row.questClass.rstId" :disabled="!scope.row.faultType.rstId">
<el-option v-for="item in errorBigArr" :key="item.rstId" :value="item.rstId" :label="item.rstName"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column label="问题小类" prop="questSubClass.rstId" align="center">
<template #default="scope">
<el-select v-model="scope.row.questSubClass.rstId" :disabled="!scope.row.questClass.rstId">
<el-option v-for="item in errorSmallArr" :key="item.rstId" :value="item.rstId" :label="item.rstName"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column label="比例" prop="proportion" align="center" width="80">
<template #default="scope">
<el-input v-model="scope.row.proportion" @input="(value) =>changeProportion(value,scope.$index)"></el-input>
</template>
</el-table-column>
<el-table-column label="数量" prop="faultQty" align="center" width="80">
<template #default="scope">
<el-input v-model="scope.row.faultQty" @input="(value) =>changeFaultQty(value,scope.$index)"></el-input>
</template>
</el-table-column>
<el-table-column label="备注" prop="memo" align="center">
<template #default="scope">
<el-input v-model="scope.row.memo"></el-input>
</template>
</el-table-column>
</el-table>
</div>
</el-col>
<el-col :span="12">
<div class="btn_box">
<el-button type="primary" plain @click="insertDutyEvent()">插入一行</el-button>
<el-button type="danger" plain @click="deleteDutyEvent()">删除选择行</el-button>
</div>
<div class="table_box">
<el-table :data="dutyList" height="240" @selection-change="handleDutyChange" @select="selectChangeDutyData">
<el-table-column type="selection" width="55px"></el-table-column>
<el-table-column label="责任零件" prop="dutyPart" align="center">
<template #default="scope">
<el-input v-model="scope.row.dutyPart" v-if="trialType == 1"></el-input>
<el-select v-model="scope.row.dutyPart" v-if="trialType == 2">
<el-option v-for="item in dutyPartArr" :key="item.rstId" :value="item.rstId" :label="item.rstName"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column label="责任批号" prop="dutyBatch" align="center">
<template #default="scope">
<el-select v-model="scope.row.dutyBatch">
<el-option v-for="item in dutyBatchArr" :key="item.value" :value="item.value" :label="item.label"></el-option>
<!-- <el-option v-for="item in dutyBatchArr" :key="item.rstId" :value="item.rstId" :label="item.rstName"></el-option> -->
</el-select>
</template>
</el-table-column>
<el-table-column label="相关零件" prop="relevantPart" align="center">
<template #default="scope">
<el-select v-model="scope.row.relevantPart">
<el-option v-for="item in relevantPartArr" :key="item.rstId" :value="item.rstId" :label="item.rstName"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column label="相关批号" prop="relevantBatch" align="center">
<template #default="scope">
<el-select v-model="scope.row.relevantBatch">
<el-option v-for="item in relevantBatchArr" :key="item.rstId" :value="item.rstId" :label="item.rstName"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column label="数量(件)" prop="dutyQty" align="center" width="80">
<template #default="scope">
<el-input v-model="scope.row.dutyQty"></el-input>
</template>
</el-table-column>
<el-table-column label="单位" prop="unit" align="center" width="80">
<template #default="scope">
<el-input v-model="scope.row.unit"></el-input>
</template>
</el-table-column>
<el-table-column label="备注" prop="memo">
<template #default="scope">
<el-input v-model="scope.row.memo"></el-input>
</template>
</el-table-column>
</el-table>
</div>
</el-col>
</el-row>
<div class="btn_box">
<el-button plain @click="closeDialog">关闭</el-button>
<el-button type="primary" @click="submit(-1)">保存</el-button>
<el-button plain @click="submit(1)">提交质保</el-button>
<el-button plain @click="submit(2)">提交工艺</el-button>
<el-button plain @click="submit(3)">提交设计</el-button>
<el-button plain @click="submit(4)">提交设计变更</el-button>
</div>
</el-dialog>
</template>
<script>
export default {
props:{
showDialog: {
type: Boolean,
default: false
},
rsId: {
type: Number,
default: null
},
trialType: {
type: Number,
default: null
},
},
data(){
return{
searchForm:{},
qcReviewSheet:{
scale: 0,
unqualifiedQty: 0,
supCode: '',
batchProblem: false,
lowError: false,
qualityProblem: false,
typicalProblem: false
}, //顶部右侧数据
qualityProblemAbled:false,
tableData:[],
page:{
total:0,
pageSize:10,
currentPage:1
},
faultList:[],
errorTypeArr:[],
errorBigArr:[],
errorSmallArr:[],
checkFaultList:[],
dutyList:[],
dutyPartArr:[], //责任零件选择列表
dutyBatchArr:[], //责任批号选择列表
relevantPartArr:[], //相关零件选择列表
relevantBatchArr:[], //相关批号选择列表
workCheck:null, //选中的行
deleteArr:[], //删除的右下角表格数据
rightData:[], //接口获取的右下角数据
updateData:[], //修改的右下角表格数据
deleteFault:[], //删除的左下角数据
leftData:[], //接口获取的左下角数据
updateLeftData:[], //修改的左下角表格数据
}
},
mounted(){
},
methods:{
closeDialog(){
this.dutyList = []
this.faultList = []
this.$emit('closeDialog');
},
handleScale(value){
// 只允许数字和小数点(如果你想限制小数点后的位数,可以更复杂地处理)
// // 移除非数字字符,只允许数字输入
console.log("value.replace(/[^\d]/g, '')=====================",value.replace(/[^\d]/g, ''))
this.qcReviewSheet.scale = value.replace(/[^\d]/g, '') < 0 ? 0 : value.replace(/[^\d]/g, '') > 100 ? 100 : value.replace(/[^\d]/g, '');
},
handleUnqual(value){
// 只允许数字和小数点(如果你想限制小数点后的位数,可以更复杂地处理)
// // 移除非数字字符,只允许数字输入
console.log("value.replace(/[^\d]/g, '')=====================",value.replace(/[^\d]/g, ''))
this.qcReviewSheet.unqualifiedQty = value.replace(/[^\d]/g, '') < 0 ? 0 : value.replace(/[^\d]/g, '') > 1000000 ? 1000000 : value.replace(/[^\d]/g, '');
},
opened(){
if(this.rsId === null){
this.qualityProblemAbled = false
this.faultList = []
this.tableData = [
{
poorReason:'',
poorMemo:'',
prWorkPlan:{
prWorkOrder:{
woCode:'WO-2303196151-R02',
cardNo:'101682589001',
batchNo:'Y049230421301',
makeQty:5,
pjYieldOrder:{
partCode:'21E8-010-662-E9',
partName:'24插头密封盖'
}
},
procedureSet:{
ppsName:'涂色标test'
},
qualifiedQty:1
},
},
{
poorReason:'',
poorMemo:'',
prWorkPlan:{
prWorkOrder:{
woCode:'WO-2303196151-R02',
cardNo:'101682589001',
batchNo:'Y049230421301',
makeQty:5,
pjYieldOrder:{
partCode:'21E8-010-662-E9',
partName:'24插头密封盖'
}
},
procedureSet:{
ppsName:'涂色标test'
},
qualifiedQty:1
},
},
{
poorReason:'',
poorMemo:'',
prWorkPlan:{
prWorkOrder:{
woCode:'WO-2303196151-R02',
cardNo:'101682589001',
batchNo:'Y049230421301',
makeQty:5,
pjYieldOrder:{
partCode:'21E8-010-662-E9',
partName:'24插头密封盖'
}
},
procedureSet:{
ppsName:'涂色标test'
},
qualifiedQty:1
},
}
]
}else{
this.qualityProblemAbled = true
this.tableData = [
{
poorReason:'',
poorMemo:'',
prWorkPlan:{
prWorkOrder:{
woCode:'WO-2303196151-R02',
cardNo:'101682589001',
batchNo:'Y049230421301',
makeQty:5,
pjYieldOrder:{
partCode:'21E8-010-662-E9',
partName:'24插头密封盖'
}
},
procedureSet:{
ppsName:'涂色标test'
},
qualifiedQty:1
},
}
]
this.workCheck = this.tableData[0]
this.rowClick(this.workCheck)
this.dutyList = [
{rdId:21,dutyPart:3,dutyBatch:'Y049230421301',_select:false,relevantPart:null,relevantBatch:null,dutyQty:null,unit:null,memo:null},
{rdId:23,dutyPart:4,dutyBatch:'Y0262304159',_select:false,relevantPart:null,relevantBatch:null,dutyQty:null,unit:null,memo:null},
]
this.rightData = [
{rdId:21,dutyPart:3,dutyBatch:'Y049230421301',_select:false,relevantPart:null,relevantBatch:null,dutyQty:null,unit:null,memo:null},
{rdId:23,dutyPart:4,dutyBatch:'Y0262304159',_select:false,relevantPart:null,relevantBatch:null,dutyQty:null,unit:null,memo:null},
]
this.faultList = [
{
rfId:21,
faultType:{rstId:30001},
questClass:{rstId:30001001},
questSubClass:{rstId:30001001001},
proportion:5,
faultQty:2,
memo:null,_select:false,
},
{
rfId:22,
faultType:{rstId:30002},
questClass:{rstId:30001002},
questSubClass:{rstId:30001001003},
proportion:5,
faultQty:2,
memo:null,_select:false,
}
]
this.leftData = [
{
rfId:21,
faultType:{rstId:30001},
questClass:{rstId:30001001},
questSubClass:{rstId:30001001001},
proportion:5,
faultQty:2,
memo:null,_select:false,
},
{
rfId:22,
faultType:{rstId:30002},
questClass:{rstId:30001002},
questSubClass:{rstId:30001001003},
proportion:5,
faultQty:2,
memo:null,_select:false,
}
]
this.page.total = this.tableData.length
}
this.reasonData = [
{bcId: 2,code: "BCL",keyValue: 2,name: "表处理",type: 4},
{bcId: 3,code: "JJ",keyValue: 3,name: "机架",type:4},
{bcId: 4,code: "RCL",keyValue: 4,name: "热处理",type:4},
{bcId: 5,code: "SBSK",keyValue: 5,name: "设备失控"},
]
this.errorTypeArr = [
{"keyValue": 30001,"parentId": 300,"rstId": 30001,"rstName": "壳体类","rstType": 2},
{"keyValue": 30002,"parentId": 300,"rstId": 30002,"rstName": "针孔类","rstType": 2},
{"keyValue": 30003,"parentId": 300,"rstId": 30003,"rstName": "绝缘类","rstType": 2}
]
this.errorBigArr = [
{"keyValue": 30001001,"parentId": 30001,"rstId": 30001001,"rstName": "外观质量","rstType": 3},
{"keyValue": 30001002,"parentId": 30001,"rstId": 30001002,"rstName": "尺寸问题","rstType": 3},
{"keyValue": 30001003,"parentId": 30001,"rstId": 30001003,"rstName": "镀层质量","rstType": 3},
{ "keyValue": 30001004,"parentId": 30001,"rstId": 30001004,"rstName": "材料问题","rstType": 3},
{"keyValue": 30001005,"parentId": 30001,"rstId": 30001005,"rstName": "包装问题","rstType": 3}
]
this.errorSmallArr = [
{"keyValue": 30001001001,"parentId": 30001001,"rstId": 30001001001,"rstName": "划伤、磕碰伤","rstType": 4},
{"keyValue": 30001001003,"parentId": 30001001,"rstId": 30001001003,"rstName": "零件缺口、掉块","rstType": 4},
{"keyValue": 30001001002,"parentId": 30001001,"rstId": 30001001002,"rstName": "表面脏污、发黄、发黑","rstType": 4},
{"keyValue": 30001001004,"parentId": 30001001,"rstId": 30001001004,"rstName": "麻点、麻坑","rstType": 4},
]
},
insertFaultEvent(row = -1) {
const record = { faultType: {}, questClass: {}, questSubClass: {},_select:false};
this.faultList.push(record)
},
changeProportion(value,index){
if(this.faultList.length != 0){
this.faultList[index].proportion = value.replace(/[^\d]/g, '') < 0 ? 0 : value.replace(/[^\d]/g, '') > 100 ? 100 : value.replace(/[^\d]/g, '')
}
},
changeFaultQty(value,index){
if(this.faultList.length != 0){
this.faultList[index].faultQty = value.replace(/[^\d]/g, '') < 0 ? 0 : value.replace(/[^\d]/g, '')
}
},
handleSelectionChange(list){
this.checkFaultList = list
},
selectChangeData(list,val){
val._select = !val._select
},
deleteFaultEvent(){
let arr = this.faultList.filter(item => item._select)
if(arr.length != 0){
this.$confirm('确定将选择数据删除?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(() =>{
if(this.rsId){
let faultDate = this.faultList.filter(item => item._select)
this.deleteFault = faultDate.filter(item => item.rfId)
}
let arr = this.faultList.filter(item => item._select == false)
this.faultList = arr
})
}else{
this.$message.error('请至少选择一条数据进行操作!')
}
},
handleDutyChange(list){
this.checkFaultList = list
},
selectChangeDutyData(list,val){
val._select = !val._select
},
deleteDutyEvent(){
let arr = this.dutyList.filter(item => item._select)
if(arr.length != 0){
this.$confirm('确定将选择数据删除?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(() =>{
if(this.rsId){
let deleteData = this.dutyList.filter(item => item._select)
this.deleteArr = deleteData.filter(item => item.rdId)
}
let arr = this.dutyList.filter(item => item._select == false)
this.dutyList = arr
})
}else{
this.$message.error('请至少选择一条数据进行操作!')
}
},
// 责任零件
insertDutyEvent(row = -1) {
const record = {_select:false};
this.dutyList.push(record)
},
//点击行
rowClick(row){
// this.$set(row, 'isSelect', true);
row.isSelect = true
this.workCheck = row;
console.log('work---------------------',this.workCheck)
const makeQty = row.prWorkPlan.qualifiedQty;
if (this.qcReviewSheet.unqualifiedQty) {
this.qcReviewSheet.scale = Math.round((this.qcReviewSheet.unqualifiedQty / makeQty) * 100)
}
if (
this.qcReviewSheet.scale &&
(this.qcReviewSheet.unqualifiedQty == null ||
this.qcReviewSheet.unqualifiedQty == '' ||
this.qcReviewSheet.unqualifiedQty <= 0)
) {
this.qcReviewSheet.unqualifiedQty = Math.round((this.qcReviewSheet.scale / 100) * makeQty, 0)
}
if (
row.prWorkPlan != null &&
row.prWorkPlan.prWorkOrder != null &&
row.prWorkPlan.prWorkOrder.pjYieldOrder != null
) {
const partCode = row.prWorkPlan.prWorkOrder.pjYieldOrder.partCode;
const batchNo = row.prWorkPlan.prWorkOrder.batchNo;
//调用接口获取责任零件/责任批号选择列表数据
this.dutyPartArr = []
this.dutyBatchArr = [
{label:'Y049230421301',value:'Y049230421301'},
{label:'Y0262304159',value:'Y0262304159'},
{label:'Y8892304821',value:'Y8892304821'},
]
}
},
currentRow(row, oldRow) {
if (oldRow) {
// this.$set(oldRow, 'isSelect', false);
oldRow.isSelect = false
}
},
rowClass({ row }) {
if (row.isSelect) {
return 'selectRow';
}
},
// 查找数组不同项
findDifferentObjects(arr1, arr2,type){
const result = [];
// 遍历第一个数组
arr1.forEach(obj1 => {
// 查找第二个数组中具有相同id的对象
// let foundObj = type == 1 ? arr2.find(obj2 => obj2[type] === obj1[type]) : arr2.find(obj2 => obj2[type] === obj1[type]);
const foundObj = arr2.find(obj2 => obj2[type] === obj1[type]);
// 检查是否找到具有相同id的对象,并且至少一个字段值不同
if (foundObj) {
const fields = Object.keys(obj1); // 获取所有字段名
let isDifferent = false;
// if(type == 1){
// fields.forEach(field => {
// if (obj1[field] !== foundObj[field]) {
// isDifferent = true;
// }
// });
// }else{
fields.forEach(field => {
if (JSON.stringify(obj1[field] ) !== JSON.stringify(foundObj[field])) {
isDifferent = true;
}
});
// }
// 如果至少一个字段不同,则添加到结果数组中
if (isDifferent) {
result.push({ ...obj1, ...foundObj }); // 可以选择合并两个对象或者只添加一个对象,取决于你的需求
}
}
});
return result;
},
//提交
submit(val){
if (this.workCheck === null) {
this.$message.error('请至少选择一条数据进行操作!');
return;
}
if(this.faultList.length != 0){
let tmp = this.faultList.find(item => JSON.stringify(item.faultType) == '{}' || JSON.stringify(item.questClass) == '{}' || JSON.stringify(item.questSubClass) == '{}')
if(tmp){
this.$message.error('请填写完整数据!')
return;
}
}
if(this.dutyList.length != 0){
let tmp = this.dutyList.find(item => !item.dutyPart || !item.dutyBatch)
if(tmp){
this.$message.error('请填写完整数据!')
return;
}
}
this.updateData = []
if(this.rsId){
let updateArr = this.findDifferentObjects(this.rightData,this.dutyList,'rdId')
this.updateData = updateArr
let updataLeftArr = this.findDifferentObjects(this.leftData,this.faultList,'rfId')
this.updateLeftData = updataLeftArr
}
let rdList = [];
const rdDelete = [];
rdList = this.dutyList.filter(item => !item.rdId)
rdList = rdList.concat(this.updateData)
if (this.deleteArr.length > 0) {
this.deleteArr.forEach((obj) => {
if (obj.rdId) {
rdDelete.push(obj.rdId);
}
});
}
let rfList = [];
const rfDelete = [];
rfList = this.faultList.filter(item => !item.rfId)
rfList = rfList.concat(this.updateLeftData)
if (this.deleteFault.length > 0) {
this.deleteFault.forEach((obj) => {
if (obj.rfId) {
rfDelete.push(obj.rfId);
}
});
}
setTimeout(() =>{
this.closeDialog()
},500)
},
}
}
</script>
<style lang="scss">
.right_box{
width: 100%;
display: flex;
.right_item{
display: flex;
align-items: center;
margin-right: 5px;
.el-input{
width: 100px;
}
}
}
.el-table {
tr {
&.selectRow {
background-color: #6acaf0 !important;
}
}
}
.btn_box{
margin-top: 20px;
margin-bottom: 10px;
display: flex;
justify-content: end;
}
.table_box{
width: 99%;
}
</style>