/* * @Author: RenXiaoDong * @Date: 2025-06-28 12:55:44 */ import { CUSTOM_FIELDS, getPropPrefix } from '@/views/property-marketing/media-account/common_constants'; // 不足4个。就补两个null进去 export function groupArrayBySize( fields: T[], groupSize = 4, dateType: string, ): T[][] { const result: T[][] = []; for (let i = 0; i < fields.length; i += groupSize) { result.push(fields.slice(i, i + groupSize)); } const labelPrefix = dateType === 'week' ? '近7天' : '近30天'; return result.map((item) => { return item.map((item) => { return { ...item, dataIndex: `${getPropPrefix(dateType)}${item.dataIndex}`, prop: `${getPropPrefix(dateType)}${item.prop}`, title: `${labelPrefix}${item.title}`, tooltip: `${labelPrefix}${item.tooltip}`, }; }); }); } export const getAccountInfoFields = (dateType: string, showMore: boolean) => { const baseFields = [ [ { title: '账号名称', dataIndex: 'name' }, { title: '项目分组', dataIndex: 'group.name' }, { title: '状态', dataIndex: 'status', type: 'status' }, { title: '运营人员', dataIndex: 'operator_name' }, ], [ { title: 'AI评价', dataIndex: 'ai_evaluation' }, { title: '粉丝量', dataIndex: 'fans_number', tooltip: '粉丝量' }, { title: '总赞藏数', dataIndex: 'like_collect_number', tooltip: '总赞藏数' }, ], ]; const customFields = groupArrayBySize(CUSTOM_FIELDS, 4, dateType); return showMore ? [...baseFields, ...customFields] : [...baseFields]; };