提交代码
This commit is contained in:
parent
258766dfa2
commit
ebba5e851e
|
|
@ -17,6 +17,7 @@ export default {
|
|||
config: { type: String, required: true },
|
||||
id: { type: Number, required: true },
|
||||
itemIndex: { type: Number, required: true },
|
||||
fileAnnotationStatus: { type: String, required: true },
|
||||
annotations: {
|
||||
type: Array,
|
||||
default: () => [] // 默认值为空数组
|
||||
|
|
@ -65,7 +66,6 @@ export default {
|
|||
},
|
||||
// 初始化 LabelStudio
|
||||
initLabelStudio() {
|
||||
console.log(this.annotations);
|
||||
this.cleanupLabelStudio(); // 清理之前的实例
|
||||
|
||||
const task = {
|
||||
|
|
@ -76,7 +76,12 @@ export default {
|
|||
if (this.annotations) {
|
||||
task.annotations = this.getAnnotations();
|
||||
}
|
||||
|
||||
let interfaces = [];
|
||||
if (this.fileAnnotationStatus === '2'){
|
||||
interfaces = ["controls"];
|
||||
}else {
|
||||
interfaces = ["panel","update", "submit", "controls"];
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
const labelStudioElement = document.getElementById('label-studio');
|
||||
if (!labelStudioElement) {
|
||||
|
|
@ -86,7 +91,7 @@ export default {
|
|||
|
||||
this.labelStudio = new LabelStudio('label-studio', {
|
||||
config: this.config,
|
||||
interfaces: ["panel","update", "submit", "controls"],
|
||||
interfaces: interfaces,
|
||||
user: { pk: 1, firstName: '标注者', lastName: '用户' },
|
||||
task,
|
||||
onLabelStudioLoad: (LS) => {
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@
|
|||
</div>
|
||||
<div class="bottom-content-center">
|
||||
<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"
|
||||
@update-itemIndex="updateItemIndex"
|
||||
></custom-label-studio>
|
||||
|
|
@ -103,6 +103,7 @@ export default {
|
|||
components: { customLabelStudio },
|
||||
data() {
|
||||
return {
|
||||
fileAnnotationStatus: '1',
|
||||
itemIndex: 0,
|
||||
annotationResult: [],
|
||||
item: {},
|
||||
|
|
@ -168,12 +169,12 @@ export default {
|
|||
},
|
||||
getColor(index) {
|
||||
const randomColor = () => {
|
||||
const r = 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
|
||||
return `rgb(${r}, ${g}, ${b})`;
|
||||
};
|
||||
return randomColor();
|
||||
const r = 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
|
||||
return `rgb(${r}, ${g}, ${b})`
|
||||
}
|
||||
return randomColor()
|
||||
},
|
||||
// 切换标注类型并加载任务文件
|
||||
toggleSelected(type) {
|
||||
|
|
@ -210,6 +211,7 @@ export default {
|
|||
let url = JSON.parse(localStorage.getItem('minIoUrl'))
|
||||
this.task.data.image = `${url.minioUrl}${item.fileUrl}`
|
||||
this.task.id = item.fileId
|
||||
this.fileAnnotationStatus = item.fileAnnotationStatus
|
||||
this.annotationResult = JSON.parse(item.annotationResult)
|
||||
}
|
||||
}
|
||||
|
|
@ -399,6 +401,7 @@ export default {
|
|||
.bottom-content-center {
|
||||
width: 80%;
|
||||
padding: 5px;
|
||||
|
||||
> div {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
|
|
|||
Loading…
Reference in New Issue