@tsingroc/tsingroc-components 5.0.1 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/BarLineChart/BarLineChart.module.css +10 -0
- package/dist/components/BarLineChart/index.d.ts +66 -0
- package/dist/components/BarLineChart/index.js +590 -0
- package/dist/components/BaseBarChart/BaseBarChart.module.css +12 -0
- package/dist/components/BaseBarChart/index.d.ts +33 -0
- package/dist/components/BaseBarChart/index.js +121 -0
- package/dist/components/DataCellNumber/DataCellNumber.module.css +20 -0
- package/dist/components/DataCellNumber/index.d.ts +14 -0
- package/dist/components/DataCellNumber/index.js +142 -0
- package/dist/components/FlexColLayout/index.d.ts +6 -0
- package/dist/components/FlexColLayout/index.js +40 -0
- package/dist/components/FlexRowLayout/index.d.ts +5 -0
- package/dist/components/FlexRowLayout/index.js +45 -0
- package/dist/components/HighlightSyncedECharts/index.d.ts +47 -0
- package/dist/components/HighlightSyncedECharts/index.js +260 -0
- package/dist/components/HighlightSyncedTable/index.d.ts +8 -0
- package/dist/components/HighlightSyncedTable/index.js +183 -0
- package/dist/components/LoadingSection/index.d.ts +41 -0
- package/dist/components/LoadingSection/index.js +183 -0
- package/dist/components/LoadingSkeleton/index.d.ts +42 -0
- package/dist/components/LoadingSkeleton/index.js +634 -0
- package/dist/components/ScrollableTable/ScrollableTable.module.css +21 -0
- package/dist/components/ScrollableTable/index.d.ts +13 -0
- package/dist/components/ScrollableTable/index.js +29 -0
- package/dist/components/TsingrocTable/TsingrocTable.module.css +32 -0
- package/dist/components/TsingrocTable/index.d.ts +12 -0
- package/dist/components/TsingrocTable/index.js +23 -0
- package/dist/components/TsingrocTheme/index.js +3 -3
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/pages/DayAheadReviewPage/components/PricePlot/index.d.ts +7 -0
- package/dist/pages/DayAheadReviewPage/components/PricePlot/index.js +136 -0
- package/dist/pages/DayAheadReviewPage/components/ProfitBarChart/ProfitBarChart.module.css +13 -0
- package/dist/pages/DayAheadReviewPage/components/ProfitBarChart/index.d.ts +17 -0
- package/dist/pages/DayAheadReviewPage/components/ProfitBarChart/index.js +278 -0
- package/dist/pages/DayAheadReviewPage/components/RevenueCard/RevenueCard.module.css +40 -0
- package/dist/pages/DayAheadReviewPage/components/RevenueCard/index.d.ts +9 -0
- package/dist/pages/DayAheadReviewPage/components/RevenueCard/index.js +195 -0
- package/dist/pages/DayAheadReviewPage/components/RevenueSummaryCard/RevenueSummaryCard.module.css +38 -0
- package/dist/pages/DayAheadReviewPage/components/RevenueSummaryCard/index.d.ts +10 -0
- package/dist/pages/DayAheadReviewPage/components/RevenueSummaryCard/index.js +117 -0
- package/dist/pages/DayAheadReviewPage/components/ReviewLineChart/ReviewLineChart.module.css +11 -0
- package/dist/pages/DayAheadReviewPage/components/ReviewLineChart/index.d.ts +53 -0
- package/dist/pages/DayAheadReviewPage/components/ReviewLineChart/index.js +398 -0
- package/dist/pages/DayAheadReviewPage/components/ReviewSummaryTable/ReviewSummaryTable.module.css +33 -0
- package/dist/pages/DayAheadReviewPage/components/ReviewSummaryTable/index.d.ts +17 -0
- package/dist/pages/DayAheadReviewPage/components/ReviewSummaryTable/index.js +187 -0
- package/dist/pages/DayAheadReviewPage/components/StrategyPlot/index.d.ts +10 -0
- package/dist/pages/DayAheadReviewPage/components/StrategyPlot/index.js +223 -0
- package/dist/pages/DayAheadReviewPage/components/SummaryTable/index.d.ts +7 -0
- package/dist/pages/DayAheadReviewPage/components/SummaryTable/index.js +39 -0
- package/dist/pages/DayAheadReviewPage/components/SummaryTable/useTableColumns.d.ts +10 -0
- package/dist/pages/DayAheadReviewPage/components/SummaryTable/useTableColumns.js +307 -0
- package/dist/pages/DayAheadReviewPage/hook/useDayAheadReviewDate.d.ts +137 -0
- package/dist/pages/DayAheadReviewPage/hook/useDayAheadReviewDate.js +252 -0
- package/dist/pages/DayAheadReviewPage/index.d.ts +149 -0
- package/dist/pages/DayAheadReviewPage/index.js +259 -0
- package/dist/pages/DayAheadReviewPage/layout/LeftChartContainer.d.ts +12 -0
- package/dist/pages/DayAheadReviewPage/layout/LeftChartContainer.js +236 -0
- package/dist/pages/DayAheadReviewPage/layout/ReviewPageLayout.d.ts +4 -0
- package/dist/pages/DayAheadReviewPage/layout/ReviewPageLayout.js +32 -0
- package/dist/pages/DayAheadReviewPage/layout/RightSummaryContainer.d.ts +14 -0
- package/dist/pages/DayAheadReviewPage/layout/RightSummaryContainer.js +199 -0
- package/dist/pages/DayAheadReviewPage/layout/TopDayReviewHeader.d.ts +9 -0
- package/dist/pages/DayAheadReviewPage/layout/TopDayReviewHeader.js +115 -0
- package/dist/pages/DayAheadReviewPage/types/dayahead.d.ts +172 -0
- package/dist/pages/DayAheadReviewPage/types/dayahead.js +1 -0
- package/dist/utils/accessibility.d.ts +114 -0
- package/dist/utils/accessibility.js +214 -0
- package/dist/utils/constants.d.ts +18 -0
- package/dist/utils/constants.js +34 -0
- package/dist/utils/export.d.ts +10 -0
- package/dist/utils/export.js +72 -0
- package/dist/utils/formatters.d.ts +46 -0
- package/dist/utils/formatters.js +84 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/presenters.d.ts +24 -0
- package/dist/utils/presenters.js +48 -0
- package/dist/utils/ui.d.ts +116 -0
- package/dist/utils/ui.js +171 -0
- package/package.json +32 -31
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { COLOR_POWER_GENERATION, COLOR_POWER_MANUAL, COLOR_POWER_TSINGROC } from "#src/utils/constants";
|
|
4
|
+
import ReviewLineChart from "../ReviewLineChart";
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
const TIME_INTERVAL_MIN = 15;
|
|
7
|
+
const StrategyPlot = t0 => {
|
|
8
|
+
const $ = _c(16);
|
|
9
|
+
const {
|
|
10
|
+
data,
|
|
11
|
+
hasManualData,
|
|
12
|
+
filterValue: t1
|
|
13
|
+
} = t0;
|
|
14
|
+
const filterValue = t1 === undefined ? "all" : t1;
|
|
15
|
+
let t2;
|
|
16
|
+
bb0: {
|
|
17
|
+
if (filterValue === "manual" && !hasManualData) {
|
|
18
|
+
t2 = "agent";
|
|
19
|
+
break bb0;
|
|
20
|
+
}
|
|
21
|
+
t2 = filterValue;
|
|
22
|
+
}
|
|
23
|
+
const effectiveFilter = t2;
|
|
24
|
+
const showManual = hasManualData && (effectiveFilter === "all" || effectiveFilter === "manual");
|
|
25
|
+
const hasData = data && data.length > 0;
|
|
26
|
+
let safeData;
|
|
27
|
+
let t3;
|
|
28
|
+
if ($[0] !== data || $[1] !== effectiveFilter || $[2] !== hasData || $[3] !== showManual) {
|
|
29
|
+
safeData = hasData ? data : [];
|
|
30
|
+
const hasAnyValue = _temp2;
|
|
31
|
+
const allSeries = [{
|
|
32
|
+
name: "\u9884\u6D4B\u7535\u91CF",
|
|
33
|
+
data: safeData.map(_temp3),
|
|
34
|
+
option: {
|
|
35
|
+
color: COLOR_POWER_GENERATION,
|
|
36
|
+
smooth: false,
|
|
37
|
+
lineStyle: {
|
|
38
|
+
width: 2,
|
|
39
|
+
type: "dotted"
|
|
40
|
+
},
|
|
41
|
+
tooltip: {
|
|
42
|
+
valueFormatter: _temp4
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}, {
|
|
46
|
+
name: "\u5B9E\u53D1\u7535\u91CF",
|
|
47
|
+
data: safeData.map(_temp5),
|
|
48
|
+
option: {
|
|
49
|
+
color: COLOR_POWER_GENERATION,
|
|
50
|
+
smooth: false,
|
|
51
|
+
tooltip: {
|
|
52
|
+
valueFormatter: _temp6
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}, {
|
|
56
|
+
name: "\u7533\u62A5\u7535\u91CF-\u667A\u80FD\u4F53",
|
|
57
|
+
data: effectiveFilter === "manual" ? [] : safeData.map(_temp7),
|
|
58
|
+
option: {
|
|
59
|
+
color: COLOR_POWER_TSINGROC,
|
|
60
|
+
smooth: false,
|
|
61
|
+
lineStyle: {
|
|
62
|
+
width: 2,
|
|
63
|
+
type: "dotted"
|
|
64
|
+
},
|
|
65
|
+
tooltip: {
|
|
66
|
+
valueFormatter: _temp8
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}, {
|
|
70
|
+
name: "\u7533\u62A5\u7535\u91CF-\u4EBA\u5DE5",
|
|
71
|
+
data: showManual ? safeData.map(_temp9) : [],
|
|
72
|
+
option: {
|
|
73
|
+
color: COLOR_POWER_MANUAL,
|
|
74
|
+
smooth: false,
|
|
75
|
+
lineStyle: {
|
|
76
|
+
width: 2,
|
|
77
|
+
type: "dotted"
|
|
78
|
+
},
|
|
79
|
+
tooltip: {
|
|
80
|
+
valueFormatter: _temp0
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}, {
|
|
84
|
+
name: "\u51FA\u6E05\u7535\u91CF-\u667A\u80FD\u4F53",
|
|
85
|
+
data: effectiveFilter === "manual" ? [] : safeData.map(_temp1),
|
|
86
|
+
option: {
|
|
87
|
+
color: COLOR_POWER_TSINGROC,
|
|
88
|
+
smooth: false,
|
|
89
|
+
lineStyle: {
|
|
90
|
+
width: 2
|
|
91
|
+
},
|
|
92
|
+
tooltip: {
|
|
93
|
+
valueFormatter: _temp10
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}, {
|
|
97
|
+
name: "\u51FA\u6E05\u7535\u91CF-\u4EBA\u5DE5",
|
|
98
|
+
data: showManual ? safeData.map(_temp11) : [],
|
|
99
|
+
option: {
|
|
100
|
+
color: COLOR_POWER_MANUAL,
|
|
101
|
+
smooth: false,
|
|
102
|
+
lineStyle: {
|
|
103
|
+
width: 2
|
|
104
|
+
},
|
|
105
|
+
tooltip: {
|
|
106
|
+
valueFormatter: _temp12
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}];
|
|
110
|
+
const visibleSeries = hasData ? allSeries.filter(s => hasAnyValue(s.data)) : allSeries;
|
|
111
|
+
t3 = showManual ? visibleSeries : visibleSeries.filter(_temp13);
|
|
112
|
+
$[0] = data;
|
|
113
|
+
$[1] = effectiveFilter;
|
|
114
|
+
$[2] = hasData;
|
|
115
|
+
$[3] = showManual;
|
|
116
|
+
$[4] = safeData;
|
|
117
|
+
$[5] = t3;
|
|
118
|
+
} else {
|
|
119
|
+
safeData = $[4];
|
|
120
|
+
t3 = $[5];
|
|
121
|
+
}
|
|
122
|
+
const series = t3;
|
|
123
|
+
let t4;
|
|
124
|
+
if ($[6] !== series) {
|
|
125
|
+
t4 = series.map(_temp14);
|
|
126
|
+
$[6] = series;
|
|
127
|
+
$[7] = t4;
|
|
128
|
+
} else {
|
|
129
|
+
t4 = $[7];
|
|
130
|
+
}
|
|
131
|
+
const legendData = t4;
|
|
132
|
+
let t5;
|
|
133
|
+
if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
|
|
134
|
+
t5 = {
|
|
135
|
+
实发电量: false
|
|
136
|
+
};
|
|
137
|
+
$[8] = t5;
|
|
138
|
+
} else {
|
|
139
|
+
t5 = $[8];
|
|
140
|
+
}
|
|
141
|
+
const legendSelected = t5;
|
|
142
|
+
let t6;
|
|
143
|
+
if ($[9] !== hasData || $[10] !== safeData) {
|
|
144
|
+
t6 = hasData ? safeData.map(_temp15) : undefined;
|
|
145
|
+
$[9] = hasData;
|
|
146
|
+
$[10] = safeData;
|
|
147
|
+
$[11] = t6;
|
|
148
|
+
} else {
|
|
149
|
+
t6 = $[11];
|
|
150
|
+
}
|
|
151
|
+
let t7;
|
|
152
|
+
if ($[12] !== legendData || $[13] !== series || $[14] !== t6) {
|
|
153
|
+
t7 = /*#__PURE__*/_jsx(ReviewLineChart, {
|
|
154
|
+
title: "\u7B56\u7565\u5BF9\u6BD4\u56FE",
|
|
155
|
+
xAxisData: t6,
|
|
156
|
+
timeIntervalMinutes: TIME_INTERVAL_MIN,
|
|
157
|
+
useUtc: false,
|
|
158
|
+
yAxisName: "\u7535\u91CF (MWh)",
|
|
159
|
+
series: series,
|
|
160
|
+
legendData: legendData,
|
|
161
|
+
legendSelected: legendSelected
|
|
162
|
+
});
|
|
163
|
+
$[12] = legendData;
|
|
164
|
+
$[13] = series;
|
|
165
|
+
$[14] = t6;
|
|
166
|
+
$[15] = t7;
|
|
167
|
+
} else {
|
|
168
|
+
t7 = $[15];
|
|
169
|
+
}
|
|
170
|
+
return t7;
|
|
171
|
+
};
|
|
172
|
+
export default StrategyPlot;
|
|
173
|
+
function _temp(v) {
|
|
174
|
+
return v != null;
|
|
175
|
+
}
|
|
176
|
+
function _temp2(arr) {
|
|
177
|
+
return arr.some(_temp);
|
|
178
|
+
}
|
|
179
|
+
function _temp3(v_0) {
|
|
180
|
+
return v_0.forecastVolume ?? null;
|
|
181
|
+
}
|
|
182
|
+
function _temp4(v_1) {
|
|
183
|
+
return v_1 != null ? `${Number(v_1).toFixed(3)} MWh` : "-";
|
|
184
|
+
}
|
|
185
|
+
function _temp5(v_2) {
|
|
186
|
+
return v_2.actualVolume ?? null;
|
|
187
|
+
}
|
|
188
|
+
function _temp6(v_3) {
|
|
189
|
+
return v_3 != null ? `${Number(v_3).toFixed(3)} MWh` : "-";
|
|
190
|
+
}
|
|
191
|
+
function _temp7(v_4) {
|
|
192
|
+
return v_4.agentDeclaredVolume ?? null;
|
|
193
|
+
}
|
|
194
|
+
function _temp8(v_5) {
|
|
195
|
+
return v_5 != null ? `${Number(v_5).toFixed(2)} MWh` : "-";
|
|
196
|
+
}
|
|
197
|
+
function _temp9(v_6) {
|
|
198
|
+
return v_6.manualDeclaredVolume ?? null;
|
|
199
|
+
}
|
|
200
|
+
function _temp0(v_7) {
|
|
201
|
+
return v_7 != null ? `${Number(v_7).toFixed(2)} MWh` : "-";
|
|
202
|
+
}
|
|
203
|
+
function _temp1(v_8) {
|
|
204
|
+
return v_8.agentClearanceVolume ?? null;
|
|
205
|
+
}
|
|
206
|
+
function _temp10(v_9) {
|
|
207
|
+
return v_9 != null ? `${Number(v_9).toFixed(2)} MWh` : "-";
|
|
208
|
+
}
|
|
209
|
+
function _temp11(v_10) {
|
|
210
|
+
return v_10.manualClearanceVolume ?? null;
|
|
211
|
+
}
|
|
212
|
+
function _temp12(v_11) {
|
|
213
|
+
return v_11 != null ? `${Number(v_11).toFixed(2)} MWh` : "-";
|
|
214
|
+
}
|
|
215
|
+
function _temp13(s_0) {
|
|
216
|
+
return !s_0.name.includes("\u4EBA\u5DE5");
|
|
217
|
+
}
|
|
218
|
+
function _temp14(s_1) {
|
|
219
|
+
return s_1.name;
|
|
220
|
+
}
|
|
221
|
+
function _temp15(v_12) {
|
|
222
|
+
return v_12.time;
|
|
223
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ExtendedReviewValue, TableProps } from "../../types/dayahead";
|
|
2
|
+
import { type FilterOption } from "../ReviewSummaryTable";
|
|
3
|
+
declare const SummaryTable: ({ data, section, tradingDay, filterValue, onExport }: TableProps & {
|
|
4
|
+
filterValue?: FilterOption;
|
|
5
|
+
onExport?: (data: ExtendedReviewValue[], date: string, filename: string) => void;
|
|
6
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default SummaryTable;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import ReviewSummaryTable from "../ReviewSummaryTable";
|
|
3
|
+
import { useReviewColumns } from "./useTableColumns";
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
const SummaryTable = t0 => {
|
|
6
|
+
const $ = _c(5);
|
|
7
|
+
const {
|
|
8
|
+
data,
|
|
9
|
+
section,
|
|
10
|
+
tradingDay,
|
|
11
|
+
filterValue: t1,
|
|
12
|
+
onExport
|
|
13
|
+
} = t0;
|
|
14
|
+
const filterValue = t1 === undefined ? "all" : t1;
|
|
15
|
+
const {
|
|
16
|
+
columns
|
|
17
|
+
} = useReviewColumns(data, section, filterValue);
|
|
18
|
+
const t2 = onExport || _temp;
|
|
19
|
+
let t3;
|
|
20
|
+
if ($[0] !== columns || $[1] !== data || $[2] !== t2 || $[3] !== tradingDay) {
|
|
21
|
+
t3 = /*#__PURE__*/_jsx(ReviewSummaryTable, {
|
|
22
|
+
data: data,
|
|
23
|
+
columns: columns,
|
|
24
|
+
tradingDay: tradingDay,
|
|
25
|
+
onExport: t2,
|
|
26
|
+
dataType: 96
|
|
27
|
+
});
|
|
28
|
+
$[0] = columns;
|
|
29
|
+
$[1] = data;
|
|
30
|
+
$[2] = t2;
|
|
31
|
+
$[3] = tradingDay;
|
|
32
|
+
$[4] = t3;
|
|
33
|
+
} else {
|
|
34
|
+
t3 = $[4];
|
|
35
|
+
}
|
|
36
|
+
return t3;
|
|
37
|
+
};
|
|
38
|
+
export default SummaryTable;
|
|
39
|
+
function _temp() {}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ColumnType } from "antd/es/table";
|
|
2
|
+
import type { ExtendedReviewValue, ReviewSection } from "../../types/dayahead";
|
|
3
|
+
export type FilterOption = "all" | "agent" | "manual";
|
|
4
|
+
export declare const TIME_INTERVAL_MIN = 15;
|
|
5
|
+
export declare function useReviewColumns(data: ExtendedReviewValue[], section?: ReviewSection, filterValue?: FilterOption): {
|
|
6
|
+
columns: ColumnType<ExtendedReviewValue & {
|
|
7
|
+
index: number;
|
|
8
|
+
}>[];
|
|
9
|
+
resolvedSection: ReviewSection;
|
|
10
|
+
};
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
import { DataCellNumber } from "#src/components/DataCellNumber";
|
|
2
|
+
import { COLOR_TABLE_CELL_TEXT, COLOR_TABLE_HEADER } from "#src/utils/constants";
|
|
3
|
+
import { presentTableValue } from "#src/utils/ui";
|
|
4
|
+
import dayjs from "dayjs";
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
export const TIME_INTERVAL_MIN = 15;
|
|
7
|
+
const columnConfigs = {
|
|
8
|
+
standard: [{
|
|
9
|
+
key: "time",
|
|
10
|
+
title: "时间",
|
|
11
|
+
width: 150
|
|
12
|
+
}, {
|
|
13
|
+
key: "forecastVolume",
|
|
14
|
+
title: "预测电量",
|
|
15
|
+
width: 120
|
|
16
|
+
}, {
|
|
17
|
+
key: "actualVolume",
|
|
18
|
+
title: "实际电量",
|
|
19
|
+
width: 120
|
|
20
|
+
}, {
|
|
21
|
+
key: "clearanceVolume",
|
|
22
|
+
title: "出清电量",
|
|
23
|
+
width: 140
|
|
24
|
+
}, {
|
|
25
|
+
key: "dayAheadPrice",
|
|
26
|
+
title: "日前价格",
|
|
27
|
+
width: 120
|
|
28
|
+
}, {
|
|
29
|
+
key: "realTimePrice",
|
|
30
|
+
title: "实时价格",
|
|
31
|
+
width: 120
|
|
32
|
+
}, {
|
|
33
|
+
key: "profitPredictBaseline",
|
|
34
|
+
title: "预测收益",
|
|
35
|
+
width: 120
|
|
36
|
+
}, {
|
|
37
|
+
key: "profitStrategyAdd",
|
|
38
|
+
title: "策略收益",
|
|
39
|
+
width: 120
|
|
40
|
+
}],
|
|
41
|
+
thermalQuote: [{
|
|
42
|
+
key: "time",
|
|
43
|
+
title: "时间",
|
|
44
|
+
width: 150
|
|
45
|
+
}, {
|
|
46
|
+
key: "forecastVolume",
|
|
47
|
+
title: "预测电量",
|
|
48
|
+
width: 120
|
|
49
|
+
}, {
|
|
50
|
+
key: "actualVolume",
|
|
51
|
+
title: "实际电量",
|
|
52
|
+
width: 120
|
|
53
|
+
}, {
|
|
54
|
+
key: "clearanceVolume",
|
|
55
|
+
title: "出清电量",
|
|
56
|
+
width: 140
|
|
57
|
+
}, {
|
|
58
|
+
key: "quotation",
|
|
59
|
+
title: "报价",
|
|
60
|
+
width: 120
|
|
61
|
+
}, {
|
|
62
|
+
key: "dayAheadPrice",
|
|
63
|
+
title: "日前价格",
|
|
64
|
+
width: 120
|
|
65
|
+
}, {
|
|
66
|
+
key: "realTimePrice",
|
|
67
|
+
title: "实时价格",
|
|
68
|
+
width: 120
|
|
69
|
+
}, {
|
|
70
|
+
key: "profitPredictBaseline",
|
|
71
|
+
title: "预测收益",
|
|
72
|
+
width: 120
|
|
73
|
+
}, {
|
|
74
|
+
key: "profitStrategyAdd",
|
|
75
|
+
title: "策略收益",
|
|
76
|
+
width: 120
|
|
77
|
+
}]
|
|
78
|
+
};
|
|
79
|
+
export function useReviewColumns(data, section, filterValue = "all") {
|
|
80
|
+
const resolvedSection = (() => {
|
|
81
|
+
if (section) {
|
|
82
|
+
return section;
|
|
83
|
+
}
|
|
84
|
+
if (!data || data.length === 0) return "standard";
|
|
85
|
+
const hasQuotation = data.some(it => it.quotation !== undefined && it.quotation !== null);
|
|
86
|
+
return hasQuotation ? "thermalQuote" : "standard";
|
|
87
|
+
})();
|
|
88
|
+
const columns = columnConfigs[resolvedSection].map(col => {
|
|
89
|
+
const baseColumn = {
|
|
90
|
+
title: col.title,
|
|
91
|
+
width: col.width,
|
|
92
|
+
align: "center",
|
|
93
|
+
headerCellStyle: {
|
|
94
|
+
backgroundColor: COLOR_TABLE_HEADER
|
|
95
|
+
},
|
|
96
|
+
onCell: col.key === "profitPredictBaseline" || col.key === "profitStrategyAdd" || col.key === "clearanceVolume" || col.key === "declaredVolume" ? () => ({
|
|
97
|
+
style: {
|
|
98
|
+
padding: 0
|
|
99
|
+
}
|
|
100
|
+
}) : undefined,
|
|
101
|
+
render: (_, record) => {
|
|
102
|
+
// Handle declared volume column with conditional rendering
|
|
103
|
+
if (col.key === "declaredVolume") {
|
|
104
|
+
const agentValue = record.agentDeclaredVolume;
|
|
105
|
+
const manualValue = record.manualDeclaredVolume;
|
|
106
|
+
|
|
107
|
+
// If both values are null, display ""
|
|
108
|
+
if (agentValue == null && manualValue == null) {
|
|
109
|
+
return presentTableValue(null);
|
|
110
|
+
}
|
|
111
|
+
if (filterValue === "agent") {
|
|
112
|
+
if (agentValue == null) return presentTableValue(null);
|
|
113
|
+
return /*#__PURE__*/_jsx(DataCellNumber, {
|
|
114
|
+
value1: agentValue,
|
|
115
|
+
value2: undefined,
|
|
116
|
+
fractionDigits: 3,
|
|
117
|
+
valueKey: "agentDeclaredVolume"
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
if (filterValue === "manual") {
|
|
121
|
+
if (manualValue == null) return presentTableValue(null);
|
|
122
|
+
return /*#__PURE__*/_jsx(DataCellNumber, {
|
|
123
|
+
value1: manualValue,
|
|
124
|
+
value2: undefined,
|
|
125
|
+
fractionDigits: 3,
|
|
126
|
+
valueKey: "manualDeclaredVolume"
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// filterValue === "all"
|
|
131
|
+
if (agentValue == null && manualValue == null) {
|
|
132
|
+
return presentTableValue(null);
|
|
133
|
+
}
|
|
134
|
+
return /*#__PURE__*/_jsx(DataCellNumber, {
|
|
135
|
+
value1: agentValue ?? 0,
|
|
136
|
+
value2: manualValue ?? undefined,
|
|
137
|
+
fractionDigits: 3,
|
|
138
|
+
valueKey: "agentDeclaredVolume"
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// Handle clearance volume column with conditional rendering
|
|
143
|
+
if (col.key === "clearanceVolume") {
|
|
144
|
+
const agentValue = record.agentClearanceVolume;
|
|
145
|
+
const manualValue = record.manualClearanceVolume;
|
|
146
|
+
|
|
147
|
+
// If both values are null, display ""
|
|
148
|
+
if (agentValue == null && manualValue == null) {
|
|
149
|
+
return presentTableValue(null);
|
|
150
|
+
}
|
|
151
|
+
if (filterValue === "agent") {
|
|
152
|
+
if (agentValue == null) return presentTableValue(null);
|
|
153
|
+
return /*#__PURE__*/_jsx(DataCellNumber, {
|
|
154
|
+
value1: agentValue,
|
|
155
|
+
value2: undefined,
|
|
156
|
+
fractionDigits: 3,
|
|
157
|
+
valueKey: "agentClearanceVolume"
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
if (filterValue === "manual") {
|
|
161
|
+
if (manualValue == null) return presentTableValue(null);
|
|
162
|
+
return /*#__PURE__*/_jsx(DataCellNumber, {
|
|
163
|
+
value1: manualValue,
|
|
164
|
+
value2: undefined,
|
|
165
|
+
fractionDigits: 3,
|
|
166
|
+
valueKey: "manualClearanceVolume"
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// filterValue === "all"
|
|
171
|
+
if (agentValue == null && manualValue == null) {
|
|
172
|
+
return presentTableValue(null);
|
|
173
|
+
}
|
|
174
|
+
return /*#__PURE__*/_jsx(DataCellNumber, {
|
|
175
|
+
value1: agentValue ?? 0,
|
|
176
|
+
value2: manualValue ?? undefined,
|
|
177
|
+
fractionDigits: 3,
|
|
178
|
+
valueKey: "agentClearanceVolume"
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// Handle profitPredictBaseline column with conditional rendering
|
|
183
|
+
if (col.key === "profitPredictBaseline") {
|
|
184
|
+
const agentValue = record.agentPredictBaseline;
|
|
185
|
+
const manualValue = record.manualProfit;
|
|
186
|
+
|
|
187
|
+
// If both values are null, display ""
|
|
188
|
+
if (agentValue == null && manualValue == null) {
|
|
189
|
+
return presentTableValue(null);
|
|
190
|
+
}
|
|
191
|
+
if (filterValue === "agent") {
|
|
192
|
+
if (agentValue == null) return presentTableValue(null);
|
|
193
|
+
return /*#__PURE__*/_jsx(DataCellNumber, {
|
|
194
|
+
value1: agentValue,
|
|
195
|
+
value2: undefined,
|
|
196
|
+
fractionDigits: 3,
|
|
197
|
+
valueKey: "agentPredictBaseline"
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
if (filterValue === "manual") {
|
|
201
|
+
if (manualValue == null) return presentTableValue(null);
|
|
202
|
+
return /*#__PURE__*/_jsx(DataCellNumber, {
|
|
203
|
+
value1: manualValue,
|
|
204
|
+
value2: undefined,
|
|
205
|
+
fractionDigits: 3,
|
|
206
|
+
valueKey: "manualProfit"
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// filterValue === "all"
|
|
211
|
+
if (agentValue == null && manualValue == null) {
|
|
212
|
+
return presentTableValue(null);
|
|
213
|
+
}
|
|
214
|
+
return /*#__PURE__*/_jsx(DataCellNumber, {
|
|
215
|
+
value1: agentValue ?? 0,
|
|
216
|
+
value2: manualValue ?? undefined,
|
|
217
|
+
fractionDigits: 3,
|
|
218
|
+
valueKey: "agentPredictBaseline"
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// Handle profitStrategyAdd column with conditional rendering
|
|
223
|
+
if (col.key === "profitStrategyAdd") {
|
|
224
|
+
const agentValue = record.agentStrategyAdd;
|
|
225
|
+
|
|
226
|
+
// If value is null, display ""
|
|
227
|
+
if (agentValue == null) {
|
|
228
|
+
return presentTableValue(null);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// Only show agent value for strategy add
|
|
232
|
+
return /*#__PURE__*/_jsx(DataCellNumber, {
|
|
233
|
+
value1: agentValue,
|
|
234
|
+
value2: undefined,
|
|
235
|
+
fractionDigits: 3,
|
|
236
|
+
valueKey: "agentStrategyAdd"
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// Handle regular columns
|
|
241
|
+
let value = "";
|
|
242
|
+
let formatter = value => {
|
|
243
|
+
if (typeof value === "number") {
|
|
244
|
+
return value.toFixed(3);
|
|
245
|
+
}
|
|
246
|
+
return value;
|
|
247
|
+
};
|
|
248
|
+
switch (col.key) {
|
|
249
|
+
case "time":
|
|
250
|
+
{
|
|
251
|
+
const startTime = dayjs(record.time);
|
|
252
|
+
value = startTime.format("HH:mm");
|
|
253
|
+
break;
|
|
254
|
+
}
|
|
255
|
+
case "forecastVolume":
|
|
256
|
+
{
|
|
257
|
+
const displayValue = presentTableValue(record.forecastVolume);
|
|
258
|
+
if (displayValue === "") return displayValue;
|
|
259
|
+
value = record.forecastVolume ?? 0;
|
|
260
|
+
break;
|
|
261
|
+
}
|
|
262
|
+
case "actualVolume":
|
|
263
|
+
{
|
|
264
|
+
const displayValue = presentTableValue(record.actualVolume);
|
|
265
|
+
if (displayValue === "") return displayValue;
|
|
266
|
+
value = record.actualVolume ?? 0;
|
|
267
|
+
break;
|
|
268
|
+
}
|
|
269
|
+
case "dayAheadPrice":
|
|
270
|
+
{
|
|
271
|
+
const displayValue = presentTableValue(record.dayAheadPrice);
|
|
272
|
+
if (displayValue === "") return displayValue;
|
|
273
|
+
value = record.dayAheadPrice ?? 0;
|
|
274
|
+
break;
|
|
275
|
+
}
|
|
276
|
+
case "realTimePrice":
|
|
277
|
+
{
|
|
278
|
+
const displayValue = presentTableValue(record.realTimePrice);
|
|
279
|
+
if (displayValue === "") return displayValue;
|
|
280
|
+
value = record.realTimePrice ?? 0;
|
|
281
|
+
break;
|
|
282
|
+
}
|
|
283
|
+
case "quotation":
|
|
284
|
+
{
|
|
285
|
+
const displayValue = presentTableValue(record.quotation);
|
|
286
|
+
if (displayValue === "") return displayValue;
|
|
287
|
+
value = record.quotation ?? 0;
|
|
288
|
+
break;
|
|
289
|
+
}
|
|
290
|
+
default:
|
|
291
|
+
return "";
|
|
292
|
+
}
|
|
293
|
+
return /*#__PURE__*/_jsx("span", {
|
|
294
|
+
style: {
|
|
295
|
+
color: COLOR_TABLE_CELL_TEXT
|
|
296
|
+
},
|
|
297
|
+
children: formatter(value)
|
|
298
|
+
}, `${col.key}-${record.index}`);
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
return baseColumn;
|
|
302
|
+
});
|
|
303
|
+
return {
|
|
304
|
+
columns,
|
|
305
|
+
resolvedSection
|
|
306
|
+
};
|
|
307
|
+
}
|