feat(用例评审): 批量取消用例关联

This commit is contained in:
shiziyuan9527 2020-09-22 17:23:07 +08:00
parent 6e2069e011
commit 37ced87b76
9 changed files with 95 additions and 110 deletions

View File

@ -4,7 +4,7 @@
:close-on-click-modal="false"
class="ms-switch-project"
>
<ms-table-header :condition.sync="condition" @search="initData" title="切换项目" :show-create="false"/>
<ms-table-header :condition.sync="condition" @search="initData" :title="$t('test_track.switch_project')" :show-create="false"/>
<el-table
:data="tableData"
highlight-current-row

View File

@ -11,7 +11,7 @@
<el-container class="main-content">
<el-aside class="tree-aside" width="250px">
<el-link type="primary" class="project-link" @click="switchProject">{{projectName ? projectName : '切换项目' }}</el-link>
<el-link type="primary" class="project-link" @click="switchProject">{{projectName ? projectName : $t('test_track.switch_project') }}</el-link>
<node-tree class="node-tree"
@nodeSelectEvent="nodeChange"
@refresh="refresh"

View File

@ -5,7 +5,7 @@
<div v-if="comments.length === 0" style="text-align: center">
<i class="el-icon-chat-line-square" style="font-size: 15px;color: #8a8b8d;">
<span style="font-size: 15px; color: #8a8b8d;">
暂无评论
{{ $t('test_track.comment.no_comment') }}
</span>
</i>
</div>
@ -13,7 +13,7 @@
<div>
<el-input
type="textarea"
placeholder="发表评论Ctrl+Enter发送"
:placeholder="$t('test_track.comment.send_comment')"
v-model="textarea"
maxlength="60"
show-word-limit
@ -22,7 +22,9 @@
@keyup.ctrl.enter.native="sendComment"
>
</el-input>
<el-button type="primary" size="mini" class="send-btn" @click="sendComment">发送</el-button>
<el-button type="primary" size="mini" class="send-btn" @click="sendComment">
{{ $t('test_track.comment.send') }}
</el-button>
</div>
</div>
</template>
@ -49,16 +51,15 @@ export default {
comment.caseId = this.caseId;
comment.description = this.textarea;
if (!this.textarea) {
this.$warning("评论内容不能为空!");
this.$warning(this.$t('test_track.comment.description_is_null'));
return;
}
this.result = this.$post('/test/case/comment/save', comment, () => {
this.$success("评论成功!");
this.$success(this.$t('test_track.comment.send_success'));
this.$emit('getComments');
this.textarea = '';
});
},
}
}
</script>

View File

@ -11,7 +11,7 @@
<el-container class="main-content">
<el-aside class="tree-aside" width="250px">
<el-link type="primary" class="project-link" @click="switchProject">{{projectName ? projectName : '切换项目' }}</el-link>
<el-link type="primary" class="project-link" @click="switchProject">{{projectName ? projectName : $t('test_track.switch_project') }}</el-link>
<node-tree class="node-tree"
@nodeSelectEvent="nodeChange"
@refresh="refresh"

View File

@ -29,12 +29,12 @@
<el-col :span="12" class="head-right">
<span class="head-right-tip" v-if="index + 1 == testCases.length">
<span class="head-right-tip" v-if="index + 1 === testCases.length">
{{ $t('test_track.plan_view.pre_case') }} : {{
testCases[index - 1] ? testCases[index - 1].name : ''
}}
</span>
<span class="head-right-tip" v-if="index + 1 != testCases.length">
<span class="head-right-tip" v-if="index + 1 !== testCases.length">
{{ $t('test_track.plan_view.next_case') }} : {{
testCases[index + 1] ? testCases[index + 1].name : ''
}}
@ -50,16 +50,16 @@
<el-divider direction="vertical"></el-divider>
<el-button type="success" size="mini" :disabled="isReadOnly" plain @click="saveCase('Pass')">
通过
{{ $t('test_track.review.pass') }}
</el-button>
<el-button type="danger" size="mini" :disabled="isReadOnly" plain @click="saveCase('UnPass')">
未通过
{{ $t('test_track.review.un_pass') }}
</el-button>
</el-col>
</el-row>
<el-row style="margin-top: 0px;">
<el-row style="margin-top: 0;">
<el-col>
<el-divider content-position="left">{{ testCase.name }}</el-divider>
</el-col>
@ -75,18 +75,20 @@
</el-col>
<el-col :span="5">
<span class="cast_label">{{ $t('test_track.case.case_type') }}</span>
<span class="cast_item" v-if="testCase.type == 'functional'">{{ $t('commons.functional') }}</span>
<span class="cast_item" v-if="testCase.type === 'functional'">{{
$t('commons.functional')
}}</span>
<span class="cast_item"
v-if="testCase.type == 'performance'">{{ $t('commons.performance') }}</span>
<span class="cast_item" v-if="testCase.type == 'api'">{{ $t('commons.api') }}</span>
v-if="testCase.type === 'performance'">{{ $t('commons.performance') }}</span>
<span class="cast_item" v-if="testCase.type === 'api'">{{ $t('commons.api') }}</span>
</el-col>
</el-row>
<el-row>
<el-col :span="4" :offset="1">
<span class="cast_label">{{ $t('test_track.case.method') }}</span>
<span v-if="testCase.method == 'manual'">{{ $t('test_track.case.manual') }}</span>
<span v-if="testCase.method == 'auto'">{{ $t('test_track.case.auto') }}</span>
<span v-if="testCase.method === 'manual'">{{ $t('test_track.case.manual') }}</span>
<span v-if="testCase.method === 'auto'">{{ $t('test_track.case.auto') }}</span>
</el-col>
<el-col :span="5">
<span class="cast_label">{{ $t('test_track.case.module') }}</span>
@ -105,27 +107,21 @@
</el-col>
</el-row>
<el-row v-if="testCase.method == 'auto' && testCase.testId">
<el-row v-if="testCase.method === 'auto' && testCase.testId">
<el-col class="test-detail" :span="20" :offset="1">
<el-tabs v-model="activeTab" type="border-card" @tab-click="testTabChange">
<el-tabs v-model="activeTab" type="border-card">
<el-tab-pane name="detail" :label="$t('test_track.plan_view.test_detail')">
<api-test-detail :is-read-only="isReadOnly" v-if="testCase.type == 'api'" @runTest="testRun"
<api-test-detail :is-read-only="true" v-if="testCase.type === 'api'" @runTest="testRun"
:id="testCase.testId" ref="apiTestDetail"/>
<performance-test-detail :is-read-only="isReadOnly" v-if="testCase.type == 'performance'"
<performance-test-detail :is-read-only="true" v-if="testCase.type === 'performance'"
@runTest="testRun" :id="testCase.testId"
ref="performanceTestDetail"/>
</el-tab-pane>
<el-tab-pane name="result" :label="$t('test_track.plan_view.test_result')">
<api-test-result :report-id="testCase.reportId" v-if=" testCase.type == 'api'"
ref="apiTestResult"/>
<performance-test-result :is-read-only="isReadOnly" :report-id="testCase.reportId"
v-if="testCase.type == 'performance'" ref="performanceTestResult"/>
</el-tab-pane>
</el-tabs>
</el-col>
</el-row>
<el-row v-if="testCase.method && testCase.method != 'auto'">
<el-row v-if="testCase.method && testCase.method !== 'auto'">
<el-col :span="20" :offset="1">
<div>
<span class="cast_label">{{ $t('test_track.case.steps') }}</span>
@ -202,7 +198,7 @@
<el-col :span="15" :offset="1">
<div>
<span class="cast_label">{{ $t('commons.remark') }}</span>
<span v-if="testCase.remark == null || testCase.remark == ''"
<span v-if="testCase.remark == null || testCase.remark === ''"
style="color: darkgrey">{{ $t('commons.not_filled') }}</span>
</div>
<div>
@ -222,7 +218,7 @@
<el-col :span="7">
<el-card class="comment-card">
<template slot="header">
<span style="font-size: 15px; color: #1E90FF">评论</span>
<span style="font-size: 15px; color: #1E90FF">{{ $t('test_track.review.comment') }}</span>
<i class="el-icon-refresh" @click="getComments(testCase)"
style="margin-left:10px;font-size: 14px; cursor: pointer"/>
</template>
@ -232,7 +228,6 @@
</div>
</el-row>
</template>
</el-drawer>
@ -348,11 +343,10 @@ export default {
},
initTest() {
this.$nextTick(() => {
if (this.testCase.method == 'auto') {
if (this.$refs.apiTestDetail && this.testCase.type == 'api') {
if (this.testCase.method === 'auto') {
if (this.$refs.apiTestDetail && this.testCase.type === 'api') {
this.$refs.apiTestDetail.init();
} else if (this.testCase.type == 'performance') {
} else if (this.testCase.type === 'performance') {
this.$refs.performanceTestDetail.init();
}
}
@ -362,12 +356,6 @@ export default {
this.testCase.reportId = reportId;
this.saveReport(reportId);
},
testTabChange(data) {
if (this.testCase.type == 'performance' && data.paneName == 'result') {
this.$refs.performanceTestResult.checkReportStatus();
this.$refs.performanceTestResult.init();
}
},
saveReport(reportId) {
// this.$post('/test/plan/case/edit', {id: this.testCase.id, reportId: reportId});
},
@ -395,7 +383,7 @@ export default {
});
},
getRelatedTest() {
if (this.testCase.method == 'auto' && this.testCase.testId && this.testCase.testId != 'other') {
if (this.testCase.method === 'auto' && this.testCase.testId && this.testCase.testId !== 'other') {
this.$get('/' + this.testCase.type + '/get/' + this.testCase.testId, response => {
let data = response.data;
if (data) {
@ -413,7 +401,7 @@ export default {
this.$post('/test/case/review/edit/status/' + reviewId);
},
stepResultChange() {
if (this.testCase.method == 'manual') {
if (this.testCase.method === 'manual') {
this.isFailure = this.testCase.steptResults.filter(s => {
return s.executeResult === 'Failure' || s.executeResult === 'Blocking';
}).length > 0;

View File

@ -38,7 +38,7 @@
type="selection"/>
<el-table-column width="40" :resizable="false" align="center">
<template v-slot:default="scope">
<!-- <show-more-btn :is-show="scope.row.showMore" :buttons="buttons" :size="selectRows.size"/>-->
<show-more-btn :is-show="scope.row.showMore" :buttons="buttons" :size="selectRows.size"/>
</template>
</el-table-column>
<el-table-column
@ -146,14 +146,11 @@
@refreshTable="search"/>
</el-card>
<batch-edit ref="batchEdit" @batchEdit="batchEdit"
:type-arr="typeArr" :value-arr="valueArr" :dialog-title="$t('test_track.case.batch_edit_case')"/>
</div>
</template>
<script>
import ClassicEditor from "@ckeditor/ckeditor5-build-classic";
import MsTableOperatorButton from "../../../../common/components/MsTableOperatorButton";
import MsTableOperator from "../../../../common/components/MsTableOperator";
import MethodTableItem from "../../../common/tableItems/planview/MethodTableItem";
@ -171,7 +168,7 @@ import BatchEdit from "../../../case/components/BatchEdit";
import MsTablePagination from '../../../../common/pagination/TablePagination';
import {_filter, _sort, checkoutTestManagerOrTestUser, hasRoles} from "../../../../../../common/js/utils";
import {TEST_CASE_CONFIGS} from "../../../../common/components/search/search-components";
import {ROLE_TEST_MANAGER, ROLE_TEST_USER, TokenKey, WORKSPACE_ID} from "../../../../../../common/js/constants";
import {ROLE_TEST_MANAGER, ROLE_TEST_USER} from "../../../../../../common/js/constants";
import TestReviewTestCaseEdit from "./TestReviewTestCaseEdit";
export default {
@ -216,9 +213,6 @@ export default {
],
showMore: false,
buttons: [
{
name: this.$t('test_track.case.batch_edit_case'), handleClick: this.handleBatchEdit
},
{
name: this.$t('test_track.case.batch_unlink'), handleClick: this.handleDeleteBatch
}
@ -236,10 +230,6 @@ export default {
{name: this.$t('test_track.plan_view.skip'), id: 'Skip'}
]
},
editor: ClassicEditor,
editorConfig: {
toolbar: [],
},
}
},
props: {
@ -335,7 +325,7 @@ export default {
this.$post('/test/review/case/batch/delete', {ids: ids}, () => {
this.selectRows.clear();
this.$emit("refresh");
this.$success(this.$t('commons.delete_success'));
this.$success(this.$t('test_track.cancel_relevance_success'));
});
}
}
@ -345,33 +335,33 @@ export default {
let testCaseId = testCase.id;
this.$post('/test/review/case/delete/' + testCaseId, {}, () => {
this.$emit("refresh");
this.$success(this.$t('commons.delete_success'));
this.$success(this.$t('test_track.cancel_relevance_success'));
});
},
handleSelectAll(selection) {
if (selection.length > 0) {
this.tableData.forEach(item => {
this.$set(item, "showMore", true);
this.selectRows.add(item);
});
} else {
this.selectRows.clear();
this.tableData.forEach(row => {
this.$set(row, "showMore", false);
})
}
},
handleSelectionChange(selection, row) {
},
handleBatch(type) {
if (this.selectRows.size < 1) {
this.$warning(this.$t('test_track.plan_view.select_manipulate'));
return;
}
if (type === 'executor') {
this.$refs.executorEdit.openExecutorEdit();
} else if (type === 'status') {
this.$refs.statusEdit.openStatusEdit();
} else if (type === 'delete') {
this.handleDeleteBatch();
if (this.selectRows.has(row)) {
this.$set(row, "showMore", false);
this.selectRows.delete(row);
} else {
this.$set(row, "showMore", true);
this.selectRows.add(row);
}
},
openTestReport() {
this.$refs.testReportTemplateList.open(this.reviewId);
},
statusChange(param) {
},
getTestReviewById() {
if (this.reviewId) {
@ -393,34 +383,12 @@ export default {
_sort(column, this.condition);
this.initTableData();
},
batchEdit(form) {
// let param = {};
// param[form.type] = form.value;
// param.ids = Array.from(this.selectRows).map(row => row.id);
// this.$post('/test/plan/case/batch/edit', param, () => {
// this.selectRows.clear();
// this.status = '';
// this.$post('/test/plan/edit/status/' + this.reviewId);
// this.$success(this.$t('commons.save_success'));
// this.$emit('refresh');
// });
},
handleBatchEdit() {
this.getMaintainerOptions();
this.$refs.batchEdit.open();
},
getMaintainerOptions() {
let workspaceId = localStorage.getItem(WORKSPACE_ID);
this.$post('/user/ws/member/tester/list', {workspaceId: workspaceId}, response => {
this.valueArr.executor = response.data;
});
},
startReview() {
if (this.tableData.length !== 0) {
this.isReadOnly = false;
this.$refs.testReviewTestCaseEdit.openTestCaseEdit(this.tableData[0]);
} else {
this.$warning("没有关联的评审!");
this.$warning(this.$t('test_track.review.no_link_case'));
}
}
}
@ -429,14 +397,5 @@ export default {
<style scoped>
.search {
margin-left: 10px;
width: 240px;
}
.test-case-status, .el-table {
cursor: pointer;
}
</style>

View File

@ -621,6 +621,8 @@ export default {
pass_rate: "Pass rate",
execution_result: ": Please select the execution result",
actual_result: ": The actual result is empty",
cancel_relevance_success: "Unlinked successfully",
switch_project: "Switch project",
case: {
export_all_cases: 'Are you sure you want to export all use cases?',
input_test_case: 'Please enter the associated case name',
@ -737,6 +739,17 @@ export default {
input_review_name: "Please enter the name of the review",
input_review_project: "Please select the project",
input_reviewer: "Please select reviewer",
no_link_case: "No associated use cases!",
pass: "pass",
un_pass: "UnPass",
comment: "Comment",
},
comment: {
no_comment: "No Comment",
send_comment: "Post a comment (Ctrl + Enter to send)",
send: "Send",
description_is_null: "Comment content cannot be empty!",
send_success: "Comment successful!",
},
review_view: {
review: "Review",

View File

@ -623,7 +623,8 @@ export default {
pass_rate: "通过率",
execution_result: ": 请选择执行结果",
actual_result: ": 实际结果为空",
cancel_relevance_success: "取消关联成功",
switch_project: "切换项目",
case: {
export_all_cases: '确定要导出全部用例吗?',
input_test_case: '请输入关联用例名称',
@ -740,6 +741,17 @@ export default {
input_review_name: "请输入评审名称",
input_review_project: "请选择所属项目",
input_reviewer: "请选择评审人",
no_link_case: "没有关联用例!",
pass: "通过",
un_pass: "未通过",
comment: "评论",
},
comment: {
no_comment: "暂无评论",
send_comment: "发表评论Ctrl+Enter发送",
send: "发送",
description_is_null: "评论内容不能为空!",
send_success: "评论成功!",
},
review_view: {
review: "评审",

View File

@ -623,7 +623,8 @@ export default {
pass_rate: "通過率",
execution_result: ": 請選擇執行結果",
actual_result: ": 實際結果為空",
cancel_relevance_success: "取消關聯成功",
switch_project: "切換項目",
case: {
export_all_cases: '確定要匯出全部用例嗎?',
input_test_case: '請輸入關聯用例名稱',
@ -740,6 +741,17 @@ export default {
input_review_name: "請輸入評審名稱",
input_review_project: "請選擇所屬項目",
input_reviewer: "請選擇評審人",
no_link_case: "沒有關聯用例!",
pass: "通過",
un_pass: "未通過",
comment: "評論",
},
comment: {
no_comment: "暫無評論",
send_comment: "發表評論Ctrl+Enter發送",
send: "發送",
description_is_null: "評論內容不能為空!",
send_success: "評論成功!",
},
review_view: {
review: "評審",