From 2031a460f6c0827fe80f8c625dd98333d1631d2f Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 08 五月 2020 22:10:48 +0800 Subject: [PATCH] 2020-05-08 --- src/templates/zshare/verifycard/customscript/index.jsx | 50 ++++++++++++++++++++++++++------------------------ 1 files changed, 26 insertions(+), 24 deletions(-) diff --git a/src/templates/zshare/verifycard/customscript/index.jsx b/src/templates/zshare/verifycard/customscript/index.jsx index b1fabe2..04781fd 100644 --- a/src/templates/zshare/verifycard/customscript/index.jsx +++ b/src/templates/zshare/verifycard/customscript/index.jsx @@ -1,6 +1,6 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import { Form, Row, Col, Input, Button, notification, Modal, Menu, Tooltip, Icon, Radio, Dropdown } from 'antd' +import { Form, Row, Col, Input, Button, notification, Modal, Tooltip, Icon, Radio, Select } from 'antd' import moment from 'moment' import Utils from '@/utils/utils.js' @@ -131,11 +131,7 @@ }) } - selectScript = (e) => { - const { systemScripts } = this.props - - let option = systemScripts[+e.key] - + selectScript = (value, option) => { let _sql = this.props.form.getFieldValue('sql') if (_sql) { _sql = _sql + ` @@ -144,10 +140,10 @@ } _sql = _sql.replace(/\s{6}$/, '') - _sql = _sql + `/*${option.name}*/ + _sql = _sql + `/*${option.props.children}*/ ` _sql = _sql.replace(/\s{4}$/, '') - _sql = _sql + option.value + _sql = _sql + value this.props.form.setFieldsValue({ sql: _sql @@ -169,8 +165,18 @@ } return ( - <Form {...formItemLayout} className="verify-form" id="verifycard2"> + <Form {...formItemLayout} className="verify-form" id="verify-custom-scripts"> <Row gutter={24}> + {btn.sql ? <Col span={8}> + <Form.Item label={'琛ㄥ悕'} style={{whiteSpace: 'nowrap', margin: 0}}> + {btn.sql} + </Form.Item> + </Col> : null} + <Col span={16}> + <Form.Item label={'鎶ラ敊瀛楁'} style={{margin: 0}}> + errorCode, errmsg + </Form.Item> + </Col> {usefulfields ? <Col span={24} className="sqlfield"> <Form.Item label={'鍙敤瀛楁'}> {usefulfields} @@ -194,28 +200,24 @@ )} </Form.Item> </Col> - <Col span={4} style={{lineHeight: '40px', textAlign: 'center'}}> - <Dropdown trigger={['click']} overlayClassName="mk-normal-dropdown" overlay={ - <Menu onClick={this.selectScript}> + <Col span={10}> + <Form.Item label={'蹇嵎娣诲姞'} style={{marginBottom: 0}}> + <Select + showSearch + filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} + onChange={this.selectScript} + getPopupContainer={() => document.getElementById('verify-custom-scripts')} + > {systemScripts.map((option, i) => - <Menu.Item key={i}>{option.name}</Menu.Item> + <Select.Option key={i} value={option.value}>{option.name}</Select.Option> )} - </Menu> - }> - <span style={{color: '#1890ff', display: 'inline-block', cursor: 'pointer'}}> - 蹇嵎娣诲姞 <Icon type="down" style={{marginRight: '5px'}} /> - </span> - </Dropdown> + </Select> + </Form.Item> </Col> <Col span={4} className="add"> <Button onClick={this.handleConfirm} loading={this.state.loading} className="mk-green" style={{marginBottom: 15, marginLeft: 40}}> 淇濆瓨 </Button> - </Col> - <Col span={8} style={{textAlign: 'right'}}> - {btn.sql ? <span style={{maxWidth: '100%', display: 'inline-block', position: 'relative', top: '20px', whiteSpace: 'nowrap', textOverflow: 'ellipsis', overflow: 'hidden'}}> - 琛ㄥ悕: {btn.sql} - </span> : null} </Col> <Col span={24} className="sql"> <Form.Item label={'sql'}> -- Gitblit v1.8.0