From 862b6cf69dc925a6138a7ebf79b782a5d7791202 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 03 一月 2020 12:13:52 +0800 Subject: [PATCH] 2020-01-03 --- src/tabviews/tableshare/mutilform/index.jsx | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 56 insertions(+), 0 deletions(-) diff --git a/src/tabviews/tableshare/mutilform/index.jsx b/src/tabviews/tableshare/mutilform/index.jsx index ca13bc6..dc8dd96 100644 --- a/src/tabviews/tableshare/mutilform/index.jsx +++ b/src/tabviews/tableshare/mutilform/index.jsx @@ -3,6 +3,7 @@ import { Form, Row, Col, Input, InputNumber, Select, DatePicker, notification } from 'antd' import moment from 'moment' import Utils from '@/utils/utils.js' +import FileUpload from '../fileupload' import './index.scss' const {MonthPicker} = DatePicker @@ -372,6 +373,42 @@ </Form.Item> </Col> ) + } else if (item.type === 'fileupload') { + // let filelist = this.props.data ? this.props.data[item.field] : item.initval + let filelist = 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png,https://img.alicdn.com/tfs/TB1Ly5oS3HqK1RjSZFPXXcwapXa-238-54.png' + if (filelist) { + try { + filelist = filelist.split(',').map((url, index) => { + return { + uid: `${index}`, + name: url.slice(url.lastIndexOf('/') + 1), + status: 'done', + url: url, + origin: true + } + }) + } catch { + filelist = [] + } + } + + fields.push( + <Col span={24 / cols} key={index}> + <Form.Item label={item.label}> + {getFieldDecorator(item.field, { + initialValue: filelist, + rules: [ + { + required: item.required === 'true', + message: this.props.dict['form.required.select'] + item.label + '!' + } + ] + })( + <FileUpload /> + )} + </Form.Item> + </Col> + ) } }) @@ -432,6 +469,25 @@ key: key, value: values[key] ? values[key].join(',') : '' }) + } else if (this.state.datatype[key] === 'fileupload') { + let vals = [] + + if (values[key].length > 0) { + values[key].forEach(_val => { + if (_val.origin && _val.url) { + vals.push(_val.url) + } else if (!_val.origin && _val.status === 'done' && _val.response) { + vals.push(Utils.getrealurl(_val.response)) + } + }) + } + + search.push({ + type: this.state.datatype[key], + readonly: this.state.readtype[key], + key: key, + value: vals.join(',') + }) } else { search.push({ type: this.state.datatype[key], -- Gitblit v1.8.0