From 10ff3ad41319a52d91343b1ce84e2a50058fdc13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?zhaobing=E2=80=99?= Date: Mon, 4 Dec 2023 09:16:52 +0800 Subject: [PATCH 1/4] feat:fix bugs --- .../sections/firmwareUpgrade/components/addFirmwareModal.jsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/web/client/src/sections/firmwareUpgrade/components/addFirmwareModal.jsx b/web/client/src/sections/firmwareUpgrade/components/addFirmwareModal.jsx index 20de846..c62bab2 100644 --- a/web/client/src/sections/firmwareUpgrade/components/addFirmwareModal.jsx +++ b/web/client/src/sections/firmwareUpgrade/components/addFirmwareModal.jsx @@ -29,7 +29,7 @@ const AddFirmwareModal = (props) => { },[]) // console.log('xxxx1111',recordRow) // console.log('xxxx11112',fileUrl) - + const okHandler= ()=>{ // console.log('fileObj',fileObj) api.current.validate().then(async (res)=>{ @@ -50,8 +50,9 @@ const AddFirmwareModal = (props) => { // } // dispatch(firmwareUpgrade.upgradeFirmware(query,body)).then(res=>{ // }) - const responseData=await request.get(qiniu+'/'+fileUrl).responseType('blob') + const responseData=await request.get(qiniu+'/'+fileUrl).responseType('arraybuffer') const blobData = responseData.body; + request.post(crawapi+'/firmwareupgrade') // .set('Content-Type','application/octet-stream') .attach('file',blobData,removeFlag?fileObj.name:recordRow?recordRow.firmwareName:fileObj.name) From aa449658c09dda6729194f5343920f78d1084daa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?zhaobing=E2=80=99?= Date: Mon, 4 Dec 2023 13:37:39 +0800 Subject: [PATCH 2/4] =?UTF-8?q?feat:=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/addFirmwareModal.jsx | 64 ++++++++++--------- 1 file changed, 33 insertions(+), 31 deletions(-) diff --git a/web/client/src/sections/firmwareUpgrade/components/addFirmwareModal.jsx b/web/client/src/sections/firmwareUpgrade/components/addFirmwareModal.jsx index c62bab2..f932f3f 100644 --- a/web/client/src/sections/firmwareUpgrade/components/addFirmwareModal.jsx +++ b/web/client/src/sections/firmwareUpgrade/components/addFirmwareModal.jsx @@ -6,7 +6,7 @@ import { IconUpload,IconVigoLogo } from '@douyinfe/semi-icons'; import request from 'superagent'; 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 {domain}=qiniu //七牛服务器地址 const {firmwareUpgrade}=actions @@ -50,36 +50,36 @@ const AddFirmwareModal = (props) => { // } // dispatch(firmwareUpgrade.upgradeFirmware(query,body)).then(res=>{ // }) - const responseData=await request.get(qiniu+'/'+fileUrl).responseType('arraybuffer') - const blobData = responseData.body; - - request.post(crawapi+'/firmwareupgrade') - // .set('Content-Type','application/octet-stream') - .attach('file',blobData,removeFlag?fileObj.name:recordRow?recordRow.firmwareName:fileObj.name) - .field('filePath',removeFlag?fileUrl:recordRow?recordRow.filepath:fileUrl) - .field('userId', userId||'') - .field('firmwareName', res?.firmwareName||'') - .field('comment',res?.remark||'') - .field('device_meta_name', options?.find(item=>item.value===res?.deviceName)?.label||'') - .query({ version:res?.versionNo,device_meta_id: res?.deviceName,token:'22767e1f-db8d-4a1d-87d4-56347cf21247'}) - .end((err, response) => { - if(response?.ok){ - Notification.success({ title: recordRow?'编辑固件包':'新增固件包', - content: recordRow?'编辑成功':'新增成功', - duration: 3, - }) - setRemoveFlag(false) - onCancel() - }else{ - console.error('Superagent request failed:'); - Notification.error({ title: recordRow?'编辑固件包':'新增固件包', - content: recordRow?'编辑失败':'新增失败', - duration: 3, - }) - } - }) + request.post(crawapi+'/firmwareupgrade') + // .set('Content-Type','application/octet-stream') + // .attach('file',blobData,removeFlag?fileObj.name:recordRow?recordRow.firmwareName:fileObj.name) + .field('filePath',removeFlag?`${apiRoot}/attachments/`+fileUrl:recordRow?`${apiRoot}/attachments/`+recordRow.filepath:`${apiRoot}/attachments/`+fileUrl) + .field('userId', userId||'') + .field('firmwareName', res?.firmwareName||'') + .field('comment',res?.remark||'') + .field('device_meta_name', options?.find(item=>item.value===res?.deviceName)?.label||'') + .query({ version:res?.versionNo,device_meta_id: res?.deviceName,token:'22767e1f-db8d-4a1d-87d4-56347cf21247'}) + .end((err, response) => { + if(response?.ok){ + Notification.success({ title: recordRow?'编辑固件包':'新增固件包', + content: recordRow?'编辑成功':'新增成功', + duration: 3, + }) + setRemoveFlag(false) + onCancel() + }else{ + console.error('Superagent request failed:'); + Notification.error({ title: recordRow?'编辑固件包':'新增固件包', + content: recordRow?'编辑失败':'新增失败', + duration: 3, + }) + } + }) + + + }) } @@ -114,8 +114,10 @@ const AddFirmwareModal = (props) => { { setUploadData({}) From 5ffa783c1f19169b6e1c1ebc91f957da141dcb8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?zhaobing=E2=80=99?= Date: Mon, 4 Dec 2023 13:41:39 +0800 Subject: [PATCH 3/4] =?UTF-8?q?feat:=E4=BF=AE=E6=94=B9=E5=9B=BA=E4=BB=B6?= =?UTF-8?q?=E5=8D=87=E7=BA=A7=E4=B8=8A=E4=BC=A0=E6=8E=A5=E5=8F=A3=E7=9A=84?= =?UTF-8?q?=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sections/firmwareUpgrade/components/addFirmwareModal.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/client/src/sections/firmwareUpgrade/components/addFirmwareModal.jsx b/web/client/src/sections/firmwareUpgrade/components/addFirmwareModal.jsx index f932f3f..9d4444c 100644 --- a/web/client/src/sections/firmwareUpgrade/components/addFirmwareModal.jsx +++ b/web/client/src/sections/firmwareUpgrade/components/addFirmwareModal.jsx @@ -53,7 +53,7 @@ const AddFirmwareModal = (props) => { request.post(crawapi+'/firmwareupgrade') // .set('Content-Type','application/octet-stream') // .attach('file',blobData,removeFlag?fileObj.name:recordRow?recordRow.firmwareName:fileObj.name) - .field('filePath',removeFlag?`${apiRoot}/attachments/`+fileUrl:recordRow?`${apiRoot}/attachments/`+recordRow.filepath:`${apiRoot}/attachments/`+fileUrl) + .field('filePath',removeFlag?`${domain}/attachments/`+fileUrl:recordRow?`${domain}/attachments/`+recordRow.filepath:`${domain}/attachments/`+fileUrl) .field('userId', userId||'') .field('firmwareName', res?.firmwareName||'') .field('comment',res?.remark||'') From 6893553c94058fb87c9b73e731572e376469fcbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?zhaobing=E2=80=99?= Date: Mon, 4 Dec 2023 14:52:28 +0800 Subject: [PATCH 4/4] feat:fix bugs --- .../analysis/containers/tableShow.jsx | 30 ++++++++++--------- web/client/src/sections/analysis/nav-item.jsx | 8 +++-- .../components/addFirmwareModal.jsx | 2 +- 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/web/client/src/sections/analysis/containers/tableShow.jsx b/web/client/src/sections/analysis/containers/tableShow.jsx index dcc1fc1..06c9728 100644 --- a/web/client/src/sections/analysis/containers/tableShow.jsx +++ b/web/client/src/sections/analysis/containers/tableShow.jsx @@ -171,7 +171,7 @@ const Network = props => { ? deviceListAlarms?.find(v => v.deviceId == p.sensorId) ? '异常' : '正常' - : '正常', + : '--', option: objRslt ? objRslt.option : p.option, } }) @@ -190,22 +190,24 @@ const Network = props => { // const lastDataCopy=useMemo(()=>{ // return lastData // },[thingId]) - // const scroll = useMemo(() => ({ y: 400 }), []) + const scroll = useMemo(() => ({ y:clientHeight-600+175 }), []) //名称回调事件 const inputChange = e => { setSearchName(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 = () => { setLastData( - searchName || searchType - ? lastDataCopy.filter(f => f.sensorName.includes(searchName) && f.deviceType.includes(searchType)) - : lastDataCopy + lastDataCopy.filter(f => + (searchName === undefined || f.sensorName.includes(searchName)) && + (searchType === undefined || f.deviceType===searchType) + ) ) } @@ -213,7 +215,7 @@ const Network = props => { { title: '设备名称', dataIndex: 'sensorName', - width: 200, + width: '20%', key: 'sensorName', render: (_, r) => { return ( @@ -228,19 +230,19 @@ const Network = props => { { title: '设备类型', dataIndex: 'deviceType', - width: 200, + width: '15%', key: 'deviceType', }, { title: '最后采集时间', dataIndex: 'collectTime', - width: 200, + width: '15%', key: 'collectTime', }, { title: '数据', dataIndex: 'data', - width: 200, + width: '20%', key: 'data', render: (_, r) => { return ( @@ -254,19 +256,19 @@ const Network = props => { }, { title: '物联网卡状态', - width: 200, + width: '15%', dataIndex: 'iotCardStatus', key: 'iotCardStatus', }, { title: '状态', - width: 200, + width: '10%', dataIndex: 'status', key: 'status', }, { title: '操作', - width: 200, + width: '10%', dataIndex: 'option', key: 'option', }, @@ -318,7 +320,7 @@ const Network = props => {
diff --git a/web/client/src/sections/analysis/nav-item.jsx b/web/client/src/sections/analysis/nav-item.jsx index 76213e6..38b3fa0 100644 --- a/web/client/src/sections/analysis/nav-item.jsx +++ b/web/client/src/sections/analysis/nav-item.jsx @@ -24,9 +24,11 @@ export function getNavItem (user, dispatch) { to: '/analysis/operationAnalysis/operationData', items: [{ itemKey: 'operationData', to: '/analysis/operationAnalysis/operationData', text: '运维数据' - },{ - itemKey: 'network', to: '/analysis/operationAnalysis/network', text: '一图统揽' - }] + }, + // { + // itemKey: 'network', to: '/analysis/operationAnalysis/network', text: '一图统揽' + // } + ] }, // { // itemKey: 'workorderAnalysis', diff --git a/web/client/src/sections/firmwareUpgrade/components/addFirmwareModal.jsx b/web/client/src/sections/firmwareUpgrade/components/addFirmwareModal.jsx index 9d4444c..2d63471 100644 --- a/web/client/src/sections/firmwareUpgrade/components/addFirmwareModal.jsx +++ b/web/client/src/sections/firmwareUpgrade/components/addFirmwareModal.jsx @@ -53,7 +53,7 @@ const AddFirmwareModal = (props) => { request.post(crawapi+'/firmwareupgrade') // .set('Content-Type','application/octet-stream') // .attach('file',blobData,removeFlag?fileObj.name:recordRow?recordRow.firmwareName:fileObj.name) - .field('filePath',removeFlag?`${domain}/attachments/`+fileUrl:recordRow?`${domain}/attachments/`+recordRow.filepath:`${domain}/attachments/`+fileUrl) + .field('filePath',removeFlag?`${domain}/`+fileUrl:recordRow?`${domain}/`+recordRow.filepath:`${domain}/`+fileUrl) .field('userId', userId||'') .field('firmwareName', res?.firmwareName||'') .field('comment',res?.remark||'')