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/sharecomponent/actioncomponent/verifyexcelin/columnform/index.jsx | 75 +++++++++---------------------------- 1 files changed, 19 insertions(+), 56 deletions(-) diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelin/columnform/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelin/columnform/index.jsx index 2cf05f4..4ae7e6a 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelin/columnform/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelin/columnform/index.jsx @@ -6,45 +6,12 @@ class ExcelInColumn extends Component { static propTpyes = { dict: PropTypes.object, // 瀛楀吀椤� - columns: PropTypes.array, // 鍒楀悕闆嗗悎 columnChange: PropTypes.func // 淇敼鍑芥暟 } state = { - editItem: null, // 缂栬緫鍏冪礌 type: 'Nvarchar(50)', locked: false - } - - edit = (record) => { - this.setState({ - editItem: record, - type: record.type || 'Nvarchar(50)' - }, () => { - if (!/^Nvarchar/.test(record.type)) { - this.props.form.setFieldsValue({ - min: record.min, - max: record.max - }) - } - }) - - this.props.form.setFieldsValue({ - Column: record.Column, - Text: record.Text, - required: record.required || 'true', - import: record.import || 'true', - type: record.type - }) - if (record.type === 'Int' || /^Decimal/ig.test(record.type)) { - this.setState({ - locked: true - }) - } else { - this.setState({ - locked: false - }) - } } typeChange = (val) => { @@ -68,12 +35,9 @@ handleConfirm = () => { - // const { columns } = this.props // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� this.props.form.validateFieldsAndScroll((err, values) => { if (!err) { - values.uuid = this.state.editItem ? this.state.editItem.uuid : '' - if (/^Nvarchar/ig.test(values.type)) { values.limit = values.type.match(/\d+/) ? values.type.match(/\d+/)[0] : '20000' } else if (/^Decimal/ig.test(values.type)) { @@ -84,7 +48,6 @@ this.props.columnChange(values) this.setState({ - editItem: null, locked: false, type: 'Nvarchar(50)' }) @@ -113,12 +76,10 @@ } } - let haslimit = !/^Nvarchar/.test(this.state.type) - return ( <Form {...formItemLayout} className="verify-form"> <Row gutter={24}> - <Col span={7}> + <Col span={6}> <Form.Item label={dict['model.form.field']}> {getFieldDecorator('Column', { initialValue: '', @@ -131,7 +92,7 @@ })(<Input placeholder="" autoComplete="off" />)} </Form.Item> </Col> - <Col span={7}> + <Col span={6}> <Form.Item label={dict['model.name']}> {getFieldDecorator('Text', { initialValue: '', @@ -144,7 +105,7 @@ })(<Input placeholder="" autoComplete="off" />)} </Form.Item> </Col> - <Col span={7}> + <Col span={6}> <Form.Item label={dict['model.form.type']}> {getFieldDecorator('type', { initialValue: 'Nvarchar(50)' @@ -169,12 +130,7 @@ )} </Form.Item> </Col> - <Col span={3} className="add"> - <Button onClick={this.handleConfirm} type="primary" className="mk-green"> - {dict['model.save']} - </Button> - </Col> - <Col span={7}> + <Col span={6}> <Form.Item label={dict['model.required']}> {getFieldDecorator('required', { initialValue: 'true' @@ -186,8 +142,8 @@ )} </Form.Item> </Col> - <Col span={7}> - <Form.Item label={dict['model.import']}> + <Col span={6}> + <Form.Item style={{marginBottom: 0}} label={dict['model.import']}> {getFieldDecorator('import', { initialValue: 'true' })( @@ -198,20 +154,27 @@ )} </Form.Item> </Col> - {haslimit ? <Col span={7}> - <Form.Item label={'鏈�灏忓��'}> + <Col span={6}> + <Form.Item style={{marginBottom: 0}} label={'鏈�灏忓��'}> {getFieldDecorator('min', { initialValue: '' })(<InputNumber />)} </Form.Item> - </Col> : null} - {haslimit ? <Col span={7}> - <Form.Item label={'鏈�澶у��'}> + </Col> + <Col span={6}> + <Form.Item style={{marginBottom: 0}} label={'鏈�澶у��'}> {getFieldDecorator('max', { initialValue: '' })(<InputNumber />)} </Form.Item> - </Col> : null} + </Col> + <Col span={6}> + <Form.Item style={{marginBottom: 0}} label={' '} colon={false}> + <Button onClick={this.handleConfirm} type="primary" className="mk-green"> + {dict['model.add']} + </Button> + </Form.Item> + </Col> </Row> </Form> ) -- Gitblit v1.8.0