king
2020-04-09 2ff464f30d94235b3ad04475593b75a74a354de9
src/templates/zshare/verifycard/customscript/index.jsx
@@ -1,6 +1,10 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { Form, Row, Col, Input, Button, notification } from 'antd'
import moment from 'moment'
import Utils from '@/utils/utils.js'
import Api from '@/api'
import './index.scss'
const { TextArea } = Input
@@ -9,11 +13,13 @@
  static propTpyes = {
    dict: PropTypes.object,         // 字典项
    usefulfields: PropTypes.string, // 可用字段
    initsql: PropTypes.string,      // 可用字段
    scriptsChange: PropTypes.func   // 表单
  }
  state = {
    editItem: null
    editItem: null,
    loading: false
  }
  edit = (record) => {
@@ -64,12 +70,33 @@
          return
        }
        let param = {
          func: 's_debug_sql',
          LText: this.props.initsql + values.sql
        }
        param.LText = Utils.formatOptions(param.LText)
        param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000'
        param.secretkey = Utils.encrypt(param.LText, param.timestamp)
        this.setState({loading: true})
        Api.getLocalConfig(param).then(res => {
          if (res.status) {
        this.props.scriptsChange(values)
        this.setState({
              loading: false,
          editItem: null
        })
        this.props.form.setFieldsValue({
          sql: ''
            })
          } else {
            this.setState({loading: false})
            notification.warning({
              top: 92,
              message: res.message,
              duration: 10
            })
          }
        })
      }
    })
@@ -111,7 +138,7 @@
            </Form.Item>
          </Col>
          <Col span={3} className="add">
            <Button onClick={this.handleConfirm} type="primary" className="add-row">
            <Button onClick={this.handleConfirm} loading={this.state.loading} type="primary" className="add-row">
              确定
            </Button>
          </Col>