fix(用例管理): 修改用例bug

This commit is contained in:
xinxin.wu 2024-02-29 12:59:14 +08:00 committed by 刘瑞斌
parent f17dd9a6bf
commit 367ab71336
12 changed files with 139 additions and 77 deletions

View File

@ -513,6 +513,7 @@
@apply relative overflow-hidden;
:deep(.halo-rich-text-editor .ProseMirror) {
padding: 16px 24px !important;
height: 130px;
p:first-child {
margin-top: 0;
}

View File

@ -119,7 +119,16 @@ const useFeatureCaseStore = defineStore('featureCase', {
async getCaseCounts(caseId: string) {
try {
const result = await getCaseDetail(caseId);
const { bugCount, caseCount, caseReviewCount, demandCount, relateEdgeCount, testPlanCount } = result;
const {
bugCount,
caseCount,
caseReviewCount,
demandCount,
relateEdgeCount,
testPlanCount,
historyCount,
commentCount,
} = result;
const countMap: Record<string, any> = {
case: caseCount,
dependency: relateEdgeCount,
@ -127,6 +136,8 @@ const useFeatureCaseStore = defineStore('featureCase', {
testPlan: testPlanCount,
bug: bugCount,
requirement: demandCount,
changeHistory: historyCount,
comments: commentCount,
};
this.initCountMap(countMap);
} catch (error) {

View File

@ -247,7 +247,6 @@
async function getEnabledModules() {
const result = await postTabletList({ projectId: currentProjectId.value });
debugger;
const caseArr = result.filter((item) => Object.keys(moduleMaps).includes(item.module));
caseArr.forEach((item: any) => {
const currentModule = moduleMaps[item.module];

View File

@ -92,7 +92,7 @@
height: 'calc(100% - 86px)',
}"
>
<MsSplitBox :size="800" :max="0.7" :min="0.5" direction="horizontal" expand-direction="right">
<MsSplitBox :size="900" :max="0.7" :min="0.5" direction="horizontal" expand-direction="right">
<template #first>
<div class="leftWrapper h-full">
<div class="header h-[50px]">

View File

@ -58,7 +58,7 @@
<span class="text-[var(--color-text-2)]"> <caseLevel :case-level="record.caseLevel" /></span>
</template>
<a-option v-for="item of caseLevelList" :key="item.value" :value="item.value">
<caseLevel :case-level="item.value" />
<caseLevel :case-level="item.text" />
</a-option>
</a-select>
</template>
@ -307,6 +307,7 @@
v-model:visible="showThirdDrawer"
:case-id="caseId"
:drawer-loading="drawerLoading"
:platform-info="platformInfo"
@save="saveThirdDemand"
/>
</template>
@ -351,6 +352,7 @@
getCustomFieldsTable,
updateCaseRequest,
} from '@/api/modules/case-management/featureCase';
import { getCaseRelatedInfo } from '@/api/modules/project-management/menuManagement';
import { getProjectOptions } from '@/api/modules/project-management/projectMember';
import { useI18n } from '@/hooks/useI18n';
import useModal from '@/hooks/useModal';
@ -610,7 +612,7 @@
width: hasOperationPermission.value ? 260 : 50,
},
];
const platformInfo = ref<Record<string, any>>({});
const tableBatchActions = {
baseAction: [
// {
@ -803,7 +805,6 @@
}
}
const initDefaultFields = ref<CustomAttributes[]>([]);
let fullColumns: MsTableColumn = []; //
const { propsRes, propsEvent, loadList, setLoadListParams, resetSelector, setKeyword, setAdvanceFilter } = useTable(
getCaseList,
@ -1197,6 +1198,7 @@
let customFieldsColumns: Record<string, any>[] = [];
const tableRef = ref<InstanceType<typeof MsBaseTable> | null>(null);
let fullColumns: MsTableColumn = [];
//
async function getDefaultFields() {
customFieldsColumns = [];
@ -1449,17 +1451,29 @@
async function saveThirdDemand(params: CreateOrUpdateDemand) {
try {
drawerLoading.value = true;
const { demandPlatform, demandList } = params;
const { demandPlatform, demandList, functionalDemandBatchRequest } = params;
const batchAddParams: CreateOrUpdateDemand = {
selectIds: batchParams.value?.selectAll ? [] : batchParams.value.selectedIds,
selectAll: !!batchParams.value?.selectAll,
excludeIds: batchParams.value?.excludeIds || [],
condition: { keyword: keyword.value },
projectId: currentProjectId.value,
moduleIds: props.activeFolder === 'all' ? [] : [props.activeFolder, ...props.offspringIds],
moduleId: selectedModuleKeys.value[0],
demandPlatform,
demandList,
filter: {
reviewStatus: statusFilters.value,
caseLevel: caseFilters.value,
lastExecuteResult: executeResultFilters.value,
updateUserName: updateUserFilters.value,
createUserName: createUserFilters.value,
},
condition: {
keyword: keyword.value,
filter: propsRes.value.filter,
combine: batchParams.value.condition,
},
functionalDemandBatchRequest,
};
await batchAssociationDemand(batchAddParams);
Message.success(t('caseManagement.featureCase.associatedSuccess'));
@ -1481,11 +1495,29 @@
}
}
//
onBeforeMount(async () => {
try {
const result = await getCaseRelatedInfo(currentProjectId.value);
if (result && result.platform_key) {
platformInfo.value = { ...result };
}
if (Object.keys(result).length === 0) {
tableBatchActions.moreAction = [
...tableBatchActions.moreAction.slice(0, 1),
...tableBatchActions.moreAction.slice(-2),
];
}
} catch (error) {
console.log(error);
}
});
onMounted(async () => {
if (route.query.id) {
showCaseDetail(route.query.id as string, 0);
}
await getDefaultFields();
await initFilter();
initData();
});
@ -1507,6 +1539,7 @@
}
}
);
await getDefaultFields();
</script>
<style scoped lang="less">

View File

@ -755,8 +755,9 @@
return data;
}
function resetForm() {
async function resetForm() {
form.value = { ...initForm, templateId: form.value.templateId };
await initDefaultFields();
form.value.customFields = formItem.value.map((item: any) => {
return {
fieldId: item.field,

View File

@ -41,7 +41,9 @@
<div class="ml-2"> {{ item.name }} </div>
</div>
<a-button type="outline"> {{ t('caseManagement.featureCase.addContinueCreate') }} </a-button>
<a-button type="outline" @click="goNavigation(item.route)">
{{ t('caseManagement.featureCase.addContinueCreate') }}
</a-button>
</div>
</div>
</template>
@ -61,7 +63,7 @@
import { useI18n } from '@/hooks/useI18n';
import useVisit from '@/hooks/useVisit';
import { CaseManagementRouteEnum } from '@/enums/routeEnum';
import { RouteEnum } from '@/enums/routeEnum';
const { t } = useI18n();
@ -71,13 +73,14 @@
const router = useRouter();
const route = useRoute();
const cardList = ref([
{
key: 'testPlanTemplate',
name: t('caseManagement.featureCase.createTestPlan'),
},
// {
// key: 'testPlanTemplate',
// name: t('caseManagement.featureCase.createTestPlan'),
// },
{
key: 'caseReview',
name: t('caseManagement.featureCase.createCaseReview'),
route: RouteEnum.CASE_MANAGEMENT_REVIEW_CREATE,
},
]);
@ -91,7 +94,7 @@
} else {
clearInterval(timer.value);
router.push({
name: CaseManagementRouteEnum.CASE_MANAGEMENT_CASE,
name: RouteEnum.CASE_MANAGEMENT_CASE,
});
}
}, 1000);
@ -108,7 +111,7 @@
clearInterval(timer.value);
timer.value = null;
router.push({
name: CaseManagementRouteEnum.CASE_MANAGEMENT_CASE,
name: RouteEnum.CASE_MANAGEMENT_CASE,
});
}
@ -117,18 +120,24 @@
clearInterval(timer.value);
timer.value = null;
router.push({
name: CaseManagementRouteEnum.CASE_MANAGEMENT_CASE_DETAIL,
name: RouteEnum.CASE_MANAGEMENT_CASE_DETAIL,
});
}
function goDetail() {
clearInterval(timer.value);
router.push({
name: CaseManagementRouteEnum.CASE_MANAGEMENT_CASE,
name: RouteEnum.CASE_MANAGEMENT_CASE,
query: route.query,
});
}
function goNavigation(name: string) {
router.push({
name,
});
}
watch(
() => isNextTip.value,
() => {

View File

@ -63,14 +63,14 @@
<template #second>
<div class="p-[24px]">
<MsAdvanceFilter
v-model:keyword="keyword"
:filter-config-list="filterConfigList"
:custom-fields-config-list="searchCustomFields"
:row-count="filterRowCount"
:search-placeholder="t('caseManagement.featureCase.searchPlaceholder')"
@keyword-search="fetchData"
@adv-search="handleAdvSearch"
@refresh="fetchData()"
v-model:keyword="keyword"
:search-placeholder="t('caseManagement.featureCase.searchPlaceholder')"
>
<template #left>
<div class="text-[var(--color-text-1)]"
@ -669,7 +669,7 @@
lastExecuteResult: executeResultFilters.value,
updateUserName: updateUserFilters.value,
createUserName: createUserFilters.value,
deleteUserName: deleteUserFilters.value
deleteUserName: deleteUserFilters.value,
},
condition: {
keyword: keyword.value,

View File

@ -107,23 +107,19 @@
}
}
function setCount(list: CommentItem[]) {
featureCaseStore.setListCount(featureCaseStore.activeTab, list.length);
}
async function getAllCommentList() {
switch (activeComment.value) {
case 'caseComment':
await initCommentList();
setCount(commentList.value);
featureCaseStore.getCaseCounts(props.caseId);
break;
case 'reviewComment':
await initReviewCommentList();
setCount(reviewCommentList.value);
featureCaseStore.getCaseCounts(props.caseId);
break;
case 'executiveComment':
await initCommentList();
setCount(commentList.value);
featureCaseStore.getCaseCounts(props.caseId);
break;
default:
break;

View File

@ -17,6 +17,10 @@
<template v-if="(props.funParams.keyword || '').trim() === '' && props.showEmpty" #empty>
<div class="flex w-full items-center justify-center">
{{ t('caseManagement.caseReview.tableNoData') }}
<MsButton class="ml-[8px]" @click="emit('associate')">
{{ t('caseManagement.featureCase.associatedDemand') }}
</MsButton>
{{ t('caseManagement.featureCase.or') }}
<MsButton class="ml-[8px]" @click="emit('create')">
{{ t('caseManagement.featureCase.addDemand') }}
</MsButton>
@ -65,6 +69,7 @@
const emit = defineEmits<{
(e: 'update', record: DemandItem): void;
(e: 'create'): void;
(e: 'associate'): void;
(e: 'cancel', record: DemandItem): void;
}>();

View File

@ -2,7 +2,7 @@
<div>
<div class="mb-4 flex items-center justify-between">
<div>
<a-button type="primary" @click="associatedDemand">
<a-button v-if="platformInfo.platform_key" type="primary" @click="associatedDemand">
{{ t('caseManagement.featureCase.associatedDemand') }}</a-button
>
<a-button class="mx-3" type="outline" @click="addDemand">
@ -22,9 +22,11 @@
<AssociatedDemandTable
ref="demandRef"
:fun-params="{ caseId: props.caseId, keyword, projectId: currentProjectId }"
:show-empty="true"
@update="updateDemand"
@create="addDemand"
@cancel="cancelLink"
@associate="linkDemandDrawer = true"
></AssociatedDemandTable>
<AddDemandModal
ref="demandModalRef"
@ -174,7 +176,7 @@
// ellipsis: true,
// },
];
const fullColumns = ref<MsTableColumn>([]);
const fullColumns = ref<MsTableColumn>([...columns]);
const { propsRes, propsEvent, loadList, setLoadListParams, resetSelector } = useTable(getThirdDemandList, {
tableKey: TableKeyEnum.CASE_MANAGEMENT_TAB_DEMAND_PLATFORM,
@ -228,6 +230,7 @@
const tableRef = ref();
const customFields = ref<any[]>([]);
async function initColumn() {
fullColumns.value = [...columns];
try {
const res = await getThirdDemandList({
current: 1,
@ -244,9 +247,7 @@
};
}) as any;
fullColumns.value = [...columns, ...customFields.value];
tableRef.value.initColumn(fullColumns.value);
} catch (error) {
tableRef.value.initColumn(columns);
console.log(error);
}
}
@ -324,12 +325,8 @@
async (val) => {
if (val) {
resetSelector();
await initColumn();
initData();
}
},
{
immediate: true,
}
);
@ -362,12 +359,13 @@
showAddModel.value = true;
modelForm.value = { ...initModelForm };
}
// const activeTab = computed(() => featureCaseStore.activeTab);
onMounted(async () => {
try {
const result = await getCaseRelatedInfo(currentProjectId.value);
if (result && result.platform_key) {
platformInfo.value = { ...result };
initColumn();
}
} catch (error) {
console.log(error);

View File

@ -52,7 +52,6 @@
import useTable from '@/components/pure/ms-table/useTable';
import { getThirdDemandList } from '@/api/modules/case-management/featureCase';
import { getCaseRelatedInfo } from '@/api/modules/project-management/menuManagement';
import { useI18n } from '@/hooks/useI18n';
import { useAppStore } from '@/store';
@ -66,6 +65,7 @@
visible: boolean;
caseId: string;
drawerLoading: boolean;
platformInfo: Record<string, any>;
}>();
const emit = defineEmits<{
@ -107,7 +107,7 @@
// },
];
const fullColumns = ref<MsTableColumn>([]);
const fullColumns = ref<MsTableColumn>([...columns]);
const customFields = ref<Record<string, any>[]>([]);
const { propsRes, propsEvent, loadList, setLoadListParams, resetSelector } = useTable(getThirdDemandList, {
@ -138,11 +138,13 @@
return filteredData;
});
const platformInfo = ref<Record<string, any>>({});
// const platformInfo = ref<Record<string, any>>({});
function getPlatName() {
switch (platformInfo.value.platform_key) {
switch (props.platformInfo.platform_key) {
case 'zentao':
return t('caseManagement.featureCase.zentao');
case 'jira':
return t('caseManagement.featureCase.jira');
default:
break;
}
@ -159,10 +161,15 @@
});
const params = {
id: JSON.parse(platformInfo.value.demand_platform_config).zentaoId,
id: JSON.parse(props.platformInfo.demand_platform_config).zentaoId,
caseId: props.caseId,
demandPlatform: platformInfo.value.platform_key,
demandList,
demandPlatform: props.platformInfo.platform_key,
demandList: propsRes.value.selectorStatus === 'all' ? [] : demandList,
functionalDemandBatchRequest: {
keyword: platformKeyword.value,
excludeIds: [...propsRes.value.excludeKeys],
selectAll: propsRes.value.selectorStatus === 'all',
},
};
emit('save', params);
}
@ -198,12 +205,14 @@
const tableRef = ref();
async function initColumn() {
fullColumns.value = [...columns];
try {
const res = await getThirdDemandList({
current: 1,
pageSize: 10,
projectId: currentProjectId.value,
});
if (res.data.customHeaders.length) {
customFields.value = (res.data.customHeaders || []).map((item: any) => {
return {
title: item.name,
@ -213,35 +222,35 @@
options: item.options,
};
}) as any;
fullColumns.value = [...columns, ...customFields.value];
}
fullColumns.value.push(...customFields.value);
} catch (error) {
tableRef.value.initColumn(columns);
console.log(error);
}
}
onBeforeMount(async () => {
try {
const result = await getCaseRelatedInfo(currentProjectId.value);
if (result && result.platform_key) {
platformInfo.value = { ...result };
}
} catch (error) {
console.log(error);
}
});
// onBeforeMount(async () => {
// try {
// const result = await getCaseRelatedInfo(currentProjectId.value);
// if (result && result.platform_key) {
// platformInfo.value = { ...result };
// initColumn();
// }
// } catch (error) {
// console.log(error);
// }
// });
watch(
() => innerLinkDemandVisible.value,
async (val) => {
if (val) {
resetSelector();
await initColumn();
if (props.platformInfo.demand_platform_config) {
initData();
}
},
{
immediate: true,
}
}
);
</script>