fix(测试计划): 执行操作-请求不可重复发起
This commit is contained in:
parent
c564a5b8f5
commit
00a3c58939
|
@ -12,68 +12,70 @@
|
||||||
@adv-search="loadCaseList()"
|
@adv-search="loadCaseList()"
|
||||||
@refresh="loadCaseList()"
|
@refresh="loadCaseList()"
|
||||||
/>
|
/>
|
||||||
<MsBaseTable
|
<a-spin :loading="tableLoading" class="w-full">
|
||||||
ref="tableRef"
|
<MsBaseTable
|
||||||
class="mt-[16px]"
|
ref="tableRef"
|
||||||
v-bind="propsRes"
|
class="mt-[16px]"
|
||||||
:action-config="batchActions"
|
v-bind="propsRes"
|
||||||
v-on="propsEvent"
|
:action-config="batchActions"
|
||||||
@batch-action="handleTableBatch"
|
v-on="propsEvent"
|
||||||
@drag-change="handleDragChange"
|
@batch-action="handleTableBatch"
|
||||||
@selected-change="handleTableSelect"
|
@drag-change="handleDragChange"
|
||||||
@filter-change="getModuleCount"
|
@selected-change="handleTableSelect"
|
||||||
@module-change="loadCaseList(false)"
|
@filter-change="getModuleCount"
|
||||||
>
|
@module-change="loadCaseList(false)"
|
||||||
<template #num="{ record }">
|
>
|
||||||
<MsButton type="text" @click="toDetail(record)">{{ record.num }}</MsButton>
|
<template #num="{ record }">
|
||||||
</template>
|
<MsButton type="text" @click="toDetail(record)">{{ record.num }}</MsButton>
|
||||||
<template #protocol="{ record }">
|
</template>
|
||||||
<ApiMethodName :method="record.protocol" />
|
<template #protocol="{ record }">
|
||||||
</template>
|
<ApiMethodName :method="record.protocol" />
|
||||||
<template #[FilterSlotNameEnum.CASE_MANAGEMENT_CASE_LEVEL]="{ filterContent }">
|
</template>
|
||||||
<CaseLevel :case-level="filterContent.value" />
|
<template #[FilterSlotNameEnum.CASE_MANAGEMENT_CASE_LEVEL]="{ filterContent }">
|
||||||
</template>
|
<CaseLevel :case-level="filterContent.value" />
|
||||||
<template #caseLevel="{ record }">
|
</template>
|
||||||
<CaseLevel :case-level="record.priority" />
|
<template #caseLevel="{ record }">
|
||||||
</template>
|
<CaseLevel :case-level="record.priority" />
|
||||||
<template #[FilterSlotNameEnum.API_TEST_CASE_API_LAST_EXECUTE_STATUS]="{ filterContent }">
|
</template>
|
||||||
<ExecutionStatus :module-type="ReportEnum.API_REPORT" :status="filterContent.value" />
|
<template #[FilterSlotNameEnum.API_TEST_CASE_API_LAST_EXECUTE_STATUS]="{ filterContent }">
|
||||||
</template>
|
<ExecutionStatus :module-type="ReportEnum.API_REPORT" :status="filterContent.value" />
|
||||||
<template #lastExecResult="{ record }">
|
</template>
|
||||||
<ExecutionStatus
|
<template #lastExecResult="{ record }">
|
||||||
:module-type="ReportEnum.API_REPORT"
|
<ExecutionStatus
|
||||||
:status="record.lastExecResult"
|
:module-type="ReportEnum.API_REPORT"
|
||||||
:class="[!record.lastExecReportId ? '' : 'cursor-pointer']"
|
:status="record.lastExecResult"
|
||||||
@click="showReport(record)"
|
:class="[!record.lastExecReportId ? '' : 'cursor-pointer']"
|
||||||
/>
|
@click="showReport(record)"
|
||||||
</template>
|
/>
|
||||||
<template #status="{ record }">
|
</template>
|
||||||
<apiStatus :status="record.status" />
|
<template #status="{ record }">
|
||||||
</template>
|
<apiStatus :status="record.status" />
|
||||||
<template v-if="props.canEdit" #operation="{ record }">
|
</template>
|
||||||
<MsButton
|
<template v-if="props.canEdit" #operation="{ record }">
|
||||||
v-permission="['PROJECT_TEST_PLAN:READ+EXECUTE']"
|
<MsButton
|
||||||
type="text"
|
v-permission="['PROJECT_TEST_PLAN:READ+EXECUTE']"
|
||||||
class="!mr-0"
|
type="text"
|
||||||
@click="handleRun(record)"
|
class="!mr-0"
|
||||||
>
|
@click="handleRun(record)"
|
||||||
{{ t('common.execute') }}
|
>
|
||||||
</MsButton>
|
{{ t('common.execute') }}
|
||||||
<a-divider v-permission="['PROJECT_TEST_PLAN:READ+ASSOCIATION']" direction="vertical" :margin="8"></a-divider>
|
|
||||||
<MsPopconfirm
|
|
||||||
:title="t('testPlan.featureCase.disassociateTip', { name: characterLimit(record.name) })"
|
|
||||||
:sub-title-tip="t('testPlan.featureCase.disassociateTipContent')"
|
|
||||||
:ok-text="t('common.confirm')"
|
|
||||||
:loading="disassociateLoading"
|
|
||||||
type="error"
|
|
||||||
@confirm="(val, done) => handleDisassociateCase(record, done)"
|
|
||||||
>
|
|
||||||
<MsButton v-permission="['PROJECT_TEST_PLAN:READ+ASSOCIATION']" type="text" class="!mr-0">
|
|
||||||
{{ t('common.cancelLink') }}
|
|
||||||
</MsButton>
|
</MsButton>
|
||||||
</MsPopconfirm>
|
<a-divider v-permission="['PROJECT_TEST_PLAN:READ+ASSOCIATION']" direction="vertical" :margin="8"></a-divider>
|
||||||
</template>
|
<MsPopconfirm
|
||||||
</MsBaseTable>
|
:title="t('testPlan.featureCase.disassociateTip', { name: characterLimit(record.name) })"
|
||||||
|
:sub-title-tip="t('testPlan.featureCase.disassociateTipContent')"
|
||||||
|
:ok-text="t('common.confirm')"
|
||||||
|
:loading="disassociateLoading"
|
||||||
|
type="error"
|
||||||
|
@confirm="(val, done) => handleDisassociateCase(record, done)"
|
||||||
|
>
|
||||||
|
<MsButton v-permission="['PROJECT_TEST_PLAN:READ+ASSOCIATION']" type="text" class="!mr-0">
|
||||||
|
{{ t('common.cancelLink') }}
|
||||||
|
</MsButton>
|
||||||
|
</MsPopconfirm>
|
||||||
|
</template>
|
||||||
|
</MsBaseTable>
|
||||||
|
</a-spin>
|
||||||
<CaseAndScenarioReportDrawer
|
<CaseAndScenarioReportDrawer
|
||||||
v-model:visible="reportVisible"
|
v-model:visible="reportVisible"
|
||||||
:report-id="reportId"
|
:report-id="reportId"
|
||||||
|
@ -310,7 +312,7 @@
|
||||||
selectable: hasOperationPermission.value,
|
selectable: hasOperationPermission.value,
|
||||||
});
|
});
|
||||||
|
|
||||||
const { propsRes, propsEvent, loadList, setLoadListParams, resetSelector, setLoading } = useTable(
|
const { propsRes, propsEvent, loadList, setLoadListParams, resetSelector } = useTable(
|
||||||
getPlanDetailApiCaseList,
|
getPlanDetailApiCaseList,
|
||||||
tableProps.value,
|
tableProps.value,
|
||||||
(record) => {
|
(record) => {
|
||||||
|
@ -491,9 +493,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// 执行
|
// 执行
|
||||||
|
const tableLoading = ref(false); // 包含批量操作按钮,防止重复发起请求
|
||||||
async function handleRun(record: PlanDetailApiCaseItem) {
|
async function handleRun(record: PlanDetailApiCaseItem) {
|
||||||
try {
|
try {
|
||||||
setLoading(true);
|
tableLoading.value = true;
|
||||||
await runApiCase(record.id);
|
await runApiCase(record.id);
|
||||||
Message.success(t('common.executionSuccess'));
|
Message.success(t('common.executionSuccess'));
|
||||||
resetSelectorAndCaseList();
|
resetSelectorAndCaseList();
|
||||||
|
@ -502,14 +505,14 @@
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.log(error);
|
console.log(error);
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
tableLoading.value = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 批量执行
|
// 批量执行
|
||||||
async function handleBatchRun() {
|
async function handleBatchRun() {
|
||||||
try {
|
try {
|
||||||
setLoading(true);
|
tableLoading.value = true;
|
||||||
const tableParams = await getTableParams(true);
|
const tableParams = await getTableParams(true);
|
||||||
await batchRunApiCase({
|
await batchRunApiCase({
|
||||||
selectIds: tableSelected.value as string[],
|
selectIds: tableSelected.value as string[],
|
||||||
|
@ -524,7 +527,7 @@
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.log(error);
|
console.log(error);
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
tableLoading.value = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,65 +12,67 @@
|
||||||
@adv-search="loadCaseList()"
|
@adv-search="loadCaseList()"
|
||||||
@refresh="loadCaseList()"
|
@refresh="loadCaseList()"
|
||||||
/>
|
/>
|
||||||
<MsBaseTable
|
<a-spin :loading="tableLoading" class="w-full">
|
||||||
ref="tableRef"
|
<MsBaseTable
|
||||||
class="mt-[16px]"
|
ref="tableRef"
|
||||||
v-bind="propsRes"
|
class="mt-[16px]"
|
||||||
:action-config="batchActions"
|
v-bind="propsRes"
|
||||||
v-on="propsEvent"
|
:action-config="batchActions"
|
||||||
@batch-action="handleTableBatch"
|
v-on="propsEvent"
|
||||||
@drag-change="handleDragChange"
|
@batch-action="handleTableBatch"
|
||||||
@selected-change="handleTableSelect"
|
@drag-change="handleDragChange"
|
||||||
@filter-change="getModuleCount"
|
@selected-change="handleTableSelect"
|
||||||
@module-change="loadCaseList(false)"
|
@filter-change="getModuleCount"
|
||||||
>
|
@module-change="loadCaseList(false)"
|
||||||
<template #num="{ record }">
|
>
|
||||||
<MsButton type="text" @click="toDetail(record)">{{ record.num }}</MsButton>
|
<template #num="{ record }">
|
||||||
</template>
|
<MsButton type="text" @click="toDetail(record)">{{ record.num }}</MsButton>
|
||||||
<template #[FilterSlotNameEnum.CASE_MANAGEMENT_CASE_LEVEL]="{ filterContent }">
|
</template>
|
||||||
<CaseLevel :case-level="filterContent.value" />
|
<template #[FilterSlotNameEnum.CASE_MANAGEMENT_CASE_LEVEL]="{ filterContent }">
|
||||||
</template>
|
<CaseLevel :case-level="filterContent.value" />
|
||||||
<template #caseLevel="{ record }">
|
</template>
|
||||||
<CaseLevel :case-level="record.priority" />
|
<template #caseLevel="{ record }">
|
||||||
</template>
|
<CaseLevel :case-level="record.priority" />
|
||||||
<template #[FilterSlotNameEnum.API_TEST_CASE_API_LAST_EXECUTE_STATUS]="{ filterContent }">
|
</template>
|
||||||
<ExecutionStatus :module-type="ReportEnum.API_REPORT" :status="filterContent.value" />
|
<template #[FilterSlotNameEnum.API_TEST_CASE_API_LAST_EXECUTE_STATUS]="{ filterContent }">
|
||||||
</template>
|
<ExecutionStatus :module-type="ReportEnum.API_REPORT" :status="filterContent.value" />
|
||||||
<template #lastExecResult="{ record }">
|
</template>
|
||||||
<ExecutionStatus
|
<template #lastExecResult="{ record }">
|
||||||
:module-type="ReportEnum.API_REPORT"
|
<ExecutionStatus
|
||||||
:status="record.lastExecResult"
|
:module-type="ReportEnum.API_REPORT"
|
||||||
:class="[!record.lastExecReportId ? '' : 'cursor-pointer']"
|
:status="record.lastExecResult"
|
||||||
@click="showReport(record)"
|
:class="[!record.lastExecReportId ? '' : 'cursor-pointer']"
|
||||||
/>
|
@click="showReport(record)"
|
||||||
</template>
|
/>
|
||||||
<template #status="{ record }">
|
</template>
|
||||||
<apiStatus :status="record.status" />
|
<template #status="{ record }">
|
||||||
</template>
|
<apiStatus :status="record.status" />
|
||||||
<template v-if="props.canEdit" #operation="{ record }">
|
</template>
|
||||||
<MsButton
|
<template v-if="props.canEdit" #operation="{ record }">
|
||||||
v-permission="['PROJECT_TEST_PLAN:READ+EXECUTE']"
|
<MsButton
|
||||||
type="text"
|
v-permission="['PROJECT_TEST_PLAN:READ+EXECUTE']"
|
||||||
class="!mr-0"
|
type="text"
|
||||||
@click="handleRun(record)"
|
class="!mr-0"
|
||||||
>
|
@click="handleRun(record)"
|
||||||
{{ t('common.execute') }}
|
>
|
||||||
</MsButton>
|
{{ t('common.execute') }}
|
||||||
<a-divider v-permission="['PROJECT_TEST_PLAN:READ+ASSOCIATION']" direction="vertical" :margin="8"></a-divider>
|
|
||||||
<MsPopconfirm
|
|
||||||
:title="t('testPlan.featureCase.disassociateTip', { name: characterLimit(record.name) })"
|
|
||||||
:sub-title-tip="t('testPlan.featureCase.disassociateTipContent')"
|
|
||||||
:ok-text="t('common.confirm')"
|
|
||||||
:loading="disassociateLoading"
|
|
||||||
type="error"
|
|
||||||
@confirm="(val, done) => handleDisassociateCase(record, done)"
|
|
||||||
>
|
|
||||||
<MsButton v-permission="['PROJECT_TEST_PLAN:READ+ASSOCIATION']" type="text" class="!mr-0">
|
|
||||||
{{ t('common.cancelLink') }}
|
|
||||||
</MsButton>
|
</MsButton>
|
||||||
</MsPopconfirm>
|
<a-divider v-permission="['PROJECT_TEST_PLAN:READ+ASSOCIATION']" direction="vertical" :margin="8"></a-divider>
|
||||||
</template>
|
<MsPopconfirm
|
||||||
</MsBaseTable>
|
:title="t('testPlan.featureCase.disassociateTip', { name: characterLimit(record.name) })"
|
||||||
|
:sub-title-tip="t('testPlan.featureCase.disassociateTipContent')"
|
||||||
|
:ok-text="t('common.confirm')"
|
||||||
|
:loading="disassociateLoading"
|
||||||
|
type="error"
|
||||||
|
@confirm="(val, done) => handleDisassociateCase(record, done)"
|
||||||
|
>
|
||||||
|
<MsButton v-permission="['PROJECT_TEST_PLAN:READ+ASSOCIATION']" type="text" class="!mr-0">
|
||||||
|
{{ t('common.cancelLink') }}
|
||||||
|
</MsButton>
|
||||||
|
</MsPopconfirm>
|
||||||
|
</template>
|
||||||
|
</MsBaseTable>
|
||||||
|
</a-spin>
|
||||||
<CaseAndScenarioReportDrawer
|
<CaseAndScenarioReportDrawer
|
||||||
v-model:visible="reportVisible"
|
v-model:visible="reportVisible"
|
||||||
:report-id="reportId"
|
:report-id="reportId"
|
||||||
|
@ -291,7 +293,7 @@
|
||||||
selectable: hasOperationPermission.value,
|
selectable: hasOperationPermission.value,
|
||||||
});
|
});
|
||||||
|
|
||||||
const { propsRes, propsEvent, loadList, setLoadListParams, resetSelector, setLoading } = useTable(
|
const { propsRes, propsEvent, loadList, setLoadListParams, resetSelector } = useTable(
|
||||||
getPlanDetailApiScenarioList,
|
getPlanDetailApiScenarioList,
|
||||||
tableProps.value,
|
tableProps.value,
|
||||||
(record) => {
|
(record) => {
|
||||||
|
@ -474,9 +476,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// 执行
|
// 执行
|
||||||
|
const tableLoading = ref(false); // 包含批量操作按钮,防止重复发起请求
|
||||||
async function handleRun(record: PlanDetailApiScenarioItem) {
|
async function handleRun(record: PlanDetailApiScenarioItem) {
|
||||||
try {
|
try {
|
||||||
setLoading(true);
|
tableLoading.value = true;
|
||||||
await runApiScenario(record.id);
|
await runApiScenario(record.id);
|
||||||
Message.success(t('common.executionSuccess'));
|
Message.success(t('common.executionSuccess'));
|
||||||
resetSelectorAndCaseList();
|
resetSelectorAndCaseList();
|
||||||
|
@ -485,14 +488,14 @@
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.log(error);
|
console.log(error);
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
tableLoading.value = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 批量执行
|
// 批量执行
|
||||||
async function handleBatchRun() {
|
async function handleBatchRun() {
|
||||||
try {
|
try {
|
||||||
setLoading(true);
|
tableLoading.value = true;
|
||||||
const tableParams = await getTableParams(true);
|
const tableParams = await getTableParams(true);
|
||||||
await batchRunApiScenario({
|
await batchRunApiScenario({
|
||||||
selectIds: tableSelected.value as string[],
|
selectIds: tableSelected.value as string[],
|
||||||
|
@ -507,7 +510,7 @@
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.log(error);
|
console.log(error);
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
tableLoading.value = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue