|
|
@ -30,7 +30,17 @@ const MaintenanceRecords = (props) => { |
|
|
|
const delHandler=(record)=>{ |
|
|
|
dispatch(facility.delServerInfoMaintenanceRecord(record.id)).then((res)=>{ |
|
|
|
if(res.success) { |
|
|
|
getServerInfo({startTime,endTime,pageIndex:1,pageSize}) |
|
|
|
const query={startTime,endTime,pageIndex,pageSize} |
|
|
|
dispatch(facility.getServerInfoMaintenanceRecord(query)).then((res)=>{ |
|
|
|
if(res.success) { |
|
|
|
setRecordList(res.payload.data.responseRes);setTotal(res?.payload.data.count) |
|
|
|
//再用当前页去查询,判断结果是否为空(删除某一页的唯一元素时,再次请求结果为空),为空且当前页不是第一页,当前页-1,再查询一遍。 |
|
|
|
if(res?.payload.data.responseRes.length===0&&pageIndex!==1){ |
|
|
|
getServerInfo({startTime,endTime,pageIndex:pageIndex-1,pageSize}) |
|
|
|
setPageIndex(pageIndex-1) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
setPageIndex(1) |
|
|
|
|
|
|
|
} |
|
|
@ -164,14 +174,14 @@ const MaintenanceRecords = (props) => { |
|
|
|
</Button> |
|
|
|
</div> |
|
|
|
<div style={{ marginRight: 20, display: 'flex', alignItems: 'baseline' }}> |
|
|
|
<span style={{ marginRight: 10 }}>上报时间</span> |
|
|
|
<span style={{ marginRight: 10 }}>维护开始时间</span> |
|
|
|
<DatePicker type='dateTimeRange' onChange={(dateTime)=>{ |
|
|
|
setStartTime(dateTime[0]+'') |
|
|
|
setEndTime(dateTime[1]+'') |
|
|
|
}} onClear={clearHandler}></DatePicker> |
|
|
|
</div> |
|
|
|
<div> |
|
|
|
<Button onClick={searchHandler}>查询</Button> |
|
|
|
<Button theme='solid' type="primary" onClick={searchHandler}>查询</Button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div> |
|
|
|