diff --git a/api/app/lib/controllers/firmwareUpgrade/index.js b/api/app/lib/controllers/firmwareUpgrade/index.js index 0d7a39b..fcbbc91 100644 --- a/api/app/lib/controllers/firmwareUpgrade/index.js +++ b/api/app/lib/controllers/firmwareUpgrade/index.js @@ -276,8 +276,9 @@ async function deleteFirmware(ctx){ async function getThingMessages(ctx){ try{ - const {thingIds,device_meta_id,searchVal}=ctx.query - const res= await ctx.app.fs.craw.get(ApiTable.getThingMessages,{query:{thingIds,device_meta_id}}) + const {thingIds,device_meta_id,searchVal}=ctx.request.body + + const res= await ctx.app.fs.craw.post(ApiTable.getThingMessages,{data:{thingIds,device_meta_id}}) // console.log('xxxxxx',res) let rslt=[] if(res){ diff --git a/api/app/lib/routes/firmwareUpgrade/index.js b/api/app/lib/routes/firmwareUpgrade/index.js index d91ead1..fdfc130 100644 --- a/api/app/lib/routes/firmwareUpgrade/index.js +++ b/api/app/lib/routes/firmwareUpgrade/index.js @@ -18,8 +18,8 @@ module.exports = function (app, router, opts) { app.fs.api.logAttr['DELETE/deleteFirmware'] = { content: '删除固件包', visible: true } router.delete('/deleteFirmware', firmwareUpgrade.deleteFirmware) - app.fs.api.logAttr['GET/getThingMessages'] = { content: '获取设备信息', visible: true } - router.get('/getThingMessages', firmwareUpgrade.getThingMessages) + app.fs.api.logAttr['POST/getThingMessages'] = { content: '获取设备信息', visible: true } + router.post('/getThingMessages', firmwareUpgrade.getThingMessages) app.fs.api.logAttr['POST/distributeConfiguration'] = { content: '下发配置(单个或批量)', visible: true } router.post('/distributeConfiguration', firmwareUpgrade.distributeConfiguration) diff --git a/web/client/src/sections/firmwareUpgrade/actions/firmwareUpgrade.js b/web/client/src/sections/firmwareUpgrade/actions/firmwareUpgrade.js index 0910b66..6413124 100644 --- a/web/client/src/sections/firmwareUpgrade/actions/firmwareUpgrade.js +++ b/web/client/src/sections/firmwareUpgrade/actions/firmwareUpgrade.js @@ -75,11 +75,11 @@ export function deleteFirmware(query) { //删除固件包 } -export function getThingMessages(query) { //获取固件包信息 +export function getThingMessages(data) { //获取固件包信息 return dispatch => basicAction({ - type: 'get', + type: 'post', dispatch: dispatch, - query, + data, actionType: 'GET_THING_MESSAGES', url: `${ApiTable.getThingMessages}`, msg: { option: '获取设备信息' }, diff --git a/web/client/src/sections/firmwareUpgrade/containers/deviceManagement.jsx b/web/client/src/sections/firmwareUpgrade/containers/deviceManagement.jsx index e163fb1..21a8e6a 100644 --- a/web/client/src/sections/firmwareUpgrade/containers/deviceManagement.jsx +++ b/web/client/src/sections/firmwareUpgrade/containers/deviceManagement.jsx @@ -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 = () => {