fix(测试跟踪): 功能用例编辑页跳转优化
--bug=1023154 --user=陈建星 【测试跟踪】功能用例-编辑页面-修改用例等级和版本后未更新 https://www.tapd.cn/55049933/s/1337368
This commit is contained in:
parent
8cc1080453
commit
4f954a1f84
|
@ -174,6 +174,11 @@ public class TestCaseController {
|
||||||
return testCaseService.getTestCaseStep(testCaseId);
|
return testCaseService.getTestCaseStep(testCaseId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get/simple/{testCaseId}")
|
||||||
|
public TestCaseWithBLOBs getSimpleCase(@PathVariable String testCaseId) {
|
||||||
|
return testCaseService.getSimpleCase(testCaseId);
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/project/{testCaseId}")
|
@GetMapping("/project/{testCaseId}")
|
||||||
public Project getProjectByTestCaseId(@PathVariable String testCaseId) {
|
public Project getProjectByTestCaseId(@PathVariable String testCaseId) {
|
||||||
trackCheckPermissionService.checkTestCaseOwner(testCaseId);
|
trackCheckPermissionService.checkTestCaseOwner(testCaseId);
|
||||||
|
|
|
@ -3150,4 +3150,8 @@ public class TestCaseService {
|
||||||
return new ArrayList<>(0);
|
return new ArrayList<>(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TestCaseWithBLOBs getSimpleCase(String testCaseId) {
|
||||||
|
return testCaseMapper.selectByPrimaryKey(testCaseId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,10 @@ export function getTestCase(id) {
|
||||||
return get(BASE_URL + `get/${id}`);
|
return get(BASE_URL + `get/${id}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getSimpleTestCase(id) {
|
||||||
|
return get(BASE_URL + `get/simple/${id}`);
|
||||||
|
}
|
||||||
|
|
||||||
export function getTestCaseByVersionId(refId, versionId) {
|
export function getTestCaseByVersionId(refId, versionId) {
|
||||||
return get(BASE_URL + `get/version/${refId}/${versionId}`);
|
return get(BASE_URL + `get/version/${refId}/${versionId}`);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<ms-container v-if="renderComponent" v-loading="loading">
|
<ms-container v-if="renderComponent" v-loading="loading">
|
||||||
<!-- operate-button -->
|
<!-- operate-button -->
|
||||||
<div class="top-btn-group-layout" v-if="!showPublicNode && !showTrashNode && !editable" style="margin-bottom: 16px">
|
<div class="top-btn-group-layout" v-if="!showPublicNode && !showTrashNode" style="margin-bottom: 16px">
|
||||||
<el-button size="small" v-permission="['PROJECT_TRACK_CASE:READ+BATCH_EDIT']" @click="handleCreateCase" type="primary">
|
<el-button size="small" v-permission="['PROJECT_TRACK_CASE:READ+BATCH_EDIT']" @click="handleCreateCase" type="primary">
|
||||||
<svg-icon icon-class="icon_add_outlined_white"/>
|
<svg-icon icon-class="icon_add_outlined_white"/>
|
||||||
{{$t('test_track.case.create_case')}}
|
{{$t('test_track.case.create_case')}}
|
||||||
|
@ -46,7 +46,7 @@
|
||||||
<span class="back-content">{{showPublicNode? $t('project.case_public') : $t('commons.trash')}}</span>
|
<span class="back-content">{{showPublicNode? $t('project.case_public') : $t('commons.trash')}}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style="display: flex; height: calc(100vh - 130px)" v-if="!editable" class = "test-case-aside-layout">
|
<div style="display: flex; height: calc(100vh - 130px)" class = "test-case-aside-layout">
|
||||||
<!-- case-aside-container -->
|
<!-- case-aside-container -->
|
||||||
<ms-aside-container v-show="isAsideHidden" :min-width="'0'" :enable-aside-hidden.sync="enableAsideHidden">
|
<ms-aside-container v-show="isAsideHidden" :min-width="'0'" :enable-aside-hidden.sync="enableAsideHidden">
|
||||||
<test-case-node-tree
|
<test-case-node-tree
|
||||||
|
@ -161,7 +161,6 @@
|
||||||
:trash-enable="true"
|
:trash-enable="true"
|
||||||
:current-version="currentTrashVersion"
|
:current-version="currentTrashVersion"
|
||||||
:version-enable="versionEnable"
|
:version-enable="versionEnable"
|
||||||
@testCaseCopy="copyTestCase"
|
|
||||||
@refresh="refreshTrashNode"
|
@refresh="refreshTrashNode"
|
||||||
@refreshAll="refreshAll"
|
@refreshAll="refreshAll"
|
||||||
@setCondition="setTrashCondition"
|
@setCondition="setTrashCondition"
|
||||||
|
@ -171,29 +170,6 @@
|
||||||
</el-card>
|
</el-card>
|
||||||
</ms-main-container>
|
</ms-main-container>
|
||||||
</div>
|
</div>
|
||||||
<!-- since v2.6 创建用例流程变更 -->
|
|
||||||
<ms-container v-if="editable" class = "edit-layout">
|
|
||||||
<div v-for="item in tabs" :key="item.name">
|
|
||||||
<test-case-edit
|
|
||||||
:currentTestCaseInfo="item.testCaseInfo"
|
|
||||||
:version-enable="versionEnable"
|
|
||||||
@refresh="refreshAll"
|
|
||||||
@checkout="checkout($event, item)"
|
|
||||||
:is-public="item.isPublic"
|
|
||||||
:read-only="testCaseReadOnly"
|
|
||||||
:tree-nodes="treeNodes"
|
|
||||||
:select-node="selectNode"
|
|
||||||
:select-condition="item.isPublic ? publicCondition : condition"
|
|
||||||
:public-enable="item.isPublic"
|
|
||||||
:case-type="type"
|
|
||||||
@addTab="addTab"
|
|
||||||
@closeTab="closeTab"
|
|
||||||
:editable="item.edit"
|
|
||||||
ref="testCaseEdit"
|
|
||||||
>
|
|
||||||
</test-case-edit>
|
|
||||||
</div>
|
|
||||||
</ms-container>
|
|
||||||
|
|
||||||
<!-- dialog -->
|
<!-- dialog -->
|
||||||
<!-- export case -->
|
<!-- export case -->
|
||||||
|
@ -206,7 +182,6 @@
|
||||||
<script>
|
<script>
|
||||||
import TestCaseExportToExcel from "@/business/case/components/export/TestCaseExportToExcel";
|
import TestCaseExportToExcel from "@/business/case/components/export/TestCaseExportToExcel";
|
||||||
import TestCaseCommonImportNew from "@/business/case/components/import/TestCaseCommonImportNew";
|
import TestCaseCommonImportNew from "@/business/case/components/import/TestCaseCommonImportNew";
|
||||||
import TestCaseEdit from "./components/TestCaseEdit";
|
|
||||||
import TestCaseList from "./components/TestCaseList";
|
import TestCaseList from "./components/TestCaseList";
|
||||||
import SelectMenu from "../common/SelectMenu";
|
import SelectMenu from "../common/SelectMenu";
|
||||||
import MsContainer from "metersphere-frontend/src/components/new-ui/MsContainer";
|
import MsContainer from "metersphere-frontend/src/components/new-ui/MsContainer";
|
||||||
|
@ -215,7 +190,6 @@ import MsMainContainer from "metersphere-frontend/src/components/new-ui/MsMainCo
|
||||||
import MsMainButtonGroup from "metersphere-frontend/src/components/new-ui/MsMainButtonGroup";
|
import MsMainButtonGroup from "metersphere-frontend/src/components/new-ui/MsMainButtonGroup";
|
||||||
import {getCurrentProjectID, getCurrentWorkspaceId} from "metersphere-frontend/src/utils/token";
|
import {getCurrentProjectID, getCurrentWorkspaceId} from "metersphere-frontend/src/utils/token";
|
||||||
import {hasLicense, hasPermission} from "metersphere-frontend/src/utils/permission";
|
import {hasLicense, hasPermission} from "metersphere-frontend/src/utils/permission";
|
||||||
import {getUUID} from "metersphere-frontend/src/utils";
|
|
||||||
import TestCaseNodeTree from "@/business/module/TestCaseNodeTree";
|
import TestCaseNodeTree from "@/business/module/TestCaseNodeTree";
|
||||||
import MsTabButton from "metersphere-frontend/src/components/new-ui/MsTabButton";
|
import MsTabButton from "metersphere-frontend/src/components/new-ui/MsTabButton";
|
||||||
import TestCaseMinder from "../common/minder/TestCaseMinder";
|
import TestCaseMinder from "../common/minder/TestCaseMinder";
|
||||||
|
@ -226,20 +200,19 @@ import {PROJECT_ID} from "metersphere-frontend/src/utils/constants";
|
||||||
import MxVersionSelect from "metersphere-frontend/src/components/version/MxVersionSelect";
|
import MxVersionSelect from "metersphere-frontend/src/components/version/MxVersionSelect";
|
||||||
import {useStore} from "@/store";
|
import {useStore} from "@/store";
|
||||||
import {testCaseNodePublicCount, testCaseNodeTrashCount} from "@/api/test-case-node";
|
import {testCaseNodePublicCount, testCaseNodeTrashCount} from "@/api/test-case-node";
|
||||||
import {getTestCase} from "@/api/testCase";
|
|
||||||
import {getProjectApplicationConfig} from "@/api/project-application";
|
import {getProjectApplicationConfig} from "@/api/project-application";
|
||||||
import {versionEnableByProjectId} from "@/api/project";
|
import {versionEnableByProjectId} from "@/api/project";
|
||||||
import TestCasePublicNodeTree from "@/business/module/TestCasePublicNodeTree";
|
import TestCasePublicNodeTree from "@/business/module/TestCasePublicNodeTree";
|
||||||
import TestCaseTrashNodeTree from "@/business/module/TestCaseTrashNodeTree";
|
import TestCaseTrashNodeTree from "@/business/module/TestCaseTrashNodeTree";
|
||||||
import PublicTestCaseList from "@/business/case/components/public/PublicTestCaseList";
|
import PublicTestCaseList from "@/business/case/components/public/PublicTestCaseList";
|
||||||
import {openCaseCreate, openCaseEdit} from "@/business/case/test-case";
|
import {openCaseCreate} from "@/business/case/test-case";
|
||||||
|
|
||||||
const store = useStore();
|
const store = useStore();
|
||||||
export default {
|
export default {
|
||||||
name: "TestCase",
|
name: "TestCase",
|
||||||
components: {
|
components: {
|
||||||
PublicTestCaseList, TestCaseTrashNodeTree, TestCasePublicNodeTree, IsChangeConfirm, TestCaseMinder, MsTabButton, TestCaseNodeTree,
|
PublicTestCaseList, TestCaseTrashNodeTree, TestCasePublicNodeTree, IsChangeConfirm, TestCaseMinder, MsTabButton, TestCaseNodeTree,
|
||||||
MsMainContainer, MsAsideContainer, MsContainer, TestCaseList, TestCaseEdit, SelectMenu, TestCaseEditShow, 'VersionSelect': MxVersionSelect,
|
MsMainContainer, MsAsideContainer, MsContainer, TestCaseList, SelectMenu, TestCaseEditShow, 'VersionSelect': MxVersionSelect,
|
||||||
MsMainButtonGroup, TestCaseExportToExcel, TestCaseCommonImportNew
|
MsMainButtonGroup, TestCaseExportToExcel, TestCaseCommonImportNew
|
||||||
},
|
},
|
||||||
comments: {},
|
comments: {},
|
||||||
|
@ -257,7 +230,6 @@ export default {
|
||||||
publicCondition: {},
|
publicCondition: {},
|
||||||
activeName: 'default',
|
activeName: 'default',
|
||||||
currentActiveName: '',
|
currentActiveName: '',
|
||||||
tabs: [],
|
|
||||||
renderComponent: true,
|
renderComponent: true,
|
||||||
loading: false,
|
loading: false,
|
||||||
type: '',
|
type: '',
|
||||||
|
@ -367,10 +339,7 @@ export default {
|
||||||
},
|
},
|
||||||
moduleOptions() {
|
moduleOptions() {
|
||||||
return store.testCaseModuleOptions;
|
return store.testCaseModuleOptions;
|
||||||
},
|
}
|
||||||
editable() {
|
|
||||||
return this.tabs.length > 0;
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
hasPermission,
|
hasPermission,
|
||||||
|
@ -379,46 +348,6 @@ export default {
|
||||||
projectId: this.projectId
|
projectId: this.projectId
|
||||||
}, this);
|
}, this);
|
||||||
},
|
},
|
||||||
closeTab(){
|
|
||||||
this.handleTabClose();
|
|
||||||
},
|
|
||||||
handleCommand(e) {
|
|
||||||
switch (e) {
|
|
||||||
case "ADD":
|
|
||||||
this.addTab({name: 'add'});
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
addTab(tab) {
|
|
||||||
this.showPublic = false
|
|
||||||
if (tab.name === 'edit' || tab.name === 'show') {
|
|
||||||
let label = this.$t('test_track.case.create');
|
|
||||||
let name = getUUID().substring(0, 8);
|
|
||||||
if (this.activeName === 'public') {
|
|
||||||
this.currentActiveName = 'public'
|
|
||||||
} else {
|
|
||||||
this.currentActiveName = 'default'
|
|
||||||
}
|
|
||||||
this.activeName = name;
|
|
||||||
label = tab.testCaseInfo.name;
|
|
||||||
this.tabs = [];
|
|
||||||
this.tabs.push({ edit: false, label: label, name: name, testCaseInfo: tab.testCaseInfo, isPublic: tab.isPublic});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tab.name === 'public') {
|
|
||||||
this.publicEnable = false;
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.publicEnable = true;
|
|
||||||
})
|
|
||||||
} else if (tab.name === 'trash') {
|
|
||||||
this.trashEnable = false;
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.trashEnable = true;
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
this.setCurTabId(tab, 'testCaseEdit');
|
|
||||||
},
|
|
||||||
handleImportCommand(e) {
|
handleImportCommand(e) {
|
||||||
switch (e) {
|
switch (e) {
|
||||||
case "excel":
|
case "excel":
|
||||||
|
@ -454,16 +383,6 @@ export default {
|
||||||
this.publicTotal = response.data;
|
this.publicTotal = response.data;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
setCurTabId(tab, ref) {
|
|
||||||
this.$nextTick(() => {
|
|
||||||
if (this.$refs && this.$refs[ref]) {
|
|
||||||
let index = tab.index ? Number.parseInt(tab.index) : this.tabs.length;
|
|
||||||
let cutEditTab = this.$refs[ref][index - 1];
|
|
||||||
let curTabId = cutEditTab ? cutEditTab.tabId : null;
|
|
||||||
useStore().curTabId = curTabId;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
updateActiveDom(activeDom) {
|
updateActiveDom(activeDom) {
|
||||||
openMinderConfirm(this, activeDom);
|
openMinderConfirm(this, activeDom);
|
||||||
},
|
},
|
||||||
|
@ -510,98 +429,6 @@ export default {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
addTabShow(tab) {
|
|
||||||
if (!this.projectId) {
|
|
||||||
this.$warning(this.$t('commons.check_project_tip'));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (tab.name === 'show') {
|
|
||||||
this.showPublic = true
|
|
||||||
let label = this.$t('test_track.case.create');
|
|
||||||
let name = getUUID().substring(0, 8);
|
|
||||||
this.activeName = name;
|
|
||||||
this.currentActiveName = 'public'
|
|
||||||
label = tab.testCaseInfo.name;
|
|
||||||
this.tabs.push({ edit: false, label: label, name: name, testCaseInfo: tab.testCaseInfo});
|
|
||||||
}
|
|
||||||
this.setCurTabId(this, tab, 'testCaseEditShow');
|
|
||||||
},
|
|
||||||
handleTabClose() {
|
|
||||||
let message = "";
|
|
||||||
this.tabs.forEach(t => {
|
|
||||||
if (t && store.testCaseMap.has(t.testCaseInfo.id) && store.testCaseMap.get(t.testCaseInfo.id) > 1) {
|
|
||||||
message += t.testCaseInfo.name + ",";
|
|
||||||
}
|
|
||||||
if (t.label === this.$t('test_track.case.create')) {
|
|
||||||
message += this.$t('test_track.case.create') + ",";
|
|
||||||
}
|
|
||||||
if (t.testCaseInfo.isCopy) {
|
|
||||||
message += t.testCaseInfo.name + ",";
|
|
||||||
}
|
|
||||||
})
|
|
||||||
if (message !== "") {
|
|
||||||
this.$alert(this.$t('commons.track') + " [ " + message.substr(0, message.length - 1) + " ] " + this.$t('commons.confirm_info'), '', {
|
|
||||||
confirmButtonText: this.$t('commons.confirm'),
|
|
||||||
cancelButtonText: this.$t('commons.cancel'),
|
|
||||||
callback: (action) => {
|
|
||||||
if (action === 'confirm') {
|
|
||||||
store.testCaseMap.clear();
|
|
||||||
this.tabs = [];
|
|
||||||
this.activeName = "default";
|
|
||||||
this.refresh();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
this.tabs = [];
|
|
||||||
this.activeName = "default";
|
|
||||||
this.refresh();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
closeConfirm(targetName) {
|
|
||||||
if (targetName === 'trash') {
|
|
||||||
this.activeName = 'default';
|
|
||||||
this.trashEnable = false;
|
|
||||||
} else {
|
|
||||||
this.closeTabWithSave(targetName);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
closeTabWithSave(targetName) {
|
|
||||||
let t = this.tabs.filter(tab => tab.name === targetName);
|
|
||||||
let message = "";
|
|
||||||
if (t && store.testCaseMap.has(t[0].testCaseInfo.id) && store.testCaseMap.get(t[0].testCaseInfo.id) > 0) {
|
|
||||||
message += t[0].testCaseInfo.name;
|
|
||||||
}
|
|
||||||
if (t[0].label === this.$t('test_track.case.create')) {
|
|
||||||
message += this.$t('test_track.case.create');
|
|
||||||
}
|
|
||||||
if (t[0].testCaseInfo.isCopy) {
|
|
||||||
message += t[0].testCaseInfo.name;
|
|
||||||
}
|
|
||||||
if (message !== "") {
|
|
||||||
this.$alert(this.$t('commons.track') + " [ " + message + " ] " + this.$t('commons.confirm_info'), '', {
|
|
||||||
confirmButtonText: this.$t('commons.confirm'),
|
|
||||||
cancelButtonText: this.$t('commons.cancel'),
|
|
||||||
callback: (action) => {
|
|
||||||
if (action === 'confirm') {
|
|
||||||
store.testCaseMap.delete(t[0].testCaseInfo.id);
|
|
||||||
this.removeTab(targetName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
store.testCaseMap.delete(t[0].testCaseInfo.id);
|
|
||||||
this.removeTab(targetName);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
removeTab(targetName) {
|
|
||||||
this.tabs = this.tabs.filter(tab => tab.name !== targetName);
|
|
||||||
if (this.tabs.length > 0) {
|
|
||||||
this.activeName = this.tabs[this.tabs.length - 1].name;
|
|
||||||
} else {
|
|
||||||
this.activeName = "default";
|
|
||||||
}
|
|
||||||
},
|
|
||||||
handleExportCheck() {
|
handleExportCheck() {
|
||||||
if (this.$refs.testCaseList.checkSelected()) {
|
if (this.$refs.testCaseList.checkSelected()) {
|
||||||
this.$refs.nodeTree.openExport();
|
this.$refs.nodeTree.openExport();
|
||||||
|
@ -673,25 +500,13 @@ export default {
|
||||||
this.$refs.nodeTree.list();
|
this.$refs.nodeTree.list();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setTable(data) {
|
refreshAll() {
|
||||||
if (data) {
|
|
||||||
for (let index in this.tabs) {
|
|
||||||
let tab = this.tabs[index];
|
|
||||||
if (tab.name === this.activeName) {
|
|
||||||
tab.label = data.name;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
refreshAll(data) {
|
|
||||||
if (this.$refs.testCaseList) {
|
if (this.$refs.testCaseList) {
|
||||||
this.$refs.testCaseList.initTableData();
|
this.$refs.testCaseList.initTableData();
|
||||||
}
|
}
|
||||||
if(this.$refs.nodeTree){
|
if(this.$refs.nodeTree){
|
||||||
this.$refs.nodeTree.list();
|
this.$refs.nodeTree.list();
|
||||||
}
|
}
|
||||||
this.setTable(data);
|
|
||||||
},
|
},
|
||||||
importRefresh() {
|
importRefresh() {
|
||||||
this.refreshAll();
|
this.refreshAll();
|
||||||
|
@ -762,23 +577,6 @@ export default {
|
||||||
changeVersion(currentVersion) {
|
changeVersion(currentVersion) {
|
||||||
this.currentVersion = currentVersion || null;
|
this.currentVersion = currentVersion || null;
|
||||||
},
|
},
|
||||||
changeTrashVersion(currentVersion) {
|
|
||||||
this.currentTrashVersion = currentVersion || null;
|
|
||||||
},
|
|
||||||
checkout(testCase, item) {
|
|
||||||
Object.assign(item.testCaseInfo, testCase)
|
|
||||||
//子组件先变更 copy 状态,再执行初始化操作
|
|
||||||
for (let i = 0; i < this.$refs.testCaseEdit.length; i++) {
|
|
||||||
this.$refs.testCaseEdit[i].initEdit(item.testCaseInfo, () => {
|
|
||||||
this.$nextTick(() => {
|
|
||||||
let vh = this.$refs.testCaseEdit[i].$refs.versionHistory;
|
|
||||||
vh.getVersionOptionList(vh.handleVersionOptions);
|
|
||||||
vh.show = false;
|
|
||||||
vh.loading = false;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
checkoutPublic(testCase, item) {
|
checkoutPublic(testCase, item) {
|
||||||
Object.assign(item.testCaseInfo, testCase)
|
Object.assign(item.testCaseInfo, testCase)
|
||||||
//子组件先变更 copy 状态,再执行初始化操作
|
//子组件先变更 copy 状态,再执行初始化操作
|
||||||
|
|
|
@ -362,7 +362,7 @@ import {
|
||||||
hasTestCaseOtherInfo,
|
hasTestCaseOtherInfo,
|
||||||
testCaseEditFollows,
|
testCaseEditFollows,
|
||||||
testCaseGetByVersionId,
|
testCaseGetByVersionId,
|
||||||
testCaseDeleteToGc, getTestCaseNodesByCaseFilter, getTestCaseByVersionId,
|
testCaseDeleteToGc, getTestCaseNodesByCaseFilter, getTestCaseByVersionId, getSimpleTestCase,
|
||||||
} from "@/api/testCase";
|
} from "@/api/testCase";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
@ -682,17 +682,11 @@ export default {
|
||||||
|
|
||||||
},
|
},
|
||||||
activated() {
|
activated() {
|
||||||
if (localStorage.getItem('trackProjectChange')) {
|
|
||||||
// 如果在编辑页切换项目,则跳转到用例列表
|
|
||||||
this.$router.push('/track/case/all');
|
|
||||||
} else {
|
|
||||||
this.loadTestCase();
|
this.loadTestCase();
|
||||||
}
|
|
||||||
},
|
},
|
||||||
created(){
|
created(){
|
||||||
this.$EventBus.$on('projectChange', () => {
|
this.$EventBus.$on('projectChange', () => {
|
||||||
this.projectChange = true;
|
this.$router.push('/track/case/all');
|
||||||
localStorage.setItem('trackProjectChange', 'true');
|
|
||||||
});
|
});
|
||||||
this.$EventBus.$on("handleSaveCaseWithEvent", this.handleSaveCaseWithEvent);
|
this.$EventBus.$on("handleSaveCaseWithEvent", this.handleSaveCaseWithEvent);
|
||||||
},
|
},
|
||||||
|
@ -779,7 +773,7 @@ export default {
|
||||||
this.checkVersionEnable();
|
this.checkVersionEnable();
|
||||||
},
|
},
|
||||||
editPublicCase(type) {
|
editPublicCase(type) {
|
||||||
openCaseEdit({caseId: this.caseId, projectId: this.projectId, type}, this)
|
openCaseEdit({caseId: this.caseId, type}, this)
|
||||||
},
|
},
|
||||||
copyPublicCase() {
|
copyPublicCase() {
|
||||||
this.editPublicCase('copy');
|
this.editPublicCase('copy');
|
||||||
|
@ -805,10 +799,7 @@ export default {
|
||||||
if (this.editable || !this.form.id || this.isPublicShow) {
|
if (this.editable || !this.form.id || this.isPublicShow) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let TestCaseData = this.$router.resolve({
|
openCaseEdit({caseId: this.form.id}, this);
|
||||||
path: "/track/case/edit/" + this.form.id
|
|
||||||
});
|
|
||||||
window.open(TestCaseData.href, "_blank");
|
|
||||||
},
|
},
|
||||||
handleSaveCaseWithEvent(formData) {
|
handleSaveCaseWithEvent(formData) {
|
||||||
this.saveCase();
|
this.saveCase();
|
||||||
|
@ -948,11 +939,24 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
checkCurrentProject() {
|
checkCurrentProject() {
|
||||||
// 如果不是当前项目,先切项目
|
if (this.projectId) {
|
||||||
|
// 创建时会带 projectId,校验是否是当前项目
|
||||||
if (getCurrentProjectID() !== this.projectId) {
|
if (getCurrentProjectID() !== this.projectId) {
|
||||||
setCurrentProjectID(this.projectId);
|
setCurrentProjectID(this.projectId);
|
||||||
location.reload();
|
location.reload();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (this.caseId) {
|
||||||
|
getSimpleTestCase(this.caseId).then((response) => {
|
||||||
|
let testCase = response.data;
|
||||||
|
if (getCurrentProjectID() !== testCase.projectId) {
|
||||||
|
// 如果不是当前项目,先切项目
|
||||||
|
setCurrentProjectID(testCase.projectId);
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
getTestCase() {
|
getTestCase() {
|
||||||
if (!this.caseId) {
|
if (!this.caseId) {
|
||||||
|
@ -976,8 +980,6 @@ export default {
|
||||||
item.isEdit = false;
|
item.isEdit = false;
|
||||||
});
|
});
|
||||||
this.form.id = null;
|
this.form.id = null;
|
||||||
} else {
|
|
||||||
this.checkCurrentProject(testCase.projectId);
|
|
||||||
}
|
}
|
||||||
this.currentTestCaseInfo = testCase;
|
this.currentTestCaseInfo = testCase;
|
||||||
this.setFormData(testCase);
|
this.setFormData(testCase);
|
||||||
|
@ -1108,7 +1110,7 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
routerToEdit(id) {
|
routerToEdit(id) {
|
||||||
this.$router.push({path: '/track/' + this.projectId + '/case/edit/' + id});
|
this.$router.push({path: '/track/case/edit/' + id});
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
}, 300);
|
}, 300);
|
||||||
|
@ -1488,7 +1490,7 @@ export default {
|
||||||
this.saveCase();
|
this.saveCase();
|
||||||
},
|
},
|
||||||
copyRow() {
|
copyRow() {
|
||||||
openCaseEdit({caseId: this.testCase.id, projectId: this.testCase.projectId, type: 'copy'}, this);
|
openCaseEdit({caseId: this.testCase.id, type: 'copy'}, this);
|
||||||
},
|
},
|
||||||
deleteRow() {
|
deleteRow() {
|
||||||
getTestCaseVersions(this.testCase.id)
|
getTestCaseVersions(this.testCase.id)
|
||||||
|
|
|
@ -849,7 +849,7 @@ export default {
|
||||||
this.$refs.table.resetHeader();
|
this.$refs.table.resetHeader();
|
||||||
},
|
},
|
||||||
handleEdit(testCase, type) {
|
handleEdit(testCase, type) {
|
||||||
openCaseEdit({caseId: testCase.id, projectId: testCase.projectId, type}, this);
|
openCaseEdit({caseId: testCase.id, type}, this);
|
||||||
},
|
},
|
||||||
getCase(id) {
|
getCase(id) {
|
||||||
this.$refs.testCasePreview.open();
|
this.$refs.testCasePreview.open();
|
||||||
|
|
|
@ -328,14 +328,9 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getTestCaseVersions } from "@/api/testCase";
|
|
||||||
import {
|
import {
|
||||||
getDefaultVersion,
|
|
||||||
getProjectMembers,
|
|
||||||
getProjectVersions,
|
getProjectVersions,
|
||||||
isProjectVersionEnable,
|
|
||||||
} from "metersphere-frontend/src/api/version";
|
} from "metersphere-frontend/src/api/version";
|
||||||
import { getVersionFilters } from "@/business/utils/sdk-utils";
|
|
||||||
import { hasLicense } from "metersphere-frontend/src/utils/permission";
|
import { hasLicense } from "metersphere-frontend/src/utils/permission";
|
||||||
import MsFormDivider from "metersphere-frontend/src/components/MsFormDivider";
|
import MsFormDivider from "metersphere-frontend/src/components/MsFormDivider";
|
||||||
import MsSelectTree from "metersphere-frontend/src/components/select-tree/SelectTree";
|
import MsSelectTree from "metersphere-frontend/src/components/select-tree/SelectTree";
|
||||||
|
@ -346,7 +341,6 @@ import BaseEditItemComponent from "../BaseEditItemComponent";
|
||||||
import { issueDemandList } from "@/api/issue";
|
import { issueDemandList } from "@/api/issue";
|
||||||
import {
|
import {
|
||||||
getCurrentProjectID,
|
getCurrentProjectID,
|
||||||
getCurrentUser,
|
|
||||||
} from "metersphere-frontend/src/utils/token";
|
} from "metersphere-frontend/src/utils/token";
|
||||||
export default {
|
export default {
|
||||||
name: "CaseBaseInfo",
|
name: "CaseBaseInfo",
|
||||||
|
|
|
@ -449,7 +449,7 @@ export default {
|
||||||
this.selectCounts = this.$refs.table.selectDataCounts;
|
this.selectCounts = this.$refs.table.selectDataCounts;
|
||||||
},
|
},
|
||||||
handleEdit(testCase, type) {
|
handleEdit(testCase, type) {
|
||||||
openCaseEdit({caseId: testCase.id, projectId: testCase.projectId, type}, this);
|
openCaseEdit({caseId: testCase.id, type}, this);
|
||||||
},
|
},
|
||||||
handleEditShow(testCase, column) {
|
handleEditShow(testCase, column) {
|
||||||
this.$refs.publicTestCaseShow.open(testCase.id);
|
this.$refs.publicTestCaseShow.open(testCase.id);
|
||||||
|
|
|
@ -64,11 +64,8 @@ export function openCaseEdit(query, v) {
|
||||||
if (!query.type) {
|
if (!query.type) {
|
||||||
delete query.type;
|
delete query.type;
|
||||||
}
|
}
|
||||||
if (!query.projectId) {
|
|
||||||
query.projectId = getCurrentProjectID();
|
|
||||||
}
|
|
||||||
let path = '/track/' + query.projectId + '/case/edit/' + query.caseId;
|
|
||||||
delete query.projectId;
|
delete query.projectId;
|
||||||
|
let path = '/track/case/edit/' + query.caseId;
|
||||||
delete query.caseId;
|
delete query.caseId;
|
||||||
let TestCaseData = v.$router.resolve({
|
let TestCaseData = v.$router.resolve({
|
||||||
path,
|
path,
|
||||||
|
@ -88,8 +85,7 @@ export function openCaseCreate(query, v) {
|
||||||
if (!query.projectId) {
|
if (!query.projectId) {
|
||||||
query.projectId = getCurrentProjectID();
|
query.projectId = getCurrentProjectID();
|
||||||
}
|
}
|
||||||
let path = '/track/' + query.projectId + '/case/create';
|
let path = '/track/case/create';
|
||||||
delete query.projectId;
|
|
||||||
let TestCaseData = v.$router.resolve({
|
let TestCaseData = v.$router.resolve({
|
||||||
path,
|
path,
|
||||||
query,
|
query,
|
||||||
|
|
|
@ -95,6 +95,8 @@ export default {
|
||||||
this.pathName = '/track/review/all';
|
this.pathName = '/track/review/all';
|
||||||
} else if (to.params && to.params.planId) {
|
} else if (to.params && to.params.planId) {
|
||||||
this.pathName = '/track/plan/all';
|
this.pathName = '/track/plan/all';
|
||||||
|
} if (to.path.indexOf("/track/case") >= 0) {
|
||||||
|
this.pathName = '/track/case/all';
|
||||||
} else {
|
} else {
|
||||||
this.pathName = to.path;
|
this.pathName = to.path;
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,7 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
openTestCase() {
|
openTestCase() {
|
||||||
openCaseEdit({caseId: this.testCase.caseId, projectId: this.testCase.projectId}, this);
|
openCaseEdit({caseId: this.testCase.caseId}, this);
|
||||||
},
|
},
|
||||||
close() {
|
close() {
|
||||||
this.$emit('close');
|
this.$emit('close');
|
||||||
|
|
|
@ -12,7 +12,7 @@ export default {
|
||||||
component: () => import('@/business/home/TrackHome'),
|
component: () => import('@/business/home/TrackHome'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: ':projectId/case/create',
|
path: 'case/create',
|
||||||
name: 'testCaseCreate',
|
name: 'testCaseCreate',
|
||||||
component: () => import('@/business/case/components/TestCaseEdit'),
|
component: () => import('@/business/case/components/TestCaseEdit'),
|
||||||
},
|
},
|
||||||
|
@ -27,7 +27,7 @@ export default {
|
||||||
component: () => import('@/business/case/TestCase'),
|
component: () => import('@/business/case/TestCase'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: ':projectId/case/edit/:caseId',
|
path: 'case/edit/:caseId',
|
||||||
name: 'testCaseEdit',
|
name: 'testCaseEdit',
|
||||||
component: () => import('@/business/case/components/TestCaseEdit'),
|
component: () => import('@/business/case/components/TestCaseEdit'),
|
||||||
},
|
},
|
||||||
|
|
|
@ -654,13 +654,18 @@ export default {
|
||||||
this.initTableData();
|
this.initTableData();
|
||||||
},
|
},
|
||||||
handleEdit(testCase, column) {
|
handleEdit(testCase, column) {
|
||||||
let caseResolve = this.$router.resolve({
|
let query = {
|
||||||
path: '/track/case/edit',
|
|
||||||
query: {
|
|
||||||
caseId: testCase.id,
|
caseId: testCase.id,
|
||||||
},
|
projectId: testCase.projectId
|
||||||
|
};
|
||||||
|
let path = '/track/' + query.projectId + '/case/edit/' + query.caseId;
|
||||||
|
delete query.projectId;
|
||||||
|
delete query.caseId;
|
||||||
|
let TestCaseData = this.$router.resolve({
|
||||||
|
path,
|
||||||
|
query,
|
||||||
});
|
});
|
||||||
window.open(caseResolve.href, '_blank');
|
window.open(TestCaseData.href, '_blank');
|
||||||
},
|
},
|
||||||
refresh() {
|
refresh() {
|
||||||
this.$refs.table.clear();
|
this.$refs.table.clear();
|
||||||
|
|
|
@ -75,7 +75,7 @@ export default{
|
||||||
},
|
},
|
||||||
toCreatCase(){
|
toCreatCase(){
|
||||||
let caseData = this.$router.resolve({
|
let caseData = this.$router.resolve({
|
||||||
path: '/track/' + getCurrentProject() + '/case/create',
|
path: '/track/case/create',
|
||||||
});
|
});
|
||||||
window.open(caseData.href, '_blank');
|
window.open(caseData.href, '_blank');
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue