diff --git a/framework/sdk-parent/frontend/src/utils/default-table-header.js b/framework/sdk-parent/frontend/src/utils/default-table-header.js index b8e7f1ff8f..fcb337ac62 100644 --- a/framework/sdk-parent/frontend/src/utils/default-table-header.js +++ b/framework/sdk-parent/frontend/src/utils/default-table-header.js @@ -77,7 +77,7 @@ export let CUSTOM_TABLE_HEADER = { API_SCENARIO: [ { id: "num", key: "1", label: "ID" }, { id: "name", key: "2", label: "api_report.scenario_name" }, - { id: 'nodePath', key: '9', label: 'api_test.automation.module', defaultHide: true }, + { id: 'nodePath', key: "9", label: 'api_test.automation.module', defaultHide: true }, { id: "level", key: "3", label: "api_test.automation.case_level" }, { id: "status", key: "4", label: "test_track.plan.plan_status" }, { id: "tags", key: "5", label: "commons.tag" }, @@ -100,7 +100,7 @@ export let CUSTOM_TABLE_HEADER = { UI_SCENARIO: [ { id: "num", key: "1", label: "ID" }, { id: "name", key: "2", label: "api_report.scenario_name" }, - { id: 'nodePath', key: '9', label: 'api_test.automation.module', defaultHide: true }, + { id: 'nodePath', key: "9", label: 'api_test.automation.module', defaultHide: true }, { id: "level", key: "3", label: "api_test.automation.case_level" }, { id: "status", key: "4", label: "test_track.plan.plan_status" }, { id: "tags", key: "5", label: "commons.tag" }, @@ -123,7 +123,7 @@ export let CUSTOM_TABLE_HEADER = { UI_CUSTOM_COMMAND: [ { id: "num", key: "1", label: "ID" }, { id: "name", key: "2", label: "ui.command_name_label" }, - { id: 'nodePath', key: '9', label: 'api_test.automation.module', defaultHide: true}, + { id: 'nodePath', key: "9", label: 'api_test.automation.module', defaultHide: true}, { id: "tags", key: "5", label: "commons.tag" }, { id: "creatorName", key: "d", label: "api_test.automation.creator" }, { diff --git a/framework/sdk-parent/frontend/src/utils/tableUtils.js b/framework/sdk-parent/frontend/src/utils/tableUtils.js index 4e908f718c..c53e1612f2 100644 --- a/framework/sdk-parent/frontend/src/utils/tableUtils.js +++ b/framework/sdk-parent/frontend/src/utils/tableUtils.js @@ -311,26 +311,32 @@ export function getCustomTableHeaderByDefault(key, customFields) { } export function getAllFieldWithCustomFieldsByDefault(key, customFields) { - let fieldSetting = [...CUSTOM_TABLE_HEADER[key]]; - // 如果没有 license, 排除 xpack - if (!hasLicense()) { - fieldSetting = fieldSetting.filter((v) => !v.xpack); + let fieldStr = localStorage.getItem(key); + if (fieldStr == null) { + let fieldSetting = [...CUSTOM_TABLE_HEADER[key]]; + // 如果没有 license, 排除 xpack + if (!hasLicense()) { + fieldSetting = fieldSetting.filter((v) => !v.xpack); + } + fieldSetting = fieldSetting.filter((v) => !v.defaultHide); + fieldSetting = JSON.parse(JSON.stringify(fieldSetting)); + translateLabel(fieldSetting); + if (customFields) { + customFields.forEach((item) => { + let field = { + id: item.name, + key: item.key, + label: item.name, + isCustom: true, + }; + fieldSetting.push(field); + }); + } + return fieldSetting; + } else { + return getAllFieldWithCustomFields(key, customFields) } - fieldSetting = fieldSetting.filter((v) => !v.defaultHide); - fieldSetting = JSON.parse(JSON.stringify(fieldSetting)); - translateLabel(fieldSetting); - if (customFields) { - customFields.forEach((item) => { - let field = { - id: item.name, - key: item.key, - label: item.name, - isCustom: true, - }; - fieldSetting.push(field); - }); - } - return fieldSetting; + }