refactor: 测试计划管理用例页面优化

This commit is contained in:
chenjianxing 2021-05-25 12:04:51 +08:00 committed by jianxing
parent 95b167e9ce
commit 9d95677c50
14 changed files with 284 additions and 342 deletions

View File

@ -4,6 +4,8 @@ import io.metersphere.base.domain.TestCase;
import io.metersphere.base.domain.TestCaseExample;
import io.metersphere.base.domain.TestCaseWithBLOBs;
import java.util.List;
import io.metersphere.controller.request.BaseQueryRequest;
import org.apache.ibatis.annotations.Param;
public interface TestCaseMapper {
@ -34,4 +36,6 @@ public interface TestCaseMapper {
int updateByPrimaryKeyWithBLOBs(TestCaseWithBLOBs record);
int updateByPrimaryKey(TestCase record);
}
List<String> selectIdsByQuery(BaseQueryRequest query);
}

View File

@ -94,8 +94,8 @@
</where>
</sql>
<sql id="Base_Column_List">
id, node_id, node_path, project_id, `name`, `type`, maintainer, priority, `method`,
create_time, update_time, test_id, sort, num, other_test_name, review_status, tags,
id, node_id, node_path, project_id, `name`, `type`, maintainer, priority, `method`,
create_time, update_time, test_id, sort, num, other_test_name, review_status, tags,
demand_id, demand_name, follow_people, `status`, custom_num, step_model, create_user
</sql>
<sql id="Blob_Column_List">
@ -132,7 +132,7 @@
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
select
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
@ -150,27 +150,27 @@
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.TestCaseWithBLOBs">
insert into test_case (id, node_id, node_path,
project_id, `name`, `type`,
maintainer, priority, `method`,
create_time, update_time, test_id,
sort, num, other_test_name,
review_status, tags, demand_id,
demand_name, follow_people, `status`,
custom_num, step_model, create_user,
prerequisite, remark, steps,
step_description, expected_result,
insert into test_case (id, node_id, node_path,
project_id, `name`, `type`,
maintainer, priority, `method`,
create_time, update_time, test_id,
sort, num, other_test_name,
review_status, tags, demand_id,
demand_name, follow_people, `status`,
custom_num, step_model, create_user,
prerequisite, remark, steps,
step_description, expected_result,
custom_fields)
values (#{id,jdbcType=VARCHAR}, #{nodeId,jdbcType=VARCHAR}, #{nodePath,jdbcType=VARCHAR},
#{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR},
#{maintainer,jdbcType=VARCHAR}, #{priority,jdbcType=VARCHAR}, #{method,jdbcType=VARCHAR},
#{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{testId,jdbcType=VARCHAR},
#{sort,jdbcType=INTEGER}, #{num,jdbcType=INTEGER}, #{otherTestName,jdbcType=VARCHAR},
#{reviewStatus,jdbcType=VARCHAR}, #{tags,jdbcType=VARCHAR}, #{demandId,jdbcType=VARCHAR},
#{demandName,jdbcType=VARCHAR}, #{followPeople,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
#{customNum,jdbcType=VARCHAR}, #{stepModel,jdbcType=VARCHAR}, #{createUser,jdbcType=VARCHAR},
#{prerequisite,jdbcType=LONGVARCHAR}, #{remark,jdbcType=LONGVARCHAR}, #{steps,jdbcType=LONGVARCHAR},
#{stepDescription,jdbcType=LONGVARCHAR}, #{expectedResult,jdbcType=LONGVARCHAR},
values (#{id,jdbcType=VARCHAR}, #{nodeId,jdbcType=VARCHAR}, #{nodePath,jdbcType=VARCHAR},
#{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR},
#{maintainer,jdbcType=VARCHAR}, #{priority,jdbcType=VARCHAR}, #{method,jdbcType=VARCHAR},
#{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{testId,jdbcType=VARCHAR},
#{sort,jdbcType=INTEGER}, #{num,jdbcType=INTEGER}, #{otherTestName,jdbcType=VARCHAR},
#{reviewStatus,jdbcType=VARCHAR}, #{tags,jdbcType=VARCHAR}, #{demandId,jdbcType=VARCHAR},
#{demandName,jdbcType=VARCHAR}, #{followPeople,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
#{customNum,jdbcType=VARCHAR}, #{stepModel,jdbcType=VARCHAR}, #{createUser,jdbcType=VARCHAR},
#{prerequisite,jdbcType=LONGVARCHAR}, #{remark,jdbcType=LONGVARCHAR}, #{steps,jdbcType=LONGVARCHAR},
#{stepDescription,jdbcType=LONGVARCHAR}, #{expectedResult,jdbcType=LONGVARCHAR},
#{customFields,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestCaseWithBLOBs">
@ -366,7 +366,10 @@
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
<select id="selectIdsByQuery" resultType="java.lang.String">
</select>
<update id="updateByExampleSelective" parameterType="map">
update test_case
<set>
<if test="record.id != null">
@ -683,4 +686,4 @@
create_user = #{createUser,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>
</mapper>

View File

@ -90,4 +90,6 @@ public interface ExtTestCaseMapper {
List<TestCaseDTO> getTestCaseByIds(@Param("ids")List<String> ids);
void updateTestCaseCustomNumByProjectId(@Param("projectId") String projectId);
List<String> selectRelateIdsByQuery(@Param("request") BaseQueryRequest query);
}

View File

@ -116,8 +116,9 @@
</sql>
<select id="getTestCaseByNotInPlan" resultType="io.metersphere.base.domain.TestCase">
select test_case.id, test_case.name, test_case.priority, test_case.type, test_case.review_status from test_case
as test_case
select test_case.id, test_case.name, test_case.priority, test_case.type, test_case.review_status,
test_case.num, test_case.custom_num, test_case.priority, test_case.tags, test_case.create_time, test_case.update_time
from test_case as test_case
left join test_plan_test_case as T2 on test_case.id=T2.case_id and T2.plan_id =#{request.planId}
<include refid="notInQueryWhereCondition"></include>
and T2.case_id is null
@ -438,4 +439,11 @@
</foreach>
</where>
</select>
<select id="selectRelateIdsByQuery" resultType="java.lang.String">
select test_case.id as id
from test_case as test_case
left join test_plan_test_case as T2 on test_case.id=T2.case_id and T2.plan_id =#{request.planId}
<include refid="notInQueryWhereCondition"/>
and T2.case_id is null
</select>
</mapper>

View File

@ -14,6 +14,8 @@ public class PlanCaseRelevanceRequest {
*/
private String planId;
private List<String> ids;
/**
* 当选择关联全部用例时把加载条件送到后台从后台查询
*/

View File

@ -1,13 +1,10 @@
package io.metersphere.track.request.testcase;
import io.metersphere.base.domain.TestCase;
import io.metersphere.controller.request.BaseQueryRequest;
import io.metersphere.controller.request.OrderRequest;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
import java.util.Map;
@Getter
@Setter

View File

@ -444,46 +444,33 @@ public class TestPlanService {
public void testPlanRelevance(PlanCaseRelevanceRequest request) {
List<String> testCaseIds = request.getTestCaseIds();
ServiceUtils.getSelectAllIds(request, request.getRequest(),
(query) -> extTestCaseMapper.selectRelateIdsByQuery(query));
List<String> testCaseIds = request.getIds();
if (testCaseIds.isEmpty()) {
return;
}
// 如果是关联全部指令则根据条件查询未关联的案例
if (testCaseIds.get(0).equals("all")) {
List<TestCase> testCases = extTestCaseMapper.getTestCaseByNotInPlan(request.getRequest());
if (!testCases.isEmpty()) {
testCaseIds = testCases.stream().map(testCase -> testCase.getId()).collect(Collectors.toList());
}
}
TestCaseExample testCaseExample = new TestCaseExample();
testCaseExample.createCriteria().andIdIn(testCaseIds);
Map<String, TestCaseWithBLOBs> testCaseMap =
testCaseMapper.selectByExampleWithBLOBs(testCaseExample)
.stream()
.collect(Collectors.toMap(TestCase::getId, testcase -> testcase));
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
TestPlanTestCaseMapper batchMapper = sqlSession.getMapper(TestPlanTestCaseMapper.class);
if (!testCaseIds.isEmpty()) {
testCaseIds.forEach(caseId -> {
TestCaseWithBLOBs testCase = testCaseMap.get(caseId);
TestPlanTestCaseWithBLOBs testPlanTestCase = new TestPlanTestCaseWithBLOBs();
testPlanTestCase.setId(UUID.randomUUID().toString());
testPlanTestCase.setCreateUser(SessionUtils.getUserId());
testPlanTestCase.setExecutor(SessionUtils.getUser().getId());
testPlanTestCase.setCaseId(caseId);
testPlanTestCase.setCreateTime(System.currentTimeMillis());
testPlanTestCase.setUpdateTime(System.currentTimeMillis());
testPlanTestCase.setPlanId(request.getPlanId());
testPlanTestCase.setStatus(TestPlanStatus.Prepare.name());
testPlanTestCase.setResults(testCase.getSteps());
batchMapper.insert(testPlanTestCase);
});
}
testCaseIds.forEach(caseId -> {
TestPlanTestCaseWithBLOBs testPlanTestCase = new TestPlanTestCaseWithBLOBs();
testPlanTestCase.setId(UUID.randomUUID().toString());
testPlanTestCase.setCreateUser(SessionUtils.getUserId());
testPlanTestCase.setExecutor(SessionUtils.getUser().getId());
testPlanTestCase.setCaseId(caseId);
testPlanTestCase.setCreateTime(System.currentTimeMillis());
testPlanTestCase.setUpdateTime(System.currentTimeMillis());
testPlanTestCase.setPlanId(request.getPlanId());
testPlanTestCase.setStatus(TestPlanStatus.Prepare.name());
batchMapper.insert(testPlanTestCase);
});
sqlSession.flushStatements();
//同步添加关联的接口和测试用例
@ -548,11 +535,8 @@ public class TestPlanService {
if (testPlanApiScenarioMapper.countByExample(example) <= 0) {
testPlanApiScenarioMapper.insert(t);
}
}
});
});
}
}

View File

@ -77,6 +77,7 @@ export default {
return {
selectDataCounts: 0,
selectRows: new Set(),
selectIds: []
};
},
props: {
@ -159,11 +160,6 @@ export default {
this.selectDataCounts = 0;
},
},
computed: {
selectIds() {
return Array.from(this.selectRows).map(o => o.id);
}
},
methods: {
openCustomHeader() {
this.$emit("openCustomHeader");
@ -177,6 +173,7 @@ export default {
_handleSelect(this, selection, row, this.selectRows);
setUnSelectIds(this.data, this.condition, this.selectRows);
this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows);
this.selectIds = Array.from(this.selectRows).map(o => o.id);
},
isSelectDataAll(data) {
this.condition.selectAll = data;
@ -235,23 +232,24 @@ export default {
this.$emit('pageChange');
},
clear() {
this.selectRows.clear();
this.selectDataCounts = 0;
this.clearSelectRows();
},
checkTableRowIsSelect() {
checkTableRowIsSelect(this, this.condition, this.data, this.$refs.table, this.selectRows);
},
clearSelection() {
this.selectRows = new Set();
if (this.$refs.table) {
this.$refs.table.clearSelection();
}
this.clearSelectRows();
},
getSelectRows() {
return this.selectRows;
},
clearSelectRows() {
this.selectRows = new Set();
this.selectRows.clear();
this.selectIds = [];
this.selectDataCounts = 0;
if (this.$refs.table) {
this.$refs.table.clearSelection();
}
},
}
};

View File

@ -337,7 +337,11 @@ export default {
this.result = this.$get('/test/plan/case/get/' + testCase.id, response => {
let item = {};
Object.assign(item, response.data);
item.results = JSON.parse(item.results);
if (item.results) {
item.results = JSON.parse(item.results);
} else {
item.results = [item.steps.length];
}
if (item.issues) {
item.issues = JSON.parse(item.issues);
} else {

View File

@ -83,23 +83,8 @@
</template>
</el-table-column>
<el-table-column
v-if="item.id=='type'"
prop="type"
:filters="typeFilters"
column-key="type"
:label="$t('test_track.case.type')"
min-width="80px"
:key="index"
show-overflow-tooltip>
<template v-slot:default="scope">
<type-table-item :value="scope.row.type"/>
</template>
</el-table-column>
<el-table-column v-if="item.id=='tags'" prop="tags" :label="$t('commons.tag')" min-width="120px"
:key="index"
>
:key="index">
<template v-slot:default="scope">
<ms-tag v-for="(tag, index) in scope.row.showTags" :key="tag + '_' + index" type="success" effect="plain"
:content="tag" style="margin-left: 0px; margin-right: 2px"/>

View File

@ -15,55 +15,73 @@
ref="nodeTree"/>
</template>
<ms-table-header :condition.sync="condition" @search="search" title="" :show-create="false"/>
<ms-table-header :condition.sync="page.condition" @search="search" title="" :show-create="false"/>
<el-table
v-loading="result.loading"
:data="testCases"
@filter-change="filter"
row-key="id"
@mouseleave.passive="leave"
v-el-table-infinite-scroll="scrollLoading"
@select-all="handleSelectAll"
@select="handleSelectionChange"
height="50vh"
<ms-table
v-loading="page.result.loading"
:data="page.data"
:condition="page.condition"
:total="page.total"
:page-size.sync="page.pageSize"
:screen-height="null"
@handlePageChange="search"
@refresh="search"
ref="table">
<el-table-column
type="selection"></el-table-column>
<ms-table-column
v-if="!customNum"
prop="num"
sortable
:label="$t('commons.id')">
</ms-table-column>
<ms-table-column
v-if="customNum"
prop="customNum"
sortable
:label="$t('commons.id')">
</ms-table-column>
<el-table-column
prop="name"
:label="$t('test_track.case.name')"
style="width: 100%">
<template v-slot:default="scope">
{{scope.row.name}}
</template>
</el-table-column>
<el-table-column
<ms-table-column prop="name" :label="$t('commons.name')"/>
<ms-table-column
prop="priority"
:filters="priorityFilters"
column-key="priority"
:label="$t('test_track.case.priority')"
show-overflow-tooltip>
sortable
:label="$t('test_track.case.priority')">
<template v-slot:default="scope">
<priority-table-item :value="scope.row.priority"/>
</template>
</el-table-column>
<el-table-column
prop="type"
:filters="typeFilters"
column-key="type"
:label="$t('test_track.case.type')"
show-overflow-tooltip>
<template v-slot:default="scope">
<type-table-item :value="scope.row.type"/>
</template>
</el-table-column>
</el-table>
</ms-table-column>
<div v-if="!lineStatus" style="text-align: center">{{ $t('test_track.review_view.last_page') }}</div>
<div style="text-align: center"> {{ total }} </div>
<ms-table-column prop="tags" :label="$t('commons.tag')">
<template v-slot:default="scope">
<ms-tag v-for="(itemName, index) in scope.row.tags" :key="index" type="success" effect="plain"
:content="itemName" style="margin-left: 0px; margin-right: 2px"/>
<span/>
</template>
</ms-table-column>
<ms-table-column
sortable
:label="$t('commons.create_time')"
prop="createTime">
<template v-slot="scope">
<span>{{ scope.row.createTime | timestampFormatDate }}</span>
</template>
</ms-table-column>
<ms-table-column
sortable
:label="$t('commons.update_time')"
prop="updateTime">
<template v-slot="scope">
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
</template>
</ms-table-column>
</ms-table>
<ms-table-pagination :change="search" :current-page.sync="page.currentPage" :page-size.sync="page.pageSize" :total="page.total"/>
</test-case-relevance-base>
</template>
@ -76,15 +94,21 @@ import TypeTableItem from "../../../../common/tableItems/planview/TypeTableItem"
import MsTableSearchBar from "../../../../../common/components/MsTableSearchBar";
import MsTableAdvSearchBar from "../../../../../common/components/search/MsTableAdvSearchBar";
import MsTableHeader from "../../../../../common/components/MsTableHeader";
import {TEST_CASE_CONFIGS} from "../../../../../common/components/search/search-components";
import elTableInfiniteScroll from 'el-table-infinite-scroll';
import TestCaseRelevanceBase from "../base/TestCaseRelevanceBase";
import {_filter} from "@/common/js/tableUtils";
import {buildPagePath, getPageDate, getPageInfo} from "@/common/js/tableUtils";
import MsTableColumn from "@/business/components/common/components/table/Ms-table-column";
import MsTable from "@/business/components/common/components/table/MsTable";
import MsTablePagination from "@/business/components/common/pagination/TablePagination";
import MsTag from "@/business/components/common/components/MsTag";
export default {
name: "TestCaseFunctionalRelevance",
components: {
MsTag,
MsTablePagination,
MsTable,
MsTableColumn,
TestCaseRelevanceBase,
NodeTree,
PriorityTableItem,
@ -93,212 +117,138 @@ export default {
MsTableAdvSearchBar,
MsTableHeader,
},
directives: {
'el-table-infinite-scroll': elTableInfiniteScroll
data() {
return {
result: {},
treeNodes: [],
selectNodeIds: [],
selectNodeNames: [],
projectId: '',
projectName: '',
projects: [],
page: getPageInfo(),
customNum: false,
priorityFilters: [
{text: 'P0', value: 'P0'},
{text: 'P1', value: 'P1'},
{text: 'P2', value: 'P2'},
{text: 'P3', value: 'P3'}
]
};
},
props: {
planId: {
type: String
}
},
watch: {
planId() {
this.page.condition.planId = this.planId;
},
data() {
return {
result: {},
isCheckAll: false,
testCases: [],
selectIds: new Set(),
treeNodes: [],
selectNodeIds: [],
selectNodeNames: [],
projectId: '',
projectName: '',
projects: [],
pageSize: 50,
currentPage: 1,
total: 0,
lineStatus: true,
condition: {
components: TEST_CASE_CONFIGS
},
priorityFilters: [
{text: 'P0', value: 'P0'},
{text: 'P1', value: 'P1'},
{text: 'P2', value: 'P2'},
{text: 'P3', value: 'P3'}
],
typeFilters: [
{text: this.$t('commons.functional'), value: 'functional'},
{text: this.$t('commons.performance'), value: 'performance'},
{text: this.$t('commons.api'), value: 'api'}
]
};
selectNodeIds() {
this.search();
},
props: {
planId: {
type: String
projectId() {
this.page.condition.projectId = this.projectId;
this.getProjectNode();
this.search();
this.getProject();
}
},
methods: {
open() {
this.$refs.baseRelevance.open();
if (this.$refs.table) {
this.$refs.table.clear();
}
},
watch: {
planId() {
this.condition.planId = this.planId;
},
selectNodeIds() {
this.search();
},
projectId() {
this.condition.projectId = this.projectId;
this.getProjectNode();
this.search();
}
setProject(projectId) {
this.projectId = projectId;
},
updated() {
this.toggleSelection(this.testCases);
},
methods: {
open() {
this.$refs.baseRelevance.open();
},
setProject(projectId) {
this.projectId = projectId;
},
saveCaseRelevance(item) {
let param = {};
param.planId = this.planId;
param.testCaseIds = [...this.selectIds];
param.request = this.condition;
param.checked = item
//
if (this.testCases.length === param.testCaseIds.length) {
param.testCaseIds = ['all'];
getProject() {
this.$get("/project/get/" + this.projectId, result => {
let data = result.data;
if (data) {
this.customNum = data.customNum;
}
this.result = this.$post('/test/plan/relevance', param, () => {
this.selectIds.clear();
this.$success(this.$t('commons.save_success'));
this.$refs.baseRelevance.close();
this.$emit('refresh');
})
},
saveCaseRelevance(item) {
let param = {};
param.planId = this.planId;
param.ids = this.$refs.table.selectIds;
param.request = this.page.condition;
param.checked = item
this.result = this.$post('/test/plan/relevance', param, () => {
this.$success(this.$t('commons.save_success'));
this.$refs.baseRelevance.close();
this.$emit('refresh');
});
},
search() {
this.getTestCases();
},
getTestCases() {
let condition = this.page.condition;
if (this.planId) {
condition.planId = this.planId;
}
if (this.selectNodeIds && this.selectNodeIds.length > 0) {
condition.nodeIds = this.selectNodeIds;
} else {
condition.nodeIds = [];
}
if (this.projectId) {
condition.projectId = this.projectId;
this.page.result = this.$post(buildPagePath('/test/case/relate', this.page), condition, response => {
getPageDate(response, this.page);
let data = this.page.data;
data.forEach(item => {
item.checked = false;
item.tags = JSON.parse(item.tags);
});
});
},
buildPagePath(path) {
return path + "/" + this.currentPage + "/" + this.pageSize;
},
search() {
this.currentPage = 1;
this.testCases = [];
this.getTestCases(true);
},
getTestCases(flag) {
if (this.planId) {
this.condition.planId = this.planId;
}
if (this.selectNodeIds && this.selectNodeIds.length > 0) {
this.condition.nodeIds = this.selectNodeIds;
} else {
this.condition.nodeIds = [];
}
if (this.projectId) {
this.condition.projectId = this.projectId;
this.result = this.$post(this.buildPagePath('/test/case/relate'), this.condition, response => {
let data = response.data;
this.total = data.itemCount;
let tableData = data.listObject;
tableData.forEach(item => {
item.checked = false;
});
flag ? this.testCases = tableData : this.testCases = this.testCases.concat(tableData);
//
let hash = {};
this.testCases = this.testCases.reduce((item, next) => {
if (!hash[next.id]) {
hash[next.id] = true
item.push(next)
}
return item
}, [])
this.lineStatus = tableData.length === 50 && this.testCases.length < this.total;
});
}
},
handleSelectAll(selection) {
if (selection.length > 0) {
this.testCases.forEach(item => {
this.selectIds.add(item.id);
});
} else {
this.testCases.forEach(item => {
if (this.selectIds.has(item.id)) {
this.selectIds.delete(item.id);
}
});
}
},
handleSelectionChange(selection, row) {
if (this.selectIds.has(row.id)) {
this.selectIds.delete(row.id);
} else {
this.selectIds.add(row.id);
}
},
nodeChange(node, nodeIds, nodeNames) {
this.selectNodeIds = nodeIds;
this.selectNodeNames = nodeNames;
},
refresh() {
this.close();
},
scrollLoading() {
if (this.lineStatus) {
this.currentPage += 1;
this.getTestCases();
}
},
getAllNodeTreeByPlanId() {
if (this.planId) {
let param = {
testPlanId: this.planId,
projectId: this.projectId
};
this.result = this.$post("/case/node/list/all/plan", param, response => {
this.treeNodes = response.data;
});
}
},
close() {
this.lineStatus = false;
this.selectIds.clear();
this.selectNodeIds = [];
this.selectNodeNames = [];
},
filter(filters) {
_filter(filters, this.condition);
this.search();
},
toggleSelection(rows) {
rows.forEach(row => {
this.selectIds.forEach(id => {
if (row.id === id) {
// true
this.$refs.table.toggleRowSelection(row, true)
}
})
})
},
getProjectNode(projectId) {
const index = this.projects.findIndex(project => project.id === projectId);
if (index !== -1) {
this.projectName = this.projects[index].name;
}
if (projectId) {
this.projectId = projectId;
}
this.$refs.nodeTree.result = this.$post("/case/node/list/all/plan",
{testPlanId: this.planId, projectId: this.projectId}, response => {
this.treeNodes = response.data;
});
this.selectNodeIds = [];
}
},
nodeChange(node, nodeIds, nodeNames) {
this.selectNodeIds = nodeIds;
this.selectNodeNames = nodeNames;
},
refresh() {
this.close();
},
getAllNodeTreeByPlanId() {
if (this.planId) {
let param = {
testPlanId: this.planId,
projectId: this.projectId
};
this.result = this.$post("/case/node/list/all/plan", param, response => {
this.treeNodes = response.data;
});
}
},
close() {
this.selectNodeIds = [];
this.selectNodeNames = [];
this.$refs.table.clear();
},
getProjectNode(projectId) {
const index = this.projects.findIndex(project => project.id === projectId);
if (index !== -1) {
this.projectName = this.projects[index].name;
}
if (projectId) {
this.projectId = projectId;
}
this.$refs.nodeTree.result = this.$post("/case/node/list/all/plan",
{testPlanId: this.planId, projectId: this.projectId}, response => {
this.treeNodes = response.data;
});
this.selectNodeIds = [];
}
}
}
</script>
<style scoped>

View File

@ -205,3 +205,13 @@ export function getPageInfo() {
condition: {},
}
}
export function buildPagePath(path, page) {
return path + "/" + page.currentPage + "/" + page.pageSize;
}
export function getPageDate(response, page) {
let data = response.data;
page.total = data.itemCount;
page.data = data.listObject;
}

View File

@ -1,7 +1,8 @@
import {post} from "@/common/js/ajax";
import {getPageDate} from "@/network/network-utils";
import {getPageDate} from "@/common/js/tableUtils";
export function buildIssues(data, page) {
export function buildIssues(page) {
let data = page.data;
for (let i = 0; i < data.length; i++) {
if (data[i]) {
if (data[i].platform !== 'Local') {
@ -9,13 +10,12 @@ export function buildIssues(data, page) {
}
}
}
page.data = data;
}
export function getIssues(page) {
return post('issues/list/' + page.currentPage + '/' + page.pageSize, page.condition, (response) => {
let data = getPageDate(response, page);
buildIssues(data, page);
getPageDate(response, page);
buildIssues(page);
});
}
@ -44,8 +44,8 @@ export function testCaseIssueRelate(param, success) {
export function getRelateIssues(page) {
return post('issues/list/relate/' + page.currentPage + '/' + page.pageSize, page.condition, (response) => {
let data = getPageDate(response, page);
buildIssues(data, page);
getPageDate(response, page);
buildIssues(page);
});
}

View File

@ -1,5 +0,0 @@
export function getPageDate(response, page) {
let data = response.data;
page.total = data.itemCount;
return data.listObject;
}