From 47a1b4052b8eb0d22e910e6272e820e9e2fe2612 Mon Sep 17 00:00:00 2001 From: guhao Date: Mon, 24 Apr 2023 16:49:44 +0800 Subject: [PATCH] fix: pc-tool save bug --- frontend/pc-tool/src/api/common.ts | 1 - frontend/pc-tool/src/common/Editor.ts | 8 ++++---- .../src/packages/pc-editor/utils/classification.ts | 1 - 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/frontend/pc-tool/src/api/common.ts b/frontend/pc-tool/src/api/common.ts index 2681c309..9ed95d7c 100644 --- a/frontend/pc-tool/src/api/common.ts +++ b/frontend/pc-tool/src/api/common.ts @@ -25,7 +25,6 @@ export async function saveObject(config: any) { let url = '/api/annotate/data/save'; let data = await post(url, config); data = data.data || []; - console.log(data); let keyMap = {} as Record>; data.forEach((e: any) => { let dataId = e.dataId; diff --git a/frontend/pc-tool/src/common/Editor.ts b/frontend/pc-tool/src/common/Editor.ts index 90170ee5..b1121ebf 100644 --- a/frontend/pc-tool/src/common/Editor.ts +++ b/frontend/pc-tool/src/common/Editor.ts @@ -93,6 +93,7 @@ export default class Editor extends BaseEditor { }); this.showMsg('success', this.lang('save-ok')); } catch (e: any) { + console.error(e); this.showMsg('error', this.lang('save-error')); } bsState.saving = false; @@ -102,11 +103,11 @@ export default class Editor extends BaseEditor { Object.keys(keyMap).forEach((dataId) => { let dataKeyMap = keyMap[dataId]; let annotates = this.dataManager.getFrameObject(dataId) || []; - annotates.forEach((annotate:any) => { + annotates.forEach((annotate: any) => { let frontId = annotate.uuid; let backId = dataKeyMap[frontId]; if (!backId) return; - annotate.id = backId; + annotate.userData.backId = backId; // annotate.uuid = backId; }); }); @@ -114,7 +115,7 @@ export default class Editor extends BaseEditor { async getResultSources(frame?: IFrame) { let { state } = this; frame = frame || this.getCurrentFrame(); - if(!frame.sources){ + if (!frame.sources) { let sources = await api.getResultSources(frame.id); sources.unshift({ name: 'Without Task', @@ -125,7 +126,6 @@ export default class Editor extends BaseEditor { } this.setSources(frame.sources); - // let sourceMap = {}; // sources.forEach((e) => { // sourceMap[e.sourceId] = true; diff --git a/frontend/pc-tool/src/packages/pc-editor/utils/classification.ts b/frontend/pc-tool/src/packages/pc-editor/utils/classification.ts index e3d710bd..2f4ae662 100644 --- a/frontend/pc-tool/src/packages/pc-editor/utils/classification.ts +++ b/frontend/pc-tool/src/packages/pc-editor/utils/classification.ts @@ -223,7 +223,6 @@ export function classificationToSave(classification: IClassification) { }; }); - console.log(data); return data; } export function isAttrVisible(