Browse Source

feat:结构物默认值+升级开关关的时候,批量升级开关指挥

dev
zhaobing’ 1 year ago
parent
commit
ee04507342
  1. 9
      web/client/src/sections/firmwareUpgrade/containers/deviceManagement.jsx

9
web/client/src/sections/firmwareUpgrade/containers/deviceManagement.jsx

@ -22,6 +22,7 @@ const DeviceManagement = (props) => {
const [selectedRows,setSelectedRows]=useState([])//key const [selectedRows,setSelectedRows]=useState([])//key
const [selectdR,setSelectedR]=useState([])// const [selectdR,setSelectedR]=useState([])//
const [vData,setVData]=useState([])// const [vData,setVData]=useState([])//
const [id,setId]=useState()//
const getData=(data)=>{ const getData=(data)=>{
dispatch(firmwareUpgrade.getThingMessages(data)).then((res)=>{ dispatch(firmwareUpgrade.getThingMessages(data)).then((res)=>{
if(res.success) { if(res.success) {
@ -51,12 +52,13 @@ const DeviceManagement = (props) => {
useEffect(()=>{ useEffect(()=>{
if(thingIds&&thingIds.length){ if(thingIds&&thingIds.length){
const data={thingIds:thingIds.split(',')[0]||'000'}// const data={thingIds:thingIds.split(',')[0]||'000'}//
setId(thingIds.split(',')[0])
getData(data) getData(data)
} }
console.log('thingIds',thingIds)
},[thingIds]) },[thingIds])
const structChange =value => { const structChange =value => {
setId(value)
clearSelectedRows() clearSelectedRows()
setUpdataButtonDisabled(true) setUpdataButtonDisabled(true)
const deviceTypeList= strucAndDeviceType?.find(item=>item.thingId==value)?.deviceType?.map(child=>{ const deviceTypeList= strucAndDeviceType?.find(item=>item.thingId==value)?.deviceType?.map(child=>{
@ -120,7 +122,7 @@ const DeviceManagement = (props) => {
// console.log(`select row: ${selected}`, record); // console.log(`select row: ${selected}`, record);
// }, // },
onSelectAll: (selected, selectedRows) => { 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) => { onChange: (selectedRowKeys, selectedRows) => {
setSelectedR(selectedRows) setSelectedR(selectedRows)
@ -132,7 +134,7 @@ const DeviceManagement = (props) => {
} }
// //
if(selectedRows&&selectedRows.length>0){ 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 <><div style={{ background: '#FFFFFF', margin: '8px 12px', padding: '20
<Select placeholder='请选择结构物' optionList={struc} filter showClear <Select placeholder='请选择结构物' optionList={struc} filter showClear
onChange={structChange} onChange={structChange}
onClear={clearHandler} onClear={clearHandler}
value={id} //
style={{ width:300,marginRight:10}}> style={{ width:300,marginRight:10}}>
</Select> </Select>
<Select placeholder='请选择设备型号' value={defaultVal} optionList={deviceType} <Select placeholder='请选择设备型号' value={defaultVal} optionList={deviceType}

Loading…
Cancel
Save