fix(测试跟踪): 功能用例列表页批量操作问题

--bug=1022779 --user=宋昌昌 【测试跟踪】功能用例批量复制、批量移动功能没有生效 https://www.tapd.cn/55049933/s/1335738
This commit is contained in:
song-cc-rock 2023-02-15 15:56:56 +08:00 committed by 刘瑞斌
parent 0cf34d4f25
commit 151ab0a3d1
14 changed files with 62 additions and 14 deletions

View File

@ -63,6 +63,8 @@ export default {
i.el-icon-delete { i.el-icon-delete {
margin-top: 10px; margin-top: 10px;
margin-left: 24px; margin-left: 24px;
min-width: 200px;
display: flex;
} }
.el-icon-delete:before { .el-icon-delete:before {

View File

@ -24,7 +24,7 @@
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
<i class="delimiter">|</i> <i class="delimiter">|</i>
<el-button size="mini" icon="el-icon-close" @click="close" style="float: right; margin: 5px 19px;"></el-button> <el-button size="mini" icon="el-icon-close" @click="close" style="margin: 0 30px 0 20px"></el-button>
</div> </div>
</el-col> </el-col>
</el-row> </el-row>
@ -57,12 +57,14 @@ export default {
</script> </script>
<style scoped> <style scoped>
.name-edit {
padding-left: 10px;
}
.head-bar { .head-bar {
background: white; background: white;
height: 45px; height: 45px;
line-height: 45px; line-height: 45px;
padding: 0 10px;
border: 1px solid #EBEEF5; border: 1px solid #EBEEF5;
box-shadow: 0 0 2px 0 rgba(31, 31, 31, 0.15), 0 1px 2px 0 rgba(31, 31, 31, 0.15); box-shadow: 0 0 2px 0 rgba(31, 31, 31, 0.15), 0 1px 2px 0 rgba(31, 31, 31, 0.15);
} }
@ -135,4 +137,13 @@ i.delimiter {
top: -2px; top: -2px;
left: 15px; left: 15px;
} }
.ms-export {
float: right;
}
:deep(.el-icon-close:before) {
position: relative;
top: 2px;
}
</style> </style>

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="recycle" v-if="this.isXpack" @click="exe"> <div class="recycle" v-if="this.isXpack" @click="exe">
<div style="padding: 9px 13px 9px 13px;" class="to-public"> <div style="padding: 9px 13px 9px 13px;" class="to-public">
<svg-icon icon-class="icon_folder-share" style="width: 1.3em;height: 1.3em;position: relative;top: 4px;left: 1px;margin-right: 9px;"/> <svg-icon icon-class="icon_folder-share" style="width: 1.3em;height: 1.3em;position: relative;top: 2px;left: 1px;margin-right: 9px;"/>
<span style="margin-right: 12px;">{{ $t('project.case_public') }}</span> <span style="margin-right: 12px;">{{ $t('project.case_public') }}</span>
<span style="color: #8F959E">{{ '(' + publicTotal + ')' }}</span> <span style="color: #8F959E">{{ '(' + publicTotal + ')' }}</span>
</div> </div>
@ -73,6 +73,7 @@ export default {
width: auto; width: auto;
border-radius: 4px; border-radius: 4px;
display: flex; display: flex;
overflow-x: hidden;
} }
.to-public:hover { .to-public:hover {

View File

@ -700,7 +700,7 @@ export default {
:deep(.node-icon .svg-icon) { :deep(.node-icon .svg-icon) {
width: 1.2em; width: 1.2em;
height: 1.2em; height: 1.2em;
margin-top: 4px; margin-top: 2px;
} }
.node-title { .node-title {

View File

@ -373,8 +373,15 @@ export default {
} }
}, },
handleSelectAll(selection) { handleSelectAll(selection) {
if (this.condition.selectAll) {
return;
}
_handleSelectAll(this, selection, this.data, this.selectRows, this.condition); _handleSelectAll(this, selection, this.data, this.selectRows, this.condition);
if (this.condition.selectAll) {
this.condition.unSelectIds = [];
} else {
setUnSelectIds(this.data, this.condition, this.selectRows); setUnSelectIds(this.data, this.condition, this.selectRows);
}
this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows); this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows);
this.selectIds = Array.from(this.selectRows).map(o => o.id); this.selectIds = Array.from(this.selectRows).map(o => o.id);
// //
@ -422,7 +429,7 @@ export default {
// //
this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows); this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows);
this.selectIds = Array.from(this.selectRows).map(o => o.id); this.selectIds = Array.from(this.selectRows).map(o => o.id);
this.$emit('callBackSelect'); this.$emit(data ? 'callBackSelectAll' : 'callBackSelect');
}, },
headerDragend(newWidth, oldWidth, column, event) { headerDragend(newWidth, oldWidth, column, event) {
if (column) { if (column) {

View File

@ -352,6 +352,7 @@ export default {
.search-item { .search-item {
display: block; display: block;
width: 100%; width: 100%;
margin-left: -15px;
} }
.delete-icon { .delete-icon {
@ -370,6 +371,7 @@ export default {
height: 26px; height: 26px;
width: 112px; width: 112px;
border-radius: 4px; border-radius: 4px;
float: left;
} }
:deep(span.el-select__tags-text) { :deep(span.el-select__tags-text) {
@ -431,7 +433,7 @@ span.condition-num {
:deep(button.el-button.el-button--default.el-button--mini svg) { :deep(button.el-button.el-button--default.el-button--mini svg) {
position: relative; position: relative;
right: 7px; right: 7px;
top: 1px; top: -1px;
width: 14px; width: 14px;
height: 14px; height: 14px;
} }

View File

@ -14,7 +14,6 @@
@change="changeTreeTag" @change="changeTreeTag"
class="search-select" class="search-select"
size="small" size="small"
collapse-tags
multiple> multiple>
<div class="search-div"> <div class="search-div">
<el-option <el-option

View File

@ -1412,7 +1412,7 @@
inner join project p on p.id = test_case.project_id inner join project p on p.id = test_case.project_id
<include refid="queryWhereCondition"/> <include refid="queryWhereCondition"/>
and p.workspace_id = #{request.workspaceId} and p.workspace_id = #{request.workspaceId}
group by tcn.id; group by tcn.id, test_case.project_id;
</select> </select>
<update id="updateNoModuleTrashNodeToDefault"> <update id="updateNoModuleTrashNodeToDefault">

View File

@ -80,6 +80,7 @@ import java.nio.charset.StandardCharsets;
import java.util.*; import java.util.*;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream;
@Service @Service
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@ -1894,6 +1895,12 @@ public class TestCaseService {
batchEditTag(request); batchEditTag(request);
} else { } else {
// 批量移动 // 批量移动
if (request.getCondition().isSelectAll()) {
// 全选则重新设置MoveIds
List<TestCaseDTO> testCaseDTOS = listTestCase(request.getCondition());
List<String> ids = testCaseDTOS.stream().map(TestCaseDTO::getId).collect(Collectors.toList());
request.setIds(ids);
}
TestCaseWithBLOBs batchEdit = new TestCaseWithBLOBs(); TestCaseWithBLOBs batchEdit = new TestCaseWithBLOBs();
BeanUtils.copyBean(batchEdit, request); BeanUtils.copyBean(batchEdit, request);
batchEdit.setUpdateTime(System.currentTimeMillis()); batchEdit.setUpdateTime(System.currentTimeMillis());

View File

@ -248,5 +248,24 @@ button.el-button.el-button--default.el-button--small.el-button--danger {
.el-icon-warning:before, .el-icon-success:before { .el-icon-warning:before, .el-icon-success:before {
font-size: 17px; font-size: 17px;
} }
/**
* el-icon-close
*/
i.el-tag__close.el-icon-close {
height: 0;
}
.el-select .el-tag__close.el-icon-close::before {
font-size: 26px;
position: relative;
top: -7px;
left: -6px;
}
.el-tag.el-tag--info .el-tag__close:hover {
color: #1F2329;
background-color: #909399;
}
</style> </style>

View File

@ -143,7 +143,6 @@
:tree-nodes="treeNodes" :tree-nodes="treeNodes"
:version-enable="versionEnable" :version-enable="versionEnable"
@refreshTable="refresh" @refreshTable="refresh"
@testCaseCopy="copyTestCase"
@refresh="refresh" @refresh="refresh"
@refreshAll="refreshAll" @refreshAll="refreshAll"
@refreshPublic="refreshPublic" @refreshPublic="refreshPublic"

View File

@ -77,12 +77,13 @@ export default {
} }
}, },
methods: { methods: {
open(isMoveBatch, caseTitle, treeNodes, selectNum, moduleOptions) { open(isMoveBatch, caseTitle, treeNodes, selectNum, selectIds, moduleOptions) {
this.isMoveBatch = isMoveBatch; this.isMoveBatch = isMoveBatch;
this.moveCaseTitle = caseTitle; this.moveCaseTitle = caseTitle;
this.dialogVisible = true; this.dialogVisible = true;
this.treeNodes = treeNodes; this.treeNodes = treeNodes;
this.selectNum = selectNum; this.selectNum = selectNum;
this.selectIds = selectIds;
this.moduleOptions = moduleOptions; this.moduleOptions = moduleOptions;
}, },
save() { save() {

View File

@ -1151,12 +1151,12 @@ export default {
handleBatchMove() { handleBatchMove() {
this.isMoveBatch = true; this.isMoveBatch = true;
let firstSelectRow = this.$refs.table.selectRows.values().next().value; let firstSelectRow = this.$refs.table.selectRows.values().next().value;
this.$refs.testBatchMove.open(this.isMoveBatch, firstSelectRow.name, this.treeNodes, this.selectCounts, this.moduleOptions); this.$refs.testBatchMove.open(this.isMoveBatch, firstSelectRow.name, this.treeNodes, this.selectCounts, this.$refs.table.selectIds, this.moduleOptions);
}, },
handleBatchCopy() { handleBatchCopy() {
this.isMoveBatch = false; this.isMoveBatch = false;
let firstSelectRow = this.$refs.table.selectRows.values().next().value; let firstSelectRow = this.$refs.table.selectRows.values().next().value;
this.$refs.testBatchMove.open(this.isMoveBatch, firstSelectRow.name, this.treeNodes, this.selectCounts, this.moduleOptions); this.$refs.testBatchMove.open(this.isMoveBatch, firstSelectRow.name, this.treeNodes, this.selectCounts, this.$refs.table.selectIds, this.moduleOptions);
}, },
_handleDeleteVersion(testCase, deleteCurrentVersion) { _handleDeleteVersion(testCase, deleteCurrentVersion) {
// //

View File

@ -352,7 +352,7 @@
or test_case.tags like CONCAT('%', #{request.name},'%') or test_case.tags like CONCAT('%', #{request.name},'%')
or test_case.custom_num like CONCAT('%', #{request.name},'%')) or test_case.custom_num like CONCAT('%', #{request.name},'%'))
</if> </if>
<if test="request.ids != null"> <if test="request.ids != null and request.ids.size() > 0">
and test_case.id in and test_case.id in
<foreach collection="request.ids" item="id" separator="," open="(" close=")"> <foreach collection="request.ids" item="id" separator="," open="(" close=")">
#{id} #{id}