refactor(功能用例): 用例评审脑图-更换用例评审最终结果和每个评审人最终评审结果的数据

This commit is contained in:
teukkk 2024-07-12 16:59:28 +08:00 committed by 刘瑞斌
parent f65edc53bc
commit 3f03f1c5ff
4 changed files with 36 additions and 27 deletions

View File

@ -22,6 +22,7 @@ import {
GetReviewDetailModuleCountUrl, GetReviewDetailModuleCountUrl,
GetReviewDetailModuleTreeUrl, GetReviewDetailModuleTreeUrl,
GetReviewDetailUrl, GetReviewDetailUrl,
GetReviewerAndStatusUrl,
GetReviewListUrl, GetReviewListUrl,
GetReviewModulesUrl, GetReviewModulesUrl,
GetReviewUsersUrl, GetReviewUsersUrl,
@ -49,6 +50,7 @@ import {
Review, Review,
ReviewCaseItem, ReviewCaseItem,
ReviewDetailCaseListQueryParams, ReviewDetailCaseListQueryParams,
ReviewerAndStatus,
ReviewHistoryItem, ReviewHistoryItem,
ReviewItem, ReviewItem,
ReviewListQueryParams, ReviewListQueryParams,
@ -211,3 +213,8 @@ export const getCaseReviewerList = (reviewId: string, caseId: string) => {
export function getCaseReviewMinder(data: CaseReviewMinderParams) { export function getCaseReviewMinder(data: CaseReviewMinderParams) {
return MSR.post<CommonList<MinderJsonNode>>({ url: `${GetCaseReviewMinderUrl}`, data }); return MSR.post<CommonList<MinderJsonNode>>({ url: `${GetCaseReviewMinderUrl}`, data });
} }
// 脑图-获取用例评审最终结果和每个评审人最终的评审结果
export const getReviewerAndStatus = (reviewId: string, caseId: string) => {
return MSR.get<ReviewerAndStatus>({ url: `${GetReviewerAndStatusUrl}/${reviewId}/${caseId}` });
};

View File

@ -28,3 +28,4 @@ export const GetCaseReviewHistoryListUrl = '/review/functional/case/get/list'; /
export const SaveCaseReviewResultUrl = '/review/functional/case/save'; // 评审详情-提交评审 export const SaveCaseReviewResultUrl = '/review/functional/case/save'; // 评审详情-提交评审
export const getCaseReviewerListUrl = '/case/review/detail/reviewer/list'; // 评审详情-获取用例的评审人 export const getCaseReviewerListUrl = '/case/review/detail/reviewer/list'; // 评审详情-获取用例的评审人
export const GetCaseReviewMinderUrl = '/functional/mind/case/review/list'; // 获取脑图数据 export const GetCaseReviewMinderUrl = '/functional/mind/case/review/list'; // 获取脑图数据
export const GetReviewerAndStatusUrl = '/case/review/detail/reviewer/status/total'; // 脑图-获取用例评审最终结果和每个评审人最终的评审结果

View File

@ -88,7 +88,7 @@
:class="`flex cursor-pointer items-center rounded p-[4px] hover:bg-[var(--color-text-n9)] :class="`flex cursor-pointer items-center rounded p-[4px] hover:bg-[var(--color-text-n9)]
${statusVisible ? 'bg-[var(--color-text-n9)]' : ''} `" ${statusVisible ? 'bg-[var(--color-text-n9)]' : ''} `"
> >
<ReviewResult :status="activeCaseInfo.reviewStatus" class="text-[12px]" :icon-size="12" /> <ReviewResult :status="reviewHistoryStatus" class="text-[12px]" :icon-size="12" />
<MsIcon type="icon-icon_expand-down_filled" size="12" class="ml-[4px] text-[var(--color-text-4)]" /> <MsIcon type="icon-icon_expand-down_filled" size="12" class="ml-[4px] text-[var(--color-text-4)]" />
</div> </div>
<template #content> <template #content>
@ -97,9 +97,9 @@
> >
<div v-for="item in reviewUserStatusList" :key="item.id" class="my-[4px] flex justify-between"> <div v-for="item in reviewUserStatusList" :key="item.id" class="my-[4px] flex justify-between">
<div class="one-line-text max-w-[80px]"> <div class="one-line-text max-w-[80px]">
{{ item.userName }} {{ item.id }}
</div> </div>
<ReviewResult :status="item.status" class="text-[12px]" :icon-size="12" /> <ReviewResult :status="item.name as ReviewResultStatus" class="text-[12px]" :icon-size="12" />
</div> </div>
<MsEmpty v-if="!reviewUserStatusList.length" /> <MsEmpty v-if="!reviewUserStatusList.length" />
</div> </div>
@ -119,7 +119,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import dayjs from 'dayjs';
import MsButton from '@/components/pure/ms-button/index.vue'; import MsButton from '@/components/pure/ms-button/index.vue';
import MsDescription, { Description } from '@/components/pure/ms-description/index.vue'; import MsDescription, { Description } from '@/components/pure/ms-description/index.vue';
@ -137,8 +136,10 @@
getCaseReviewerList, getCaseReviewerList,
getCaseReviewHistoryList, getCaseReviewHistoryList,
getCaseReviewMinder, getCaseReviewMinder,
getReviewerAndStatus,
} from '@/api/modules/case-management/caseReview'; } from '@/api/modules/case-management/caseReview';
import { getCaseDetail } from '@/api/modules/case-management/featureCase'; import { getCaseDetail } from '@/api/modules/case-management/featureCase';
import { OptionItem } from '@/api/modules/message/index';
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import { useUserStore } from '@/store'; import { useUserStore } from '@/store';
import useAppStore from '@/store/modules/app'; import useAppStore from '@/store/modules/app';
@ -151,6 +152,7 @@
CaseReviewFunctionalCaseUserItem, CaseReviewFunctionalCaseUserItem,
ReviewHistoryItem, ReviewHistoryItem,
ReviewPassRule, ReviewPassRule,
ReviewResult as ReviewResultStatus,
} from '@/models/caseManagement/caseReview'; } from '@/models/caseManagement/caseReview';
import { ModuleTreeNode } from '@/models/common'; import { ModuleTreeNode } from '@/models/common';
import { MinderEventName, MinderKeyEnum } from '@/enums/minderEnum'; import { MinderEventName, MinderKeyEnum } from '@/enums/minderEnum';
@ -436,10 +438,6 @@
label: t('caseManagement.caseReview.caseName'), label: t('caseManagement.caseReview.caseName'),
value: res.name, value: res.name,
}, },
{
label: t('common.belongModule'),
value: res.moduleName || t('common.root'),
},
{ {
label: t('common.tag'), label: t('common.tag'),
value: res.tags, value: res.tags,
@ -459,14 +457,6 @@
}; };
} }
}), }),
{
label: t('common.creator'),
value: res.createUserName || '',
},
{
label: t('common.createTime'),
value: dayjs(res.createTime).format('YYYY-MM-DD HH:mm:ss'),
},
]; ];
// //
if (activeCaseInfo.value.attachments) { if (activeCaseInfo.value.attachments) {
@ -489,22 +479,24 @@
} }
} }
// const reviewHistoryList = ref<ReviewHistoryItem[]>([]); //
const reviewHistoryList = ref<ReviewHistoryItem[]>([]); const reviewHistoryStatus = ref<ReviewResultStatus>();
const reviewUserStatusList = ref<ReviewHistoryItem[]>([]); // const reviewUserStatusList = ref<OptionItem[]>([]); //
const statusVisible = ref(false); const statusVisible = ref(false);
async function initReviewHistoryList(data: MinderJsonNodeData) { async function initReviewHistoryList(data: MinderJsonNodeData) {
try { try {
const res = await getCaseReviewHistoryList(route.query.id as string, data?.caseId || activeCaseInfo.value.caseId); const res = await getCaseReviewHistoryList(route.query.id as string, data?.caseId || activeCaseInfo.value.caseId);
reviewHistoryList.value = res; reviewHistoryList.value = res;
reviewUserStatusList.value = []; } catch (error) {
const userNamesSet = new Set(); // eslint-disable-next-line no-console
reviewHistoryList.value.forEach((reviewItem) => { console.log(error);
if (!userNamesSet.has(reviewItem.userName)) { }
reviewUserStatusList.value.push(reviewItem); }
userNamesSet.add(reviewItem.userName); async function initReviewerAndStatus(data: MinderJsonNodeData) {
} try {
}); const res = await getReviewerAndStatus(route.query.id as string, data?.caseId || activeCaseInfo.value.caseId);
reviewUserStatusList.value = res.reviewerStatus;
reviewHistoryStatus.value = res.status as ReviewResultStatus;
} catch (error) { } catch (error) {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.log(error); console.log(error);
@ -522,6 +514,7 @@
activeExtraKey.value = 'history'; activeExtraKey.value = 'history';
initCaseDetail(data); initCaseDetail(data);
initReviewHistoryList(data); initReviewHistoryList(data);
initReviewerAndStatus(data);
} }
} }

View File

@ -1,3 +1,5 @@
import { OptionItem } from '@/api/modules/message/index';
import { BatchApiParams, TableQueryParams } from '@/models/common'; import { BatchApiParams, TableQueryParams } from '@/models/common';
// 评审状态, PREPARED: 待开始, UNDERWAY: 进行中, COMPLETED: 已完成, ARCHIVED: 已归档(暂时没有) // 评审状态, PREPARED: 待开始, UNDERWAY: 进行中, COMPLETED: 已完成, ARCHIVED: 已归档(暂时没有)
@ -247,6 +249,12 @@ export interface ReviewHistoryItem {
contentText: string; contentText: string;
} }
export interface ReviewerAndStatus {
reviewerStatus: OptionItem[]; // 每个评审人最终的评审结果
status: ReviewResult;
caseId: string; // 用例评审最终结果
}
// 评审详情-用例列表项 // 评审详情-用例列表项
export interface CaseReviewFunctionalCaseUserItem { export interface CaseReviewFunctionalCaseUserItem {
caseId: string; caseId: string;