fix(工作台): 修复工作台测试计划卡片bug

This commit is contained in:
xinxin.wu 2024-12-20 19:15:17 +08:00 committed by 刘瑞斌
parent f7355b11ec
commit e71f4de9a0
4 changed files with 39 additions and 5 deletions

View File

@ -31,6 +31,7 @@ export interface SelectedCardItem {
handleUsers: string[];
selectAll: boolean; // 是否全选项目
planId: string; // 测试计划id
groupId: string; // 测试计划组id
}
// 查询入参

View File

@ -147,6 +147,7 @@
handleUsers: [],
selectAll: !![WorkCardEnum.PROJECT_VIEW, WorkCardEnum.CREATE_BY_ME].includes(item.value),
planId: '',
groupId: '',
};
selectedCardList.value.push(newCard);
}

View File

@ -126,6 +126,10 @@
required: true,
});
const innerGroupPlanId = defineModel<string>('groupId', {
required: true,
});
const innerProjectIds = defineModel<string[]>('projectIds', {
required: true,
});
@ -353,9 +357,17 @@
}
}
async function changeHandler(value: string) {
async function changeHandler(value: string[]) {
selectValue.value = value;
innerPlanId.value = value[value.length - 1];
innerProjectIds.value = [value[0]];
const planLevel = 3;
if (value.length === planLevel) {
innerGroupPlanId.value = value[value.length - 2];
} else {
innerGroupPlanId.value = '';
}
await nextTick();
labelPath.value = getLabelPath(innerPlanId.value);
initOverViewDetail();
@ -407,27 +419,46 @@
}
}
function getSelectedParams() {
const [newProjectId] = innerProjectIds.value;
const selectedData = [newProjectId, innerGroupPlanId.value, innerPlanId.value];
selectValue.value = [];
const tempArr: string[] = [];
selectedData.forEach((e) => {
if (e) {
tempArr.push(e);
}
});
return tempArr;
}
async function handleRefreshKeyChange() {
await nextTick(() => {
innerProjectIds.value = [...props.item.projectIds];
});
const [newProjectId] = innerProjectIds.value;
selectValue.value = [newProjectId, props.item.planId];
selectValue.value = getSelectedParams();
refreshHandler(newProjectId);
labelPath.value = getLabelPath(innerPlanId.value);
}
const defaultValue = computed(() => {
const [newProjectId] = innerProjectIds.value;
return [newProjectId, innerPlanId.value];
const selectedData = [newProjectId, props.item.groupId, props.item.planId];
const tempArr: string[] = [];
selectedData.forEach((e) => {
if (e) {
tempArr.push(e);
}
});
return tempArr;
});
onMounted(() => {
projectOptions.value = appStore.projectList.map((e) => ({ value: e.id, label: e.name }));
const [newProjectId] = props.item.projectIds;
if (props.item.planId) {
selectValue.value = [newProjectId, props.item.planId];
selectValue.value = getSelectedParams();
}
refreshHandler(newProjectId);
});

View File

@ -150,6 +150,7 @@
<TestPlanOverView
v-else-if="item.key === WorkCardEnum.PROJECT_PLAN_VIEW"
v-model:planId="item.planId"
v-model:groupId="item.groupId"
v-model:projectIds="item.projectIds"
:item="item"
:refresh-key="refreshKey"