diff --git a/frontend/src/business/components/track/case/TestCase.vue b/frontend/src/business/components/track/case/TestCase.vue
index e236795bb3..e3d0d23c15 100644
--- a/frontend/src/business/components/track/case/TestCase.vue
+++ b/frontend/src/business/components/track/case/TestCase.vue
@@ -166,7 +166,8 @@ export default {
type: '',
activeDom: 'left',
tmpActiveDom: null,
- total: 0
+ total: 0,
+ tmpPath: null
};
},
mounted() {
@@ -178,6 +179,14 @@ export default {
this.init(this.$route);
}
},
+ beforeRouteLeave(to, from, next) {
+ if (this.$store.state.isTestCaseMinderChanged) {
+ this.$refs.isChangeConfirm.open();
+ this.tmpPath = to.path;
+ } else {
+ next();
+ }
+ },
watch: {
redirectID() {
this.renderComponent = false;
diff --git a/frontend/src/business/components/track/case/components/TestCaseApiRelate.vue b/frontend/src/business/components/track/case/components/TestCaseApiRelate.vue
index 3a77b75372..1dd90eaa84 100644
--- a/frontend/src/business/components/track/case/components/TestCaseApiRelate.vue
+++ b/frontend/src/business/components/track/case/components/TestCaseApiRelate.vue
@@ -58,7 +58,9 @@ export default {
open() {
this.init();
this.$refs.baseRelevance.open();
- this.$refs.apiCaseList.clear();
+ if (this.$refs.apiCaseList) {
+ this.$refs.apiCaseList.clear();
+ }
},
init() {
if (this.$refs.apiCaseList) {
diff --git a/frontend/src/business/components/track/common/minder/minderUtils.js b/frontend/src/business/components/track/common/minder/minderUtils.js
index b2fb258e12..e71ab0b544 100644
--- a/frontend/src/business/components/track/common/minder/minderUtils.js
+++ b/frontend/src/business/components/track/common/minder/minderUtils.js
@@ -567,10 +567,18 @@ export function openMinderConfirm(vueObj, activeDom) {
export function saveMinderConfirm(vueObj, isSave) {
if (isSave) {
vueObj.$refs.minder.save(window.minder.exportJson());
- } else {
- vueObj.$store.commit('setIsTestCaseMinderChanged', false);
}
+ vueObj.$store.commit('setIsTestCaseMinderChanged', false);
vueObj.$nextTick(() => {
- vueObj.activeDom = vueObj.tmpActiveDom;
+ if (vueObj.tmpActiveDom) {
+ vueObj.activeDom = vueObj.tmpActiveDom;
+ vueObj.tmpActiveDom = null;
+ }
+ if (vueObj.tmpPath) {
+ vueObj.$router.push({
+ path: vueObj.tmpPath
+ });
+ vueObj.tmpPath = null;
+ }
});
}
diff --git a/frontend/src/business/components/track/plan/view/TestPlanView.vue b/frontend/src/business/components/track/plan/view/TestPlanView.vue
index 6a3dc17f1b..bb66c0f185 100644
--- a/frontend/src/business/components/track/plan/view/TestPlanView.vue
+++ b/frontend/src/business/components/track/plan/view/TestPlanView.vue
@@ -20,7 +20,7 @@
+ :clickType="clickType" :plan-id="planId" ref="testPlanFunctional"/>
{
if (this.$route.name === 'planView') {
diff --git a/frontend/src/business/components/track/plan/view/comonents/functional/FunctionalTestCaseList.vue b/frontend/src/business/components/track/plan/view/comonents/functional/FunctionalTestCaseList.vue
index 11177d73a4..747dca3085 100644
--- a/frontend/src/business/components/track/plan/view/comonents/functional/FunctionalTestCaseList.vue
+++ b/frontend/src/business/components/track/plan/view/comonents/functional/FunctionalTestCaseList.vue
@@ -450,7 +450,7 @@ export default {
this.testCaseTemplate = template;
this.fields = getTableHeaderWithCustomFields(this.tableHeaderKey, this.testCaseTemplate.customFields);
this.result.loading = false;
- this.$refs.table.reloadTable();
+ if (this.$refs.table) this.$refs.table.reloadTable();
});
},
getCustomFieldValue(row, field) {
diff --git a/frontend/src/business/components/track/plan/view/comonents/functional/TestPlanFunctional.vue b/frontend/src/business/components/track/plan/view/comonents/functional/TestPlanFunctional.vue
index f208e9de4b..60f062aedf 100644
--- a/frontend/src/business/components/track/plan/view/comonents/functional/TestPlanFunctional.vue
+++ b/frontend/src/business/components/track/plan/view/comonents/functional/TestPlanFunctional.vue
@@ -83,7 +83,8 @@ export default {
activeDom: 'left',
selectNode: {},
condition: {},
- tmpActiveDom: null
+ tmpActiveDom: null,
+ tmpPath: null
};
},
props: [
@@ -164,7 +165,16 @@ export default {
},
changeConfirm(isSave) {
saveMinderConfirm(this, isSave);
- }
+ },
+ handleBeforeRouteLeave(to) {
+ if (this.$store.state.isTestCaseMinderChanged) {
+ this.$refs.isChangeConfirm.open();
+ this.tmpPath = to.path;
+ return false;
+ } else {
+ return true;
+ }
+ },
}
};
diff --git a/frontend/src/business/components/track/review/view/TestCaseReviewView.vue b/frontend/src/business/components/track/review/view/TestCaseReviewView.vue
index 045c56b905..f89aba2c3a 100644
--- a/frontend/src/business/components/track/review/view/TestCaseReviewView.vue
+++ b/frontend/src/business/components/track/review/view/TestCaseReviewView.vue
@@ -17,7 +17,7 @@
+ :clickType="clickType" :review-id="reviewId" ref="testReviewFunction"/>
@@ -86,6 +86,13 @@ export default {
this.initData();
this.openTestCaseEdit(this.$route.path);
},
+ beforeRouteLeave(to, from, next) {
+ if (!this.$refs.testReviewFunction) {
+ next();
+ } else if (this.$refs.testReviewFunction.handleBeforeRouteLeave(to)) {
+ next();
+ }
+ },
watch: {
'$route'(to, from) {
this.openTestCaseEdit(to.path);
diff --git a/frontend/src/business/components/track/review/view/components/TestReviewFunction.vue b/frontend/src/business/components/track/review/view/components/TestReviewFunction.vue
index 284f6d0134..16e09ccab0 100644
--- a/frontend/src/business/components/track/review/view/components/TestReviewFunction.vue
+++ b/frontend/src/business/components/track/review/view/components/TestReviewFunction.vue
@@ -82,7 +82,8 @@ export default {
isMenuShow: true,
activeDom: 'left',
condition: {},
- tmpActiveDom: null
+ tmpActiveDom: null,
+ tmpPath: null
}
},
props: [
@@ -130,7 +131,16 @@ export default {
},
changeConfirm(isSave) {
saveMinderConfirm(this, isSave);
- }
+ },
+ handleBeforeRouteLeave(to) {
+ if (this.$store.state.isTestCaseMinderChanged) {
+ this.$refs.isChangeConfirm.open();
+ this.tmpPath = to.path;
+ return false;
+ } else {
+ return true;
+ }
+ },
}
}