wenlele 1 year ago
parent
commit
5f34b36d8a
  1. 30
      web/client/src/sections/analysis/containers/tableShow.jsx
  2. 8
      web/client/src/sections/analysis/nav-item.jsx
  3. 65
      web/client/src/sections/firmwareUpgrade/components/addFirmwareModal.jsx

30
web/client/src/sections/analysis/containers/tableShow.jsx

@ -171,7 +171,7 @@ const Network = props => {
? deviceListAlarms?.find(v => v.deviceId == p.sensorId) ? deviceListAlarms?.find(v => v.deviceId == p.sensorId)
? '异常' ? '异常'
: '正常' : '正常'
: '正常', : '--',
option: objRslt ? objRslt.option : p.option, option: objRslt ? objRslt.option : p.option,
} }
}) })
@ -190,22 +190,24 @@ const Network = props => {
// const lastDataCopy=useMemo(()=>{ // const lastDataCopy=useMemo(()=>{
// return lastData // return lastData
// },[thingId]) // },[thingId])
// const scroll = useMemo(() => ({ y: 400 }), []) const scroll = useMemo(() => ({ y:clientHeight-600+175 }), [])
// //
const inputChange = e => { const inputChange = e => {
setSearchName(e) setSearchName(e)
} }
// //
const selectChange = e => { const selectChange = e => {
setSearchType(typeList.find(f => f.value == e)?.label) let rslt=typeList.find(f => f.value == e)
setSearchType(rslt?rslt.label:undefined)
} }
// //
const searchHandler = () => { const searchHandler = () => {
setLastData( setLastData(
searchName || searchType lastDataCopy.filter(f =>
? lastDataCopy.filter(f => f.sensorName.includes(searchName) && f.deviceType.includes(searchType)) (searchName === undefined || f.sensorName.includes(searchName)) &&
: lastDataCopy (searchType === undefined || f.deviceType===searchType)
)
) )
} }
@ -213,7 +215,7 @@ const Network = props => {
{ {
title: '设备名称', title: '设备名称',
dataIndex: 'sensorName', dataIndex: 'sensorName',
width: 200, width: '20%',
key: 'sensorName', key: 'sensorName',
render: (_, r) => { render: (_, r) => {
return ( return (
@ -228,19 +230,19 @@ const Network = props => {
{ {
title: '设备类型', title: '设备类型',
dataIndex: 'deviceType', dataIndex: 'deviceType',
width: 200, width: '15%',
key: 'deviceType', key: 'deviceType',
}, },
{ {
title: '最后采集时间', title: '最后采集时间',
dataIndex: 'collectTime', dataIndex: 'collectTime',
width: 200, width: '15%',
key: 'collectTime', key: 'collectTime',
}, },
{ {
title: '数据', title: '数据',
dataIndex: 'data', dataIndex: 'data',
width: 200, width: '20%',
key: 'data', key: 'data',
render: (_, r) => { render: (_, r) => {
return ( return (
@ -254,19 +256,19 @@ const Network = props => {
}, },
{ {
title: '物联网卡状态', title: '物联网卡状态',
width: 200, width: '15%',
dataIndex: 'iotCardStatus', dataIndex: 'iotCardStatus',
key: 'iotCardStatus', key: 'iotCardStatus',
}, },
{ {
title: '状态', title: '状态',
width: 200, width: '10%',
dataIndex: 'status', dataIndex: 'status',
key: 'status', key: 'status',
}, },
{ {
title: '操作', title: '操作',
width: 200, width: '10%',
dataIndex: 'option', dataIndex: 'option',
key: 'option', key: 'option',
}, },
@ -318,7 +320,7 @@ const Network = props => {
</div> </div>
</div> </div>
<Table <Table
// scroll={scroll} scroll={scroll}
columns={columns} columns={columns}
dataSource={lastData}></Table> dataSource={lastData}></Table>
</> </>

8
web/client/src/sections/analysis/nav-item.jsx

@ -24,9 +24,11 @@ export function getNavItem (user, dispatch) {
to: '/analysis/operationAnalysis/operationData', to: '/analysis/operationAnalysis/operationData',
items: [{ items: [{
itemKey: 'operationData', to: '/analysis/operationAnalysis/operationData', text: '运维数据' itemKey: 'operationData', to: '/analysis/operationAnalysis/operationData', text: '运维数据'
},{ },
itemKey: 'network', to: '/analysis/operationAnalysis/network', text: '一图统揽' // {
}] // itemKey: 'network', to: '/analysis/operationAnalysis/network', text: ''
// }
]
}, },
// { // {
// itemKey: 'workorderAnalysis', // itemKey: 'workorderAnalysis',

65
web/client/src/sections/firmwareUpgrade/components/addFirmwareModal.jsx

@ -6,7 +6,7 @@ import { IconUpload,IconVigoLogo } from '@douyinfe/semi-icons';
import request from 'superagent'; import request from 'superagent';
const AddFirmwareModal = (props) => { const AddFirmwareModal = (props) => {
const {modalVis,onCancel,crawapi,recordRow,actions,dispatch,qiniu,apiRoot} =props const {modalVis,onCancel,crawapi,recordRow,actions,dispatch,qiniu,apiRoot,user} =props
const api = useRef(); const api = useRef();
const {domain}=qiniu // const {domain}=qiniu //
const {firmwareUpgrade}=actions const {firmwareUpgrade}=actions
@ -29,7 +29,7 @@ const AddFirmwareModal = (props) => {
},[]) },[])
// console.log('xxxx1111',recordRow) // console.log('xxxx1111',recordRow)
// console.log('xxxx11112',fileUrl) // console.log('xxxx11112',fileUrl)
const okHandler= ()=>{ const okHandler= ()=>{
// console.log('fileObj',fileObj) // console.log('fileObj',fileObj)
api.current.validate().then(async (res)=>{ api.current.validate().then(async (res)=>{
@ -50,35 +50,36 @@ const AddFirmwareModal = (props) => {
// } // }
// dispatch(firmwareUpgrade.upgradeFirmware(query,body)).then(res=>{ // dispatch(firmwareUpgrade.upgradeFirmware(query,body)).then(res=>{
// }) // })
const responseData=await request.get(qiniu+'/'+fileUrl).responseType('blob') request.post(crawapi+'/firmwareupgrade')
const blobData = responseData.body; // .set('Content-Type','application/octet-stream')
request.post(crawapi+'/firmwareupgrade') // .attach('file',blobData,removeFlag?fileObj.name:recordRow?recordRow.firmwareName:fileObj.name)
// .set('Content-Type','application/octet-stream') .field('filePath',removeFlag?`${domain}/`+fileUrl:recordRow?`${domain}/`+recordRow.filepath:`${domain}/`+fileUrl)
.attach('file',blobData,removeFlag?fileObj.name:recordRow?recordRow.firmwareName:fileObj.name) .field('userId', userId||'')
.field('filePath',removeFlag?fileUrl:recordRow?recordRow.filepath:fileUrl) .field('firmwareName', res?.firmwareName||'')
.field('userId', userId||'') .field('comment',res?.remark||'')
.field('firmwareName', res?.firmwareName||'') .field('device_meta_name', options?.find(item=>item.value===res?.deviceName)?.label||'')
.field('comment',res?.remark||'') .query({ version:res?.versionNo,device_meta_id: res?.deviceName,token:'22767e1f-db8d-4a1d-87d4-56347cf21247'})
.field('device_meta_name', options?.find(item=>item.value===res?.deviceName)?.label||'') .end((err, response) => {
.query({ version:res?.versionNo,device_meta_id: res?.deviceName,token:'22767e1f-db8d-4a1d-87d4-56347cf21247'}) if(response?.ok){
.end((err, response) => { Notification.success({ title: recordRow?'编辑固件包':'新增固件包',
if(response?.ok){ content: recordRow?'编辑成功':'新增成功',
Notification.success({ title: recordRow?'编辑固件包':'新增固件包', duration: 3,
content: recordRow?'编辑成功':'新增成功', })
duration: 3, setRemoveFlag(false)
}) onCancel()
setRemoveFlag(false) }else{
onCancel() console.error('Superagent request failed:');
}else{ Notification.error({ title: recordRow?'编辑固件包':'新增固件包',
console.error('Superagent request failed:'); content: recordRow?'编辑失败':'新增失败',
Notification.error({ title: recordRow?'编辑固件包':'新增固件包', duration: 3,
content: recordRow?'编辑失败':'新增失败', })
duration: 3, }
}) })
}
})
}) })
} }
@ -113,8 +114,10 @@ const AddFirmwareModal = (props) => {
<Form.Select disabled={recordRow?true:false} field='deviceName' label='设备型号:' placeholder='请选择设备型号' optionList={options} rules={[{ required: true, message: '设备型号必填' }]}></Form.Select> <Form.Select disabled={recordRow?true:false} field='deviceName' label='设备型号:' placeholder='请选择设备型号' optionList={options} rules={[{ required: true, message: '设备型号必填' }]}></Form.Select>
<Form.Input disabled={recordRow?true:false} field='versionNo' label='版本号:' rules={[{ required: true, message: '版本号必填' }]}></Form.Input> <Form.Input disabled={recordRow?true:false} field='versionNo' label='版本号:' rules={[{ required: true, message: '版本号必填' }]}></Form.Input>
<Form.Upload limit={1} <Form.Upload limit={1}
action={`${apiRoot}/attachments/p`} // action={`/file/uploadLocal&token=` + user.token}
field='files' label='文件上传' // action={`/file/uploadLocal&token=` + user.token}
action={`${apiRoot}/attachments/p`}
field='files' label='文件上传'
rules={[{ required: true, message: '文件上传必填' }]} rules={[{ required: true, message: '文件上传必填' }]}
onRemove={() => { onRemove={() => {
setUploadData({}) setUploadData({})

Loading…
Cancel
Save