From 8996eaedd90c865211664f48a306d1a968fe0550 Mon Sep 17 00:00:00 2001 From: zhen lin <1149538837@qq.com> Date: Sat, 12 Apr 2025 15:46:29 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fear:=E6=B7=BB=E5=8A=A0=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E6=97=A5=E6=9C=9F=E6=8E=A7=E4=BB=B6=E4=BF=AE=E6=94=B9=E6=97=A5?= =?UTF-8?q?=E6=9C=9F=20#1597?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/TableBox/index.tsx | 53 ++++++++++++++++++- .../src/components/SearchResult/utils.tsx | 7 ++- .../src/layouts/GlobalLayout/index.tsx | 13 ++++- 3 files changed, 68 insertions(+), 5 deletions(-) diff --git a/chat2db-client/src/components/SearchResult/components/TableBox/index.tsx b/chat2db-client/src/components/SearchResult/components/TableBox/index.tsx index dc24967c6..af0d23d9f 100644 --- a/chat2db-client/src/components/SearchResult/components/TableBox/index.tsx +++ b/chat2db-client/src/components/SearchResult/components/TableBox/index.tsx @@ -1,5 +1,5 @@ import React, { useEffect, useMemo, useState } from 'react'; -import { Dropdown, Input, MenuProps, message, Modal, Space, Popover, Spin, Button } from 'antd'; +import { Dropdown, Input, MenuProps, message, Modal, Space, Popover, Spin, Button, DatePicker } from 'antd'; import { BaseTable, ArtColumn, useTablePipeline, features, SortItem } from 'ali-react-table'; import styled from 'styled-components'; import classnames from 'classnames'; @@ -15,7 +15,7 @@ import styles from './index.less'; // 工具函数 import { compareStrings } from '@/utils/sort'; import { downloadFile } from '@/utils/file'; -import { transformInputValue } from '../../utils'; +import { transformInputValue, transformDateTimeValue } from '../../utils'; // 类型定义 import { CRUD } from '@/constants'; @@ -72,6 +72,10 @@ export enum USER_FILLED_VALUE { DEFAULT = 'CHAT2DB_UPDATE_TABLE_DATA_USER_FILLED_DEFAULT', } +export enum DATE_TIME { + DATEFORMAT = 'YYYY-MM-DD HH:mm:ss', +} + const SupportBaseTable: any = styled(BaseTable)` &.supportBaseTable { --bgcolor: var(--color-bg-base); @@ -605,6 +609,7 @@ export default function TableBox(props: ITableProps) { const isNumber = dataType === TableDataType.NUMERIC; const isNumericalOrder = dataType === TableDataType.CHAT2DB_ROW_NUMBER; const colId = `${preCode}${colIndex}${name}`; + const isDateTime = dataType === TableDataType.DATETIME; if (isNumericalOrder) { return { @@ -652,6 +657,50 @@ export default function TableBox(props: ITableProps) { }; } + if (isDateTime) { + return { + code: colId, + name: name, + key: name, + render: (value: any, rowData) => { + const rowId = rowData[colNoCode]; + const content = renderTableCellValue(value); + return ( +