Skip to content

Commit 7d63a1b

Browse files
committed
fix: bugs
1 parent 049a352 commit 7d63a1b

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

src/compoments/ReportTemplate/compoments/ReportTable.tsx

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export const ReportTable: React.FC<ReportTableProp> = (props) => {
2525
const info: { [key: string]: any } = {
2626
key: `${index}`,
2727
};
28+
// eslint-disable-next-line guard-for-in
2829
for (let i in item) {
2930
info[`name-${i}`] = item[i];
3031
}
@@ -39,7 +40,7 @@ export const ReportTable: React.FC<ReportTableProp> = (props) => {
3940
columns={columns}
4041
dataSource={dataSource}
4142
pagination={false}
42-
></Table>
43+
/>
4344
</div>
4445
);
4546
};
@@ -54,12 +55,14 @@ export const FoldTable: React.FC<RiskTableProp> = (props) => {
5455
const [extendItem, setExtendItem] = useState<boolean>(true);
5556
useEffect(() => {
5657
let header: string[] = [];
58+
// eslint-disable-next-line array-callback-return
5759
data.map((item, index) => {
5860
let newArr: any = Object.entries(item);
59-
newArr.sort(function (a: any, b: any) {
61+
newArr.sort((a: any, b: any) => {
6062
return a[1].sort - b[1].sort;
6163
});
6264
let itemData: any = {};
65+
// eslint-disable-next-line array-callback-return
6366
newArr.map((itemIn: any[], indexIn: number) => {
6467
if (index === 0) {
6568
header.push(itemIn[0]);
@@ -85,6 +88,7 @@ export const FoldTable: React.FC<RiskTableProp> = (props) => {
8588
header as string[]
8689
).map((item, index) => {
8790
return {
91+
// eslint-disable-next-line react/no-unstable-nested-components
8892
title: () => {
8993
if (index === 0) {
9094
return (
@@ -132,7 +136,7 @@ export const FoldTable: React.FC<RiskTableProp> = (props) => {
132136
dataSource={dataSource}
133137
pagination={false}
134138
onHeaderRow={() => headerRow}
135-
></Table>
139+
/>
136140
</div>
137141
);
138142
};
@@ -147,12 +151,14 @@ export const ReportMergeTable: React.FC<ReportMergeTableProp> = (props) => {
147151
let header: string[] = [];
148152
let data: any[] = [];
149153
if (Array.isArray(content.data)) {
150-
content.data.map((item: any, index: number) => {
154+
// eslint-disable-next-line array-callback-return
155+
content?.data?.map((item: any, index: number) => {
151156
let newArr = Object.entries(item);
152-
newArr.sort(function (a: any, b: any) {
157+
newArr.sort((a: any, b: any) => {
153158
return a[1].sort - b[1].sort;
154159
});
155160
let itemData: any[] = [];
161+
// eslint-disable-next-line array-callback-return
156162
newArr.map((itemIn: any) => {
157163
if (index === 0) {
158164
header.push(itemIn[0]);
@@ -173,6 +179,7 @@ export const ReportMergeTable: React.FC<ReportMergeTableProp> = (props) => {
173179
return acc;
174180
}, {});
175181
const sortedArr = Object.values(result);
182+
// eslint-disable-next-line array-callback-return
176183
sortedArr.map((item) => {
177184
if (Array.isArray(item)) {
178185
newData = [...newData, ...item];
@@ -220,6 +227,7 @@ export const ReportMergeTable: React.FC<ReportMergeTableProp> = (props) => {
220227
const info: { [key: string]: any } = {
221228
key: `${index}`,
222229
};
230+
// eslint-disable-next-line guard-for-in
223231
for (let i in item) {
224232
info[`name-${i}`] = item[i];
225233
}
@@ -234,7 +242,7 @@ export const ReportMergeTable: React.FC<ReportMergeTableProp> = (props) => {
234242
columns={columns}
235243
dataSource={dataSource}
236244
pagination={false}
237-
></Table>
245+
/>
238246
</div>
239247
);
240248
};
@@ -257,12 +265,14 @@ export const RiskTable: React.FC<RiskTableProp> = (props) => {
257265
useEffect(() => {
258266
let header: string[] = [];
259267
let tableData: any[] = [];
260-
data.map((item, index) => {
268+
// eslint-disable-next-line array-callback-return
269+
data?.map((item, index) => {
261270
let newArr: any = Object.entries(item);
262-
newArr.sort(function (a: any, b: any) {
271+
newArr.sort((a: any, b: any) => {
263272
return a[1].sort - b[1].sort;
264273
});
265274
let itemData: any = {};
275+
// eslint-disable-next-line array-callback-return
266276
newArr.map((itemIn: any[], indexIn: number) => {
267277
if (index === 0) {
268278
header.push(itemIn[0]);
@@ -304,7 +314,7 @@ export const RiskTable: React.FC<RiskTableProp> = (props) => {
304314
columns={columns}
305315
dataSource={dataSource}
306316
pagination={false}
307-
></Table>
317+
/>
308318
</div>
309319
);
310320
};

0 commit comments

Comments
 (0)