fix(测试跟踪): 功能用例列表,URL添加项目ID参数
--bug=1024038 --user=陈建星 功能测试用例列表查询URL优化 https://www.tapd.cn/55049933/s/1348234
This commit is contained in:
parent
ef1b674159
commit
2effdb1a0c
|
@ -136,8 +136,24 @@ export default {
|
|||
this.$router.push("/");
|
||||
}
|
||||
}
|
||||
|
||||
this.rewriteProjectRouteParam();
|
||||
this.reload();
|
||||
},
|
||||
rewriteProjectRouteParam() {
|
||||
if (this.$route.query.projectId && merge) {
|
||||
let query = {};
|
||||
Object.assign(query, this.$route.query);
|
||||
|
||||
// 切换项目的时候如果有项目 ID 参数,修改为切换后的项目 ID,模块参数置空
|
||||
query.projectId = getCurrentProjectID();
|
||||
delete query.moduleId;
|
||||
|
||||
this.$router.push({
|
||||
query: Object.assign(query)
|
||||
});
|
||||
}
|
||||
},
|
||||
change(projectId) {
|
||||
let currentProjectId = getCurrentProjectID();
|
||||
if (projectId === currentProjectId) {
|
||||
|
|
|
@ -305,6 +305,9 @@ export default {
|
|||
let pNodes = [];
|
||||
this.getChildNodeId(node.data, nodeIds);
|
||||
this.getParentNodes(node, pNodes);
|
||||
pNodes.forEach(item => {
|
||||
this.nodeExpand(item);
|
||||
});
|
||||
this.$emit("nodeSelectEvent", node, nodeIds, pNodes);
|
||||
},
|
||||
filterNode(value, data) {
|
||||
|
@ -344,6 +347,9 @@ export default {
|
|||
}
|
||||
});
|
||||
},
|
||||
getNode(key) {
|
||||
return this.$refs.tree.getNode(key);
|
||||
},
|
||||
// 改变节点的状态
|
||||
changeTreeNodeStatus(parentData) {
|
||||
for (let i = 0; i < parentData.children.length; i++) {
|
||||
|
|
|
@ -271,8 +271,8 @@ import {
|
|||
initCondition, parseCustomFilesForList,
|
||||
} from "metersphere-frontend/src/utils/tableUtils";
|
||||
import PlanStatusTableItem from "@/business/common/tableItems/plan/PlanStatusTableItem";
|
||||
import {getCurrentProjectID, getCurrentWorkspaceId} from "metersphere-frontend/src/utils/token";
|
||||
import {getUUID, operationConfirm, parseTag} from "metersphere-frontend/src/utils"
|
||||
import {getCurrentProjectID, getCurrentWorkspaceId, setCurrentProjectID} from "metersphere-frontend/src/utils/token";
|
||||
import {parseTag} from "metersphere-frontend/src/utils"
|
||||
import {hasLicense} from "metersphere-frontend/src/utils/permission"
|
||||
import {getTestTemplate} from "@/api/custom-field-template";
|
||||
import {getProjectMember, getProjectMemberUserFilter} from "@/api/user";
|
||||
|
@ -482,7 +482,8 @@ export default {
|
|||
advanceSearchShow: false,
|
||||
selectCounts: 0,
|
||||
refreshBySearch: false,
|
||||
enableVersionColumn: false
|
||||
enableVersionColumn: false,
|
||||
projectId: ''
|
||||
};
|
||||
},
|
||||
props: {
|
||||
|
@ -499,8 +500,8 @@ export default {
|
|||
}
|
||||
},
|
||||
computed: {
|
||||
projectId() {
|
||||
return getCurrentProjectID();
|
||||
routeProjectId() {
|
||||
return this.$route.query.projectId;
|
||||
},
|
||||
systemFiledMap() {
|
||||
return SYSTEM_FIELD_NAME_MAP;
|
||||
|
@ -516,6 +517,8 @@ export default {
|
|||
})
|
||||
},
|
||||
created: function () {
|
||||
this.checkCurrentProject();
|
||||
|
||||
getProjectMemberUserFilter((data) => {
|
||||
this.userFilter = data;
|
||||
});
|
||||
|
@ -631,6 +634,22 @@ export default {
|
|||
});
|
||||
});
|
||||
},
|
||||
checkCurrentProject() {
|
||||
// 带了 routeProjectId 校验是否是当前项目
|
||||
if (this.routeProjectId) {
|
||||
if (getCurrentProjectID() !== this.routeProjectId) {
|
||||
setCurrentProjectID(this.routeProjectId);
|
||||
location.reload();
|
||||
return;
|
||||
} else {
|
||||
// 切换项目,url会重写为新的项目ID,也走这里
|
||||
this.projectId = this.routeProjectId;
|
||||
}
|
||||
} else {
|
||||
// 没带 routeProjectId 则使用当前项目
|
||||
this.projectId = getCurrentProjectID();
|
||||
}
|
||||
},
|
||||
getTagToolTips(tags) {
|
||||
return getTagToolTips(tags);
|
||||
},
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<el-menu-item :index="'/track/home'" v-permission="['PROJECT_TRACK_HOME:READ']">
|
||||
{{ $t("i18n.home") }}
|
||||
</el-menu-item>
|
||||
<el-menu-item :index="'/track/case/all'" v-permission="['PROJECT_TRACK_CASE:READ']">
|
||||
<el-menu-item :index="caseListPath" v-permission="['PROJECT_TRACK_CASE:READ']">
|
||||
{{ $t("test_track.case.test_case") }}
|
||||
</el-menu-item>
|
||||
|
||||
|
@ -57,33 +57,6 @@ export default {
|
|||
testCaseProjectPath: '',
|
||||
isProjectActivation: true,
|
||||
currentProject: sessionStorage.getItem(PROJECT_NAME),
|
||||
caseRecent: {
|
||||
title: this.$t('test_track.recent_case'),
|
||||
url: "/test/case/recent/5",
|
||||
index: function (item) {
|
||||
return '/track/case/edit/' + item.id;
|
||||
},
|
||||
router: function (item) {
|
||||
}
|
||||
},
|
||||
reviewRecent: {
|
||||
title: this.$t('test_track.recent_review'),
|
||||
url: "/test/case/review/recent/5",
|
||||
index: function (item) {
|
||||
return '/track/review/view/' + item.id;
|
||||
},
|
||||
router: function (item) {
|
||||
}
|
||||
},
|
||||
planRecent: {
|
||||
title: this.$t('test_track.recent_plan'),
|
||||
url: getCurrentProjectID() === '' ? "/test/plan/recent/5/" + undefined : "/test/plan/recent/5/" + getCurrentProjectID(),
|
||||
index: function (item) {
|
||||
return '/track/plan/view/' + item.id;
|
||||
},
|
||||
router: function (item) {
|
||||
}
|
||||
},
|
||||
pathName: '',
|
||||
};
|
||||
},
|
||||
|
@ -91,12 +64,12 @@ export default {
|
|||
'$route': {
|
||||
immediate: true,
|
||||
handler(to, from) {
|
||||
if (to.params && to.params.reviewId) {
|
||||
if (to.path.indexOf("/track/review") >= 0) {
|
||||
this.pathName = '/track/review/all';
|
||||
} else if (to.params && to.params.planId) {
|
||||
} else if (to.path.indexOf("/track/plan") >= 0) {
|
||||
this.pathName = '/track/plan/all';
|
||||
} if (to.path.indexOf("/track/case") >= 0) {
|
||||
this.pathName = '/track/case/all';
|
||||
this.pathName = this.caseListPath;
|
||||
} else {
|
||||
this.pathName = to.path;
|
||||
}
|
||||
|
@ -107,6 +80,11 @@ export default {
|
|||
mounted() {
|
||||
this.init();
|
||||
},
|
||||
computed: {
|
||||
caseListPath() {
|
||||
return '/track/case/all?projectId=' + this.getProjectId();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
reload() {
|
||||
this.isRouterAlive = false;
|
||||
|
@ -129,9 +107,9 @@ export default {
|
|||
this.reload();
|
||||
}
|
||||
},
|
||||
|
||||
},
|
||||
beforeDestroy() {
|
||||
getProjectId() {
|
||||
return getCurrentProjectID();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -159,13 +137,6 @@ export default {
|
|||
border-bottom: white !important;
|
||||
}
|
||||
|
||||
/*.project-change {*/
|
||||
/* height: 40px;*/
|
||||
/* line-height: 40px;*/
|
||||
/* color: inherit;*/
|
||||
/* margin-left: 20px;*/
|
||||
/*}*/
|
||||
|
||||
.el-menu-item {
|
||||
padding: 0 10px;
|
||||
}
|
||||
|
|
|
@ -146,7 +146,7 @@ export default {
|
|||
mounted() {
|
||||
let store = useStore();
|
||||
store.testCaseSelectNode = {};
|
||||
store.setTestCaseSelectNodeIds = [];
|
||||
store.testCaseSelectNodeIds = [];
|
||||
this.list();
|
||||
},
|
||||
computed: {
|
||||
|
@ -215,8 +215,13 @@ export default {
|
|||
let isCurrentNodeEqualsRouteModule = this.currentNode && this.currentNode.data && this.currentNode.data.id === this.routeModuleId;
|
||||
if (this.routeModuleId && !isCurrentNodeEqualsRouteModule) {
|
||||
if (this.$refs.nodeTree) {
|
||||
this.$nextTick(() => {
|
||||
if (this.$refs.nodeTree.getNode(this.routeModuleId)) {
|
||||
// 如果项目有此模块,则设置 moduleId
|
||||
this.$refs.nodeTree.setCurrentKeyById(this.routeModuleId);
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.setCurrentKey();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue