feat: 优化接口和组件类型定义,调整参数类型以增强类型安全性
This commit is contained in:
parent
1c38b4e3dc
commit
f3cf800aa1
@ -4,7 +4,7 @@ const enum API {
|
|||||||
// 控制接口 - 只包含右键菜单需要的
|
// 控制接口 - 只包含右键菜单需要的
|
||||||
控制AMR = '/amr/control',
|
控制AMR = '/amr/control',
|
||||||
抢占控制权 = '/amr/controlAmr',
|
抢占控制权 = '/amr/controlAmr',
|
||||||
// 设置接单状态 = '/amr/acceptTask',
|
设置接单状态 = '/amr/acceptTask',
|
||||||
手动发布充电任务 = '/amr/manuallSetCharging',
|
手动发布充电任务 = '/amr/manuallSetCharging',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -136,7 +136,7 @@ const setUserInteraction = () => {
|
|||||||
}, 2000); // 2秒内,用户的操作优先
|
}, 2000); // 2秒内,用户的操作优先
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleHourChange = (newHour: number) => {
|
const handleHourChange = (newHour: any) => {
|
||||||
setUserInteraction();
|
setUserInteraction();
|
||||||
selectedHour.value = newHour;
|
selectedHour.value = newHour;
|
||||||
const newTime = newHour * HOUR_IN_MS;
|
const newTime = newHour * HOUR_IN_MS;
|
||||||
|
|||||||
@ -6,10 +6,10 @@ import { computed, reactive, type Ref, ref, watch } from 'vue';
|
|||||||
|
|
||||||
// --- Type Definitions ---
|
// --- Type Definitions ---
|
||||||
interface IrayParams {
|
interface IrayParams {
|
||||||
mapWidth: number | null;
|
mapWidth: number;
|
||||||
mapHeight: number | null;
|
mapHeight: number;
|
||||||
xAttrMin: number | null;
|
xAttrMin: number;
|
||||||
yAttrMin: number | null;
|
yAttrMin: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ExportFormat = 'smap' | 'iray';
|
export type ExportFormat = 'smap' | 'iray';
|
||||||
|
|||||||
@ -108,7 +108,7 @@ const convertMap = async (convertType: string, formData: FormData) => {
|
|||||||
|
|
||||||
// 如果是iray转换,需要特殊处理二进制响应
|
// 如果是iray转换,需要特殊处理二进制响应
|
||||||
if (convertType === 'iray') {
|
if (convertType === 'iray') {
|
||||||
const response = await http.post(apiUrl, formData, {
|
const response = await http.post<any>(apiUrl, formData, {
|
||||||
headers: { 'Content-Type': 'multipart/form-data' },
|
headers: { 'Content-Type': 'multipart/form-data' },
|
||||||
responseType: 'blob',
|
responseType: 'blob',
|
||||||
});
|
});
|
||||||
|
|||||||
@ -42,7 +42,7 @@ const container = shallowRef<HTMLDivElement>();
|
|||||||
const editor = shallowRef<EditorService>();
|
const editor = shallowRef<EditorService>();
|
||||||
provide(EDITOR_KEY, editor);
|
provide(EDITOR_KEY, editor);
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
editor.value = new EditorService(container.value!);
|
editor.value = new EditorService(container.value!, props.sid);
|
||||||
});
|
});
|
||||||
|
|
||||||
const editable = ref<boolean>(false);
|
const editable = ref<boolean>(false);
|
||||||
|
|||||||
@ -230,7 +230,6 @@ const handleExportConfirm = async (payload: ExportConfirmPayload) => {
|
|||||||
});
|
});
|
||||||
await exportSceneToSmap(sceneFile, payload.smapFile, payload.smapFile.name.replace(/\.smap$/i, ''));
|
await exportSceneToSmap(sceneFile, payload.smapFile, payload.smapFile.name.replace(/\.smap$/i, ''));
|
||||||
} else if (payload.format === 'iray') {
|
} else if (payload.format === 'iray') {
|
||||||
// @ts-expect-error iray params are not typed
|
|
||||||
await convertSceneToIray(sceneJson, payload.smapFile, title.value || 'unknown', payload.irayParams);
|
await convertSceneToIray(sceneJson, payload.smapFile, title.value || 'unknown', payload.irayParams);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user