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.$router.push("/");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.rewriteProjectRouteParam();
|
||||||
this.reload();
|
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) {
|
change(projectId) {
|
||||||
let currentProjectId = getCurrentProjectID();
|
let currentProjectId = getCurrentProjectID();
|
||||||
if (projectId === currentProjectId) {
|
if (projectId === currentProjectId) {
|
||||||
|
|
|
@ -305,6 +305,9 @@ export default {
|
||||||
let pNodes = [];
|
let pNodes = [];
|
||||||
this.getChildNodeId(node.data, nodeIds);
|
this.getChildNodeId(node.data, nodeIds);
|
||||||
this.getParentNodes(node, pNodes);
|
this.getParentNodes(node, pNodes);
|
||||||
|
pNodes.forEach(item => {
|
||||||
|
this.nodeExpand(item);
|
||||||
|
});
|
||||||
this.$emit("nodeSelectEvent", node, nodeIds, pNodes);
|
this.$emit("nodeSelectEvent", node, nodeIds, pNodes);
|
||||||
},
|
},
|
||||||
filterNode(value, data) {
|
filterNode(value, data) {
|
||||||
|
@ -344,6 +347,9 @@ export default {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
getNode(key) {
|
||||||
|
return this.$refs.tree.getNode(key);
|
||||||
|
},
|
||||||
// 改变节点的状态
|
// 改变节点的状态
|
||||||
changeTreeNodeStatus(parentData) {
|
changeTreeNodeStatus(parentData) {
|
||||||
for (let i = 0; i < parentData.children.length; i++) {
|
for (let i = 0; i < parentData.children.length; i++) {
|
||||||
|
|
|
@ -271,8 +271,8 @@ import {
|
||||||
initCondition, parseCustomFilesForList,
|
initCondition, parseCustomFilesForList,
|
||||||
} from "metersphere-frontend/src/utils/tableUtils";
|
} from "metersphere-frontend/src/utils/tableUtils";
|
||||||
import PlanStatusTableItem from "@/business/common/tableItems/plan/PlanStatusTableItem";
|
import PlanStatusTableItem from "@/business/common/tableItems/plan/PlanStatusTableItem";
|
||||||
import {getCurrentProjectID, getCurrentWorkspaceId} from "metersphere-frontend/src/utils/token";
|
import {getCurrentProjectID, getCurrentWorkspaceId, setCurrentProjectID} from "metersphere-frontend/src/utils/token";
|
||||||
import {getUUID, operationConfirm, parseTag} from "metersphere-frontend/src/utils"
|
import {parseTag} from "metersphere-frontend/src/utils"
|
||||||
import {hasLicense} from "metersphere-frontend/src/utils/permission"
|
import {hasLicense} from "metersphere-frontend/src/utils/permission"
|
||||||
import {getTestTemplate} from "@/api/custom-field-template";
|
import {getTestTemplate} from "@/api/custom-field-template";
|
||||||
import {getProjectMember, getProjectMemberUserFilter} from "@/api/user";
|
import {getProjectMember, getProjectMemberUserFilter} from "@/api/user";
|
||||||
|
@ -482,7 +482,8 @@ export default {
|
||||||
advanceSearchShow: false,
|
advanceSearchShow: false,
|
||||||
selectCounts: 0,
|
selectCounts: 0,
|
||||||
refreshBySearch: false,
|
refreshBySearch: false,
|
||||||
enableVersionColumn: false
|
enableVersionColumn: false,
|
||||||
|
projectId: ''
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
|
@ -499,8 +500,8 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
projectId() {
|
routeProjectId() {
|
||||||
return getCurrentProjectID();
|
return this.$route.query.projectId;
|
||||||
},
|
},
|
||||||
systemFiledMap() {
|
systemFiledMap() {
|
||||||
return SYSTEM_FIELD_NAME_MAP;
|
return SYSTEM_FIELD_NAME_MAP;
|
||||||
|
@ -516,6 +517,8 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
created: function () {
|
created: function () {
|
||||||
|
this.checkCurrentProject();
|
||||||
|
|
||||||
getProjectMemberUserFilter((data) => {
|
getProjectMemberUserFilter((data) => {
|
||||||
this.userFilter = 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) {
|
getTagToolTips(tags) {
|
||||||
return getTagToolTips(tags);
|
return getTagToolTips(tags);
|
||||||
},
|
},
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
<el-menu-item :index="'/track/home'" v-permission="['PROJECT_TRACK_HOME:READ']">
|
<el-menu-item :index="'/track/home'" v-permission="['PROJECT_TRACK_HOME:READ']">
|
||||||
{{ $t("i18n.home") }}
|
{{ $t("i18n.home") }}
|
||||||
</el-menu-item>
|
</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") }}
|
{{ $t("test_track.case.test_case") }}
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
|
|
||||||
|
@ -57,33 +57,6 @@ export default {
|
||||||
testCaseProjectPath: '',
|
testCaseProjectPath: '',
|
||||||
isProjectActivation: true,
|
isProjectActivation: true,
|
||||||
currentProject: sessionStorage.getItem(PROJECT_NAME),
|
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: '',
|
pathName: '',
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
@ -91,12 +64,12 @@ export default {
|
||||||
'$route': {
|
'$route': {
|
||||||
immediate: true,
|
immediate: true,
|
||||||
handler(to, from) {
|
handler(to, from) {
|
||||||
if (to.params && to.params.reviewId) {
|
if (to.path.indexOf("/track/review") >= 0) {
|
||||||
this.pathName = '/track/review/all';
|
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';
|
this.pathName = '/track/plan/all';
|
||||||
} if (to.path.indexOf("/track/case") >= 0) {
|
} if (to.path.indexOf("/track/case") >= 0) {
|
||||||
this.pathName = '/track/case/all';
|
this.pathName = this.caseListPath;
|
||||||
} else {
|
} else {
|
||||||
this.pathName = to.path;
|
this.pathName = to.path;
|
||||||
}
|
}
|
||||||
|
@ -107,6 +80,11 @@ export default {
|
||||||
mounted() {
|
mounted() {
|
||||||
this.init();
|
this.init();
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
caseListPath() {
|
||||||
|
return '/track/case/all?projectId=' + this.getProjectId();
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
reload() {
|
reload() {
|
||||||
this.isRouterAlive = false;
|
this.isRouterAlive = false;
|
||||||
|
@ -129,9 +107,9 @@ export default {
|
||||||
this.reload();
|
this.reload();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
getProjectId() {
|
||||||
},
|
return getCurrentProjectID();
|
||||||
beforeDestroy() {
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -159,13 +137,6 @@ export default {
|
||||||
border-bottom: white !important;
|
border-bottom: white !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*.project-change {*/
|
|
||||||
/* height: 40px;*/
|
|
||||||
/* line-height: 40px;*/
|
|
||||||
/* color: inherit;*/
|
|
||||||
/* margin-left: 20px;*/
|
|
||||||
/*}*/
|
|
||||||
|
|
||||||
.el-menu-item {
|
.el-menu-item {
|
||||||
padding: 0 10px;
|
padding: 0 10px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,7 +146,7 @@ export default {
|
||||||
mounted() {
|
mounted() {
|
||||||
let store = useStore();
|
let store = useStore();
|
||||||
store.testCaseSelectNode = {};
|
store.testCaseSelectNode = {};
|
||||||
store.setTestCaseSelectNodeIds = [];
|
store.testCaseSelectNodeIds = [];
|
||||||
this.list();
|
this.list();
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -215,7 +215,12 @@ export default {
|
||||||
let isCurrentNodeEqualsRouteModule = this.currentNode && this.currentNode.data && this.currentNode.data.id === this.routeModuleId;
|
let isCurrentNodeEqualsRouteModule = this.currentNode && this.currentNode.data && this.currentNode.data.id === this.routeModuleId;
|
||||||
if (this.routeModuleId && !isCurrentNodeEqualsRouteModule) {
|
if (this.routeModuleId && !isCurrentNodeEqualsRouteModule) {
|
||||||
if (this.$refs.nodeTree) {
|
if (this.$refs.nodeTree) {
|
||||||
this.$refs.nodeTree.setCurrentKeyById(this.routeModuleId);
|
this.$nextTick(() => {
|
||||||
|
if (this.$refs.nodeTree.getNode(this.routeModuleId)) {
|
||||||
|
// 如果项目有此模块,则设置 moduleId
|
||||||
|
this.$refs.nodeTree.setCurrentKeyById(this.routeModuleId);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.setCurrentKey();
|
this.setCurrentKey();
|
||||||
|
|
Loading…
Reference in New Issue