Skip to content

Commit

Permalink
fix: fix annotate params
Browse files Browse the repository at this point in the history
  • Loading branch information
honelone committed Nov 30, 2023
1 parent 50cfdf5 commit 495794f
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 31 deletions.
5 changes: 3 additions & 2 deletions frontend/main/src/api/business/model/datasetModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export enum CompressSourceType {
export enum dataTypeEnum {
ALL = 'ALL',
SINGLE_DATA = 'SINGLE_DATA',
FRAME_SERIES = 'FRAME_SERIES',
FRAME_SERIES = 'SCENE',
}

export enum SortFieldEnum {
Expand Down Expand Up @@ -205,11 +205,12 @@ export enum modelCode {
export interface takeRecordParams {
datasetId: number;
dataIds: string[];
dataType: dataTypeEnum;
dataType?: dataTypeEnum;
modelId?: Nullable<number>;
modelCode?: modelCode;
isFilterData?: boolean;
resultFilterParam?: Nullable<resultFilterParam>;
operateItemType: dataTypeEnum;
}

export interface exportFileRecord {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
@click="
(e) => {
e.stopPropagation();
handleAnnotate(data.id);
handleAnnotate(data);
}
"
>
Expand Down Expand Up @@ -303,7 +303,7 @@
onImgLoad,
getImageUrl,
getTextJson,
} = useImgCard(props);
} = useImgCard(props as any);
const dataId = unref(props).data.id;
// const originalUrl = unref(props).data.files ? unref(props).data.files[0].url.originalUrl : null;
const { prefixCls } = useDesign('img-card');
Expand Down Expand Up @@ -370,8 +370,9 @@
return `background:${color}`;
};
const handleAnnotate = (id) => {
emits('handleSingleAnnotate', id);
const handleAnnotate = (data) => {
console.log('handleAnnotate', data);
emits('handleSingleAnnotate', data);
};
const handleDel = (e) => {
Expand Down
42 changes: 20 additions & 22 deletions frontend/main/src/views/datasets/datasetContent/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<Button type="primary" @click="handleUnlock">Unlock</Button>
</div>
</div>
<TipModal @register="tipRegister" :datasetType="info?.type" />
<TipModal @register="tipRegister" :datasetType="(info?.type as datasetTypeEnum )" />
<ModelRun
modelType="model"
@register="registerRunModel"
Expand Down Expand Up @@ -115,7 +115,7 @@
</div>
</div>
</div>
<div class="sider" :style="info?.type === datasetTypeEnum.TEXT ? { paddingTop: 0 } : null">
<div class="sider" :style="info?.type === datasetTypeEnum.TEXT ? { paddingTop: 0 } : ''">
<div class="header" v-if="info?.type !== datasetTypeEnum.TEXT">
<div
@click="sliderType = 'fliter'"
Expand Down Expand Up @@ -348,7 +348,6 @@
import {
Select,
Radio,
Input,
Modal,
Switch,
Tabs,
Expand Down Expand Up @@ -480,7 +479,7 @@
let timeout;
let getMoelResult = async () => {
let res = await getMoelResultApi(id);
let res = await getMoelResultApi(id as any);
modelRunResultList.value = res.map((item) => {
let result = {
Expand Down Expand Up @@ -765,17 +764,11 @@
};
const handleAnnotate = async () => {
let templist: DatasetItem[] = [];
let type = dataTypeEnum.SINGLE_DATA;
const data = unref(list).filter((item) => {
return unref(selectedList).some((record) => record === item.id);
});
if (data.some((item) => item.type === dataTypeEnum.SINGLE_DATA)) {
templist = data.filter((item) => item.type === dataTypeEnum.SINGLE_DATA);
} else {
type = dataTypeEnum.FRAME_SERIES;
templist = selectedList.value;
}
const data = unref(list).filter((item) => unref(selectedList).includes(item.id));
const type = data[0].type;
const templist: DatasetItem[] = data.filter((item) => item.type == type);
const flag = await handleEmpty(templist.map((item) => item.id || item) as string[], type);
if (!flag) {
return;
Expand All @@ -784,21 +777,25 @@
const res = await takeRecordByData({
datasetId: id as unknown as number,
dataIds: templist.map((item) => item.id || item) as string[],
dataType: type,
operateItemType: type,
});
goToTool({ recordId: res }, info.value?.type);
fixedFetchList();
};
const handleSingleAnnotate = async (dataId) => {
const handleSingleAnnotate = async (data) => {
const dataId = data.id;
const dataType = data.type;
console.log(dataId, dataType);
const flag = await handleEmpty([dataId], dataTypeEnum.SINGLE_DATA);
if (!flag) {
return;
}
const res = await takeRecordByData({
datasetId: id as unknown as number,
dataIds: [dataId],
dataType: dataTypeEnum.SINGLE_DATA,
// dataType: dataTypeEnum.SINGLE_DATA,
operateItemType: dataType,
});
getLockedData();
goToTool({ recordId: res }, info.value?.type);
Expand All @@ -813,7 +810,7 @@
const res = await takeRecordByData({
datasetId: id as unknown as number,
dataIds: list,
dataType: type,
operateItemType: type,
});
goToTool({ recordId: res }, info.value?.type);
},
Expand All @@ -823,10 +820,11 @@
};
const handleAnotateFrame = async (dataId) => {
console.log('handleAnotateFrame ==>', dataId);
const res = await takeRecordByData({
datasetId: id as unknown as number,
dataIds: [dataId],
dataType: dataTypeEnum.FRAME_SERIES,
operateItemType: dataTypeEnum.FRAME_SERIES,
});
goToTool({ recordId: res });
// window.location.reload();
Expand All @@ -838,7 +836,7 @@
const handleRun = async (
resultModel: Nullable<ResultsModelParam>,
dataModel: Nullable<DataModelParam>,
_dataModel: Nullable<DataModelParam>,
) => {
let templist: DatasetItem[] = [];
let type = dataTypeEnum.SINGLE_DATA;
Expand All @@ -855,7 +853,7 @@
const res = await takeRecordByDataModel({
datasetId: id as unknown as number,
dataIds: templist.map((item) => item.id || item) as string[],
dataType: type,
operateItemType: type,
modelId: modelId.value as number,
modelCode: selectOptions.value.filter((item) => item.id === modelId.value)[0].modelCode,
resultFilterParam: resultModel,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@
.img{
flex-shrink: 0;
width: 33.3%;
height: 50%;
img{
width: 100%;
height: 100%;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@
const recordId = await takeRecordByData({
datasetId: object.datasetId || info.value.id,
dataIds: [object.dataId],
dataType: dataTypeEnum.SINGLE_DATA,
operateItemType: data.type,
isFilterData: true,
}).catch((error: any = {}) => {
const { code, message: msg } = error;
Expand Down
4 changes: 2 additions & 2 deletions frontend/main/src/views/ontology/scenario/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
// import { useMessage } from '/@/hooks/web/useMessage';
import SearchCard from '../../datasets/datasetSearch/searchCard.vue';
import { useRoute } from 'vue-router';
import { datasetTypeEnum, dataTypeEnum } from '/@/api/business/model/datasetModel';
import { datasetTypeEnum } from '/@/api/business/model/datasetModel';
import exportModalVue from '../../datasets/datasetSearch/exportModal.vue';
import { useModal } from '/@/components/Modal';
import { getAllClassByOntologyIdApi } from '/@/api/business/classes';
Expand Down Expand Up @@ -267,7 +267,7 @@
const recordId = await takeRecordByData({
datasetId: object.datasetId || info.value.id,
dataIds: [object.dataId],
dataType: dataTypeEnum.SINGLE_DATA,
operateItemType: data.type,
isFilterData: true,
}).catch((error: any = {}) => {
const { code, message: msg } = error;
Expand Down

0 comments on commit 495794f

Please sign in to comment.