Browse Source

feat:查询结构物的bugs

dev
zhaobing’ 1 year ago
parent
commit
72a4128458
  1. 5
      api/app/lib/controllers/firmwareUpgrade/index.js
  2. 4
      api/app/lib/routes/firmwareUpgrade/index.js
  3. 6
      web/client/src/sections/firmwareUpgrade/actions/firmwareUpgrade.js
  4. 42
      web/client/src/sections/firmwareUpgrade/containers/deviceManagement.jsx

5
api/app/lib/controllers/firmwareUpgrade/index.js

@ -276,8 +276,9 @@ async function deleteFirmware(ctx){
async function getThingMessages(ctx){ async function getThingMessages(ctx){
try{ try{
const {thingIds,device_meta_id,searchVal}=ctx.query const {thingIds,device_meta_id,searchVal}=ctx.request.body
const res= await ctx.app.fs.craw.get(ApiTable.getThingMessages,{query:{thingIds,device_meta_id}})
const res= await ctx.app.fs.craw.post(ApiTable.getThingMessages,{data:{thingIds,device_meta_id}})
// console.log('xxxxxx',res) // console.log('xxxxxx',res)
let rslt=[] let rslt=[]
if(res){ if(res){

4
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 } app.fs.api.logAttr['DELETE/deleteFirmware'] = { content: '删除固件包', visible: true }
router.delete('/deleteFirmware', firmwareUpgrade.deleteFirmware) router.delete('/deleteFirmware', firmwareUpgrade.deleteFirmware)
app.fs.api.logAttr['GET/getThingMessages'] = { content: '获取设备信息', visible: true } app.fs.api.logAttr['POST/getThingMessages'] = { content: '获取设备信息', visible: true }
router.get('/getThingMessages', firmwareUpgrade.getThingMessages) router.post('/getThingMessages', firmwareUpgrade.getThingMessages)
app.fs.api.logAttr['POST/distributeConfiguration'] = { content: '下发配置(单个或批量)', visible: true } app.fs.api.logAttr['POST/distributeConfiguration'] = { content: '下发配置(单个或批量)', visible: true }
router.post('/distributeConfiguration', firmwareUpgrade.distributeConfiguration) router.post('/distributeConfiguration', firmwareUpgrade.distributeConfiguration)

6
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({ return dispatch => basicAction({
type: 'get', type: 'post',
dispatch: dispatch, dispatch: dispatch,
query, data,
actionType: 'GET_THING_MESSAGES', actionType: 'GET_THING_MESSAGES',
url: `${ApiTable.getThingMessages}`, url: `${ApiTable.getThingMessages}`,
msg: { option: '获取设备信息' }, msg: { option: '获取设备信息' },

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

@ -22,16 +22,14 @@ 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 getData=(query)=>{ const getData=(data)=>{
dispatch(firmwareUpgrade.getThingMessages(query)).then((res)=>{ dispatch(firmwareUpgrade.getThingMessages(data)).then((res)=>{
if(res.success) { if(res.success) {
setData(res.payload.data) setData(res.payload.data)
} }
}) })
dispatch(firmwareUpgrade.getFirmware(query)).then(res=>{
if(res.success) setVData(res.payload.data)
})
} }
useEffect(()=>{ useEffect(()=>{
// //
@ -46,10 +44,16 @@ const DeviceManagement = (props) => {
}) })
// console.log('xxxx111',user) // console.log('xxxx111',user)
dispatch(firmwareUpgrade.getFirmware()).then(res=>{
if(res.success) setVData(res.payload.data)
})
},[]) },[])
useEffect(()=>{ useEffect(()=>{
const query={thingIds} if(thingIds&&thingIds.length){
getData(query) const data={thingIds}
getData(data)
}
},[thingIds]) },[thingIds])
const structChange =value => { const structChange =value => {
@ -65,24 +69,24 @@ const DeviceManagement = (props) => {
// console.log('event',deviceTypeList) // console.log('event',deviceTypeList)
setDeviceType(deviceTypeList) setDeviceType(deviceTypeList)
setThingId(value) setThingId(value)
const query={thingIds:value,device_meta_id:defaultVal} const data={thingIds:value,device_meta_id:defaultVal}
getData(query) getData(data)
}; };
const deviceTypeChange=value=>{ const deviceTypeChange=value=>{
setUpdataButtonDisabled(true) setUpdataButtonDisabled(true)
clearSelectedRows() clearSelectedRows()
setDefaultVal(value) setDefaultVal(value)
const query={thingIds:thingId,device_meta_id:value} const data={thingIds:thingId,device_meta_id:value}
getData(query) getData(data)
// console.log(value,'event') // console.log(value,'event')
} }
// //
const clearHandler=()=>{ const clearHandler=()=>{
setUpdataButtonDisabled(true) setUpdataButtonDisabled(true)
clearSelectedRows() clearSelectedRows()
const query={thingIds} const data={thingIds}
getData(query) getData(data)
} }
// //
@ -90,17 +94,17 @@ const DeviceManagement = (props) => {
setUpdataButtonDisabled(true) setUpdataButtonDisabled(true)
clearSelectedRows() clearSelectedRows()
setDefaultVal(null) setDefaultVal(null)
const query={thingIds:thingId} const data={thingIds:thingId}
getData(query) getData(data)
} }
// //
const searchHandler=()=>{ const searchHandler=()=>{
if(!thingId&&!defaultVal){ if(!thingId&&!defaultVal){
const query={thingIds} const data={thingIds}
getData(query) getData(data)
}else{ }else{
const query={thingIds:thingId,device_meta_id:defaultVal,searchVal} const data={thingIds:thingId,device_meta_id:defaultVal,searchVal}
getData(query) getData(data)
} }
} }
const clearSelectedRows = () => { const clearSelectedRows = () => {

Loading…
Cancel
Save