feat(测试计划&接口测试): 优化测试计划报告&接口报告选中高亮

This commit is contained in:
xinxin.wu 2024-10-08 17:50:39 +08:00 committed by Craftsman
parent a88a5e305b
commit b94b8ade44
4 changed files with 40 additions and 29 deletions

View File

@ -5,6 +5,7 @@
ref="treeRef" ref="treeRef"
v-model:selected-keys="selectedKeys" v-model:selected-keys="selectedKeys"
v-model:expanded-keys="innerExpandedKeys" v-model:expanded-keys="innerExpandedKeys"
v-model:focus-node-key="focusStepKey"
v-model:data="steps" v-model:data="steps"
:expand-all="props.expandAll" :expand-all="props.expandAll"
:field-names="{ title: 'name', key: 'stepId', children: 'children' }" :field-names="{ title: 'name', key: 'stepId', children: 'children' }"
@ -66,16 +67,9 @@
<div v-if="props.showType === 'API' && showCondition.includes(step.stepType)" class="flex-shrink-0"> <div v-if="props.showType === 'API' && showCondition.includes(step.stepType)" class="flex-shrink-0">
<ConditionStatus class="mx-1" :status="step.stepType || ''" /> <ConditionStatus class="mx-1" :status="step.stepType || ''" />
</div> </div>
<a-tooltip :content="step.name" :disabled="!step.name">
<a-tooltip :content="step.name" position="tl"> <div class="step-name-container" @click="showDetail($event, step)">
<div <div class="step-name-text one-line-text ml-[4px] font-normal">
class="step-name-container"
:class="{
'w-full flex-grow': showApiType.includes(step.stepType),
}"
@click="showDetail($event, step)"
>
<div class="one-line-text mx-[4px] max-w-[300px] text-[var(--color-text-1)]">
{{ step.name }} {{ step.name }}
</div> </div>
</div> </div>
@ -317,7 +311,6 @@
} }
activeItem.value = cloneDeep(item); activeItem.value = cloneDeep(item);
emit('detail', activeItem.value); emit('detail', activeItem.value);
event.stopPropagation();
} }
// //
@ -390,10 +383,9 @@
@apply flex w-full flex-1 items-center; @apply flex w-full flex-1 items-center;
gap: 8px; gap: 8px;
margin-right: 6px;
} }
.step-name-container { .step-name-container {
@apply flex items-center; @apply flex flex-1 items-center overflow-hidden;
margin-right: 16px; margin-right: 16px;
&:hover { &:hover {
@ -422,7 +414,7 @@
} }
.ms-tree-node-extra { .ms-tree-node-extra {
gap: 4px; gap: 4px;
background-color: white !important; background-color: var(--color-text-n9) !important;
} }
} }
:deep(.arco-tree-node-selected) { :deep(.arco-tree-node-selected) {
@ -433,11 +425,8 @@
} }
} }
} }
:deep(.step-tree-node-focus) { :deep(.step-tree-node-title) {
background-color: white !important; @apply w-full;
.arco-tree-node-title {
background-color: white;
}
} }
.resTime, .resTime,
.resSize, .resSize,
@ -484,11 +473,14 @@
border-radius: 6px; border-radius: 6px;
} }
} }
:deep(.ms-tree-container .ms-tree .arco-tree-node .arco-tree-node-title) { :deep(.step-tree-node-focus) {
background: white; background-color: var(--color-text-n9) !important;
.arco-tree-node-title {
background-color: var(--color-text-n9) !important;
}
.ms-tree-node-extra {
@apply !visible !w-auto;
} }
:deep(.ms-tree-container .ms-tree .arco-tree-node-selected) {
background: white;
} }
.line { .line {
position: absolute; position: absolute;
@ -497,7 +489,4 @@
height: 1px; height: 1px;
background: var(--color-text-n8); background: var(--color-text-n8);
} }
:deep(.step-tree-node-title) {
width: 100%;
}
</style> </style>

View File

@ -1,6 +1,10 @@
<template> <template>
<div :class="`${props.enabledTestSet ? 'test-set-wrapper' : ''}`"> <div :class="`${props.enabledTestSet ? 'test-set-wrapper' : ''}`">
<MsBaseTable v-bind="currentCaseTable.propsRes.value" v-on="currentCaseTable.propsEvent.value"> <MsBaseTable
v-bind="currentCaseTable.propsRes.value"
:row-class="getRowClass"
v-on="currentCaseTable.propsEvent.value"
>
<template #num="{ record }"> <template #num="{ record }">
<MsButton type="text" @click="toDetail(record)">{{ record.num }}</MsButton> <MsButton type="text" @click="toDetail(record)">{{ record.num }}</MsButton>
</template> </template>
@ -240,6 +244,7 @@
const reportVisible = ref(false); const reportVisible = ref(false);
const apiReportId = ref<string>(''); const apiReportId = ref<string>('');
const selectedReportId = ref<string>('');
function showReport(record: ApiOrScenarioCaseItem) { function showReport(record: ApiOrScenarioCaseItem) {
if (!record.reportId) { if (!record.reportId) {
@ -248,6 +253,11 @@
if (!record.executeResult || record.executeResult === 'STOPPED') return; if (!record.executeResult || record.executeResult === 'STOPPED') return;
reportVisible.value = true; reportVisible.value = true;
apiReportId.value = record.reportId; apiReportId.value = record.reportId;
selectedReportId.value = record.reportId;
}
function getRowClass(record: ApiOrScenarioCaseItem) {
return record.reportId === selectedReportId.value ? 'selected-row-class' : '';
} }
// //

View File

@ -1,6 +1,6 @@
<template> <template>
<div :class="`${props.enabledTestSet ? 'test-set-wrapper' : ''}`"> <div :class="`${props.enabledTestSet ? 'test-set-wrapper' : ''}`">
<MsBaseTable v-bind="propsRes" v-on="propsEvent"> <MsBaseTable v-bind="propsRes" :row-class="getRowClass" v-on="propsEvent">
<template #num="{ record }"> <template #num="{ record }">
<MsButton :disabled="!props.isPreview" type="text" @click="toDetail(record)">{{ record.num }}</MsButton> <MsButton :disabled="!props.isPreview" type="text" @click="toDetail(record)">{{ record.num }}</MsButton>
</template> </template>
@ -276,12 +276,18 @@
} }
} }
const selectedId = ref<string>('');
function openExecuteHistory(record: FeatureCaseItem) { function openExecuteHistory(record: FeatureCaseItem) {
executeReportId.value = record.reportId; executeReportId.value = record.reportId;
selectedId.value = record.reportId;
showDetailVisible.value = true; showDetailVisible.value = true;
getExecuteStep(); getExecuteStep();
} }
function getRowClass(record: FeatureCaseItem) {
return record.reportId === selectedId.value ? 'selected-row-class' : '';
}
watch( watch(
() => props.isPreview, () => props.isPreview,
(val) => { (val) => {

View File

@ -135,4 +135,10 @@
@apply overflow-y-auto bg-white; @apply overflow-y-auto bg-white;
.ms-scroll-bar(); .ms-scroll-bar();
} }
:deep(.selected-row-class.arco-table-tr) {
background: var(--color-fill-1) !important;
.arco-table-td {
background: var(--color-fill-1) !important;
}
}
</style> </style>