完善阵位分配命令的变量数据加载

This commit is contained in:
2026-04-15 17:22:22 +08:00
parent a08e061979
commit dbbc8a27c3
3 changed files with 25 additions and 31 deletions

View File

@@ -135,7 +135,7 @@
<a-select :placeholder="`请选择${setting.description}`"
allow-clear
v-else-if="setting.paramKey === 'platforms'" v-model:value="setting.defaultValue">
<a-select-option v-for="pl in platforms" :value="pl.name">{{ pl.description }}</a-select-option>
<a-select-option v-for="pl in getAvailablePlatforms()" :value="pl.name">{{ pl.description }}</a-select-option>
</a-select>
<a-select :placeholder="`请选择${setting.description}`"
allow-clear
@@ -231,7 +231,16 @@ export default defineComponent({
const addParameterTab = () => {
let newParameters = dumpParameters();
// 新增一个空的参数分组
// 如果有下属平台,预填对应索引的平台名称
const nextIndex = groupedParameters.value.length;
const subPlatform = subPlatforms.value[nextIndex];
if (subPlatform) {
const platformParam = newParameters.find(p => p.paramKey === 'platforms');
if (platformParam) {
platformParam.defaultValue = subPlatform.name;
}
}
// 新增一个参数分组
groupedParameters.value.push(newParameters);
// 自动切换到新增的分组
groupedParametersActiveTab.value = groupedParameters.value.length - 1;
@@ -301,24 +310,13 @@ export default defineComponent({
multiableParameters.value = multiable === true && groupedParameters.value.length > 0;
};
// 获取平台Tab显示名称
// 获取平台Tab显示名称(优先使用下属平台名称)
const getPlatformTabName = (index: number): string => {
if (!currentTree.value?.platformId) {
return `平台 ${index + 1}`;
const sub = subPlatforms.value[index];
if (sub) {
return sub.name || sub.description || `平台 ${index + 1}`;
}
// 查找当前行为树绑定的平台
const currentPlatform = platforms.value.find(p => p.id === currentTree.value?.platformId);
if (!currentPlatform) {
return `平台 ${index + 1}`;
}
// 如果有多个分组,显示平台名称和索引
if (groupedParameters.value.length > 1) {
return `${currentPlatform.name || '未知平台'}-${index + 1}`;
}
return currentPlatform.name || '平台';
return `平台 ${index + 1}`;
};
// 获取可用的平台列表(包括当前平台和其下属平台)