fix: 测试计划用例提示保存脑图

--bug=1008131 --user=陈建星 【github#7831】进入【测试跟踪】-【测试计划】,标记用例执行结果,点击其他窗口,未提示保存,导致用例执行结果记录丢失。 https://www.tapd.cn/55049933/s/10781699
This commit is contained in:
chenjianxing 2021-12-06 18:03:31 +08:00 committed by jianxing
parent de99c2bb86
commit 70c7ad22fd
1 changed files with 28 additions and 1 deletions

View File

@ -27,6 +27,12 @@
:plan-id="planId"/> :plan-id="planId"/>
<test-plan-report-content v-if="activeIndex === 'report'" :plan-id="planId"/> <test-plan-report-content v-if="activeIndex === 'report'" :plan-id="planId"/>
<is-change-confirm
:title="'请保存脑图'"
:tip="'脑图未保存,确认保存脑图吗?'"
@confirm="changeConfirm"
ref="isChangeConfirm"/>
</div> </div>
</template> </template>
@ -45,10 +51,12 @@ import TestPlanApi from "./comonents/api/TestPlanApi";
import TestPlanLoad from "@/business/components/track/plan/view/comonents/load/TestPlanLoad"; import TestPlanLoad from "@/business/components/track/plan/view/comonents/load/TestPlanLoad";
import {getCurrentProjectID} from "@/common/js/utils"; import {getCurrentProjectID} from "@/common/js/utils";
import TestPlanReportContent from "@/business/components/track/plan/view/comonents/report/detail/TestPlanReportContent"; import TestPlanReportContent from "@/business/components/track/plan/view/comonents/report/detail/TestPlanReportContent";
import IsChangeConfirm from "@/business/components/common/components/IsChangeConfirm";
export default { export default {
name: "TestPlanView", name: "TestPlanView",
components: { components: {
IsChangeConfirm,
TestPlanReportContent, TestPlanReportContent,
TestPlanApi, TestPlanApi,
TestPlanFunctional, TestPlanFunctional,
@ -66,6 +74,7 @@ export default {
redirectCharType: '', redirectCharType: '',
//- //-
clickType: '', clickType: '',
tmpActiveIndex: ''
}; };
}, },
computed: { computed: {
@ -80,7 +89,7 @@ export default {
'$route.params.planId'() { '$route.params.planId'() {
this.genRedirectParam(); this.genRedirectParam();
this.getTestPlans(); this.getTestPlans();
} },
}, },
beforeRouteLeave(to, from, next) { beforeRouteLeave(to, from, next) {
if (!this.$refs.testPlanFunctional) { if (!this.$refs.testPlanFunctional) {
@ -131,8 +140,26 @@ export default {
this.$router.push('/track/plan/view/' + plan.id); this.$router.push('/track/plan/view/' + plan.id);
}, },
handleSelect(key) { handleSelect(key) {
let isTestCaseMinderChanged = this.$store.state.isTestCaseMinderChanged;
if (key !== 'functional' && isTestCaseMinderChanged) {
this.$refs.isChangeConfirm.open();
this.tmpActiveIndex = key;
return;
}
this.activeIndex = key; this.activeIndex = key;
}, },
changeConfirm(isSave) {
if (isSave) {
this.$refs.testPlanFunctional.$refs.minder.save(window.minder.exportJson());
}
this.$store.commit('setIsTestCaseMinderChanged', false);
this.$nextTick(() => {
if (this.tmpActiveIndex) {
this.activeIndex = this.tmpActiveIndex;
this.tmpActiveIndex = null;
}
});
},
reloadMenu() { reloadMenu() {
this.isMenuShow = false; this.isMenuShow = false;
this.$nextTick(() => { this.$nextTick(() => {