汉化时间选择器
This commit is contained in:
@@ -12,6 +12,7 @@ import {
|
|||||||
import { Close as CloseIcon } from "@mui/icons-material";
|
import { Close as CloseIcon } from "@mui/icons-material";
|
||||||
import { DateTimePicker } from "@mui/x-date-pickers/DateTimePicker";
|
import { DateTimePicker } from "@mui/x-date-pickers/DateTimePicker";
|
||||||
import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider";
|
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 { AdapterDayjs } from "@mui/x-date-pickers/AdapterDayjs";
|
||||||
import "dayjs/locale/zh-cn"; // 引入中文包
|
import "dayjs/locale/zh-cn"; // 引入中文包
|
||||||
import dayjs, { Dayjs } from "dayjs";
|
import dayjs, { Dayjs } from "dayjs";
|
||||||
@@ -437,6 +438,10 @@ const AnalysisParameters: React.FC = () => {
|
|||||||
fullWidth: true,
|
fullWidth: true,
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
|
localeText={
|
||||||
|
pickerZhCN.components.MuiLocalizationProvider.defaultProps
|
||||||
|
.localeText
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
</LocalizationProvider>
|
</LocalizationProvider>
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
@@ -103,14 +103,6 @@ const HealthRiskStatistics: React.FC = () => {
|
|||||||
trigger: "axis",
|
trigger: "axis",
|
||||||
showContent: true,
|
showContent: true,
|
||||||
confine: 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: {
|
dataset: {
|
||||||
source: datasetSource,
|
source: datasetSource,
|
||||||
@@ -135,10 +127,7 @@ const HealthRiskStatistics: React.FC = () => {
|
|||||||
{
|
{
|
||||||
type: "category",
|
type: "category",
|
||||||
gridIndex: 0,
|
gridIndex: 0,
|
||||||
data:
|
data: datasetSource.length > 0 ? (datasetSource[0] as string[]).slice(1) : [],
|
||||||
datasetSource.length > 0
|
|
||||||
? (datasetSource[0] as string[]).slice(1)
|
|
||||||
: [],
|
|
||||||
axisLabel: {
|
axisLabel: {
|
||||||
fontSize: 10,
|
fontSize: 10,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import {
|
|||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
import { DateTimePicker } from "@mui/x-date-pickers/DateTimePicker";
|
import { DateTimePicker } from "@mui/x-date-pickers/DateTimePicker";
|
||||||
import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider";
|
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 { AdapterDayjs } from "@mui/x-date-pickers/AdapterDayjs";
|
||||||
import "dayjs/locale/zh-cn"; // 引入中文包
|
import "dayjs/locale/zh-cn"; // 引入中文包
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
@@ -454,7 +455,13 @@ const Timeline: React.FC<TimelineProps> = ({
|
|||||||
|
|
||||||
return (
|
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">
|
<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
|
<Paper
|
||||||
elevation={3}
|
elevation={3}
|
||||||
sx={{
|
sx={{
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ import "dayjs/locale/zh-cn"; // 引入中文包
|
|||||||
import dayjs, { Dayjs } from "dayjs";
|
import dayjs, { Dayjs } from "dayjs";
|
||||||
import { AdapterDayjs } from "@mui/x-date-pickers/AdapterDayjs";
|
import { AdapterDayjs } from "@mui/x-date-pickers/AdapterDayjs";
|
||||||
import { DateTimePicker, LocalizationProvider } from "@mui/x-date-pickers";
|
import { DateTimePicker, LocalizationProvider } from "@mui/x-date-pickers";
|
||||||
|
import { zhCN as pickerZhCN } from "@mui/x-date-pickers/locales";
|
||||||
|
|
||||||
const STATUS_OPTIONS: {
|
const STATUS_OPTIONS: {
|
||||||
value: "online" | "offline" | "warning" | "error";
|
value: "online" | "offline" | "warning" | "error";
|
||||||
@@ -1210,6 +1211,10 @@ const SCADADeviceList: React.FC<SCADADeviceListProps> = ({
|
|||||||
<LocalizationProvider
|
<LocalizationProvider
|
||||||
dateAdapter={AdapterDayjs}
|
dateAdapter={AdapterDayjs}
|
||||||
adapterLocale="zh-cn"
|
adapterLocale="zh-cn"
|
||||||
|
localeText={
|
||||||
|
pickerZhCN.components.MuiLocalizationProvider.defaultProps
|
||||||
|
.localeText
|
||||||
|
}
|
||||||
>
|
>
|
||||||
<DateTimePicker
|
<DateTimePicker
|
||||||
label="开始时间"
|
label="开始时间"
|
||||||
|
|||||||
Reference in New Issue
Block a user