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 <>