diff --git a/web/client/src/sections/data/containers/dataDetail.jsx b/web/client/src/sections/data/containers/dataDetail.jsx
index 62dc2e7..34a16e2 100644
--- a/web/client/src/sections/data/containers/dataDetail.jsx
+++ b/web/client/src/sections/data/containers/dataDetail.jsx
@@ -26,15 +26,16 @@ const DataDetail = (props) => {
const [sensorList,setSensorList]=useState([])//设备列表
const [sensorId,setSensorId]=useState([])//设备数组id
const [project,setProject]=useState(null)//project(eg:{projcet:'nbjj'})
- const form = useRef();
+ const [dateRange,setDateRange]=useState([moment().subtract(24, 'hours').format('YYYY-MM-DD HH:mm:ss'), moment().format('YYYY-MM-DD HH:mm:ss')])
+ const form = useRef()
//初始化
useEffect(() => {
if(factorId&&project){
let query={
factorId,
sensorId:sensorId&&sensorId.length>0?sensorId.map(item=>`${project}-${item}`).join(','):[-11],
- startTime:form.current.getValue('createTimes')[0],
- endTime:form.current.getValue('createTimes')[1],
+ startTime:moment(dateRange[0]).format('YYYY-MM-DD HH:mm:ss'),
+ endTime:moment(dateRange[1]).format('YYYY-MM-DD HH:mm:ss'),
limit:queryPage.limit,
page:queryPage.page
}
@@ -153,6 +154,10 @@ const DataDetail = (props) => {
}
})
}
+ //日期变化函数
+ const dateChange=(e)=>{
+ setDateRange(e)
+ }
const searchHandler=(values) => {
form.current.validate().then(rs=>{
let query={
@@ -238,7 +243,7 @@ const DataDetail = (props) => {
label="查询时间"
initValue={[moment().subtract(24, 'hours').format('YYYY-MM-DD HH:mm:ss'), moment().format('YYYY-MM-DD HH:mm:ss')]}
// style={{ width: 268 }}
- type="dateTimeRange" density="compact"
+ type="dateTimeRange" density="compact" onChange={dateChange}
/>