fix(scene-editor): 修复楼层导入逻辑,调整楼层属性保持设置为 false

This commit is contained in:
xudan 2025-10-22 11:37:54 +08:00
parent e1070e21f6
commit 8cde103ac9

View File

@ -23,7 +23,7 @@ import {
type ProcessJsonListItem,
} from '../services/map-converter.service';
import { useViewState } from '../services/useViewState';
import { decodeTextFile, downloadFile, selectFile, textToBlob } from '../services/utils';
import { downloadFile, selectFile, textToBlob } from '../services/utils';
import { editorStore } from '../stores/editor.store';
const EDITOR_KEY = Symbol('editor-key');
@ -303,8 +303,7 @@ const toPush = () => {
const importModalVisible = ref(false);
const importMode = ref<'normal' | 'floor'>('floor');
const normalImportFileList = ref([]);
const normalImportKeepProperties = ref(true);
const floorImportList = ref([{ name: 'F1', fileList: [], keepProperties: true }]);
const floorImportList = ref([{ name: 'F1', fileList: [], keepProperties: false }]);
const OriginalProperties = ref<string[]>([]);
const fileTableColumns = [
@ -313,13 +312,6 @@ const fileTableColumns = [
{ title: '文件大小', dataIndex: 'size', key: 'size', width: 120 },
];
const handleNormalFileChange = (info: any) => {
//
let fileList = [...info.fileList];
fileList = fileList.slice(-1);
normalImportFileList.value = fileList;
};
const handleFloorFileChange = (info: any, index: number) => {
floorImportList.value[index].fileList = [...info.fileList];
};
@ -328,7 +320,7 @@ const addFloor = () => {
floorImportList.value.push({
name: `F${floorImportList.value.length + 1}`,
fileList: [],
keepProperties: true,
keepProperties: false,
});
};
@ -336,7 +328,7 @@ const openImportModal = () => {
importMode.value = 'floor'; // 使
importModalVisible.value = true;
//
floorImportList.value = [{ name: 'F1', fileList: [], keepProperties: true }];
floorImportList.value = [{ name: 'F1', fileList: [], keepProperties: false }];
OriginalProperties.value = [];
};
@ -453,7 +445,7 @@ const handleImportConfirm = async () => {
// 4)
importModalVisible.value = false;
normalImportFileList.value = [];
floorImportList.value = [{ name: 'F1', fileList: [], keepProperties: true }];
floorImportList.value = [{ name: 'F1', fileList: [], keepProperties: false }];
OriginalProperties.value = [];
return;
} catch (error) {
@ -488,7 +480,7 @@ const handleImportConfirm = async () => {
importModalVisible.value = false;
//
normalImportFileList.value = [];
floorImportList.value = [{ name: 'F1', fileList: [], keepProperties: true }];
floorImportList.value = [{ name: 'F1', fileList: [], keepProperties: false }];
} catch (error) {
console.error('导入失败:', error);
message.error(`导入失败: ${(error as Error).message || '请检查文件格式或内容。'}`);