diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.java b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.java index 3fae39300a..cc5301c246 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.java +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.java @@ -1,5 +1,6 @@ package io.metersphere.base.mapper.ext; +import io.metersphere.controller.request.BaseQueryRequest; import io.metersphere.track.dto.TestCaseReportStatusResultDTO; import io.metersphere.track.dto.TestCaseTestDTO; import io.metersphere.track.dto.TestPlanCaseDTO; @@ -53,4 +54,6 @@ public interface ExtTestPlanTestCaseMapper { List listTestCaseTest(@Param("caseId") String caseId); List selectIds(@Param("request") TestPlanFuncCaseConditions conditions); + + List selectIdsByQuery(@Param("request") BaseQueryRequest query); } diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.xml index e11b765560..01edb3753e 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.xml @@ -135,16 +135,7 @@ and plan_id = #{planId}; - + select test_plan_test_case.id as id, test_case.id as caseId, test_case.name, test_case.priority, + test_case.type,test_case.test_id as testId,test_case.node_id, test_case.tags, test_case.maintainer, test_case.custom_fields, + test_case.node_path, test_case.method, if(project.custom_num = 0, cast(test_case.num as char), test_case.custom_num) as customNum, test_plan_test_case.executor, test_plan_test_case.status, test_plan_test_case.actual_result, + test_plan_test_case.update_time, test_case_node.name as model, project.name as projectName, + test_plan_test_case.plan_id as planId + from test_plan_test_case + inner join test_case on test_plan_test_case.case_id = test_case.id + left join test_case_node on test_case_node.id = test_case.node_id + inner join project on project.id = test_case.project_id + + select * from test_case_test where test_case_id = #{caseId}; - + update test_plan_test_case diff --git a/backend/src/main/java/io/metersphere/track/request/testplancase/QueryTestPlanCaseRequest.java b/backend/src/main/java/io/metersphere/track/request/testplancase/QueryTestPlanCaseRequest.java index 1c6d2cb82b..2546e41205 100644 --- a/backend/src/main/java/io/metersphere/track/request/testplancase/QueryTestPlanCaseRequest.java +++ b/backend/src/main/java/io/metersphere/track/request/testplancase/QueryTestPlanCaseRequest.java @@ -1,6 +1,7 @@ package io.metersphere.track.request.testplancase; import io.metersphere.base.domain.TestPlanTestCase; +import io.metersphere.controller.request.BaseQueryRequest; import io.metersphere.controller.request.OrderRequest; import lombok.Getter; import lombok.Setter; @@ -10,26 +11,16 @@ import java.util.Map; @Getter @Setter -public class QueryTestPlanCaseRequest extends TestPlanTestCase { - - private List nodeIds; +public class QueryTestPlanCaseRequest extends BaseQueryRequest { private List nodePaths; - private List orders; - - private Map> filters; - private List planIds; private List projectIds; private String workspaceId; - private String projectId; - - private String name; - private String status; private String node; @@ -38,5 +29,11 @@ public class QueryTestPlanCaseRequest extends TestPlanTestCase { private String nodeId; + private String planId; + + private String executor; + + private String id; + private Map combine; } diff --git a/backend/src/main/java/io/metersphere/track/service/TestPlanTestCaseService.java b/backend/src/main/java/io/metersphere/track/service/TestPlanTestCaseService.java index d23c043630..357ceea970 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestPlanTestCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestPlanTestCaseService.java @@ -101,16 +101,7 @@ public class TestPlanTestCaseService { } public void editTestCaseBath(TestPlanCaseBatchRequest request) { - List ids = request.getIds(); - if (request.getCondition() != null && request.getCondition().isSelectAll()) { - ids = extTestPlanTestCaseMapper.selectIds(request.getCondition()); - if (request.getCondition().getUnSelectIds() != null) { - ids.removeAll(request.getCondition().getUnSelectIds()); - } - } - TestPlanTestCaseExample testPlanTestCaseExample = new TestPlanTestCaseExample(); - testPlanTestCaseExample.createCriteria().andIdIn(ids); - + TestPlanTestCaseExample testPlanTestCaseExample = getBatchExample(request); TestPlanTestCaseWithBLOBs testPlanTestCase = new TestPlanTestCaseWithBLOBs(); BeanUtils.copyBean(testPlanTestCase, request); testPlanTestCase.setUpdateTime(System.currentTimeMillis()); @@ -119,6 +110,14 @@ public class TestPlanTestCaseService { testPlanTestCaseExample); } + public TestPlanTestCaseExample getBatchExample(TestPlanCaseBatchRequest request) { + ServiceUtils.getSelectAllIds(request, request.getCondition(), + (query) -> extTestPlanTestCaseMapper.selectIdsByQuery(query)); + TestPlanTestCaseExample testPlanTestCaseExample = new TestPlanTestCaseExample(); + testPlanTestCaseExample.createCriteria().andIdIn(request.getIds()); + return testPlanTestCaseExample; + } + public List getRecentTestCases(QueryTestPlanCaseRequest request, int count) { buildQueryRequest(request, count); if (request.getPlanIds().isEmpty()) { @@ -195,8 +194,7 @@ public class TestPlanTestCaseService { } public void deleteTestCaseBath(TestPlanCaseBatchRequest request) { - TestPlanTestCaseExample example = new TestPlanTestCaseExample(); - example.createCriteria().andIdIn(request.getIds()); + TestPlanTestCaseExample example = getBatchExample(request); testPlanTestCaseMapper.deleteByExample(example); } diff --git a/frontend/src/business/components/api/definition/components/list/ApiList.vue b/frontend/src/business/components/api/definition/components/list/ApiList.vue index 9a80f66037..a41985998f 100644 --- a/frontend/src/business/components/api/definition/components/list/ApiList.vue +++ b/frontend/src/business/components/api/definition/components/list/ApiList.vue @@ -16,7 +16,7 @@ :fields.sync="fields" :table-is-loading="this.result.loading" field-key="API_DEFINITION" - ref="apiDefinitionTable"> + ref="table"> { + this.$post('/api/definition/reduction/', buildBatchParam(this, this.$refs.table.selectIds), () => { this.$success(this.$t('commons.save_success')); this.search(); }); @@ -631,8 +622,8 @@ export default { confirmButtonText: this.$t('commons.confirm'), callback: (action) => { if (action === 'confirm') { - this.$post('/api/definition/deleteBatchByParams/', buildBatchParam(this), () => { - this.$refs.apiDefinitionTable.clearSelectRows(); + this.$post('/api/definition/deleteBatchByParams/', buildBatchParam(this, this.$refs.table.selectIds), () => { + this.$refs.table.clear(); this.initTable(); this.$success(this.$t('commons.delete_success')); }); @@ -644,8 +635,8 @@ export default { confirmButtonText: this.$t('commons.confirm'), callback: (action) => { if (action === 'confirm') { - this.$post('/api/definition/removeToGcByParams/', buildBatchParam(this), () => { - this.$refs.apiDefinitionTable.clearSelectRows(); + this.$post('/api/definition/removeToGcByParams/', buildBatchParam(this, this.$refs.table.selectIds), () => { + this.$refs.table.clear(); this.initTable(); this.$success(this.$t('commons.delete_success')); this.$refs.caseList.apiCaseClose(); @@ -668,7 +659,7 @@ export default { this.$refs.batchEdit.open(); }, batchEdit(form) { - let param = buildBatchParam(this); + let param = buildBatchParam(this, this.$refs.table.selectIds); param[form.type] = form.value; this.$post('/api/definition/batch/editByParams', param, () => { this.$success(this.$t('commons.save_success')); @@ -676,15 +667,10 @@ export default { }); }, moveSave(param) { - let arr = Array.from(this.selectRows); - let ids = arr.map(row => row.id); + let ids = this.$refs.table.selectIds; param.ids = ids; param.projectId = this.projectId; - param.moduleId = param.nodeId; param.condition = this.condition; - param.selectAllDate = this.isSelectAllDate; - param.unSelectIds = this.unSelection; - param = Object.assign(param, this.condition); param.moduleId = param.nodeId; this.$post('/api/definition/batch/editByParams', param, () => { this.$success(this.$t('commons.save_success')); @@ -756,7 +742,7 @@ export default { return ids; }, exportApi(type) { - let param = buildBatchParam(this); + let param = buildBatchParam(this, this.$refs.table.selectIds); param.protocol = this.currentProtocol; if (param.ids === undefined || param.ids.length < 1) { this.$warning(this.$t("api_test.definition.check_select")); diff --git a/frontend/src/business/components/track/case/components/TestCaseList.vue b/frontend/src/business/components/track/case/components/TestCaseList.vue index 4a5b05266c..262fbb43b1 100644 --- a/frontend/src/business/components/track/case/components/TestCaseList.vue +++ b/frontend/src/business/components/track/case/components/TestCaseList.vue @@ -161,12 +161,16 @@ import TestCaseDetail from "./TestCaseDetail"; import ReviewStatus from "@/business/components/track/case/components/ReviewStatus"; import MsTag from "@/business/components/common/components/MsTag"; import { - buildBatchParam, deepClone, getCustomFieldBatchEditOption, getCustomFieldValue, getCustomTableWidth, + buildBatchParam, + checkTableRowIsSelected, + deepClone, + getCustomFieldBatchEditOption, + getCustomFieldValue, + getCustomTableWidth, getPageInfo, getTableHeaderWithCustomFields, initCondition, } from "@/common/js/tableUtils"; -import {Track_Test_Case} from "@/business/components/common/model/JsonData"; import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate"; import PlanStatusTableItem from "@/business/components/track/common/tableItems/plan/PlanStatusTableItem"; import {getCurrentProjectID} from "@/common/js/utils"; @@ -207,7 +211,6 @@ export default { return { type: TEST_CASE_LIST, screenHeight: 'calc(100vh - 310px)', - headerItems: Track_Test_Case, tableLabel: [], deletePath: "/test/case/delete", condition: { @@ -424,6 +427,7 @@ export default { this.page.data.forEach((item) => { item.tags = JSON.parse(item.tags); }); + checkTableRowIsSelected(this, this.$refs.table); }); } }, @@ -464,7 +468,7 @@ export default { confirmButtonText: this.$t('commons.confirm'), callback: (action) => { if (action === 'confirm') { - let param = buildBatchParam(this); + let param = buildBatchParam(this, this.$refs.table.selectIds); this.$post('/test/case/batch/delete', param, () => { this.$refs.table.clear(); this.$emit("refresh"); @@ -510,7 +514,7 @@ export default { url: '/test/case/export/testcase', method: 'post', responseType: 'blob', - data: buildBatchParam(this) + data: buildBatchParam(this, this.$refs.table.selectIds) }; if (config.data.ids === undefined || config.data.ids.length < 1) { diff --git a/frontend/src/business/components/track/plan/view/comonents/functional/FunctionalTestCaseList.vue b/frontend/src/business/components/track/plan/view/comonents/functional/FunctionalTestCaseList.vue index 260abf9fe3..100a4008c3 100644 --- a/frontend/src/business/components/track/plan/view/comonents/functional/FunctionalTestCaseList.vue +++ b/frontend/src/business/components/track/plan/view/comonents/functional/FunctionalTestCaseList.vue @@ -19,111 +19,91 @@ - - + - - - - - - - - - - - - - - + + + + + + + + + @@ -244,7 +216,6 @@ :is-read-only="isReadOnly" @refreshTable="search"/> - @@ -261,11 +232,8 @@ import MsTableButton from '../../../../../common/components/MsTableButton'; import NodeBreadcrumb from '../../../../common/NodeBreadcrumb'; import { - ROLE_TEST_MANAGER, - ROLE_TEST_USER, TEST_PLAN_FUNCTION_TEST_CASE, TokenKey, - WORKSPACE_ID } from "@/common/js/constants"; import {getCurrentProjectID, hasPermission} from "@/common/js/utils"; import PriorityTableItem from "../../../../common/tableItems/planview/PriorityTableItem"; @@ -275,34 +243,26 @@ import MethodTableItem from "../../../../common/tableItems/planview/MethodTableI import MsTableOperator from "../../../../../common/components/MsTableOperator"; import MsTableOperatorButton from "../../../../../common/components/MsTableOperatorButton"; import {TEST_CASE_CONFIGS} from "../../../../../common/components/search/search-components"; -import ShowMoreBtn from "../../../../case/components/ShowMoreBtn"; import BatchEdit from "../../../../case/components/BatchEdit"; import ClassicEditor from "@ckeditor/ckeditor5-build-classic"; import {hub} from "@/business/components/track/plan/event-bus"; import MsTag from "@/business/components/common/components/MsTag"; import { - _filter, - _handleSelect, - _handleSelectAll, - _sort, - buildBatchParam, - deepClone, - getLabel, - getSelectDataCounts, + buildBatchParam, checkTableRowIsSelected, + getCustomFieldValue, getCustomTableWidth, + getTableHeaderWithCustomFields, initCondition, - setUnSelectIds, - toggleAllSelection } from "@/common/js/tableUtils"; -import HeaderCustom from "@/business/components/common/head/HeaderCustom"; -import {Test_Plan_Function_Test_Case} from "@/business/components/common/model/JsonData"; -import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate"; -import MsTableHeaderSelectPopover from "@/business/components/common/components/table/MsTableHeaderSelectPopover"; +import MsTable from "@/business/components/common/components/table/MsTable"; +import MsTableColumn from "@/business/components/common/components/table/Ms-table-column"; +import {getProjectMember} from "@/network/user"; +import {getTestTemplate} from "@/network/custom-field-template"; export default { name: "FunctionalTestCaseList", components: { - HeaderLabelOperate, - HeaderCustom, + MsTableColumn, + MsTable, FunctionalTestCaseEdit, MsTableOperatorButton, MsTableOperator, @@ -310,14 +270,15 @@ export default { TypeTableItem, StatusTableItem, PriorityTableItem, StatusEdit, ExecutorEdit, MsTipButton, MsTablePagination, - MsTableHeader, NodeBreadcrumb, MsTableButton, ShowMoreBtn, - BatchEdit, MsTag, MsTableHeaderSelectPopover + MsTableHeader, NodeBreadcrumb, MsTableButton, + BatchEdit, MsTag }, data() { return { - updata: false, + // updata: false, type: TEST_PLAN_FUNCTION_TEST_CASE, - headerItems: Test_Plan_Function_Test_Case, + fields: [], + fieldsWidth: getCustomTableWidth('TRACK_TEST_CASE'), screenHeight: 'calc(100vh - 330px)', tableLabel: [], result: {}, @@ -331,7 +292,6 @@ export default { pageSize: 10, total: 0, status: 'default', - selectRows: new Set(), testPlan: {}, isReadOnly: false, hasEditPermission: false, @@ -345,11 +305,6 @@ export default { {text: this.$t('test_track.case.manual'), value: 'manual'}, {text: this.$t('test_track.case.auto'), value: 'auto'} ], - typeFilters: [ - {text: this.$t('commons.functional'), value: 'functional'}, - {text: this.$t('commons.performance'), value: 'performance'}, - {text: this.$t('commons.api'), value: 'api'} - ], statusFilters: [ {text: this.$t('test_track.plan.plan_status_prepare'), value: 'Prepare'}, {text: this.$t('test_track.plan_view.pass'), value: 'Pass'}, @@ -371,6 +326,18 @@ export default { permissions: ['PROJECT_TRACK_PLAN:READ+CASE_BATCH_DELETE'] } ], + 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_PLAN:READ+RELEVANCE_OR_CANCEL'] + } + ], typeArr: [ {id: 'status', name: this.$t('test_track.plan_view.execute_result')}, {id: 'executor', name: this.$t('test_track.plan_view.executor')}, @@ -389,8 +356,9 @@ export default { // 'increaseIndent','decreaseIndent' toolbar: [], }, - selectDataCounts: 0, - selectDataRange: "all" + selectDataRange: "all", + testCaseTemplate: {}, + }; }, props: { @@ -426,16 +394,30 @@ export default { this.refreshTableAndPlan(); this.hasEditPermission = hasPermission('PROJECT_TRACK_PLAN:READ+EDIT'); this.getMaintainerOptions(); + this.getTemplateField(); }, beforeDestroy() { hub.$off("openFailureTestCase"); }, methods: { - customHeader() { - const list = deepClone(this.tableLabel); - this.$refs.headerCustom.open(list); + getTemplateField() { + this.result.loading = true; + let p1 = getProjectMember((data) => { + this.members = data; + }); + let p2 = getTestTemplate(); + Promise.all([p1, p2]).then((data) => { + let template = data[1]; + this.result.loading = true; + this.testCaseTemplate = template; + this.fields = getTableHeaderWithCustomFields('TEST_PLAN_FUNCTION_TEST_CASE', this.testCaseTemplate.customFields); + this.result.loading = false; + this.$refs.table.reloadTable(); + }); + }, + getCustomFieldValue(row, field) { + return getCustomFieldValue(row, field, this.members); }, - initTableData() { initCondition(this.condition, this.condition.selectAll); this.autoCheckStatus(); @@ -463,6 +445,9 @@ export default { this.tableData = data.listObject; for (let i = 0; i < this.tableData.length; i++) { if (this.tableData[i]) { + if (this.tableData[i].customFields) { + this.tableData[i].customFields = JSON.parse(this.tableData[i].customFields); + } this.$set(this.tableData[i], "showTags", JSON.parse(this.tableData[i].tags)); this.$set(this.tableData[i], "issuesSize", 0); this.$get("/issues/get/" + this.tableData[i].caseId).then(response => { @@ -480,17 +465,10 @@ export default { }); } } - this.selectRows.clear(); - if (this.$refs.table) { - setTimeout(this.$refs.table.doLayout, 200); - } - - this.$nextTick(() => { - this.checkTableRowIsSelect(); - }); + this.$refs.table.clear(); + checkTableRowIsSelected(this, this.$refs.table); }); } - getLabel(this, TEST_PLAN_FUNCTION_TEST_CASE); }, autoCheckStatus() { if (!this.planId) { @@ -505,7 +483,7 @@ export default { }, refresh() { this.condition = {components: TEST_CASE_CONFIGS}; - this.selectRows.clear(); + this.$refs.table.clear(); this.$emit('refresh'); }, breadcrumbRefresh() { @@ -551,42 +529,16 @@ export default { confirmButtonText: this.$t('commons.confirm'), callback: (action) => { if (action === 'confirm') { - if (this.selectRows.size > 0) { - if (this.condition.selectAll) { - let param = buildBatchParam(this); - this.$post('/test/plan/case/idList/all', param, res => { - let ids = res.data; - this._handleBatchDelete(ids); - }); - } else { - let ids = Array.from(this.selectRows).map(row => row.id); - this._handleBatchDelete(ids); - } - } else { - if (this.planId) { - this.condition.planId = this.planId; - } - if (this.selectNodeIds && this.selectNodeIds.length > 0) { - this.condition.nodeIds = this.selectNodeIds; - } - // 根据条件查询计划下所有的关联用例 - this.$post('/test/plan/case/list/all', this.condition, res => { - let data = res.data; - let ids = data.map(d => d.id); - this._handleBatchDelete(ids); - }); - } + let param = buildBatchParam(this, this.$refs.table.selectIds); + this.$post('/test/plan/case/batch/delete', param, () => { + this.$refs.table.clear(); + this.$emit("refresh"); + this.$success(this.$t('test_track.cancel_relevance_success')); + }); } } }); }, - _handleBatchDelete(ids) { - this.result = this.$post('/test/plan/case/batch/delete', {ids: ids}, () => { - this.selectRows.clear(); - this.$emit("refresh"); - this.$success(this.$t('test_track.cancel_relevance_success')); - }); - }, _handleDelete(testCase) { let testCaseId = testCase.id; this.result = this.$post('/test/plan/case/delete/' + testCaseId, {}, () => { @@ -594,29 +546,6 @@ export default { this.$success(this.$t('test_track.cancel_relevance_success')); }); }, - handleSelectAll(selection) { - _handleSelectAll(this, selection, this.tableData, this.selectRows); - setUnSelectIds(this.tableData, this.condition, this.selectRows); - this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows); - }, - 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); - }, - 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(); - } - }, searchMyTestCase() { this.showMyTestCase = !this.showMyTestCase; if (this.showMyTestCase) { @@ -645,33 +574,12 @@ 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(); - }, - headerDragend(newWidth, oldWidth, column, event) { - let finalWidth = newWidth; - if (column.minWidth > finalWidth) { - finalWidth = column.minWidth; - } - column.width = finalWidth; - column.realWidth = finalWidth; - }, batchEdit(form) { - let param = buildBatchParam(this); + let param = buildBatchParam(this, this.$refs.table.selectIds); param[form.type] = form.value; - param.ids = Array.from(this.selectRows).map(row => row.id); + param.ids = this.$refs.table.selectIds; this.$post('/test/plan/case/batch/edit', param, () => { - this.selectRows.clear(); + this.$refs.table.clear(); this.status = ''; this.$post('/test/plan/edit/status/' + this.planId); this.$success(this.$t('commons.save_success')); @@ -693,40 +601,6 @@ export default { }); }); }, - checkTableRowIsSelect() { - //如果默认全选的话,则选中应该选中的行 - if (this.condition.selectAll) { - let unSelectIds = this.condition.unSelectIds; - this.tableData.forEach(row => { - if (unSelectIds.indexOf(row.id) < 0) { - this.$refs.table.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); - } - } - }); - } - }, - isSelectDataAll(data) { - this.condition.selectAll = data; - //设置勾选 - toggleAllSelection(this.$refs.table, this.tableData, this.selectRows); - //显示隐藏菜单 - _handleSelectAll(this, this.tableData, this.tableData, this.selectRows); - //设置未选择ID(更新) - this.condition.unSelectIds = []; - //更新统计信息 - this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows); - }, } }; @@ -746,11 +620,15 @@ export default { margin-left: 10px; } -.ms-table-header >>> .table-title { - height: 0px; -} +/*.ms-table-header >>> .table-title {*/ +/* height: 0px;*/ +/*}*/ -/deep/ .el-table__fixed-body-wrapper { - top: 59px !important; +/*/deep/ .el-table__fixed-body-wrapper {*/ +/* top: 59px !important;*/ +/*}*/ + +.ms-table-header { + margin-bottom: 10px; } diff --git a/frontend/src/common/js/custom_field.js b/frontend/src/common/js/custom_field.js index e3d9df2c26..9c1033fdea 100644 --- a/frontend/src/common/js/custom_field.js +++ b/frontend/src/common/js/custom_field.js @@ -57,7 +57,7 @@ export function parseCustomField(data, template, customFieldForm, rules, oldFiel if (data.customFields instanceof Array) { for (let i = 0; i < data.customFields.length; i++) { let customField = data.customFields[i]; - if (customField.id === item.id) { + if (customField.name === item.name) { setDefaultValue(item, customField.value); break; } @@ -97,13 +97,12 @@ export function buildCustomFields(data, param, template) { } nameSet.add(name); } - } template.customFields.forEach(item => { let hasField = false; for (const index in customFields) { - if (customFields[index].id === item.id) { + if (customFields[index].name === item.name) { hasField = true; customFields[index].name = item.name; customFields[index].value = item.defaultValue; diff --git a/frontend/src/common/js/default-table-header.js b/frontend/src/common/js/default-table-header.js index 61e649dd46..22440291d2 100644 --- a/frontend/src/common/js/default-table-header.js +++ b/frontend/src/common/js/default-table-header.js @@ -12,13 +12,6 @@ export const CUSTOM_FIELD_LIST = new Set([ 'updateTime' ]); -export const TEST_CASE_TEMPLATE_LIST = new Set([ - 'name', - 'type', - 'description', - 'createTime', - 'updateTime' -]); export const ISSUE_TEMPLATE_LIST = new Set([ 'name', @@ -100,7 +93,7 @@ export const CUSTOM_TABLE_HEADER = { {id: 'reviewerName', key: '7', label: i18n.t('test_track.review.reviewer')}, {id: 'reviewStatus', key: '8', label: i18n.t('test_track.case.status')}, {id: 'updateTime', key: '9', label: i18n.t('commons.update_time')}, - {id: 'maintainer', key: '10', label: i18n.t('custom_field.case_maintainer')}, + {id: 'maintainer', key: 'a', label: i18n.t('custom_field.case_maintainer')}, ], //测试计划 TEST_PLAN_LIST: [ @@ -113,26 +106,23 @@ export const CUSTOM_TABLE_HEADER = { {id: 'plannedStartTime', key: '7', label: i18n.t('test_track.plan.planned_start_time')}, {id: 'plannedEndTime', key: '8', label: i18n.t('test_track.plan.planned_end_time')}, {id: 'actualStartTime', key: '9', label: i18n.t('test_track.plan.actual_start_time')}, - {id: 'actualEndTime', key: '10', label: i18n.t('test_track.plan.actual_end_time')}, - {id: 'tags', key: '11', label: i18n.t('commons.tag')}, - {id: 'executionTimes', key: '12', label: i18n.t('commons.execution_times')}, - {id: 'passRate', key: '13', label: i18n.t('commons.pass_rate')}, - {id: 'createUser', key: '14', label: i18n.t('commons.create_user')}, + {id: 'actualEndTime', key: 'a', label: i18n.t('test_track.plan.actual_end_time')}, + {id: 'tags', key: 'b', label: i18n.t('commons.tag')}, + {id: 'executionTimes', key: 'c', label: i18n.t('commons.execution_times')}, + {id: 'passRate', key: 'd', label: i18n.t('commons.pass_rate')}, + {id: 'createUser', key: 'e', label: i18n.t('commons.create_user')}, ], //测试计划-功能用例 TEST_PLAN_FUNCTION_TEST_CASE: [ {id: 'num', key: '1', label: i18n.t('commons.id')}, - {id: 'name', key: ' 2', label: i18n.t('commons.name')}, - {id: 'priority', key: '3', label: i18n.t('test_track.case.priority')}, - {id: 'type', key: '4', label: i18n.t('test_track.case.type')}, - {id: 'tags', key: '5', label: i18n.t('commons.tag')}, - {id: 'nodePath', key: '6', label: i18n.t('test_track.case.module')}, - {id: 'projectName', key: '7', label: i18n.t('test_track.review.review_project')}, - {id: 'issuesContent', key: '8', label: i18n.t('test_track.issue.issue')}, - {id: 'executorName', key: '9', label: i18n.t('test_track.plan_view.executor')}, - {id: 'status', key: '10', label: i18n.t('test_track.plan_view.execute_result')}, - {id: 'updateTime', key: '11', label: i18n.t('commons.update_time')}, - {id: 'maintainer', key: '12', label: i18n.t('api_test.definition.request.responsible')} + {id: 'name', key: '2', label: i18n.t('commons.name')}, + {id: 'tags', key: '3', label: i18n.t('commons.tag')}, + {id: 'nodePath', key: '4', label: i18n.t('test_track.case.module')}, + {id: 'projectName', key: '5', label: i18n.t('test_track.review.review_project')}, + {id: 'issuesContent', key: '6', label: i18n.t('test_track.issue.issue')}, + {id: 'executorName', key: '7', label: i18n.t('test_track.plan_view.executor')}, + {id: 'status', key: '8', label: i18n.t('test_track.plan_view.execute_result')}, + {id: 'updateTime', key: '9', label: i18n.t('commons.update_time')}, ], //测试计划-api用例 TEST_PLAN_API_CASE: [ @@ -169,7 +159,7 @@ export const CUSTOM_TABLE_HEADER = { {id: 'stepTotal', key: '7', label: i18n.t('api_test.automation.success')}, {id: 'lastResult', key: '8', label: i18n.t('api_test.automation.fail')}, {id: 'passRate', key: '9', label: i18n.t('api_test.automation.passing_rate')}, - {id: 'maintainer', key: '10', label: i18n.t('api_test.definition.request.responsible')} + {id: 'maintainer', key: 'a', label: i18n.t('api_test.definition.request.responsible')} ], //测试用例 TRACK_TEST_CASE: [ diff --git a/frontend/src/common/js/tableUtils.js b/frontend/src/common/js/tableUtils.js index feea5c17d4..6cb40b4322 100644 --- a/frontend/src/common/js/tableUtils.js +++ b/frontend/src/common/js/tableUtils.js @@ -9,6 +9,7 @@ export function _handleSelectAll(component, selection, tableData, selectRows, co selection.hashTree = []; tableData.forEach(item => { component.$set(item, "showMore", true); + selectRows.add(item); }); } else { tableData.forEach(item => { @@ -26,9 +27,6 @@ export function _handleSelectAll(component, selection, tableData, selectRows, co condition.selectAll = false; } } - if (selectRows.size < 1 && condition) { - condition.selectAll = false; - } } export function _handleSelect(component, selection, row, selectRows) { @@ -109,6 +107,15 @@ export function checkTableRowIsSelect(component, condition, tableData, table, se } } +// nexttick:表格加载完成之后触发。判断是否需要勾选行 +export function checkTableRowIsSelected(veuObj, table) { + veuObj.$nextTick(function () { + if (table) { + table.checkTableRowIsSelect(); + table.doLayout(); + } + }); +} //表格数据过滤 export function _filter(filters, condition) { @@ -179,9 +186,9 @@ export function getLabel(vueObj, type) { } -export function buildBatchParam(vueObj) { +export function buildBatchParam(vueObj, selectIds) { let param = {}; - param.ids = Array.from(vueObj.selectRows).map(row => row.id); + param.ids = selectIds ? selectIds: Array.from(vueObj.selectRows).map(row => row.id); param.projectId = getCurrentProjectID(); param.condition = vueObj.condition; return param;