diff --git a/Release/database/XNSim.db b/Release/database/XNSim.db index c7afde6..85d2151 100644 Binary files a/Release/database/XNSim.db and b/Release/database/XNSim.db differ diff --git a/XNSimPortal/components/configuration-config.js b/XNSimPortal/components/configuration-config.js index 261d276..bcda69a 100644 --- a/XNSimPortal/components/configuration-config.js +++ b/XNSimPortal/components/configuration-config.js @@ -849,7 +849,7 @@ class ConfigurationConfig extends HTMLElement { const baseConfig = await this.showBaseConfigDialog(configs, planeName); if (baseConfig !== null) { const defaultConfig = { - ConfName: '', + ConfName: baseConfig.ConfName, // 使用用户输入的构型名称 OSName: baseConfig?.OSName || '', OSVersion: baseConfig?.OSVersion || '', RTXVersion: baseConfig?.RTXVersion || '', diff --git a/XNSimPortal/components/interface-config.js b/XNSimPortal/components/interface-config.js index 60c27d7..f1e7aec 100644 --- a/XNSimPortal/components/interface-config.js +++ b/XNSimPortal/components/interface-config.js @@ -105,9 +105,10 @@ class InterfaceConfig extends HTMLElement { } }); - // 确认导入事件 + // 导入确认事件 importDialog.addEventListener('confirm-import', async (e) => { const importData = e.detail; + try { const savedSelection = localStorage.getItem('xnsim-selection'); if (!savedSelection) { @@ -143,12 +144,23 @@ class InterfaceConfig extends HTMLElement { if (result.success) { await this.loadData(); alert('导入成功'); + // 关闭导入对话框 + const importDialog = this.shadowRoot.querySelector('import-dialog'); + if (importDialog && importDialog.hide) { + importDialog.hide(); + } } else { throw new Error(result.error || '保存导入数据失败'); } } catch (error) { console.error('保存导入数据时出错:', error); alert(error.message || '保存导入数据失败'); + } finally { + // 通知导入对话框隐藏加载蒙版 + const importDialog = this.shadowRoot.querySelector('import-dialog'); + if (importDialog && importDialog.hideLoading) { + importDialog.hideLoading(); + } } }); @@ -310,15 +322,24 @@ class InterfaceConfig extends HTMLElement { throw new Error('请先选择构型'); } + // 获取接口数据 const response = await fetch(`/api/interface/list?confID=${selection.configurationId}`); if (!response.ok) { throw new Error('获取数据失败'); } this.data = await response.json(); - // 从接口数据中提取机型和ATA章节列表 + // 获取ATA章节数据 + const ataResponse = await fetch('/api/ata-chapters'); + if (!ataResponse.ok) { + throw new Error('获取ATA章节数据失败'); + } + const ataChapters = await ataResponse.json(); + + // 从接口数据中提取机型列表 this.planes = [...new Set(this.data.map(item => item.PlaneName))]; - this.atas = [...new Set(this.data.map(item => item.ATAName))]; + // 从ATA章节数据中提取章节ID列表 + this.atas = ataChapters.map(chapter => chapter.ID); this.updateTable(); this.updateAdvancedSearchOptions(); diff --git a/XNSimPortal/components/interface-config/import-dialog.js b/XNSimPortal/components/interface-config/import-dialog.js index 94f9a28..6ecaa0a 100644 --- a/XNSimPortal/components/interface-config/import-dialog.js +++ b/XNSimPortal/components/interface-config/import-dialog.js @@ -73,7 +73,7 @@ class ImportDialog extends HTMLElement { this.updateTable(); }); - confirmBtn.addEventListener('click', () => { + confirmBtn.addEventListener('click', async () => { const ataSelect = this.shadowRoot.querySelector('#ata-select'); const modelInput = this.shadowRoot.querySelector('#model-input'); @@ -127,15 +127,32 @@ class ImportDialog extends HTMLElement { return; } + // 显示加载蒙版 + this.showLoading(); + + // 触发导入事件,让父组件处理导入逻辑 this.dispatchEvent(new CustomEvent('confirm-import', { detail: processedData, bubbles: true, composed: true })); - this.hide(); }); } + showLoading() { + const loadingOverlay = this.shadowRoot.querySelector('.loading-overlay'); + if (loadingOverlay) { + loadingOverlay.style.display = 'flex'; + } + } + + hideLoading() { + const loadingOverlay = this.shadowRoot.querySelector('.loading-overlay'); + if (loadingOverlay) { + loadingOverlay.style.display = 'none'; + } + } + render() { // 从 localStorage 获取机型信息 const savedSelection = localStorage.getItem('xnsim-selection'); @@ -168,6 +185,41 @@ class ImportDialog extends HTMLElement { max-height: 90vh; display: flex; flex-direction: column; + position: relative; + } + + .loading-overlay { + display: none; + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + background: rgba(255, 255, 255, 0.9); + z-index: 10; + justify-content: center; + align-items: center; + border-radius: 8px; + } + + .loading-spinner { + width: 40px; + height: 40px; + border: 4px solid #f3f3f3; + border-top: 4px solid #5c6bc0; + border-radius: 50%; + animation: spin 1s linear infinite; + } + + .loading-text { + margin-top: 10px; + color: #666; + font-size: 14px; + } + + @keyframes spin { + 0% { transform: rotate(0deg); } + 100% { transform: rotate(360deg); } } .header { @@ -259,30 +311,33 @@ class ImportDialog extends HTMLElement { } .confirm-btn { - background-color: #4CAF50; + background-color: #5c6bc0; color: white; } .cancel-btn { - background-color: #f44336; - color: white; + background-color: #e8eaf6; + color: #5c6bc0; } - .plane-info { - background-color: #f5f5f5; - padding: 10px; - border-radius: 4px; - margin-bottom: 15px; - font-size: 14px; + .confirm-btn:hover { + background-color: #3949ab; + } + + .cancel-btn:hover { + background-color: #c5cae9; }
-
-
导入数据预览
- +
+
+
+
正在导入数据,请稍候...
+
-
- 当前机型:${planeName} +
+
导入数据
+
diff --git a/XNSimPortal/server.js b/XNSimPortal/server.js index 3b21e5e..6107bc6 100644 --- a/XNSimPortal/server.js +++ b/XNSimPortal/server.js @@ -58,8 +58,8 @@ app.use(session({ maxAge: 30 * 60 * 1000 // cookie 有效期 30 分钟 } })); -app.use(bodyParser.json()); -app.use(bodyParser.urlencoded({ extended: true })); +app.use(bodyParser.json({ limit: '50mb' })); // 增加JSON请求体大小限制到50MB +app.use(bodyParser.urlencoded({ extended: true, limit: '50mb' })); // 增加URL编码请求体大小限制到50MB // 静态文件服务 - 放在根路径处理之前 app.use(express.static(__dirname));