feat(测试跟踪): 表头默认不显示所属模块字段

--story=1013902 --user=王旭 【接口测试】和【UI测试】场景列表的表头字段支持展示所属模块 https://www.tapd.cn/55049933/s/1442910
This commit is contained in:
WangXu10 2023-12-12 16:40:39 +08:00 committed by Craftsman
parent 4a5b4a187e
commit 3db0e65c6b
3 changed files with 34 additions and 4 deletions

View File

@ -442,7 +442,7 @@ import { API_SCENARIO_CONFIGS } from 'metersphere-frontend/src/components/search
import { API_SCENARIO_LIST } from 'metersphere-frontend/src/utils/constants';
import {
buildBatchParam,
getCustomTableHeader,
getCustomTableHeaderByDefault,
getCustomTableWidth,
getLastTableSortField,
getSelectDataCounts,
@ -558,7 +558,7 @@ export default {
result: false,
tableHeaderKey: 'API_SCENARIO',
type: API_SCENARIO_LIST,
fields: getCustomTableHeader('API_SCENARIO', undefined),
fields: getCustomTableHeaderByDefault('API_SCENARIO', undefined),
fieldsWidth: getCustomTableWidth('API_SCENARIO'),
screenHeight: 'calc(100vh - 200px)', //,
condition: {

View File

@ -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'},
{ 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'},
{ 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" },

View File

@ -304,6 +304,36 @@ export function getCustomTableHeader(key, customFields) {
return getCustomTableHeaderByFiledSetting(key, fieldSetting);
}
export function getCustomTableHeaderByDefault(key, customFields) {
let fieldSetting = getAllFieldWithCustomFieldsByDefault(key, customFields);
return getCustomTableHeaderByFiledSetting(key, fieldSetting);
}
export function getAllFieldWithCustomFieldsByDefault(key, customFields) {
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;
}
/**
* 获取 localStorage 的值过滤
* @param key