fix(测试跟踪): 修改自定义表头后,拖拽排序失效

--bug=1014223 --user=陈建星 【测试跟踪】表头显示字段增加/减少后用例拖拽失效,刷新后正常 https://www.tapd.cn/55049933/s/1185871
This commit is contained in:
chenjianxing 2022-06-18 16:00:39 +08:00 committed by jianxing
parent 6543dd5e2f
commit 4620167ae8
3 changed files with 30 additions and 19 deletions

View File

@ -19,7 +19,6 @@
@header-dragend="headerDragend" @header-dragend="headerDragend"
@cell-mouse-enter="showPopover" @cell-mouse-enter="showPopover"
@row-click="handleRowClick" @row-click="handleRowClick"
:key="tableActive"
ref="table"> ref="table">
<el-table-column <el-table-column
@ -139,7 +138,6 @@ import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOpe
import HeaderCustom from "@/business/components/common/head/HeaderCustom"; import HeaderCustom from "@/business/components/common/head/HeaderCustom";
import MsCustomTableHeader from "@/business/components/common/components/table/MsCustomTableHeader"; import MsCustomTableHeader from "@/business/components/common/components/table/MsCustomTableHeader";
import {lineToHump} from "@/common/js/utils"; import {lineToHump} from "@/common/js/utils";
import {editTestCaseOrder} from "@/network/testCase";
/** /**
* 参考 ApiList * 参考 ApiList
@ -166,8 +164,7 @@ export default {
selectRows: new Set(), selectRows: new Set(),
selectIds: [], selectIds: [],
hasBatchTipShow: false, hasBatchTipShow: false,
defaultSort: {}, defaultSort: {}
tableActive: true
}; };
}, },
props: { props: {
@ -489,10 +486,8 @@ export default {
this.$refs.table.toggleRowSelection(); this.$refs.table.toggleRowSelection();
}, },
reloadTable() { reloadTable() {
this.tableActive = false;
this.$nextTick(() => { this.$nextTick(() => {
this.doLayout(); this.doLayout();
this.tableActive = true;
}); });
}, },
addPaddingColClass({column}) { addPaddingColClass({column}) {

View File

@ -50,14 +50,6 @@
:label="$t('commons.delete_user')" :label="$t('commons.delete_user')"
min-width="120"/> min-width="120"/>
<ms-table-column
prop="projectName"
:fields-width="fieldsWidth"
:label="$t('test_track.case.project')"
v-if="publicEnable"
min-width="150px">
</ms-table-column>
<span v-for="(item, index) in fields" :key="index"> <span v-for="(item, index) in fields" :key="index">
<ms-table-column <ms-table-column
v-if="item.id === 'lastExecResult'" v-if="item.id === 'lastExecResult'"
@ -73,6 +65,14 @@
</template> </template>
</ms-table-column> </ms-table-column>
<ms-table-column
prop="projectName"
:fields-width="fieldsWidth"
:label="$t('test_track.case.project')"
v-if="publicEnable && item.id === 'projectName'"
min-width="150px">
</ms-table-column>
<ms-table-column <ms-table-column
v-if="!customNum" v-if="!customNum"
:field="item" :field="item"
@ -526,6 +526,10 @@ export default {
} }
}, },
created: function () { created: function () {
if (this.publicEnable) {
this.tableHeaderKey = 'TRACK_PUBLIC_TEST_CASE';
this.fields = getCustomTableHeader(this.tableHeaderKey);
}
this.getTemplateField(); this.getTemplateField();
this.$emit('setCondition', this.condition); this.$emit('setCondition', this.condition);
this.initTableData(); this.initTableData();
@ -631,7 +635,7 @@ export default {
Promise.all([p1, p2]).then((data) => { Promise.all([p1, p2]).then((data) => {
let template = data[1]; let template = data[1];
this.testCaseTemplate = template; this.testCaseTemplate = template;
this.fields = getTableHeaderWithCustomFields('TRACK_TEST_CASE', this.testCaseTemplate.customFields); this.fields = getTableHeaderWithCustomFields(this.tableHeaderKey, this.testCaseTemplate.customFields);
this.setTestCaseDefaultValue(template); this.setTestCaseDefaultValue(template);
this.typeArr = []; this.typeArr = [];
getCustomFieldBatchEditOption(template.customFields, this.typeArr, this.valueArr, this.members); getCustomFieldBatchEditOption(template.customFields, this.typeArr, this.valueArr, this.members);

View File

@ -32,7 +32,7 @@ export let CUSTOM_TABLE_HEADER = {
{id: 'createTime', key: '6', label: 'commons.create_time'}, {id: 'createTime', key: '6', label: 'commons.create_time'},
{id: 'updateTime', key: '7', label: 'commons.update_time'}, {id: 'updateTime', key: '7', label: 'commons.update_time'},
], ],
//接口定义 //接口定义
API_DEFINITION: [ API_DEFINITION: [
{id: 'num', key: '1', label: "ID"}, {id: 'num', key: '1', label: "ID"},
{id: 'name', key: '2', label: 'api_test.definition.api_name'}, {id: 'name', key: '2', label: 'api_test.definition.api_name'},
@ -49,7 +49,7 @@ export let CUSTOM_TABLE_HEADER = {
{id: 'createTime', key: 'c', label: 'commons.create_time'}, {id: 'createTime', key: 'c', label: 'commons.create_time'},
{id: 'description', key: 'e', label: 'commons.description'}, {id: 'description', key: 'e', label: 'commons.description'},
], ],
//接口用例 //接口用例
API_CASE: [ API_CASE: [
{id: 'num', key: '1', label: "ID"}, {id: 'num', key: '1', label: "ID"},
{id: 'name', key: '2', label: 'test_track.case.name'}, {id: 'name', key: '2', label: 'test_track.case.name'},
@ -215,7 +215,20 @@ export let CUSTOM_TABLE_HEADER = {
{id: 'desc', key: '9', label: 'test_track.case.case_desc'}, {id: 'desc', key: '9', label: 'test_track.case.case_desc'},
{id: 'lastExecResult', key: '0', label: 'test_track.plan_view.execute_result'}, {id: 'lastExecResult', key: '0', label: 'test_track.plan_view.execute_result'},
], ],
// 公共用例库
TRACK_PUBLIC_TEST_CASE: [
{id: 'num', key: '1', label: 'commons.id'},
{id: 'name', key: '2', label: 'commons.name'},
{id: 'reviewStatus', key: '3', label: 'test_track.case.status'},
{id: 'tags', key: '4', label: 'commons.tag'},
{id: 'versionId', key: 'b', label: 'project.version.name', xpack: true},
{id: 'projectName', key: '5', label: 'test_track.case.project'},
{id: 'updateTime', key: '6', label: 'commons.update_time'},
{id: 'createName', key: '7', label: 'commons.create_user'},
{id: 'createTime', key: '8', label: 'commons.create_time'},
{id: 'desc', key: '9', label: 'test_track.case.case_desc'},
{id: 'lastExecResult', key: '0', label: 'test_track.plan_view.execute_result'},
],
// 测试报告 // 测试报告
TRACK_REPORT_TABLE: [ TRACK_REPORT_TABLE: [
{id: 'name', key: '1', label: 'test_track.report.list.name'}, {id: 'name', key: '1', label: 'test_track.report.list.name'},
@ -306,4 +319,3 @@ export let CUSTOM_TABLE_HEADER = {
] ]
} }