V0.37.1.250711_alpha:修复了一系列问题
This commit is contained in:
parent
b1f1c4970f
commit
18308ad375
Binary file not shown.
@ -1864,7 +1864,7 @@ class ConfigurationConfig extends HTMLElement {
|
||||
let serviceList = [];
|
||||
|
||||
try {
|
||||
const response = await fetch('/api/services');
|
||||
const response = await fetch('/api/service-dev/services');
|
||||
if (!response.ok) throw new Error('B03042015: 获取服务列表失败');
|
||||
serviceList = await response.json();
|
||||
serviceSelect.innerHTML = '<option value="">请选择服务</option>' +
|
||||
@ -1886,7 +1886,7 @@ class ConfigurationConfig extends HTMLElement {
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await fetch(`/api/service-versions/${className}`);
|
||||
const response = await fetch(`/api/service-dev/service-versions/${className}`);
|
||||
if (!response.ok) throw new Error('B03042016: 获取版本列表失败');
|
||||
const versions = await response.json();
|
||||
versionSelect.innerHTML = '<option value="">请选择版本</option>' +
|
||||
|
@ -919,12 +919,12 @@ class ModelDevelopment extends HTMLElement {
|
||||
<div class="form-group">
|
||||
<label for="runFreqGroup">运行频率组 (RunFreqGroup)</label>
|
||||
<select id="runFreqGroup" name="RunFreqGroup" title="模型的运行频率组">
|
||||
<option value="0" ${this.currentVersion.RunFreqGroup === '0' ? 'selected' : ''}>基频 (0)</option>
|
||||
<option value="1" ${this.currentVersion.RunFreqGroup === '1' ? 'selected' : ''}>半频 (1)</option>
|
||||
<option value="2" ${this.currentVersion.RunFreqGroup === '2' ? 'selected' : ''}>1/4频 (2)</option>
|
||||
<option value="3" ${this.currentVersion.RunFreqGroup === '3' ? 'selected' : ''}>1/8频 (3)</option>
|
||||
<option value="4" ${this.currentVersion.RunFreqGroup === '4' ? 'selected' : ''}>1/16频 (4)</option>
|
||||
<option value="5" ${this.currentVersion.RunFreqGroup === '5' ? 'selected' : ''}>1/32频 (5)</option>
|
||||
<option value="0" ${this.currentVersion.RunFreqGroup == '0' ? 'selected' : ''}>基频 (0)</option>
|
||||
<option value="1" ${this.currentVersion.RunFreqGroup == '1' ? 'selected' : ''}>半频 (1)</option>
|
||||
<option value="2" ${this.currentVersion.RunFreqGroup == '2' ? 'selected' : ''}>1/4频 (2)</option>
|
||||
<option value="3" ${this.currentVersion.RunFreqGroup == '3' ? 'selected' : ''}>1/8频 (3)</option>
|
||||
<option value="4" ${this.currentVersion.RunFreqGroup == '4' ? 'selected' : ''}>1/16频 (4)</option>
|
||||
<option value="5" ${this.currentVersion.RunFreqGroup == '5' ? 'selected' : ''}>1/32频 (5)</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@ -1299,11 +1299,19 @@ class ModelDevelopment extends HTMLElement {
|
||||
const option = document.createElement('option');
|
||||
option.value = i.toString();
|
||||
option.textContent = i.toString();
|
||||
if (this.currentVersion.RunNode === i.toString()) {
|
||||
|
||||
// 使用宽松比较,处理数字和字符串类型
|
||||
if (this.currentVersion.RunNode == i.toString()) {
|
||||
option.selected = true;
|
||||
}
|
||||
|
||||
runNodeSelect.appendChild(option);
|
||||
}
|
||||
|
||||
// 如果没有选中任何选项,默认选择第一个
|
||||
if (runNodeSelect.selectedIndex === -1 && maxNode > 0) {
|
||||
runNodeSelect.selectedIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -854,35 +854,33 @@ async function findStructDefinition(headerFilePath, structName) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 匹配成员声明
|
||||
// 基础类型: int, double, float, char, short, long, unsigned, etc.
|
||||
// 结构体指针: struct xxx_S*
|
||||
// 结构体: struct xxx_S
|
||||
const memberRegex = /^(?:const\s+)?(?:struct\s+([A-Za-z_][A-Za-z0-9_]*)\s*)?(?:unsigned\s+)?(?:long\s+)?(?:int\s+)?(?:char\s+)?(?:short\s+)?(?:float\s+)?(?:double\s+)?(?:void\s*)?(?:[A-Za-z_][A-Za-z0-9_]*\s*)?(\*?)\s*([A-Za-z_][A-Za-z0-9_]*)\s*(?:\[[^\]]*\])?\s*;?\s*$/;
|
||||
/**
|
||||
* 匹配结构体成员声明,包括如下形式:
|
||||
* int a;
|
||||
* double b;
|
||||
* struct input_hydraulic_S input;
|
||||
* struct input_hydraulic_S *input;
|
||||
* float arr[10];
|
||||
* const char *name;
|
||||
*/
|
||||
// 新正则:分组更清晰,支持struct和基础类型指针
|
||||
const memberRegex = /^(?:const\s+)?(?:(struct)\s+([A-Za-z_][A-Za-z0-9_]*)\s*)?([A-Za-z_][A-Za-z0-9_\s]*?)?(\*?)\s*([A-Za-z_][A-Za-z0-9_]*)\s*(?:\[[^\]]*\])?\s*;?\s*$/;
|
||||
|
||||
const memberMatch = trimmedLine.match(memberRegex);
|
||||
if (memberMatch) {
|
||||
const structType = memberMatch[1]; // 结构体类型名
|
||||
const isPointer = memberMatch[2]; // 是否为指针
|
||||
const memberName = memberMatch[3]; // 成员名
|
||||
const isStruct = memberMatch[1]; // struct关键字
|
||||
const structType = memberMatch[2]; // 结构体类型名
|
||||
const baseType = memberMatch[3] ? memberMatch[3].trim() : '';
|
||||
const isPointer = memberMatch[4]; // *
|
||||
const memberName = memberMatch[5]; // 变量名
|
||||
|
||||
// 构建类型信息
|
||||
let type = '';
|
||||
if (structType) {
|
||||
// 结构体类型
|
||||
if (isStruct && structType) {
|
||||
type = `struct ${structType}${isPointer ? '*' : ''}`;
|
||||
} else {
|
||||
// 基础类型,需要从原始行中提取
|
||||
const typeMatch = trimmedLine.match(/^(?:const\s+)?(?:unsigned\s+)?(?:long\s+)?(?:int\s+)?(?:char\s+)?(?:short\s+)?(?:float\s+)?(?:double\s+)?(?:void\s*)?(?:[A-Za-z_][A-Za-z0-9_]*\s*)?/);
|
||||
if (typeMatch) {
|
||||
type = typeMatch[0].trim() + (isPointer ? '*' : '');
|
||||
} else {
|
||||
type = 'unknown';
|
||||
}
|
||||
type = `${baseType}${isPointer ? '*' : ''}`.replace(/\s+/g, ' ').trim();
|
||||
}
|
||||
|
||||
// 拼接类型和成员名
|
||||
const memberString = `${type} ${memberName}`;
|
||||
const memberString = `${type} ${memberName}`.trim();
|
||||
memberNames.push(memberString);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user