fix(缺项管理): 列表自定义字段展示问题

--bug=1040999 --user=宋昌昌 【缺陷管理】服务集成-配置好tapd模版,创建缺陷,ms缺陷列表优先级字段不显示 https://www.tapd.cn/55049933/s/1520015
This commit is contained in:
song-cc-rock 2024-05-24 11:03:12 +08:00 committed by 刘瑞斌
parent 705122cf87
commit 625594e9ed
2 changed files with 17 additions and 4 deletions

View File

@ -8,6 +8,8 @@ import { BugEditCustomField, CustomFieldItem } from '@/models/bug-management';
import { isObject } from './is';
type TargetContext = '_self' | '_parent' | '_blank' | '_top';
const multipleExcludes = ['MULTIPLE_SELECT', 'CHECKBOX', 'MULTIPLE_MEMBER'];
const selectExcludes = ['MEMBER', 'RADIO', 'SELECT'];
/**
*
@ -807,13 +809,26 @@ export function formatPhoneNumber(phoneNumber = '') {
}
return phoneNumber;
}
// 获取表头自定义字段过滤索引
export function getCustomFieldIndex(field: CustomFieldItem) {
const { fieldId } = field;
if (selectExcludes.includes(field.type)) {
return `custom_single_${fieldId}`;
}
if (multipleExcludes.includes(field.type)) {
return `custom_multiple_${fieldId}`;
}
return fieldId;
}
// 表格自定义字段转column
export function customFieldToColumns(customFields: CustomFieldItem[]) {
return customFields.map((field) => {
const { fieldName, fieldKey, fieldId } = field;
const column: MsTableColumnData = {
title: fieldName,
dataIndex: ['handleUser', 'status'].includes(fieldId) ? fieldKey : fieldId,
dataIndex: ['handleUser', 'status'].includes(fieldId) ? fieldKey : getCustomFieldIndex(field),
showTooltip: true,
showDrag: true,
showInTable: true,
@ -822,6 +837,7 @@ export function customFieldToColumns(customFields: CustomFieldItem[]) {
return column;
});
}
// 表格查询参数转请求参数
export function tableParamsToRequestParams(params: BatchActionQueryParams) {
const { selectedIds, selectAll, excludeIds, condition } = params;
@ -862,8 +878,6 @@ export function customFieldDataToTableData(customFieldData: Record<string, any>[
if (!customFieldData || !customFields) return {};
const tableData: Record<string, any> = {};
const multipleExcludes = ['MULTIPLE_SELECT', 'CHECKBOX', 'MULTIPLE_MEMBER'];
const selectExcludes = ['MEMBER', 'RADIO', 'SELECT'];
customFieldData.forEach((field) => {
const customField = customFields.find((item) => item.fieldId === field.id);

View File

@ -793,7 +793,6 @@
if (item.title === '严重程度' || item.title === 'Bug Degree') {
item.showInTable = true;
item.slotName = 'severity';
item.dataIndex = `custom_single_${item.dataIndex}`;
item.filterConfig = {
options: cloneDeep(unref(severityFilterOptions.value)) || [],
labelKey: 'text',