[Fix][Chat]Fix time granularity bug in model editing and dashboard display.

This commit is contained in:
beat4ocean
2025-03-05 11:03:58 +08:00
parent 5b994c4f8f
commit b6d1525daa
2 changed files with 27 additions and 27 deletions

View File

@@ -8,7 +8,7 @@ import { ISemantic } from '../../data';
import {
AGG_OPTIONS,
DATE_FORMATTER,
DATE_OPTIONS,
// DATE_OPTIONS,
DIM_OPTIONS,
EnumDataSourceType,
EnumModelDataType,
@@ -275,7 +275,7 @@ const ModelFieldForm: React.FC<Props> = ({
}
}
if ([EnumDataSourceType.TIME, EnumDataSourceType.PARTITION_TIME].includes(type)) {
const { dateFormat, timeGranularity } = record;
const { dateFormat } = record;
const dateFormatterOptions =
type === EnumDataSourceType.PARTITION_TIME ? PARTITION_TIME_FORMATTER : DATE_FORMATTER;
@@ -302,25 +302,25 @@ const ModelFieldForm: React.FC<Props> = ({
<ExclamationCircleOutlined />
</Tooltip>
</Space>
<Space>
<span>:</span>
<Select
placeholder="时间粒度"
value={timeGranularity === '' ? undefined : timeGranularity}
onChange={(value) => {
handleFieldChange(record, 'timeGranularity', value);
}}
defaultValue={timeGranularity === '' ? undefined : DATE_OPTIONS[0]}
style={{ minWidth: 180 }}
allowClear
>
{DATE_OPTIONS.map((item) => (
<Option key={item} value={item}>
{item}
</Option>
))}
</Select>
</Space>
{/*<Space>*/}
{/* <span>时间粒度:</span>*/}
{/* <Select*/}
{/* placeholder="时间粒度"*/}
{/* value={timeGranularity === '' ? undefined : timeGranularity}*/}
{/* onChange={(value) => {*/}
{/* handleFieldChange(record, 'timeGranularity', value);*/}
{/* }}*/}
{/* defaultValue={timeGranularity === '' ? undefined : DATE_OPTIONS[0]}*/}
{/* style={{ minWidth: 180 }}*/}
{/* allowClear*/}
{/* >*/}
{/* {DATE_OPTIONS.map((item) => (*/}
{/* <Option key={item} value={item}>*/}
{/* {item}*/}
{/* </Option>*/}
{/* ))}*/}
{/* </Select>*/}
{/*</Space>*/}
</Space>
);
}