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,
GetReviewDetailModuleTreeUrl,
GetReviewDetailUrl,
GetReviewerAndStatusUrl,
GetReviewListUrl,
GetReviewModulesUrl,
GetReviewUsersUrl,
@ -49,6 +50,7 @@ import {
Review,
ReviewCaseItem,
ReviewDetailCaseListQueryParams,
ReviewerAndStatus,
ReviewHistoryItem,
ReviewItem,
ReviewListQueryParams,
@ -211,3 +213,8 @@ export const getCaseReviewerList = (reviewId: string, caseId: string) => {
export function getCaseReviewMinder(data: CaseReviewMinderParams) {
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 getCaseReviewerListUrl = '/case/review/detail/reviewer/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)]
${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)]" />
</div>
<template #content>
@ -97,9 +97,9 @@
>
<div v-for="item in reviewUserStatusList" :key="item.id" class="my-[4px] flex justify-between">
<div class="one-line-text max-w-[80px]">
{{ item.userName }}
{{ item.id }}
</div>
<ReviewResult :status="item.status" class="text-[12px]" :icon-size="12" />
<ReviewResult :status="item.name as ReviewResultStatus" class="text-[12px]" :icon-size="12" />
</div>
<MsEmpty v-if="!reviewUserStatusList.length" />
</div>
@ -119,7 +119,6 @@
<script setup lang="ts">
import { useRoute } from 'vue-router';
import dayjs from 'dayjs';
import MsButton from '@/components/pure/ms-button/index.vue';
import MsDescription, { Description } from '@/components/pure/ms-description/index.vue';
@ -137,8 +136,10 @@
getCaseReviewerList,
getCaseReviewHistoryList,
getCaseReviewMinder,
getReviewerAndStatus,
} from '@/api/modules/case-management/caseReview';
import { getCaseDetail } from '@/api/modules/case-management/featureCase';
import { OptionItem } from '@/api/modules/message/index';
import { useI18n } from '@/hooks/useI18n';
import { useUserStore } from '@/store';
import useAppStore from '@/store/modules/app';
@ -151,6 +152,7 @@
CaseReviewFunctionalCaseUserItem,
ReviewHistoryItem,
ReviewPassRule,
ReviewResult as ReviewResultStatus,
} from '@/models/caseManagement/caseReview';
import { ModuleTreeNode } from '@/models/common';
import { MinderEventName, MinderKeyEnum } from '@/enums/minderEnum';
@ -436,10 +438,6 @@
label: t('caseManagement.caseReview.caseName'),
value: res.name,
},
{
label: t('common.belongModule'),
value: res.moduleName || t('common.root'),
},
{
label: t('common.tag'),
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) {
@ -489,22 +479,24 @@
}
}
//
const reviewHistoryList = ref<ReviewHistoryItem[]>([]);
const reviewUserStatusList = ref<ReviewHistoryItem[]>([]); //
const reviewHistoryList = ref<ReviewHistoryItem[]>([]); //
const reviewHistoryStatus = ref<ReviewResultStatus>();
const reviewUserStatusList = ref<OptionItem[]>([]); //
const statusVisible = ref(false);
async function initReviewHistoryList(data: MinderJsonNodeData) {
try {
const res = await getCaseReviewHistoryList(route.query.id as string, data?.caseId || activeCaseInfo.value.caseId);
reviewHistoryList.value = res;
reviewUserStatusList.value = [];
const userNamesSet = new Set();
reviewHistoryList.value.forEach((reviewItem) => {
if (!userNamesSet.has(reviewItem.userName)) {
reviewUserStatusList.value.push(reviewItem);
userNamesSet.add(reviewItem.userName);
}
});
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
}
}
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) {
// eslint-disable-next-line no-console
console.log(error);
@ -522,6 +514,7 @@
activeExtraKey.value = 'history';
initCaseDetail(data);
initReviewHistoryList(data);
initReviewerAndStatus(data);
}
}

View File

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