feat(用例管理): 用例列表新增执行结果&列表更新

This commit is contained in:
WangXu10 2024-04-17 13:44:00 +08:00 committed by 刘瑞斌
parent fe9d313c2a
commit 39b21dccb6
5 changed files with 147 additions and 27 deletions

View File

@ -118,4 +118,7 @@ public class FunctionalCaseDetailDTO implements Serializable {
@Schema(description = "变更历史数量") @Schema(description = "变更历史数量")
private Integer historyCount; private Integer historyCount;
@Schema(description = "执行结果")
private String lastExecuteResult;
} }

View File

@ -78,5 +78,6 @@ public class FunctionalCaseAddRequest implements Serializable {
@Schema(description = "附件信息") @Schema(description = "附件信息")
private List<FunctionalCaseAttachmentDTO> attachments; private List<FunctionalCaseAttachmentDTO> attachments;
@Schema(description = "执行结果")
private String lastExecuteResult;
} }

View File

@ -0,0 +1,68 @@
<template>
<div v-if="props.executeResult" class="flex items-center">
<MsIcon
:type="lastExecuteResultMap[props.executeResult]?.icon || ''"
class="mr-1"
:class="[lastExecuteResultMap[props.executeResult].color]"
></MsIcon>
<span>{{ status?.text || '' }}</span>
</div>
</template>
<script setup lang="ts">
import MsIcon from '@/components/pure/ms-icon-font/index.vue';
import { useI18n } from '@/hooks/useI18n';
import { LastExecuteResults, StatusType } from '@/enums/caseEnum';
const { t } = useI18n();
const props = defineProps<{
executeResult?: LastExecuteResults;
}>();
const lastExecuteResultMap = {
UN_EXECUTED: {
label: 'UN_EXECUTED',
icon: StatusType.UN_EXECUTED,
statusText: 'caseManagement.featureCase.nonExecution',
color: 'text-[rgb(var(--warning-6))]',
},
PASSED: {
label: 'PASSED',
icon: StatusType.PASSED,
statusText: 'caseManagement.featureCase.passed',
color: '',
},
SKIPPED: {
label: 'SKIPPED',
icon: StatusType.SKIPPED,
statusText: 'caseManagement.featureCase.skip',
color: 'text-[rgb(var(--link-6))]',
},
BLOCKED: {
label: 'BLOCKED',
icon: StatusType.BLOCKED,
statusText: 'caseManagement.featureCase.chokeUp',
color: 'text-[rgb(var(--warning-6))]',
},
FAILED: {
label: 'FAILED',
icon: StatusType.FAILED,
statusText: 'caseManagement.featureCase.failure',
color: '',
},
};
const status = computed(() => {
if (props.executeResult) {
const config = lastExecuteResultMap[props.executeResult];
return {
text: t(config?.statusText || ''),
};
}
});
</script>
<style lang="less" scoped></style>

View File

@ -12,4 +12,12 @@ export enum StatusType {
SKIPPED = 'icon-icon_skip_planarity', // 跳过 SKIPPED = 'icon-icon_skip_planarity', // 跳过
} }
export enum LastExecuteResults {
UN_EXECUTED = 'UN_EXECUTED',
PASSED = 'PASSED',
SKIPPED = 'SKIPPED',
BLOCKED = 'BLOCKED',
FAILED = 'FAILED',
}
export default {}; export default {};

View File

@ -92,19 +92,42 @@
</TableFilter> </TableFilter>
</template> </template>
<template #executeResultFilter="{ columnConfig }"> <template #executeResultFilter="{ columnConfig }">
<TableFilter <a-trigger
v-model:visible="executeResultFilterVisible" v-model:popup-visible="executeResultFilterVisible"
v-model:status-filters="executeResultFilters" trigger="click"
:title="(columnConfig.title as string)" @popup-visible-change="handleFilterHidden"
:list="executeResultFilterList"
value-key="key"
@search="initData()"
> >
<template #item="{ item }"> <a-button type="text" class="arco-btn-text--secondary p-[8px_4px]" @click="executeResultFilterVisible = true">
<MsIcon :type="item.icon || ''" class="mr-1" :class="[item.color]"></MsIcon> <div class="font-medium">
<span>{{ item.statusText || '' }}</span> {{ t(columnConfig.title as string) }}
</div>
<icon-down :class="executeResultFilterVisible ? 'text-[rgb(var(--primary-5))]' : ''" />
</a-button>
<template #content>
<div class="arco-table-filters-content">
<div class="ml-[6px] flex items-center justify-start px-[6px] py-[2px]">
<a-checkbox-group v-model:model-value="executeResultFilters" direction="vertical" size="small">
<a-checkbox v-for="key of Object.keys(executionResultMap)" :key="key" :value="key">
<MsIcon
:type="executionResultMap[key]?.icon || ''"
class="mr-1"
:class="[executionResultMap[key].color]"
></MsIcon>
<span>{{ executionResultMap[key]?.statusText || '' }} </span>
</a-checkbox>
</a-checkbox-group>
</div>
<div class="filter-button">
<a-button size="mini" class="mr-[8px]" @click="resetExecuteResultFilter">
{{ t('common.reset') }}
</a-button>
<a-button type="primary" size="mini" @click="handleFilterHidden(false)">
{{ t('system.orgTemplate.confirm') }}
</a-button>
</div>
</div>
</template> </template>
</TableFilter> </a-trigger>
</template> </template>
<template #updateUserFilter="{ columnConfig }"> <template #updateUserFilter="{ columnConfig }">
<TableFilter <TableFilter
@ -175,12 +198,19 @@
</a-trigger> </a-trigger>
</template> </template>
<template #lastExecuteResult="{ record }"> <template #lastExecuteResult="{ record }">
<MsIcon <a-select
:type="executionResultMap[record.lastExecuteResult]?.icon || ''" v-model:model-value="record.lastExecuteResult"
class="mr-1" :placeholder="t('common.pleaseSelect')"
:class="[executionResultMap[record.lastExecuteResult].color]" class="param-input w-full"
></MsIcon> @change="() => handleStatusChange(record)"
<span>{{ executionResultMap[record.lastExecuteResult]?.statusText || '' }}</span> >
<template #label>
<span class="text-[var(--color-text-2)]"> <executeResult :execute-result="record.lastExecuteResult" /></span>
</template>
<a-option v-for="item of LastExecuteResults" :key="item" :value="item">
<executeResult :execute-result="item" />
</a-option>
</a-select>
</template> </template>
<template #moduleId="{ record }"> <template #moduleId="{ record }">
<a-tree-select <a-tree-select
@ -377,6 +407,7 @@
import { ActionsItem } from '@/components/pure/ms-table-more-action/types'; import { ActionsItem } from '@/components/pure/ms-table-more-action/types';
import type { TagType, Theme } from '@/components/pure/ms-tag/ms-tag.vue'; import type { TagType, Theme } from '@/components/pure/ms-tag/ms-tag.vue';
import caseLevel from '@/components/business/ms-case-associate/caseLevel.vue'; import caseLevel from '@/components/business/ms-case-associate/caseLevel.vue';
import executeResult from '@/components/business/ms-case-associate/executeResult.vue';
import BatchEditModal from './batchEditModal.vue'; import BatchEditModal from './batchEditModal.vue';
import CaseDetailDrawer from './caseDetailDrawer.vue'; import CaseDetailDrawer from './caseDetailDrawer.vue';
import FeatureCaseTree from './caseTree.vue'; import FeatureCaseTree from './caseTree.vue';
@ -416,6 +447,7 @@
DragCase, DragCase,
} from '@/models/caseManagement/featureCase'; } from '@/models/caseManagement/featureCase';
import type { TableQueryParams } from '@/models/common'; import type { TableQueryParams } from '@/models/common';
import { LastExecuteResults } from '@/enums/caseEnum';
import { CaseManagementRouteEnum } from '@/enums/routeEnum'; import { CaseManagementRouteEnum } from '@/enums/routeEnum';
import { ColumnEditTypeEnum, TableKeyEnum } from '@/enums/tableEnum'; import { ColumnEditTypeEnum, TableKeyEnum } from '@/enums/tableEnum';
@ -569,15 +601,15 @@
width: 200, width: 200,
showDrag: true, showDrag: true,
}, },
// { {
// title: 'caseManagement.featureCase.tableColumnExecutionResult', title: 'caseManagement.featureCase.tableColumnExecutionResult',
// dataIndex: 'lastExecuteResult', dataIndex: 'lastExecuteResult',
// slotName: 'lastExecuteResult', slotName: 'lastExecuteResult',
// titleSlotName: 'executeResultFilter', titleSlotName: 'executeResultFilter',
// showInTable: true, showInTable: true,
// width: 200, width: 200,
// showDrag: true, showDrag: true,
// }, },
// { // {
// title: 'caseManagement.featureCase.tableColumnVersion', // title: 'caseManagement.featureCase.tableColumnVersion',
// slotName: 'versionName', // slotName: 'versionName',
@ -1416,6 +1448,7 @@
const params = { const params = {
request: { request: {
...detailResult, ...detailResult,
lastExecuteResult: record.lastExecuteResult,
customFields: customFieldsList, customFields: customFieldsList,
}, },
fileList: [], fileList: [],
@ -1556,6 +1589,7 @@
if (!val) { if (!val) {
initData(); initData();
statusFilterVisible.value = false; statusFilterVisible.value = false;
executeResultFilterVisible.value = false;
} }
} }
@ -1565,6 +1599,12 @@
initData(); initData();
} }
function resetExecuteResultFilter() {
executeResultFilters.value = [];
executeResultFilterVisible.value = false;
initData();
}
// //
onBeforeMount(async () => { onBeforeMount(async () => {
try { try {