汉化时间选择器
This commit is contained in:
@@ -12,6 +12,7 @@ import {
|
||||
import { Close as CloseIcon } from "@mui/icons-material";
|
||||
import { DateTimePicker } from "@mui/x-date-pickers/DateTimePicker";
|
||||
import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider";
|
||||
import { zhCN as pickerZhCN } from "@mui/x-date-pickers/locales";
|
||||
import { AdapterDayjs } from "@mui/x-date-pickers/AdapterDayjs";
|
||||
import "dayjs/locale/zh-cn"; // 引入中文包
|
||||
import dayjs, { Dayjs } from "dayjs";
|
||||
@@ -437,6 +438,10 @@ const AnalysisParameters: React.FC = () => {
|
||||
fullWidth: true,
|
||||
},
|
||||
}}
|
||||
localeText={
|
||||
pickerZhCN.components.MuiLocalizationProvider.defaultProps
|
||||
.localeText
|
||||
}
|
||||
/>
|
||||
</LocalizationProvider>
|
||||
</Box>
|
||||
|
||||
@@ -103,14 +103,6 @@ const HealthRiskStatistics: React.FC = () => {
|
||||
trigger: "axis",
|
||||
showContent: true,
|
||||
confine: true,
|
||||
// formatter: function(params: any[]) {
|
||||
// const year = params[0].axisValue;
|
||||
// let content = `预测年份:${year}<br/>`;
|
||||
// params.forEach((p: any) => {
|
||||
// content += `${p.seriesName}: ${p.value}<br/>`;
|
||||
// });
|
||||
// return content;
|
||||
// },
|
||||
},
|
||||
dataset: {
|
||||
source: datasetSource,
|
||||
@@ -135,10 +127,7 @@ const HealthRiskStatistics: React.FC = () => {
|
||||
{
|
||||
type: "category",
|
||||
gridIndex: 0,
|
||||
data:
|
||||
datasetSource.length > 0
|
||||
? (datasetSource[0] as string[]).slice(1)
|
||||
: [],
|
||||
data: datasetSource.length > 0 ? (datasetSource[0] as string[]).slice(1) : [],
|
||||
axisLabel: {
|
||||
fontSize: 10,
|
||||
},
|
||||
|
||||
@@ -20,6 +20,7 @@ import {
|
||||
} from "@mui/material";
|
||||
import { DateTimePicker } from "@mui/x-date-pickers/DateTimePicker";
|
||||
import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider";
|
||||
import { zhCN as pickerZhCN } from "@mui/x-date-pickers/locales";
|
||||
import { AdapterDayjs } from "@mui/x-date-pickers/AdapterDayjs";
|
||||
import "dayjs/locale/zh-cn"; // 引入中文包
|
||||
import dayjs from "dayjs";
|
||||
@@ -454,7 +455,13 @@ const Timeline: React.FC<TimelineProps> = ({
|
||||
|
||||
return (
|
||||
<div className="absolute bottom-4 left-1/2 -translate-x-1/2 z-10 w-[920px] opacity-90 hover:opacity-100 transition-opacity duration-300">
|
||||
<LocalizationProvider dateAdapter={AdapterDayjs} adapterLocale="zh-cn">
|
||||
<LocalizationProvider
|
||||
dateAdapter={AdapterDayjs}
|
||||
adapterLocale="zh-cn"
|
||||
localeText={
|
||||
pickerZhCN.components.MuiLocalizationProvider.defaultProps.localeText
|
||||
}
|
||||
>
|
||||
<Paper
|
||||
elevation={3}
|
||||
sx={{
|
||||
|
||||
@@ -66,6 +66,7 @@ import "dayjs/locale/zh-cn"; // 引入中文包
|
||||
import dayjs, { Dayjs } from "dayjs";
|
||||
import { AdapterDayjs } from "@mui/x-date-pickers/AdapterDayjs";
|
||||
import { DateTimePicker, LocalizationProvider } from "@mui/x-date-pickers";
|
||||
import { zhCN as pickerZhCN } from "@mui/x-date-pickers/locales";
|
||||
|
||||
const STATUS_OPTIONS: {
|
||||
value: "online" | "offline" | "warning" | "error";
|
||||
@@ -1210,6 +1211,10 @@ const SCADADeviceList: React.FC<SCADADeviceListProps> = ({
|
||||
<LocalizationProvider
|
||||
dateAdapter={AdapterDayjs}
|
||||
adapterLocale="zh-cn"
|
||||
localeText={
|
||||
pickerZhCN.components.MuiLocalizationProvider.defaultProps
|
||||
.localeText
|
||||
}
|
||||
>
|
||||
<DateTimePicker
|
||||
label="开始时间"
|
||||
|
||||
Reference in New Issue
Block a user