king
2023-08-02 574ea3b532b625456c09f14fc11073aad6b61db7
src/menu/components/table/edit-table/columns/tableIn/customscript/index.jsx
@@ -1,6 +1,6 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { Form, Row, Col, Button, notification, Modal, Tooltip, Radio, Select } from 'antd'
import { Form, Row, Col, Button, notification, Modal, Tooltip, Radio, Select, Switch } from 'antd'
import { QuestionCircleOutlined } from '@ant-design/icons'
import moment from 'moment'
@@ -22,6 +22,7 @@
    editItem: null,
    usefulfields: null,
    loading: false,
    skip: false,
    verifySql: ''
  }
@@ -67,7 +68,7 @@
  handleConfirm = () => {
    const { type } = this.props
    const { editItem } = this.state
    const { editItem, skip } = this.state
    // 表单提交时检查输入值是否正确
    this.props.form.validateFieldsAndScroll((err, values) => {
      if (type === 'fullscreen' && err) {
@@ -209,6 +210,17 @@
        param.LText = Utils.formatOptions(param.LText)
        param.secretkey = Utils.encrypt('', param.timestamp)
        
        if (skip) {
          this.setState({
            editItem: null,
            skip: false
          }, () => {
            this.props.scriptsChange(values)
          })
          this.props.form.setFieldsValue({
            sql: ' '
          })
        } else {
        this.setState({loading: true})
        Api.genericInterface(param).then(res => {
          if (res.status) {
@@ -229,6 +241,7 @@
            })
          }
        })
        }
      }
    })
  }
@@ -287,7 +300,7 @@
  render() {
    const { systemScripts, btn, type } = this.props
    const { usefulfields, editItem } = this.state
    const { usefulfields, editItem, skip } = this.state
    const { getFieldDecorator } = this.props.form
    const formItemLayout = {
      labelCol: {
@@ -338,7 +351,7 @@
              )}
            </Form.Item>
          </Col> : null}
          {!type ? <Col span={10}>
          {!type ? <Col span={8}>
            <Form.Item style={{marginBottom: 0}} label={'快捷添加'}>
              <Select
                showSearch
@@ -360,14 +373,18 @@
              </Select>
            </Form.Item>
          </Col> : null}
          <Col span={6} className="add">
            <Button onClick={this.handleConfirm} loading={this.state.loading} className="mk-green" style={{marginBottom: 15, marginLeft: 40}}>
          <Col span={5} style={{paddingTop: '3px', whiteSpace: 'nowrap'}}>
            <Button onClick={this.handleConfirm} loading={this.state.loading} className="mk-green" style={{marginBottom: 15, marginLeft: 15}}>
              {type === 'fullscreen' && !editItem ? '添加' : '保存'}
            </Button>
            <Button onClick={this.handleCancel} style={{marginBottom: 15, marginLeft: 10}}>
              取消
            </Button>
          </Col>
          <Col span={3} style={{paddingTop: '12px', 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', {