From 0f79daefced8980fa571dd3d2c781a0e3646614f Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 24 十一月 2020 16:57:19 +0800 Subject: [PATCH] 2020-11-24 --- src/templates/zshare/verifycard/uniqueform/index.jsx | 56 +++++++++++++------------------------------------------- 1 files changed, 13 insertions(+), 43 deletions(-) diff --git a/src/templates/zshare/verifycard/uniqueform/index.jsx b/src/templates/zshare/verifycard/uniqueform/index.jsx index 5468de8..8566289 100644 --- a/src/templates/zshare/verifycard/uniqueform/index.jsx +++ b/src/templates/zshare/verifycard/uniqueform/index.jsx @@ -3,7 +3,6 @@ import { Form, Row, Col, Select, Button } from 'antd' import './index.scss' - class UniqueForm extends Component { static propTpyes = { btn: PropTypes.object, // 瀛楀吀椤� @@ -12,53 +11,24 @@ uniqueChange: PropTypes.func // 淇敼鍑芥暟 } - state = { - editItem: null // 缂栬緫鍏冪礌 - } - - edit = (record) => { - const { btn } = this.props - - this.setState({ - editItem: record - }) - - let _value = { - field: record.field.split(',') - } - - if (btn.Ot !== 'requiredOnce') { - _value.errorCode = record.errorCode - _value.verifyType = record.verifyType || 'physical' - } - - this.props.form.setFieldsValue(_value) - } - - handleConfirm = () => { const { fields } = this.props + let change = {} + + fields.forEach(col => { + change[col.field] = col.label + }) // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� 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 + return change[field] || '' }) values.fieldlabel = values.fieldlabel.join(',') values.field = values.field.join(',') - this.setState({ - editItem: null - }, () => { - this.props.uniqueChange(values) - }) + this.props.uniqueChange(values) this.props.form.setFieldsValue({ field: [], }) @@ -84,7 +54,7 @@ return ( <Form {...formItemLayout} className="verify-form" id="verifycard1"> <Row gutter={24}> - <Col span={8}> + <Col span={7}> <Form.Item label={'瀛楁鍚�'}> {getFieldDecorator('field', { initialValue: [], @@ -99,13 +69,13 @@ mode="multiple" > {fields.map(item => ( - <Select.Option key={item.uuid} value={item.field}>{item.field}</Select.Option> + <Select.Option key={item.uuid} value={item.field}>{item.label}</Select.Option> ))} </Select> )} </Form.Item> </Col> - {btn.Ot !== 'requiredOnce' ? <Col span={6}> + {btn.Ot !== 'requiredOnce' ? <Col span={7}> <Form.Item label={'鎶ラ敊缂栫爜'}> {getFieldDecorator('errorCode', { initialValue: 'E', @@ -125,7 +95,7 @@ )} </Form.Item> </Col> : null} - {btn.Ot !== 'requiredOnce' ? <Col span={6}> + {btn.Ot !== 'requiredOnce' ? <Col span={7}> <Form.Item label={'楠岃瘉绫诲瀷'}> {getFieldDecorator('verifyType', { initialValue: 'physical', @@ -143,9 +113,9 @@ )} </Form.Item> </Col> : null} - <Col span={4} className="add"> + <Col span={3} className="add"> <Button onClick={this.handleConfirm} className="mk-green"> - 淇濆瓨 + {this.props.dict['model.add']} </Button> </Col> </Row> -- Gitblit v1.8.0