Skip to content

Commit

Permalink
fix: Fixed the issue that the result set was overwritten when the fie…
Browse files Browse the repository at this point in the history
…ld aliases were taken the same
  • Loading branch information
JerryFan626 committed Sep 14, 2023
1 parent d8fd071 commit 33b176e
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions chat2db-client/src/components/SearchResult/TableBox/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,13 @@ export default function TableBox(props: ITableProps) {

const columns: ArtColumn[] = useMemo(
() =>
(headerList || []).map((item, index) => {
(headerList || []).map((item, colIndex) => {
const { dataType, name } = item;
const isNumber = dataType === TableDataType.NUMERIC;
const isNumericalOrder = dataType === TableDataType.CHAT2DB_ROW_NUMBER;
if (isNumericalOrder) {
return {
code: `${preCode}No.`,
code: `${preCode}${colIndex}No.`,
name: 'No.',
key: name,
lock: true,
Expand All @@ -146,7 +146,7 @@ export default function TableBox(props: ITableProps) {
};
}
return {
code: `${preCode}${name}`,
code: `${preCode}${colIndex}${name}`,
name: name,
key: name,
width: 120,
Expand Down Expand Up @@ -174,8 +174,8 @@ export default function TableBox(props: ITableProps) {
} else {
return (dataList || []).map((item, rowIndex) => {
const rowData: any = {};
item.map((i: string | null, index: number) => {
const name = `${preCode}${columns[index].name}`;
item.map((i: string | null, colIndex: number) => {
const name = `${preCode}${colIndex}${columns[colIndex].name}`;
if (i === null) {
rowData[name] = '<null>';
} else {
Expand Down Expand Up @@ -212,6 +212,7 @@ export default function TableBox(props: ITableProps) {
const onPageNoChange = (pageNo: number) => {
onConfigChange && onConfigChange({ ...config, pageNo });
};

const onPageSizeChange = (pageSize: number) => {
onConfigChange && onConfigChange({ ...config, pageSize, pageNo: 1 });
};
Expand All @@ -221,6 +222,7 @@ export default function TableBox(props: ITableProps) {
return await props.onSearchTotal();
}
};

const renderContent = () => {
const bottomStatus = (
<div className={styles.statusBar}>
Expand Down Expand Up @@ -271,6 +273,7 @@ export default function TableBox(props: ITableProps) {
);
}
};

return (
<div className={classnames(className, styles.tableBox)}>
{renderContent()}
Expand Down

0 comments on commit 33b176e

Please sign in to comment.