|
|
@@ -17,9 +17,6 @@ import {
|
|
|
} from 'antd-mobile'
|
|
|
import { isObjEmpty, isObjNull } from '../../utils/common'
|
|
|
import moment from 'moment'
|
|
|
-import { Upload, Button, Icon } from 'antd'
|
|
|
-
|
|
|
-let uploadFail = false
|
|
|
|
|
|
export default class FormInput extends Component {
|
|
|
|
|
|
@@ -69,10 +66,6 @@ export default class FormInput extends Component {
|
|
|
valueItem =
|
|
|
this.getHtmlcom(billModel)
|
|
|
break
|
|
|
- // case 'MF':
|
|
|
- // valueItem =
|
|
|
- // this.getEnclosureCom(billModel)
|
|
|
- // break
|
|
|
default:
|
|
|
valueItem =
|
|
|
this.getTextCom(billModel)
|
|
|
@@ -82,9 +75,7 @@ export default class FormInput extends Component {
|
|
|
(type === 'DT' || type === 'D' || type === 'T') ? <div>
|
|
|
{valueItem}
|
|
|
</div> :
|
|
|
- (type === 'MS'
|
|
|
- // || type === 'MF'
|
|
|
- ) ? (this.renderTwoLines(
|
|
|
+ (type === 'MS') ? (this.renderTwoLines(
|
|
|
billModel,
|
|
|
valueItem)) :
|
|
|
(this.renderNormal(billModel, valueItem, modalOpen, modalList))
|
|
|
@@ -260,100 +251,6 @@ export default class FormInput 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={false}
|
|
|
- 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'}>
|
|
|
- <Icon type="upload"
|
|
|
- style={{ color: 'white' }}/>
|
|
|
- <span style={{ fontSize: '12px', marginLeft: '6px' }}>选择文件</span>
|
|
|
- </div>
|
|
|
- <span className='promptText'>(不能超过100MB)</span>
|
|
|
- </div>
|
|
|
- </Upload>
|
|
|
- </div>
|
|
|
- }
|
|
|
-
|
|
|
- handleChange = ({ fileList }) => {
|
|
|
- console.log('filelist', fileList)
|
|
|
- if (uploadFail) {
|
|
|
- return
|
|
|
- }
|
|
|
- const { count } = this.props
|
|
|
- const { billModel } = this.state
|
|
|
- if (isObjNull(count) || fileList.length <= count) {
|
|
|
- /*if (fileList) {
|
|
|
- fileList.forEach((value, index) => {
|
|
|
- value.url = (value.response && value.response.data)
|
|
|
- ? value.response.data.accessPath
|
|
|
- : value.url
|
|
|
- value.picUrl = value.url
|
|
|
- value.relativeUrl = (value.response && value.response.data)
|
|
|
- ? value.response.data.fullPath
|
|
|
- : value.relativeUrl
|
|
|
- })
|
|
|
- }*/
|
|
|
- billModel.fileList = fileList
|
|
|
- console.log('raomeng', billModel)
|
|
|
- this.setState({ billModel })
|
|
|
- this.props.handleChange && this.props.handleChange(fileList)
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- handleRemove = (file) => {
|
|
|
- if (this.props.handleRemove) {
|
|
|
- return this.props.handleRemove(file)
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- beforeUpload = (file, fileList) => {
|
|
|
- uploadFail = false
|
|
|
- if (file.size && file.size > 100 * 1024 * 1024) {
|
|
|
- uploadFail = false
|
|
|
- Toast.fail('文件大小不能超过100M')
|
|
|
- return false
|
|
|
- }
|
|
|
- const { count } = this.props
|
|
|
- const { billModel } = this.state
|
|
|
- if (count && billModel.fileList &&
|
|
|
- ((billModel.fileList.length + fileList.length) > count)) {
|
|
|
- Toast.fail(`上传失败,附件数量不能超过${count}`)
|
|
|
- uploadFail = true
|
|
|
- return false
|
|
|
- } else {
|
|
|
- return this.props.beforeUpload
|
|
|
- ? this.props.beforeUpload(file, fileList)
|
|
|
- : true
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- handlePreview = (file) => {
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
onTextChange = value => {
|
|
|
const { billModel } = this.state
|
|
|
billModel.value = value
|