Commit 26d33ab4 authored by 罗林杰's avatar 罗林杰

修改bug

parent 0a2545e6
...@@ -210,6 +210,12 @@ export default { ...@@ -210,6 +210,12 @@ export default {
this.tableRemarks = JSON.parse(JSON.stringify(newValue)) this.tableRemarks = JSON.parse(JSON.stringify(newValue))
}, },
deep: true deep: true
},
tableRemarks: {
handler(newValue, oldValue) {
this.$emit('tableRemarks', this.tableRemarks)
},
deep: true
} }
}, },
created() { created() {
...@@ -240,7 +246,7 @@ export default { ...@@ -240,7 +246,7 @@ export default {
if (result[i] !== lowerBound) { if (result[i] !== lowerBound) {
allInRange = 'NG' allInRange = 'NG'
} }
} else if (upperBound === undefined && lowerBound === ''){ } else if (upperBound === undefined && lowerBound === '') {
// remarks没填值 // remarks没填值
allInRange = 'OK' allInRange = 'OK'
} else { } else {
...@@ -264,7 +270,7 @@ export default { ...@@ -264,7 +270,7 @@ export default {
} else { } else {
// 修改时 不跟新增写一样的 是因为这样可以避免无限循环 // 修改时 不跟新增写一样的 是因为这样可以避免无限循环
// 判断是否是最后一行 如果是最后一行 value返回的是输入的值 // 判断是否是最后一行 如果是最后一行 value返回的是输入的值
if (rowData[0] === this.tableData[this.tableData.length - 1][0]){ if (rowData[0] === this.tableData[this.tableData.length - 1][0]) {
const params = { const params = {
rowData: rowData, rowData: rowData,
value: rowData[rowData.length - 1] value: rowData[rowData.length - 1]
......
...@@ -210,6 +210,12 @@ export default { ...@@ -210,6 +210,12 @@ export default {
this.tableRemarks = JSON.parse(JSON.stringify(newValue)) this.tableRemarks = JSON.parse(JSON.stringify(newValue))
}, },
deep: true deep: true
},
tableRemarks: {
handler(newValue, oldValue) {
this.$emit('tableRemarks', this.tableRemarks)
},
deep: true
} }
}, },
created() { created() {
......
...@@ -131,6 +131,8 @@ export default { ...@@ -131,6 +131,8 @@ export default {
ocrArray: { ocrArray: {
handler(newValue, oldValue) { handler(newValue, oldValue) {
if (this.updateFlag === true) { if (this.updateFlag === true) {
// 修改时初始化
this.allInRange = 'OK'
this.tableData = Array.from({ length: newValue.length }, () => []) this.tableData = Array.from({ length: newValue.length }, () => [])
// 修改 // 修改
// 循环this.tableData i代表第几行 // 循环this.tableData i代表第几行
...@@ -204,6 +206,12 @@ export default { ...@@ -204,6 +206,12 @@ export default {
this.tableRemarks = JSON.parse(JSON.stringify(newValue)) this.tableRemarks = JSON.parse(JSON.stringify(newValue))
}, },
deep: true deep: true
},
tableRemarks: {
handler(newValue, oldValue) {
this.$emit('tableRemarks', this.tableRemarks)
},
deep: true
} }
}, },
created() { created() {
...@@ -216,11 +224,14 @@ export default { ...@@ -216,11 +224,14 @@ export default {
methods: { methods: {
handleInput() { handleInput() {
this.allInRange = 'OK' this.allInRange = 'OK'
if (this.updateFlag === true) {
this.updateFlag = false
}
}, },
// 初始化时 整个表格的数据校验 // 初始化时 整个表格的数据校验
dataVerify(rowData, columnData, column, index) { dataVerify(rowData, columnData, column, index) {
// 判断该列是否需要校验 // 判断该列是否需要校验
if (column.label === '毛刺' || column.label === 'ITEM') { if (column.label === 'ITEM') {
return false return false
} }
// 数据为空 // 数据为空
...@@ -238,7 +249,9 @@ export default { ...@@ -238,7 +249,9 @@ export default {
// 当前列的数据不在第四行和第五行指定的范围内 // 当前列的数据不在第四行和第五行指定的范围内
return false return false
} else { } else {
this.allInRange = 'NG' if (this.updateFlag === false) {
this.allInRange = 'NG'
}
return true return true
} }
} else { } else {
...@@ -251,27 +264,25 @@ export default { ...@@ -251,27 +264,25 @@ export default {
const upperBound = this.tableRemarks[index][1] // 上限 const upperBound = this.tableRemarks[index][1] // 上限
const lowerBound = this.tableRemarks[index][0]// 下限 const lowerBound = this.tableRemarks[index][0]// 下限
// 检查 columnData 是否为数字 // 检查 columnData 是否为数字
if (isNaN(Number(columnData))) { if (Number(column.property) + 1 === Number(this.tableHeader.length)) {
this.allInRange = 'NG' this.$emit('updateTableData', this.allInRange)
if (Number(column.property) + 2 === Number(this.tableHeader.length)) {
this.$emit('updateTableData', this.allInRange)
}
return true // 如果 columnData 不是数字,直接返回 true
} else { } else {
if (upperBound !== '' && upperBound !== '') { if (isNaN(Number(columnData))) {
if (Number(columnData) < Number(lowerBound) || Number(columnData) > Number(upperBound)) { if (this.updateFlag === false) {
this.allInRange = 'NG' this.allInRange = 'NG'
if (Number(column.property) + 2 === this.tableHeader.length) { }
this.$emit('updateTableData', this.allInRange) return true // 如果 columnData 不是数字,直接返回 true
} } else {
// 不在范围之间 if (upperBound !== '' && upperBound !== '') {
return true if (Number(columnData) < Number(lowerBound) || Number(columnData) > Number(upperBound)) {
} else { if (this.updateFlag === false) {
if (Number(column.property) + 2 === this.tableHeader.length) { this.allInRange = 'NG'
// 在范围内 }
this.$emit('updateTableData', this.allInRange) // 不在范围之间
return true
} else {
return false
} }
return false
} }
} }
} }
......
...@@ -131,9 +131,9 @@ export default { ...@@ -131,9 +131,9 @@ export default {
ocrArray: { ocrArray: {
handler(newValue, oldValue) { handler(newValue, oldValue) {
if (this.updateFlag === true) { if (this.updateFlag === true) {
// 修改时初始化
this.allInRange = 'OK'
this.tableData = Array.from({ length: newValue.length }, () => []) this.tableData = Array.from({ length: newValue.length }, () => [])
console.log('111111111',this.tableData)
console.log('2222222',newValue)
// 修改 // 修改
// 循环this.tableData i代表第几行 // 循环this.tableData i代表第几行
for (let i = 0; i < newValue.length; i++) { for (let i = 0; i < newValue.length; i++) {
...@@ -144,7 +144,6 @@ export default { ...@@ -144,7 +144,6 @@ export default {
// this.tableData[i][this.fixedColumnCount + j] = newValue[i][j]; // this.tableData[i][this.fixedColumnCount + j] = newValue[i][j];
} }
} }
console.log('33333333333',this.tableData)
this.tableHeader = JSON.parse(JSON.stringify(this.returnTableHeader)) this.tableHeader = JSON.parse(JSON.stringify(this.returnTableHeader))
this.tableHeaderLength = this.tableHeader.length this.tableHeaderLength = this.tableHeader.length
// 找出列表表头为1的索引号 // 找出列表表头为1的索引号
...@@ -207,6 +206,12 @@ export default { ...@@ -207,6 +206,12 @@ export default {
this.tableRemarks = JSON.parse(JSON.stringify(newValue)) this.tableRemarks = JSON.parse(JSON.stringify(newValue))
}, },
deep: true deep: true
},
tableRemarks: {
handler(newValue, oldValue) {
this.$emit('tableRemarks', this.tableRemarks)
},
deep: true
} }
}, },
created() { created() {
...@@ -219,11 +224,14 @@ export default { ...@@ -219,11 +224,14 @@ export default {
methods: { methods: {
handleInput() { handleInput() {
this.allInRange = 'OK' this.allInRange = 'OK'
if (this.updateFlag === true) {
this.updateFlag = false
}
}, },
// 初始化时 整个表格的数据校验 // 初始化时 整个表格的数据校验
dataVerify(rowData, columnData, column, index) { dataVerify(rowData, columnData, column, index) {
// 判断该列是否需要校验 // 判断该列是否需要校验
if (column.label === '毛刺' || column.label === 'ITEM') { if (column.label === 'ITEM') {
return false return false
} }
// 数据为空 // 数据为空
...@@ -241,7 +249,9 @@ export default { ...@@ -241,7 +249,9 @@ export default {
// 当前列的数据不在第四行和第五行指定的范围内 // 当前列的数据不在第四行和第五行指定的范围内
return false return false
} else { } else {
this.allInRange = 'NG' if (this.updateFlag === false) {
this.allInRange = 'NG'
}
return true return true
} }
} else { } else {
...@@ -254,27 +264,25 @@ export default { ...@@ -254,27 +264,25 @@ export default {
const upperBound = this.tableRemarks[index][1] // 上限 const upperBound = this.tableRemarks[index][1] // 上限
const lowerBound = this.tableRemarks[index][0]// 下限 const lowerBound = this.tableRemarks[index][0]// 下限
// 检查 columnData 是否为数字 // 检查 columnData 是否为数字
if (isNaN(Number(columnData))) { if (Number(column.property) + 1 === Number(this.tableHeader.length)) {
this.allInRange = 'NG' this.$emit('updateTableData', this.allInRange)
if (Number(column.property) + 2 === Number(this.tableHeader.length)) {
this.$emit('updateTableData', this.allInRange)
}
return true // 如果 columnData 不是数字,直接返回 true
} else { } else {
if (upperBound !== '' && upperBound !== '') { if (isNaN(Number(columnData))) {
if (Number(columnData) < Number(lowerBound) || Number(columnData) > Number(upperBound)) { if (this.updateFlag === false) {
this.allInRange = 'NG' this.allInRange = 'NG'
if (Number(column.property) + 2 === this.tableHeader.length) { }
this.$emit('updateTableData', this.allInRange) return true // 如果 columnData 不是数字,直接返回 true
} } else {
// 不在范围之间 if (upperBound !== '' && upperBound !== '') {
return true if (Number(columnData) < Number(lowerBound) || Number(columnData) > Number(upperBound)) {
} else { if (this.updateFlag === false) {
if (Number(column.property) + 2 === this.tableHeader.length) { this.allInRange = 'NG'
// 在范围内 }
this.$emit('updateTableData', this.allInRange) // 不在范围之间
return true
} else {
return false
} }
return false
} }
} }
} }
......
...@@ -532,7 +532,7 @@ export default { ...@@ -532,7 +532,7 @@ export default {
getAfterUpdateDataB(value) { getAfterUpdateDataB(value) {
this.tableData1 = value this.tableData1 = value
}, },
// 获取组件传递过来的备注数据 // 获取组件传递过来的备注数据
getTableRemarks(value) { getTableRemarks(value) {
this.tableRemarks = value this.tableRemarks = value
}, },
...@@ -646,6 +646,7 @@ export default { ...@@ -646,6 +646,7 @@ export default {
lot: this.form.lot, lot: this.form.lot,
chJson: JSON.stringify(data) chJson: JSON.stringify(data)
} }
console.log('修改保存:---', params)
updateOcrData(params).then(res => { updateOcrData(params).then(res => {
if (res.code === 200) { if (res.code === 200) {
this.$message.success('保存成功') this.$message.success('保存成功')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment