refactor(测试计划): 测试计划详情-缺陷列表-点id查看详情
This commit is contained in:
parent
536185bdca
commit
2650120822
|
@ -20,6 +20,7 @@
|
||||||
<slot name="titleLeft" :loading="loading" :detail="detail"></slot>
|
<slot name="titleLeft" :loading="loading" :detail="detail"></slot>
|
||||||
</div>
|
</div>
|
||||||
<MsPrevNextButton
|
<MsPrevNextButton
|
||||||
|
v-if="props.tableData && props.pagination && props.pageChange"
|
||||||
ref="prevNextButtonRef"
|
ref="prevNextButtonRef"
|
||||||
v-model:loading="loading"
|
v-model:loading="loading"
|
||||||
class="ml-[16px]"
|
class="ml-[16px]"
|
||||||
|
@ -52,15 +53,15 @@
|
||||||
width: number;
|
width: number;
|
||||||
detailId: string; // 详情 id
|
detailId: string; // 详情 id
|
||||||
tooltipText?: string; // tooltip内容
|
tooltipText?: string; // tooltip内容
|
||||||
detailIndex: number; // 详情 下标
|
detailIndex?: number; // 详情 下标
|
||||||
tableData: any[]; // 表格数据
|
tableData?: any[]; // 表格数据
|
||||||
pagination: MsPaginationI; // 分页器对象
|
pagination?: MsPaginationI; // 分页器对象
|
||||||
showFullScreen?: boolean; // 是否显示全屏按钮
|
showFullScreen?: boolean; // 是否显示全屏按钮
|
||||||
pageChange: (page: number) => Promise<void>; // 分页变更函数
|
pageChange?: (page: number) => Promise<void>; // 分页变更函数
|
||||||
getDetailFunc: (id: string) => Promise<any>; // 获取详情的请求函数
|
getDetailFunc: (id: string) => Promise<any>; // 获取详情的请求函数
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const emit = defineEmits(['update:visible', 'loaded', 'loadingDetail']);
|
const emit = defineEmits(['update:visible', 'loaded', 'loadingDetail', 'getDetail']);
|
||||||
|
|
||||||
const prevNextButtonRef = ref<InstanceType<typeof MsPrevNextButton>>();
|
const prevNextButtonRef = ref<InstanceType<typeof MsPrevNextButton>>();
|
||||||
|
|
||||||
|
@ -108,7 +109,11 @@
|
||||||
if (innerVisible.value) {
|
if (innerVisible.value) {
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
// 为了确保 prevNextButtonRef 已渲染
|
// 为了确保 prevNextButtonRef 已渲染
|
||||||
|
if (props.tableData && props.pagination && props.pageChange) {
|
||||||
initDetail();
|
initDetail();
|
||||||
|
} else {
|
||||||
|
emit('getDetail');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
loading: boolean;
|
loading: boolean;
|
||||||
detailId: string; // 详情 id
|
detailId: string; // 详情 id
|
||||||
detailIndex: number; // 详情 下标
|
detailIndex?: number; // 详情 下标
|
||||||
tableData: any[]; // 表格数据
|
tableData: any[]; // 表格数据
|
||||||
pagination: MsPaginationI; // 分页器对象
|
pagination: MsPaginationI; // 分页器对象
|
||||||
pageChange: (page: number) => Promise<void>; // 分页变更函数
|
pageChange: (page: number) => Promise<void>; // 分页变更函数
|
||||||
|
@ -82,12 +82,12 @@
|
||||||
{ immediate: true }
|
{ immediate: true }
|
||||||
);
|
);
|
||||||
|
|
||||||
const activeDetailIndex = ref(props.detailIndex);
|
const activeDetailIndex = ref(props.detailIndex || 0);
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => props.detailIndex,
|
() => props.detailIndex,
|
||||||
(val) => {
|
(val) => {
|
||||||
activeDetailIndex.value = val;
|
activeDetailIndex.value = val as number;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -69,6 +69,7 @@ export interface TestPlanDetail extends AddTestPlanParams {
|
||||||
reReviewedCount: number;
|
reReviewedCount: number;
|
||||||
underReviewedCount: number;
|
underReviewedCount: number;
|
||||||
functionalCaseCount?: number;
|
functionalCaseCount?: number;
|
||||||
|
bugCount?: number;
|
||||||
apiCaseCount?: number;
|
apiCaseCount?: number;
|
||||||
apiScenarioCount?: number;
|
apiScenarioCount?: number;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
:mask="false"
|
:mask="false"
|
||||||
@loading-detail="setDetailLoading"
|
@loading-detail="setDetailLoading"
|
||||||
@loaded="loadedBug"
|
@loaded="loadedBug"
|
||||||
|
@get-detail="getDetail"
|
||||||
>
|
>
|
||||||
<template #titleLeft>
|
<template #titleLeft>
|
||||||
<div class="flex items-center">
|
<div class="flex items-center">
|
||||||
|
@ -286,11 +287,11 @@
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
visible: boolean;
|
visible: boolean;
|
||||||
detailId: string; // 详情 id
|
detailId: string; // 详情 id
|
||||||
detailIndex: number; // 详情 下标
|
detailIndex?: number; // 详情 下标
|
||||||
detailDefaultTab: string; // 详情默认 tab
|
detailDefaultTab: string; // 详情默认 tab
|
||||||
tableData: any[]; // 表格数据
|
tableData?: any[]; // 表格数据
|
||||||
pagination: MsPaginationI; // 分页器对象
|
pagination?: MsPaginationI; // 分页器对象
|
||||||
pageChange: (page: number) => Promise<void>; // 分页变更函数
|
pageChange?: (page: number) => Promise<void>; // 分页变更函数
|
||||||
currentPlatform: string;
|
currentPlatform: string;
|
||||||
}>();
|
}>();
|
||||||
const caseCount = ref(0);
|
const caseCount = ref(0);
|
||||||
|
@ -560,7 +561,11 @@
|
||||||
await deleteSingleBug(params);
|
await deleteSingleBug(params);
|
||||||
Message.success(t('common.deleteSuccess'));
|
Message.success(t('common.deleteSuccess'));
|
||||||
updateSuccess();
|
updateSuccess();
|
||||||
|
if (!props.pagination && !props.tableData) {
|
||||||
|
showDrawerVisible.value = false;
|
||||||
|
} else {
|
||||||
detailDrawerRef.value?.openPrevDetail();
|
detailDrawerRef.value?.openPrevDetail();
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.log(error);
|
console.log(error);
|
||||||
|
@ -655,6 +660,12 @@
|
||||||
});
|
});
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function getDetail() {
|
||||||
|
const res = await getBugDetail(props.detailId);
|
||||||
|
loadedBug(res);
|
||||||
|
}
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => showDrawerVisible.value,
|
() => showDrawerVisible.value,
|
||||||
(val) => {
|
(val) => {
|
||||||
|
@ -665,6 +676,7 @@
|
||||||
activeTab.value = 'detail';
|
activeTab.value = 'detail';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if (!props.pagination && !props.tableData) return;
|
||||||
const query = { ...route.query };
|
const query = { ...route.query };
|
||||||
delete query.id;
|
delete query.id;
|
||||||
router.replace({
|
router.replace({
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<MsBaseTable ref="tableRef" v-bind="propsRes" v-on="propsEvent">
|
<MsBaseTable ref="tableRef" v-bind="propsRes" v-on="propsEvent">
|
||||||
<template #num="{ record }">
|
<template v-if="props.canEdit" #num="{ record }">
|
||||||
<MsButton type="text" @click="toDetail(record.id)">{{ record.num }}</MsButton>
|
<MsButton type="text" @click="handleShowDetail(record.id)">{{ record.num }}</MsButton>
|
||||||
</template>
|
</template>
|
||||||
<template #name="{ record }">
|
<template #name="{ record }">
|
||||||
<a-tooltip :content="record.title">
|
<a-tooltip :content="record.title">
|
||||||
|
@ -35,6 +35,13 @@
|
||||||
</template>
|
</template>
|
||||||
</MsBaseTable>
|
</MsBaseTable>
|
||||||
</div>
|
</div>
|
||||||
|
<BugDetailDrawer
|
||||||
|
v-model:visible="detailVisible"
|
||||||
|
:detail-id="activeDetailId"
|
||||||
|
detail-default-tab="detail"
|
||||||
|
:current-platform="currentPlatform"
|
||||||
|
@submit="refresh"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
@ -46,22 +53,28 @@
|
||||||
import type { MsTableColumn } from '@/components/pure/ms-table/type';
|
import type { MsTableColumn } from '@/components/pure/ms-table/type';
|
||||||
import useTable from '@/components/pure/ms-table/useTable';
|
import useTable from '@/components/pure/ms-table/useTable';
|
||||||
import CaseCountPopover from './caseCountPopover.vue';
|
import CaseCountPopover from './caseCountPopover.vue';
|
||||||
|
import BugDetailDrawer from '@/views/bug-management/components/bug-detail-drawer.vue';
|
||||||
|
|
||||||
import { getCustomOptionHeader } from '@/api/modules/bug-management';
|
import { getCustomOptionHeader, getPlatform } from '@/api/modules/bug-management';
|
||||||
import { planDetailBugPage } from '@/api/modules/test-plan/testPlan';
|
import { planDetailBugPage } from '@/api/modules/test-plan/testPlan';
|
||||||
import { useI18n } from '@/hooks/useI18n';
|
import { useI18n } from '@/hooks/useI18n';
|
||||||
import useAppStore from '@/store/modules/app';
|
import useAppStore from '@/store/modules/app';
|
||||||
import { addCommasToNumber } from '@/utils';
|
import { addCommasToNumber } from '@/utils';
|
||||||
import { hasAnyPermission } from '@/utils/permission';
|
import { hasAnyPermission } from '@/utils/permission';
|
||||||
|
|
||||||
// import { BugManagementRouteEnum } from '@/enums/routeEnum';
|
|
||||||
import { TableKeyEnum } from '@/enums/tableEnum';
|
import { TableKeyEnum } from '@/enums/tableEnum';
|
||||||
|
|
||||||
import { makeColumns } from '@/views/case-management/caseManagementFeature/components/utils';
|
import { makeColumns } from '@/views/case-management/caseManagementFeature/components/utils';
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
canEdit: boolean;
|
||||||
|
}>();
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'refresh'): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
// const router = useRouter();
|
|
||||||
const appStore = useAppStore();
|
const appStore = useAppStore();
|
||||||
|
|
||||||
const keyword = ref<string>('');
|
const keyword = ref<string>('');
|
||||||
|
@ -166,20 +179,27 @@
|
||||||
tableRef.value?.initColumn(columns.value);
|
tableRef.value?.initColumn(columns.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
function toDetail(id: string) {
|
const detailVisible = ref(false);
|
||||||
// eslint-disable-next-line no-console
|
const activeDetailId = ref<string>('');
|
||||||
console.log('id', id);
|
const currentPlatform = ref('Local');
|
||||||
// TODO: 查看详情
|
const handleShowDetail = async (id: string) => {
|
||||||
// window.open(
|
activeDetailId.value = id;
|
||||||
// `${window.location.origin}#${
|
detailVisible.value = true;
|
||||||
// router.resolve({ name: BugManagementRouteEnum.BUG_MANAGEMENT_INDEX }).fullPath
|
};
|
||||||
// }?id=${id}&orgId=${appStore.currentOrgId}&pId=${appStore.currentProjectId}`
|
const setCurrentPlatform = async () => {
|
||||||
// );
|
const res = await getPlatform(appStore.currentProjectId);
|
||||||
|
currentPlatform.value = res;
|
||||||
|
};
|
||||||
|
|
||||||
|
function refresh() {
|
||||||
|
loadList();
|
||||||
|
emit('refresh');
|
||||||
}
|
}
|
||||||
|
|
||||||
onBeforeMount(() => {
|
onBeforeMount(() => {
|
||||||
initFilterOptions();
|
initFilterOptions();
|
||||||
getFetch();
|
getFetch();
|
||||||
|
setCurrentPlatform();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -107,7 +107,7 @@
|
||||||
:can-edit="detail.status !== 'ARCHIVED'"
|
:can-edit="detail.status !== 'ARCHIVED'"
|
||||||
@refresh="initDetail"
|
@refresh="initDetail"
|
||||||
/>
|
/>
|
||||||
<BugManagement v-if="activeTab === 'defectList'" />
|
<BugManagement v-if="activeTab === 'defectList'" :can-edit="detail.status !== 'ARCHIVED'" @refresh="initDetail" />
|
||||||
<ApiCase
|
<ApiCase
|
||||||
v-if="activeTab === 'apiCase'"
|
v-if="activeTab === 'apiCase'"
|
||||||
ref="apiCaseRef"
|
ref="apiCaseRef"
|
||||||
|
@ -326,6 +326,9 @@
|
||||||
case 'featureCase':
|
case 'featureCase':
|
||||||
const count = detail.value.functionalCaseCount ?? 0;
|
const count = detail.value.functionalCaseCount ?? 0;
|
||||||
return `${count > 0 ? count : ''}`;
|
return `${count > 0 ? count : ''}`;
|
||||||
|
case 'defectList':
|
||||||
|
const bugCount = detail.value.bugCount ?? 0;
|
||||||
|
return `${bugCount > 0 ? bugCount : ''}`;
|
||||||
case 'apiCase':
|
case 'apiCase':
|
||||||
const apiCaseCount = detail.value?.apiCaseCount ?? 0;
|
const apiCaseCount = detail.value?.apiCaseCount ?? 0;
|
||||||
return `${apiCaseCount > 0 ? apiCaseCount : ''}`;
|
return `${apiCaseCount > 0 ? apiCaseCount : ''}`;
|
||||||
|
|
Loading…
Reference in New Issue