fix(测试计划): 执行操作-请求不可重复发起
This commit is contained in:
parent
c564a5b8f5
commit
00a3c58939
|
@ -12,6 +12,7 @@
|
|||
@adv-search="loadCaseList()"
|
||||
@refresh="loadCaseList()"
|
||||
/>
|
||||
<a-spin :loading="tableLoading" class="w-full">
|
||||
<MsBaseTable
|
||||
ref="tableRef"
|
||||
class="mt-[16px]"
|
||||
|
@ -74,6 +75,7 @@
|
|||
</MsPopconfirm>
|
||||
</template>
|
||||
</MsBaseTable>
|
||||
</a-spin>
|
||||
<CaseAndScenarioReportDrawer
|
||||
v-model:visible="reportVisible"
|
||||
:report-id="reportId"
|
||||
|
@ -310,7 +312,7 @@
|
|||
selectable: hasOperationPermission.value,
|
||||
});
|
||||
|
||||
const { propsRes, propsEvent, loadList, setLoadListParams, resetSelector, setLoading } = useTable(
|
||||
const { propsRes, propsEvent, loadList, setLoadListParams, resetSelector } = useTable(
|
||||
getPlanDetailApiCaseList,
|
||||
tableProps.value,
|
||||
(record) => {
|
||||
|
@ -491,9 +493,10 @@
|
|||
}
|
||||
|
||||
// 执行
|
||||
const tableLoading = ref(false); // 包含批量操作按钮,防止重复发起请求
|
||||
async function handleRun(record: PlanDetailApiCaseItem) {
|
||||
try {
|
||||
setLoading(true);
|
||||
tableLoading.value = true;
|
||||
await runApiCase(record.id);
|
||||
Message.success(t('common.executionSuccess'));
|
||||
resetSelectorAndCaseList();
|
||||
|
@ -502,14 +505,14 @@
|
|||
// eslint-disable-next-line no-console
|
||||
console.log(error);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
tableLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
// 批量执行
|
||||
async function handleBatchRun() {
|
||||
try {
|
||||
setLoading(true);
|
||||
tableLoading.value = true;
|
||||
const tableParams = await getTableParams(true);
|
||||
await batchRunApiCase({
|
||||
selectIds: tableSelected.value as string[],
|
||||
|
@ -524,7 +527,7 @@
|
|||
// eslint-disable-next-line no-console
|
||||
console.log(error);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
tableLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
@adv-search="loadCaseList()"
|
||||
@refresh="loadCaseList()"
|
||||
/>
|
||||
<a-spin :loading="tableLoading" class="w-full">
|
||||
<MsBaseTable
|
||||
ref="tableRef"
|
||||
class="mt-[16px]"
|
||||
|
@ -71,6 +72,7 @@
|
|||
</MsPopconfirm>
|
||||
</template>
|
||||
</MsBaseTable>
|
||||
</a-spin>
|
||||
<CaseAndScenarioReportDrawer
|
||||
v-model:visible="reportVisible"
|
||||
:report-id="reportId"
|
||||
|
@ -291,7 +293,7 @@
|
|||
selectable: hasOperationPermission.value,
|
||||
});
|
||||
|
||||
const { propsRes, propsEvent, loadList, setLoadListParams, resetSelector, setLoading } = useTable(
|
||||
const { propsRes, propsEvent, loadList, setLoadListParams, resetSelector } = useTable(
|
||||
getPlanDetailApiScenarioList,
|
||||
tableProps.value,
|
||||
(record) => {
|
||||
|
@ -474,9 +476,10 @@
|
|||
}
|
||||
|
||||
// 执行
|
||||
const tableLoading = ref(false); // 包含批量操作按钮,防止重复发起请求
|
||||
async function handleRun(record: PlanDetailApiScenarioItem) {
|
||||
try {
|
||||
setLoading(true);
|
||||
tableLoading.value = true;
|
||||
await runApiScenario(record.id);
|
||||
Message.success(t('common.executionSuccess'));
|
||||
resetSelectorAndCaseList();
|
||||
|
@ -485,14 +488,14 @@
|
|||
// eslint-disable-next-line no-console
|
||||
console.log(error);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
tableLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
// 批量执行
|
||||
async function handleBatchRun() {
|
||||
try {
|
||||
setLoading(true);
|
||||
tableLoading.value = true;
|
||||
const tableParams = await getTableParams(true);
|
||||
await batchRunApiScenario({
|
||||
selectIds: tableSelected.value as string[],
|
||||
|
@ -507,7 +510,7 @@
|
|||
// eslint-disable-next-line no-console
|
||||
console.log(error);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
tableLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue