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