king
2023-08-02 574ea3b532b625456c09f14fc11073aad6b61db7
src/menu/datasource/verifycard/customscript/index.jsx
@@ -1,7 +1,7 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { is, fromJS } from 'immutable'
import { Form, Row, Col, Button, notification, Select, Tooltip, Modal } from 'antd'
import { Form, Row, Col, Button, notification, Select, Tooltip, Modal, Switch } from 'antd'
import Toast from 'antd-mobile/es/components/toast'
import Dialog from 'antd-mobile/es/components/dialog'
@@ -22,6 +22,7 @@
  }
  state = {
    skip: false,
    editItem: null,
    loading: false,
    usefulFields: ''
@@ -100,6 +101,7 @@
  }
  handleConfirm = () => {
    const { skip } = this.state
    // 表单提交时检查输入值是否正确
    this.props.form.validateFieldsAndScroll((err, values) => {
      if (!err) {
@@ -163,11 +165,10 @@
          return
        }
        this.setState({loading: true})
        this.props.scriptsChange(values).then(() => {
        if (skip) {
          this.setState({
            editItem: null,
            loading: false
            skip: false
          })
          if (values.uuid) {
@@ -178,11 +179,28 @@
            sql: ' '
          })
          this.props.scriptSubmit(values)
        }, () => {
          this.setState({
            loading: false
        } else {
          this.setState({loading: true})
          this.props.scriptsChange(values).then(() => {
            this.setState({
              editItem: null,
              loading: false
            })
            if (values.uuid) {
              MKEmitter.emit('editLineId', values.uuid)
            }
            this.props.form.setFieldsValue({
              sql: ' '
            })
            this.props.scriptSubmit(values)
          }, () => {
            this.setState({
              loading: false
            })
          })
        })
        }
      }
    })
  }
@@ -258,7 +276,7 @@
  render() {
    const { systemScripts, setting, type } = this.props
    const { getFieldDecorator } = this.props.form
    const { usefulFields } = this.state
    const { usefulFields, skip } = this.state
    let urlFields = window.GLOB.urlFields ? window.GLOB.urlFields.join(', ') : ''
@@ -312,7 +330,7 @@
              </Select>
            </Form.Item>
          </Col>
          <Col span={6} className="add">
          <Col span={5} style={{whiteSpace: 'nowrap'}}>
            <Button onClick={this.handleConfirm} loading={this.state.loading} className="mk-green" style={{marginTop: 5, marginBottom: 15, marginLeft: 30}}>
              保存
            </Button>
@@ -320,6 +338,10 @@
              取消
            </Button>
          </Col>
          <Col span={3} style={{paddingTop: '15px', fontSize: '12px', whiteSpace: 'nowrap'}}>
            强制保存:
            <Switch checked={skip} size="small" onChange={() => this.setState({skip: !skip})}/>
          </Col>
          <Col span={24} className="sql">
            <Form.Item label="sql">
              {getFieldDecorator('sql', {