feat:不良代码逻辑回填

This commit is contained in:
周炼 2024-11-26 17:40:24 +08:00
parent a19a82a7b1
commit bd874cae46

View File

@ -243,7 +243,8 @@
<template slot-scope="scope">
<el-input v-if="scope.row.showNcCode" v-model="scope.row.ncCode" placeholder="请输入不良代码"
:disabled="state === 'view'">
<i slot="suffix" class="el-input__icon el-icon-copy-document" @click.stop="showDialog(scope.row)"></i>
<i slot="suffix" class="el-input__icon el-icon-copy-document"
@click.stop="showDialog(scope.row)"></i>
</el-input>
</template>
</el-table-column>
@ -328,6 +329,7 @@ export default {
data() {
return {
selectRow:{},
qms,
headers: {
Authorization: 'Bearer ' + store.getters.access_token,
@ -506,6 +508,23 @@ export default {
row.sid = null
me.showDialog(row)
},
// 找到父节点
_findParent(tree, node) {
for (let i = 0; i < tree.length; i++) {
if (tree[i].inspecResultList && tree[i].inspecResultList.length) {
if (tree[i].inspecResultList.includes(node)) {
return tree[i];
}
const parent = me._findParent(tree[i].inspecResultList, node);
if (parent) {
return parent;
}
}
}
return null;
},
//查看图片
showPhotos(row) {
let me = this
@ -542,11 +561,19 @@ export default {
item: me.ncCodeForm.item
}
showLoading()
let ncCode = []
const parent = me._findParent(me.qcTable, me.selectRow)
const index = parent.inspecResultList.findIndex(child => child.handle === me.selectRow.handle)
me.inspecNcList.forEach(item => {
ncCode.push(item.ncCode)
})
me.selectRow.ncCode=ncCode.join(',')
saveNc(param).then((res) => {
hideLoading()
if (res.status === 200) {
me.$message.success('保存成功')
me.ncCodeFormClose()
me.$set(parent.inspecResultList, index, me.selectRow)
} else {
me.$message.error(res.data.message)
}
@ -577,10 +604,10 @@ export default {
resData.forEach(element => {
me.inspecNcList.forEach(element2 => {
if (element.ncBasisBo === element2.ncBasisBo) {
let index =me.inspecNcList.indexOf(element2)
me.inspecNcList.splice(index, 1,element)
}
})
let index = me.inspecNcList.indexOf(element2)
me.inspecNcList.splice(index, 1, element)
}
})
});
} else {
me.inspecNcList = []
@ -602,6 +629,7 @@ export default {
me.ncCodeDialogVisible = true
me.ncCodeList = []
me.inspecNcList = []
me.selectRow =row
me.getNcList(row)
},
async getNcList(row) {
@ -792,9 +820,9 @@ export default {
console.log(e)
console.log('Switch changed:', event, row);
if (e) {
return 'ok-cell'
return 'ok-cell'
} else {
return 'ng-cell'
return 'ng-cell'
}
},
// 数字输入限制