tien_nemo

test ok1

......@@ -770,10 +770,11 @@
// Cập nhật formData để hiển thị trong input
this.formData[item.field] = item.text || '';
// Cập nhật manualBoxData với tọa độ mới
// Cập nhật manualBoxData với tọa độ mới (box OCR không có nút xóa)
this.manualBoxData[item.field] = {
coords: item.bbox,
text: item.text || ''
text: item.text || '',
isFromOCR: true // Đánh dấu đây là box OCR, không phải quét chọn
};
// Xóa dataMapping cũ để tránh focus về tọa độ cũ
......@@ -784,7 +785,7 @@
// Set active index
this.activeIndex = this.selectingIndex;
console.log(`Updated field "${item.field}" for box at index ${this.selectingIndex} with new coordinates`);
console.log(`Updated field "${item.field}" for box OCR at index ${this.selectingIndex} with new coordinates`);
}
this.selectingIndex = null;
......@@ -835,10 +836,11 @@
// Cập nhật formData để hiển thị trong input
this.formData[this.manualField] = finalText.trim();
// Cập nhật manualBoxData
// Cập nhật manualBoxData (box quét chọn có nút xóa)
this.manualBoxData[this.manualField] = {
coords: newBbox,
text: finalText.trim()
text: finalText.trim(),
isFromOCR: false // Đánh dấu đây là box quét chọn, không phải OCR
};
// Xóa dataMapping cũ để tránh focus về tọa độ cũ
......@@ -989,19 +991,22 @@
// Xóa box cũ có cùng fieldName trước khi hiển thị lại
this.ocrData = this.ocrData.filter(box => !(box.field === fieldName && box.isManual));
// Hiển thị lại box manual đã quét chọn (có nút xóa)
// Kiểm tra xem đây có phải box quét chọn hay box OCR
const isFromOCR = this.manualBoxData[fieldName] && this.manualBoxData[fieldName].isFromOCR;
// 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)
const manualBox = {
text: text || '',
bbox: coords,
field: fieldName,
isManual: true,
showDelete: true,
showDelete: !isFromOCR, // Chỉ hiển thị nút xóa nếu KHÔNG phải từ OCR
isDeleted: false,
hideBorder: false
};
this.ocrData.push(manualBox);
console.log('Manual box shown successfully:', manualBox);
console.log(`Manual box shown successfully: ${isFromOCR ? 'from OCR (no delete btn)' : 'from manual selection (with delete btn)'}`);
// Force re-render
this.$forceUpdate();
......