feat(工作台): 工作台-我的创建&我的关注接口联调

This commit is contained in:
baiqi 2024-11-08 16:19:38 +08:00 committed by Craftsman
parent 31d9ae57ab
commit 6078bcb4f5
12 changed files with 293 additions and 72 deletions

View File

@ -0,0 +1,54 @@
import MSR from '@/api/http/index';
import type { ApiCaseDetail } from '@/models/apiTest/management';
import type { ApiScenarioTableItem } from '@/models/apiTest/scenario';
import type { BugListItem } from '@/models/bug-management';
import type { ReviewItem } from '@/models/caseManagement/caseReview';
import type { CaseManagementTable } from '@/models/caseManagement/featureCase';
import type { CommonList, TableQueryParams } from '@/models/common';
import type { PassRateCountDetail, TestPlanItem } from '@/models/testPlan/testPlan';
import {
WorkbenchApiCaseListUrl,
WorkbenchBugListUrl,
WorkbenchCaseListUrl,
WorkbenchReviewListUrl,
WorkbenchScenarioListUrl,
WorkbenchTestPlanListUrl,
WorkbenchTestPlanStatisticUrl,
} from '../requrls/workbench';
// 我的-场景列表
export function workbenchScenarioList(data: TableQueryParams) {
return MSR.post<CommonList<ApiScenarioTableItem>>({ url: WorkbenchScenarioListUrl, data });
}
// 我的-用例评审列表
export function workbenchReviewList(data: TableQueryParams) {
return MSR.post<CommonList<ReviewItem>>({ url: WorkbenchReviewListUrl, data });
}
// 我的-测试计划列表
export function workbenchTestPlanList(data: TableQueryParams) {
return MSR.post<CommonList<TestPlanItem>>({ url: WorkbenchTestPlanListUrl, data });
}
// 我的-测试计划统计
export function workbenchTestPlanStatistic(data: string[]) {
return MSR.post<PassRateCountDetail[]>({ url: WorkbenchTestPlanStatisticUrl, data });
}
// 我的-用例列表
export function workbenchCaseList(data: TableQueryParams) {
return MSR.post<CommonList<CaseManagementTable>>({ url: WorkbenchCaseListUrl, data });
}
// 我的-缺陷列表
export function workbenchBugList(data: TableQueryParams) {
return MSR.post<CommonList<BugListItem>>({ url: WorkbenchBugListUrl, data });
}
// 我的-接口用例列表
export function workbenchApiCaseList(data: TableQueryParams) {
return MSR.post<CommonList<ApiCaseDetail>>({ url: WorkbenchApiCaseListUrl, data });
}

View File

@ -0,0 +1,7 @@
export const WorkbenchScenarioListUrl = '/dashboard/my/scenario/page'; // 工作台-我的-场景列表
export const WorkbenchReviewListUrl = '/dashboard/my/review/page'; // 工作台-我的-用例评审列表
export const WorkbenchTestPlanListUrl = '/dashboard/my/plan/page'; // 工作台-我的-测试计划列表
export const WorkbenchTestPlanStatisticUrl = '/dashboard/my/plan/statistics'; // 工作台-我的-测试计划统计
export const WorkbenchCaseListUrl = '/dashboard/my/functional/page'; // 工作台-我的-用例列表
export const WorkbenchBugListUrl = '/dashboard/my/bug/page'; // 工作台-我的-缺陷列表
export const WorkbenchApiCaseListUrl = '/dashboard/my/api/page'; // 工作台-我的-接口用例列表

View File

@ -208,7 +208,7 @@
followLoading.value = true; followLoading.value = true;
await followScenario(scenario.value.id || ''); await followScenario(scenario.value.id || '');
scenario.value.follow = !scenario.value.follow; scenario.value.follow = !scenario.value.follow;
Message.success(scenario.value.follow ? t('common.unFollowSuccess') : t('common.followSuccess')); Message.success(scenario.value.follow ? t('common.followSuccess') : t('common.unFollowSuccess'));
emit('updateFollow'); emit('updateFollow');
} catch (error) { } catch (error) {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console

View File

@ -70,7 +70,7 @@
import caseAndScenarioReportDrawer from '@/views/api-test/components/caseAndScenarioReportDrawer.vue'; import caseAndScenarioReportDrawer from '@/views/api-test/components/caseAndScenarioReportDrawer.vue';
import ExecutionStatus from '@/views/api-test/report/component/reportStatus.vue'; import ExecutionStatus from '@/views/api-test/report/component/reportStatus.vue';
import { getCasePage } from '@/api/modules/api-test/management'; import { workbenchApiCaseList } from '@/api/modules/workbench';
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import useOpenNewPage from '@/hooks/useOpenNewPage'; import useOpenNewPage from '@/hooks/useOpenNewPage';
@ -84,6 +84,7 @@
const props = defineProps<{ const props = defineProps<{
project: string; project: string;
type: 'my_follow' | 'my_create'; type: 'my_follow' | 'my_create';
refreshId: string;
}>(); }>();
const { t } = useI18n(); const { t } = useI18n();
@ -109,7 +110,7 @@
sorter: true, sorter: true,
}, },
fixed: 'left', fixed: 'left',
width: 150, width: 100,
columnSelectorDisabled: true, columnSelectorDisabled: true,
}, },
{ {
@ -120,6 +121,7 @@
sortDirections: ['ascend', 'descend'], sortDirections: ['ascend', 'descend'],
sorter: true, sorter: true,
}, },
fixed: 'left',
width: 180, width: 180,
columnSelectorDisabled: true, columnSelectorDisabled: true,
}, },
@ -146,7 +148,7 @@
options: caseStatusOptions, options: caseStatusOptions,
filterSlotName: FilterSlotNameEnum.API_TEST_CASE_API_STATUS, filterSlotName: FilterSlotNameEnum.API_TEST_CASE_API_STATUS,
}, },
width: 150, width: 100,
showDrag: true, showDrag: true,
}, },
{ {
@ -158,7 +160,7 @@
filterSlotName: FilterSlotNameEnum.API_TEST_CASE_API_LAST_EXECUTE_STATUS, filterSlotName: FilterSlotNameEnum.API_TEST_CASE_API_LAST_EXECUTE_STATUS,
}, },
showInTable: false, showInTable: false,
width: 150, width: 100,
showDrag: true, showDrag: true,
}, },
{ {
@ -174,7 +176,8 @@
slotName: 'createName', slotName: 'createName',
dataIndex: 'createUser', dataIndex: 'createUser',
showInTable: true, showInTable: true,
width: 180, showTooltip: true,
width: 150,
}, },
{ {
title: 'case.tableColumnCreateTime', title: 'case.tableColumnCreateTime',
@ -183,7 +186,7 @@
width: 180, width: 180,
}, },
]; ];
const { propsRes, propsEvent, loadList, setLoadListParams } = useTable(getCasePage, { const { propsRes, propsEvent, loadList, setLoadListParams } = useTable(workbenchApiCaseList, {
columns, columns,
scroll: { x: '100%' }, scroll: { x: '100%' },
showSetting: false, showSetting: false,
@ -219,6 +222,13 @@
loadList(); loadList();
} }
watch(
() => props.refreshId,
() => {
init();
}
);
onBeforeMount(() => { onBeforeMount(() => {
init(); init();
}); });

View File

@ -43,7 +43,8 @@
import { MsTableColumn } from '@/components/pure/ms-table/type'; import { MsTableColumn } from '@/components/pure/ms-table/type';
import useTable from '@/components/pure/ms-table/useTable'; import useTable from '@/components/pure/ms-table/useTable';
import { getBugList, getCustomFieldHeader, getCustomOptionHeader } from '@/api/modules/bug-management'; import { getCustomFieldHeader, getCustomOptionHeader } from '@/api/modules/bug-management';
import { workbenchBugList } from '@/api/modules/workbench';
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import useOpenNewPage from '@/hooks/useOpenNewPage'; import useOpenNewPage from '@/hooks/useOpenNewPage';
import useAppStore from '@/store/modules/app'; import useAppStore from '@/store/modules/app';
@ -57,6 +58,7 @@
const props = defineProps<{ const props = defineProps<{
project: string; project: string;
type: 'my_follow' | 'my_create' | 'my_todo'; type: 'my_follow' | 'my_create' | 'my_todo';
refreshId: string;
}>(); }>();
const appStore = useAppStore(); const appStore = useAppStore();
@ -75,7 +77,8 @@
{ {
title: 'bugManagement.bugName', title: 'bugManagement.bugName',
dataIndex: 'title', dataIndex: 'title',
width: 250, width: 180,
fixed: 'left',
showTooltip: true, showTooltip: true,
showInTable: true, showInTable: true,
}, },
@ -189,9 +192,10 @@
await initFilterOptions(); await initFilterOptions();
const { propsRes, propsEvent, setLoadListParams, loadList } = useTable( const { propsRes, propsEvent, setLoadListParams, loadList } = useTable(
getBugList, workbenchBugList,
{ {
columns, columns,
scroll: { x: '100%' },
selectable: false, selectable: false,
noDisable: false, noDisable: false,
showSetting: false, showSetting: false,
@ -219,7 +223,7 @@
}; };
function handleShowDetail(id: number) { function handleShowDetail(id: number) {
openNewPage(BugManagementRouteEnum.BUG_MANAGEMENT_DETAIL, { id, pId: props.project }); openNewPage(BugManagementRouteEnum.BUG_MANAGEMENT_INDEX, { id, pId: props.project });
} }
function goBugList() { function goBugList() {
@ -236,6 +240,13 @@
loadList(); loadList();
} }
watch(
() => props.refreshId,
() => {
init();
}
);
onBeforeMount(() => { onBeforeMount(() => {
init(); init();
}); });

View File

@ -68,7 +68,7 @@
import MsStatusTag from '@/components/business/ms-status-tag/index.vue'; import MsStatusTag from '@/components/business/ms-status-tag/index.vue';
import passRateLine from '@/views/case-management/caseReview/components/passRateLine.vue'; import passRateLine from '@/views/case-management/caseReview/components/passRateLine.vue';
import { getReviewList } from '@/api/modules/case-management/caseReview'; import { workbenchReviewList } from '@/api/modules/workbench';
import { reviewStatusMap } from '@/config/caseManagement'; import { reviewStatusMap } from '@/config/caseManagement';
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import useOpenNewPage from '@/hooks/useOpenNewPage'; import useOpenNewPage from '@/hooks/useOpenNewPage';
@ -80,6 +80,7 @@
const props = defineProps<{ const props = defineProps<{
project: string; project: string;
type: 'my_follow' | 'my_create' | 'my_todo'; type: 'my_follow' | 'my_create' | 'my_todo';
refreshId: string;
}>(); }>();
const { t } = useI18n(); const { t } = useI18n();
@ -104,7 +105,6 @@
sortDirections: ['ascend', 'descend'], sortDirections: ['ascend', 'descend'],
sorter: true, sorter: true,
}, },
showTooltip: true,
width: 100, width: 100,
}, },
{ {
@ -114,8 +114,9 @@
sortDirections: ['ascend', 'descend'], sortDirections: ['ascend', 'descend'],
sorter: true, sorter: true,
}, },
fixed: 'left',
showTooltip: true, showTooltip: true,
width: 200, width: 180,
}, },
{ {
title: 'caseManagement.caseReview.status', title: 'caseManagement.caseReview.status',
@ -126,7 +127,7 @@
filterSlotName: FilterSlotNameEnum.CASE_MANAGEMENT_REVIEW_STATUS, filterSlotName: FilterSlotNameEnum.CASE_MANAGEMENT_REVIEW_STATUS,
}, },
showDrag: true, showDrag: true,
width: 150, width: 100,
}, },
{ {
title: 'caseManagement.caseReview.passRate', title: 'caseManagement.caseReview.passRate',
@ -139,7 +140,7 @@
title: 'caseManagement.caseReview.caseCount', title: 'caseManagement.caseReview.caseCount',
dataIndex: 'caseCount', dataIndex: 'caseCount',
showDrag: true, showDrag: true,
width: 100, width: 80,
}, },
{ {
title: 'caseManagement.caseReview.type', title: 'caseManagement.caseReview.type',
@ -155,8 +156,9 @@
}, },
]; ];
const { propsRes, propsEvent, loadList, setLoadListParams } = useTable(getReviewList, { const { propsRes, propsEvent, loadList, setLoadListParams } = useTable(workbenchReviewList, {
columns, columns,
scroll: { x: '100%' },
showSetting: false, showSetting: false,
selectable: false, selectable: false,
showSelectAll: false, showSelectAll: false,
@ -181,6 +183,13 @@
loadList(); loadList();
} }
watch(
() => props.refreshId,
() => {
init();
}
);
onBeforeMount(() => { onBeforeMount(() => {
init(); init();
}); });

View File

@ -76,7 +76,7 @@
import caseAndScenarioReportDrawer from '@/views/api-test/components/caseAndScenarioReportDrawer.vue'; import caseAndScenarioReportDrawer from '@/views/api-test/components/caseAndScenarioReportDrawer.vue';
import ExecutionStatus from '@/views/api-test/report/component/reportStatus.vue'; import ExecutionStatus from '@/views/api-test/report/component/reportStatus.vue';
import { getScenarioPage } from '@/api/modules/api-test/scenario'; import { workbenchScenarioList } from '@/api/modules/workbench';
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import useOpenNewPage from '@/hooks/useOpenNewPage'; import useOpenNewPage from '@/hooks/useOpenNewPage';
import { characterLimit } from '@/utils'; import { characterLimit } from '@/utils';
@ -92,6 +92,7 @@
const props = defineProps<{ const props = defineProps<{
project: string; project: string;
type: 'my_follow' | 'my_create'; type: 'my_follow' | 'my_create';
refreshId: string;
}>(); }>();
const { t } = useI18n(); const { t } = useI18n();
@ -127,8 +128,7 @@
sorter: true, sorter: true,
}, },
fixed: 'left', fixed: 'left',
width: 140, width: 100,
showTooltip: false,
columnSelectorDisabled: true, columnSelectorDisabled: true,
}, },
{ {
@ -139,6 +139,7 @@
sortDirections: ['ascend', 'descend'], sortDirections: ['ascend', 'descend'],
sorter: true, sorter: true,
}, },
fixed: 'left',
width: 134, width: 134,
showTooltip: true, showTooltip: true,
columnSelectorDisabled: true, columnSelectorDisabled: true,
@ -214,7 +215,7 @@
}, },
]; ];
const { propsRes, propsEvent, loadList, setLoadListParams } = useTable( const { propsRes, propsEvent, loadList, setLoadListParams } = useTable(
getScenarioPage, workbenchScenarioList,
{ {
columns, columns,
scroll: { x: '100%' }, scroll: { x: '100%' },
@ -258,6 +259,13 @@
loadList(); loadList();
} }
watch(
() => props.refreshId,
() => {
init();
}
);
onBeforeMount(() => { onBeforeMount(() => {
init(); init();
}); });

View File

@ -7,9 +7,11 @@
</div> </div>
<ms-base-table v-bind="propsRes" ref="tableRef" filter-icon-align-left class="mt-[16px]" v-on="propsEvent"> <ms-base-table v-bind="propsRes" ref="tableRef" filter-icon-align-left class="mt-[16px]" v-on="propsEvent">
<template #num="{ record }"> <template #num="{ record }">
<span type="text" class="one-line-text cursor-pointer px-0 text-[rgb(var(--primary-5))]"> <div class="flex items-center">
{{ record.num }} <MsButton type="text" class="float-left" style="margin-right: 4px" @click="openCase(record.id)">
</span> {{ record.num }}
</MsButton>
</div>
</template> </template>
<template #name="{ record }"> <template #name="{ record }">
<div class="one-line-text">{{ record.name }}</div> <div class="one-line-text">{{ record.name }}</div>
@ -45,6 +47,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import MsButton from '@/components/pure/ms-button/index.vue';
import MsCard from '@/components/pure/ms-card/index.vue'; import MsCard from '@/components/pure/ms-card/index.vue';
import MsIcon from '@/components/pure/ms-icon-font/index.vue'; import MsIcon from '@/components/pure/ms-icon-font/index.vue';
import MsBaseTable from '@/components/pure/ms-table/base-table.vue'; import MsBaseTable from '@/components/pure/ms-table/base-table.vue';
@ -54,7 +57,7 @@
import caseLevel from '@/components/business/ms-case-associate/caseLevel.vue'; import caseLevel from '@/components/business/ms-case-associate/caseLevel.vue';
import ExecuteStatusTag from '@/components/business/ms-case-associate/executeResult.vue'; import ExecuteStatusTag from '@/components/business/ms-case-associate/executeResult.vue';
import { getCaseList } from '@/api/modules/case-management/featureCase'; import { workbenchCaseList } from '@/api/modules/workbench';
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import useOpenNewPage from '@/hooks/useOpenNewPage'; import useOpenNewPage from '@/hooks/useOpenNewPage';
@ -71,6 +74,7 @@
const props = defineProps<{ const props = defineProps<{
project: string; project: string;
type: 'my_follow' | 'my_create'; type: 'my_follow' | 'my_create';
refreshId: string;
}>(); }>();
const { t } = useI18n(); const { t } = useI18n();
@ -100,8 +104,7 @@
'slotName': 'num', 'slotName': 'num',
'sortIndex': 1, 'sortIndex': 1,
'fixed': 'left', 'fixed': 'left',
'width': 150, 'width': 100,
'showTooltip': true,
'columnSelectorDisabled': true, 'columnSelectorDisabled': true,
'filter-icon-align-left': true, 'filter-icon-align-left': true,
}, },
@ -111,6 +114,7 @@
dataIndex: 'name', dataIndex: 'name',
showInTable: true, showInTable: true,
showTooltip: true, showTooltip: true,
fixed: 'left',
width: 180, width: 180,
ellipsis: true, ellipsis: true,
}, },
@ -123,7 +127,7 @@
filterSlotName: FilterSlotNameEnum.CASE_MANAGEMENT_CASE_LEVEL, filterSlotName: FilterSlotNameEnum.CASE_MANAGEMENT_CASE_LEVEL,
}, },
showInTable: true, showInTable: true,
width: 150, width: 100,
showDrag: true, showDrag: true,
}, },
{ {
@ -174,25 +178,30 @@
const tableProps = ref<Partial<MsTableProps<CaseManagementTable>>>({ const tableProps = ref<Partial<MsTableProps<CaseManagementTable>>>({
columns, columns,
scroll: { x: '100%' },
selectable: false, selectable: false,
showSetting: false, showSetting: false,
paginationSize: 'mini', paginationSize: 'mini',
}); });
const { propsRes, propsEvent, loadList, setLoadListParams } = useTable(getCaseList, tableProps.value, (record) => { const { propsRes, propsEvent, loadList, setLoadListParams } = useTable(
return { workbenchCaseList,
...record, tableProps.value,
tags: (record.tags || []).map((item: string, i: number) => { (record) => {
return { return {
id: `${record.id}-${i}`, ...record,
name: item, tags: (record.tags || []).map((item: string, i: number) => {
}; return {
}), id: `${record.id}-${i}`,
visible: false, name: item,
showModuleTree: false, };
caseLevel: getCaseLevels(record.customFields), }),
}; visible: false,
}); showModuleTree: false,
caseLevel: getCaseLevels(record.customFields),
};
}
);
function init() { function init() {
setLoadListParams({ setLoadListParams({
@ -206,6 +215,17 @@
init(); init();
}); });
watch(
() => props.refreshId,
() => {
init();
}
);
function openCase(id: number) {
openNewPage(CaseManagementRouteEnum.CASE_MANAGEMENT_CASE, { id, pId: props.project, showType: 'list' });
}
function goTestCase() { function goTestCase() {
openNewPage(CaseManagementRouteEnum.CASE_MANAGEMENT_CASE, { openNewPage(CaseManagementRouteEnum.CASE_MANAGEMENT_CASE, {
showType: 'list', showType: 'list',

View File

@ -4,7 +4,7 @@
<div class="cursor-pointer font-medium text-[var(--color-text-1)]" @click="goTestPlan"> <div class="cursor-pointer font-medium text-[var(--color-text-1)]" @click="goTestPlan">
{{ t('ms.workbench.myFollowed.feature.TEST_PLAN') }} {{ t('ms.workbench.myFollowed.feature.TEST_PLAN') }}
</div> </div>
<a-radio-group v-model="showType" type="button" class="file-show-type mr-2" size="small" @change="fetchData"> <a-radio-group v-model="showType" type="button" class="file-show-type mr-2" size="small" @change="init">
<a-radio :value="testPlanTypeEnum.ALL" class="show-type-icon p-[2px]"> <a-radio :value="testPlanTypeEnum.ALL" class="show-type-icon p-[2px]">
{{ t('testPlan.testPlanIndex.all') }} {{ t('testPlan.testPlanIndex.all') }}
</a-radio> </a-radio>
@ -122,7 +122,7 @@
import PlanExpandRow from '@/views/test-plan/testPlan/components/planExpandRow.vue'; import PlanExpandRow from '@/views/test-plan/testPlan/components/planExpandRow.vue';
import StatusProgress from '@/views/test-plan/testPlan/components/statusProgress.vue'; import StatusProgress from '@/views/test-plan/testPlan/components/statusProgress.vue';
import { getPlanPassRate, getTestPlanList } from '@/api/modules/test-plan/testPlan'; import { workbenchTestPlanList, workbenchTestPlanStatistic } from '@/api/modules/workbench';
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import useOpenNewPage from '@/hooks/useOpenNewPage'; import useOpenNewPage from '@/hooks/useOpenNewPage';
@ -136,6 +136,7 @@
const props = defineProps<{ const props = defineProps<{
project: string; project: string;
type: 'my_follow' | 'my_create' | 'my_todo'; type: 'my_follow' | 'my_create' | 'my_todo';
refreshId: string;
}>(); }>();
const { t } = useI18n(); const { t } = useI18n();
@ -153,9 +154,9 @@
return defaultCountDetailMap.value[id]?.status; return defaultCountDetailMap.value[id]?.status;
} }
async function getStatistics(selectedPlanIds: (string | undefined)[]) { async function getStatistics(selectedPlanIds: string[]) {
try { try {
const result = await getPlanPassRate(selectedPlanIds); const result = await workbenchTestPlanStatistic(selectedPlanIds);
result.forEach((item: PassRateCountDetail) => { result.forEach((item: PassRateCountDetail) => {
defaultCountDetailMap.value[item.id] = item; defaultCountDetailMap.value[item.id] = item;
}); });
@ -170,7 +171,7 @@
title: 'testPlan.testPlanIndex.ID', title: 'testPlan.testPlanIndex.ID',
slotName: 'num', slotName: 'num',
dataIndex: 'num', dataIndex: 'num',
width: 180, width: 100,
showInTable: true, showInTable: true,
showDrag: false, showDrag: false,
}, },
@ -180,6 +181,7 @@
dataIndex: 'name', dataIndex: 'name',
showInTable: true, showInTable: true,
showTooltip: true, showTooltip: true,
fixed: 'left',
width: 180, width: 180,
showDrag: false, showDrag: false,
}, },
@ -193,7 +195,7 @@
}, },
showInTable: true, showInTable: true,
showDrag: true, showDrag: true,
width: 150, width: 100,
}, },
{ {
title: 'testPlan.testPlanIndex.passRate', title: 'testPlan.testPlanIndex.passRate',
@ -229,13 +231,14 @@
const tableProps = ref<Partial<MsTableProps<TestPlanItem>>>({ const tableProps = ref<Partial<MsTableProps<TestPlanItem>>>({
columns, columns,
scroll: { x: '100%' },
selectable: false, selectable: false,
showSetting: false, showSetting: false,
paginationSize: 'mini', paginationSize: 'mini',
showSelectorAll: false, showSelectorAll: false,
}); });
const { propsRes, propsEvent, loadList, setLoadListParams } = useTable(getTestPlanList, tableProps.value); const { propsRes, propsEvent, loadList, setLoadListParams } = useTable(workbenchTestPlanList, tableProps.value);
const planData = computed(() => { const planData = computed(() => {
return propsRes.value.data; return propsRes.value.data;
@ -266,7 +269,7 @@
() => planData.value, () => planData.value,
(val) => { (val) => {
if (val) { if (val) {
const selectedPlanIds: (string | undefined)[] = propsRes.value.data.map((e) => e.id) || []; const selectedPlanIds: string[] = propsRes.value.data.map((e) => e.id) || [];
if (selectedPlanIds.length) { if (selectedPlanIds.length) {
getStatistics(selectedPlanIds); getStatistics(selectedPlanIds);
} }
@ -277,7 +280,7 @@
} }
); );
function fetchData() { function init() {
setLoadListParams({ setLoadListParams({
type: showType.value, type: showType.value,
projectId: props.project, projectId: props.project,
@ -293,8 +296,15 @@
}); });
} }
watch(
() => props.refreshId,
() => {
init();
}
);
onBeforeMount(() => { onBeforeMount(() => {
fetchData(); init();
}); });
</script> </script>

View File

@ -1,7 +1,12 @@
<template> <template>
<div class="flex flex-col gap-[16px]"> <div class="flex flex-col gap-[16px]">
<div class="flex items-center justify-end gap-[12px]"> <div class="flex items-center justify-end gap-[12px]">
<MsProjectSelect v-model:project="currentProject" class="w-[240px]" use-default-arrow-icon> <MsProjectSelect
v-model:project="currentProject"
class="w-[240px]"
use-default-arrow-icon
@change="handleRefresh"
>
<template #prefix> <template #prefix>
{{ t('menu.projectManagementShort') }} {{ t('menu.projectManagementShort') }}
</template> </template>
@ -27,12 +32,43 @@
<MsIcon type="icon-icon_reset_outlined" size="14" /> <MsIcon type="icon-icon_reset_outlined" size="14" />
</a-button> </a-button>
</div> </div>
<testPlanTable v-if="features.includes(FeatureEnum.TEST_PLAN)" :project="currentProject" type="my_create" />
<testCaseTable v-if="features.includes(FeatureEnum.TEST_CASE)" :project="currentProject" type="my_create" /> <testPlanTable
<caseReviewTable v-if="features.includes(FeatureEnum.CASE_REVIEW)" :project="currentProject" type="my_create" /> v-if="features.includes(FeatureEnum.TEST_PLAN)"
<apiCaseTable v-if="features.includes(FeatureEnum.API_CASE)" :project="currentProject" type="my_create" /> :project="currentProject"
<scenarioCaseTable v-if="features.includes(FeatureEnum.API_SCENARIO)" :project="currentProject" type="my_create" /> :refresh-id="refreshId"
<bugTable v-if="features.includes(FeatureEnum.BUG)" :project="currentProject" type="my_create" /> type="my_create"
/>
<testCaseTable
v-if="features.includes(FeatureEnum.TEST_CASE)"
:project="currentProject"
:refresh-id="refreshId"
type="my_create"
/>
<caseReviewTable
v-if="features.includes(FeatureEnum.CASE_REVIEW)"
:project="currentProject"
:refresh-id="refreshId"
type="my_create"
/>
<apiCaseTable
v-if="features.includes(FeatureEnum.API_CASE)"
:project="currentProject"
:refresh-id="refreshId"
type="my_create"
/>
<scenarioCaseTable
v-if="features.includes(FeatureEnum.API_SCENARIO)"
:project="currentProject"
:refresh-id="refreshId"
type="my_create"
/>
<bugTable
v-if="features.includes(FeatureEnum.BUG)"
:project="currentProject"
:refresh-id="refreshId"
type="my_create"
/>
</div> </div>
</template> </template>
@ -48,6 +84,7 @@
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import useAppStore from '@/store/modules/app'; import useAppStore from '@/store/modules/app';
import { getGenerateId } from '@/utils';
import { FeatureEnum } from '@/enums/workbenchEnum'; import { FeatureEnum } from '@/enums/workbenchEnum';
@ -61,6 +98,7 @@
value: key as FeatureEnum, value: key as FeatureEnum,
})); }));
const featureAll = ref(true); const featureAll = ref(true);
const refreshId = ref('');
function handleFeatureAllChange(val: boolean | (string | number | boolean)[]) { function handleFeatureAllChange(val: boolean | (string | number | boolean)[]) {
features.value = val ? featureOptions.map((item) => item.value) : []; features.value = val ? featureOptions.map((item) => item.value) : [];
@ -73,7 +111,7 @@
} }
function handleRefresh() { function handleRefresh() {
console.log('refresh'); refreshId.value = getGenerateId();
} }
</script> </script>

View File

@ -1,7 +1,12 @@
<template> <template>
<div class="flex flex-col gap-[16px]"> <div class="flex flex-col gap-[16px]">
<div class="flex items-center justify-end gap-[12px]"> <div class="flex items-center justify-end gap-[12px]">
<MsProjectSelect v-model:project="currentProject" class="w-[240px]" use-default-arrow-icon> <MsProjectSelect
v-model:project="currentProject"
class="w-[240px]"
use-default-arrow-icon
@change="handleRefresh"
>
<template #prefix> <template #prefix>
{{ t('menu.projectManagementShort') }} {{ t('menu.projectManagementShort') }}
</template> </template>
@ -27,12 +32,42 @@
<MsIcon type="icon-icon_reset_outlined" size="14" /> <MsIcon type="icon-icon_reset_outlined" size="14" />
</a-button> </a-button>
</div> </div>
<testPlanTable v-if="features.includes(FeatureEnum.TEST_PLAN)" :project="currentProject" type="my_follow" /> <testPlanTable
<testCaseTable v-if="features.includes(FeatureEnum.TEST_CASE)" :project="currentProject" type="my_follow" /> v-if="features.includes(FeatureEnum.TEST_PLAN)"
<caseReviewTable v-if="features.includes(FeatureEnum.CASE_REVIEW)" :project="currentProject" type="my_follow" /> :project="currentProject"
<apiCaseTable v-if="features.includes(FeatureEnum.API_CASE)" :project="currentProject" type="my_follow" /> :refresh-id="refreshId"
<scenarioCaseTable v-if="features.includes(FeatureEnum.API_SCENARIO)" :project="currentProject" type="my_follow" /> type="my_follow"
<bugTable v-if="features.includes(FeatureEnum.BUG)" :project="currentProject" type="my_follow" /> />
<testCaseTable
v-if="features.includes(FeatureEnum.TEST_CASE)"
:project="currentProject"
:refresh-id="refreshId"
type="my_follow"
/>
<caseReviewTable
v-if="features.includes(FeatureEnum.CASE_REVIEW)"
:project="currentProject"
:refresh-id="refreshId"
type="my_follow"
/>
<apiCaseTable
v-if="features.includes(FeatureEnum.API_CASE)"
:project="currentProject"
:refresh-id="refreshId"
type="my_follow"
/>
<scenarioCaseTable
v-if="features.includes(FeatureEnum.API_SCENARIO)"
:project="currentProject"
:refresh-id="refreshId"
type="my_follow"
/>
<bugTable
v-if="features.includes(FeatureEnum.BUG)"
:project="currentProject"
:refresh-id="refreshId"
type="my_follow"
/>
</div> </div>
</template> </template>
@ -48,6 +83,7 @@
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import useAppStore from '@/store/modules/app'; import useAppStore from '@/store/modules/app';
import { getGenerateId } from '@/utils';
import { FeatureEnum } from '@/enums/workbenchEnum'; import { FeatureEnum } from '@/enums/workbenchEnum';
@ -61,6 +97,7 @@
value: key as FeatureEnum, value: key as FeatureEnum,
})); }));
const featureAll = ref(true); const featureAll = ref(true);
const refreshId = ref('');
function handleFeatureAllChange(val: boolean | (string | number | boolean)[]) { function handleFeatureAllChange(val: boolean | (string | number | boolean)[]) {
features.value = val ? featureOptions.map((item) => item.value) : []; features.value = val ? featureOptions.map((item) => item.value) : [];
@ -73,7 +110,7 @@
} }
function handleRefresh() { function handleRefresh() {
console.log('refresh'); refreshId.value = getGenerateId();
} }
</script> </script>

View File

@ -27,9 +27,24 @@
<MsIcon type="icon-icon_reset_outlined" size="14" /> <MsIcon type="icon-icon_reset_outlined" size="14" />
</a-button> </a-button>
</div> </div>
<testPlanTable v-if="features.includes(FeatureEnum.TEST_PLAN)" :project="currentProject" type="my_follow" /> <testPlanTable
<caseReviewTable v-if="features.includes(FeatureEnum.CASE_REVIEW)" :project="currentProject" type="my_follow" /> v-if="features.includes(FeatureEnum.TEST_PLAN)"
<bugTable v-if="features.includes(FeatureEnum.BUG)" :project="currentProject" type="my_follow" /> :project="currentProject"
:refresh-id="refreshId"
type="my_follow"
/>
<caseReviewTable
v-if="features.includes(FeatureEnum.CASE_REVIEW)"
:project="currentProject"
:refresh-id="refreshId"
type="my_follow"
/>
<bugTable
v-if="features.includes(FeatureEnum.BUG)"
:project="currentProject"
:refresh-id="refreshId"
type="my_follow"
/>
</div> </div>
</template> </template>
@ -42,6 +57,7 @@
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import useAppStore from '@/store/modules/app'; import useAppStore from '@/store/modules/app';
import { getGenerateId } from '@/utils';
import { FeatureEnum } from '@/enums/workbenchEnum'; import { FeatureEnum } from '@/enums/workbenchEnum';
@ -55,6 +71,7 @@
value: key as FeatureEnum, value: key as FeatureEnum,
})); }));
const featureAll = ref(true); const featureAll = ref(true);
const refreshId = ref('');
function handleFeatureAllChange(val: boolean | (string | number | boolean)[]) { function handleFeatureAllChange(val: boolean | (string | number | boolean)[]) {
features.value = val ? featureOptions.map((item) => item.value) : []; features.value = val ? featureOptions.map((item) => item.value) : [];
@ -67,7 +84,7 @@
} }
function handleRefresh() { function handleRefresh() {
console.log('refresh'); refreshId.value = getGenerateId();
} }
</script> </script>