V0.36.7.250630_alpha:修复接口配置时无法选择其它章节的问题
This commit is contained in:
parent
6028e98292
commit
723927c8f7
Binary file not shown.
@ -849,7 +849,7 @@ class ConfigurationConfig extends HTMLElement {
|
|||||||
const baseConfig = await this.showBaseConfigDialog(configs, planeName);
|
const baseConfig = await this.showBaseConfigDialog(configs, planeName);
|
||||||
if (baseConfig !== null) {
|
if (baseConfig !== null) {
|
||||||
const defaultConfig = {
|
const defaultConfig = {
|
||||||
ConfName: '',
|
ConfName: baseConfig.ConfName, // 使用用户输入的构型名称
|
||||||
OSName: baseConfig?.OSName || '',
|
OSName: baseConfig?.OSName || '',
|
||||||
OSVersion: baseConfig?.OSVersion || '',
|
OSVersion: baseConfig?.OSVersion || '',
|
||||||
RTXVersion: baseConfig?.RTXVersion || '',
|
RTXVersion: baseConfig?.RTXVersion || '',
|
||||||
|
@ -105,9 +105,10 @@ class InterfaceConfig extends HTMLElement {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// 确认导入事件
|
// 导入确认事件
|
||||||
importDialog.addEventListener('confirm-import', async (e) => {
|
importDialog.addEventListener('confirm-import', async (e) => {
|
||||||
const importData = e.detail;
|
const importData = e.detail;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const savedSelection = localStorage.getItem('xnsim-selection');
|
const savedSelection = localStorage.getItem('xnsim-selection');
|
||||||
if (!savedSelection) {
|
if (!savedSelection) {
|
||||||
@ -143,12 +144,23 @@ class InterfaceConfig extends HTMLElement {
|
|||||||
if (result.success) {
|
if (result.success) {
|
||||||
await this.loadData();
|
await this.loadData();
|
||||||
alert('导入成功');
|
alert('导入成功');
|
||||||
|
// 关闭导入对话框
|
||||||
|
const importDialog = this.shadowRoot.querySelector('import-dialog');
|
||||||
|
if (importDialog && importDialog.hide) {
|
||||||
|
importDialog.hide();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Error(result.error || '保存导入数据失败');
|
throw new Error(result.error || '保存导入数据失败');
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('保存导入数据时出错:', error);
|
console.error('保存导入数据时出错:', error);
|
||||||
alert(error.message || '保存导入数据失败');
|
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('请先选择构型');
|
throw new Error('请先选择构型');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取接口数据
|
||||||
const response = await fetch(`/api/interface/list?confID=${selection.configurationId}`);
|
const response = await fetch(`/api/interface/list?confID=${selection.configurationId}`);
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error('获取数据失败');
|
throw new Error('获取数据失败');
|
||||||
}
|
}
|
||||||
this.data = await response.json();
|
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.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.updateTable();
|
||||||
this.updateAdvancedSearchOptions();
|
this.updateAdvancedSearchOptions();
|
||||||
|
@ -73,7 +73,7 @@ class ImportDialog extends HTMLElement {
|
|||||||
this.updateTable();
|
this.updateTable();
|
||||||
});
|
});
|
||||||
|
|
||||||
confirmBtn.addEventListener('click', () => {
|
confirmBtn.addEventListener('click', async () => {
|
||||||
const ataSelect = this.shadowRoot.querySelector('#ata-select');
|
const ataSelect = this.shadowRoot.querySelector('#ata-select');
|
||||||
const modelInput = this.shadowRoot.querySelector('#model-input');
|
const modelInput = this.shadowRoot.querySelector('#model-input');
|
||||||
|
|
||||||
@ -127,15 +127,32 @@ class ImportDialog extends HTMLElement {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 显示加载蒙版
|
||||||
|
this.showLoading();
|
||||||
|
|
||||||
|
// 触发导入事件,让父组件处理导入逻辑
|
||||||
this.dispatchEvent(new CustomEvent('confirm-import', {
|
this.dispatchEvent(new CustomEvent('confirm-import', {
|
||||||
detail: processedData,
|
detail: processedData,
|
||||||
bubbles: true,
|
bubbles: true,
|
||||||
composed: 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() {
|
render() {
|
||||||
// 从 localStorage 获取机型信息
|
// 从 localStorage 获取机型信息
|
||||||
const savedSelection = localStorage.getItem('xnsim-selection');
|
const savedSelection = localStorage.getItem('xnsim-selection');
|
||||||
@ -168,6 +185,41 @@ class ImportDialog extends HTMLElement {
|
|||||||
max-height: 90vh;
|
max-height: 90vh;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
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 {
|
.header {
|
||||||
@ -259,30 +311,33 @@ class ImportDialog extends HTMLElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.confirm-btn {
|
.confirm-btn {
|
||||||
background-color: #4CAF50;
|
background-color: #5c6bc0;
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cancel-btn {
|
.cancel-btn {
|
||||||
background-color: #f44336;
|
background-color: #e8eaf6;
|
||||||
color: white;
|
color: #5c6bc0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.plane-info {
|
.confirm-btn:hover {
|
||||||
background-color: #f5f5f5;
|
background-color: #3949ab;
|
||||||
padding: 10px;
|
}
|
||||||
border-radius: 4px;
|
|
||||||
margin-bottom: 15px;
|
.cancel-btn:hover {
|
||||||
font-size: 14px;
|
background-color: #c5cae9;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<div class="dialog">
|
<div class="dialog">
|
||||||
<div class="header">
|
<div class="loading-overlay">
|
||||||
<div class="title">导入数据预览</div>
|
<div style="text-align: center;">
|
||||||
<button class="close-btn">×</button>
|
<div class="loading-spinner"></div>
|
||||||
|
<div class="loading-text">正在导入数据,请稍候...</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="plane-info">
|
<div class="header">
|
||||||
当前机型:${planeName}
|
<div class="title">导入数据</div>
|
||||||
|
<button class="close-btn">×</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="options">
|
<div class="options">
|
||||||
<div class="option-group">
|
<div class="option-group">
|
||||||
|
@ -58,8 +58,8 @@ app.use(session({
|
|||||||
maxAge: 30 * 60 * 1000 // cookie 有效期 30 分钟
|
maxAge: 30 * 60 * 1000 // cookie 有效期 30 分钟
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
app.use(bodyParser.json());
|
app.use(bodyParser.json({ limit: '50mb' })); // 增加JSON请求体大小限制到50MB
|
||||||
app.use(bodyParser.urlencoded({ extended: true }));
|
app.use(bodyParser.urlencoded({ extended: true, limit: '50mb' })); // 增加URL编码请求体大小限制到50MB
|
||||||
|
|
||||||
// 静态文件服务 - 放在根路径处理之前
|
// 静态文件服务 - 放在根路径处理之前
|
||||||
app.use(express.static(__dirname));
|
app.use(express.static(__dirname));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user