diff --git a/api/app/lib/controllers/analysis/network.js b/api/app/lib/controllers/analysis/network.js index 8b3d99c..a0690bb 100644 --- a/api/app/lib/controllers/analysis/network.js +++ b/api/app/lib/controllers/analysis/network.js @@ -430,8 +430,8 @@ async function createInvoke (ctx, next) { if (data) { try { const dataToIota = data - let iotaResponse = await ctx.app.fs.iotRequest.post(`/capabilities/invoke`, dataToIota) - rslt = JSON.parse(iotaResponse) + let iotaResponse = await ctx.app.fs.iotInvoke.post(`capabilities/invoke`, {data:dataToIota}) + rslt = iotaResponse error = null; } catch (err) { ctx.fs.logger.error(`path: ${ctx.path}, error: ${err}`); diff --git a/api/config.js b/api/config.js index 30add71..ea21e00 100644 --- a/api/config.js +++ b/api/config.js @@ -332,7 +332,10 @@ const product = { name: 'iotRequest', root: IOT_PROXY + '/_iota_api', dataWord: 'text' - }, { + }, { + name: 'iotInvoke', + root: IOT_PROXY + '/_iota_api', + },{ name: 'godRequest', root: GOD_URL, params: { diff --git a/web-network/client/src/sections/network/containers/tableShow.js b/web-network/client/src/sections/network/containers/tableShow.js index 15a663c..57eff96 100644 --- a/web-network/client/src/sections/network/containers/tableShow.js +++ b/web-network/client/src/sections/network/containers/tableShow.js @@ -7,7 +7,8 @@ import moment from 'moment' const Network = props => { const { dispatch, actions, user, clientHeight, thingId, deviceListAlarms, devicesCardStatusList, project, token,thingStatus } = props const { analysis } = actions - const form = useRef() //表单 + // const form = useRef() //表单 + const [form] = Form.useForm(); const [deployData, setDeployData] = useState([]) const [deviceData, setDeviceData] = useState([]) const [deviceMetasDeployed, setDeviceMetasDeployed] = useState([]) @@ -26,6 +27,7 @@ const Network = props => { const [controlId,setControlId]=useState('') const [id,setId]=useState('')//设计设备的id const [param,setParam]=useState('')//开与关 + const [text,setText]=useState('') const DeviceTypes = { 'DTU': 'DTU', 'gateway': '网关', @@ -267,8 +269,9 @@ const Network = props => { }; const res= await dispatch(analysis.invokeCapability(values,token)) - setStatus(res?.payload?.data?.data?.info?.includes('离线')?false:true) - } + setStatus(res?.payload?.data?.data?.data?.info?.includes('离线')?false:true) + form.setFieldValue('status', res?.payload?.data?.data?.data?.info) +} const columns = [ { title: '设备名称', @@ -406,18 +409,24 @@ const Network = props => { dataSource={lastData}> {setModalVis(false)}}> + 取消 + , + ]} visible={modalVis} - onCancel={()=>{setModalVis(false)}} // sensorId={sensorId} - onOk={okHandler} okText='升级' > -
+ - + - +