king
2024-12-05 4a356e81b1a456f0cb16f61f548c46171c26c1b6
src/menu/datasource/verifycard/index.jsx
@@ -1,7 +1,7 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { fromJS } from 'immutable'
import { Form, Tabs, Popconfirm, notification, Modal, Typography, Spin, message, Button, Input } from 'antd'
import { Form, Tabs, Popconfirm, notification, Modal, Typography, Spin, message, Button, Input, Switch } from 'antd'
import { StopOutlined, CheckCircleOutlined, TableOutlined, EditOutlined, SwapOutlined, DeleteOutlined, CopyOutlined, BorderOutlined, SnippetsOutlined } from '@ant-design/icons'
import moment from 'moment'
@@ -40,6 +40,7 @@
    subColumns: [],
    activeKey: 'setting',
    loading: false,
    skip: false,
    colLoading: false,
    searchKey: '',
    usefulfields: '',
@@ -832,7 +833,7 @@
  }
  triggerConfirm = () => {
    const { script, scriptValue, scripts } = this.state
    const { script, scriptValue, scripts, skip } = this.state
    let _scripts = fromJS(scripts).toJS()
    if (!scriptValue) {
@@ -865,9 +866,13 @@
      _scripts.push(_script)
    }
    if (skip) {
      this.setState({scripts: _scripts, script: null, scriptValue: '', editLineId})
    } else {
    this.setState({loading: true, editLineId})
    this.sqlverify(() => {this.setState({scripts: _scripts, script: null, scriptValue: '', loading: false})}, () => {this.setState({loading: false})}, 'script', _scripts)
    }
  }
  updatefields = (columns) => {
@@ -1228,7 +1233,7 @@
  render() {
    const { config } = this.props
    const { columns, subColumns, median, setting, scripts, colColumns, scriptsColumns, activeKey, loading, searches, defaultsql, visible, pvisible, reload, script, scriptValue, searchKey, editLineId } = this.state
    const { columns, subColumns, median, skip, setting, scripts, colColumns, scriptsColumns, activeKey, loading, searches, defaultsql, visible, pvisible, reload, script, scriptValue, searchKey, editLineId } = this.state
    return (
      <div className="model-data-source-wrap">
@@ -1313,7 +1318,7 @@
                })
                return
              }
              this.setState({visible: true, script: null, scriptValue: '', editLineId: ''})
              this.setState({visible: true, skip: false, script: null, scriptValue: '', editLineId: ''})
            }}/> : null}
            <CustomScriptsForm
              type={config.type}
@@ -1321,7 +1326,6 @@
              setting={setting}
              searches={searches}
              defaultsql={defaultsql}
              customScripts={scripts}
              systemScripts={this.state.systemScripts}
              scriptsChange={this.scriptsChange}
              scriptSubmit={this.scriptSubmit}
@@ -1405,6 +1409,10 @@
            <Button onClick={() => {this.setState({script: null, scriptValue: ''})}} style={{marginBottom: 15, marginLeft: 10}}>
              取消
            </Button>
            <span style={{paddingLeft: '20px', fontSize: '12px'}}>
              强制保存:
              <Switch checked={skip} size="small" onChange={() => this.setState({skip: !skip})}/>
            </span>
          </div>
          <CodeMirror value={scriptValue} onChange={(val) => {this.setState({scriptValue: val})}}></CodeMirror>
        </Modal>