fix(测试跟踪): 公共用例库选择修改用例责任人后,新的责任人仍不可编辑和删除该用例

--bug=1008907 --user=王孝刚 【公共用例库】-选择修改用例责任人后,新的责任人仍不可编辑和删除该用例
https://www.tapd.cn/55049933/s/1086358
This commit is contained in:
wxg0103 2021-12-23 11:35:58 +08:00 committed by BugKing
parent aec1395ea8
commit 6e30857c77
7 changed files with 107 additions and 51 deletions

View File

@ -107,6 +107,12 @@ public class TestCaseController {
return testCaseService.listTestCaseIds(request);
}
@PostMapping("/list/ids/public")
public List<TestCaseDTO> getTestPlanCaseIdsPublic(@RequestBody QueryTestCaseRequest request) {
return testCaseService.publicListTestCase(request);
}
@GetMapping("/relationship/case/{id}/{relationshipType}")
public List<RelationshipEdgeDTO> getRelationshipCase(@PathVariable("id") String id, @PathVariable("relationshipType") String relationshipType) {
return testCaseService.getRelationshipCase(id, relationshipType);
@ -184,7 +190,6 @@ public class TestCaseController {
@GetMapping("/get/{testCaseId}")
public TestCaseWithBLOBs getTestCase(@PathVariable String testCaseId) {
checkPermissionService.checkTestCaseOwner(testCaseId);
return testCaseService.getTestCase(testCaseId);
}

View File

@ -1337,6 +1337,7 @@ public class TestCaseService {
BeanUtils.copyBean(batchCopy, item);
checkTestCaseExist(batchCopy);
batchCopy.setId(UUID.randomUUID().toString());
batchCopy.setName("copy_" + item.getName());
batchCopy.setCreateTime(System.currentTimeMillis());
batchCopy.setUpdateTime(System.currentTimeMillis());
batchCopy.setNum(getNextNum(SessionUtils.getCurrentProjectId()));

View File

@ -2,7 +2,9 @@
<div id="app" v-loading="loading">
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane :label="$t('organization.message.template')" name="apiTemplate">
<el-button type="primary" size="mini" style="margin: 10px 10px 0px" @click="openOneClickOperation">导入</el-button>
<el-button type="primary" size="mini" style="margin: 10px 10px 0px" @click="openOneClickOperation">
{{ this.$t('commons.import') }}
</el-button>
<div style="min-height: 200px">
<json-schema-editor class="schema" :value="schema" lang="zh_CN" custom/>
</div>

View File

@ -75,6 +75,7 @@
:isRedirectEdit="isRedirectEdit"
:tree-nodes="treeNodes"
:trash-enable="false"
:public-enable="false"
@refreshTable="refresh"
@testCaseEdit="editTestCase"
@testCaseCopy="copyTestCase"
@ -112,6 +113,7 @@
:tree-nodes="treeNodes"
:select-node="selectNode"
:select-condition="condition"
:public-enable="currentActiveName === 'default' ? false : true"
:type="type"
@addTab="addTab"
ref="testCaseEdit">
@ -128,7 +130,7 @@
:select-node="selectNode"
:select-condition="condition"
:type="type"
:is-public="publicEnable"
:public-enable="currentActiveName === 'default' ? false : true"
@addTab="addTabShow"
ref="testCaseEditShow">
</test-case-edit-show>
@ -202,6 +204,7 @@ export default {
showPublic: false,
condition: {},
activeName: 'default',
currentActiveName: '',
tabs: [],
renderComponent: true,
loading: false,
@ -344,12 +347,18 @@ export default {
let label = this.$t('test_track.case.create');
let name = getUUID().substring(0, 8);
this.activeName = name;
this.currentActiveName = 'default'
this.type = 'add';
this.tabs.push({label: label, name: name, testCaseInfo: {testCaseModuleId: "", id: getUUID()}});
}
if (tab.name === 'edit') {
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.push({label: label, name: name, testCaseInfo: tab.testCaseInfo});
@ -367,6 +376,7 @@ export default {
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({label: label, name: name, testCaseInfo: tab.testCaseInfo});
}

View File

@ -18,23 +18,15 @@
<el-link type="primary" style="margin-right: 20px" @click="openHis" v-if="form.id">
{{ $t('operating_log.change_history') }}
</el-link>
<ms-table-button v-if="this.path!=='/test/case/add'"
id="inputDelay"
type="primary"
:content="$t('commons.save')"
size="small" @click="saveCase"
icon=""
:disabled="readOnly"
title="ctrl + s"/>
<el-dropdown v-else split-button type="primary" class="ms-api-buttion" @click="handleCommand"
<el-dropdown split-button type="primary" class="ms-api-buttion" @click="handleCommand"
@command="handleCommand" size="small" style="float: right;margin-right: 20px">
{{ $t('commons.save') }}
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="ADD_AND_CREATE">{{
<el-dropdown-item command="ADD_AND_CREATE" v-if="this.path =='/test/case/add'">{{
$t('test_track.case.save_create_continue')
}}
</el-dropdown-item>
<el-dropdown-item command="ADD_AND_PUBLIC" v-if="this.publicEnable && this.isXpack">{{
<el-dropdown-item command="ADD_AND_PUBLIC" v-if="this.isPublic && this.isXpack">{{
$t('test_track.case.save_add_public')
}}
</el-dropdown-item>
@ -55,12 +47,22 @@
</el-col>
<el-col :span="8">
<el-form-item :label="$t('test_track.case.module')" :label-width="formLabelWidth" prop="module">
<el-form-item :label="$t('test_track.case.module')" :label-width="formLabelWidth" prop="module"
v-if="!publicEnable">
<ms-select-tree :disabled="readOnly" :data="treeNodes" :defaultKey="form.module" :obj="moduleObj"
@getValue="setModule" clearable checkStrictly size="small"/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('test_track.case.project')" :label-width="formLabelWidth" prop="projectId"
v-if="publicEnable">
<el-select v-model="form.projectId" filterable clearable>
<el-option v-for="item in projectList" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('commons.tag')" :label-width="formLabelWidth" prop="tag">
<ms-input-tag :read-only="readOnly" :currentScenario="form" v-if="showInputTag" ref="tag"
@ -198,9 +200,10 @@ export default {
return {
// sysList: [],//
path: "/test/case/add",
publicEnable: false,
isPublic: false,
isXpack: false,
testCaseTemplate: {},
projectList: [],
options: REVIEW_STATUS,
statuOptions: API_STATUS,
comments: [],
@ -294,6 +297,11 @@ export default {
type: Object
},
type: String,
publicEnable: {
type: Boolean,
default: false,
},
activeName: String
},
computed: {
projectIds() {
@ -367,6 +375,11 @@ export default {
this.$store.state.testCaseMap.set(this.form.id, 0);
},
created() {
if (!this.projectList || this.projectList.length === 0) { //
this.$get("/project/listAll", (response) => {
this.projectList = response.data; //,
})
}
this.projectId = this.projectIds;
let initAddFuc = this.initAddFuc;
getTestTemplate()
@ -401,7 +414,7 @@ export default {
this.result = this.$get('/project/get/' + this.projectId, res => {
let data = res.data;
if (data.casePublic) {
this.publicEnable = true;
this.isPublic = true;
}
})
if (hasLicense()) {
@ -583,16 +596,28 @@ export default {
this.getTestCase(this.index);
},
initTestCases(testCase) {
this.selectCondition.workspaceId = null;
this.result = this.$post('/test/case/list/ids', this.selectCondition, response => {
this.testCases = response.data;
for (let i = 0; i < this.testCases.length; i++) {
if (this.testCases[i].id === testCase.id) {
this.index = i;
this.getTestCase(i);
if (this.publicEnable) {
this.result = this.$post('/test/case/list/ids/public', this.selectCondition, response => {
this.testCases = response.data;
for (let i = 0; i < this.testCases.length; i++) {
if (this.testCases[i].id === testCase.id) {
this.index = i;
this.getTestCase(i);
}
}
}
});
});
} else {
this.selectCondition.workspaceId = null;
this.result = this.$post('/test/case/list/ids', this.selectCondition, response => {
this.testCases = response.data;
for (let i = 0; i < this.testCases.length; i++) {
if (this.testCases[i].id === testCase.id) {
this.index = i;
this.getTestCase(i);
}
}
});
}
},
getTestCase(index) {
let id = "";

View File

@ -59,7 +59,7 @@
<el-form v-if="isFormAlive" :model="customFieldForm" :rules="customFieldRules" ref="customFieldForm"
class="case-form">
<custom-filed-form-item :form="customFieldForm" :form-label-width="formLabelWidth"
:issue-template="testCaseTemplate" :is-public="isPublic"/>
:issue-template="testCaseTemplate" :is-public="publicEnable"/>
</el-form>
<el-row v-if="isCustomNum">
@ -121,7 +121,7 @@
<ms-change-history ref="changeHistory"/>
</div>
<batch-move ref="testBatchMove" :public-enable="isPublic"
<batch-move ref="testBatchMove" :public-enable="publicEnable"
@copyPublic="copyPublic"/>
</el-card>
@ -191,7 +191,7 @@ export default {
path: "/test/case/add",
selectIds: [],
projectList: [],
publicEnable: false,
isPublic: false,
isXpack: false,
testCaseTemplate: {},
options: REVIEW_STATUS,
@ -287,8 +287,9 @@ export default {
type: Object
},
type: String,
isPublic: {
type: Boolean
publicEnable: {
type: Boolean,
default: false
}
},
computed: {
@ -381,7 +382,7 @@ export default {
this.result = this.$get('/project/get/' + this.projectId, res => {
let data = res.data;
if (data.casePublic) {
this.publicEnable = true;
this.isPublic = true;
}
})
if (hasLicense()) {
@ -562,16 +563,28 @@ export default {
this.getTestCase(this.index);
},
initTestCases(testCase) {
this.selectCondition.workspaceId = null;
this.result = this.$post('/test/case/list/ids', this.selectCondition, response => {
this.testCases = response.data;
for (let i = 0; i < this.testCases.length; i++) {
if (this.testCases[i].id === testCase.id) {
this.index = i;
this.getTestCase(i);
if (this.publicEnable) {
this.result = this.$post('/test/case/list/ids/public', this.selectCondition, response => {
this.testCases = response.data;
for (let i = 0; i < this.testCases.length; i++) {
if (this.testCases[i].id === testCase.id) {
this.index = i;
this.getTestCase(i);
}
}
}
});
});
} else {
this.selectCondition.workspaceId = null;
this.result = this.$post('/test/case/list/ids', this.selectCondition, response => {
this.testCases = response.data;
for (let i = 0; i < this.testCases.length; i++) {
if (this.testCases[i].id === testCase.id) {
this.index = i;
this.getTestCase(i);
}
}
});
}
},
getTestCase(index) {
let id = "";

View File

@ -757,10 +757,14 @@ export default {
},
handleEdit(testCase, column) {
if (column.label !== this.$t('test_track.case.case_desc')) {
this.$get('test/case/get/' + testCase.id, response => {
let testCase = response.data;
this.$emit('testCaseEdit', testCase);
});
if (this.publicEnable) {
return;
} else {
this.$get('test/case/get/' + testCase.id, response => {
let testCase = response.data;
this.$emit('testCaseEdit', testCase);
});
}
}
},
@ -774,14 +778,10 @@ export default {
},
isPublic(testCase) {
if (testCase.maintainer && testCase.maintainer !== getCurrentUserId()) {
return true;
}
if (testCase.createUser && testCase.createUser !== getCurrentUserId()) {
return true;
} else {
if ((testCase.maintainer && testCase.maintainer === getCurrentUserId()) || (testCase.createUser && testCase.createUser === getCurrentUserId())) {
return false;
}
return true;
},
getCase(id) {
this.$refs.testCasePreview.open();