From 669d7cc31eb3728ad09bfb7ce6e615f5c571c14e Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 08 一月 2020 15:58:39 +0800 Subject: [PATCH] 2020-01-08 --- src/templates/tableshare/verifycard/uniqueform/index.jsx | 40 ++++++++++++++++++---------------------- 1 files changed, 18 insertions(+), 22 deletions(-) diff --git a/src/templates/tableshare/verifycard/uniqueform/index.jsx b/src/templates/tableshare/verifycard/uniqueform/index.jsx index e9c05ba..9e4b5f1 100644 --- a/src/templates/tableshare/verifycard/uniqueform/index.jsx +++ b/src/templates/tableshare/verifycard/uniqueform/index.jsx @@ -1,37 +1,48 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import { Form, Row, Col, Input, Select, Button } from 'antd' +import { Form, Row, Col, Select, Button } from 'antd' import './index.scss' class UniqueForm extends Component { static propTpyes = { - dict: PropTypes.object, // 瀛楀吀椤� - fields: PropTypes.array, // 琛ㄥ崟 - uniqueChange: PropTypes.func // 琛ㄥ崟 + dict: PropTypes.object, // 瀛楀吀椤� + fields: PropTypes.array, // 琛ㄥ崟瀛楁 + uniqueChange: PropTypes.func // 淇敼鍑芥暟 } state = { - editItem: null + editItem: null // 缂栬緫鍏冪礌 } edit = (record) => { this.setState({ editItem: record }) + this.props.form.setFieldsValue({ field: record.field.split(','), - errmsg: record.errmsg, errorCode: record.errorCode }) } handleConfirm = () => { + const { fields } = this.props // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� this.props.form.validateFieldsAndScroll((err, values) => { if (!err) { values.uuid = this.state.editItem ? this.state.editItem.uuid : '' + values.fieldlabel = values.field.map(field => { + let item = fields.filter(cell => cell.field === field)[0] + let label = '' + if (item) { + label = item.label + } + return label + }) + + values.fieldlabel = values.fieldlabel.join(',') values.field = values.field.join(',') this.props.uniqueChange(values) @@ -40,7 +51,6 @@ }) this.props.form.setFieldsValue({ field: [], - errmsg: '' }) } }) @@ -59,6 +69,7 @@ sm: { span: 16 } } } + return ( <Form {...formItemLayout} className="verify-form" id="verifycard1"> <Row gutter={24}> @@ -84,19 +95,6 @@ </Form.Item> </Col> <Col span={6}> - <Form.Item label={'鎻愮ず淇℃伅'}> - {getFieldDecorator('errmsg', { - initialValue: '', - rules: [ - { - required: true, - message: this.props.dict['form.required.input'] + '鎻愮ず淇℃伅!' - } - ] - })(<Input placeholder="" autoComplete="off" />)} - </Form.Item> - </Col> - <Col span={6}> <Form.Item label={'鎶ラ敊缂栫爜'}> {getFieldDecorator('errorCode', { initialValue: 'E', @@ -112,8 +110,6 @@ <Select.Option value="N"> N </Select.Option> <Select.Option value="F"> F </Select.Option> <Select.Option value="NM"> NM </Select.Option> - <Select.Option value="S"> S </Select.Option> - <Select.Option value="-1"> -1 </Select.Option> </Select> )} </Form.Item> -- Gitblit v1.8.0