From 24affac44843ceac56f0d98f03e3ee2b07e183b2 Mon Sep 17 00:00:00 2001 From: BianLzhaoMin <11485688+bianliangzhaomin123@user.noreply.gitee.com> Date: Wed, 26 Nov 2025 15:27:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=87=E6=B3=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/imageCaptioning/imageCaptioning.js | 45 +- .../components/FileUploader.vue | 2 +- .../components/HistoryView.vue | 13 +- .../components/ImageResults.vue | 425 +++++++++++++++--- .../image-captioning/index.vue | 9 +- 5 files changed, 414 insertions(+), 80 deletions(-) diff --git a/src/api/imageCaptioning/imageCaptioning.js b/src/api/imageCaptioning/imageCaptioning.js index 14f5147..503d2d9 100644 --- a/src/api/imageCaptioning/imageCaptioning.js +++ b/src/api/imageCaptioning/imageCaptioning.js @@ -11,11 +11,11 @@ export function getSelectedAPI(data) { // 查询左侧历史记录 export function getImageListAPI(data) { - return request({ - url: '/image/caption/getImageList', - method: 'POST', - data, - }) + return request({ + url: '/image/caption/getImageList', + method: 'POST', + data, + }) } //查询右侧的历史记录详情 @@ -29,23 +29,30 @@ export function getImageListDetailsAPI(data) { //新增标注 export function addImageInfoAPI(data) { - return request({ - url: '/image/caption/addImageInfo', - method: 'POST', - data, - headers: { - 'Content-Type': 'multipart/form-data' - } - }) + return request({ + url: '/image/caption/addImageInfo', + method: 'POST', + data, + headers: { + 'Content-Type': 'multipart/form-data', + }, + }) } //修改图片 export function updateImageSureAPI(data) { - return request({ - url: '/image/caption/updateImageSure', - method: 'POST', - data, - }) + return request({ + url: '/image/caption/updateImageSure', + method: 'POST', + data, + }) } - +// 修改标注 +export function updateImageAnnotationAPI(data) { + return request({ + url: '/image/caption/manualAnnotation', + method: 'POST', + data, + }) +} diff --git a/src/views/imageCaptioning/image-captioning/components/FileUploader.vue b/src/views/imageCaptioning/image-captioning/components/FileUploader.vue index 4a5d00e..c7a7c9f 100644 --- a/src/views/imageCaptioning/image-captioning/components/FileUploader.vue +++ b/src/views/imageCaptioning/image-captioning/components/FileUploader.vue @@ -55,7 +55,7 @@ $emit('file-change', file, fileList) " @remove-image="(index) => $emit('remove-image', index)" - @start-upload="$emit('start-upload')" + @start-upload="$emit('start-upload', remarkInfo)" /> @@ -108,6 +108,17 @@ export default { this.$emit('hand-click', result, index) }, }, + + watch: { + groupedImageResults: { + handler(newVal) { + if (newVal.length > 0) { + this.remarkInfo = newVal[0].remark + } + }, + immediate: true, + }, + }, } diff --git a/src/views/imageCaptioning/image-captioning/components/ImageResults.vue b/src/views/imageCaptioning/image-captioning/components/ImageResults.vue index 08835ef..723a4c2 100644 --- a/src/views/imageCaptioning/image-captioning/components/ImageResults.vue +++ b/src/views/imageCaptioning/image-captioning/components/ImageResults.vue @@ -272,7 +272,7 @@ preview @@ -280,19 +280,15 @@
标注类型: - - + - + :label="option.value" + > + {{ option.label }} + +
@@ -302,18 +298,14 @@ {{ originalSize.height }}

- 左上:({{ annotationCoords.x1 }}, + 当前标注:左上:({{ annotationCoords.x1 }}, {{ annotationCoords.y1 }}) ,右下:({{ annotationCoords.x2 }}, {{ annotationCoords.y2 }})

- +

+ 请先选择标注类型,然后拖拽绘制标注框 +

- 提交 + 临时确定 + + + 提交全部
+ + +
+
已标注列表({{ annotations.length }})
+
+
+ + {{ + getTypeLabel(item.type) + }} + ({{ item.coords.x1 }}, + {{ item.coords.y1 }}) - ({{ + item.coords.x2 + }}, {{ item.coords.y2 }}) + + + 删除 + +
+
+
请先选择图片
@@ -346,6 +383,10 @@ @@ -751,11 +1002,13 @@ export default { width: 100%; display: flex; align-items: center; - gap: 8px; + gap: 12px; } -.annotation-type-select { - flex: 1; +.annotation-type .label { + font-weight: 500; + color: #333; + white-space: nowrap; } .annotation-info { @@ -782,6 +1035,66 @@ export default { padding: 30px 0; } +.annotation-list { + width: 100%; + border: 1px solid #e4e7ed; + border-radius: 4px; + background: #f5f7fa; +} + +.annotation-list-title { + padding: 12px 16px; + background: #e4e7ed; + font-weight: 500; + color: #333; + border-bottom: 1px solid #e4e7ed; +} + +.annotation-list-content { + max-height: 200px; + overflow-y: auto; +} + +.annotation-list-item { + display: flex; + align-items: center; + justify-content: space-between; + padding: 10px 16px; + border-bottom: 1px solid #e4e7ed; + transition: background-color 0.2s; +} + +.annotation-list-item:last-child { + border-bottom: none; +} + +.annotation-list-item:hover { + background-color: #ecf5ff; +} + +.annotation-item-info { + display: flex; + align-items: center; + gap: 12px; + flex: 1; +} + +.annotation-item-type { + padding: 2px 8px; + background: #409eff; + color: #fff; + border-radius: 3px; + font-size: 12px; + font-weight: 500; + white-space: nowrap; +} + +.annotation-item-coords { + color: #606266; + font-size: 13px; + font-family: monospace; +} + .icon-hand { position: absolute; top: 25px; diff --git a/src/views/imageCaptioning/image-captioning/index.vue b/src/views/imageCaptioning/image-captioning/index.vue index 16f2ec4..3821540 100644 --- a/src/views/imageCaptioning/image-captioning/index.vue +++ b/src/views/imageCaptioning/image-captioning/index.vue @@ -179,7 +179,7 @@ export default { this.addId = '' }, - startUpload() { + startUpload(remarkInfo = '') { console.log('开始上传') if (this.selectedTag.length === 0) { this.$message.warning('请选择需要标注的内容标签') @@ -224,7 +224,7 @@ export default { // 修改参数处理方式,与之前的params 保持一致 const params = { param: selectedTagNames, - remark: this.remarkInfo, + remark: remarkInfo || this.remarkInfo, id: this.addId, } formData.append('params', JSON.stringify(params)) @@ -250,6 +250,7 @@ export default { operaName: record.operaName, images: record.fileVoList.map((item) => ({ url: item.bjUrl || '未找到图片地址', + originUrl: item.imageUrl, id: item.imageId || item.id, name: item.originalName, contentImage: item.contentImage, @@ -511,7 +512,8 @@ export default { index: index, // 下标 operaName: record.operaName, images: record.fileVoList.map((item) => ({ - url: item.bjUrl || item.url, + url: item.bjUrl, + originUrl: item.imageUrl, id: item.imageId || item.id, name: item.originalName, contentImage: item.contentImage, @@ -524,6 +526,7 @@ export default { isSure: record.isSure, operId: record.operaId, id: record.id, + remark: record.remark, }), )