fix(测试计划): 修复测试计划关联功能案例时表单重复提交的问题

修复测试计划关联功能案例时表单重复提交的问题
This commit is contained in:
song-tianyang 2021-08-31 15:45:27 +08:00 committed by 刘瑞斌
parent a820a0f418
commit 63d55ba3db
3 changed files with 16 additions and 4 deletions

View File

@ -244,7 +244,7 @@ public class TestPlanService {
testPlan.setActualEndTime(null); testPlan.setActualEndTime(null);
} }
if ((testPlan.getStatus().equals(TestPlanStatus.Finished.name()) || testPlan.getStatus().equals(TestPlanStatus.Completed.name())) if (StringUtils.equalsAnyIgnoreCase(testPlan.getStatus(),TestPlanStatus.Finished.name(),TestPlanStatus.Completed.name())
&& res.getActualEndTime() == null) { && res.getActualEndTime() == null) {
testPlan.setActualEndTime(System.currentTimeMillis()); testPlan.setActualEndTime(System.currentTimeMillis());
} }
@ -256,7 +256,6 @@ public class TestPlanService {
extScheduleMapper.updateNameByResourceID(testPlan.getId(), testPlan.getName());// 同步更新该测试的定时任务的name extScheduleMapper.updateNameByResourceID(testPlan.getId(), testPlan.getName());// 同步更新该测试的定时任务的name
i = testPlanMapper.updateByPrimaryKeyWithBLOBs(testPlan); // 更新 i = testPlanMapper.updateByPrimaryKeyWithBLOBs(testPlan); // 更新
} }
return testPlanMapper.selectByPrimaryKey(testPlan.getId()); return testPlanMapper.selectByPrimaryKey(testPlan.getId());
} }

View File

@ -22,7 +22,7 @@
<div style="margin-bottom: 15px" v-if="flag"> <div style="margin-bottom: 15px" v-if="flag">
<el-checkbox v-model="checked">{{ $t('test_track.sync_add_api_load') }}</el-checkbox> <el-checkbox v-model="checked">{{ $t('test_track.sync_add_api_load') }}</el-checkbox>
</div> </div>
<ms-dialog-footer @cancel="close" @confirm="save"/> <ms-dialog-footer @cancel="close" v-loading="isSaving" @confirm="save"/>
</div> </div>
</template> </template>
@ -67,7 +67,13 @@
flag:{ flag:{
type:Boolean, type:Boolean,
}, },
width: String width: String,
isSaving:{
type:Boolean,
default() {
return false;
}
}
}, },
watch: { watch: {

View File

@ -5,6 +5,7 @@
@save="saveCaseRelevance" @save="saveCaseRelevance"
:plan-id="planId" :plan-id="planId"
:flag="true" :flag="true"
:is-saving="isSaving"
ref="baseRelevance"> ref="baseRelevance">
<template v-slot:aside> <template v-slot:aside>
@ -122,6 +123,7 @@ export default {
return { return {
openType: 'relevance', openType: 'relevance',
result: {}, result: {},
isSaving:false,
treeNodes: [], treeNodes: [],
selectNodeIds: [], selectNodeIds: [],
selectNodeNames: [], selectNodeNames: [],
@ -159,6 +161,7 @@ export default {
}, },
methods: { methods: {
open() { open() {
this.isSaving = false;
this.$refs.baseRelevance.open(); this.$refs.baseRelevance.open();
if (this.$refs.table) { if (this.$refs.table) {
this.$refs.table.clear(); this.$refs.table.clear();
@ -176,15 +179,19 @@ export default {
}) })
}, },
saveCaseRelevance(item) { saveCaseRelevance(item) {
this.isSaving = true;
let param = {}; let param = {};
param.planId = this.planId; param.planId = this.planId;
param.ids = this.$refs.table.selectIds; param.ids = this.$refs.table.selectIds;
param.request = this.page.condition; param.request = this.page.condition;
param.checked = item param.checked = item
this.result = this.$post('/test/plan/relevance', param, () => { this.result = this.$post('/test/plan/relevance', param, () => {
this.isSaving = false;
this.$success(this.$t('commons.save_success')); this.$success(this.$t('commons.save_success'));
this.$refs.baseRelevance.close(); this.$refs.baseRelevance.close();
this.$emit('refresh'); this.$emit('refresh');
},(error) => {
this.isSaving = false;
}); });
}, },
search() { search() {