fix: 先点模块再点脑图,评审脑图不是对应模块的脑图 (#1790)

* fix: 解决冲突

* refactor: 用例评审点击模块展示对应脑图

* refactor: 测试计划用例点击模块展示对应脑图

* fix: 先点模块再点脑图,评审脑图不是对应模块的脑图

* fix: 动态更新模块树

* refactor: 代码规范

Co-authored-by: chenjianxing <jianxing.chen@fit2cloud.com>
Co-authored-by: BugKing <wangzhen@fit2cloud.com>
This commit is contained in:
metersphere-bot 2021-04-01 18:09:23 +08:00 committed by 刘瑞斌
parent 3ae7570bc8
commit 793758ac62
23 changed files with 286 additions and 125 deletions

View File

@ -1,6 +1,7 @@
package io.metersphere.base.mapper.ext; package io.metersphere.base.mapper.ext;
import io.metersphere.base.domain.TestCase; import io.metersphere.base.domain.TestCase;
import io.metersphere.base.domain.TestCaseWithBLOBs;
import io.metersphere.controller.request.BaseQueryRequest; import io.metersphere.controller.request.BaseQueryRequest;
import io.metersphere.track.dto.TestCaseDTO; import io.metersphere.track.dto.TestCaseDTO;
import io.metersphere.track.request.testcase.QueryTestCaseRequest; import io.metersphere.track.request.testcase.QueryTestCaseRequest;
@ -76,5 +77,5 @@ public interface ExtTestCaseMapper {
int getTestPlanPassCase(@Param("planId") String planId); int getTestPlanPassCase(@Param("planId") String planId);
List<TestCaseWithBLOBs> listForMinder(@Param("request") QueryTestCaseRequest request);
} }

View File

@ -416,5 +416,11 @@
) as temp ) as temp
</select> </select>
<select id="listForMinder" resultType="io.metersphere.base.domain.TestCaseWithBLOBs">
select
id, `name`, node_id, node_path, `type`, `method`, maintainer, priority, prerequisite, remark, steps
from test_case
<include refid="queryWhereCondition"/>
</select>
</mapper> </mapper>

View File

@ -11,6 +11,16 @@
from test_case_review from test_case_review
join project on project.id = test_case_review.project_id join project on project.id = test_case_review.project_id
left join user on test_case_review.creator = user.id left join user on test_case_review.creator = user.id
<include refid="queryWhereCondition"/>
<if test="request.orders != null and request.orders.size() > 0">
order by
<foreach collection="request.orders" separator="," item="order">
test_case_review.${order.name} ${order.type}
</foreach>
</if>
</select>
<sql id="queryWhereCondition">
<where> <where>
<if test="request.name != null"> <if test="request.name != null">
and test_case_review.name like CONCAT('%', #{request.name},'%') and test_case_review.name like CONCAT('%', #{request.name},'%')
@ -19,13 +29,7 @@
and test_case_review.project_id = #{request.projectId} and test_case_review.project_id = #{request.projectId}
</if> </if>
</where> </where>
<if test="request.orders != null and request.orders.size() > 0"> </sql>
order by
<foreach collection="request.orders" separator="," item="order">
test_case_review.${order.name} ${order.type}
</foreach>
</if>
</select>
<select id="listByWorkspaceId" resultType="io.metersphere.track.dto.TestCaseReviewDTO" <select id="listByWorkspaceId" resultType="io.metersphere.track.dto.TestCaseReviewDTO"
parameterType="io.metersphere.track.request.testreview.QueryCaseReviewRequest"> parameterType="io.metersphere.track.request.testreview.QueryCaseReviewRequest">
@ -91,4 +95,4 @@
</foreach> </foreach>
</if>) as temp </if>) as temp
</select> </select>
</mapper> </mapper>

View File

@ -58,10 +58,10 @@ public class TestCaseController {
return testCaseService.listTestCase(request); return testCaseService.listTestCase(request);
} }
@GetMapping("/list/detail/{projectId}") @PostMapping("/list/minder")
public List<TestCaseWithBLOBs> listDetail(@PathVariable String projectId) { public List<TestCaseWithBLOBs> listDetail(@RequestBody QueryTestCaseRequest request) {
checkPermissionService.checkProjectOwner(projectId); checkPermissionService.checkProjectOwner(request.getProjectId());
return testCaseService.listTestCaseDetail(projectId); return testCaseService.listTestCaseForMinder(request);
} }
/*jenkins项目下所有接口和性能测试用例*/ /*jenkins项目下所有接口和性能测试用例*/

View File

@ -893,12 +893,6 @@ public class TestCaseService {
return extTestCaseMapper.list(request); return extTestCaseMapper.list(request);
} }
public List<TestCaseWithBLOBs> listTestCaseDetail(String projectId) {
TestCaseExample testCaseExample = new TestCaseExample();
testCaseExample.createCriteria().andProjectIdEqualTo(projectId);
return testCaseMapper.selectByExampleWithBLOBs(testCaseExample);
}
public void minderEdit(TestCaseMinderEditRequest request) { public void minderEdit(TestCaseMinderEditRequest request) {
List<TestCaseWithBLOBs> data = request.getData(); List<TestCaseWithBLOBs> data = request.getData();
data.forEach(item -> { data.forEach(item -> {
@ -927,4 +921,8 @@ public class TestCaseService {
example.createCriteria().andProjectIdEqualTo(projectId); example.createCriteria().andProjectIdEqualTo(projectId);
return testCaseMapper.selectByExample(example); return testCaseMapper.selectByExample(example);
} }
public List<TestCaseWithBLOBs> listTestCaseForMinder(QueryTestCaseRequest request) {
return extTestCaseMapper.listForMinder(request);
}
} }

View File

@ -44,6 +44,9 @@ export default {
default() { default() {
return [] return []
} }
},
selectNode: {
type: Object,
} }
}, },
data() { data() {
@ -53,16 +56,15 @@ export default {
data: { data: {
text: this.$t('test_track.review_view.all_case'), text: this.$t('test_track.review_view.all_case'),
disable: true, disable: true,
id: "root", id: 'root',
path: ""
}, },
children: [] children: []
}, },
"template":"default" template: 'default'
}, },
isActive: true, isActive: true,
isFullScreen: false, isFullScreen: false,
height: "" height: ''
} }
}, },
created() { created() {
@ -71,7 +73,11 @@ export default {
watch: { watch: {
dataMap() { dataMap() {
this.$nextTick(() => { this.$nextTick(() => {
this.parse(this.importJson.root, this.treeNodes); if (this.selectNode && this.selectNode.data) {
this.handleNodeSelect(this.selectNode);
} else {
this.parse(this.importJson.root, this.treeNodes);
}
this.reload(); this.reload();
}) })
} }
@ -109,7 +115,6 @@ export default {
text: item.name, text: item.name,
id: item.id, id: item.id,
disable: true, disable: true,
path: root.data.path + "/" + item.name,
expandState:"collapse" expandState:"collapse"
}, },
} }
@ -125,6 +130,29 @@ export default {
}, },
setJsonImport(data) { setJsonImport(data) {
this.importJson = data; this.importJson = data;
},
handleNodeSelect(node) {
if (node && node.data) {
let nodeData = node.data;
let importJson = this.getImportJsonBySelectNode(nodeData);
this.parse(importJson.root, nodeData.children);
this.setJsonImport(importJson);
this.reload();
}
},
getImportJsonBySelectNode(nodeData) {
let importJson = {
root: {
data: {
text: nodeData.name,
id: nodeData.id,
disable: true,
},
children: []
},
template: "default"
};
return importJson;
} }
} }
} }

View File

@ -28,10 +28,7 @@
<test-case-list <test-case-list
v-if="activeDom === 'left'" v-if="activeDom === 'left'"
:checkRedirectID="checkRedirectID" :checkRedirectID="checkRedirectID"
:module-options="moduleOptions"
:select-node-ids="selectNodeIds"
:isRedirectEdit="isRedirectEdit" :isRedirectEdit="isRedirectEdit"
:select-parent-nodes="selectParentNodes"
:tree-nodes="treeNodes" :tree-nodes="treeNodes"
@testCaseEdit="editTestCase" @testCaseEdit="editTestCase"
@testCaseCopy="copyTestCase" @testCaseCopy="copyTestCase"
@ -58,7 +55,6 @@
<test-case-edit <test-case-edit
:currentTestCaseInfo="item.testCaseInfo" :currentTestCaseInfo="item.testCaseInfo"
@refresh="refreshTable" @refresh="refreshTable"
@setModuleOptions="setModuleOptions"
@caseEdit="handleCaseCreateOrEdit($event,'edit')" @caseEdit="handleCaseCreateOrEdit($event,'edit')"
@caseCreate="handleCaseCreateOrEdit($event,'add')" @caseCreate="handleCaseCreateOrEdit($event,'add')"
:read-only="testCaseReadOnly" :read-only="testCaseReadOnly"
@ -123,12 +119,8 @@ export default {
result: {}, result: {},
projects: [], projects: [],
treeNodes: [], treeNodes: [],
selectNodeIds: [],
selectParentNodes: [],
testCaseReadOnly: true, testCaseReadOnly: true,
selectNode: {},
condition: {}, condition: {},
moduleOptions: [],
activeName: 'default', activeName: 'default',
tabs: [], tabs: [],
renderComponent:true, renderComponent:true,
@ -177,6 +169,15 @@ export default {
projectId() { projectId() {
return this.$store.state.projectId return this.$store.state.projectId
}, },
selectNodeIds() {
return this.$store.state.testCaseSelectNodeIds;
},
selectNode() {
return this.$store.state.testCaseSelectNode;
},
moduleOptions() {
return this.$store.state.testCaseModuleOptions;
}
}, },
methods: { methods: {
handleCommand(e) { handleCommand(e) {
@ -284,11 +285,8 @@ export default {
this.$router.push('/track/case/all'); this.$router.push('/track/case/all');
} }
}, },
nodeChange(node, nodeIds, pNodes) { nodeChange(node) {
this.activeName = "default"; this.activeName = "default";
this.selectNodeIds = nodeIds;
this.selectNode = node;
this.selectParentNodes = pNodes;
}, },
refreshTable() { refreshTable() {
if ( this.$refs.testCaseList) { if ( this.$refs.testCaseList) {
@ -310,6 +308,15 @@ export default {
} }
}, },
handleCaseSimpleCreate(data, type) { handleCaseSimpleCreate(data, type) {
if ('default-module' === data.nodeId) {
for (let i = 0; i < this.moduleOptions.length; i++) {
let item = this.moduleOptions[i];
if (item.path.indexOf('默认模块') > -1) {
data.nodeId = item.id;
break;
}
}
}
this.handleCaseCreateOrEdit(data, type); this.handleCaseCreateOrEdit(data, type);
if (this.$refs.minder) { if (this.$refs.minder) {
this.$refs.minder.refresh(); this.$refs.minder.refresh();
@ -325,15 +332,12 @@ export default {
this.testCaseReadOnly = true; this.testCaseReadOnly = true;
}, },
refresh(data) { refresh(data) {
this.selectNodeIds = []; this.$store.commit('setTestCaseSelectNode', {});
this.selectParentNodes = []; this.$store.commit('setTestCaseSelectNodeIds', []);
this.selectNode = {};
this.refreshTable(); this.refreshTable();
this.setTable(data); this.setTable(data);
}, },
setTable(data) { setTable(data) {
console.log(data)
for (let index in this.tabs) { for (let index in this.tabs) {
let tab = this.tabs[index]; let tab = this.tabs[index];
if (tab.name === this.activeName) { if (tab.name === this.activeName) {
@ -367,9 +371,6 @@ export default {
}, },
setCondition(data) { setCondition(data) {
this.condition = data; this.condition = data;
},
setModuleOptions(data) {
this.moduleOptions = data;
} }
} }
} }

View File

@ -95,12 +95,15 @@ export default {
watch: { watch: {
treeNodes() { treeNodes() {
this.getModuleOptions(); this.getModuleOptions();
}, }
}, },
computed: { computed: {
projectId() { projectId() {
return this.$store.state.projectId return this.$store.state.projectId
}, },
moduleOptions() {
return this.$store.state.testCaseModuleOptions;
}
}, },
methods: { methods: {
saveTestCase(saveAs) { saveTestCase(saveAs) {
@ -134,12 +137,12 @@ export default {
}) })
}, },
getModuleOptions() { getModuleOptions() {
let moduleOptions = []; // let moduleOptions = [];
this.treeNodes.forEach(node => { // this.treeNodes.forEach(node => {
buildNodePath(node, {path: ''}, moduleOptions); // buildNodePath(node, {path: ''}, moduleOptions);
}); // });
if(this.currentModule!==undefined){ if(this.currentModule!==undefined){
moduleOptions.forEach(item => { this.moduleOptions.forEach(item => {
if (this.currentModule.id === item.id) { if (this.currentModule.id === item.id) {
this.currentModule.path = item.path; this.currentModule.path = item.path;
} }

View File

@ -277,7 +277,7 @@
<script> <script>
import {TokenKey, WORKSPACE_ID} from '@/common/js/constants'; import {TokenKey, WORKSPACE_ID} from '@/common/js/constants';
import MsDialogFooter from '../../../common/components/MsDialogFooter' import MsDialogFooter from '../../../common/components/MsDialogFooter'
import {getCurrentUser, handleCtrlSEvent, listenGoBack, removeGoBackListener} from "@/common/js/utils"; import {getCurrentUser, getNodePath, handleCtrlSEvent, listenGoBack, removeGoBackListener} from "@/common/js/utils";
import {Message} from "element-ui"; import {Message} from "element-ui";
import TestCaseAttachment from "@/business/components/track/case/components/TestCaseAttachment"; import TestCaseAttachment from "@/business/components/track/case/components/TestCaseAttachment";
import {buildNodePath,buildTree} from "../../../api/definition/model/NodeTree"; import {buildNodePath,buildTree} from "../../../api/definition/model/NodeTree";
@ -337,7 +337,6 @@ export default {
reviewStatus: 'Prepare', reviewStatus: 'Prepare',
}, },
readOnly: false, readOnly: false,
moduleOptions: [],
maintainerOptions: [], maintainerOptions: [],
testOptions: [], testOptions: [],
demandOptions: [], demandOptions: [],
@ -382,9 +381,6 @@ export default {
type: Array type: Array
}, },
currentTestCaseInfo: {}, currentTestCaseInfo: {},
setModuleOptions: {
type: Array
},
/*readOnly: { /*readOnly: {
type: Boolean, type: Boolean,
default: false default: false
@ -401,6 +397,9 @@ export default {
projectIds() { projectIds() {
return this.$store.state.projectId return this.$store.state.projectId
}, },
moduleOptions() {
return this.$store.state.testCaseModuleOptions;
}
}, },
mounted() { mounted() {
this.getSelectOptions(); this.getSelectOptions();
@ -425,14 +424,14 @@ export default {
this.form.nodePath = this.treeNodes[0].path; this.form.nodePath = this.treeNodes[0].path;
} }
}, },
watch: { // watch: {
treeNodes() { // treeNodes() {
this.getModuleOptions(); // this.getModuleOptions();
}, // },
moduleOptions() { // moduleOptions() {
this.$emit('setModuleOptions', this.moduleOptions); // this.$emit('setModuleOptions', this.moduleOptions);
} // }
}, // },
created() { created() {
this.loadOptions(); this.loadOptions();
this.addListener(); // ctrl s this.addListener(); // ctrl s
@ -785,6 +784,7 @@ export default {
Object.assign(param, this.form); Object.assign(param, this.form);
param.steps = JSON.stringify(this.form.steps); param.steps = JSON.stringify(this.form.steps);
param.nodeId = this.form.module; param.nodeId = this.form.module;
param.nodePath = getNodePath(this.form.module, this.moduleOptions);
if (this.projectId) { if (this.projectId) {
param.projectId = this.projectId; param.projectId = this.projectId;
} }
@ -795,7 +795,7 @@ export default {
} }
param.testId = JSON.stringify(this.form.selected) param.testId = JSON.stringify(this.form.selected)
param.tags = this.form.tags; param.tags = this.form.tags;
param.type = 'functional' param.type = 'functional';
return param; return param;
}, },
getOption(param) { getOption(param) {
@ -856,13 +856,6 @@ export default {
this.form.testId = ''; this.form.testId = '';
this.getTestOptions() this.getTestOptions()
}, },
getModuleOptions() {
let moduleOptions = [];
this.treeNodes.forEach(node => {
buildNodePath(node, {path: ''}, moduleOptions);
});
this.moduleOptions = moduleOptions;
},
getMaintainerOptions() { getMaintainerOptions() {
let workspaceId = localStorage.getItem(WORKSPACE_ID); let workspaceId = localStorage.getItem(WORKSPACE_ID);
this.$post('/user/ws/member/tester/list', {workspaceId: workspaceId}, response => { this.$post('/user/ws/member/tester/list', {workspaceId: workspaceId}, response => {
@ -889,7 +882,6 @@ export default {
} }
}, },
getSelectOptions() { getSelectOptions() {
this.getModuleOptions();
this.getMaintainerOptions(); this.getMaintainerOptions();
this.getTestOptions(); this.getTestOptions();
if (this.type === 'edit') { if (this.type === 'edit') {

View File

@ -281,18 +281,9 @@ export default {
} }
}, },
props: { props: {
selectNodeIds: {
type: Array
},
selectParentNodes: {
type: Array
},
treeNodes: { treeNodes: {
type: Array type: Array
}, },
moduleOptions: {
type: Array
},
trashEnable: { trashEnable: {
type: Boolean, type: Boolean,
default: false, default: false,
@ -302,6 +293,12 @@ export default {
projectId() { projectId() {
return this.$store.state.projectId return this.$store.state.projectId
}, },
selectNodeIds() {
return this.$store.state.testCaseSelectNodeIds;
},
moduleOptions() {
return this.$store.state.testCaseModuleOptions;
}
}, },
created: function () { created: function () {
this.$emit('setCondition', this.condition); this.$emit('setCondition', this.condition);

View File

@ -38,6 +38,7 @@ import TestCaseCreate from "@/business/components/track/case/components/TestCase
import TestCaseImport from "@/business/components/track/case/components/TestCaseImport"; import TestCaseImport from "@/business/components/track/case/components/TestCaseImport";
import MsSearchBar from "@/business/components/common/components/search/MsSearchBar"; import MsSearchBar from "@/business/components/common/components/search/MsSearchBar";
import {buildTree} from "../../api/definition/model/NodeTree"; import {buildTree} from "../../api/definition/model/NodeTree";
import {buildNodePath} from "@/business/components/api/definition/model/NodeTree";
export default { export default {
name: "TestCaseNodeTree", name: "TestCaseNodeTree",
@ -119,6 +120,7 @@ export default {
this.treeNodes.forEach(node => { this.treeNodes.forEach(node => {
buildTree(node, {path: ''}); buildTree(node, {path: ''});
}); });
this.setModuleOptions();
if (this.$refs.nodeTree) { if (this.$refs.nodeTree) {
this.$refs.nodeTree.filter(); this.$refs.nodeTree.filter();
} }
@ -167,7 +169,18 @@ export default {
this.list(); this.list();
}); });
}, },
setModuleOptions() {
let moduleOptions = [];
this.treeNodes.forEach(node => {
buildNodePath(node, {path: ''}, moduleOptions);
});
this.$store.commit('setTestCaseModuleOptions', moduleOptions);
},
nodeChange(node, nodeIds, pNodes) { nodeChange(node, nodeIds, pNodes) {
this.$store.commit('setTestCaseSelectNode', node);
this.$store.commit('setTestCaseSelectNodeIds', nodeIds);
this.$emit("nodeSelectEvent", node, nodeIds, pNodes); this.$emit("nodeSelectEvent", node, nodeIds, pNodes);
this.currentModule = node.data; this.currentModule = node.data;
if (node.data.id === 'root') { if (node.data.id === 'root') {

View File

@ -4,6 +4,7 @@
:tree-nodes="treeNodes" :tree-nodes="treeNodes"
:data-map="dataMap" :data-map="dataMap"
:tags="tags" :tags="tags"
:select-node="selectNode"
:distinct-tags="tags" :distinct-tags="tags"
@save="save" @save="save"
ref="minder" ref="minder"
@ -17,6 +18,7 @@ import {
getTestCaseDataMap, getTestCaseDataMap,
parseCase, updateNode parseCase, updateNode
} from "@/business/components/track/common/minder/minderUtils"; } from "@/business/components/track/common/minder/minderUtils";
import {getNodePath} from "@/common/js/utils";
export default { export default {
name: "TestCaseMinder", name: "TestCaseMinder",
components: {MsModuleMinder}, components: {MsModuleMinder},
@ -38,7 +40,32 @@ name: "TestCaseMinder",
condition: Object, condition: Object,
projectId: String projectId: String
}, },
computed: {
selectNodeIds() {
return this.$store.state.testCaseSelectNodeIds;
},
selectNode() {
return this.$store.state.testCaseSelectNode;
},
moduleOptions() {
return this.$store.state.testCaseModuleOptions;
}
},
watch: {
selectNode() {
if (this.$refs.minder) {
this.$refs.minder.handleNodeSelect(this.selectNode);
}
// this.getTestCases();
}
},
mounted() { mounted() {
if (this.selectNode && this.selectNode.data) {
if (this.$refs.minder) {
let importJson = this.$refs.minder.getImportJsonBySelectNode(this.selectNode.data);
this.$refs.minder.setJsonImport(importJson);
}
}
this.$nextTick(() => { this.$nextTick(() => {
this.getTestCases(); this.getTestCases();
}) })
@ -46,14 +73,17 @@ name: "TestCaseMinder",
methods: { methods: {
getTestCases() { getTestCases() {
if (this.projectId) { if (this.projectId) {
this.result = this.$get('/test/case/list/detail/' + this.projectId,response => { let param = {
projectId: this.projectId,
nodeIds: this.selectNodeIds
}
this.result = this.$post('/test/case/list/minder', param,response => {
this.testCase = response.data; this.testCase = response.data;
this.dataMap = getTestCaseDataMap(this.testCase); this.dataMap = getTestCaseDataMap(this.testCase);
}); });
} }
}, },
save(data) { save(data) {
console.log(data);
let saveCases = []; let saveCases = [];
let deleteCases = []; let deleteCases = [];
this.buildSaveCase(data.root, saveCases, deleteCases, undefined); this.buildSaveCase(data.root, saveCases, deleteCases, undefined);
@ -92,7 +122,7 @@ name: "TestCaseMinder",
id: data.id, id: data.id,
name: data.text, name: data.text,
nodeId: parent ? parent.id : "", nodeId: parent ? parent.id : "",
nodePath: parent ? parent.path : "", nodePath: getNodePath(parent ? parent.id : '', this.moduleOptions),
type: data.type ? data.type : 'functional', type: data.type ? data.type : 'functional',
method: data.method ? data.method: 'manual', method: data.method ? data.method: 'manual',
maintainer: data.maintainer, maintainer: data.maintainer,

View File

@ -6,6 +6,7 @@
:tags="tags" :tags="tags"
:distinct-tags="[...tags, $t('test_track.plan.plan_status_prepare')]" :distinct-tags="[...tags, $t('test_track.plan.plan_status_prepare')]"
@save="save" @save="save"
ref="minder"
/> />
</template> </template>
@ -37,11 +38,30 @@ name: "TestPlanMinder",
}, },
projectId: String projectId: String
}, },
computed: {
selectNode() {
return this.$store.state.testPlanViewSelectNode;
}
},
mounted() { mounted() {
if (this.selectNode && this.selectNode.data) {
if (this.$refs.minder) {
let importJson = this.$refs.minder.getImportJsonBySelectNode(this.selectNode.data);
this.$refs.minder.setJsonImport(importJson);
}
}
this.$nextTick(() => { this.$nextTick(() => {
this.getTestCases(); this.getTestCases();
}) })
}, },
watch: {
selectNode() {
if (this.$refs.minder) {
this.$refs.minder.handleNodeSelect(this.selectNode);
}
// this.getTestCases();
}
},
methods: { methods: {
getTestCases() { getTestCases() {
if (this.projectId) { if (this.projectId) {

View File

@ -6,6 +6,7 @@
:tags="tags" :tags="tags"
:distinct-tags="[...tags, $t('test_track.plan.plan_status_prepare')]" :distinct-tags="[...tags, $t('test_track.plan.plan_status_prepare')]"
@save="save" @save="save"
ref="minder"
/> />
</template> </template>
@ -29,23 +30,46 @@ name: "TestReviewMinder",
return [] return []
} }
}, },
selectNodeIds: {
type: Array
},
reviewId: { reviewId: {
type: String type: String
}, },
projectId: String projectId: String
}, },
mounted() { mounted() {
if (this.selectNode && this.selectNode.data) {
if (this.$refs.minder) {
let importJson = this.$refs.minder.getImportJsonBySelectNode(this.selectNode.data);
this.$refs.minder.setJsonImport(importJson);
}
}
this.$nextTick(() => { this.$nextTick(() => {
this.getTestCases(); this.getTestCases();
}) })
}, },
watch: {
selectNode() {
if (this.$refs.minder) {
this.$refs.minder.handleNodeSelect(this.selectNode);
}
// this.getTestCases();
}
},
computed: {
selectNodeIds() {
return this.$store.state.testReviewSelectNodeIds;
},
selectNode() {
return this.$store.state.testReviewSelectNode;
}
},
methods: { methods: {
getTestCases() { getTestCases() {
if (this.projectId) { if (this.projectId) {
this.result = this.$post('/test/review/case/list/all', {reviewId: this.reviewId}, response => { let param = {
reviewId: this.reviewId,
nodeIds: this.selectNodeIds
};
this.result = this.$post('/test/review/case/list/all', param, response => {
this.dataMap = getTestCaseDataMap(response.data, true, (data, item) => { this.dataMap = getTestCaseDataMap(response.data, true, (data, item) => {
if (item.reviewStatus === 'Pass') { if (item.reviewStatus === 'Pass') {
data.resource.push(this.$t('test_track.plan_view.pass')); data.resource.push(this.$t('test_track.plan_view.pass'));

View File

@ -399,9 +399,6 @@ export default {
selectNodeIds: { selectNodeIds: {
type: Array type: Array
}, },
selectParentNodes: {
type: Array
}
}, },
watch: { watch: {
planId() { planId() {

View File

@ -24,7 +24,6 @@
:plan-id="planId" :plan-id="planId"
:clickType="clickType" :clickType="clickType"
:select-node-ids="selectNodeIds" :select-node-ids="selectNodeIds"
:select-parent-nodes="selectParentNodes"
ref="testPlanTestCaseList"/> ref="testPlanTestCaseList"/>
<test-plan-minder <test-plan-minder
:tree-nodes="treeNodes" :tree-nodes="treeNodes"
@ -67,9 +66,9 @@
return { return {
result: {}, result: {},
selectNodeIds: [], selectNodeIds: [],
selectParentNodes: [],
treeNodes: [], treeNodes: [],
activeDom: 'left', activeDom: 'left',
selectNode: {}
} }
}, },
props: [ props: [
@ -100,7 +99,7 @@
methods: { methods: {
refresh() { refresh() {
this.selectNodeIds = []; this.selectNodeIds = [];
this.selectParentNodes = []; this.$store.commit('setTestPlanViewSelectNode', {});
this.$refs.testCaseRelevance.search(); this.$refs.testCaseRelevance.search();
this.getNodeTreeByPlanId(); this.getNodeTreeByPlanId();
}, },
@ -112,10 +111,12 @@
}, },
nodeChange(node, nodeIds, pNodes) { nodeChange(node, nodeIds, pNodes) {
this.selectNodeIds = nodeIds; this.selectNodeIds = nodeIds;
this.selectParentNodes = pNodes; this.$store.commit('setTestPlanViewSelectNode', node);
// node // node
this.$refs.testPlanTestCaseList.currentPage = 1; if (this.$refs.testPlanTestCaseList) {
this.$refs.testPlanTestCaseList.pageSize = 10; this.$refs.testPlanTestCaseList.currentPage = 1;
this.$refs.testPlanTestCaseList.pageSize = 10;
}
}, },
getNodeTreeByPlanId() { getNodeTreeByPlanId() {
if (this.planId) { if (this.planId) {

View File

@ -138,6 +138,11 @@ export default {
reviewerOptions: [] reviewerOptions: []
}; };
}, },
computed: {
projectId() {
return this.$store.state.projectId;
}
},
methods: { methods: {
reload() { reload() {
this.isStepTableAlive = false; this.isStepTableAlive = false;
@ -180,10 +185,13 @@ export default {
if (!this.compareTime(new Date().getTime(), this.form.endTime)) { if (!this.compareTime(new Date().getTime(), this.form.endTime)) {
return false; return false;
} }
this.result = this.$post('/test/case/review/' + this.operationType, param, response => { param.projectId = this.projectId;
this.dialogFormVisible = false; if (this.projectId) {
this.$router.push('/track/review/view/' + response.data); this.result = this.$post('/test/case/review/' + this.operationType, param, response => {
}); this.dialogFormVisible = false;
this.$router.push('/track/review/view/' + response.data);
});
}
} else { } else {
return false; return false;
} }
@ -209,11 +217,14 @@ export default {
return false; return false;
} }
this.result = this.$post('/test/case/review/' + this.operationType, param, () => { param.projectId = this.projectId;
this.$success(this.$t('commons.save_success')); if (this.projectId) {
this.dialogFormVisible = false; this.result = this.$post('/test/case/review/' + this.operationType, param, () => {
this.$emit("refresh"); this.$success(this.$t('commons.save_success'));
}); this.dialogFormVisible = false;
this.$emit("refresh");
});
}
} else { } else {
return false; return false;

View File

@ -23,8 +23,6 @@
@openTestReviewRelevanceDialog="openTestReviewRelevanceDialog" @openTestReviewRelevanceDialog="openTestReviewRelevanceDialog"
@refresh="refresh" @refresh="refresh"
:review-id="reviewId" :review-id="reviewId"
:select-node-ids="selectNodeIds"
:select-parent-nodes="selectParentNodes"
:clickType="clickType" :clickType="clickType"
ref="testPlanTestCaseList"/> ref="testPlanTestCaseList"/>
<test-review-minder <test-review-minder
@ -63,8 +61,8 @@ export default {
result: {}, result: {},
testReviews: [], testReviews: [],
currentReview: {}, currentReview: {},
selectNodeIds: [], // selectNodeIds: [],
selectParentNodes: [], // selectParentNodes: [],
treeNodes: [], treeNodes: [],
isMenuShow: true, isMenuShow: true,
activeDom: 'left', activeDom: 'left',
@ -88,14 +86,14 @@ export default {
}, },
methods: { methods: {
refresh() { refresh() {
this.selectNodeIds = []; this.$store.commit('setTestReviewSelectNode', {});
this.selectParentNodes = []; this.$store.commit('setTestReviewSelectNodeIds', []);
this.$refs.testReviewRelevance.search(); this.$refs.testReviewRelevance.search();
this.getNodeTreeByReviewId(); this.getNodeTreeByReviewId();
}, },
nodeChange(node, nodeIds, pNodes) { nodeChange(node, nodeIds, pNodes) {
this.selectNodeIds = nodeIds; this.$store.commit('setTestReviewSelectNode', node);
this.selectParentNodes = pNodes; this.$store.commit('setTestReviewSelectNodeIds', nodeIds);
}, },
getNodeTreeByReviewId() { getNodeTreeByReviewId() {
if (this.reviewId) { if (this.reviewId) {

View File

@ -17,6 +17,7 @@
:select-ids="new Set(Array.from(this.selectRows).map(row => row.id))" @refresh="initTableData"/> :select-ids="new Set(Array.from(this.selectRows).map(row => row.id))" @refresh="initTableData"/>
<el-table <el-table
v-loading="result.loading"
class="adjust-table" class="adjust-table"
border border
@select-all="handleSelectAll" @select-all="handleSelectAll"
@ -277,12 +278,6 @@ export default {
reviewId: { reviewId: {
type: String type: String
}, },
selectNodeIds: {
type: Array
},
selectParentNodes: {
type: Array
}
}, },
watch: { watch: {
reviewId() { reviewId() {
@ -292,6 +287,11 @@ export default {
this.search(); this.search();
} }
}, },
computed: {
selectNodeIds() {
return this.$store.state.testReviewSelectNodeIds;
}
},
mounted() { mounted() {
this.refreshTableAndReview(); this.refreshTableAndReview();
this.isTestManagerOrTestUser = checkoutTestManagerOrTestUser(); this.isTestManagerOrTestUser = checkoutTestManagerOrTestUser();

View File

@ -376,3 +376,13 @@ export function publicKeyEncrypt(input, publicKey) {
return jsencrypt.encrypt(input); return jsencrypt.encrypt(input);
} }
export function getNodePath(id, moduleOptions) {
for (let i = 0; i < moduleOptions.length; i++) {
let item = moduleOptions[i];
if (id === item.id) {
return item.path;
}
}
return '';
}

View File

@ -1,6 +1,14 @@
const getters = { const getters = {
isNewVersion: state => state.versionSwitch === 'new', isNewVersion: state => state.versionSwitch === 'new',
isOldVersion: state => state.versionSwitch === 'old' isOldVersion: state => state.versionSwitch === 'old',
// getTestCaseNodePath(state, nodeId) {
// for (const index in state.moduleOptions) {
// let item = state.moduleOptions[index];
// if (nodeId === item.id) {
// return item.path;
// }
// }
// }
} }
export default getters export default getters

View File

@ -11,7 +11,17 @@ const state = {
test: {}, test: {},
versionSwitch: "new", versionSwitch: "new",
isReadOnly: true, isReadOnly: true,
theme: undefined theme: undefined,
testCaseSelectNode: {},
testCaseSelectNodeIds: [],
testCaseModuleOptions: [],
testReviewSelectNode: {},
testReviewSelectNodeIds: [],
testReviewModuleOptions: [],
testPlanViewSelectNode: {}
} }

View File

@ -3,7 +3,16 @@ const mutations = {
setTest: (state, test) => state.test = test, setTest: (state, test) => state.test = test,
clearTest: state => state.test = {}, clearTest: state => state.test = {},
setVersionSwitch: (state, value) => state.versionSwitch = value, setVersionSwitch: (state, value) => state.versionSwitch = value,
setTheme: (state, value) => state.theme = value setTheme: (state, value) => state.theme = value,
setTestCaseSelectNode: (state, value) => state.testCaseSelectNode = value,
setTestCaseSelectNodeIds: (state, value) => state.testCaseSelectNodeIds = value,
setTestCaseModuleOptions: (state, value) => state.testCaseModuleOptions = value,
setTestReviewSelectNode: (state, value) => state.testReviewSelectNode = value,
setTestReviewSelectNodeIds: (state, value) => state.testReviewSelectNodeIds = value,
setTestReviewModuleOptions: (state, value) => state.testReviewModuleOptions = value,
setTestPlanViewSelectNode: (state, value) => state.testPlanViewSelectNode = value,
} }
export default mutations; export default mutations;