|
|
@@ -6,10 +6,11 @@
|
|
|
import React, { Component } from 'react'
|
|
|
import './formCommon.less'
|
|
|
import { Upload } from 'antd'
|
|
|
-import { isObjNull } from '../../../utils/common/common.util'
|
|
|
+import { getBracketStr, isObjNull } from '../../../utils/common/common.util'
|
|
|
import { Toast } from 'antd-mobile'
|
|
|
import { UploadOutlined } from '@ant-design/icons'
|
|
|
-import BillModel from '../../../model/common/BillModel'
|
|
|
+import BillModel, { billReadOnly } from '../../../model/common/BillModel'
|
|
|
+import store from '../../../redux/store/store'
|
|
|
|
|
|
let uploadFail = false
|
|
|
|
|
|
@@ -42,10 +43,7 @@ export default class FormEnclosure extends Component {
|
|
|
const { billModel } = this.state
|
|
|
|
|
|
let valueItem = this.getEnclosureCom(billModel)
|
|
|
- return (
|
|
|
- this.renderTwoLines(
|
|
|
- billModel,
|
|
|
- valueItem))
|
|
|
+ return (valueItem)
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -77,44 +75,65 @@ export default class FormEnclosure extends Component {
|
|
|
* @param billModel
|
|
|
*/
|
|
|
getEnclosureCom = (billModel) => {
|
|
|
- return <div style={{
|
|
|
- margin: '4px 10px 10px',
|
|
|
- }}>
|
|
|
- <Upload
|
|
|
- action={this.props.baseUrl + '/mobile/uploadAttachs.action'}
|
|
|
- listType={'picture'}
|
|
|
- multiple={true}
|
|
|
- fileList={billModel.fileList ? billModel.fileList : []}
|
|
|
- showUploadList={true}
|
|
|
- withCredentials={true}
|
|
|
- beforeUpload={this.beforeUpload}
|
|
|
- onChange={this.handleChange}
|
|
|
- // onPreview={this.handlePreview}
|
|
|
- // onRemove={this.handleRemove}
|
|
|
- // onDownload={() => {}}
|
|
|
- // data={''}
|
|
|
- method={'post'}
|
|
|
- className={'upload-list-inline'}
|
|
|
- >
|
|
|
- <div style={{ display: 'flex', alignItems: 'center' }}>
|
|
|
- <div
|
|
|
- className={'uploadBtn'}>
|
|
|
- <UploadOutlined
|
|
|
- style={{ color: 'white' }}/>
|
|
|
- <span style={{ fontSize: '12px', marginLeft: '6px' }}>选择文件</span>
|
|
|
+ return <Upload
|
|
|
+ action={this.props.baseUrl + '/mobile/uploadAttachs.action'}
|
|
|
+ listType={'picture'}
|
|
|
+ multiple={true}
|
|
|
+ disabled={billReadOnly(billModel)}
|
|
|
+ fileList={billModel.fileList ? billModel.fileList : []}
|
|
|
+ showUploadList={true}
|
|
|
+ withCredentials={true}
|
|
|
+ beforeUpload={this.beforeUpload}
|
|
|
+ onChange={this.handleChange}
|
|
|
+ // onPreview={this.handlePreview}
|
|
|
+ onRemove={this.handleRemove}
|
|
|
+ // onDownload={() => {}}
|
|
|
+ // data={''}
|
|
|
+ method={'post'}
|
|
|
+ className={'upload-list-inline'}
|
|
|
+ >
|
|
|
+ <div className='form-common-layout'
|
|
|
+ style={{
|
|
|
+ borderBottom: 'none',
|
|
|
+ width: '100vw',
|
|
|
+ }}>
|
|
|
+ <div style={{
|
|
|
+ display: 'flex',
|
|
|
+ flex: 1,
|
|
|
+ }}>
|
|
|
+ <div style={{
|
|
|
+ minWidth: '90px',
|
|
|
+ fontSize: '14px',
|
|
|
+ color: '#333333',
|
|
|
+ }}>{billModel.caption}</div>
|
|
|
+ <div className={!billModel.allowBlank
|
|
|
+ ? 'form-input-fill'
|
|
|
+ : 'visibleHidden'}>*
|
|
|
</div>
|
|
|
- <span className='promptText'>(不能超过100MB)</span>
|
|
|
</div>
|
|
|
- </Upload>
|
|
|
- </div>
|
|
|
+
|
|
|
+ {
|
|
|
+ billReadOnly(billModel) ||
|
|
|
+ <div style={{ display: 'flex', alignItems: 'center' }}>
|
|
|
+ <div
|
|
|
+ className={'uploadBtn'}>
|
|
|
+ <UploadOutlined
|
|
|
+ style={{ color: 'white' }}/>
|
|
|
+ <span
|
|
|
+ style={{ fontSize: '12px', marginLeft: '6px' }}>选择文件</span>
|
|
|
+ </div>
|
|
|
+ <span className='promptText'>(不能超过100MB)</span>
|
|
|
+ </div>
|
|
|
+ }
|
|
|
+ </div>
|
|
|
+ </Upload>
|
|
|
}
|
|
|
|
|
|
handleChange = ({ fileList }) => {
|
|
|
- console.log('filelist', fileList)
|
|
|
if (uploadFail) {
|
|
|
return
|
|
|
}
|
|
|
- const { count } = this.props
|
|
|
+ const { count, onTextChange, groupIndex, childIndex } = this.props
|
|
|
const { billModel } = this.state
|
|
|
if (isObjNull(count) || fileList.length <= count) {
|
|
|
//{"success":true,"id":"[52650]"}
|
|
|
@@ -122,15 +141,20 @@ export default class FormEnclosure extends Component {
|
|
|
if (fileList) {
|
|
|
fileList.forEach((file, index) => {
|
|
|
file.enclosureId = (file.response && file.response.id)
|
|
|
- ? file.response.id
|
|
|
- : ''
|
|
|
+ ? getBracketStr(file.response.id)
|
|
|
+ : file.enclosureId
|
|
|
+ if (file.enclosureId) {
|
|
|
+ value = value + file.enclosureId + ';'
|
|
|
+ file.url = this.props.baseUrl + '/common/downloadbyId.action?id=' +
|
|
|
+ file.enclosureId
|
|
|
+ + '&master=' + store.getState().userState.accountCode
|
|
|
+ }
|
|
|
})
|
|
|
}
|
|
|
+ console.log(fileList)
|
|
|
billModel.fileList = fileList
|
|
|
this.setState({ billModel })
|
|
|
- // this.props.onTextChange &&
|
|
|
- // this.props.onTextChange(this.props.groupIndex, this.props.childIndex,
|
|
|
- // value)
|
|
|
+ onTextChange && onTextChange(groupIndex, childIndex, value)
|
|
|
}
|
|
|
}
|
|
|
|