禁止其他年份选择
This commit is contained in:
parent
147baceeb0
commit
125279656f
@ -329,7 +329,22 @@ class DangerJob extends React.Component {
|
||||
|
||||
// 如果没有数据,返回空
|
||||
if (!tableData || tableData.length === 0) {
|
||||
return <div style={{ textAlign: 'center', padding: '50px', color: '#999' }}>暂无危险作业数据</div>;
|
||||
return (
|
||||
<div
|
||||
style={{
|
||||
textAlign: 'center',
|
||||
padding: '50px',
|
||||
color: '#999',
|
||||
fontSize: '20px',
|
||||
display: 'flex',
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
flex: 1,
|
||||
}}
|
||||
>
|
||||
暂无危险作业数据
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
// 表格列配置
|
||||
@ -531,6 +546,13 @@ class DangerJob extends React.Component {
|
||||
this.isUnmounted = true;
|
||||
this.disposeAllCharts();
|
||||
}
|
||||
disabledCurrentYearDate = (current) => {
|
||||
if (!current) return false;
|
||||
const currentYear = new Date().getFullYear();
|
||||
const selectedYear = current.year();
|
||||
// 只能选择当前年份
|
||||
return selectedYear !== currentYear;
|
||||
};
|
||||
|
||||
render() {
|
||||
const { companyData, selectedCompany, selectedStartDate, selectedEndDate } = this.props;
|
||||
@ -556,11 +578,21 @@ class DangerJob extends React.Component {
|
||||
<span className={styles.monthSelectorLabel} style={{ margin: '0 20px' }}>
|
||||
开始日期:
|
||||
</span>
|
||||
<DatePicker value={selectedStartDate} format="YYYY-MM-DD" onChange={this.startChange} />
|
||||
<DatePicker
|
||||
value={selectedStartDate}
|
||||
format="YYYY-MM-DD"
|
||||
onChange={this.startChange}
|
||||
disabledDate={this.disabledCurrentYearDate}
|
||||
/>
|
||||
<span className={styles.monthSelectorLabel} style={{ margin: '0 20px' }}>
|
||||
结束日期:
|
||||
</span>
|
||||
<DatePicker value={selectedEndDate} format="YYYY-MM-DD" onChange={this.endChange} />
|
||||
<DatePicker
|
||||
value={selectedEndDate}
|
||||
format="YYYY-MM-DD"
|
||||
onChange={this.endChange}
|
||||
disabledDate={this.disabledCurrentYearDate}
|
||||
/>
|
||||
</div>
|
||||
{this.renderDangerTable()}
|
||||
</div>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user