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

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

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

42
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 = () => {

Loading…
Cancel
Save