refactor: 测试计划和评审用例记住排序
This commit is contained in:
parent
353bb0eafa
commit
ec1b4bbdfd
|
@ -90,6 +90,7 @@ import MsTableOperators from "@/business/components/common/components/MsTableOpe
|
|||
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
|
||||
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
|
||||
import MsCustomTableHeader from "@/business/components/common/components/table/MsCustomTableHeader";
|
||||
import {lineToHump} from "@/common/js/utils";
|
||||
|
||||
/**
|
||||
* 参考 ApiList
|
||||
|
@ -248,13 +249,14 @@ export default {
|
|||
let orders = this.condition.orders;
|
||||
if (orders) {
|
||||
orders.forEach(item => {
|
||||
this.defaultSort = {};
|
||||
this.defaultSort.prop = item.name;
|
||||
this.defaultSort = {
|
||||
prop: lineToHump(item.name),
|
||||
order: 'descending'
|
||||
};
|
||||
if (item.type === 'asc') {
|
||||
this.defaultSort.order = 'ascending';
|
||||
} else {
|
||||
this.defaultSort.order = 'descending';
|
||||
}
|
||||
return;
|
||||
});
|
||||
}
|
||||
},
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
<ms-table
|
||||
v-loading="result.loading"
|
||||
field-key="TEST_PLAN_FUNCTION_TEST_CASE"
|
||||
:field-key="tableHeaderKey"
|
||||
:data="tableData"
|
||||
:condition="condition"
|
||||
:total="total"
|
||||
|
@ -32,6 +32,7 @@
|
|||
@handlePageChange="initTableData"
|
||||
@handleRowClick="handleEdit"
|
||||
:fields.sync="fields"
|
||||
:remember-order="true"
|
||||
@refresh="initTableData"
|
||||
ref="table">
|
||||
|
||||
|
@ -266,7 +267,7 @@ import {hub} from "@/business/components/track/plan/event-bus";
|
|||
import MsTag from "@/business/components/common/components/MsTag";
|
||||
import {
|
||||
buildBatchParam, checkTableRowIsSelected,
|
||||
getCustomFieldValue, getCustomTableWidth,
|
||||
getCustomFieldValue, getCustomTableWidth, getLastTableSortField,
|
||||
getTableHeaderWithCustomFields,
|
||||
initCondition,
|
||||
} from "@/common/js/tableUtils";
|
||||
|
@ -312,6 +313,7 @@ export default {
|
|||
testPlan: {},
|
||||
isReadOnly: false,
|
||||
hasEditPermission: false,
|
||||
tableHeaderKey: 'TEST_PLAN_FUNCTION_TEST_CASE',
|
||||
priorityFilters: [
|
||||
{text: 'P0', value: 'P0'},
|
||||
{text: 'P1', value: 'P1'},
|
||||
|
@ -405,6 +407,9 @@ export default {
|
|||
this.$emit('setCondition', this.condition);
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.condition.orders = getLastTableSortField(this.tableHeaderKey);
|
||||
},
|
||||
mounted() {
|
||||
this.$emit('setCondition', this.condition);
|
||||
hub.$on("openFailureTestCase", row => {
|
||||
|
@ -431,7 +436,7 @@ export default {
|
|||
let template = data[1];
|
||||
this.result.loading = true;
|
||||
this.testCaseTemplate = template;
|
||||
this.fields = getTableHeaderWithCustomFields('TEST_PLAN_FUNCTION_TEST_CASE', this.testCaseTemplate.customFields);
|
||||
this.fields = getTableHeaderWithCustomFields(this.tableHeaderKey, this.testCaseTemplate.customFields);
|
||||
this.result.loading = false;
|
||||
this.$refs.table.reloadTable();
|
||||
});
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
<ms-table
|
||||
v-loading="result.loading"
|
||||
field-key="TEST_CASE_REVIEW_FUNCTION_TEST_CASE"
|
||||
:field-key="tableHeaderKey"
|
||||
:data="tableData"
|
||||
:condition="condition"
|
||||
:total="total"
|
||||
|
@ -29,6 +29,7 @@
|
|||
@handlePageChange="initTableData"
|
||||
@handleRowClick="showDetail"
|
||||
:fields.sync="fields"
|
||||
:remember-order="true"
|
||||
@refresh="initTableData"
|
||||
ref="table"
|
||||
>
|
||||
|
@ -168,7 +169,7 @@ import TestReviewTestCaseEdit from "./TestReviewTestCaseEdit";
|
|||
import ReviewStatus from "@/business/components/track/case/components/ReviewStatus";
|
||||
import {
|
||||
_handleSelectAll,
|
||||
buildBatchParam, checkTableRowIsSelected, deepClone, getCustomTableWidth,
|
||||
buildBatchParam, checkTableRowIsSelected, deepClone, getCustomTableWidth, getLastTableSortField,
|
||||
getSelectDataCounts, getTableHeaderWithCustomFields,
|
||||
initCondition,
|
||||
toggleAllSelection
|
||||
|
@ -211,6 +212,7 @@ export default {
|
|||
isReadOnly: false,
|
||||
isTestManagerOrTestUser: false,
|
||||
selectDataCounts: 0,
|
||||
tableHeaderKey: 'TEST_CASE_REVIEW_FUNCTION_TEST_CASE',
|
||||
priorityFilters: [
|
||||
{text: 'P0', value: 'P0'},
|
||||
{text: 'P1', value: 'P1'},
|
||||
|
@ -285,6 +287,9 @@ export default {
|
|||
return this.$store.state.testReviewSelectNodeIds;
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.condition.orders = getLastTableSortField(this.tableHeaderKey);
|
||||
},
|
||||
mounted() {
|
||||
this.$emit('setCondition', this.condition);
|
||||
this.refreshTableAndReview();
|
||||
|
@ -294,7 +299,7 @@ export default {
|
|||
methods: {
|
||||
initTableHeader() {
|
||||
this.result.loading = true;
|
||||
this.fields = getTableHeaderWithCustomFields('TEST_CASE_REVIEW_FUNCTION_TEST_CASE', []);
|
||||
this.fields = getTableHeaderWithCustomFields(this.tableHeaderKey, []);
|
||||
this.result.loading = false;
|
||||
this.$refs.table.reloadTable();
|
||||
},
|
||||
|
|
|
@ -253,6 +253,12 @@ export function mapToJson(strMap) {
|
|||
export function humpToLine(name) {
|
||||
return name.replace(/([A-Z])/g, "_$1").toLowerCase();
|
||||
}
|
||||
// 下划线转换驼峰
|
||||
export function lineToHump(name) {
|
||||
return name.replace(/\_(\w)/g, function(all, letter){
|
||||
return letter.toUpperCase();
|
||||
});
|
||||
}
|
||||
|
||||
export function downloadFile(name, content) {
|
||||
const blob = new Blob([content]);
|
||||
|
|
Loading…
Reference in New Issue