fix: 用例名称列宽调整#1005639

--bug=1005639 --user=lyh 【测试跟踪】测试用例列表名称列还是显示不全
https://www.tapd.cn/55049933/s/1036071
This commit is contained in:
shiziyuan9527 2021-08-18 11:35:05 +08:00 committed by 刘瑞斌
parent 97d989efb2
commit 54ba05d9f4
3 changed files with 148 additions and 236 deletions

View File

@ -62,7 +62,7 @@ public class TestReviewTestCaseService {
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders())); request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
List<TestReviewCaseDTO> list = extTestReviewCaseMapper.list(request); List<TestReviewCaseDTO> list = extTestReviewCaseMapper.list(request);
QueryMemberRequest queryMemberRequest = new QueryMemberRequest(); QueryMemberRequest queryMemberRequest = new QueryMemberRequest();
queryMemberRequest.setWorkspaceId(SessionUtils.getCurrentWorkspaceId()); queryMemberRequest.setWorkspaceId(SessionUtils.getCurrentProjectId());
Map<String, String> userMap = userService.getMemberList(queryMemberRequest) Map<String, String> userMap = userService.getMemberList(queryMemberRequest)
.stream().collect(Collectors.toMap(User::getId, User::getName)); .stream().collect(Collectors.toMap(User::getId, User::getName));
list.forEach(item -> { list.forEach(item -> {

View File

@ -295,7 +295,7 @@ export default {
// updata: false, // updata: false,
type: TEST_PLAN_FUNCTION_TEST_CASE, type: TEST_PLAN_FUNCTION_TEST_CASE,
fields: [], fields: [],
fieldsWidth: getCustomTableWidth('TRACK_TEST_CASE'), fieldsWidth: getCustomTableWidth('TEST_PLAN_FUNCTION_TEST_CASE'),
screenHeight: 'calc(100vh - 275px)', screenHeight: 'calc(100vh - 275px)',
tableLabel: [], tableLabel: [],
result: {}, result: {},

View File

@ -15,180 +15,132 @@
@refresh="initTableData"/> @refresh="initTableData"/>
<status-edit ref="statusEdit" :plan-id="reviewId" <status-edit ref="statusEdit" :plan-id="reviewId"
: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
v-loading="result.loading"
class="test-content adjust-table ms-select-all-fixed"
border
@select-all="handleSelectAll"
@filter-change="filter"
@sort-change="sort"
@select="handleSelectionChange"
row-key="id"
:height="screenHeight"
style="margin-top: 5px"
@row-click="showDetail"
ref="caseTable"
:data="tableData">
<el-table-column width="50" type="selection"/> <ms-table
v-loading="result.loading"
field-key="TEST_CASE_REVIEW_FUNCTION_TEST_CASE"
:data="tableData"
:condition="condition"
:total="total"
:page-size.sync="pageSize"
:operators="operators"
:screen-height="screenHeight"
:batch-operators="buttons"
@handlePageChange="initTableData"
@handleRowClick="showDetail"
:fields.sync="fields"
@refresh="initTableData"
ref="table"
>
<span v-for="item in fields" :key="item.key">
<ms-table-column
v-if="item.id === 'num'"
prop="customNum"
sortable="custom"
:fields-width="fieldsWidth"
:label="$t('commons.id')"
min-width="120px"/>
<ms-table-header-select-popover v-show="total>0" <ms-table-column
:page-size="pageSize > total ? total : pageSize" prop="name"
:total="total" :field="item"
:table-data-count-in-page="tableData.length" :fields-width="fieldsWidth"
@selectPageAll="isSelectDataAll(false)" :label="$t('commons.name')"
@selectAll="isSelectDataAll(true)"/> min-width="120px"/>
<el-table-column width="40" :resizable="false" align="center"> <ms-table-column
<template v-slot:default="scope"> prop="priority"
<show-more-btn :is-show-tool="scope.row.showTool" :is-show="scope.row.showMore" :buttons="buttons" :field="item"
:size="selectDataCounts"/> :fields-width="fieldsWidth"
</template> :filters="priorityFilters"
</el-table-column> sortable="custom"
<template v-for="(item, index) in tableLabel"> min-width="120px"
<el-table-column :label="$t('test_track.case.priority')">
v-if="item.id == 'num'"
prop="customNum"
sortable="custom"
min-width="100"
:label="$t('commons.id')"
show-overflow-tooltip
:key="index"
>
</el-table-column>
<el-table-column
v-if="item.id == 'name'"
prop="name"
min-width="100"
:label="$t('commons.name')"
show-overflow-tooltip
:key="index"
>
</el-table-column>
<el-table-column
v-if="item.id == 'priority'"
prop="priority"
:filters="priorityFilters"
column-key="priority"
sortable="custom"
min-width="120px"
:label="$t('test_track.case.priority')"
:key="index">
<template v-slot:default="scope"> <template v-slot:default="scope">
<priority-table-item :value="scope.row.priority" ref="priority"/> <priority-table-item :value="scope.row.priority" ref="priority"/>
</template> </template>
</el-table-column> </ms-table-column>
<el-table-column <ms-table-column
v-if="item.id == 'type'"
prop="type" prop="type"
:field="item"
:fields-width="fieldsWidth"
:filters="typeFilters" :filters="typeFilters"
column-key="type" sortable="custom"
min-width="100" min-width="120px"
:label="$t('test_track.case.type')" :label="$t('test_track.case.type')">
show-overflow-tooltip
:key="index">
<template v-slot:default="scope"> <template v-slot:default="scope">
<type-table-item :value="scope.row.type"/> <type-table-item :value="scope.row.type"/>
</template> </template>
</el-table-column> </ms-table-column>
<el-table-column
v-if="item.id == 'maintainer'" <ms-table-column
prop="maintainer" prop="maintainer"
:field="item"
:fields-width="fieldsWidth"
:label="$t('custom_field.case_maintainer')" :label="$t('custom_field.case_maintainer')"
show-overflow-tooltip min-width="120px"/>
:key="index"
min-width="120" <ms-table-column
>
</el-table-column>
<el-table-column
v-if="item.id=='nodePath'"
prop="nodePath" prop="nodePath"
min-width="180" :field="item"
:fields-width="fieldsWidth"
:label="$t('test_track.case.module')" :label="$t('test_track.case.module')"
show-overflow-tooltip min-width="120px"/>
:key="index"
>
</el-table-column>
<el-table-column <ms-table-column
v-if="item.id=='projectName'" prop="projectName"
prop="projectName" :field="item"
min-width="180" :fields-width="fieldsWidth"
:label="$t('test_track.review.review_project')" :label="$t('test_track.plan.plan_project')"
show-overflow-tooltip min-width="120px"/>
:key="index">
</el-table-column>
<el-table-column <ms-table-column
v-if="item.id=='reviewerName'" prop="reviewerName"
prop="reviewerName" :field="item"
min-width="80" :fields-width="fieldsWidth"
:label="$t('test_track.review.reviewer')" :label="$t('test_track.review.reviewer')"
show-overflow-tooltip min-width="120px"/>
:key="index"
>
</el-table-column>
<el-table-column <ms-table-column
v-if="item.id=='reviewStatus'" prop="reviewStatus"
:filters="statusFilters" :field="item"
column-key="status" :fields-width="fieldsWidth"
min-width="100" :filters="typeFilters"
:label="$t('test_track.review_view.execute_result')" sortable="custom"
:key="index"> min-width="120px"
<template v-slot:default="scope"> :label="$t('test_track.review_view.execute_result')">
<span class="el-dropdown-link"> <template v-slot:default="scope">
<review-status :value="scope.row.reviewStatus"/> <span class="el-dropdown-link">
</span> <review-status :value="scope.row.reviewStatus"/>
</template> </span>
</el-table-column> </template>
</ms-table-column>
<el-table-column <ms-table-column
v-if="item.id=='updateTime'" sortable
sortable prop="updateTime"
prop="updateTime" :field="item"
:label="$t('commons.update_time')" :fields-width="fieldsWidth"
show-overflow-tooltip :label="$t('commons.update_time')"
min-width="120" min-width="120px">
:key="index">
<template v-slot:default="scope"> <template v-slot:default="scope">
<span>{{ scope.row.updateTime | timestampFormatDate }}</span> <span>{{ scope.row.updateTime | timestampFormatDate }}</span>
</template> </template>
</el-table-column> </ms-table-column>
</template> </span>
<el-table-column
min-width="100" </ms-table>
fixed="right"
:label="$t('commons.operating')"
>
<template slot="header">
<header-label-operate @exec="customHeader"/>
</template>
<template v-slot:default="scope">
<div>
<ms-table-operator-button v-permission="['PROJECT_TRACK_CASE:READ+EDIT']" :tip="$t('commons.edit')"
icon="el-icon-edit"
@exec="handleEdit(scope.row)"/>
<ms-table-operator-button v-permission="['PROJECT_TRACK_REVIEW:READ+RELEVANCE_OR_CANCEL']"
:tip="$t('test_track.plan_view.cancel_relevance')"
icon="el-icon-unlock" type="danger" @exec="handleDelete(scope.row)"/>
</div>
</template>
</el-table-column>
</el-table>
<header-custom ref="headerCustom" :initTableData="initTableData" :optionalFields=headerItems
:type=type></header-custom>
<ms-table-pagination :change="search" :current-page.sync="currentPage" :page-size.sync="pageSize" <ms-table-pagination :change="search" :current-page.sync="currentPage" :page-size.sync="pageSize"
:total="total"/> :total="total"/>
<test-review-test-case-edit <test-review-test-case-edit
ref="testReviewTestCaseEdit" ref="testReviewTestCaseEdit"
:search-param="condition" :search-param="condition"
@refresh="initTableData" @refresh="initTableData"
:is-read-only="isReadOnly" :is-read-only="isReadOnly"
@refreshTable="search"/> @refreshTable="search"/>
<batch-edit ref="batchEdit" @batchEdit="batchEdit" <batch-edit ref="batchEdit" @batchEdit="batchEdit"
@ -213,27 +165,22 @@ import MsTableButton from "../../../../common/components/MsTableButton";
import ShowMoreBtn from "../../../case/components/ShowMoreBtn"; import ShowMoreBtn from "../../../case/components/ShowMoreBtn";
import BatchEdit from "../../../case/components/BatchEdit"; import BatchEdit from "../../../case/components/BatchEdit";
import MsTablePagination from '../../../../common/pagination/TablePagination'; import MsTablePagination from '../../../../common/pagination/TablePagination';
import {hasRoles} from "../../../../../../common/js/utils";
import {TEST_CASE_CONFIGS} from "../../../../common/components/search/search-components"; import {TEST_CASE_CONFIGS} from "../../../../common/components/search/search-components";
import {ROLE_TEST_MANAGER, ROLE_TEST_USER, TEST_CASE_REVIEW_CASE_LIST} from "../../../../../../common/js/constants";
import TestReviewTestCaseEdit from "./TestReviewTestCaseEdit"; import TestReviewTestCaseEdit from "./TestReviewTestCaseEdit";
import ReviewStatus from "@/business/components/track/case/components/ReviewStatus"; import ReviewStatus from "@/business/components/track/case/components/ReviewStatus";
import { import {
_filter,
_handleSelect,
_handleSelectAll, _handleSelectAll,
_sort, buildBatchParam, checkTableRowIsSelected, deepClone, getCustomTableWidth,
buildBatchParam, deepClone, getSelectDataCounts, getTableHeaderWithCustomFields,
getLabel,
getSelectDataCounts,
initCondition, initCondition,
setUnSelectIds,
toggleAllSelection toggleAllSelection
} from "@/common/js/tableUtils"; } from "@/common/js/tableUtils";
import HeaderCustom from "@/business/components/common/head/HeaderCustom"; import HeaderCustom from "@/business/components/common/head/HeaderCustom";
import {Test_Case_Review_Case_List} from "@/business/components/common/model/JsonData"; import {Test_Case_Review_Case_List} from "@/business/components/common/model/JsonData";
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate"; import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
import MsTableHeaderSelectPopover from "@/business/components/common/components/table/MsTableHeaderSelectPopover"; import MsTableHeaderSelectPopover from "@/business/components/common/components/table/MsTableHeaderSelectPopover";
import MsTableColumn from "@/business/components/common/components/table/MsTableColumn";
import MsTable from "@/business/components/common/components/table/MsTable";
export default { export default {
name: "TestReviewTestCaseList", name: "TestReviewTestCaseList",
@ -243,11 +190,15 @@ export default {
MsTableOperatorButton, MsTableOperator, MethodTableItem, TypeTableItem, MsTableOperatorButton, MsTableOperator, MethodTableItem, TypeTableItem,
StatusTableItem, PriorityTableItem, StatusEdit, StatusTableItem, PriorityTableItem, StatusEdit,
ExecutorEdit, MsTipButton, TestReviewTestCaseEdit, MsTableHeader, ExecutorEdit, MsTipButton, TestReviewTestCaseEdit, MsTableHeader,
NodeBreadcrumb, MsTableButton, ShowMoreBtn, BatchEdit, MsTablePagination, ReviewStatus, MsTableHeaderSelectPopover NodeBreadcrumb, MsTableButton, ShowMoreBtn, BatchEdit,
MsTablePagination, ReviewStatus, MsTableHeaderSelectPopover,
MsTableColumn,
MsTable,
}, },
data() { data() {
return { return {
type: TEST_CASE_REVIEW_CASE_LIST, fields: [],
fieldsWidth: getCustomTableWidth('TEST_CASE_REVIEW_FUNCTION_TEST_CASE'),
headerItems: Test_Case_Review_Case_List, headerItems: Test_Case_Review_Case_List,
screenHeight: 'calc(100vh - 270px)', screenHeight: 'calc(100vh - 270px)',
tableLabel: [], tableLabel: [],
@ -291,6 +242,18 @@ export default {
name: this.$t('test_track.case.batch_unlink'), handleClick: this.handleDeleteBatch name: this.$t('test_track.case.batch_unlink'), handleClick: this.handleDeleteBatch
} }
], ],
operators: [
{
tip: this.$t('commons.edit'), icon: "el-icon-edit",
exec: this.handleEdit,
permissions: ['PROJECT_TRACK_CASE:READ+EDIT']
},
{
tip: this.$t('test_track.plan_view.cancel_relevance'), icon: "el-icon-unlock", type: "danger",
exec: this.handleDelete,
permissions: ['PROJECT_TRACK_REVIEW:READ+RELEVANCE_OR_CANCEL']
}
],
typeArr: [ typeArr: [
{id: 'status', name: this.$t('test_track.review_view.execute_result')}, {id: 'status', name: this.$t('test_track.review_view.execute_result')},
], ],
@ -324,8 +287,15 @@ export default {
mounted() { mounted() {
this.refreshTableAndReview(); this.refreshTableAndReview();
this.isTestManagerOrTestUser = true; this.isTestManagerOrTestUser = true;
this.initTableHeader();
}, },
methods: { methods: {
initTableHeader() {
this.result.loading = true;
this.fields = getTableHeaderWithCustomFields('TEST_CASE_REVIEW_FUNCTION_TEST_CASE', []);
this.result.loading = false;
this.$refs.table.reloadTable();
},
customHeader() { customHeader() {
const list = deepClone(this.tableLabel); const list = deepClone(this.tableLabel);
this.$refs.headerCustom.open(list); this.$refs.headerCustom.open(list);
@ -349,49 +319,19 @@ export default {
let data = response.data; let data = response.data;
this.total = data.itemCount; this.total = data.itemCount;
this.tableData = data.listObject; this.tableData = data.listObject;
this.selectRows.clear(); this.tableClear();
checkTableRowIsSelected(this, this.$refs.table);
this.$nextTick(function () {
if (this.$refs.caseTable) {
setTimeout(this.$refs.caseTable.doLayout, 200);
}
this.checkTableRowIsSelect();
});
}); });
} }
getLabel(this, TEST_CASE_REVIEW_CASE_LIST);
}, },
checkTableRowIsSelect() {
//
if (this.condition.selectAll) {
let unSelectIds = this.condition.unSelectIds;
this.tableData.forEach(row => {
if (unSelectIds.indexOf(row.id) < 0) {
this.$refs.caseTable.toggleRowSelection(row, true);
//selectRows
if (!this.selectRows.has(row)) {
this.$set(row, "showMore", true);
this.selectRows.add(row);
}
} else {
//selectRow
if (this.selectRows.has(row)) {
this.$set(row, "showMore", false);
this.selectRows.delete(row);
}
}
});
}
},
showDetail(row, event, column) { showDetail(row, event, column) {
this.isReadOnly = true; this.isReadOnly = true;
this.$refs.testReviewTestCaseEdit.openTestCaseEdit(row); this.$refs.testReviewTestCaseEdit.openTestCaseEdit(row);
}, },
refresh() { refresh() {
this.condition = {components: TEST_CASE_CONFIGS}; this.condition = {components: TEST_CASE_CONFIGS};
this.selectRows.clear(); this.tableClear();
this.$emit('refresh'); this.$emit('refresh');
}, },
refreshTableAndReview() { refreshTableAndReview() {
@ -429,10 +369,11 @@ export default {
confirmButtonText: this.$t('commons.confirm'), confirmButtonText: this.$t('commons.confirm'),
callback: (action) => { callback: (action) => {
if (action === 'confirm') { if (action === 'confirm') {
let param = buildBatchParam(this); let param = buildBatchParam(this, this.$refs.table.selectIds);
param.ids = this.$refs.table.selectIds;
param.reviewId = this.reviewId; param.reviewId = this.reviewId;
this.$post('/test/review/case/batch/delete', param, () => { this.$post('/test/review/case/batch/delete', param, () => {
this.selectRows.clear(); this.tableClear();
this.$emit("refresh"); this.$emit("refresh");
this.$success(this.$t('test_track.cancel_relevance_success')); this.$success(this.$t('test_track.cancel_relevance_success'));
}); });
@ -448,47 +389,22 @@ export default {
}); });
}, },
handleEditBatch() { handleEditBatch() {
this.$refs.batchEdit.open(this.selectRows.size); this.$refs.batchEdit.open(this.$refs.table.selectRows.size);
}, },
batchEdit(form) { batchEdit(form) {
let reviewId = this.reviewId; let reviewId = this.reviewId;
let param = buildBatchParam(this); let param = buildBatchParam(this, this.$refs.table.selectIds);
param.ids = Array.from(this.$refs.table.selectRows).map(row => row.caseId);
param[form.type] = form.value; param[form.type] = form.value;
param.ids = Array.from(this.selectRows).map(row => row.caseId);
param.reviewId = reviewId; param.reviewId = reviewId;
this.$post('/test/review/case/batch/edit/status', param, () => { this.$post('/test/review/case/batch/edit/status', param, () => {
this.selectRows.clear(); this.tableClear();
this.status = ''; this.status = '';
this.$post('/test/case/review/edit/status/' + reviewId); this.$post('/test/case/review/edit/status/' + reviewId);
this.$success(this.$t('commons.save_success')); this.$success(this.$t('commons.save_success'));
this.$emit('refresh'); this.$emit('refresh');
}); });
}, },
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) {
_handleSelect(this, selection, row, this.selectRows);
setUnSelectIds(this.tableData, this.condition, this.selectRows);
this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows);
// 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() { openTestReport() {
this.$refs.testReportTemplateList.open(this.reviewId); this.$refs.testReportTemplateList.open(this.reviewId);
}, },
@ -500,18 +416,6 @@ export default {
}); });
} }
}, },
filter(filters) {
_filter(filters, this.condition);
this.initTableData();
},
sort(column) {
//
if (this.condition.orders) {
this.condition.orders = [];
}
_sort(column, this.condition);
this.initTableData();
},
startReview() { startReview() {
if (this.tableData.length !== 0) { if (this.tableData.length !== 0) {
this.isReadOnly = false; this.isReadOnly = false;
@ -531,7 +435,11 @@ export default {
// //
this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows); this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows);
}, },
tableClear() {
if (this.$refs.table) {
this.$refs.table.clear();
}
}
} }
}; };
</script> </script>
@ -542,5 +450,9 @@ export default {
font-weight: bold; font-weight: bold;
font-size: 0px; font-size: 0px;
} }
.ms-table-header {
margin-bottom: 10px;
}
</style> </style>