提交代码

This commit is contained in:
jiang 2024-12-03 16:35:45 +08:00
parent 258766dfa2
commit ebba5e851e
2 changed files with 18 additions and 10 deletions

View File

@ -17,6 +17,7 @@ export default {
config: { type: String, required: true }, config: { type: String, required: true },
id: { type: Number, required: true }, id: { type: Number, required: true },
itemIndex: { type: Number, required: true }, itemIndex: { type: Number, required: true },
fileAnnotationStatus: { type: String, required: true },
annotations: { annotations: {
type: Array, type: Array,
default: () => [] // default: () => [] //
@ -65,7 +66,6 @@ export default {
}, },
// LabelStudio // LabelStudio
initLabelStudio() { initLabelStudio() {
console.log(this.annotations);
this.cleanupLabelStudio(); // this.cleanupLabelStudio(); //
const task = { const task = {
@ -76,7 +76,12 @@ export default {
if (this.annotations) { if (this.annotations) {
task.annotations = this.getAnnotations(); task.annotations = this.getAnnotations();
} }
let interfaces = [];
if (this.fileAnnotationStatus === '2'){
interfaces = ["controls"];
}else {
interfaces = ["panel","update", "submit", "controls"];
}
this.$nextTick(() => { this.$nextTick(() => {
const labelStudioElement = document.getElementById('label-studio'); const labelStudioElement = document.getElementById('label-studio');
if (!labelStudioElement) { if (!labelStudioElement) {
@ -86,7 +91,7 @@ export default {
this.labelStudio = new LabelStudio('label-studio', { this.labelStudio = new LabelStudio('label-studio', {
config: this.config, config: this.config,
interfaces: ["panel","update", "submit", "controls"], interfaces: interfaces,
user: { pk: 1, firstName: '标注者', lastName: '用户' }, user: { pk: 1, firstName: '标注者', lastName: '用户' },
task, task,
onLabelStudioLoad: (LS) => { onLabelStudioLoad: (LS) => {

View File

@ -83,7 +83,7 @@
</div> </div>
<div class="bottom-content-center"> <div class="bottom-content-center">
<div> <div>
<custom-label-studio :annotations="annotationResult" :taskId="taskId || 0" :item-index="itemIndex" <custom-label-studio :file-annotation-status="fileAnnotationStatus" :annotations="annotationResult" :taskId="taskId || 0" :item-index="itemIndex"
:config="labelConfig" :id="task.id" :file-url="task.data.image" :config="labelConfig" :id="task.id" :file-url="task.data.image"
@update-itemIndex="updateItemIndex" @update-itemIndex="updateItemIndex"
></custom-label-studio> ></custom-label-studio>
@ -103,6 +103,7 @@ export default {
components: { customLabelStudio }, components: { customLabelStudio },
data() { data() {
return { return {
fileAnnotationStatus: '1',
itemIndex: 0, itemIndex: 0,
annotationResult: [], annotationResult: [],
item: {}, item: {},
@ -168,12 +169,12 @@ export default {
}, },
getColor(index) { getColor(index) {
const randomColor = () => { const randomColor = () => {
const r = Math.floor(Math.random() * 256); // 0-255 const r = Math.floor(Math.random() * 256) // 0-255
const g = Math.floor(Math.random() * 256); // 0-255 const g = Math.floor(Math.random() * 256) // 0-255
const b = Math.floor(Math.random() * 256); // 0-255 const b = Math.floor(Math.random() * 256) // 0-255
return `rgb(${r}, ${g}, ${b})`; return `rgb(${r}, ${g}, ${b})`
}; }
return randomColor(); return randomColor()
}, },
// //
toggleSelected(type) { toggleSelected(type) {
@ -210,6 +211,7 @@ export default {
let url = JSON.parse(localStorage.getItem('minIoUrl')) let url = JSON.parse(localStorage.getItem('minIoUrl'))
this.task.data.image = `${url.minioUrl}${item.fileUrl}` this.task.data.image = `${url.minioUrl}${item.fileUrl}`
this.task.id = item.fileId this.task.id = item.fileId
this.fileAnnotationStatus = item.fileAnnotationStatus
this.annotationResult = JSON.parse(item.annotationResult) this.annotationResult = JSON.parse(item.annotationResult)
} }
} }
@ -399,6 +401,7 @@ export default {
.bottom-content-center { .bottom-content-center {
width: 80%; width: 80%;
padding: 5px; padding: 5px;
> div { > div {
width: 100%; width: 100%;
height: 100%; height: 100%;