@@ -108,7 +108,8 @@
|
|||||||
:placeholder="setting.description" size="small" style="width:100%;" />
|
:placeholder="setting.description" size="small" style="width:100%;" />
|
||||||
<a-select :placeholder="`请选择${setting.description}`"
|
<a-select :placeholder="`请选择${setting.description}`"
|
||||||
allow-clear
|
allow-clear
|
||||||
v-else-if="setting.paramKey === 'platforms'" v-model:value="setting.defaultValue">
|
v-else-if="setting.paramKey === 'platforms'"
|
||||||
|
v-model:value="setting.defaultValue">
|
||||||
<a-select-option v-for="pl in getAvailablePlatforms()" :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>
|
||||||
<a-select :placeholder="`请选择${setting.description}`"
|
<a-select :placeholder="`请选择${setting.description}`"
|
||||||
@@ -315,17 +316,46 @@ export default defineComponent({
|
|||||||
});
|
});
|
||||||
|
|
||||||
// 第二步:将 Map 转换为二维数组(按 groupIndex 升序排序)
|
// 第二步:将 Map 转换为二维数组(按 groupIndex 升序排序)
|
||||||
groupedParameters.value = Array.from(groupMap.entries())
|
const rawGroups = Array.from(groupMap.entries())
|
||||||
// 按分组索引从小到大排序(保证分组顺序正确)
|
|
||||||
.sort((a, b) => a[0] - b[0])
|
.sort((a, b) => a[0] - b[0])
|
||||||
// 只保留分组后的参数数组,丢弃 key
|
|
||||||
.map(item => item[1]);
|
.map(item => item[1]);
|
||||||
|
|
||||||
|
// 第三步:展开逗号分隔的 platforms 值 —— 每个平台拆成独立分组
|
||||||
|
const expandedGroups: Array<ElementParameter[]> = [];
|
||||||
|
for (const group of rawGroups) {
|
||||||
|
const platformParam = group.find(p => p.paramKey === 'platforms');
|
||||||
|
if (platformParam) {
|
||||||
|
const platformValues = String(platformParam.defaultValue ?? '')
|
||||||
|
.split(',')
|
||||||
|
.map(v => v.trim())
|
||||||
|
.filter(Boolean);
|
||||||
|
if (platformValues.length > 1) {
|
||||||
|
// 每个平台值生成独立分组,其余参数保持一致
|
||||||
|
for (const pv of platformValues) {
|
||||||
|
const newGroup = JSON.parse(JSON.stringify(group)) as ElementParameter[];
|
||||||
|
const pp = newGroup.find(p => p.paramKey === 'platforms');
|
||||||
|
if (pp) pp.defaultValue = pv;
|
||||||
|
expandedGroups.push(newGroup);
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
expandedGroups.push(group);
|
||||||
|
}
|
||||||
|
|
||||||
|
groupedParameters.value = expandedGroups;
|
||||||
multiableParameters.value = multiable === true && groupedParameters.value.length > 0;
|
multiableParameters.value = multiable === true && groupedParameters.value.length > 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
// 获取平台Tab显示名称(优先使用下属平台名称)
|
// 获取平台Tab显示名称(优先取该分组的 platforms 参数值,其次下属平台名称)
|
||||||
const getPlatformTabName = (index: number): string => {
|
const getPlatformTabName = (index: number): string => {
|
||||||
|
const group = groupedParameters.value[index];
|
||||||
|
if (group) {
|
||||||
|
const platformParam = group.find(p => p.paramKey === 'platforms');
|
||||||
|
if (platformParam?.defaultValue) {
|
||||||
|
return String(platformParam.defaultValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
const sub = subPlatforms.value[index];
|
const sub = subPlatforms.value[index];
|
||||||
if (sub) {
|
if (sub) {
|
||||||
return sub.name || sub.description || `平台 ${index + 1}`;
|
return sub.name || sub.description || `平台 ${index + 1}`;
|
||||||
|
|||||||
Reference in New Issue
Block a user