fix(测试跟踪): 关联评审用例高级搜索未添加自定义字段&评审截止时间校验有误

--bug=1029672 --user=宋昌昌 【测试跟踪】github#26471,关联评审用例时的过滤器不能选择自定义字段 https://www.tapd.cn/55049933/s/1413784
This commit is contained in:
song-cc-rock 2023-09-07 18:14:12 +08:00 committed by fit2-zhao
parent 44aeb43baf
commit ab2578d8a1
11 changed files with 290 additions and 286 deletions

View File

@ -1,56 +1,56 @@
<template> <template>
<span class="adv-search-bar"> <span class="adv-search-bar">
<el-link type="primary" @click="open" v-if="showLink">{{ <el-link type="primary" @click="open" v-if="showLink">{{
$t("commons.adv_search.title") $t("commons.adv_search.title")
}}</el-link> }}</el-link>
<el-dialog <el-dialog
:title="$t('commons.adv_search.title')" :title="$t('commons.adv_search.title')"
:visible.sync="visible" :visible.sync="visible"
custom-class="adv-dialog" custom-class="adv-dialog"
:append-to-body="true" :append-to-body="true"
> >
<div class="search-items"> <div class="search-items">
<div <div
class="search-item" class="search-item"
v-for="component in optional.components" v-for="component in optional.components"
:key="component.key" :key="component.key"
> >
<el-row> <el-row>
<el-col :span="22"> <el-col :span="22">
<component <component
:is="component.name" :is="component.name"
:component="component" :component="component"
:components.sync="config.components" :components.sync="config.components"
@updateKey="changeSearchItemKey" @updateKey="changeSearchItemKey"
:custom="condition.custom" :custom="condition.custom"
/> />
</el-col> </el-col>
<el-col :span="2"> <el-col :span="2">
<i <i
class="el-icon-close delete-icon" class="el-icon-close delete-icon"
@click="remove(component)" @click="remove(component)"
v-if="optional.components.length !== 1" v-if="optional.components.length !== 1"
></i> ></i>
</el-col> </el-col>
</el-row> </el-row>
</div> </div>
<el-link <el-link
type="primary" type="primary"
icon="el-icon-plus" icon="el-icon-plus"
v-if="showAddFilterLink" v-if="showAddFilterLink"
class="add-filter-link" class="add-filter-link"
@click="addFilter" @click="addFilter"
>{{ $t("commons.adv_search.add_filter_link") }}</el-link >{{ $t("commons.adv_search.add_filter_link") }}</el-link
> >
</div> </div>
<template v-slot:footer> <template v-slot:footer>
<div class="dialog-footer"> <div class="dialog-footer">
<el-button @click="reset">{{ <el-button @click="reset">{{
$t("commons.adv_search.reset") $t("commons.adv_search.reset")
}}</el-button> }}</el-button>
<el-button type="primary" @click="search">{{ <el-button type="primary" @click="search">{{
$t("commons.adv_search.search") $t("commons.adv_search.search")
}}</el-button> }}</el-button>
</div> </div>
</template> </template>
</el-dialog> </el-dialog>
@ -59,11 +59,11 @@
<script> <script>
import components from "./search-components"; import components from "./search-components";
import { cloneDeep, concat, slice } from "lodash-es"; import {cloneDeep, concat, slice} from "lodash-es";
import { _findByKey, _findIndexByKey } from "./custom-component"; import {_findByKey, _findIndexByKey} from "./custom-component";
export default { export default {
components: { ...components }, components: {...components},
name: "MsTableAdvSearchBar", name: "MsTableAdvSearchBar",
props: { props: {
condition: Object, condition: Object,
@ -98,9 +98,9 @@ export default {
config.components.forEach((component) => { config.components.forEach((component) => {
let operator = component.operator.value; let operator = component.operator.value;
component.operator.value = component.operator.value =
operator === undefined operator === undefined
? component.operator.options[0].value ? component.operator.options[0].value
: operator; : operator;
}); });
if (!handleCustom) { if (!handleCustom) {
return config; return config;
@ -108,7 +108,7 @@ export default {
if (this.condition.custom) { if (this.condition.custom) {
let components = []; let components = [];
this.systemFiled = config.components.filter( this.systemFiled = config.components.filter(
(co) => co.custom === undefined || co.custom === false (co) => co.custom === undefined || co.custom === false
); );
this.customFiled = config.components.filter((co) => co.custom === true); this.customFiled = config.components.filter((co) => co.custom === true);
// //
@ -151,15 +151,15 @@ export default {
// custom false // custom false
// //
if ( if (
component.custom || component.custom ||
[ [
"严重程度", "严重程度",
"处理人", "处理人",
"状态", "状态",
"用例状态", "用例状态",
"责任人", "责任人",
"用例等级", "用例等级",
].indexOf(component.label) > -1 ].indexOf(component.label) > -1
) { ) {
this.handleCustomField(condition, component); this.handleCustomField(condition, component);
return; return;
@ -175,16 +175,16 @@ export default {
} }
let value = component.value; let value = component.value;
if ( if (
component.label === "用例状态" && component.label === "用例状态" &&
value.length === 1 && value.length === 1 &&
value.indexOf("Trash") > -1 value.indexOf("Trash") > -1
) { ) {
return; return;
} }
if ( if (
component.type === "multipleMember" || component.type === "multipleMember" ||
component.type === "checkbox" || component.type === "checkbox" ||
component.type === "multipleSelect" component.type === "multipleSelect"
) { ) {
try { try {
value = JSON.stringify(component.value); value = JSON.stringify(component.value);
@ -205,9 +205,9 @@ export default {
if (component.operator.value !== undefined) { if (component.operator.value !== undefined) {
let operator = _findByKey(source, component.key).operator.value; let operator = _findByKey(source, component.key).operator.value;
component.operator.value = component.operator.value =
operator === undefined operator === undefined
? component.operator.options[0].value ? component.operator.options[0].value
: operator; : operator;
} }
if (component.value !== undefined) { if (component.value !== undefined) {
component.value = source[index].value; component.value = source[index].value;
@ -224,28 +224,28 @@ export default {
this.config = this.doInit(true); this.config = this.doInit(true);
this.optional = this.doInit(); this.optional = this.doInit();
if ( if (
this.optional.components.length && this.optional.components.length &&
this.optional.components.length <= this.showItemSize this.optional.components.length <= this.showItemSize
) { ) {
this.showAddFilterLink = false; this.showAddFilterLink = false;
} }
// //
this.optional.components = slice( this.optional.components = slice(
this.optional.components, this.optional.components,
0, 0,
this.showItemSize this.showItemSize
); );
let allComponent = this.condition.custom let allComponent = this.condition.custom
? concat( ? concat(
this.config.components[0].child, this.config.components[0].child,
this.config.components[1].child this.config.components[1].child
) )
: this.config.components; : this.config.components;
for (let component of allComponent) { for (let component of allComponent) {
let co = _findByKey(this.optional.components, component.key); let co = _findByKey(this.optional.components, component.key);
co co
? this.$set(co, "disable", true) ? this.$set(co, "disable", true)
: this.$set(component, "disable", false); : this.$set(component, "disable", false);
} }
}, },
open() { open() {
@ -262,17 +262,17 @@ export default {
refreshComponentOption() { refreshComponentOption() {
// //
let comps = this.optional.components.filter( let comps = this.optional.components.filter(
(cp) => cp.init && cp.init instanceof Function (cp) => cp.init && cp.init instanceof Function
); );
comps.forEach((comp) => comp.init()); comps.forEach((comp) => comp.init());
}, },
setModulesParam() { setModulesParam() {
let comps = this.optional.components.filter( let comps = this.optional.components.filter(
(c) => c.key === "moduleIds" && c.options.type === "POST" (c) => c.key === "moduleIds" && c.options.type === "POST"
); );
comps.forEach( comps.forEach(
(comp) => (comp) =>
(comp.options.params = { projectId: this.condition.projectId }) (comp.options.params = {projectId: this.condition.projectId})
); );
}, },
handleCustomComponent() { handleCustomComponent() {
@ -280,16 +280,16 @@ export default {
newConfig.components.forEach((component) => { newConfig.components.forEach((component) => {
let operator = component.operator.value; let operator = component.operator.value;
component.operator.value = component.operator.value =
operator === undefined operator === undefined
? component.operator.options[0].value ? component.operator.options[0].value
: operator; : operator;
}); });
this.newCustomFiled = newConfig.components.filter((co) => co.custom); this.newCustomFiled = newConfig.components.filter((co) => co.custom);
for (let customField of this.newCustomFiled) { for (let customField of this.newCustomFiled) {
let co = _findByKey(this.optional.components, customField.key); let co = _findByKey(this.optional.components, customField.key);
co co
? this.$set(co, "disable", true) ? this.$set(co, "disable", true)
: this.$set(customField, "disable", false); : this.$set(customField, "disable", false);
} }
this.config.components[1] = { this.config.components[1] = {
label: this.$t("custom_field.name"), label: this.$t("custom_field.name"),
@ -298,8 +298,8 @@ export default {
}, },
addFilter() { addFilter() {
const index = _findIndexByKey( const index = _findIndexByKey(
this.optional.components, this.optional.components,
this.nullFilterKey this.nullFilterKey
); );
if (index > -1) { if (index > -1) {
this.$warning(this.$t("commons.adv_search.add_filter_link_tip")); this.$warning(this.$t("commons.adv_search.add_filter_link_tip"));
@ -323,8 +323,8 @@ export default {
} else { } else {
// //
const components = concat( const components = concat(
this.config.components[0].child, this.config.components[0].child,
this.config.components[1].child this.config.components[1].child
); );
this.enableOptional(component, components); this.enableOptional(component, components);
} }
@ -350,8 +350,8 @@ export default {
components = this.config.components; components = this.config.components;
} else { } else {
components = concat( components = concat(
this.config.components[0].child, this.config.components[0].child,
this.config.components[1].child this.config.components[1].child
); );
} }
for (let op of components) { for (let op of components) {

View File

@ -363,9 +363,9 @@ public class TestCaseNodeService extends NodeTreeService<TestCaseNodeDTO> {
public List<TestCaseNodeDTO> getRelateReviewNodes(QueryTestCaseRequest request) { public List<TestCaseNodeDTO> getRelateReviewNodes(QueryTestCaseRequest request) {
request.setNodeIds(null); request.setNodeIds(null);
ServiceUtils.buildCombineTagsToSupportMultiple(request); ServiceUtils.buildCombineTagsToSupportMultiple(request);
ServiceUtils.setBaseQueryRequestCustomMultipleFields(request);
List<TestCaseNodeDTO> countMNodes = extTestCaseMapper.getTestReviewRelateCountNodes(request); List<TestCaseNodeDTO> countMNodes = extTestCaseMapper.getTestReviewRelateCountNodes(request);
List<TestCaseNodeDTO> testCaseNodes = extTestCaseNodeMapper.getNodeTreeByProjectId(request.getProjectId()); List<TestCaseNodeDTO> testCaseNodes = extTestCaseNodeMapper.getNodeTreeByProjectId(request.getProjectId());
ServiceUtils.setBaseQueryRequestCustomMultipleFields(request);
return getNodeTreeWithPruningTreeByCaseCount(testCaseNodes, getCountMap(countMNodes)); return getNodeTreeWithPruningTreeByCaseCount(testCaseNodes, getCountMap(countMNodes));
} }

View File

@ -154,6 +154,7 @@ public class TestCaseReviewService {
/** /**
* 计算评审的通过率和用例总数 * 计算评审的通过率和用例总数
*
* @param list * @param list
*/ */
private void calcReviewRate(List<TestCaseReviewDTO> list) { private void calcReviewRate(List<TestCaseReviewDTO> list) {
@ -303,12 +304,11 @@ public class TestCaseReviewService {
} }
public TestCaseReview editCaseReview(SaveTestCaseReviewRequest testCaseReview) { public TestCaseReview editCaseReview(SaveTestCaseReviewRequest testCaseReview) {
TestCaseReview originReview = testCaseReviewMapper.selectByPrimaryKey(testCaseReview.getId());
editCaseReviewer(testCaseReview); editCaseReviewer(testCaseReview);
editCaseRevieweFollow(testCaseReview); editCaseRevieweFollow(testCaseReview);
testCaseReview.setUpdateTime(System.currentTimeMillis()); testCaseReview.setUpdateTime(System.currentTimeMillis());
checkCaseReviewExist(testCaseReview); checkCaseReviewExist(testCaseReview);
TestCaseReview originReview = testCaseReviewMapper.selectByPrimaryKey(testCaseReview.getId());
testCaseReviewMapper.updateByPrimaryKeySelective(testCaseReview); testCaseReviewMapper.updateByPrimaryKeySelective(testCaseReview);
if (!StringUtils.equals(testCaseReview.getReviewPassRule(), originReview.getReviewPassRule())) { if (!StringUtils.equals(testCaseReview.getReviewPassRule(), originReview.getReviewPassRule())) {
@ -369,7 +369,7 @@ public class TestCaseReviewService {
}); });
} }
for (TestCaseReviewTestCase reviewTestCase : testCaseReviewTestCases) { for (TestCaseReviewTestCase reviewTestCase : testCaseReviewTestCases) {
if (StringUtils.equalsAny(reviewTestCase.getStatus(), if (StringUtils.equalsAny(reviewTestCase.getStatus(),
TestReviewCaseStatus.Pass.name(), TestReviewCaseStatus.UnPass.name(), TestReviewCaseStatus.Underway.name())) { TestReviewCaseStatus.Pass.name(), TestReviewCaseStatus.UnPass.name(), TestReviewCaseStatus.Underway.name())) {
// 重新计算评审状态 // 重新计算评审状态
@ -555,7 +555,7 @@ public class TestCaseReviewService {
public void editTestReviewStatus(String reviewId) { public void editTestReviewStatus(String reviewId) {
String status = extTestCaseReviewMapper.selectStatusById(reviewId); String status = extTestCaseReviewMapper.selectStatusById(reviewId);
if (StringUtils.equalsAnyIgnoreCase(status, TestCaseReviewStatus.Completed.name(), TestCaseReviewStatus.Finished.name())){ if (StringUtils.equalsAnyIgnoreCase(status, TestCaseReviewStatus.Completed.name(), TestCaseReviewStatus.Finished.name())) {
return; return;
} }
@ -563,7 +563,7 @@ public class TestCaseReviewService {
TestCaseReview testCaseReview = new TestCaseReview(); TestCaseReview testCaseReview = new TestCaseReview();
testCaseReview.setId(reviewId); testCaseReview.setId(reviewId);
if (statusList.contains(TestReviewCaseStatus.Underway.name()) || statusList.contains(TestReviewCaseStatus.Again.name()) ) { if (statusList.contains(TestReviewCaseStatus.Underway.name()) || statusList.contains(TestReviewCaseStatus.Again.name())) {
return; return;
} }

View File

@ -89,7 +89,7 @@ import java.util.stream.Collectors;
@Service @Service
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public class TestCaseService { public class TestCaseService {
@Resource @Resource
TestCaseNodeMapper testCaseNodeMapper; TestCaseNodeMapper testCaseNodeMapper;
@ -1058,6 +1058,7 @@ public class TestCaseService {
public List<TestCaseDTO> getReviewCase(QueryTestCaseRequest request) { public List<TestCaseDTO> getReviewCase(QueryTestCaseRequest request) {
setDefaultOrder(request); setDefaultOrder(request);
ServiceUtils.buildCombineTagsToSupportMultiple(request); ServiceUtils.buildCombineTagsToSupportMultiple(request);
ServiceUtils.setBaseQueryRequestCustomMultipleFields(request);
request.getOrders().forEach(order -> { request.getOrders().forEach(order -> {
order.setPrefix("test_case"); order.setPrefix("test_case");
}); });

View File

@ -849,15 +849,17 @@ public class TestReviewTestCaseService {
/** /**
* 检查执行结果自动更新计划状态 * 检查执行结果自动更新计划状态
*
* @param testCaseReviewDTO * @param testCaseReviewDTO
*/ */
public void checkStatus(TestCaseReviewDTO testCaseReviewDTO) { public void checkStatus(TestCaseReviewDTO testCaseReviewDTO) {
if (testCaseReviewDTO.getEndTime() != null && testCaseReviewDTO.getEndTime() < System.currentTimeMillis() && !testCaseReviewDTO.getStatus().equals(TestPlanStatus.Finished.name())) { if (testCaseReviewDTO.getEndTime() != null && testCaseReviewDTO.getEndTime() < System.currentTimeMillis()
&& StringUtils.equalsAny(testCaseReviewDTO.getStatus(), TestPlanStatus.Underway.name(), TestPlanStatus.Prepare.name(), TestPlanStatus.Completed.name())) {
TestCaseReviewExample example = new TestCaseReviewExample(); TestCaseReviewExample example = new TestCaseReviewExample();
example.createCriteria().andIdEqualTo(testCaseReviewDTO.getId()); example.createCriteria().andIdEqualTo(testCaseReviewDTO.getId());
TestCaseReview review = new TestCaseReview(); TestCaseReview review = new TestCaseReview();
review.setStatus(TestPlanStatus.Finished.name()); review.setStatus(TestPlanStatus.Finished.name());
testCaseReviewMapper.updateByExampleSelective(review,example); testCaseReviewMapper.updateByExampleSelective(review, example);
testCaseReviewDTO.setStatus(TestPlanStatus.Finished.name()); testCaseReviewDTO.setStatus(TestPlanStatus.Finished.name());
} }
} }

View File

@ -246,4 +246,5 @@ rerun_warning=The report is being rerun, check it later
case_export_text_validate_tip=Contains extremely long text, currently supported up to %s! case_export_text_validate_tip=Contains extremely long text, currently supported up to %s!
case_import_table_header_missing=Header information is missing! case_import_table_header_missing=Header information is missing!
relate_resource=relate relate_resource=relate
test_plan_run_message=The current test plan is running, please try again later test_plan_run_message=The current test plan is running, please try again later
test_review_end_time_early=Deadline cannot be earlier than current time

View File

@ -217,4 +217,5 @@ rerun_warning=报告正在重跑中,稍后查看
case_export_text_validate_tip=包含超长文本,目前支持最大长度为 %s case_export_text_validate_tip=包含超长文本,目前支持最大长度为 %s
case_import_table_header_not_exist=缺少表头信息! case_import_table_header_not_exist=缺少表头信息!
relate_resource=关联 relate_resource=关联
test_plan_run_message=当前测试计划正在执行中,请稍后再试! test_plan_run_message=当前测试计划正在执行中,请稍后再试!
test_review_end_time_early=截止时间不能早于当前时间!

View File

@ -217,4 +217,5 @@ rerun_warning=報告正在重跑中,稻後查看
case_export_text_validate_tip=包含超長文本,目前支持最大長度為 %s case_export_text_validate_tip=包含超長文本,目前支持最大長度為 %s
case_import_table_header_not_exist=缺少表頭信息! case_import_table_header_not_exist=缺少表頭信息!
relate_resource=關聯 relate_resource=關聯
test_plan_run_message=當前測試計劃正在執行中,請稍後再試! test_plan_run_message=當前測試計劃正在執行中,請稍後再試!
test_review_end_time_early=截止時間不能早於當前時間!

View File

@ -1,14 +1,14 @@
<template> <template>
<test-case-relevance-base <test-case-relevance-base
@setProject="setProject" @setProject="setProject"
@save="saveCaseRelevance" @save="saveCaseRelevance"
:enable-full-screen="false" :enable-full-screen="false"
@close="close" @close="close"
:flag="isTestPlan" :flag="isTestPlan"
:multiple-project="multipleProject" :multiple-project="multipleProject"
:is-saving="isSaving" :is-saving="isSaving"
ref="baseRelevance"> ref="baseRelevance">
<template v-slot:aside> <template v-slot:aside>
<node-tree class="node-tree" <node-tree class="node-tree"
@ -28,61 +28,61 @@
</ms-table-header> </ms-table-header>
<ms-table <ms-table
v-loading="page.loading" v-loading="page.loading"
:data="page.data" :data="page.data"
:condition="page.condition" :condition="page.condition"
:total="page.total" :total="page.total"
:page-size.sync="page.pageSize" :page-size.sync="page.pageSize"
:screen-height="screenHeight" :screen-height="screenHeight"
row-key="id" row-key="id"
:reserve-option="true" :reserve-option="true"
:page-refresh="pageRefresh" :page-refresh="pageRefresh"
@handlePageChange="getTestCases" @handlePageChange="getTestCases"
@selectCountChange="setSelectCounts" @selectCountChange="setSelectCounts"
@order="getTestCases" @order="getTestCases"
@filter="search" @filter="search"
ref="table"> ref="table">
<ms-table-column <ms-table-column
v-if="!customNum" v-if="!customNum"
prop="num" prop="num"
sortable sortable
:label="$t('commons.id')"> :label="$t('commons.id')">
</ms-table-column> </ms-table-column>
<ms-table-column <ms-table-column
v-if="customNum" v-if="customNum"
prop="customNum" prop="customNum"
sortable sortable
:label="$t('commons.id')"> :label="$t('commons.id')">
</ms-table-column> </ms-table-column>
<ms-table-column prop="name" :label="$t('commons.name')"/> <ms-table-column prop="name" :label="$t('commons.name')"/>
<ms-table-column <ms-table-column
v-if="versionEnable && versionFilters" v-if="versionEnable && versionFilters"
prop="versionId" prop="versionId"
:filters="versionFilters" :filters="versionFilters"
:label="$t('commons.version')" :label="$t('commons.version')"
show-overflow-tooltip> show-overflow-tooltip>
<template v-slot:default="scope"> <template v-slot:default="scope">
<span>{{ scope.row.versionName }}</span> <span>{{ scope.row.versionName }}</span>
</template> </template>
</ms-table-column> </ms-table-column>
<ms-table-column <ms-table-column
prop="priority" prop="priority"
:filters="priorityOptions" :filters="priorityOptions"
sortable sortable
:label="$t('test_track.case.priority')" :label="$t('test_track.case.priority')"
width="120px"> width="120px">
<template v-slot:default="scope"> <template v-slot:default="scope">
<priority-table-item :value="scope.row.priority" :priority-options="priorityOptions"/> <priority-table-item :value="scope.row.priority" :priority-options="priorityOptions"/>
</template> </template>
</ms-table-column> </ms-table-column>
<test-plan-case-status-table-item <test-plan-case-status-table-item
sortable sortable
prop="lastExecuteResult"/> prop="lastExecuteResult"/>
<test-case-review-status-table-item sortable/> <test-case-review-status-table-item sortable/>
@ -92,13 +92,13 @@
<div v-html="getTagToolTips(scope.row.tags)" slot="content"></div> <div v-html="getTagToolTips(scope.row.tags)" slot="content"></div>
<div class="oneLine"> <div class="oneLine">
<ms-tag <ms-tag
v-for="(itemName, index) in scope.row.tags" v-for="(itemName, index) in scope.row.tags"
:key="index" :key="index"
type="success" type="success"
effect="plain" effect="plain"
:show-tooltip="scope.row.tags.length === 1 && itemName.length * 12 <= 100" :show-tooltip="scope.row.tags.length === 1 && itemName.length * 12 <= 100"
:content="itemName" :content="itemName"
style="margin-left: 0px; margin-right: 2px" /> style="margin-left: 0px; margin-right: 2px"/>
</div> </div>
</el-tooltip> </el-tooltip>
</template> </template>
@ -257,14 +257,14 @@ export default {
}, },
getCustomNum() { getCustomNum() {
getProjectApplicationConfig('CASE_CUSTOM_NUM') getProjectApplicationConfig('CASE_CUSTOM_NUM')
.then(result => { .then(result => {
let data = result.data; let data = result.data;
if (data && data.typeValue === 'true') { if (data && data.typeValue === 'true') {
this.customNum = true; this.customNum = true;
} else { } else {
this.customNum = false; this.customNum = false;
} }
}); });
}, },
search() { search() {
// //
@ -327,7 +327,7 @@ export default {
}, },
getVersionOptions() { getVersionOptions() {
getVersionFilters(this.projectId) getVersionFilters(this.projectId)
.then(r => this.versionFilters = r.data); .then(r => this.versionFilters = r.data);
}, },
changeVersion(currentVersion) { changeVersion(currentVersion) {
this.page.condition.versionId = currentVersion || null; this.page.condition.versionId = currentVersion || null;

View File

@ -13,10 +13,10 @@
<el-row> <el-row>
<el-col :span="10"> <el-col :span="10">
<el-form-item <el-form-item
:placeholder="$t('test_track.review.input_review_name')" :placeholder="$t('test_track.review.input_review_name')"
:label="$t('test_track.review.review_name')" :label="$t('test_track.review.review_name')"
:label-width="formLabelWidth" :label-width="formLabelWidth"
prop="name"> prop="name">
<el-input v-model="form.name"/> <el-input v-model="form.name"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -31,16 +31,16 @@
<el-col :span="10"> <el-col :span="10">
<el-form-item :label="$t('test_track.review.reviewer')" :label-width="formLabelWidth" prop="userIds"> <el-form-item :label="$t('test_track.review.reviewer')" :label-width="formLabelWidth" prop="userIds">
<el-select <el-select
v-model="form.userIds" v-model="form.userIds"
:placeholder="$t('test_track.review.input_reviewer')" :placeholder="$t('test_track.review.input_reviewer')"
filterable multiple filterable multiple
style="width: 100%" style="width: 100%"
> >
<el-option <el-option
v-for="item in reviewerOptions" v-for="item in reviewerOptions"
:key="item.id" :key="item.id"
:label="item.name" :label="item.name"
:value="item.id"> :value="item.id">
</el-option> </el-option>
</el-select> </el-select>
<div v-if="isEdit" class="item-tip"> <div v-if="isEdit" class="item-tip">
@ -63,13 +63,13 @@
<el-form-item :label="$t('review.review_pass_rule')" :label-width="formLabelWidth" prop="reviewPassRule"> <el-form-item :label="$t('review.review_pass_rule')" :label-width="formLabelWidth" prop="reviewPassRule">
<el-select v-model="form.reviewPassRule" default-first-option> <el-select v-model="form.reviewPassRule" default-first-option>
<el-option <el-option
v-for="item in [ v-for="item in [
{text: 'review.review_pass_rule_single', value: 'SINGLE'}, {text: 'review.review_pass_rule_single', value: 'SINGLE'},
{text: 'review.review_pass_rule_all', value: 'ALL'} {text: 'review.review_pass_rule_all', value: 'ALL'}
]" ]"
:key="item.value" :key="item.value"
:label="$t(item.text)" :label="$t(item.text)"
:value="item.value"> :value="item.value">
</el-option> </el-option>
</el-select> </el-select>
<ms-instructions-icon :content="$t('review.review_rule_tip')" effect="light"/> <ms-instructions-icon :content="$t('review.review_rule_tip')" effect="light"/>
@ -199,65 +199,60 @@ export default {
this.reload(); this.reload();
}, },
reviewInfo() { reviewInfo() {
this.$refs['reviewForm'].validate((valid) => { this.$refs['reviewForm'].validate((valid) => {
if (valid) { if (valid) {
if (this.form.status !== 'Finished' && this.form.status !== 'Archived' && !this.compareTime(new Date().getTime(), this.form.endTime)) {
return false;
}
let param = {}; let param = {};
Object.assign(param, this.form); Object.assign(param, this.form);
param.name = param.name.trim(); param.name = param.name.trim();
if (this.form.tags instanceof Array) {
this.form.tags = JSON.stringify(this.form.tags);
}
param.tags = this.form.tags;
if (param.name === '') { if (param.name === '') {
this.$warning(this.$t('test_track.plan.input_plan_name')); this.$warning(this.$t('test_track.plan.input_plan_name'));
return; return;
} }
if (this.form.tags instanceof Array) {
if (!this.compareTime(new Date().getTime(), this.form.endTime)) { this.form.tags = JSON.stringify(this.form.tags);
return false;
} }
param.tags = this.form.tags;
param.projectId = this.projectId; param.projectId = this.projectId;
if (this.projectId) { if (this.projectId) {
saveOrUpdateTestCaseReview(this.operationType, param) saveOrUpdateTestCaseReview(this.operationType, param)
.then((response) => { .then((response) => {
this.dialogFormVisible = false; this.dialogFormVisible = false;
this.$router.push('/track/review/view/' + response.data.id); this.$router.push('/track/review/view/' + response.data.id);
}); });
} }
} else { } else {
return false; return false;
} }
}); });
}, },
saveReview() { saveReview() {
this.$refs['reviewForm'].validate((valid) => { this.$refs['reviewForm'].validate((valid) => {
if (valid) { if (valid) {
if (this.form.status !== 'Finished' && this.form.status !== 'Archived' && !this.compareTime(new Date().getTime(), this.form.endTime)) {
return false;
}
let param = {}; let param = {};
Object.assign(param, this.form); Object.assign(param, this.form);
param.name = param.name.trim(); param.name = param.name.trim();
if (this.form.tags instanceof Array) {
this.form.tags = JSON.stringify(this.form.tags);
}
param.tags = this.form.tags;
if (param.name === '') { if (param.name === '') {
this.$warning(this.$t('test_track.plan.input_plan_name')); this.$warning(this.$t('test_track.plan.input_plan_name'));
return; return;
} }
if (this.form.tags instanceof Array) {
if (!this.compareTime(new Date().getTime(), this.form.endTime)) { this.form.tags = JSON.stringify(this.form.tags);
return false;
} }
param.tags = this.form.tags;
param.projectId = this.projectId; param.projectId = this.projectId;
if (this.projectId) { if (this.projectId) {
saveOrUpdateTestCaseReview(this.operationType, param) saveOrUpdateTestCaseReview(this.operationType, param)
.then(() => { .then(() => {
this.$success(this.$t('commons.save_success')); this.$success(this.$t('commons.save_success'));
this.dialogFormVisible = false; this.dialogFormVisible = false;
this.$emit("refresh"); this.$emit("refresh");
}); });
} }
} else { } else {
return false; return false;
@ -266,9 +261,9 @@ export default {
}, },
setReviewerOptions() { setReviewerOptions() {
getMaintainer() getMaintainer()
.then((response) => { .then((response) => {
this.reviewerOptions = response.data; this.reviewerOptions = response.data;
}) })
}, },
statusChange(status) { statusChange(status) {
this.form.status = status; this.form.status = status;
@ -298,6 +293,10 @@ export default {
endTimeChange(value) { endTimeChange(value) {
if (value) { if (value) {
this.form.endTime = this.form.endTime.getTime(); this.form.endTime = this.form.endTime.getTime();
if (this.form.status === 'Finished' || this.form.status === 'Archived') {
// ,
return;
}
this.compareTime(new Date().getTime(), value.getTime()); this.compareTime(new Date().getTime(), value.getTime());
} }
}, },

View File

@ -21,18 +21,18 @@
<el-container class="main-content"> <el-container class="main-content">
<ms-aside-container <ms-aside-container
:min-width="'350'" :min-width="'350'"
:max-width="'600'" :max-width="'600'"
:enable-aside-hidden="false" :enable-aside-hidden="false"
:default-hidden-bottom-top="200" :default-hidden-bottom-top="200"
:enable-auto-height="true" :enable-auto-height="true"
> >
<select-menu <select-menu
:data="projects" :data="projects"
width="173px" width="173px"
:current-data="currentProject" :current-data="currentProject"
:title="$t('test_track.switch_project')" :title="$t('test_track.switch_project')"
@dataChange="changeProject"/> @dataChange="changeProject"/>
<node-tree class="node-tree" <node-tree class="node-tree"
:all-label="$t('commons.all_label.review')" :all-label="$t('commons.all_label.review')"
v-loading="result.loading" v-loading="result.loading"
@ -45,7 +45,8 @@
<el-container> <el-container>
<el-main class="case-content"> <el-main class="case-content">
<ms-table-header :tip="$t('commons.search_by_name_or_id')" :condition.sync="condition" @search="search" title="" :show-create="false"> <ms-table-header :tip="$t('commons.search_by_name_or_id')" :condition.sync="condition" @search="search"
title="" :show-create="false">
<template v-slot:searchBarBefore> <template v-slot:searchBarBefore>
<version-select v-xpack :project-id="projectId" @changeVersion="changeVersion" margin-right="20"/> <version-select v-xpack :project-id="projectId" @changeVersion="changeVersion" margin-right="20"/>
</template> </template>
@ -63,61 +64,61 @@
ref="table"> ref="table">
<el-table-column <el-table-column
v-if="!customNum" v-if="!customNum"
prop="num" prop="num"
min-width="120" min-width="120"
sortable sortable
:label="$t('commons.id')"> :label="$t('commons.id')">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
v-if="customNum" v-if="customNum"
prop="customNum" prop="customNum"
min-width="120" min-width="120"
sortable sortable
:label="$t('commons.id')"> :label="$t('commons.id')">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="name" prop="name"
:label="$t('test_track.case.name')" :label="$t('test_track.case.name')"
min-width="120" min-width="120"
show-overflow-tooltip> show-overflow-tooltip>
<template v-slot:default="scope"> <template v-slot:default="scope">
{{ scope.row.name }} {{ scope.row.name }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
v-if="versionEnable" v-if="versionEnable"
prop="versionName" prop="versionName"
:label="$t('test_track.case.version')" :label="$t('test_track.case.version')"
column-key="versionId" column-key="versionId"
:filters="versionFilters" :filters="versionFilters"
style="width: 100%"> style="width: 100%">
<template v-slot:default="scope"> <template v-slot:default="scope">
{{ scope.row.versionName }} {{ scope.row.versionName }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="priority" prop="priority"
:filters="priorityFilters" :filters="priorityFilters"
column-key="priority" column-key="priority"
:label="$t('test_track.case.priority')" :label="$t('test_track.case.priority')"
min-width="120" min-width="120"
show-overflow-tooltip> show-overflow-tooltip>
<template v-slot:default="scope"> <template v-slot:default="scope">
<priority-table-item :value="scope.row.priority" :priority-options="priorityFilters"/> <priority-table-item :value="scope.row.priority" :priority-options="priorityFilters"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
:filters="statusFilters" :filters="statusFilters"
column-key="reviewStatus" column-key="reviewStatus"
:label="$t('test_track.case.status')" :label="$t('test_track.case.status')"
min-width="120" min-width="120"
show-overflow-tooltip> show-overflow-tooltip>
<template v-slot:default="scope"> <template v-slot:default="scope">
<review-status :value="scope.row.reviewStatus"/> <review-status :value="scope.row.reviewStatus"/>
</template> </template>
@ -270,9 +271,6 @@ export default {
this.getVersionOptions(); this.getVersionOptions();
} }
}, },
activated() {
this.loadConditionComponents();
},
updated() { updated() {
this.toggleSelection(this.testReviews); this.toggleSelection(this.testReviews);
}, },
@ -290,9 +288,9 @@ export default {
} }
}) })
}, },
fullScreen(){ fullScreen() {
this.isFullScreen = !this.isFullScreen; this.isFullScreen = !this.isFullScreen;
this.screenHeight = this.isFullScreen ?'calc(100vh - 180px)' :'calc(100vh - 420px)' this.screenHeight = this.isFullScreen ? 'calc(100vh - 180px)' : 'calc(100vh - 420px)'
}, },
setConditionModuleIdParam() { setConditionModuleIdParam() {
this.condition.components.forEach(component => { this.condition.components.forEach(component => {
@ -302,13 +300,14 @@ export default {
}); });
}, },
async openTestReviewRelevanceDialog() { async openTestReviewRelevanceDialog() {
this.condition = { //
components: TEST_REVIEW_RELEVANCE_CASE_CONFIGS this.condition = {components: TEST_REVIEW_RELEVANCE_CASE_CONFIGS};
};
this.getProject(); this.getProject();
this.dialogFormVisible = true; this.dialogFormVisible = true;
await this.getProjectNode(this.projectId); await this.getProjectNode(this.projectId);
this.getReviews(); this.getReviews();
//
this.loadConditionComponents();
}, },
saveReviewRelevance() { saveReviewRelevance() {
let param = {}; let param = {};
@ -323,13 +322,13 @@ export default {
param.testCaseIds = ['all']; param.testCaseIds = ['all'];
} }
getTestCaseReviewRelevance(param) getTestCaseReviewRelevance(param)
.then(() => { .then(() => {
this.selectIds.clear(); this.selectIds.clear();
this.selectCounts = 0; this.selectCounts = 0;
this.$success(this.$t('commons.save_success')); this.$success(this.$t('commons.save_success'));
this.dialogFormVisible = false; this.dialogFormVisible = false;
this.$emit('refresh'); this.$emit('refresh');
}); });
}, },
buildPagePath(path) { buildPagePath(path) {
return path + "/" + this.currentPage + "/" + this.pageSize; return path + "/" + this.currentPage + "/" + this.pageSize;
@ -347,12 +346,12 @@ export default {
initCondition(this.condition, this.condition.selectAll); initCondition(this.condition, this.condition.selectAll);
this.condition.projectId = this.projectId || getCurrentProjectID(); this.condition.projectId = this.projectId || getCurrentProjectID();
getTestCaseReviewsCasePage(this.currentPage, this.pageSize, this.condition) getTestCaseReviewsCasePage(this.currentPage, this.pageSize, this.condition)
.then((response) => { .then((response) => {
let data = response.data; let data = response.data;
this.total = data.itemCount; this.total = data.itemCount;
this.testReviews = data.listObject; this.testReviews = data.listObject;
this.result.loading = false; this.result.loading = false;
}); });
}, },
setSelectCounts(data) { setSelectCounts(data) {
this.selectCounts = data; this.selectCounts = data;
@ -374,10 +373,10 @@ export default {
this.dialogFormVisible = false; this.dialogFormVisible = false;
this.condition.filters = {}; this.condition.filters = {};
this.condition.combine = {}; this.condition.combine = {};
if(this.condition.projectId) { if (this.condition.projectId) {
delete this.condition.projectId; delete this.condition.projectId;
} }
this.projectId= ''; this.projectId = '';
}, },
filter(filters) { filter(filters) {
_filter(filters, this.condition); _filter(filters, this.condition);
@ -396,22 +395,22 @@ export default {
getProject() { getProject() {
if (this.reviewId) { if (this.reviewId) {
projectRelated({userId: getCurrentUserId(), workspaceId: getCurrentWorkspaceId()}) projectRelated({userId: getCurrentUserId(), workspaceId: getCurrentWorkspaceId()})
.then((res) => { .then((res) => {
let data = res.data; let data = res.data;
if (data) { if (data) {
this.projects = data; this.projects = data;
const index = data.findIndex(d => d.id === getCurrentProjectID()); const index = data.findIndex(d => d.id === getCurrentProjectID());
if (index !== -1) { if (index !== -1) {
this.projectId = data[index].id; this.projectId = data[index].id;
this.projectName = data[index].name; this.projectName = data[index].name;
this.currentProject = data[index]; this.currentProject = data[index];
} else { } else {
this.projectId = data[0].id; this.projectId = data[0].id;
this.projectName = data[0].name; this.projectName = data[0].name;
this.currentProject = data[0]; this.currentProject = data[0];
}
} }
} });
});
} }
}, },
switchProject() { switchProject() {
@ -438,16 +437,16 @@ export default {
this.projectId = projectId; this.projectId = projectId;
} }
testCaseNodeListReviewRelate({reviewId: this.reviewId, projectId: this.projectId, ...condition}) testCaseNodeListReviewRelate({reviewId: this.reviewId, projectId: this.projectId, ...condition})
.then((response) => { .then((response) => {
this.treeNodes = response.data; this.treeNodes = response.data;
resolve(); resolve();
}); });
this.selectNodeIds = []; this.selectNodeIds = [];
}); });
}, },
getVersionOptions() { getVersionOptions() {
getVersionFilters(this.projectId) getVersionFilters(this.projectId)
.then(r => this.versionFilters = r.data); .then(r => this.versionFilters = r.data);
}, },
changeVersion(version) { changeVersion(version) {
this.condition.versionId = version || null; this.condition.versionId = version || null;
@ -455,14 +454,14 @@ export default {
}, },
getCustomNum() { getCustomNum() {
getProjectApplicationConfig('CASE_CUSTOM_NUM') getProjectApplicationConfig('CASE_CUSTOM_NUM')
.then(result => { .then(result => {
let data = result.data; let data = result.data;
if (data && data.typeValue === 'true') { if (data && data.typeValue === 'true') {
this.customNum = true; this.customNum = true;
} else { } else {
this.customNum = false; this.customNum = false;
} }
}); });
}, },
} }
} }