|
|
@ -22,16 +22,14 @@ const DeviceManagement = (props) => { |
|
|
|
const [selectedRows,setSelectedRows]=useState([])//选择的key |
|
|
|
const [selectdR,setSelectedR]=useState([])//选择行 |
|
|
|
const [vData,setVData]=useState([])//版本信息 |
|
|
|
const getData=(query)=>{ |
|
|
|
dispatch(firmwareUpgrade.getThingMessages(query)).then((res)=>{ |
|
|
|
const getData=(data)=>{ |
|
|
|
dispatch(firmwareUpgrade.getThingMessages(data)).then((res)=>{ |
|
|
|
if(res.success) { |
|
|
|
setData(res.payload.data) |
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
dispatch(firmwareUpgrade.getFirmware(query)).then(res=>{ |
|
|
|
if(res.success) setVData(res.payload.data) |
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
useEffect(()=>{ |
|
|
|
//结构物和设备类型 |
|
|
@ -46,10 +44,16 @@ const DeviceManagement = (props) => { |
|
|
|
|
|
|
|
}) |
|
|
|
// console.log('xxxx111',user) |
|
|
|
dispatch(firmwareUpgrade.getFirmware()).then(res=>{ |
|
|
|
if(res.success) setVData(res.payload.data) |
|
|
|
}) |
|
|
|
},[]) |
|
|
|
useEffect(()=>{ |
|
|
|
const query={thingIds} |
|
|
|
getData(query) |
|
|
|
if(thingIds&&thingIds.length){ |
|
|
|
const data={thingIds} |
|
|
|
getData(data) |
|
|
|
} |
|
|
|
|
|
|
|
},[thingIds]) |
|
|
|
|
|
|
|
const structChange =value => { |
|
|
@ -65,24 +69,24 @@ const DeviceManagement = (props) => { |
|
|
|
// console.log('event',deviceTypeList) |
|
|
|
setDeviceType(deviceTypeList) |
|
|
|
setThingId(value) |
|
|
|
const query={thingIds:value,device_meta_id:defaultVal} |
|
|
|
getData(query) |
|
|
|
const data={thingIds:value,device_meta_id:defaultVal} |
|
|
|
getData(data) |
|
|
|
|
|
|
|
}; |
|
|
|
const deviceTypeChange=value=>{ |
|
|
|
setUpdataButtonDisabled(true) |
|
|
|
clearSelectedRows() |
|
|
|
setDefaultVal(value) |
|
|
|
const query={thingIds:thingId,device_meta_id:value} |
|
|
|
getData(query) |
|
|
|
const data={thingIds:thingId,device_meta_id:value} |
|
|
|
getData(data) |
|
|
|
// console.log(value,'event') |
|
|
|
} |
|
|
|
//清除结构物的逻辑 |
|
|
|
const clearHandler=()=>{ |
|
|
|
setUpdataButtonDisabled(true) |
|
|
|
clearSelectedRows() |
|
|
|
const query={thingIds} |
|
|
|
getData(query) |
|
|
|
const data={thingIds} |
|
|
|
getData(data) |
|
|
|
|
|
|
|
} |
|
|
|
//清楚设备类型的逻辑 |
|
|
@ -90,17 +94,17 @@ const DeviceManagement = (props) => { |
|
|
|
setUpdataButtonDisabled(true) |
|
|
|
clearSelectedRows() |
|
|
|
setDefaultVal(null) |
|
|
|
const query={thingIds:thingId} |
|
|
|
getData(query) |
|
|
|
const data={thingIds:thingId} |
|
|
|
getData(data) |
|
|
|
} |
|
|
|
//搜索按钮的逻辑 |
|
|
|
const searchHandler=()=>{ |
|
|
|
if(!thingId&&!defaultVal){ |
|
|
|
const query={thingIds} |
|
|
|
getData(query) |
|
|
|
const data={thingIds} |
|
|
|
getData(data) |
|
|
|
}else{ |
|
|
|
const query={thingIds:thingId,device_meta_id:defaultVal,searchVal} |
|
|
|
getData(query) |
|
|
|
const data={thingIds:thingId,device_meta_id:defaultVal,searchVal} |
|
|
|
getData(data) |
|
|
|
} |
|
|
|
} |
|
|
|
const clearSelectedRows = () => { |
|
|
|