king
2020-04-17 bf772e586c29b4858366dbad143b1eaeca3c46ed
src/templates/zshare/verifycardexcelin/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 } from 'antd'
import { Form, Row, Col, Input, Button, notification, Modal, Select, Icon, Tooltip, Radio } from 'antd'
import moment from 'moment'
import Utils from '@/utils/utils.js'
@@ -16,6 +16,7 @@
    scripts: PropTypes.array,       // 自定义脚本列表
    isdefault: PropTypes.any,       // 是否使用默认sql
    usefulfields: PropTypes.any,    // 可用字段
    systemScripts: PropTypes.array, // 系统脚本
    scriptsChange: PropTypes.func   // 表单
  }
@@ -67,7 +68,8 @@
    })
    this.props.form.setFieldsValue({
      sql: record.sql
      sql: record.sql,
      position: record.position || 'back'
    })
  }
@@ -158,7 +160,14 @@
    })
  }
  selectScript = (val) => {
    this.props.form.setFieldsValue({
      sql: val
    })
  }
  render() {
    const { systemScripts } = this.props
    const { usefulfields } = this.state
    const { getFieldDecorator } = this.props.form
    const formItemLayout = {
@@ -180,7 +189,7 @@
              {usefulfields}
            </Form.Item>
          </Col> : null}
          <Col span={21} className="sql">
          <Col span={20} className="sql">
            <Form.Item label={'sql'}>
              {getFieldDecorator('sql', {
                initialValue: '',
@@ -193,10 +202,39 @@
              })(<TextArea rows={15} />)}
            </Form.Item>
          </Col>
          <Col span={3} className="add">
            <Button onClick={this.handleConfirm} loading={this.state.loading} type="primary" className="add-row">
          <Col span={4} className="add">
            <Button onClick={this.handleConfirm} loading={this.state.loading} type="primary" style={{marginBottom: 20}}>
              确定
            </Button>
            <Form.Item labelAlign="left" label={
              <Tooltip placement="bottomLeft" title={'自定义脚本与默认sql位置关系。'}>
                <Icon type="question-circle" style={{color: '#c49f47', marginRight: '5px'}} />
                执行位置
              </Tooltip>
            } labelCol={{xs: { span: 24 }, sm: { span: 24 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 24 }} }>
              {getFieldDecorator('position', {
                initialValue: 'back'
              })(
                <Radio.Group>
                  <Radio value="front">sql前</Radio>
                  <Radio value="back">sql后</Radio>
                </Radio.Group>
              )}
            </Form.Item>
            <Form.Item labelAlign="left" label={
              <Tooltip placement="bottomLeft" title={'从系统函数集中选择需要的函数,可快速添加至sql中。'}>
                <Icon type="question-circle" style={{color: '#c49f47', marginRight: '5px'}} />
                快捷添加
              </Tooltip>
            } labelCol={{xs: { span: 24 }, sm: { span: 24 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 24 }} }>
              <Select onChange={this.selectScript}>
                {systemScripts.map((option, i) =>
                  <Select.Option title={option.name} key={i} value={option.value}>
                    {option.name}
                  </Select.Option>
                )}
              </Select>
            </Form.Item>
          </Col>
        </Row>
      </Form>