fix(测试跟踪): 编辑脑图后不保存,切换工作空间页面无法加载

--bug=1010568 --user=陈建星 【测试跟踪】-功能用例 编辑脑图后不保存,切换工作空间 后 ,点击保存/取消 页面一直处于加载状态 https://www.tapd.cn/55049933/s/1166187
This commit is contained in:
chenjianxing 2022-05-27 15:09:07 +08:00 committed by jianxing
parent f1ad7c550b
commit 6923bac805
5 changed files with 49 additions and 16 deletions

View File

@ -4,7 +4,8 @@
width="20%"
:title="title"
:with-footer="false"
:close-on-click-modal="false">
:close-on-click-modal="false"
@close="handleClose">
{{tip}}
<template v-slot:footer>
<el-button type="primary" @click="save" @keydown.enter.native.prevent>{{$t('保存')}}</el-button>
@ -21,22 +22,28 @@ export default {
data() {
return {
visible: false,
data: {}
data: {
temWorkspaceId: null
}
}
},
props: ['title','tip', 'versionEnable'],
methods: {
open(item) {
open(item, temWorkspaceId) {
this.visible = true;
this.temWorkspaceId = temWorkspaceId ? temWorkspaceId : null;
this.data = item;
},
save() {
this.$emit('confirm', true);
this.$emit('confirm', true, this.temWorkspaceId);
this.visible = false;
},
cancel() {
this.$emit('confirm', false);
this.$emit('confirm', false, this.temWorkspaceId);
this.visible = false;
},
handleClose() {
this.$store.commit('setTemWorkspaceId', null);
}
}

View File

@ -40,8 +40,12 @@ import {PROJECT_ID, WORKSPACE_ID} from "@/common/js/constants";
export default {
name: "MsHeaderWs",
created() {
this.$EventBus.$on('changeWs', this._changeWs);
this.initMenuData();
},
destroyed() {
this.$EventBus.$off('changeWs', this._changeWs);
},
inject: [
'reloadTopMenus',
],
@ -98,15 +102,26 @@ export default {
if (!workspaceId || getCurrentWorkspaceId() === workspaceId) {
return false;
}
const loading = fullScreenLoading(this);
this.$post("/user/switch/source/ws/" + workspaceId, {}, response => {
saveLocalStorage(response);
sessionStorage.setItem(WORKSPACE_ID, workspaceId);
sessionStorage.setItem(PROJECT_ID, response.data.lastProjectId);
this.$router.push(this.getRedirectUrl(response.data)).then(() => {
this.reloadTopMenus(stopFullScreenLoading(loading));
}).catch(err => err);
});
let isTestCaseMinderChanged = this.$store.state.isTestCaseMinderChanged;
if (isTestCaseMinderChanged) {
//
this.$store.commit('setTemWorkspaceId', workspaceId);
return;
}
this._changeWs(workspaceId);
},
_changeWs(workspaceId) {
if (workspaceId) {
const loading = fullScreenLoading(this);
this.$post("/user/switch/source/ws/" + workspaceId, {}, response => {
saveLocalStorage(response);
sessionStorage.setItem(WORKSPACE_ID, workspaceId);
sessionStorage.setItem(PROJECT_ID, response.data.lastProjectId);
this.$router.push(this.getRedirectUrl(response.data)).then(() => {
this.reloadTopMenus(stopFullScreenLoading(loading));
}).catch(err => err);
});
}
},
query(queryString) {
this.workspaceList = queryString ? this.wsListCopy.filter(this.createFilter(queryString)) : this.wsListCopy;

View File

@ -309,6 +309,11 @@ export default {
} else {
this.activeName = 'default';
}
},
'$store.state.temWorkspaceId'() {
if (this.$store.state.temWorkspaceId) {
this.$refs.isChangeConfirm.open(null, this.$store.state.temWorkspaceId);
}
}
},
computed: {
@ -363,8 +368,12 @@ export default {
updateActiveDom(activeDom) {
openMinderConfirm(this, activeDom);
},
changeConfirm(isSave) {
changeConfirm(isSave, temWorkspaceId) {
saveMinderConfirm(this, isSave);
if (temWorkspaceId) {
//
this.$EventBus.$emit('changeWs', temWorkspaceId);
}
},
changeRedirectParam(redirectIDParam) {
this.redirectID = redirectIDParam;

View File

@ -47,7 +47,8 @@ const state = {
uiElementLibraryModuleIds: null,
uiElementLibraryElements: null,
refreshUiScenario: false,
showLicenseCountWarning: false
showLicenseCountWarning: false,
temWorkspaceId: null
}
const store = new Vuex.Store({

View File

@ -30,6 +30,7 @@ const mutations = {
setRefreshUiScenario: (state, value) => state.refreshUiScenario = value,
setSelectUiGroup: (state, value) => state.selectUiGroup = value,
setShowLicenseCountWarning: (state, value) => state.showLicenseCountWarning = value,
setTemWorkspaceId: (state, value) => state.temWorkspaceId = value,
}
export default mutations;