From e473b94dd1a42773b1b9f2e70a0559f583a4717a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?zhaobing=E2=80=99?= Date: Tue, 14 Nov 2023 13:42:33 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/sections/data/containers/dataDetail.jsx | 13 +++++++++---- .../src/sections/data/containers/dataQuery.jsx | 6 +++--- web/client/src/sections/data/nav-item.jsx | 2 +- web/client/src/utils/webapi.js | 2 +- 4 files changed, 14 insertions(+), 9 deletions(-) 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} />