图像评估的功能

This commit is contained in:
lSun 2025-10-09 16:37:25 +08:00
parent e5f9814aeb
commit 4d09b1e008
11 changed files with 656 additions and 190 deletions

View File

@ -0,0 +1,10 @@
import request from '@/utils/request'
// 查询参数列表
export function getAllImagelist(query) {
return request({
url: '/image/caption/list',
method: 'get',
params: query
})
}

View File

@ -2,7 +2,6 @@
<div> <div>
<el-image <el-image
:src="src1" :src="src1"
fit="cover"
:style="`width:${realWidth};height:${realHeight};border-radius: ${borderRadius}px;`" :style="`width:${realWidth};height:${realHeight};border-radius: ${borderRadius}px;`"
v-if="!isShowMask" v-if="!isShowMask"
> >
@ -14,7 +13,6 @@
<el-image <el-image
:src="src1" :src="src1"
v-else v-else
fit="cover"
:preview-src-list="realSrcList" :preview-src-list="realSrcList"
:style="`width:${realWidth};height:${realHeight};border-radius: ${borderRadius}px;`" :style="`width:${realWidth};height:${realHeight};border-radius: ${borderRadius}px;`"
> >

View File

@ -46,11 +46,11 @@
<!-- 图片区域 --> <!-- 图片区域 -->
<div class="card-image"> <div class="card-image">
<ImagePreview <ImagePreview
style="margin-top: 10px" style="margin-top: 10px;"
:height="192" :height="192"
:borderRadius="10" :borderRadius="10"
:width="itemWidth" :width="itemWidth"
:src1="item.image" :src1="item.bjUrl"
/> />
</div> </div>
@ -58,12 +58,12 @@
<div class="card-content"> <div class="card-content">
<div class="card-footer"> <div class="card-footer">
<div class="person-info"> <div class="person-info">
<span class="name">{{ item.name }}</span> <span class="name">{{ item.userName }}</span>
<span class="date">{{ item.date }}</span> <span class="date">{{ item.date }}</span>
</div> </div>
<div class="tags"> <div class="tags">
<el-tooltip :content="item.description" placement="top" :effect="'light'" :enterable="false"> <el-tooltip :content="item.contentImage" placement="top" :effect="'light'" :enterable="false">
<span class="title-desc">{{ item.description }}</span> <span class="title-desc">{{ item.contentImage }}</span>
</el-tooltip> </el-tooltip>
</div> </div>
<div style="border-top: 1px solid #CFD4D7;"></div> <div style="border-top: 1px solid #CFD4D7;"></div>
@ -96,17 +96,7 @@
</template> </template>
<script> <script>
import { import {getAllImagelist} from "@/api/imageCaptioning/imageLibrary";
getRole,
delRole,
addRole,
updateRole,
dataScope,
changeRoleStatus,
deptTreeSelect
} from "@/api/system/role"
import {treeselect as menuTreeselect, roleMenuTreeselect} from "@/api/system/menu"
import {getMaterialListAPI} from "@/api/publicService/proMaterials";
export default { export default {
name: "imageCaptioningLibrary", name: "imageCaptioningLibrary",
@ -117,10 +107,11 @@ export default {
// //
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 8,
roleName: undefined, roleName: undefined,
roleKey: undefined, roleKey: undefined,
status: undefined status: undefined,
operaType: 1
}, },
// //
form: {}, form: {},
@ -144,10 +135,9 @@ export default {
}, },
/** 查询角色列表 */ /** 查询角色列表 */
getList() { getList() {
getMaterialListAPI().then(response => { getAllImagelist(this.queryParams).then(response => {
this.proMaterialsListAll = response.rows; this.proMaterialsListAll = response.rows;
this.total = response.total || 0; this.total = response.total || 0;
console.log(this.proMaterialsListAll)
this.showProMaterialsDuctList = this.proMaterialsListAll; this.showProMaterialsDuctList = this.proMaterialsListAll;
}) })
}, },
@ -226,6 +216,7 @@ export default {
border-radius: 10px; border-radius: 10px;
align-content: flex-start; align-content: flex-start;
justify-items: center; justify-items: center;
height: 47%;
} }
.card-image { .card-image {
@ -276,7 +267,7 @@ export default {
.tags { .tags {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
margin: 10px 18px 0 18px; margin: 10px 18px 5px 18px;
height: 20px; height: 20px;
} }

View File

@ -59,7 +59,7 @@
@click="$emit('start-upload')" @click="$emit('start-upload')"
:disabled="fileList.length === 0" :disabled="fileList.length === 0"
> >
开始标注 开始评估
</el-button> </el-button>
</div> </div>
</div> </div>

View File

@ -5,6 +5,7 @@
<ImageResults <ImageResults
:upload-info="uploadInfo" :upload-info="uploadInfo"
:image-results="imageResults" :image-results="imageResults"
:grouped-image-results="groupedImageResults"
:selected-images="selectedImages" :selected-images="selectedImages"
:is-sure="isSure" :is-sure="isSure"
@hand-click="handleHandClickFromChild" @hand-click="handleHandClickFromChild"
@ -59,6 +60,10 @@ export default {
type: Array, type: Array,
default: () => [] default: () => []
}, },
groupedImageResults: {
type: Array,
default: () => []
},
selectedImages: { selectedImages: {
type: Object, type: Object,
default: () => ({}) default: () => ({})

View File

@ -36,7 +36,7 @@
</template> </template>
<script> <script>
import ImageResults from './ImageResults.vue'; import ImageResults from './ImageResultsUn.vue';
import TagSelector from './TagSelector.vue'; import TagSelector from './TagSelector.vue';
import FileUploader from './FileUploaderUn.vue'; import FileUploader from './FileUploaderUn.vue';
import axios from 'axios' import axios from 'axios'

View File

@ -1,68 +1,148 @@
<template> <template>
<div class="image-results-container"> <div class="image-results-container">
<!-- 上传信息提示 --> <!-- 按下标分组显示 -->
<div class="upload-info" v-if ="isEvaluate ==0"> <template v-if="groupedImageResults && groupedImageResults.length > 0">
<img src="@/assets/images/imageCaptioning/photography.png" alt="" class="icon-photography"> <div v-for="(group, groupIndex) in groupedImageResults" :key="group.index" class="group-section">
<span>{{ uploadInfo }}</span> <!-- 每组的上传信息提示 -->
</div> <div class="upload-info" v-if="isEvaluate == '0'">
<img src="@/assets/images/imageCaptioning/photography.png" alt="" class="icon-photography">
<span>
{{ group.index + 1 }} - {{ group.operaName }}:
上传{{ group.totalCount }}张图片可识别标注{{ group.recognizedCount }}
{{ group.unrecognizedCount }}张无法识别标注已识别标注图片如下请确认
</span>
</div>
<!-- 图片识别结果展示 --> <!-- 每组的图片展示 -->
<div class="image-results-grid"> <div class="image-results-grid">
<div <div
v-for="(result, index) in imageResults" v-for="(result, imageIndex) in group.images"
:key="index" :key="imageIndex"
:class="isEvaluate == '1' ? 'image-item-evaluate' : 'image-item'" :class="isEvaluate == '1' ? 'image-item-evaluate' : 'image-item'"
> >
<img <img
:src="result.url" :src="result.url"
alt="" alt=""
:class="isEvaluate == '1' ? 'result-image-evaluate' : 'result-image-item'" :class="isEvaluate == '1' ? 'result-image-evaluate' : 'result-image'"
> >
<!-- 右上角的hand图标 --> <!-- 右上角的hand图标 -->
<img <img
v-if="selectedImages[index] && isSure == '0'" v-if="isGroupImageSelected(groupIndex, imageIndex) && isEvaluate == '0'"
src="@/assets/images/imageCaptioning/hand-yellow.png" src="@/assets/images/imageCaptioning/hand-yellow.png"
alt="selected" alt="selected"
class="icon-hand" class="icon-hand"
@click="$emit('hand-click', result, index)" @click="handleGroupImageClick(groupIndex, imageIndex, group.isSure)"
> >
<img <img
v-else-if="!selectedImages[index] && isSure == '0'" v-else-if="!isGroupImageSelected(groupIndex, imageIndex) && isEvaluate == '0'"
src="@/assets/images/imageCaptioning/hand.png" src="@/assets/images/imageCaptioning/hand.png"
alt="hand" alt="hand"
class="icon-hand" class="icon-hand"
@click="$emit('hand-click', result, index)" @click="handleGroupImageClick(groupIndex, imageIndex, group.isSure)"
> >
<div class="card-content" v-if="isEvaluate == '1'">
<div class="card-content" v-if="isEvaluate == '1'"> <div class="card-footer">
<div class="card-footer"> <div class="person-info">
<div class="person-info"> <span class="name">综合得分:{{ overallScore }}</span>
<span class="name">综合得分:80</span> <span class="date">{{ contentImage }}</span>
<span class="date">2025-08-12</span> </div>
</div> <div class="tags">
<div class="tags"> <div class="tag-row">
<div class="tag-row"> <span class="tag-item" style="padding-left: 16px;">清晰度: {{ clarity }}</span>
<span class="tag-item" style="padding-left: 16px;">清晰度: 20</span> <span class="tag-item" style="padding-left: 16px;">干净度: {{ cleanliness }}</span>
<span class="tag-item" style="padding-left: 16px;">干净度: 10</span> <span class="tag-item">压缩痕迹: {{ compressMarks }}</span>
<span class="tag-item">压缩痕迹: 10</span> </div>
</div> <div class="tag-row">
<div class="tag-row"> <span class="tag-item">明暗均衡: {{ balance }}</span>
<span class="tag-item">明暗均衡: 10</span> <span class="tag-item">整体观感: {{ impression }}</span>
<span class="tag-item">整体观感: 15</span> <span class="tag-item">细节体验: {{ detail }}</span>
<span class="tag-item">细节体验: 15</span> </div>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<!-- 每组的操作按钮 -->
<div class="action-buttons" v-if="isEvaluate == '0'">
<el-button
type="primary"
@click="confirmGroup(groupIndex)"
:disabled="group.isSure === '1'"
>
{{ group.isSure === '1' ? '已确认' : '确认' }}
</el-button>
</div>
</div> </div>
</div> </template>
<!-- 操作按钮 --> <!-- 保持原有的单一展示方式 -->
<div class="action-buttons"> <template v-else>
<el-button type="primary" @click="$emit('confirm-results')" v-if="isSure == '0'">确认</el-button> <!-- 上传信息提示 -->
</div> <div class="upload-info" v-if ="isEvaluate == '0'">
<img src="@/assets/images/imageCaptioning/photography.png" alt="" class="icon-photography">
<span>{{ uploadInfo }}</span>
</div>
<!-- 图片识别结果展示 -->
<div class="image-results-grid">
<div
v-for="(result, index) in imageResults"
:key="index"
:class="isEvaluate == '1' ? 'image-item-evaluate' : 'image-item'"
>
<img
:src="result.url"
alt=""
:class="isEvaluate == '1' ? 'result-image-evaluate' : 'result-image'"
>
<!-- 右上角的hand图标 -->
<img
v-if="selectedImages[index] && isEvaluate == '0'"
src="@/assets/images/imageCaptioning/hand-yellow.png"
alt="selected"
class="icon-hand"
@click="handleImageClick(index, isSure)"
>
<img
v-else-if="!selectedImages[index] && isEvaluate == '0'"
src="@/assets/images/imageCaptioning/hand.png"
alt="hand"
class="icon-hand"
@click="handleImageClick(index, isSure)"
>
<div class="card-content" v-if="isEvaluate == '1'">
<div class="card-footer">
<div class="person-info">
<span class="name">综合得分:{{ overallScore }}</span>
<span class="date">{{ contentImage }}</span>
</div>
<div class="tags">
<div class="tag-row">
<span class="tag-item" style="padding-left: 16px;">清晰度: {{ clarity }}</span>
<span class="tag-item" style="padding-left: 16px;">干净度: {{ cleanliness }}</span>
<span class="tag-item">压缩痕迹: {{ compressMarks }}</span>
</div>
<div class="tag-row">
<span class="tag-item">明暗均衡: {{ balance }}</span>
<span class="tag-item">整体观感: {{ impression }}</span>
<span class="tag-item">细节体验: {{ detail }}</span>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- 操作按钮 -->
<div class="action-buttons" v-if="isEvaluate == '0'">
<el-button type="primary" @click="$emit('confirm-results')" :disabled="isSure === '1'">
{{ isSure === '1' ? '已确认' : '确认' }}
</el-button>
</div>
</template>
</div> </div>
</template> </template>
@ -78,27 +158,55 @@ export default {
type: Array, type: Array,
default: () => [] default: () => []
}, },
groupedImageResults: {
type: Array,
default: () => []
},
selectedImages: { selectedImages: {
type: Object, type: Object,
default: () => ({}) default: () => ({})
}, },
isSure: {
type: String,
default: '0'
},
isEvaluate: { isEvaluate: {
type: String, type: String,
default: '0' default: '0'
}, },
}, isSure: {
watch: { type: String,
isSure(newValue) { default: ''
console.log('isSure changed to:', newValue);
} }
}, },
mounted() { methods: {
// isSure isGroupImageSelected(groupIndex, imageIndex) {
console.log('Initial isSure:', this.isSure); //
const key = `${groupIndex}-${imageIndex}`;
return !!this.selectedImages[key];
},
handleGroupImageClick(groupIndex, imageIndex, groupIsSure) {
//
if (groupIsSure === '1') {
this.$message.warning('该组已确认,无法更改选择');
return;
}
const key = `${groupIndex}-${imageIndex}`;
this.$emit('hand-click', {groupIndex, imageIndex, key});
},
handleImageClick(index, isSure) {
//
if (isSure === '1') {
this.$message.warning('已确认,无法更改选择');
return;
}
this.$emit('hand-click', {index, isSingle: true});
},
confirmGroup(groupIndex) {
//
this.$emit('confirm-results', groupIndex);
}
} }
} }
</script> </script>

View File

@ -0,0 +1,196 @@
<template>
<div class="image-results-container">
<!-- 保持原有的单一展示方式 -->
<template >
<!-- 图片识别结果展示 -->
<div class="image-results-grid">
<div
v-for="(result, index) in imageResults"
:key="index"
class="image-item-evaluate"
>
<img
:src="result.url"
alt=""
class="result-image-evaluate"
>
<div class="card-content" >
<div class="card-footer">
<div class="person-info">
<span class="name">综合得分:{{ result.overallScore }}</span>
<span class="date">{{ result.contentImage }}</span>
</div>
<div class="tags">
<div class="tag-row">
<span class="tag-item" style="padding-left: 16px;">清晰度: {{ result.clarity }}</span>
<span class="tag-item" style="padding-left: 16px;">干净度: {{ result.cleanliness }}</span>
<span class="tag-item">压缩痕迹: {{ result.compressMarks }}</span>
</div>
<div class="tag-row">
<span class="tag-item">明暗均衡: {{ result.balance }}</span>
<span class="tag-item">整体观感: {{ result.impression }}</span>
<span class="tag-item">细节体验: {{ result.detail }}</span>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
</div>
</template>
<script>
export default {
name: "ImageResults",
props: {
imageResults: {
type: Array,
default: () => []
},
},
methods: {
}
}
</script>
<style scoped>
.upload-info {
display: flex;
align-items: center;
margin-bottom: 20px;
font-size: 16px;
color: #54646C;
font-weight: 600;
}
.icon-photography {
width: 47px;
height: 47px;
margin-right: 8px;
vertical-align: middle;
}
.image-results-grid {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 15px;
margin-bottom: 30px;
}
.image-item {
position: relative;
width: 100%;
height: 260px;
border-radius: 8px;
overflow: hidden;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.image-item-evaluate {
position: relative;
width: 100%;
height: 360px;
border-radius: 8px;
overflow: hidden;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.result-image {
width: 100%;
height: 100%;
}
.result-image-evaluate {
width: 100%;
height: 260px;
}
.icon-hand {
position: absolute;
top: 25px;
right: 25px;
width: 30px;
height: 30px;
cursor: pointer;
border-radius: 50%;
z-index: 1;
}
.icon-hand:hover {
opacity: 0.8;
}
.action-buttons {
text-align: right;
margin-bottom: 20px;
}
.card-content {
width: 100%;
display: flex;
flex-direction: column;
font-size: 14px;
}
.card-footer {
display: flex;
flex-direction: column;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
width: 100%;
min-height: 24px;
}
.person-info {
display: flex;
justify-content: space-between;
margin: 10px 18px 0 18px;
}
.name {
font-weight: bold;
color: #333;
}
.date {
color: #666;
font-size: 12px;
}
.tags {
display: flex;
flex-direction: column;
margin: 10px 18px 0 18px;
gap: 6px;
}
.tag-row {
display: table;
width: 100%;
table-layout: fixed;
margin:3px 0 0 0;
}
.tag-item {
display: table-cell;
width: 33.33%;
text-align: left;
font-size: 12px;
color: #333;
white-space: nowrap;
padding: 0 4px;
}
.action-buttons {
display: flex;
justify-content: flex-end;
margin: 10px 18px 10px 18px;
}
</style>

View File

@ -45,6 +45,7 @@
<HistoryView <HistoryView
:upload-info="uploadInfo" :upload-info="uploadInfo"
:image-results="imageResults" :image-results="imageResults"
:grouped-image-results="groupedImageResults"
:selected-images="selectedImages" :selected-images="selectedImages"
:tags="tags" :tags="tags"
:visible-tags="visibleTags" :visible-tags="visibleTags"
@ -106,6 +107,9 @@ export default {
selectedImages: {}, // selectedImages: {}, //
isSidebarVisible: true, // / isSidebarVisible: true, // /
isSure:'', // 0- 1- isSure:'', // 0- 1-
addId:'', //id
groupedImageResults: [], //
} }
}, },
@ -166,6 +170,7 @@ export default {
this.selectedImages = {}; this.selectedImages = {};
this.showNewAnnotation = true; this.showNewAnnotation = true;
this.showNewAnnotationAdd = false; this.showNewAnnotationAdd = false;
this.addId ='';
}, },
startUpload() { startUpload() {
@ -204,33 +209,44 @@ export default {
formData.append('files', file.raw); // 使 raw formData.append('files', file.raw); // 使 raw
}); });
formData.append('param', selectedTagNames); formData.append('param', selectedTagNames);
formData.append('id', this.addId);
//IDsname //IDsname
addImageInfoAPI(formData) addImageInfoAPI(formData)
.then(res => { .then(res => {
loading.close(); loading.close();
if (res.code === 200 && res.data && Array.isArray(res.data)) { if (res.code === 200 && res.data && Array.isArray(res.data)) {
// // -
const record = res.data[0]; // const records = res.data;
const totalCount = record.imageNum || originalFileList.length; this.addId = records[0]?.operaId || '';
const recognizedCount = record.bzNum || 0; console.log('this.addId:', this.addId)
const unrecognizedCount = record.wbzNum || (totalCount - recognizedCount);
this.uploadInfo = `上传${totalCount}张图片,可识别标注${recognizedCount}张,${unrecognizedCount}张无法识别标注。已识别标注图片如下,请确认。`; //
this.groupedImageResults = records.map((record, index) => ({
// index: index, //
this.imageResults = record.fileVoList.map(item => ({ operaName: record.operaName,
url: item.bjUrl || "未找到图片地址", images: record.fileVoList.map(item => ({
id: item.imageId || item.id, url: item.bjUrl || "未找到图片地址",
name: item.originalName, id: item.imageId || item.id,
contentImage: item.contentImage, name: item.originalName,
fileSize: item.fileSize, contentImage: item.contentImage,
operId: res.data[0].id , // ID fileSize: item.fileSize,
operId: record.id,
})),
totalCount: record.imageNum || originalFileList.length,
recognizedCount: record.bzNum || 0,
unrecognizedCount: record.wbzNum || 0,
isSure: record.isSure,
operId: record.id
})); }));
// - isActive
this.initializeSelectedImages(records);
this.isSure = record.isSure; // this.isSure = record.isSure;
// //
this.refreshSidebarLabel(record.operaName, record.id); if (records.length > 0) {
this.refreshSidebarLabel(records[0].operaName, records[0].id);
}
this.showImageResults = true; this.showImageResults = true;
this.showNewAnnotation = false; this.showNewAnnotation = false;
@ -354,67 +370,163 @@ export default {
this.$message.success('已删除文件'); this.$message.success('已删除文件');
}, },
//
// //
handleHandClick(result, index) { handleHandClick(result, index) {
console.log(result) //
console.log("点击了图片:", index) if (typeof result === 'object' && result.hasOwnProperty('groupIndex') && result.hasOwnProperty('imageIndex')) {
// 使 //
if (this.selectedImages[index]) { const { groupIndex, imageIndex, key } = result;
console.log("取消选中:", index)
this.$set(this.selectedImages, index, false) console.log("点击了分组图片:", groupIndex, imageIndex);
//
const hasOtherUnconfirmedGroupSelection = Object.keys(this.selectedImages).some(k => {
if (k.includes('-')) {
const [otherGroupIndex, otherImageIndex] = k.split('-').map(Number);
//
const otherGroup = this.groupedImageResults[otherGroupIndex];
//
if (otherGroup && otherGroup.isSure !== '1' && otherGroupIndex !== groupIndex && this.selectedImages[k]) {
return true;
}
}
return false;
});
//
if (hasOtherUnconfirmedGroupSelection) {
this.$message.warning('当前版本不支持跨组选择,请先取消其他组的选择');
return;
}
if (this.selectedImages[key]) {
console.log("取消选中分组图片:", groupIndex, imageIndex);
this.$set(this.selectedImages, key, false);
} else {
console.log("选中分组图片:", groupIndex, imageIndex);
this.$set(this.selectedImages, key, true);
}
} else if (typeof result === 'object' && result.hasOwnProperty('index') && result.isSingle) {
//
const { index } = result;
console.log("点击了图片:", index);
if (this.selectedImages[index]) {
console.log("取消选中:", index);
this.$set(this.selectedImages, index, false);
} else {
console.log("选中:", index);
this.$set(this.selectedImages, index, true);
}
} else { } else {
console.log("选中:", index) //
this.$set(this.selectedImages, index, true) console.log(result);
console.log("点击了图片:", index);
if (this.selectedImages[index]) {
console.log("取消选中:", index);
this.$set(this.selectedImages, index, false);
} else {
console.log("选中:", index);
this.$set(this.selectedImages, index, true);
}
} }
}, },
async generateTestData(recordId) { async generateTestData(recordId) {
//
try { try {
const res = await getImageListDetailsAPI({id: recordId, operaType: 1}) const res = await getImageListDetailsAPI({id: recordId, operaType: 1})
//
if (res.code === 200 && res.data && Array.isArray(res.data)) { if (res.code === 200 && res.data && Array.isArray(res.data)) {
// this.addId = res.data[0].operaId;
this.imageResults = res.data[0].fileVoList.map((item, index) => ({ console.log('addId:', this.addId);
url: item.bjUrl || item.url, // 使 bjUrl URL //
id: item.imageId || index, // 使 imageId ID this.groupedImageResults = res.data.map((record, index) => ({
name: item.originalName, // index: index, //
contentImage: item.contentImage, // operaName: record.operaName,
fileSize: item.fileSize, // images: record.fileVoList.map(item => ({
operId: res.data[0].id , // ID url: item.bjUrl || item.url,
id: item.imageId || item.id,
name: item.originalName,
contentImage: item.contentImage,
fileSize: item.fileSize,
operId: record.id
})),
totalCount: record.imageNum || 0,
recognizedCount: record.bzNum || 0,
unrecognizedCount: record.wbzNum || 0,
isSure: record.isSure,
operId: record.operaId
})); }));
this.isSure = res.data[0].isSure; // - isActive
this.initializeSelectedImages(res.data);
const totalCount = res.data[0].imageNum || 0; //
const recognizedCount = res.data[0].bzNum || 0; this.isSure = res.data[0]?.isSure || '';
const unrecognizedCount = res.data[0].wbzNum ;
this.uploadInfo = `上传${totalCount}张图片,可识别标注${recognizedCount}张,${unrecognizedCount}张无法识别标注。已识别标注图片如下,请确认。`;
} }
} catch (error) { } catch (error) {
console.error('获取列表异常:', error) console.error('获取列表异常:', error)
} }
}, },
confirmResults() { // IDoperId
console.log('当前 selectedImages 状态:', this.selectedImages); getSelectedImageInfo() {
// index const selectedImageInfo = [];
const selectedItems = [];
for (let index in this.selectedImages) { //
const idx = parseInt(index); for (let key in this.selectedImages) {
if (this.selectedImages[idx]) { if (this.selectedImages[key]) {
selectedItems.push(this.imageResults[idx]); // index imageResults //
if (key.includes('-')) {
// : key "groupIndex-imageIndex"
const [groupIndex, imageIndex] = key.split('-').map(Number);
const group = this.groupedImageResults[groupIndex];
if (group && group.images[imageIndex]) {
selectedImageInfo.push({
imageId: group.images[imageIndex].id,
operId: group.operId,
imageName: group.images[imageIndex].name
});
}
} else {
// : key
const index = parseInt(key);
if (this.imageResults[index]) {
selectedImageInfo.push({
imageId: this.imageResults[index].id,
operId: this.imageResults[index].operId,
imageName: this.imageResults[index].name
});
}
}
} }
} }
if (selectedItems.length === 0) {
this.$message.warning('请至少选择一张图片'); return selectedImageInfo;
return; },
confirmResults() {
const selectedInfo = this.getSelectedImageInfo();
if (selectedInfo.length === 0) {
// this.$message.warning('');
// return;
this.handleConfirm(this.addId, );
}else{
// ID
const imageIds = selectedInfo.map(item => item.imageId);
// operId使
const operId = selectedInfo[0].operId;
console.log('选中的图片IDs:', imageIds);
console.log('操作ID:', operId);
//
this.handleConfirm(operId, imageIds);
} }
// operId imageId
const imageIds = selectedItems.map(item => item.id);
const operId = selectedItems[0].operId; // operId
//
this.handleConfirm(operId,imageIds);
}, },
async handleConfirm(operId,imageIds) { async handleConfirm(operId,imageIds) {
@ -439,7 +551,26 @@ export default {
toggleSidebar() { toggleSidebar() {
this.isSidebarVisible = !this.isSidebarVisible; this.isSidebarVisible = !this.isSidebarVisible;
} },
initializeSelectedImages(records) {
//
this.selectedImages = {};
//
records.forEach((record, groupIndex) => {
if (record.fileVoList && Array.isArray(record.fileVoList)) {
record.fileVoList.forEach((fileItem, imageIndex) => {
// isActive "1"
if (fileItem.isActive === "1") {
const key = `${groupIndex}-${imageIndex}`;
this.$set(this.selectedImages, key, true);
}
});
}
});
},
}, },
} }
</script> </script>

View File

@ -83,17 +83,7 @@
</template> </template>
<script> <script>
import { import {getAllImagelist} from "@/api/imageCaptioning/imageLibrary";
getRole,
delRole,
addRole,
updateRole,
dataScope,
changeRoleStatus,
deptTreeSelect
} from "@/api/system/role"
import {treeselect as menuTreeselect, roleMenuTreeselect} from "@/api/system/menu"
import {getMaterialListAPI} from "@/api/publicService/proMaterials";
export default { export default {
name: "imageCaptioningLibrary", name: "imageCaptioningLibrary",
@ -107,7 +97,8 @@ export default {
pageSize: 10, pageSize: 10,
roleName: undefined, roleName: undefined,
roleKey: undefined, roleKey: undefined,
status: undefined status: undefined,
operaType: 2
}, },
// //
form: {}, form: {},
@ -131,7 +122,7 @@ export default {
}, },
/** 查询角色列表 */ /** 查询角色列表 */
getList() { getList() {
getMaterialListAPI().then(response => { getAllImagelist(this.queryParams).then(response => {
this.proMaterialsListAll = response.rows; this.proMaterialsListAll = response.rows;
this.total = response.total || 0; this.total = response.total || 0;
console.log(this.proMaterialsListAll) console.log(this.proMaterialsListAll)

View File

@ -35,7 +35,6 @@
:image-results="imageResults" :image-results="imageResults"
:selected-images="selectedImages" :selected-images="selectedImages"
:file-list="fileList" :file-list="fileList"
:is-sure="isSure"
@hand-click="handleHandClick" @hand-click="handleHandClick"
@confirm-results="confirmResults" @confirm-results="confirmResults"
@file-change="handleFileChange" @file-change="handleFileChange"
@ -81,7 +80,7 @@ export default {
imageResults: [], imageResults: [],
selectedImages: {}, // selectedImages: {}, //
isSidebarVisible: true, // / isSidebarVisible: true, // /
isSure:'', // 0- 1- addId: null,
} }
}, },
@ -91,10 +90,9 @@ export default {
}, },
methods: { methods: {
async getImageListAPI() { async getImageListAPI() {
try { try {
const res = await getImageListAPI({operaType: 1}) const res = await getImageListAPI({operaType: 2})
// //
if (res.code === 200 && res.data && Array.isArray(res.data)) { if (res.code === 200 && res.data && Array.isArray(res.data)) {
this.labelList = res.data.map(item => ({ this.labelList = res.data.map(item => ({
@ -116,6 +114,7 @@ export default {
this.selectedImages = {}; this.selectedImages = {};
this.showNewAnnotation = true; this.showNewAnnotation = true;
this.showNewAnnotationAdd = false; this.showNewAnnotationAdd = false;
this.addId ='';
}, },
startUpload() { startUpload() {
@ -149,26 +148,39 @@ export default {
originalFileList.forEach(file => { originalFileList.forEach(file => {
formData.append('files', file.raw); // 使 raw formData.append('files', file.raw); // 使 raw
}); });
formData.append("id", this.addId)
addImageEvaluateAPI(formData) addImageEvaluateAPI(formData)
.then(res => { .then(res => {
loading.close(); loading.close();
if (res.code === 200 && res.data && Array.isArray(res.data)) { if (res.code === 200 && res.data && Array.isArray(res.data)) {
// //
const record = res.data[0]; // this.addId = res.data[0].operaId;
let allImageResults = [];
// res.data.forEach(record => {
this.imageResults = record.fileVoList.map(item => ({ this.addId = record.operaId;
url: item.bjUrl || "未找到图片地址", const fileResults = record.fileVoList.map((item, index) => ({
id: item.imageId || item.id, url: item.bjUrl || item.url,
name: item.originalName, id: item.imageId || index,
contentImage: item.contentImage, name: item.originalName,
fileSize: item.fileSize, contentImage: item.contentImage,
operId: res.data[0].id , // ID fileSize: item.fileSize,
})); operId: record.id,
this.isSure = record.isSure;
overallScore: item.overallScore,
clarity: item.clarity,
cleanliness: item.cleanliness,
compressMarks: item.compressMarks,
impression: item.impression,
balance: item.balance,
detail: item.detail,
}));
allImageResults = allImageResults.concat(fileResults);
});
this.imageResults = allImageResults;
//
if (res.data.length > 0) {
this.refreshSidebarLabel(res.data[0].operaName, res.data[0].id);
}
this.showImageResults = true; this.showImageResults = true;
this.showNewAnnotation = false; this.showNewAnnotation = false;
this.showNewAnnotationAdd = true; this.showNewAnnotationAdd = true;
@ -184,6 +196,18 @@ export default {
}); });
}, },
refreshSidebarLabel(operaName, recordId) {
this.getImageListAPI()
setTimeout(() => {
const index = this.labelList.findIndex(item => item.id === recordId);
if (index !== -1) {
this.labelList[index].name = operaName;
}
//
this.selectedItem = recordId;
}, 500); //
},
selectItem(item) { selectItem(item) {
this.selectedItem = item.id; this.selectedItem = item.id;
// //
@ -242,20 +266,32 @@ export default {
async generateTestData(recordId) { async generateTestData(recordId) {
// //
try { try {
const res = await getImageListDetailsAPI({id: recordId, operaType: 1}) const res = await getImageListDetailsAPI({id: recordId, operaType: 2})
// //
if (res.code === 200 && res.data && Array.isArray(res.data)) { if (res.code === 200 && res.data && Array.isArray(res.data)) {
// this.addId = res.data[0].operaId;
this.imageResults = res.data[0].fileVoList.map((item, index) => ({
url: item.bjUrl || item.url, // 使 bjUrl URL
id: item.imageId || index, // 使 imageId ID
name: item.originalName, //
contentImage: item.contentImage, //
fileSize: item.fileSize, //
operId: res.data[0].id , // ID
}));
this.isSure = res.data[0].isSure; let allImageResults = [];
res.data.forEach(record => {
const fileResults = record.fileVoList.map((item, index) => ({
url: item.bjUrl || item.url,
id: item.imageId || index,
name: item.originalName,
contentImage: item.contentImage,
fileSize: item.fileSize,
operId: record.id,
overallScore: item.overallScore,
clarity: item.clarity,
cleanliness: item.cleanliness,
compressMarks: item.compressMarks,
impression: item.impression,
balance: item.balance,
detail: item.detail,
}));
allImageResults = allImageResults.concat(fileResults);
});
this.imageResults = allImageResults;
} }
} catch (error) { } catch (error) {
console.error('获取列表异常:', error) console.error('获取列表异常:', error)