Showing
1 changed file
with
13 additions
and
8 deletions
| ... | @@ -770,10 +770,11 @@ | ... | @@ -770,10 +770,11 @@ |
| 770 | // Cập nhật formData để hiển thị trong input | 770 | // Cập nhật formData để hiển thị trong input |
| 771 | this.formData[item.field] = item.text || ''; | 771 | this.formData[item.field] = item.text || ''; |
| 772 | 772 | ||
| 773 | - // Cập nhật manualBoxData với tọa độ mới | 773 | + // Cập nhật manualBoxData với tọa độ mới (box OCR không có nút xóa) |
| 774 | this.manualBoxData[item.field] = { | 774 | this.manualBoxData[item.field] = { |
| 775 | coords: item.bbox, | 775 | coords: item.bbox, |
| 776 | - text: item.text || '' | 776 | + text: item.text || '', |
| 777 | + isFromOCR: true // Đánh dấu đây là box OCR, không phải quét chọn | ||
| 777 | }; | 778 | }; |
| 778 | 779 | ||
| 779 | // Xóa dataMapping cũ để tránh focus về tọa độ cũ | 780 | // Xóa dataMapping cũ để tránh focus về tọa độ cũ |
| ... | @@ -784,7 +785,7 @@ | ... | @@ -784,7 +785,7 @@ |
| 784 | // Set active index | 785 | // Set active index |
| 785 | this.activeIndex = this.selectingIndex; | 786 | this.activeIndex = this.selectingIndex; |
| 786 | 787 | ||
| 787 | - console.log(`Updated field "${item.field}" for box at index ${this.selectingIndex} with new coordinates`); | 788 | + console.log(`Updated field "${item.field}" for box OCR at index ${this.selectingIndex} with new coordinates`); |
| 788 | } | 789 | } |
| 789 | 790 | ||
| 790 | this.selectingIndex = null; | 791 | this.selectingIndex = null; |
| ... | @@ -835,10 +836,11 @@ | ... | @@ -835,10 +836,11 @@ |
| 835 | // Cập nhật formData để hiển thị trong input | 836 | // Cập nhật formData để hiển thị trong input |
| 836 | this.formData[this.manualField] = finalText.trim(); | 837 | this.formData[this.manualField] = finalText.trim(); |
| 837 | 838 | ||
| 838 | - // Cập nhật manualBoxData | 839 | + // Cập nhật manualBoxData (box quét chọn có nút xóa) |
| 839 | this.manualBoxData[this.manualField] = { | 840 | this.manualBoxData[this.manualField] = { |
| 840 | coords: newBbox, | 841 | coords: newBbox, |
| 841 | - text: finalText.trim() | 842 | + text: finalText.trim(), |
| 843 | + isFromOCR: false // Đánh dấu đây là box quét chọn, không phải OCR | ||
| 842 | }; | 844 | }; |
| 843 | 845 | ||
| 844 | // Xóa dataMapping cũ để tránh focus về tọa độ cũ | 846 | // Xóa dataMapping cũ để tránh focus về tọa độ cũ |
| ... | @@ -989,19 +991,22 @@ | ... | @@ -989,19 +991,22 @@ |
| 989 | // Xóa box cũ có cùng fieldName trước khi hiển thị lại | 991 | // Xóa box cũ có cùng fieldName trước khi hiển thị lại |
| 990 | this.ocrData = this.ocrData.filter(box => !(box.field === fieldName && box.isManual)); | 992 | this.ocrData = this.ocrData.filter(box => !(box.field === fieldName && box.isManual)); |
| 991 | 993 | ||
| 992 | - // Hiển thị lại box manual đã quét chọn (có nút xóa) | 994 | + // Kiểm tra xem đây có phải box quét chọn hay box OCR |
| 995 | + const isFromOCR = this.manualBoxData[fieldName] && this.manualBoxData[fieldName].isFromOCR; | ||
| 996 | + | ||
| 997 | + // Hiển thị lại box manual (có nút xóa nếu là quét chọn, không có nút xóa nếu là OCR) | ||
| 993 | const manualBox = { | 998 | const manualBox = { |
| 994 | text: text || '', | 999 | text: text || '', |
| 995 | bbox: coords, | 1000 | bbox: coords, |
| 996 | field: fieldName, | 1001 | field: fieldName, |
| 997 | isManual: true, | 1002 | isManual: true, |
| 998 | - showDelete: true, | 1003 | + showDelete: !isFromOCR, // Chỉ hiển thị nút xóa nếu KHÔNG phải từ OCR |
| 999 | isDeleted: false, | 1004 | isDeleted: false, |
| 1000 | hideBorder: false | 1005 | hideBorder: false |
| 1001 | }; | 1006 | }; |
| 1002 | 1007 | ||
| 1003 | this.ocrData.push(manualBox); | 1008 | this.ocrData.push(manualBox); |
| 1004 | - console.log('Manual box shown successfully:', manualBox); | 1009 | + console.log(`Manual box shown successfully: ${isFromOCR ? 'from OCR (no delete btn)' : 'from manual selection (with delete btn)'}`); |
| 1005 | 1010 | ||
| 1006 | // Force re-render | 1011 | // Force re-render |
| 1007 | this.$forceUpdate(); | 1012 | this.$forceUpdate(); | ... | ... |
-
Please register or sign in to post a comment