fix(测试计划): 修复编辑测试计划后页面重复刷新的问题

This commit is contained in:
CaptainB 2022-06-01 12:06:09 +08:00 committed by f2c-ci-robot[bot]
parent a8f6596e7a
commit 9e0472831b
1 changed files with 36 additions and 48 deletions

View File

@ -3,7 +3,6 @@
<ms-main-container>
<test-plan-list
v-if="renderComponent"
@openTestPlanEditDialog="openTestPlanEditDialog"
@testPlanEdit="openTestPlanEditDialog"
ref="testPlanList"/>
@ -17,61 +16,50 @@
<script>
import TestPlanList from './components/TestPlanList';
import TestPlanEdit from './components/TestPlanEdit';
import MsContainer from "../../common/components/MsContainer";
import MsMainContainer from "../../common/components/MsMainContainer";
import {getCurrentProjectID} from "@/common/js/utils";
import TestPlanList from './components/TestPlanList';
import TestPlanEdit from './components/TestPlanEdit';
import MsContainer from "../../common/components/MsContainer";
import MsMainContainer from "../../common/components/MsMainContainer";
import {getCurrentProjectID} from "@/common/js/utils";
export default {
name: "TestPlan",
components: {MsMainContainer, MsContainer, TestPlanList, TestPlanEdit},
data() {
return {
renderComponent:true
}
export default {
name: "TestPlan",
components: {MsMainContainer, MsContainer, TestPlanList, TestPlanEdit},
data() {
return {};
},
computed: {
projectId() {
return getCurrentProjectID();
},
computed: {
projectId() {
return getCurrentProjectID();
},
},
mounted() {
if (this.$route.path.indexOf("/track/plan/create") >= 0){
},
mounted() {
if (this.$route.path.indexOf("/track/plan/create") >= 0) {
this.openTestPlanEditDialog();
this.$router.push('/track/plan/all');
}
},
watch: {
'$route'(to, from) {
if (to.path.indexOf("/track/plan/create") >= 0) {
if (!this.projectId) {
this.$warning(this.$t('commons.check_project_tip'));
return;
}
this.openTestPlanEditDialog();
this.$router.push('/track/plan/all');
}
}
},
methods: {
openTestPlanEditDialog(data) {
this.$refs.testPlanEditDialog.openTestPlanEditDialog(data);
},
watch: {
'$route'(to, from) {
if (to.path.indexOf("/track/plan/create") >= 0){
if (!this.projectId) {
this.$warning(this.$t('commons.check_project_tip'));
return;
}
this.openTestPlanEditDialog();
this.$router.push('/track/plan/all');
}
}
},
methods: {
openTestPlanEditDialog(data) {
this.$refs.testPlanEditDialog.openTestPlanEditDialog(data);
},
refreshTestPlanList() {
// Remove my-component from the DOM
this.renderComponent = false;
this.$nextTick(() => {
// Add the component back in
this.renderComponent = true;
});
this.$refs.testPlanList.condition = {};
this.$refs.testPlanList.initTableData();
}
refreshTestPlanList() {
this.$refs.testPlanList.initTableData();
}
}
};
</script>
<style scoped>