fix(工作台): 修复工作台首页成员接口&测试计划执行率包含进行中bug

This commit is contained in:
xinxin.wu 2024-11-20 14:21:16 +08:00 committed by Craftsman
parent 06d3408aad
commit 4f50e3a751
5 changed files with 43 additions and 28 deletions

View File

@ -44,6 +44,7 @@ import {
WorkMemberViewDetailUrl, WorkMemberViewDetailUrl,
WorkMyCreatedDetailUrl, WorkMyCreatedDetailUrl,
WorkPlanLegacyBugUrl, WorkPlanLegacyBugUrl,
WorkProjectMemberListUrl,
WorkProOverviewDetailUrl, WorkProOverviewDetailUrl,
WorkReviewListUrl, WorkReviewListUrl,
WorkScenarioCaseCountDetailUrl, WorkScenarioCaseCountDetailUrl,
@ -139,6 +140,11 @@ export function workBugHandlerDetail(data: WorkHomePageDetail) {
return MSR.post<OverViewOfProject>({ url: WorkBugHandlerDetailUrl, data }, { ignoreCancelToken: true }); return MSR.post<OverViewOfProject>({ url: WorkBugHandlerDetailUrl, data }, { ignoreCancelToken: true });
} }
// 工作台-首页-项目成员下拉
export function workProjectMemberOptions(projectId: string, keyword?: string) {
return MSR.get({ url: `${WorkProjectMemberListUrl}/${projectId}`, params: { keyword } });
}
// 工作台-首页-接口变更 // 工作台-首页-接口变更
export function workApiChangeList(data: WorkHomePageDetail) { export function workApiChangeList(data: WorkHomePageDetail) {
return MSR.post<CommonList<ApiDefinitionDetail>>( return MSR.post<CommonList<ApiDefinitionDetail>>(

View File

@ -31,3 +31,4 @@ export const WorkBugHandleByMeUrl = '/dashboard/handle_bug_by_me'; // 工作台-
export const WorkPlanLegacyBugUrl = '/dashboard/plan_legacy_bug'; // 工作台-首页-测试计划遗留缺陷 export const WorkPlanLegacyBugUrl = '/dashboard/plan_legacy_bug'; // 工作台-首页-测试计划遗留缺陷
export const WorkApiCountCoverRateUrl = '/api/definition/rage'; // 工作台-首页-覆盖率 export const WorkApiCountCoverRateUrl = '/api/definition/rage'; // 工作台-首页-覆盖率
export const WorkTestPlanRageUrl = '/test-plan/rage'; // 工作台-首页-测试计划数 export const WorkTestPlanRageUrl = '/test-plan/rage'; // 工作台-首页-测试计划数
export const WorkProjectMemberListUrl = '/dashboard/member/get-project-member/option'; // 工作台-首页-项目成员下拉

View File

@ -51,8 +51,7 @@
import MsChart from '@/components/pure/chart/index.vue'; import MsChart from '@/components/pure/chart/index.vue';
import MsSelect from '@/components/business/ms-select'; import MsSelect from '@/components/business/ms-select';
import { getProjectMemberOptions } from '@/api/modules/project-management/projectMember'; import { workMemberViewDetail, workProjectMemberOptions } from '@/api/modules/workbench';
import { workMemberViewDetail } from '@/api/modules/workbench';
import { contentTabList } from '@/config/workbench'; import { contentTabList } from '@/config/workbench';
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import useAppStore from '@/store/modules/app'; import useAppStore from '@/store/modules/app';
@ -173,7 +172,7 @@
async function getMemberOptions() { async function getMemberOptions() {
const [newProjectId] = innerProjectIds.value; const [newProjectId] = innerProjectIds.value;
const res = await getProjectMemberOptions(newProjectId); const res = await workProjectMemberOptions(newProjectId);
memberOptions.value = res.map((e: any) => ({ memberOptions.value = res.map((e: any) => ({
label: e.name, label: e.name,
value: e.id, value: e.id,
@ -238,8 +237,10 @@
); );
onMounted(() => { onMounted(() => {
getMemberOptions();
initOverViewMemberDetail(); initOverViewMemberDetail();
if (props.item.projectIds.length) {
getMemberOptions();
}
}); });
</script> </script>

View File

@ -140,26 +140,6 @@
const { unExecute, executed, passed, notPassed, finished, running, prepared, archived, errorCode } = detail; const { unExecute, executed, passed, notPassed, finished, running, prepared, archived, errorCode } = detail;
hasPermission.value = errorCode !== 109001; hasPermission.value = errorCode !== 109001;
const executeRate =
executed + unExecute > 0 ? parseFloat(((executed / (executed + unExecute)) * 100).toFixed(2)) : 0;
const executeData: {
name: string;
count: number;
}[] = [
{
name: t('workbench.homePage.executeRate'),
count: executeRate,
},
{
name: t('common.unExecute'),
count: unExecute,
},
{
name: t('common.executed'),
count: executed,
},
];
const passRate = passed + notPassed > 0 ? parseFloat(((passed / (passed + notPassed)) * 100).toFixed(2)) : 0; const passRate = passed + notPassed > 0 ? parseFloat(((passed / (passed + notPassed)) * 100).toFixed(2)) : 0;
const passData = [ const passData = [
@ -212,6 +192,25 @@
}, },
]; ];
const executeRate = finished + running > 0 ? parseFloat((((finished + running) / total) * 100).toFixed(2)) : 0;
const executeData: {
name: string;
count: number;
}[] = [
{
name: t('workbench.homePage.executeRate'),
count: executeRate,
},
{
name: t('common.unExecute'),
count: unExecute,
},
{
name: t('common.executed'),
count: executed,
},
];
testPlanCountOptions.value = handlePieData(props.item.key, hasPermission.value, listStatusPercentList); testPlanCountOptions.value = handlePieData(props.item.key, hasPermission.value, listStatusPercentList);
// //

View File

@ -1,5 +1,5 @@
<template> <template>
<div class="work-bench-content"> <div :class="`work-bench-content ${defaultWorkList.length ? 'min-w-[1000px]' : ''}`">
<div class="header-setting pb-[4px]"> <div class="header-setting pb-[4px]">
<div <div
class="setting sticky top-0 z-[999] mb-[-16px] flex items-center justify-between bg-[var(--color-bg-3)] pb-[16px]" class="setting sticky top-0 z-[999] mb-[-16px] flex items-center justify-between bg-[var(--color-bg-3)] pb-[16px]"
@ -139,8 +139,8 @@
</div> </div>
<NoData <NoData
v-if="showNoData || !defaultWorkList.length" v-if="showNoData || !defaultWorkList.length"
:no-res-permission="!defaultWorkList.length" :no-res-permission="!appStore.projectList.length"
:all-screen="!!defaultWorkList.length" :all-screen="!defaultWorkList.length"
height="h-[calc(100vh-110px)]" height="h-[calc(100vh-110px)]"
@config="cardSetting" @config="cardSetting"
/> />
@ -339,12 +339,20 @@
{ deep: true } { deep: true }
); );
watch(
() => appStore.currentOrgId,
(val) => {
if (val) {
initDefaultList();
}
}
);
provide('timeForm', time); provide('timeForm', time);
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
.work-bench-content { .work-bench-content {
min-width: 1200px;
@apply overflow-x-auto; @apply overflow-x-auto;
.ms-scroll-bar(); .ms-scroll-bar();
.header-setting { .header-setting {