|
|
@ -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,12 +50,10 @@ const AddFirmwareModal = (props) => { |
|
|
|
// } |
|
|
|
// dispatch(firmwareUpgrade.upgradeFirmware(query,body)).then(res=>{ |
|
|
|
// }) |
|
|
|
const responseData=await request.get(qiniu+'/'+fileUrl).responseType('blob') |
|
|
|
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) |
|
|
|
// .attach('file',blobData,removeFlag?fileObj.name:recordRow?recordRow.firmwareName:fileObj.name) |
|
|
|
.field('filePath',removeFlag?`${domain}/`+fileUrl:recordRow?`${domain}/`+recordRow.filepath:`${domain}/`+fileUrl) |
|
|
|
.field('userId', userId||'') |
|
|
|
.field('firmwareName', res?.firmwareName||'') |
|
|
|
.field('comment',res?.remark||'') |
|
|
@ -80,6 +78,9 @@ const AddFirmwareModal = (props) => { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
@ -113,6 +114,8 @@ const AddFirmwareModal = (props) => { |
|
|
|
<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.Upload limit={1} |
|
|
|
// action={`/file/uploadLocal&token=` + user.token} |
|
|
|
// action={`/file/uploadLocal&token=` + user.token} |
|
|
|
action={`${apiRoot}/attachments/p`} |
|
|
|
field='files' label='文件上传' |
|
|
|
rules={[{ required: true, message: '文件上传必填' }]} |
|
|
|