feat: 新增持有天数
This commit is contained in:
@@ -35,6 +35,7 @@ const MOBILE_NON_FROZEN_COLUMN_IDS = [
|
||||
'yesterdayChangePercent',
|
||||
'estimateChangePercent',
|
||||
'totalChangePercent',
|
||||
'holdingDays',
|
||||
'todayProfit',
|
||||
'holdingProfit',
|
||||
'latestNav',
|
||||
@@ -47,6 +48,7 @@ const MOBILE_COLUMN_HEADERS = {
|
||||
yesterdayChangePercent: '昨日涨幅',
|
||||
estimateChangePercent: '估值涨幅',
|
||||
totalChangePercent: '估算收益',
|
||||
holdingDays: '持有天数',
|
||||
todayProfit: '当日收益',
|
||||
holdingProfit: '持有收益',
|
||||
};
|
||||
@@ -238,6 +240,7 @@ export default function MobileFundTable({
|
||||
MOBILE_NON_FROZEN_COLUMN_IDS.forEach((id) => { o[id] = true; });
|
||||
// 新增列:默认隐藏(用户可在表格设置中开启)
|
||||
o.relatedSector = false;
|
||||
o.holdingDays = false;
|
||||
return o;
|
||||
})();
|
||||
|
||||
@@ -253,6 +256,7 @@ export default function MobileFundTable({
|
||||
if (vis && typeof vis === 'object' && Object.keys(vis).length > 0) {
|
||||
const next = { ...vis };
|
||||
if (next.relatedSector === undefined) next.relatedSector = false;
|
||||
if (next.holdingDays === undefined) next.holdingDays = false;
|
||||
return next;
|
||||
}
|
||||
return defaultVisibility;
|
||||
@@ -442,6 +446,7 @@ export default function MobileFundTable({
|
||||
yesterdayChangePercent: 72,
|
||||
estimateChangePercent: 80,
|
||||
totalChangePercent: 80,
|
||||
holdingDays: 64,
|
||||
todayProfit: 80,
|
||||
holdingProfit: 80,
|
||||
};
|
||||
@@ -515,6 +520,7 @@ export default function MobileFundTable({
|
||||
allVisible[id] = true;
|
||||
});
|
||||
allVisible.relatedSector = false;
|
||||
allVisible.holdingDays = false;
|
||||
setMobileColumnVisibility(allVisible);
|
||||
};
|
||||
const handleToggleMobileColumnVisibility = (columnId, visible) => {
|
||||
@@ -849,6 +855,23 @@ export default function MobileFundTable({
|
||||
},
|
||||
meta: { align: 'right', cellClassName: 'total-change-cell', width: columnWidthMap.totalChangePercent },
|
||||
},
|
||||
{
|
||||
accessorKey: 'holdingDays',
|
||||
header: '持有天数',
|
||||
cell: (info) => {
|
||||
const original = info.row.original || {};
|
||||
const value = original.holdingDaysValue;
|
||||
if (value == null) {
|
||||
return <div className="muted" style={{ textAlign: 'right', fontSize: '12px' }}>—</div>;
|
||||
}
|
||||
return (
|
||||
<div style={{ fontWeight: 700, textAlign: 'right' }}>
|
||||
{value}
|
||||
</div>
|
||||
);
|
||||
},
|
||||
meta: { align: 'right', cellClassName: 'holding-days-cell', width: columnWidthMap.holdingDays ?? 64 },
|
||||
},
|
||||
{
|
||||
accessorKey: 'todayProfit',
|
||||
header: '当日收益',
|
||||
@@ -1019,7 +1042,7 @@ export default function MobileFundTable({
|
||||
|
||||
const getAlignClass = (columnId) => {
|
||||
if (columnId === 'fundName') return '';
|
||||
if (['latestNav', 'estimateNav', 'yesterdayChangePercent', 'estimateChangePercent', 'totalChangePercent', 'todayProfit', 'holdingProfit'].includes(columnId)) return 'text-right';
|
||||
if (['latestNav', 'estimateNav', 'yesterdayChangePercent', 'estimateChangePercent', 'totalChangePercent', 'holdingDays', 'todayProfit', 'holdingProfit'].includes(columnId)) return 'text-right';
|
||||
return 'text-right';
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user