Commit 31a943d0 authored by 周宏民's avatar 周宏民

fix: 历史数据添加默认对比时间参数

parent fce12eee
...@@ -233,6 +233,7 @@ const HistoryView = (props) => { ...@@ -233,6 +233,7 @@ const HistoryView = (props) => {
defaultModel, defaultModel,
showModels, showModels,
needMarkLine, needMarkLine,
defaultDate,
} = props; } = props;
const isBoxPlots = const isBoxPlots =
deviceParams?.length === 1 && deviceParams[0]?.sensors?.split(',').length === 1; deviceParams?.length === 1 && deviceParams[0]?.sensors?.split(',').length === 1;
...@@ -248,7 +249,7 @@ const HistoryView = (props) => { ...@@ -248,7 +249,7 @@ const HistoryView = (props) => {
// 同期对比模式 // 同期对比模式
const [contrastOption, setContrastOption] = useState('day'); // 对比时间类型: 日/月 const [contrastOption, setContrastOption] = useState('day'); // 对比时间类型: 日/月
const [datePickerArr, setDatePickerArr] = useState(DefaultDatePicker('day')); // 对比时间段配置值 const [datePickerArr, setDatePickerArr] = useState(DefaultDatePicker(defaultDate)); // 对比时间段配置值
const [checkboxData, setCheckboxData] = useState(() => [...CheckboxData]); // 曲线设置项 const [checkboxData, setCheckboxData] = useState(() => [...CheckboxData]); // 曲线设置项
const [dataThinKey, setDataThinKey] = useState(timeIntervalList[0].key); // 曲线抽稀时间设置 const [dataThinKey, setDataThinKey] = useState(timeIntervalList[0].key); // 曲线抽稀时间设置
...@@ -322,7 +323,8 @@ const HistoryView = (props) => { ...@@ -322,7 +323,8 @@ const HistoryView = (props) => {
// 同期对比模式: 选择(日/月) // 同期对比模式: 选择(日/月)
const onContrastChange = (value) => { const onContrastChange = (value) => {
setContrastOption(value); setContrastOption(value);
setDatePickerArr([...DefaultDatePicker(value)]); // 模式为日时,默认对比时间根据defaultDate判断 是昨天、上月、还是去年
setDatePickerArr([...DefaultDatePicker(value==='day'?defaultDate:value)]);
}; };
// 同期对比模式: 时间段选择 // 同期对比模式: 时间段选择
...@@ -905,6 +907,7 @@ HistoryView.propTypes = { ...@@ -905,6 +907,7 @@ HistoryView.propTypes = {
), ),
defaultModel: PropTypes.oneOf(['curve', 'table']), defaultModel: PropTypes.oneOf(['curve', 'table']),
showModels: PropTypes.arrayOf(PropTypes.oneOf(['curve', 'table'])), showModels: PropTypes.arrayOf(PropTypes.oneOf(['curve', 'table'])),
defaultDate: PropTypes.string,
}; };
HistoryView.defaultProps = { HistoryView.defaultProps = {
...@@ -915,6 +918,7 @@ HistoryView.defaultProps = { ...@@ -915,6 +918,7 @@ HistoryView.defaultProps = {
defaultModel: 'curve', defaultModel: 'curve',
showModels: ['curve', 'table'], showModels: ['curve', 'table'],
needMarkLine: true, needMarkLine: true,
defaultDate: 'day',
}; };
export default HistoryView; export default HistoryView;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment