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="w-[292px] border-r border-[var(--color-text-n8)] p-[16px]">
<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
v-model="innerProject"
class="mb-[16px] flex-1"
class="mb-[16px] w-full"
:default-value="innerProject"
allow-search
:placeholder="t('common.pleaseSelect')"
@ -133,6 +133,23 @@
<template #caseLevel="{ record }">
<caseLevel v-if="getCaseLevel(record)" :case-level="getCaseLevel(record)" />
</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>
<div class="footer">
<div class="flex flex-1 items-center">
@ -172,6 +189,7 @@
import MsBaseTable from '@/components/pure/ms-table/base-table.vue';
import { MsTableColumn } from '@/components/pure/ms-table/type';
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 type { MsTreeNodeData } from '@/components/business/ms-tree/types';
import caseLevel from './caseLevel.vue';
@ -186,8 +204,10 @@
import type { ProjectListItem } from '@/models/setting/project';
import { CaseLinkEnum } from '@/enums/caseEnum';
import { CaseManagementRouteEnum } from '@/enums/routeEnum';
import { FilterSlotNameEnum } from '@/enums/tableFilterEnum';
import { initGetModuleCountFunc, type RequestModuleEnum } from './utils';
import { executionResultMap, statusIconMap } from '@/views/case-management/caseManagementFeature/components/utils';
const router = useRouter();
const appStore = useAppStore();
@ -359,6 +379,55 @@
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 = [
{
title: 'ID',
@ -366,16 +435,18 @@
slotName: 'num',
sortIndex: 1,
showTooltip: true,
// TODO
// sortable: {
// sortDirections: ['ascend', 'descend'],
// sorter: true,
// },
width: 150,
width: 120,
fixed: 'left',
},
{
title: 'ms.case.associate.caseName',
dataIndex: 'name',
// TODO
// sortable: {
// sortDirections: ['ascend', 'descend'],
// sorter: true,
@ -384,6 +455,7 @@
width: 250,
},
...getCaseLevelColumn(),
...getReviewStatus(),
{
title: 'ms.case.associate.tags',
dataIndex: 'tags',

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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