From ee04507342715e08104d6f074215364462e65d2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?zhaobing=E2=80=99?= Date: Wed, 11 Oct 2023 15:31:50 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E7=BB=93=E6=9E=84=E7=89=A9=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E5=80=BC+=E5=8D=87=E7=BA=A7=E5=BC=80=E5=85=B3?= =?UTF-8?q?=E5=85=B3=E7=9A=84=E6=97=B6=E5=80=99=EF=BC=8C=E6=89=B9=E9=87=8F?= =?UTF-8?q?=E5=8D=87=E7=BA=A7=E5=BC=80=E5=85=B3=E6=8C=87=E6=8C=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../firmwareUpgrade/containers/deviceManagement.jsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/web/client/src/sections/firmwareUpgrade/containers/deviceManagement.jsx b/web/client/src/sections/firmwareUpgrade/containers/deviceManagement.jsx index 2155b5d..c4bdd9e 100644 --- a/web/client/src/sections/firmwareUpgrade/containers/deviceManagement.jsx +++ b/web/client/src/sections/firmwareUpgrade/containers/deviceManagement.jsx @@ -22,6 +22,7 @@ const DeviceManagement = (props) => { const [selectedRows,setSelectedRows]=useState([])//选择的key const [selectdR,setSelectedR]=useState([])//选择行 const [vData,setVData]=useState([])//版本信息 + const [id,setId]=useState()//初始化展示的结构物 const getData=(data)=>{ dispatch(firmwareUpgrade.getThingMessages(data)).then((res)=>{ if(res.success) { @@ -51,12 +52,13 @@ const DeviceManagement = (props) => { useEffect(()=>{ if(thingIds&&thingIds.length){ const data={thingIds:thingIds.split(',')[0]||'000'}//给一个初始化的值 + setId(thingIds.split(',')[0]) getData(data) } - console.log('thingIds',thingIds) },[thingIds]) const structChange =value => { + setId(value) clearSelectedRows() setUpdataButtonDisabled(true) const deviceTypeList= strucAndDeviceType?.find(item=>item.thingId==value)?.deviceType?.map(child=>{ @@ -120,7 +122,7 @@ const DeviceManagement = (props) => { // console.log(`select row: ${selected}`, record); // }, onSelectAll: (selected, selectedRows) => { - setUpdataButtonDisabled(!selectedRows.every(item=>selectedRows[0]?.deviceType===item.deviceType)) + setUpdataButtonDisabled(!selectedRows.every(item=>selectedRows[0]?.deviceType===item.deviceType&&item.switchStatus)) }, onChange: (selectedRowKeys, selectedRows) => { setSelectedR(selectedRows) @@ -132,7 +134,7 @@ const DeviceManagement = (props) => { } //选择很多的时候,如果有设备型号不对应的情况 if(selectedRows&&selectedRows.length>0){ - setUpdataButtonDisabled(!selectedRows.every(item=>selectedRows[0].deviceType===item.deviceType)) + setUpdataButtonDisabled(!selectedRows.every(item=>selectedRows[0].deviceType===item.deviceType&&item.switchStatus)) } @@ -211,6 +213,7 @@ return <>