fix: 修复环境管理host保存bug&用例关联抽屉里边展示用例等字段&归档测试计划操作限制

This commit is contained in:
xinxin.wu 2024-05-22 17:29:46 +08:00 committed by Craftsman
parent e73f528454
commit 19826609a5
9 changed files with 90 additions and 20 deletions

View File

@ -25,10 +25,10 @@
<div class="flex h-full"> <div class="flex h-full">
<div class="w-[292px] border-r border-[var(--color-text-n8)] p-[16px]"> <div class="w-[292px] border-r border-[var(--color-text-n8)] p-[16px]">
<div class="flex items-center justify-between"> <div class="flex items-center justify-between">
<div v-if="!props.hideProjectSelect" class="flex w-full flex-1"> <div v-if="!props.hideProjectSelect" class="w-full max-w-[162px] flex-1">
<a-select <a-select
v-model="innerProject" v-model="innerProject"
class="mb-[16px] flex-1" class="mb-[16px] w-full"
:default-value="innerProject" :default-value="innerProject"
allow-search allow-search
:placeholder="t('common.pleaseSelect')" :placeholder="t('common.pleaseSelect')"
@ -133,6 +133,23 @@
<template #caseLevel="{ record }"> <template #caseLevel="{ record }">
<caseLevel v-if="getCaseLevel(record)" :case-level="getCaseLevel(record)" /> <caseLevel v-if="getCaseLevel(record)" :case-level="getCaseLevel(record)" />
</template> </template>
<template #lastExecuteResult="{ record }">
<ExecuteStatusTag v-if="record.lastExecuteResult" :execute-result="record.lastExecuteResult" />
<span v-else>-</span>
</template>
<!-- 评审结果 -->
<template #reviewStatus="{ record }">
<MsIcon
:type="statusIconMap[record.reviewStatus]?.icon || ''"
class="mr-1"
:class="[statusIconMap[record.reviewStatus].color]"
></MsIcon>
<span>{{ statusIconMap[record.reviewStatus]?.statusText || '' }} </span>
</template>
<!-- 执行结果 -->
<template #[FilterSlotNameEnum.CASE_MANAGEMENT_EXECUTE_RESULT]="{ filterContent }">
<ExecuteStatusTag :execute-result="filterContent.value" />
</template>
</ms-base-table> </ms-base-table>
<div class="footer"> <div class="footer">
<div class="flex flex-1 items-center"> <div class="flex flex-1 items-center">
@ -172,6 +189,7 @@
import MsBaseTable from '@/components/pure/ms-table/base-table.vue'; import MsBaseTable from '@/components/pure/ms-table/base-table.vue';
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 ExecuteStatusTag from '@/components/business/ms-case-associate/executeResult.vue';
import MsTree from '@/components/business/ms-tree/index.vue'; import MsTree from '@/components/business/ms-tree/index.vue';
import type { MsTreeNodeData } from '@/components/business/ms-tree/types'; import type { MsTreeNodeData } from '@/components/business/ms-tree/types';
import caseLevel from './caseLevel.vue'; import caseLevel from './caseLevel.vue';
@ -186,8 +204,10 @@
import type { ProjectListItem } from '@/models/setting/project'; import type { ProjectListItem } from '@/models/setting/project';
import { CaseLinkEnum } from '@/enums/caseEnum'; import { CaseLinkEnum } from '@/enums/caseEnum';
import { CaseManagementRouteEnum } from '@/enums/routeEnum'; import { CaseManagementRouteEnum } from '@/enums/routeEnum';
import { FilterSlotNameEnum } from '@/enums/tableFilterEnum';
import { initGetModuleCountFunc, type RequestModuleEnum } from './utils'; import { initGetModuleCountFunc, type RequestModuleEnum } from './utils';
import { executionResultMap, statusIconMap } from '@/views/case-management/caseManagementFeature/components/utils';
const router = useRouter(); const router = useRouter();
const appStore = useAppStore(); const appStore = useAppStore();
@ -359,6 +379,55 @@
return []; return [];
} }
const reviewResultOptions = computed(() => {
return Object.keys(statusIconMap).map((key) => {
return {
value: key,
label: statusIconMap[key].statusText,
};
});
});
const executeResultOptions = computed(() => {
return Object.keys(executionResultMap).map((key) => {
return {
value: key,
label: executionResultMap[key].statusText,
};
});
});
function getReviewStatus() {
if (!props.isHiddenCaseLevel) {
return [
{
title: 'caseManagement.featureCase.tableColumnReviewResult',
dataIndex: 'reviewStatus',
slotName: 'reviewStatus',
filterConfig: {
options: reviewResultOptions.value,
filterSlotName: FilterSlotNameEnum.CASE_MANAGEMENT_REVIEW_RESULT,
},
showInTable: true,
width: 150,
showDrag: true,
},
{
title: 'caseManagement.featureCase.tableColumnExecutionResult',
dataIndex: 'lastExecuteResult',
slotName: 'lastExecuteResult',
filterConfig: {
options: executeResultOptions.value,
filterSlotName: FilterSlotNameEnum.CASE_MANAGEMENT_EXECUTE_RESULT,
},
showInTable: true,
width: 150,
showDrag: true,
},
];
}
return [];
}
const columns: MsTableColumn = [ const columns: MsTableColumn = [
{ {
title: 'ID', title: 'ID',
@ -366,16 +435,18 @@
slotName: 'num', slotName: 'num',
sortIndex: 1, sortIndex: 1,
showTooltip: true, showTooltip: true,
// TODO
// sortable: { // sortable: {
// sortDirections: ['ascend', 'descend'], // sortDirections: ['ascend', 'descend'],
// sorter: true, // sorter: true,
// }, // },
width: 150, width: 120,
fixed: 'left', fixed: 'left',
}, },
{ {
title: 'ms.case.associate.caseName', title: 'ms.case.associate.caseName',
dataIndex: 'name', dataIndex: 'name',
// TODO
// sortable: { // sortable: {
// sortDirections: ['ascend', 'descend'], // sortDirections: ['ascend', 'descend'],
// sorter: true, // sorter: true,
@ -384,6 +455,7 @@
width: 250, width: 250,
}, },
...getCaseLevelColumn(), ...getCaseLevelColumn(),
...getReviewStatus(),
{ {
title: 'ms.case.associate.tags', title: 'ms.case.associate.tags',
dataIndex: 'tags', dataIndex: 'tags',

View File

@ -36,7 +36,7 @@
</a-select> </a-select>
</a-form-item> </a-form-item>
</div> </div>
<div class="w-[100px]"> <div class="w-[110px]">
<a-form-item <a-form-item
:field="`matchRules[${idx}].condition`" :field="`matchRules[${idx}].condition`"
hide-asterisk hide-asterisk

View File

@ -71,7 +71,7 @@
>{{ t('caseManagement.featureCase.backCaseList') }}</MsButton >{{ t('caseManagement.featureCase.backCaseList') }}</MsButton
> >
<MsButton <MsButton
v-if="!validateResultInfo.failCount" v-if="validateResultInfo.successCount"
type="text" type="text"
class="ml-[8px]" class="ml-[8px]"
:loading="props.importLoading" :loading="props.importLoading"
@ -227,8 +227,7 @@
.moreBtn { .moreBtn {
color: rgb(var(--primary-5)); color: rgb(var(--primary-5));
box-shadow: 0 -1px 4px rgba(31 35 41/10%); box-shadow: 0 -1px 4px rgba(31 35 41/10%);
@apply mt-2 flex items-center justify-center; @apply mt-2 flex cursor-pointer items-center justify-center;
cursor: pointer;
} }
.spanBtn { .spanBtn {
cursor: pointer; cursor: pointer;

View File

@ -240,7 +240,7 @@
store.currentEnvDetailInfo.mock = true; store.currentEnvDetailInfo.mock = true;
await updateOrAddEnv({ fileList: [], request: getParameters() }); await updateOrAddEnv({ fileList: [], request: getParameters() });
setIsSave(true); setIsSave(true);
loading.value = false;
Message.success(store.currentEnvDetailInfo.id ? t('common.updateSuccess') : t('common.saveSuccess')); Message.success(store.currentEnvDetailInfo.id ? t('common.updateSuccess') : t('common.saveSuccess'));
emit('ok', store.currentEnvDetailInfo.id); emit('ok', store.currentEnvDetailInfo.id);
}; };

View File

@ -243,6 +243,7 @@
systemTitle: t('project.environmental.env.systemTitle'), systemTitle: t('project.environmental.env.systemTitle'),
selectedTitle: t('project.environmental.env.selectedTitle'), selectedTitle: t('project.environmental.env.selectedTitle'),
}" }"
:export-loading="exportLoading"
@confirm="(v) => handleEnvExport(v.map((item) => item.key))" @confirm="(v) => handleEnvExport(v.map((item) => item.key))"
/> />
</template> </template>
@ -403,14 +404,18 @@
console.log(error); console.log(error);
} }
}; };
const exportLoading = ref<boolean>(false);
// //
const handleEnvExport = async (id: string | string[]) => { const handleEnvExport = async (id: string | string[]) => {
exportLoading.value = true;
try { try {
const blob = await exportEnv(Array.isArray(id) ? id : [id]); const blob = await exportEnv(Array.isArray(id) ? id : [id]);
downloadByteFile(blob, 'EnvParam.json'); downloadByteFile(blob, 'EnvParam.json');
} catch (error) { } catch (error) {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.log(error); console.log(error);
} finally {
exportLoading.value = false;
} }
}; };
const globalEnvRef = ref(); const globalEnvRef = ref();

View File

@ -12,7 +12,7 @@
:project-id="currentProjectId" :project-id="currentProjectId"
:type="RequestModuleEnum.CASE_MANAGEMENT" :type="RequestModuleEnum.CASE_MANAGEMENT"
hide-project-select hide-project-select
is-hidden-case-level :is-hidden-case-level="false"
:selector-all="true" :selector-all="true"
@save="saveHandler" @save="saveHandler"
> >

View File

@ -365,7 +365,7 @@
columnSelectorDisabled: true, columnSelectorDisabled: true,
}, },
{ {
title: 'testPlan.testPlanIndex.executionResult', title: 'common.status',
dataIndex: 'status', dataIndex: 'status',
slotName: 'status', slotName: 'status',
filterConfig: { filterConfig: {

View File

@ -111,7 +111,7 @@
}, },
{ {
percentage: (blockCount / caseTotal) * 100, percentage: (blockCount / caseTotal) * 100,
color: 'rgb(var(--link-6))', color: 'rgb(var(--primary-3))',
}, },
{ {
percentage: (fakeErrorCount / caseTotal) * 100, percentage: (fakeErrorCount / caseTotal) * 100,

View File

@ -32,7 +32,7 @@
{{ t('common.edit') }} {{ t('common.edit') }}
</MsButton> </MsButton>
<MsButton <MsButton
v-permission="['PROJECT_TEST_PLAN:READ+EXECUTE']" v-if="hasAnyPermission(['PROJECT_TEST_PLAN:READ+EXECUTE']) && detail.status !== 'ARCHIVED'"
type="button" type="button"
status="default" status="default"
@click="handleGenerateReport" @click="handleGenerateReport"
@ -41,7 +41,7 @@
{{ t('testPlan.testPlanDetail.generateReport') }} {{ t('testPlan.testPlanDetail.generateReport') }}
</MsButton> </MsButton>
<MsButton <MsButton
v-permission="['PROJECT_TEST_PLAN:READ+ADD']" v-if="hasAnyPermission(['PROJECT_TEST_PLAN:READ+ADD']) && detail.status !== 'ARCHIVED'"
type="button" type="button"
status="default" status="default"
@click="editorCopyHandler(true)" @click="editorCopyHandler(true)"
@ -49,13 +49,7 @@
<MsIcon type="icon-icon_copy_outlined" class="mr-[8px]" /> <MsIcon type="icon-icon_copy_outlined" class="mr-[8px]" />
{{ t('common.copy') }} {{ t('common.copy') }}
</MsButton> </MsButton>
<MsButton <MsButton v-if="isEnableEdit" type="button" status="default" :loading="followLoading" @click="followHandler">
v-permission="['PROJECT_TEST_PLAN:READ+UPDATE']"
type="button"
status="default"
:loading="followLoading"
@click="followHandler"
>
<MsIcon <MsIcon
:type="detail.followFlag ? 'icon-icon_collect_filled' : 'icon-icon_collection_outlined'" :type="detail.followFlag ? 'icon-icon_collect_filled' : 'icon-icon_collection_outlined'"
:class="`mr-[8px] ${detail.followFlag ? 'text-[rgb(var(--warning-6))]' : ''}`" :class="`mr-[8px] ${detail.followFlag ? 'text-[rgb(var(--warning-6))]' : ''}`"